12 lines
406 B
Nix
12 lines
406 B
Nix
{
|
|
pod = { pkgs, ... }: podName: containers: ports: {
|
|
systemd.services."ensure-pod_${podName}" = {
|
|
serviceConfig.Type = "oneshot";
|
|
wantedBy = map (x: "podman-${x}.service") containers;
|
|
script = ''
|
|
${pkgs.podman}/bin/podman pod exists ${podName} || \\
|
|
${pkgs.podman}/bin/podman pod create -n ${podName} ${map (x: "-p 0.0.0.0:${x}:${x}") ports}
|
|
'';
|
|
};
|
|
};
|
|
}
|