nixos/nixos/stacks/stack-utils.nix
2023-12-27 02:54:59 -05:00

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}
'';
};
};
}