summary refs log tree commit diff
path: root/nixos/tests/run-in-machine.nix
blob: 67840f3e9fe7f8449baf8bfa40e291f83938af3d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{ system ? builtins.currentSystem,
  config ? {},
  pkgs ? import ../.. { inherit system config; }
}:

with import ../lib/testing-python.nix { inherit system pkgs; };

let
  output = runInMachine {
    drv = pkgs.hello;
    machine = { ... }: { /* services.sshd.enable = true; */ };
  };

  test = 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"
  '';

in test // { inherit test; } # To emulate behaviour of makeTest