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

View file

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