41 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			Nix
		
	
	
	
	
	
{
 | 
						|
  lib,
 | 
						|
  config,
 | 
						|
  ...
 | 
						|
}: let
 | 
						|
  jellyfinPort = 8096;
 | 
						|
in {
 | 
						|
  options.services.jellyfin = {
 | 
						|
    domain = lib.mkOption {
 | 
						|
      type = lib.types.str;
 | 
						|
      description = "domain that jellyfin will be hosted at";
 | 
						|
      default = "jellyfin.arpa";
 | 
						|
    };
 | 
						|
    extraDomains = lib.mkOption {
 | 
						|
      type = lib.types.listOf lib.types.str;
 | 
						|
      description = "extra domains that should be configured for jellyfin";
 | 
						|
      default = [];
 | 
						|
    };
 | 
						|
    reverseProxy = {
 | 
						|
      enable = lib.mkOption {
 | 
						|
        type = lib.types.bool;
 | 
						|
        default = config.services.jellyfin.enable && config.services.reverseProxy.enable;
 | 
						|
      };
 | 
						|
    };
 | 
						|
  };
 | 
						|
 | 
						|
  config = lib.mkIf config.services.jellyfin.reverseProxy.enable {
 | 
						|
    services.reverseProxy.services.jellyfin = {
 | 
						|
      target = "http://localhost:${toString jellyfinPort}";
 | 
						|
      domain = config.services.jellyfin.domain;
 | 
						|
      extraDomains = config.services.jellyfin.extraDomains;
 | 
						|
 | 
						|
      settings = {
 | 
						|
        forwardHeaders.enable = true;
 | 
						|
        maxBodySize = 20;
 | 
						|
        noSniff.enable = true;
 | 
						|
        proxyBuffering.enable = false;
 | 
						|
      };
 | 
						|
    };
 | 
						|
  };
 | 
						|
}
 |