main @ 52 LINES
[ HISTORY ] [ UP ]
┌─ NIX ──────────────────────────────────────────────────────────────────────┐
│ { │
│ config, │
│ lib, │
│ ook, │
│ self, │
│ ... │
│ }: let │
│ ookflixLib = import ../lib.nix {inherit lib config self;}; │
│ inherit (ookflixLib) mkServiceUser mkServiceStateDir; │
│ inherit (lib) mkIf optionalAttrs; │
│ inherit (ook.lib.container) mkContainerLabel mkContainerEnvironment mkContainerP │
│ ort; │
│ inherit (config.ooknet.server.ookflix) gpuAcceleration volumes groups; │
│ inherit (config.ooknet.server.ookflix.services) plex; │
│ in { │
│ config = mkIf plex.enable { │
│ # not sure if this is needed for podman │
│ hardware.nvidia-container-toolkit.enable = gpuAcceleration.enable && gpuAccele │
│ ration.type == "nvidia"; │
│ │
│ # users/group/directories configuration, see lib.nix │
│ users = mkServiceUser plex.user.name; │
│ systemd.tmpfiles.settings.plexStateDir = mkServiceStateDir "plex"; │
│ │
│ # container configuration │
│ virtualisation.oci-containers.containers = { │
│ # media streaming server │
│ plex = { │
│ image = "lscr.io/linuxserver/plex:latest"; │
│ autoStart = true; │
│ hostname = "plex"; │
│ ports = [(mkContainerPort plex.port)]; │
│ volumes = [ │
│ "${volumes.media.root}:/data" │
│ "${plex.stateDir}:/config" │
│ ]; │
│ labels = mkContainerLabel { │
│ name = "plex"; │
│ inherit (plex) domain port; │
│ homepage = { │
│ group = "media"; │
│ description = "media-server streamer"; │
│ }; │
│ }; │
│ environment = │
│ mkContainerEnvironment plex.user.id groups.media.id │
│ // optionalAttrs (gpuAcceleration.enable && gpuAcceleration.type == "nvi │
│ dia") { │
│ NVIDIA_VISIBLE_DEVICES = "all"; │
│ }; │
│ }; │
│ }; │
│ }; │
│ } │
└────────────────────────────────────────────────────────────────────────────────────┘
┌─ NIX ────────────────────────────────┐
│ { │
│ config, │
│ lib, │
│ ook, │
│ self, │
│ ... │
│ }: let │
│ ookflixLib = import ../lib.nix {inherit li │
│ b config self;}; │
│ inherit (ookflixLib) mkServiceUser mkServi │
│ ceStateDir; │
│ inherit (lib) mkIf optionalAttrs; │
│ inherit (ook.lib.container) mkContainerLab │
│ el mkContainerEnvironment mkContainerPort; │
│ inherit (config.ooknet.server.ookflix) gpu │
│ Acceleration volumes groups; │
│ inherit (config.ooknet.server.ookflix.serv │
│ ices) plex; │
│ in { │
│ config = mkIf plex.enable { │
│ # not sure if this is needed for podman │
│ hardware.nvidia-container-toolkit.enable │
│ = gpuAcceleration.enable && gpuAcceleration │
│ .type == "nvidia"; │
│ │
│ # users/group/directories configuration, │
│ see lib.nix │
│ users = mkServiceUser plex.user.name; │
│ systemd.tmpfiles.settings.plexStateDir = │
│ mkServiceStateDir "plex"; │
│ │
│ # container configuration │
│ virtualisation.oci-containers.containers │
│ = { │
│ # media streaming server │
│ plex = { │
│ image = "lscr.io/linuxserver/plex:la │
│ test"; │
│ autoStart = true; │
│ hostname = "plex"; │
│ ports = [(mkContainerPort plex.port) │
│ ]; │
│ volumes = [ │
│ "${volumes.media.root}:/data" │
│ "${plex.stateDir}:/config" │
│ ]; │
│ labels = mkContainerLabel { │
│ name = "plex"; │
│ inherit (plex) domain port; │
│ homepage = { │
│ group = "media"; │
│ description = "media-server stre │
│ amer"; │
│ }; │
│ }; │
│ environment = │
│ mkContainerEnvironment plex.user.i │
│ d groups.media.id │
│ // optionalAttrs (gpuAcceleration. │
│ enable && gpuAcceleration.type == "nvidia") │
│ { │
│ NVIDIA_VISIBLE_DEVICES = "all"; │
│ }; │
│ }; │
│ }; │
│ }; │
│ } │
└──────────────────────────────────────────────┘
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET