diff --git a/nixos/viridian/configuration.nix b/nixos/viridian/configuration.nix index 0e189d5..34d29f6 100644 --- a/nixos/viridian/configuration.nix +++ b/nixos/viridian/configuration.nix @@ -25,7 +25,9 @@ # Import services ./services/traefik - ./services/media-stack + + # Import containers + ./containers/media-stack # Import your generated (nixos-generate-config) hardware configuration ./hardware-configuration.nix @@ -239,13 +241,16 @@ }; }; + # Virtualisation + virtualisation.docker.enable = true; + # Configure your system-wide user settings (groups, etc), add more users as needed. users = { users = { # System administator sabrina = { isNormalUser = true; - extraGroups = [ "networkmanager" "wheel" "media" ]; + extraGroups = [ "networkmanager" "wheel" "media" "docker" ]; openssh.authorizedKeys.keyFiles = [ ../../home-manager/sajenim/id_ed25519_sk.pub ]; diff --git a/nixos/viridian/containers/media-stack/default.nix b/nixos/viridian/containers/media-stack/default.nix new file mode 100644 index 0000000..5b23477 --- /dev/null +++ b/nixos/viridian/containers/media-stack/default.nix @@ -0,0 +1,125 @@ +{ ... }: + +{ + virtualisation.oci-containers.containers = { + # Volunteer-built media solution that puts you in control of your media + jellyfin = { + autoStart = true; + image = "jellyfin/jellyfin:10.8.12"; + ports = [ + "8096:8096/tcp" # HTTP traffic + "8920:8920/tcp" # HTTPS traffic + "1900:1900/udp" # Service auto-discovery + "7359:7359/udp" # Client auto-discovery + ]; + volumes = [ + # Media library + "/data/media:/media:ro" + # Container data + "/srv/jellyfin/config:/config:rw" + "/srv/jellyfin/cache:/cache:rw" + ]; + extraOptions = [ + "--group-add=303" + "--device=/dev/dri/renderD128:/dev/dri/renderD128" + "--network=host" + ]; + }; + # PVR for Usenet and BitTorrent users + sonarr = { + autoStart = true; + image = "ghcr.io/hotio/sonarr:nightly-4.0.0.710"; + ports = [ + "8989:8989/tcp" # WebUI + ]; + volumes = [ + # Media library + "/data:/data:rw" + # Container data + "/srv/sonarr:/config:rw" + ]; + extraOptions = [ + "--network=media-stack" + ]; + }; + # Movie collection manager for Usenet and BitTorrent users + radarr = { + autoStart = true; + image = "ghcr.io/hotio/radarr:nightly-5.1.3.8237"; + ports = [ + "7878:7878/tcp" # WebUI + ]; + volumes = [ + # Media library + "/data:/data:rw" + # Container data + "/srv/radarr:/config:rw" + ]; + extraOptions = [ + "--network=media-stack" + ]; + }; + # # Music collection manager for Usenet and BitTorrent users + lidarr = { + autoStart = true; + image = "ghcr.io/hotio/lidarr:nightly-2.0.2.377"; + ports = [ + "8686:8686/tcp" # WebUI + ]; + volumes = [ + # Media library + "/data:/data:rw" + # Container data + "/srv/lidarr:/config:rw" + ]; + extraOptions = [ + "--network=media-stack" + ]; + }; + # Indexer manager/proxy built on the popular arr .net/reactjs base stack to integrate with your various PVR apps. + prowlarr = { + autoStart = true; + image = "ghcr.io/hotio/prowlarr:nightly-1.10.3.4070"; + ports = [ + "9696:9696/tcp" # WebUI + ]; + volumes = [ + # Container data + "/srv/prowlarr:/config:rw" + ]; + extraOptions = [ + "--network=media-stack" + ]; + }; + # Automatically synchronize recommended settings from the TRaSH guides to your Sonarr/Radarr instances + recyclarr = { + autoStart = true; + image = "ghcr.io/hotio/recyclarr:6.0"; + volumes = [ + "/srv/recyclarr:/config" + ]; + extraOptions = [ + "--network=media-stack" + ]; + }; + # # Open-source software alternative to µTorrent + qbittorrent = { + autoStart = true; + image = "ghcr.io/hotio/qbittorrent:release-4.6.0"; + ports = [ + "8080:8080/tcp" # WebUI + "32372:32372/tcp" # Transport protocol + ]; + volumes = [ + # Seedbox + "/data/torrents:/data/torrents:rw" + "/srv/qbittorrent:/config:rw" + ]; + extraOptions = [ + "--network=media-stack" + ]; + }; + }; + virtualisation.oci-containers.backend = "docker"; +} + diff --git a/nixos/viridian/services/media-stack/default.nix b/nixos/viridian/services/media-stack/default.nix deleted file mode 100644 index 8a25cd4..0000000 --- a/nixos/viridian/services/media-stack/default.nix +++ /dev/null @@ -1,60 +0,0 @@ -{ pkgs, ... }: - -{ - environment.systemPackages = [ - # Required for hardware acceleration - pkgs.jellyfin-ffmpeg - ]; - - services = { - # Volunteer-built media solution that puts you in control of your media - jellyfin = { - enable = true; - openFirewall = true; - }; - # PVR for Usenet and BitTorrent users - sonarr = { - enable = true; - openFirewall = true; - dataDir = "/var/lib/sonarr"; - }; - # Movie collection manager for Usenet and BitTorrent users - radarr = { - enable = true; - openFirewall = true; - dataDir = "/var/lib/radarr"; - }; - # Music collection manager for Usenet and BitTorrent users - lidarr = { - enable = true; - openFirewall = true; - dataDir = "/var/lib/lidarr"; - }; - # Indexer manager/proxy built on the popular arr .net/reactjs base stack to integrate with your various PVR apps. - prowlarr = { - enable = true; - openFirewall = true; - }; - # Open-source software alternative to µTorrent - qbittorrent = { - enable = true; - openFirewall = true; - port = 8080; - }; - }; - - # Add our services to relevant groups - users.groups = { - media.members = [ - "jellyfin" - "sonarr" - "radarr" - "lidarr" - "qbittorrent" - ]; - render.members = [ - "jellyfin" - ]; - }; -} -