forked from aylac.top/nixcfg
this repo has no description
1{ 2 config, 3 lib, 4 ... 5}: let 6 name = "jellyfin"; 7 cfg = config.myNixOS.services.${name}; 8 9 network = config.mySnippets.tailnet; 10 service = network.networkMap.${name}; 11 12 dataDirectory = "/var/lib"; 13in { 14 options.myNixOS.services.${name} = { 15 enable = lib.mkEnableOption "${name} server"; 16 autoProxy = lib.mkOption { 17 default = true; 18 example = false; 19 description = "${name} auto proxy"; 20 type = lib.types.bool; 21 }; 22 }; 23 24 config = lib.mkIf cfg.enable { 25 services = { 26 caddy.virtualHosts."${service.vHost}".extraConfig = lib.mkIf cfg.autoProxy '' 27 bind tailscale/${name} 28 encode zstd gzip 29 reverse_proxy ${service.hostName}:${toString service.port} { 30 flush_interval -1 31 } 32 ''; 33 34 jellyfin = { 35 enable = true; 36 openFirewall = true; 37 dataDir = "${dataDirectory}/jellyfin"; 38 }; 39 }; 40 }; 41}