about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorSilvan Mosberger <contact@infinisil.com>2020-04-25 22:07:43 +0200
committerSilvan Mosberger <contact@infinisil.com>2020-04-25 23:40:20 +0200
commita89b7739846caf72c884382c31c7d6dee34370ed (patch)
tree236fae09cd9a51cc747b87bbd98879bcf9a4d3b0 /lib
parentd0b1de54915f35a3392389768d1c514a3d2779b8 (diff)
downloadnixlib-a89b7739846caf72c884382c31c7d6dee34370ed.tar
nixlib-a89b7739846caf72c884382c31c7d6dee34370ed.tar.gz
nixlib-a89b7739846caf72c884382c31c7d6dee34370ed.tar.bz2
nixlib-a89b7739846caf72c884382c31c7d6dee34370ed.tar.lz
nixlib-a89b7739846caf72c884382c31c7d6dee34370ed.tar.xz
nixlib-a89b7739846caf72c884382c31c7d6dee34370ed.tar.zst
nixlib-a89b7739846caf72c884382c31c7d6dee34370ed.zip
lib/tests: Allow overriding pkgs independent of lib being tested
Diffstat (limited to 'lib')
-rw-r--r--lib/tests/maintainers.nix11
-rw-r--r--lib/tests/release.nix15
2 files changed, 18 insertions, 8 deletions
diff --git a/lib/tests/maintainers.nix b/lib/tests/maintainers.nix
index 60d296eecae6..d3ed398c80a1 100644
--- a/lib/tests/maintainers.nix
+++ b/lib/tests/maintainers.nix
@@ -1,10 +1,11 @@
-# to run these tests:
-# nix-build nixpkgs/lib/tests/maintainers.nix
-# If nothing is output, all tests passed
-{ pkgs ? import ../.. {} }:
+# to run these tests (and the others)
+# nix-build nixpkgs/lib/tests/release.nix
+{ # The pkgs used for dependencies for the testing itself
+  pkgs
+, lib
+}:
 
 let
-  inherit (pkgs) lib;
   inherit (lib) types;
 
   maintainerModule = { config, ... }: {
diff --git a/lib/tests/release.nix b/lib/tests/release.nix
index ec0f9c32d3f7..eebee1b49bc8 100644
--- a/lib/tests/release.nix
+++ b/lib/tests/release.nix
@@ -1,8 +1,17 @@
-{ pkgs ? import ../.. {} }:
+{ # The pkgs used for dependencies for the testing itself
+  # Don't test properties of pkgs.lib, but rather the lib in the parent directory
+  pkgs ? import ../.. {} // { lib = throw "pkgs.lib accessed, but the lib tests should use nixpkgs' lib path directly!"; }
+}:
 
 pkgs.runCommandNoCC "nixpkgs-lib-tests" {
-  buildInputs = [ pkgs.nix (import ./check-eval.nix) (import ./maintainers.nix { inherit pkgs; }) ];
-  NIX_PATH = "nixpkgs=${toString pkgs.path}";
+  buildInputs = [
+    pkgs.nix
+    (import ./check-eval.nix)
+    (import ./maintainers.nix {
+      inherit pkgs;
+      lib = import ../.;
+    })
+  ];
 } ''
     datadir="${pkgs.nix}/share"
     export TEST_ROOT=$(pwd)/test-tmp