2024-04-17 07:53:10 +01:00
|
|
|
{ supportedSystems, nixpkgs, pkgs }:
|
2021-07-06 12:05:32 +01:00
|
|
|
|
2023-04-30 14:26:22 +01:00
|
|
|
pkgs.runCommand "nixpkgs-release-checks"
|
|
|
|
{
|
|
|
|
src = nixpkgs;
|
2024-04-17 07:53:10 +01:00
|
|
|
buildInputs = [ pkgs.nix ];
|
2023-04-30 14:26:22 +01:00
|
|
|
requiredSystemFeatures = [ "big-parallel" ]; # 1 thread but ~10G RAM; see #227945
|
|
|
|
}
|
|
|
|
''
|
2021-07-06 12:05:32 +01:00
|
|
|
set -o pipefail
|
|
|
|
|
2021-11-09 18:55:04 +00:00
|
|
|
export NIX_STORE_DIR=$TMPDIR/store
|
|
|
|
export NIX_STATE_DIR=$TMPDIR/state
|
2021-07-06 12:05:32 +01:00
|
|
|
export NIX_PATH=nixpkgs=$TMPDIR/barf.nix
|
2024-05-29 10:32:40 +01:00
|
|
|
opts=()
|
2021-07-06 12:05:32 +01:00
|
|
|
nix-store --init
|
|
|
|
|
|
|
|
echo 'abort "Illegal use of <nixpkgs> in Nixpkgs."' > $TMPDIR/barf.nix
|
|
|
|
|
|
|
|
# Make sure that Nixpkgs does not use <nixpkgs>.
|
2024-01-12 07:28:42 +00:00
|
|
|
badFiles=$(find $src/pkgs -type f -name '*.nix' -print | xargs grep -l '^[^#]*<nixpkgs/' || true)
|
2021-07-06 12:05:32 +01:00
|
|
|
if [[ -n $badFiles ]]; then
|
|
|
|
echo "Nixpkgs is not allowed to use <nixpkgs> to refer to itself."
|
|
|
|
echo "The offending files: $badFiles"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-07-04 09:46:13 +01:00
|
|
|
# Make sure that no paths collide on case-preserving or case-insensitive filesysytems.
|
|
|
|
conflictingPaths=$(find $src | awk '{ print $1 " " tolower($1) }' | sort -k2 | uniq -D -f 1 | cut -d ' ' -f 1)
|
|
|
|
if [[ -n $conflictingPaths ]]; then
|
|
|
|
echo "Files in nixpkgs must not vary only by case"
|
|
|
|
echo "The offending paths: $conflictingPaths"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-01-24 18:55:22 +00:00
|
|
|
src2=$TMPDIR/foo
|
|
|
|
cp -rd $src $src2
|
2021-07-06 12:05:32 +01:00
|
|
|
|
|
|
|
# Check that all-packages.nix evaluates on a number of platforms without any warnings.
|
|
|
|
for platform in ${pkgs.lib.concatStringsSep " " supportedSystems}; do
|
2023-01-15 22:08:12 +00:00
|
|
|
echo "checking Nixpkgs on $platform"
|
2021-07-06 12:05:32 +01:00
|
|
|
|
2022-01-10 11:43:04 +00:00
|
|
|
# To get a call trace; see https://nixos.org/manual/nixpkgs/stable/#function-library-lib.trivial.warn
|
|
|
|
# Relies on impure eval
|
|
|
|
export NIX_ABORT_ON_WARN=true
|
|
|
|
|
2024-07-31 08:02:18 +01:00
|
|
|
# Suppress GC warnings
|
|
|
|
export GC_LARGE_ALLOC_WARN_INTERVAL=100000
|
|
|
|
|
2022-02-05 13:32:54 +00:00
|
|
|
set +e
|
|
|
|
(
|
|
|
|
set -x
|
|
|
|
nix-env -f $src \
|
|
|
|
--show-trace --argstr system "$platform" \
|
|
|
|
--arg config '{ allowAliases = false; }' \
|
|
|
|
--option experimental-features 'no-url-literals' \
|
|
|
|
-qa --drv-path --system-filter \* --system \
|
|
|
|
"''${opts[@]}" 2> eval-warnings.log > packages1
|
|
|
|
)
|
|
|
|
rc=$?
|
|
|
|
set -e
|
|
|
|
if [ "$rc" != "0" ]; then
|
|
|
|
cat eval-warnings.log
|
|
|
|
exit $rc
|
|
|
|
fi
|
2022-01-24 18:55:22 +00:00
|
|
|
|
|
|
|
s1=$(sha1sum packages1 | cut -c1-40)
|
|
|
|
|
|
|
|
nix-env -f $src2 \
|
|
|
|
--show-trace --argstr system "$platform" \
|
|
|
|
--arg config '{ allowAliases = false; }' \
|
|
|
|
--option experimental-features 'no-url-literals' \
|
|
|
|
-qa --drv-path --system-filter \* --system \
|
|
|
|
"''${opts[@]}" > packages2
|
|
|
|
|
|
|
|
s2=$(sha1sum packages2 | cut -c1-40)
|
|
|
|
|
|
|
|
if [[ $s1 != $s2 ]]; then
|
|
|
|
echo "Nixpkgs evaluation depends on Nixpkgs path"
|
|
|
|
diff packages1 packages2
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-07-06 12:05:32 +01:00
|
|
|
|
2022-01-10 11:43:04 +00:00
|
|
|
# Catch any trace calls not caught by NIX_ABORT_ON_WARN (lib.warn)
|
2021-07-06 12:05:32 +01:00
|
|
|
if [ -s eval-warnings.log ]; then
|
|
|
|
echo "Nixpkgs on $platform evaluated with warnings, aborting"
|
2024-07-31 08:01:56 +01:00
|
|
|
echo "Warnings logged:"
|
|
|
|
cat eval-warnings.log
|
2021-07-06 12:05:32 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
nix-env -f $src \
|
|
|
|
--show-trace --argstr system "$platform" \
|
2021-08-15 16:52:55 +01:00
|
|
|
--arg config '{ allowAliases = false; }' \
|
2021-10-27 17:58:55 +01:00
|
|
|
--option experimental-features 'no-url-literals' \
|
2021-07-06 12:05:32 +01:00
|
|
|
-qa --drv-path --system-filter \* --system --meta --xml \
|
|
|
|
"''${opts[@]}" > /dev/null
|
|
|
|
done
|
|
|
|
|
|
|
|
touch $out
|
|
|
|
''
|