1{ # The pkgs used for dependencies for the testing itself
2 # Don't test properties of pkgs.lib, but rather the lib in the parent directory
3 pkgs ? import ../.. {} // { lib = throw "pkgs.lib accessed, but the lib tests should use nixpkgs' lib path directly!"; }
4}:
5
6pkgs.runCommand "nixpkgs-lib-tests" {
7 buildInputs = [
8 pkgs.nix
9 (import ./check-eval.nix)
10 (import ./maintainers.nix {
11 inherit pkgs;
12 lib = import ../.;
13 })
14 ];
15} ''
16 datadir="${pkgs.nix}/share"
17 export TEST_ROOT=$(pwd)/test-tmp
18 export NIX_BUILD_HOOK=
19 export NIX_CONF_DIR=$TEST_ROOT/etc
20 export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
21 export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
22 export NIX_STATE_DIR=$TEST_ROOT/var/nix
23 export NIX_STORE_DIR=$TEST_ROOT/store
24 export PAGER=cat
25 cacheDir=$TEST_ROOT/binary-cache
26
27 mkdir -p $NIX_CONF_DIR
28 echo "experimental-features = nix-command" >> $NIX_CONF_DIR/nix.conf
29
30 nix-store --init
31
32 cp -r ${../.} lib
33 echo "Running lib/tests/modules.sh"
34 bash lib/tests/modules.sh
35
36 echo "Running lib/tests/sources.sh"
37 TEST_LIB=$PWD/lib bash lib/tests/sources.sh
38
39 touch $out
40''