diff --git a/nixos/plex.nix b/nixos/plex.nix index 83a4cc9b..7556ddef 100644 --- a/nixos/plex.nix +++ b/nixos/plex.nix @@ -1,9 +1,9 @@ -_: { +{config, ...}: { services = { plex = { enable = true; }; - nginx.virtualHosts."plex.gensokyo.zone" = { + nginx.virtualHosts = let extraConfig = '' # Some players don't reopen a socket and playback stops totally instead of resuming after an extended pause send_timeout 100m; @@ -24,7 +24,15 @@ _: { proxy_redirect off; proxy_buffering off; ''; - locations."/".proxyPass = "http://localhost:32400"; + in { + "plex.${config.networking.domain}" = { + locations."/".proxyPass = "http://localhost:32400"; + inherit extraConfig; + }; + "plex.local.${config.networking.domain}" = { + locations."/".proxyPass = "http://localhost:32400"; + inherit extraConfig; + }; }; }; diff --git a/nixos/tautulli.nix b/nixos/tautulli.nix index 423e1485..7bc99c63 100644 --- a/nixos/tautulli.nix +++ b/nixos/tautulli.nix @@ -1,12 +1,21 @@ -{config, ...}: { +{config, lib, ...}: let + inherit (lib.modules) mkIf; + cfg = config.services.tautulli; +in { services = { tautulli = { enable = true; + openFirewall = true; port = 8181; }; - nginx.virtualHosts."tautulli.gensokyo.zone" = { - locations."/".proxyPass = "http://localhost:${toString config.services.tautulli.port}"; + nginx.virtualHosts = { + "tautulli.${config.networking.domain}" = { + locations."/".proxyPass = "http://localhost:${toString cfg.port}"; + }; + "tautulli.local.${config.networking.domain}" = mkIf cfg.openFirewall { + locations."/".proxyPass = "http://localhost:${toString cfg.port}"; + }; }; }; } diff --git a/tf/cloudflare_records.tf b/tf/cloudflare_records.tf index 7286c26d..6cb0c839 100644 --- a/tf/cloudflare_records.tf +++ b/tf/cloudflare_records.tf @@ -30,6 +30,7 @@ module "mediabox_system_records" { local_v6 = "fd0a::be24:11ff:fe34:f4a8" local_subdomains = [ "plex", + "tautulli", ] }