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 (import ./teams.nix {
15 inherit pkgs;
16 lib = import ../.;
17 })
18 ];
19} ''
20 datadir="${pkgs.nix}/share"
21 export TEST_ROOT=$(pwd)/test-tmp
22 export NIX_BUILD_HOOK=
23 export NIX_CONF_DIR=$TEST_ROOT/etc
24 export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
25 export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
26 export NIX_STATE_DIR=$TEST_ROOT/var/nix
27 export NIX_STORE_DIR=$TEST_ROOT/store
28 export PAGER=cat
29 cacheDir=$TEST_ROOT/binary-cache
30
31 mkdir -p $NIX_CONF_DIR
32 echo "experimental-features = nix-command" >> $NIX_CONF_DIR/nix.conf
33
34 nix-store --init
35
36 cp -r ${../.} lib
37 echo "Running lib/tests/modules.sh"
38 bash lib/tests/modules.sh
39
40 echo "Running lib/tests/sources.sh"
41 TEST_LIB=$PWD/lib bash lib/tests/sources.sh
42
43 touch $out
44''