Skip to content

Commit

Permalink
nixos: Fix output path generation of runInMachine
Browse files Browse the repository at this point in the history
Regression introduced by a02bb00.

The fix is done by disabling writableStore, because the latter will set
up an overlayfs on the Nix store within the VM, which in turn will
discard all the outputs of the resulting output path.

However in runInMachine we actually *want* the contents of the generated
path and also don't want a writable store within the VM (except of
course for $out, which is writable anyway).

I've added a small regression test to verifify the output in
nixos/tests/run-in-machine.nix to make sure this won't break again in
the future.

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
  • Loading branch information
aszlig committed Oct 11, 2017
1 parent 5dda132 commit 2048711
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions nixos/lib/testing.nix
Expand Up @@ -149,6 +149,7 @@ rec {
{ key = "run-in-machine";
networking.hostName = "client";
nix.readOnlyStore = false;
virtualisation.writableStore = false;
}
];

Expand Down
17 changes: 13 additions & 4 deletions nixos/tests/run-in-machine.nix
Expand Up @@ -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"
''

0 comments on commit 2048711

Please sign in to comment.