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 nix ? pkgs-nixVersions.stable,
5 nixVersions ? [ pkgs-nixVersions.minimum nix pkgs-nixVersions.unstable ],
6 pkgs-nixVersions ? import ./nix-for-tests.nix { inherit pkgs; },
12 pkgs.runCommand "nixpkgs-lib-tests-nix-${nix.version}" {
14 (import ./check-eval.nix)
15 (import ./maintainers.nix {
23 (import ../path/tests {
30 ] ++ lib.optional pkgs.stdenv.isLinux pkgs.inotify-tools;
33 datadir="${nix}/share"
34 export TEST_ROOT=$(pwd)/test-tmp
35 export HOME=$(mktemp -d)
36 export NIX_BUILD_HOOK=
37 export NIX_CONF_DIR=$TEST_ROOT/etc
38 export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
39 export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
40 export NIX_STATE_DIR=$TEST_ROOT/var/nix
41 export NIX_STORE_DIR=$TEST_ROOT/store
43 cacheDir=$TEST_ROOT/binary-cache
48 echo "Running lib/tests/modules.sh"
49 bash lib/tests/modules.sh
51 echo "Running lib/tests/filesystem.sh"
52 TEST_LIB=$PWD/lib bash lib/tests/filesystem.sh
54 echo "Running lib/tests/sources.sh"
55 TEST_LIB=$PWD/lib bash lib/tests/sources.sh
57 echo "Running lib/fileset/tests.sh"
58 TEST_LIB=$PWD/lib bash lib/fileset/tests.sh
60 echo "Running lib/tests/systems.nix"
61 [[ $(nix-instantiate --eval --strict lib/tests/systems.nix | tee /dev/stderr) == '[ ]' ]];
64 echo success > $out/${nix.version}
69 name = "nixpkgs-lib-tests";
70 paths = map testWithNix nixVersions;