nixos/modules/plex/default.nix

47 lines
1.3 KiB
Nix
Raw Normal View History

2023-05-29 16:21:23 +02:00
{ config, inputs, ... }:
2022-01-24 22:10:46 +01:00
{
2023-05-29 16:21:23 +02:00
age.secrets.plexClaim.file = "${inputs.self}/scrts/plex_claim.age";
2022-01-24 22:10:46 +01:00
networking = {
2022-01-25 06:40:25 +01:00
firewall.allowedTCPPorts = [
32400 # Web Interface/ Remote Access
];
firewall.allowedUDPPorts = [
1900 # DLNA
5353 # Bonjour/Avahi
32410 # GDM network discovery
32412 # GDM network discovery
32413 # GDM network discovery
32414 # GDM network discovery
32469 # Plex DLNA Server
];
2022-01-24 22:10:46 +01:00
};
2023-05-29 17:10:15 +02:00
services.az-docker.enable = true;
2022-11-02 15:40:09 +01:00
virtualisation.oci-containers = {
backend = "docker";
containers."plex" = {
autoStart = true;
2023-03-06 14:25:46 +01:00
# https://fleet.linuxserver.io/image?name=linuxserver/plex
2023-05-15 09:46:01 +02:00
image = "lscr.io/linuxserver/plex:1.32.1";
2022-11-02 15:40:09 +01:00
environment = {
2022-11-08 22:11:38 +01:00
TZ = " Europe/Zurich ";
PUID = "1000";
PGID = "1000";
VERSION = "docker";
2022-11-02 15:40:09 +01:00
};
environmentFiles = [ config.age.secrets.plexClaim.path ];
volumes = [
2022-11-02 16:53:45 +01:00
"/var/lib/plex/config:/config"
"/var/lib/plex/tmp:/transcode"
"/etc/localtime:/etc/localtime:ro"
2022-11-02 15:40:09 +01:00
];
extraOptions = [
''--mount=type=volume,source=media,target=/mnt/media,volume-driver=local,volume-opt=type=nfs,volume-opt=device=:/media,"volume-opt=o=addr=10.7.89.108,rw,nfsvers=4.0,nolock,hard,noatime"''
"--network=host"
2023-03-03 17:57:48 +01:00
"--log-opt=tag='plex'"
2022-11-02 15:40:09 +01:00
];
};
};
2022-01-24 22:10:46 +01:00
}