2 * Instantiate the library tests for a given Nix version.
5 * This is used by the github.com/NixOS/nix CI.
7 * Try not to change the interface of this file, or if you need to, ping the
8 * Nix maintainers for help. Thank you!
13 # Only ever use this nix; see comment at top
17 pkgs.runCommand "nixpkgs-lib-tests-nix-${nix.version}" {
19 (import ./check-eval.nix)
20 (import ./fetchers.nix)
21 (import ./maintainers.nix {
29 (import ../path/tests {
36 ] ++ lib.optional pkgs.stdenv.hostPlatform.isLinux pkgs.inotify-tools;
39 datadir="${nix}/share"
40 export TEST_ROOT=$(pwd)/test-tmp
41 export HOME=$(mktemp -d)
42 export NIX_BUILD_HOOK=
43 export NIX_CONF_DIR=$TEST_ROOT/etc
44 export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
45 export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
46 export NIX_STATE_DIR=$TEST_ROOT/var/nix
47 export NIX_STORE_DIR=$TEST_ROOT/store
49 cacheDir=$TEST_ROOT/binary-cache
54 echo "Running lib/tests/modules.sh"
55 bash lib/tests/modules.sh
57 echo "Checking lib.version"
58 nix-instantiate lib -A version --eval || {
59 echo "lib.version does not evaluate when lib is isolated from the rest of the nixpkgs tree"
63 echo "Running lib/tests/filesystem.sh"
64 TEST_LIB=$PWD/lib bash lib/tests/filesystem.sh
66 echo "Running lib/tests/sources.sh"
67 TEST_LIB=$PWD/lib bash lib/tests/sources.sh
69 echo "Running lib/tests/network.sh"
70 TEST_LIB=$PWD/lib bash lib/tests/network.sh
72 echo "Running lib/fileset/tests.sh"
73 TEST_LIB=$PWD/lib bash lib/fileset/tests.sh
75 echo "Running lib/tests/systems.nix"
76 [[ $(nix-instantiate --eval --strict lib/tests/systems.nix | tee /dev/stderr) == '[ ]' ]];
79 echo success > $out/${nix.version}