1 { supportedSystems, nixpkgs, pkgs }:
3 pkgs.runCommand "nixpkgs-release-checks"
6 buildInputs = [ pkgs.nix ];
7 requiredSystemFeatures = [ "big-parallel" ]; # 1 thread but ~10G RAM; see #227945
12 export NIX_STORE_DIR=$TMPDIR/store
13 export NIX_STATE_DIR=$TMPDIR/state
14 export NIX_PATH=nixpkgs=$TMPDIR/barf.nix
18 echo 'abort "Illegal use of <nixpkgs> in Nixpkgs."' > $TMPDIR/barf.nix
20 # Make sure that Nixpkgs does not use <nixpkgs>.
21 badFiles=$(find $src/pkgs -type f -name '*.nix' -print | xargs grep -l '^[^#]*<nixpkgs/' || true)
22 if [[ -n $badFiles ]]; then
23 echo "Nixpkgs is not allowed to use <nixpkgs> to refer to itself."
24 echo "The offending files: $badFiles"
28 # Make sure that no paths collide on case-preserving or case-insensitive filesysytems.
29 conflictingPaths=$(find $src | awk '{ print $1 " " tolower($1) }' | sort -k2 | uniq -D -f 1 | cut -d ' ' -f 1)
30 if [[ -n $conflictingPaths ]]; then
31 echo "Files in nixpkgs must not vary only by case"
32 echo "The offending paths: $conflictingPaths"
39 # Check that all-packages.nix evaluates on a number of platforms without any warnings.
40 for platform in ${pkgs.lib.concatStringsSep " " supportedSystems}; do
41 echo "checking Nixpkgs on $platform"
43 # To get a call trace; see https://nixos.org/manual/nixpkgs/stable/#function-library-lib.trivial.warn
44 # Relies on impure eval
45 export NIX_ABORT_ON_WARN=true
47 # Suppress GC warnings
48 export GC_LARGE_ALLOC_WARN_INTERVAL=100000
54 --show-trace --argstr system "$platform" \
55 --arg config '{ allowAliases = false; }' \
56 --option experimental-features 'no-url-literals' \
57 -qa --drv-path --system-filter \* --system \
58 "''${opts[@]}" 2> eval-warnings.log > packages1
62 if [ "$rc" != "0" ]; then
67 s1=$(sha1sum packages1 | cut -c1-40)
70 --show-trace --argstr system "$platform" \
71 --arg config '{ allowAliases = false; }' \
72 --option experimental-features 'no-url-literals' \
73 -qa --drv-path --system-filter \* --system \
74 "''${opts[@]}" > packages2
76 s2=$(sha1sum packages2 | cut -c1-40)
78 if [[ $s1 != $s2 ]]; then
79 echo "Nixpkgs evaluation depends on Nixpkgs path"
80 diff packages1 packages2
84 # Catch any trace calls not caught by NIX_ABORT_ON_WARN (lib.warn)
85 if [ -s eval-warnings.log ]; then
86 echo "Nixpkgs on $platform evaluated with warnings, aborting"
87 echo "Warnings logged:"
93 --show-trace --argstr system "$platform" \
94 --arg config '{ allowAliases = false; }' \
95 --option experimental-features 'no-url-literals' \
96 -qa --drv-path --system-filter \* --system --meta --xml \
97 "''${opts[@]}" > /dev/null