add forgejo module
This commit is contained in:
		
							parent
							
								
									0473f830f6
								
							
						
					
					
						commit
						256e282e2d
					
				
					 3 changed files with 81 additions and 0 deletions
				
			
		|  | @ -6,5 +6,6 @@ | |||
| }: { | ||||
|   imports = [ | ||||
|     ./trash | ||||
|     ./services | ||||
|   ]; | ||||
| } | ||||
|  |  | |||
							
								
								
									
										10
									
								
								nixos/services/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								nixos/services/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,10 @@ | |||
| { | ||||
|   config, | ||||
|   lib, | ||||
|   pkgs, | ||||
|   ... | ||||
| }: { | ||||
|   imports = [ | ||||
|     ./forgejo | ||||
|   ]; | ||||
| } | ||||
							
								
								
									
										70
									
								
								nixos/services/forgejo/default.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								nixos/services/forgejo/default.nix
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,70 @@ | |||
| { | ||||
|   config, | ||||
|   lib, | ||||
|   pkgs, | ||||
|   ... | ||||
| }: | ||||
| with lib; let | ||||
|   cfg = config.options.trivium.services.forgejo; | ||||
| in { | ||||
|   options.trivium.services.forgejo = { | ||||
|     enable = mkEnableOption "forgejo settings"; | ||||
| 
 | ||||
|     virtualHost = mkOption { | ||||
|       type = types.string; | ||||
|       description = "Virtualhost to use for nginx's reverse proxy. Usually something like git.<your server>.com"; | ||||
|     }; | ||||
| 
 | ||||
|     appName = mkOption { | ||||
|       type = types.string; | ||||
|       description = "You guess what this does"; | ||||
|     }; | ||||
| 
 | ||||
|     disableRegistration = mkOption { | ||||
|       type = types.bool; | ||||
|       default = true; | ||||
|       description = "Turn this off just to create the first admin account"; | ||||
|     }; | ||||
|   }; | ||||
| 
 | ||||
|   config = mkIf cfg.enable { | ||||
|     services = { | ||||
|       nginx = { | ||||
|         virtualHosts."${cfg.virtualHost}" = { | ||||
|           enableACME = true; | ||||
|           forceSSL = true; | ||||
|           extraConfig = '' | ||||
|             proxy_headers_hash_max_size 512; | ||||
|             proxy_headers_hash_bucket_size 128; | ||||
|           ''; | ||||
|           locations."/".proxyPass = "http://localhost:9170"; | ||||
|         }; | ||||
|       }; | ||||
| 
 | ||||
|       forgejo = { | ||||
|         enable = true; | ||||
|         lfs.enable = true; | ||||
|         useWizard = false; | ||||
|         settings = { | ||||
|           general.APP_NAME = "${cfg.appName}"; | ||||
|           ui.DEFAULT_THEME = "forgejo-dark"; | ||||
|           server = { | ||||
|             DOMAIN = "${cfg.virtualHost}"; | ||||
|             ROOT_URL = "https://${cfg.virtualHost}"; | ||||
|             HTTP_PORT = 9170; | ||||
|             LANDING_PAGE = "explore"; | ||||
|           }; | ||||
| 
 | ||||
|           service.DISABLE_REGISTRATION = ${cfg.disableRegistration}; | ||||
| 
 | ||||
|           actions = { | ||||
|             ENABLED = true; | ||||
|           }; | ||||
|           mailer = { | ||||
|             ENABLED = false; | ||||
|           }; | ||||
|         }; | ||||
|       }; | ||||
|     }; | ||||
|   }; | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue