diff options
Diffstat (limited to 'tests/nixos/util.nix')
-rw-r--r-- | tests/nixos/util.nix | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/nixos/util.nix b/tests/nixos/util.nix new file mode 100644 index 000000000..0c51cc075 --- /dev/null +++ b/tests/nixos/util.nix @@ -0,0 +1,23 @@ +{ + mkNixBuildTest = { name, expressionFile, extraMachineConfig ? {} }: + { lib, pkgs, ... }: + { + inherit name; + + nodes.machine = { + imports = [extraMachineConfig]; + nix.nixPath = ["nixpkgs=${pkgs.path}"]; + nix.settings.substituters = lib.mkForce []; + virtualisation.additionalPaths = [ + expressionFile + (pkgs.callPackage expressionFile {}).inputDerivation + ]; + }; + + testScript = { nodes }: '' + start_all() + + machine.succeed('nix-build --expr "let pkgs = import <nixpkgs> {}; in pkgs.callPackage ${expressionFile} {}"') + ''; + }; +} |