forked from jan-leila/nix-config
		
	
		
			
				
	
	
		
			43 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			43 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
| {
 | |
|   lib,
 | |
|   config,
 | |
|   ...
 | |
| }: let
 | |
|   const = import ./const.nix;
 | |
|   httpPort = const.httpPort;
 | |
| in {
 | |
|   options.services.forgejo = {
 | |
|     reverseProxy = {
 | |
|       enable = lib.mkOption {
 | |
|         type = lib.types.bool;
 | |
|         default = config.services.forgejo.enable && config.services.reverseProxy.enable;
 | |
|       };
 | |
|       domain = lib.mkOption {
 | |
|         type = lib.types.str;
 | |
|         description = "domain that forgejo will be hosted at";
 | |
|         default = "git.jan-leila.com";
 | |
|       };
 | |
|       extraDomains = lib.mkOption {
 | |
|         type = lib.types.listOf lib.types.str;
 | |
|         description = "extra domains that should be configured for forgejo";
 | |
|         default = [];
 | |
|       };
 | |
|     };
 | |
|   };
 | |
| 
 | |
|   config = lib.mkIf config.services.forgejo.reverseProxy.enable {
 | |
|     services.reverseProxy.services.forgejo = {
 | |
|       target = "http://localhost:${toString httpPort}";
 | |
|       domain = config.services.forgejo.reverseProxy.domain;
 | |
|       extraDomains = config.services.forgejo.reverseProxy.extraDomains;
 | |
| 
 | |
|       settings = {
 | |
|         forwardHeaders.enable = true;
 | |
|       };
 | |
|     };
 | |
| 
 | |
|     networking.firewall.allowedTCPPorts = [
 | |
|       config.services.forgejo.settings.server.SSH_LISTEN_PORT
 | |
|     ];
 | |
|   };
 | |
| }
 |