chore: split nixos and opentofu
This commit is contained in:
parent
d125848b82
commit
06500a8f01
68 changed files with 44 additions and 61 deletions
69
nixos/modules/apps/plex/default.nix
Normal file
69
nixos/modules/apps/plex/default.nix
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.homelab.apps.plex;
|
||||
in {
|
||||
options.homelab.apps.plex.enable = lib.mkEnableOption "Plex";
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
homelab = {
|
||||
users = {
|
||||
apps.enable = true;
|
||||
media.enable = true;
|
||||
};
|
||||
fileSystems.media.video.enable = true;
|
||||
virtualisation.containers.enable = true;
|
||||
};
|
||||
|
||||
users.users.plex = {
|
||||
uid = lib.mkForce 3009;
|
||||
isSystemUser = true;
|
||||
group = config.users.groups.apps.name;
|
||||
extraGroups = [
|
||||
config.users.groups.media.name
|
||||
];
|
||||
home = "/var/empty";
|
||||
shell = null;
|
||||
};
|
||||
|
||||
virtualisation.oci-containers.containers.plex = let
|
||||
videoHostPath = config.homelab.fileSystems.media.video.hostPath;
|
||||
in {
|
||||
hostname = "plex";
|
||||
image = "plexinc/pms-docker:1.41.6.9685-d301f511a";
|
||||
autoStart = true;
|
||||
ports = [
|
||||
"32400:32400/tcp" # Plex Media Server
|
||||
"1900:1900/udp" # Plex DLNA Server
|
||||
"32469:32469/tcp" # Plex DLNA Server
|
||||
"32410:32410/udp" # GDM network discovery
|
||||
"32412:32412/udp" # GDM network discovery
|
||||
"32413:32413/udp" # GDM network discovery
|
||||
"32414:32414/udp" # GDM network discovery
|
||||
# "8324:8324/tcp" # Controlling Plex for Roku via Plex Companion
|
||||
];
|
||||
environment = {
|
||||
#ADVERTISE_AP = "..."; # TODO Configure ip
|
||||
ALLOWED_NETWORKS = "192.168.0.0/24,172.16.0.0/16";
|
||||
CHANGE_CONFIG_DIR_OWNERSHIP = "false";
|
||||
HOSTNAME = "Hugo-Plex";
|
||||
PLEX_CLAIM = "claim-d5MqsjMeCZrUF6oUvssr";
|
||||
PLEX_UID = toString config.users.users.plex.uid;
|
||||
PLEX_GID = toString config.users.groups.media.gid;
|
||||
TZ = config.time.timeZone;
|
||||
};
|
||||
volumes = [
|
||||
# TODO Backup over NFS
|
||||
"plex-config:/config"
|
||||
"plex-transcode:/transcode"
|
||||
|
||||
"${videoHostPath}:/data/video:ro"
|
||||
];
|
||||
labels = {
|
||||
"traefik.enable" = "true";
|
||||
"traefik.http.routers.plex.rule" = "Host(`plex.depeuter.dev`)";
|
||||
"traefik.http.services.plex.loadbalancer.server.port" = "32400";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue