at 25.11-pre 2.1 kB view raw
1/** 2 Instantiate the library tests for a given Nix version. 3 4 IMPORTANT: 5 This is used by the github.com/NixOS/nix CI. 6 7 Try not to change the interface of this file, or if you need to, ping the 8 Nix maintainers for help. Thank you! 9*/ 10{ 11 pkgs, 12 lib, 13 # Only ever use this nix; see comment at top 14 nix, 15}: 16 17pkgs.runCommand "nixpkgs-lib-tests-nix-${nix.version}" 18 { 19 buildInputs = [ 20 (import ./check-eval.nix) 21 (import ./fetchers.nix) 22 (import ./maintainers.nix { 23 inherit pkgs; 24 lib = import ../.; 25 }) 26 (import ./teams.nix { 27 inherit pkgs; 28 lib = import ../.; 29 }) 30 (import ../path/tests { 31 inherit pkgs; 32 }) 33 ]; 34 nativeBuildInputs = [ 35 nix 36 pkgs.gitMinimal 37 ] ++ lib.optional pkgs.stdenv.hostPlatform.isLinux pkgs.inotify-tools; 38 strictDeps = true; 39 } 40 '' 41 datadir="${nix}/share" 42 export TEST_ROOT=$(pwd)/test-tmp 43 export HOME=$(mktemp -d) 44 export NIX_BUILD_HOOK= 45 export NIX_CONF_DIR=$TEST_ROOT/etc 46 export NIX_LOCALSTATE_DIR=$TEST_ROOT/var 47 export NIX_LOG_DIR=$TEST_ROOT/var/log/nix 48 export NIX_STATE_DIR=$TEST_ROOT/var/nix 49 export NIX_STORE_DIR=$TEST_ROOT/store 50 export PAGER=cat 51 cacheDir=$TEST_ROOT/binary-cache 52 53 nix-store --init 54 55 cp -r ${../.} lib 56 echo "Running lib/tests/modules.sh" 57 bash lib/tests/modules.sh 58 59 echo "Checking lib.version" 60 nix-instantiate lib -A version --eval || { 61 echo "lib.version does not evaluate when lib is isolated from the rest of the nixpkgs tree" 62 exit 1 63 } 64 65 echo "Running lib/tests/filesystem.sh" 66 TEST_LIB=$PWD/lib bash lib/tests/filesystem.sh 67 68 echo "Running lib/tests/sources.sh" 69 TEST_LIB=$PWD/lib bash lib/tests/sources.sh 70 71 echo "Running lib/tests/network.sh" 72 TEST_LIB=$PWD/lib bash lib/tests/network.sh 73 74 echo "Running lib/fileset/tests.sh" 75 TEST_LIB=$PWD/lib bash lib/fileset/tests.sh 76 77 echo "Running lib/tests/systems.nix" 78 [[ $(nix-instantiate --eval --strict lib/tests/systems.nix | tee /dev/stderr) == '[ ]' ]]; 79 80 mkdir $out 81 echo success > $out/${nix.version} 82 ''