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 ./maintainers.nix {
28 (import ../path/tests {
35 ] ++ lib.optional pkgs.stdenv.isLinux pkgs.inotify-tools;
38 datadir="${nix}/share"
39 export TEST_ROOT=$(pwd)/test-tmp
40 export HOME=$(mktemp -d)
41 export NIX_BUILD_HOOK=
42 export NIX_CONF_DIR=$TEST_ROOT/etc
43 export NIX_LOCALSTATE_DIR=$TEST_ROOT/var
44 export NIX_LOG_DIR=$TEST_ROOT/var/log/nix
45 export NIX_STATE_DIR=$TEST_ROOT/var/nix
46 export NIX_STORE_DIR=$TEST_ROOT/store
48 cacheDir=$TEST_ROOT/binary-cache
53 echo "Running lib/tests/modules.sh"
54 bash lib/tests/modules.sh
56 echo "Checking lib.version"
57 nix-instantiate lib -A version --eval || {
58 echo "lib.version does not evaluate when lib is isolated from the rest of the nixpkgs tree"
62 echo "Running lib/tests/filesystem.sh"
63 TEST_LIB=$PWD/lib bash lib/tests/filesystem.sh
65 echo "Running lib/tests/sources.sh"
66 TEST_LIB=$PWD/lib bash lib/tests/sources.sh
68 echo "Running lib/fileset/tests.sh"
69 TEST_LIB=$PWD/lib bash lib/fileset/tests.sh
71 echo "Running lib/tests/systems.nix"
72 [[ $(nix-instantiate --eval --strict lib/tests/systems.nix | tee /dev/stderr) == '[ ]' ]];
75 echo success > $out/${nix.version}