diff --git a/config/firefox/bookmarks.nix b/config/firefox/bookmarks.nix index d5bde22..fc2f4ec 100644 --- a/config/firefox/bookmarks.nix +++ b/config/firefox/bookmarks.nix @@ -21,6 +21,10 @@ name = "Immich"; url = "https://photo.yanlincs.com/photos"; } + { + name = "Plex"; + url = "https://plex.yanlincs.com"; + } { name = "Jellyfin"; url = "https://jellyfin.yanlincs.com"; diff --git a/hosts/nixos/hs/proxy.nix b/hosts/nixos/hs/proxy.nix index 4bbcb94..da7f48c 100644 --- a/hosts/nixos/hs/proxy.nix +++ b/hosts/nixos/hs/proxy.nix @@ -27,6 +27,17 @@ }; }; + plex = { + rule = "Host(`plex.${config.networking.hostName}.yanlincs.com`)"; + service = "plex"; + tls = { + certResolver = "cloudflare"; + domains = [{ + main = "*.${config.networking.hostName}.yanlincs.com"; + }]; + }; + }; + }; services = { @@ -46,6 +57,14 @@ }; }; + plex = { + loadBalancer = { + servers = [{ + url = "http://127.0.0.1:32400"; + }]; + }; + }; + }; }; }; diff --git a/hosts/nixos/hs/system.nix b/hosts/nixos/hs/system.nix index c7b2ff7..50193b1 100644 --- a/hosts/nixos/hs/system.nix +++ b/hosts/nixos/hs/system.nix @@ -266,6 +266,7 @@ radarr.enable = true; jellyfin.enable = true; deluge.enable = true; + plex.enable = true; }; } diff --git a/hosts/nixos/vps/proxy.nix b/hosts/nixos/vps/proxy.nix index 31bcaa7..6e0be21 100644 --- a/hosts/nixos/vps/proxy.nix +++ b/hosts/nixos/vps/proxy.nix @@ -90,6 +90,18 @@ }; }; + # Plex Media Server + plex = { + rule = "Host(`plex.yanlincs.com`)"; + service = "plex"; + tls = { + certResolver = "cloudflare"; + domains = [{ + main = "*.yanlincs.com"; + }]; + }; + }; + }; services = { @@ -157,6 +169,15 @@ }; }; + # Plex backend + plex = { + loadBalancer = { + servers = [{ + url = "http://lan.hs.yanlincs.com:32400"; + }]; + }; + }; + }; }; diff --git a/modules/media-server.nix b/modules/media-server.nix index 73539fd..be0023a 100644 --- a/modules/media-server.nix +++ b/modules/media-server.nix @@ -21,6 +21,7 @@ in radarr.enable = lib.mkEnableOption "Radarr movie management"; # port 7878 jellyfin.enable = lib.mkEnableOption "Jellyfin media server"; # port 8096 deluge.enable = lib.mkEnableOption "Deluge torrent client"; # web port 8112 + plex.enable = lib.mkEnableOption "Plex media server"; # port 32400 }; config = { @@ -59,5 +60,12 @@ in web.enable = true; web.openFirewall = false; }; + + services.plex = lib.mkIf cfg.plex.enable { + enable = true; + user = cfg.user; + group = cfg.group; + openFirewall = false; + }; }; }