Skip to content

Commit

Permalink
services: fix plex
Browse files Browse the repository at this point in the history
  • Loading branch information
tiborpilz committed Mar 2, 2024
1 parent af464a7 commit 7bb957a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
5 changes: 4 additions & 1 deletion hosts/nixos/klaus/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ with lib;
sopsFile = config.sops.secrets.deluge.path;
};
komga.enable = true;
plex.enable = true;
plex = {
enable = true;
allowedNetworks = "192.168.2.1/24";
};
immich.enable = true;
};
};
Expand Down
13 changes: 9 additions & 4 deletions modules/nixos/services/media/plex.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ in
{
options.modules.services.media.plex = {
enable = mkBoolOpt false;
allowedNetworks = mkOption {
type = types.str;
description = "CIDR of the allowed network";
default = "";
};
};

config = mkIf cfg.enable {
Expand All @@ -19,16 +24,16 @@ in
modules.services.reverseProxy.proxies.plex.publicPort = 32400;

virtualisation.oci-containers.containers.plex = {
image = "lscr.io/linuxserver/plex:latest";
image = "plexinc/pms-docker:latest";
volumes = [
"${plexConfigDir}:/config"
"/data/media/tv:/tv"
"/data/media/movies:/movies"
];
environment = {
"PUID" = "0";
"PGID" = "0";
"VERSION" = "docker";
"TZ" = "Europe/Berlin";
} // optionalAttrs (cfg.allowedNetworks != "") {
"ALLOWED_NETWORKS" = cfg.allowedNetworks;
};
extraOptions = [ "--network=host" ];
};
Expand Down

0 comments on commit 7bb957a

Please sign in to comment.