From 7811654fb7a81a61b042156a1519c79ca21a743c Mon Sep 17 00:00:00 2001 From: pazpi Date: Wed, 28 Aug 2024 21:03:48 +0200 Subject: [PATCH] formatting and removed old code --- hosts/arr/default.nix | 9 +-- modules/services/download-pod copy.nix | 88 -------------------------- modules/services/download-pod.nix | 13 ++-- modules/utils/default.nix | 1 + modules/utils/server-node-users.nix | 9 +-- modules/virtualisation/podman-pod.nix | 31 +++------ 6 files changed, 26 insertions(+), 125 deletions(-) diff --git a/hosts/arr/default.nix b/hosts/arr/default.nix index 6c0b154..ac3f590 100644 --- a/hosts/arr/default.nix +++ b/hosts/arr/default.nix @@ -1,7 +1,8 @@ -{ config -, pkgs -, lib -, ... +{ + config, + pkgs, + lib, + ... }: { my = { diff --git a/modules/services/download-pod copy.nix b/modules/services/download-pod copy.nix index 2532778..c6f5ae8 100644 --- a/modules/services/download-pod copy.nix +++ b/modules/services/download-pod copy.nix @@ -36,94 +36,6 @@ in config = lib.mkIf cfg.enable { - my.virtualisation.podman.enable = true; - - systemd.services.pod-download = { - description = "Start podman 'download' pod"; - wants = [ "network-online.target" ]; - after = [ "network-online.target" ]; - requiredBy = [ - "podman-jackett.service" - "podman-radarr.service" - "podman-sabnzbd.service" - "podman-sonarr.service" - ]; - unitConfig = { - RequiresMountsFor = "/run/containers"; - }; - serviceConfig = { - Type = "oneshot"; - # - 7878: Radarr - # - 8080: Sabnzbd - # - 8989: Sonarr - # - 9117: Jackett - # - 9696: Prowlarr - ExecStart = "-${pkgs.podman}/bin/podman pod create -p 9117:9117 -p 7878:7878 -p 8080:8080 -p 8989:8989 -p 9696:9696 download"; - }; - path = [ pkgs.podman ]; - }; - - virtualisation.oci-containers.containers = { - - my-pod = { - image = "k8s.gcr.io/pause:3.9"; - extraOptions = [ - "--pod=new:my-pod" - "--publish=8081:80" # Expose port 80 in the pod as 8080 on the host - "--publish=8082:82" # Expose port 82 in the pod as 8082 on the host - "--publish=83:9117" # Expose port 9117 in the pod as 83 on the host - ]; - }; - - jackett = { - image = "linuxserver/jackett"; - autoStart = true; - extraOptions = [ "--pod=my-pod" ]; - volumes = [ - "jackett_config:/config" - "jackett_data:/data" - ]; - }; - - radarr = { - image = "linuxserver/radarr"; - autoStart = true; - extraOptions = [ "--pod=download" ]; - volumes = [ - "radarr_config:/config" - "radarr_data:/data" - ]; - }; - - sabnzbd = { - image = "linuxserver/sabnzbd"; - autoStart = true; - extraOptions = [ "--pod=download" ]; - volumes = [ - "sabnzbd_config:/config" - "sabnzbd_data:/data" - ]; - }; - - sonarr = { - image = "linuxserver/sonarr"; - autoStart = true; - extraOptions = [ "--pod=download" ]; - volumes = [ - "sonarr_config:/config" - "sonarr_data:/data" - ]; - }; - - prowlarr = { - image = "linuxserver/prowlarr"; - autoStart = true; - extraOptions = [ "--pod=download" ]; - volumes = [ "prowlarr_config:/config" ]; - }; - - }; - services.caddy = lib.mkIf cfg.proxy.enable { enable = true; enableReload = false; diff --git a/modules/services/download-pod.nix b/modules/services/download-pod.nix index 09ad046..b1e629c 100644 --- a/modules/services/download-pod.nix +++ b/modules/services/download-pod.nix @@ -1,7 +1,8 @@ -{ config -, pkgs -, lib -, ... +{ + config, + pkgs, + lib, + ... }: with lib; @@ -9,7 +10,7 @@ with lib; let cfg = config.my.services.download-pod; - containers = { + containersDefinition = { jackett = { enable = true; @@ -45,7 +46,7 @@ let }; sonarr = { - enable = false; + enable = true; image = "linuxserver/sonarr"; autoStart = true; extraOptions = [ "--pod=download" ]; diff --git a/modules/utils/default.nix b/modules/utils/default.nix index feae744..a638d41 100644 --- a/modules/utils/default.nix +++ b/modules/utils/default.nix @@ -1,6 +1,7 @@ { imports = [ ./commons.nix + ./helper-functions.nix ./server-node-users.nix ]; } diff --git a/modules/utils/server-node-users.nix b/modules/utils/server-node-users.nix index d5f4bc6..d4b0f7e 100644 --- a/modules/utils/server-node-users.nix +++ b/modules/utils/server-node-users.nix @@ -1,7 +1,8 @@ -{ lib -, config -, pkgs -, ... +{ + lib, + config, + pkgs, + ... }: let cfg = config.my.utils.serverNodeUsers; diff --git a/modules/virtualisation/podman-pod.nix b/modules/virtualisation/podman-pod.nix index 386c429..e77ca4f 100644 --- a/modules/virtualisation/podman-pod.nix +++ b/modules/virtualisation/podman-pod.nix @@ -1,7 +1,8 @@ -{ config -, lib -, pkgs -, ... +{ + config, + lib, + pkgs, + ... }: with lib; @@ -104,26 +105,10 @@ in environment.systemPackages = [ pkgs.jq ]; - # virtualisation.oci-containers.containers = listToAttrs (flatten (mapAttrsToList - # (podName: podDef: - # mapAttrs - # (containerName: containerDef: - # filterAttrs (attrName: attrValue: attrName != "enable") containerDef - # # nameValuePair "${podName}-${containerName}" ({ - # # inherit (containerDef) image; - # # extraOptions = [ "--pod=${podName}" ] ++ containerDef.extraOptions; - # # }) - # ) - # podDef.containers - # ) - # cfg)); - networking.firewall.allowedTCPPorts = flatten ( - mapAttrsToList - ( - name: podDef: map (portMapping: lib.toInt (lib.head (lib.splitString ":" portMapping))) podDef.ports - ) - cfg + mapAttrsToList ( + name: podDef: map (portMapping: lib.toInt (lib.head (lib.splitString ":" portMapping))) podDef.ports + ) cfg ); systemd.services =