at 23.11-beta 2.2 kB view raw
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; }, 7}: 8 9let 10 lib = import ../.; 11 testWithNix = nix: 12 pkgs.runCommand "nixpkgs-lib-tests-nix-${nix.version}" { 13 buildInputs = [ 14 (import ./check-eval.nix) 15 (import ./maintainers.nix { 16 inherit pkgs; 17 lib = import ../.; 18 }) 19 (import ./teams.nix { 20 inherit pkgs; 21 lib = import ../.; 22 }) 23 (import ../path/tests { 24 inherit pkgs; 25 }) 26 ]; 27 nativeBuildInputs = [ 28 nix 29 pkgs.gitMinimal 30 ] ++ lib.optional pkgs.stdenv.isLinux pkgs.inotify-tools; 31 strictDeps = true; 32 } '' 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 42 export PAGER=cat 43 cacheDir=$TEST_ROOT/binary-cache 44 45 nix-store --init 46 47 cp -r ${../.} lib 48 echo "Running lib/tests/modules.sh" 49 bash lib/tests/modules.sh 50 51 echo "Running lib/tests/filesystem.sh" 52 TEST_LIB=$PWD/lib bash lib/tests/filesystem.sh 53 54 echo "Running lib/tests/sources.sh" 55 TEST_LIB=$PWD/lib bash lib/tests/sources.sh 56 57 echo "Running lib/fileset/tests.sh" 58 TEST_LIB=$PWD/lib bash lib/fileset/tests.sh 59 60 echo "Running lib/tests/systems.nix" 61 [[ $(nix-instantiate --eval --strict lib/tests/systems.nix | tee /dev/stderr) == '[ ]' ]]; 62 63 mkdir $out 64 echo success > $out/${nix.version} 65 ''; 66 67in 68 pkgs.symlinkJoin { 69 name = "nixpkgs-lib-tests"; 70 paths = map testWithNix nixVersions; 71 }