Add pod name automagically

This commit is contained in:
pazpi 2024-08-28 21:04:39 +02:00
parent 3bdf838524
commit d3eb6a7485

View file

@ -16,7 +16,6 @@ let
enable = true; enable = true;
image = "linuxserver/jackett"; image = "linuxserver/jackett";
autoStart = true; autoStart = true;
extraOptions = [ "--pod=download" ];
volumes = [ volumes = [
"jackett_config:/config" "jackett_config:/config"
"jackett_data:/data" "jackett_data:/data"
@ -27,7 +26,6 @@ let
enable = true; enable = true;
image = "linuxserver/radarr"; image = "linuxserver/radarr";
autoStart = true; autoStart = true;
extraOptions = [ "--pod=download" ];
volumes = [ volumes = [
"radarr_config:/config" "radarr_config:/config"
"radarr_data:/data" "radarr_data:/data"
@ -38,7 +36,6 @@ let
enable = false; enable = false;
image = "linuxserver/sabnzbd"; image = "linuxserver/sabnzbd";
autoStart = true; autoStart = true;
extraOptions = [ "--pod=download" ];
volumes = [ volumes = [
"sabnzbd_config:/config" "sabnzbd_config:/config"
"sabnzbd_data:/data" "sabnzbd_data:/data"
@ -49,7 +46,6 @@ let
enable = true; enable = true;
image = "linuxserver/sonarr"; image = "linuxserver/sonarr";
autoStart = true; autoStart = true;
extraOptions = [ "--pod=download" ];
volumes = [ volumes = [
"sonarr_config:/config" "sonarr_config:/config"
"sonarr_data:/data" "sonarr_data:/data"
@ -60,16 +56,22 @@ let
enable = true; enable = true;
image = "linuxserver/prowlarr"; image = "linuxserver/prowlarr";
autoStart = true; autoStart = true;
# extraOptions = [ "--pod=download" ];
volumes = [ "prowlarr_config:/config" ]; volumes = [ "prowlarr_config:/config" ];
}; };
}; };
enabledContainers = # Pod Definition
containers: download = {
lib.mapAttrs (name: container: lib.removeAttrs container [ "enable" ]) ( name = "download";
lib.filterAttrs (name: container: container.enable) containers ports = [
); "7878:7878" # : Radarr
# "8080:8080" # : Sabnzbd
"8989:8989" # : Sonarr
"9117:9117" # : Jackett
"9696:9696" # : Prowlarr
];
containers = containersDefinition;
};
in in
{ {
@ -102,20 +104,14 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
my.virtualisation.podmanPods = { my.virtualisation.podmanPods = {
download = { inherit download;
name = "download";
ports = [
"7878:7878" # : Radarr
# "8080:8080" # : Sabnzbd
"8989:8989" # : Sonarr
"9117:9117" # : Jackett
"9696:9696" # : Prowlarr
];
containers = enabledContainers containers;
};
}; };
virtualisation.oci-containers.containers = enabledContainers containers; virtualisation.oci-containers.containers =
let
pod = config.helpers.processContainers download;
in
pod.containers;
services.caddy = lib.mkIf cfg.proxy.enable { services.caddy = lib.mkIf cfg.proxy.enable {
enable = true; enable = true;