summaryrefslogtreecommitdiffstats
path: root/nixos/modules
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2016-05-29 17:58:55 +0200
committeraszlig <aszlig@redmoonstudios.org>2016-05-29 18:38:37 +0200
commitdc38003af91baa3387eb231f854bc4e89041434f (patch)
tree667961b76b76dfc9fc37779baabb3fc9e8c795b0 /nixos/modules
parent8d1fec55f68ffb20a4f1cf96cf444160236542db (diff)
nixos/containers: Create an empty machine-id file
Since systemd version 230, it is required to have a machine-id file prior to the startup of the container. If the file is empty, a transient machine ID is generated by systemd-nspawn. See systemd/systemd#3014 for more details on the matter. This unbreaks all of the containers-* NixOS tests. Signed-off-by: aszlig <aszlig@redmoonstudios.org> Cc: @edolstra Closes: #15808
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/virtualisation/containers.nix4
1 files changed, 4 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix
index dc65e4940549..13ecb8e25ed5 100644
--- a/nixos/modules/virtualisation/containers.nix
+++ b/nixos/modules/virtualisation/containers.nix
@@ -309,6 +309,10 @@ in
touch "$root/etc/os-release"
fi
+ if ! [ -e "$root/etc/machine-id" ]; then
+ touch "$root/etc/machine-id"
+ fi
+
mkdir -p -m 0755 \
"/nix/var/nix/profiles/per-container/$INSTANCE" \
"/nix/var/nix/gcroots/per-container/$INSTANCE"