Use the pod name, not the attribute name

This commit is contained in:
pazpi 2024-08-28 21:18:31 +02:00
parent d3eb6a7485
commit 79820a3f9b
2 changed files with 9 additions and 9 deletions

View file

@ -61,7 +61,7 @@ let
}; };
# Pod Definition # Pod Definition
download = { podDefinition = {
name = "download"; name = "download";
ports = [ ports = [
"7878:7878" # : Radarr "7878:7878" # : Radarr
@ -104,12 +104,12 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
my.virtualisation.podmanPods = { my.virtualisation.podmanPods = {
inherit download; inherit podDefinition;
}; };
virtualisation.oci-containers.containers = virtualisation.oci-containers.containers =
let let
pod = config.helpers.processContainers download; pod = config.helpers.processContainers podDefinition;
in in
pod.containers; pod.containers;

View file

@ -42,15 +42,15 @@ let
}; };
createPodScript = createPodScript =
name: podDef: podDef:
let let
podDefinitionString = builtins.toJSON { inherit (podDef) ports; }; podDefinitionString = builtins.toJSON { inherit (podDef) ports; };
in in
pkgs.writeScript "manage-pod-${name}.sh" '' pkgs.writeScript "manage-pod-${podDef.name}.sh" ''
#! /bin/sh #! /bin/sh
set -e set -e
POD_NAME="${name}" POD_NAME="${podDef.name}"
POD_DEFINITION="${podDefinitionString}" POD_DEFINITION="${podDefinitionString}"
create_pod() { create_pod() {
@ -108,11 +108,11 @@ in
podServices = mapAttrs' ( podServices = mapAttrs' (
name: podDef: name: podDef:
nameValuePair "podman-pod-${name}" { nameValuePair "podman-pod-${podDef.name}" {
description = "Manage Podman pod: ${name}"; description = "Manage Podman pod: ${podDef.name}";
serviceConfig = { serviceConfig = {
Type = "oneshot"; Type = "oneshot";
ExecStart = "${createPodScript name podDef}"; ExecStart = "${createPodScript podDef}";
}; };
path = [ path = [
pkgs.jq pkgs.jq