Skip to content

Commit 883092e

Browse files
committed
Re-enable systemd-nspawn test
It was disabled in c6953d1 because a recent Nixpkgs bump brought in a new systemd which changed how systemd-nspawn worked. As far as I can tell, the issue was caused by this upstream systemd commit: systemd/systemd@b71a019 Bind-mounting the host's `/sys` and `/proc` into the container's `/run/host/{sys,proc}` fixes the issue and allows the test to succeed.
1 parent d40e914 commit 883092e

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

tests/nixos/containers/containers.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
host.fail("nix build -v --auto-allocate-uids --no-sandbox -L --offline --impure --file ${./id-test.nix} --argstr name id-test-6 --arg uidRange true")
5757
5858
# Run systemd-nspawn in a Nix build.
59-
#host.succeed("nix build -v --auto-allocate-uids --sandbox -L --offline --impure --file ${./systemd-nspawn.nix} --argstr nixpkgs ${nixpkgs}")
60-
#host.succeed("[[ $(cat ./result/msg) = 'Hello World' ]]")
59+
host.succeed("nix build -v --auto-allocate-uids --sandbox -L --offline --impure --file ${./systemd-nspawn.nix} --argstr nixpkgs ${nixpkgs}")
60+
host.succeed("[[ $(cat ./result/msg) = 'Hello World' ]]")
6161
'';
6262

6363
}

tests/nixos/containers/systemd-nspawn.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ runCommand "test"
7373
--resolv-conf=off \
7474
--bind-ro=/nix/store \
7575
--bind=$out \
76+
--bind=/proc:/run/host/proc \
77+
--bind=/sys:/run/host/sys \
7678
--private-network \
7779
$toplevel/init
7880
''

0 commit comments

Comments
 (0)