nixpkgs/nixos/tests/run-in-machine.nix

21 lines
533 B
Nix
Raw Normal View History

{ system ? builtins.currentSystem,
config ? {},
pkgs ? import ../.. { inherit system config; }
}:
with import ../lib/testing.nix { inherit system pkgs; };
let
output = runInMachine {
drv = pkgs.hello;
machine = { ... }: { /* 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"
''