diff --git a/nixos/lib/testing.nix b/nixos/lib/testing.nix index 58c447c76db..9339ba78ff0 100644 --- a/nixos/lib/testing.nix +++ b/nixos/lib/testing.nix @@ -149,6 +149,7 @@ rec { { key = "run-in-machine"; networking.hostName = "client"; nix.readOnlyStore = false; + virtualisation.writableStore = false; } ]; diff --git a/nixos/tests/run-in-machine.nix b/nixos/tests/run-in-machine.nix index d1102f8d407..a6dfece44a9 100644 --- a/nixos/tests/run-in-machine.nix +++ b/nixos/tests/run-in-machine.nix @@ -2,7 +2,16 @@ with import ../lib/testing.nix { inherit system; }; -runInMachine { - drv = pkgs.hello; - machine = { config, pkgs, ... }: { /* services.sshd.enable = true; */ }; -} +let + output = runInMachine { + drv = pkgs.hello; + machine = { config, pkgs, ... }: { /* services.sshd.enable = true; */ }; + }; +in pkgs.runCommand "verify-output" { inherit output; } '' + if [ ! -e "$output/bin/hello" ]; then + echo "Derivation built using runInMachine produced incorrect output:" >&2 + ls -laR "$output" >&2 + exit 1 + fi + "$output/bin/hello" > "$out" +''