From 59bf355353f86a9cfcea1de92d523e8bb1a52458 Mon Sep 17 00:00:00 2001 From: Leyla Becker Date: Tue, 4 Mar 2025 21:39:12 -0600 Subject: [PATCH] added extra jellyfin domain --- .../nixos/defiant/configuration.nix | 1 + modules/nixos-modules/server/jellyfin.nix | 21 ++++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/configurations/nixos/defiant/configuration.nix b/configurations/nixos/defiant/configuration.nix index 7e46330..a524e96 100644 --- a/configurations/nixos/defiant/configuration.nix +++ b/configurations/nixos/defiant/configuration.nix @@ -97,6 +97,7 @@ jellyfin = { enable = true; subdomain = "media"; + extraSubdomains = ["jellyfin"]; }; forgejo = { enable = true; diff --git a/modules/nixos-modules/server/jellyfin.nix b/modules/nixos-modules/server/jellyfin.nix index a10470a..78afbc7 100644 --- a/modules/nixos-modules/server/jellyfin.nix +++ b/modules/nixos-modules/server/jellyfin.nix @@ -16,15 +16,30 @@ in { description = "subdomain of base domain that jellyfin will be hosted at"; default = "jellyfin"; }; + extraSubdomains = lib.mkOption { + type = lib.types.listOf lib.types.str; + description = "ex subdomain of base domain that jellyfin will be hosted at"; + default = []; + }; }; config = lib.mkIf config.host.jellyfin.enable ( lib.mkMerge [ { services.jellyfin.enable = true; - host.reverse_proxy.subdomains.${config.host.jellyfin.subdomain} = { - target = "http://localhost:${toString jellyfinPort}"; - }; + host.reverse_proxy.subdomains = lib.mkMerge ([ + { + ${config.host.jellyfin.subdomain} = { + target = "http://localhost:${toString jellyfinPort}"; + }; + } + ] + ++ (builtins.map (subdomain: { + ${subdomain} = { + target = "http://localhost:${toString jellyfinPort}"; + }; + }) + config.host.jellyfin.extraSubdomains)); environment.systemPackages = [ pkgs.jellyfin pkgs.jellyfin-web