Skip to content

Commit

Permalink
use systemd-tmpfiles to create dummy container root
Browse files Browse the repository at this point in the history
  • Loading branch information
fpletz committed Dec 19, 2024
1 parent 90750a6 commit 2ae61a0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions host.nix
Original file line number Diff line number Diff line change
Expand Up @@ -281,11 +281,11 @@ in
}
);

systemd.services."systemd-nspawn@" = {
# We create this dummy image directory because systemd-nspawn fails otherwise.
# Additionally, it persists the UID/GID mapping for user namespaces.
serviceConfig.ExecStartPre = [ "${pkgs.coreutils}/bin/mkdir -p /var/lib/machines/%i" ];
};
# We create this dummy image directory because systemd-nspawn fails otherwise.
# Additionally, it persists the UID/GID mapping for user namespaces.
systemd.tmpfiles.settings."10-nixos-nspawn-ephemeral" = lib.mapAttrs' (
name: _: lib.nameValuePair "/var/lib/machines/${name}" { d = { }; }
) cfg.containers;

# Activate the container units with machines.target
systemd.targets.machines.wants = lib.mapAttrsToList (name: _: "systemd-nspawn@${name}.service") (
Expand Down

0 comments on commit 2ae61a0

Please sign in to comment.