pkgs/top-level/make-tarball.nix: add back the number of packages sanity check

But in a way that's fast.
This commit is contained in:
K900 2024-04-22 23:39:40 +03:00
parent 4a0c2fa837
commit ee6b0bdaa0
1 changed files with 10 additions and 3 deletions

View File

@ -34,13 +34,20 @@ pkgs.releaseTools.sourceTarball {
checkPhase = ''
echo "generating packages.json"
packages=$out/packages.json.br
(
echo -n '{"version":2,"packages":'
NIX_STATE_DIR=$TMPDIR NIX_PATH= nix-env -f $src -qa --meta --json --show-trace --arg config 'import ${./packages-config.nix}'
echo -n '}'
) | sed "s|$src/||g" | jq -c | brotli -9 > $packages
) | sed "s|$src/||g" | jq -c > packages.json
# Arbitrary number. The index has ~115k packages as of April 2024.
if [ $(jq -r '.packages | length' < packages.json) -lt 100000 ]; then
echo "ERROR: not enough packages in the search index, bailing out!"
exit 1
fi
packages=$out/packages.json.br
brotli -9 < packages.json > $packages
mkdir -p $out/nix-support
echo "file json-br $packages" >> $out/nix-support/hydra-build-products