1 { supportedSystems, nixpkgs, pkgs, nix }:
3 pkgs.runCommand "nixpkgs-release-checks"
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
15 opts=(--option build-users-group "")
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
51 --show-trace --argstr system "$platform" \
52 --arg config '{ allowAliases = false; }' \
53 --option experimental-features 'no-url-literals' \
54 -qa --drv-path --system-filter \* --system \
55 "''${opts[@]}" 2> eval-warnings.log > packages1
59 if [ "$rc" != "0" ]; then
64 s1=$(sha1sum packages1 | cut -c1-40)
68 --show-trace --argstr system "$platform" \
69 --arg config '{ allowAliases = false; }' \
70 --option experimental-features 'no-url-literals' \
71 -qa --drv-path --system-filter \* --system \
72 "''${opts[@]}" > packages2
74 s2=$(sha1sum packages2 | cut -c1-40)
76 if [[ $s1 != $s2 ]]; then
77 echo "Nixpkgs evaluation depends on Nixpkgs path"
78 diff packages1 packages2
82 # Catch any trace calls not caught by NIX_ABORT_ON_WARN (lib.warn)
83 if [ -s eval-warnings.log ]; then
84 echo "Nixpkgs on $platform evaluated with warnings, aborting"
90 --show-trace --argstr system "$platform" \
91 --arg config '{ allowAliases = false; }' \
92 --option experimental-features 'no-url-literals' \
93 -qa --drv-path --system-filter \* --system --meta --xml \
94 "''${opts[@]}" > /dev/null