Add packages.json to the tarball job

Moved from nixos-homepage.
This commit is contained in:
Eelco Dolstra 2020-03-24 16:31:51 +01:00
parent 4ed98532a2
commit d6ec410a47
No known key found for this signature in database
GPG Key ID: 8170B4726D7198DE
2 changed files with 26 additions and 4 deletions

View File

@ -22,7 +22,7 @@ releaseTools.sourceTarball {
then builtins.substring 0 8 nixpkgs.lastModified
else toString nixpkgs.revCount}.${nixpkgs.shortRev or "dirty"}";
buildInputs = [ nix.out jq lib-tests ];
buildInputs = [ nix.out jq lib-tests pkgs.brotli ];
configurePhase = ''
eval "$preConfigure"
@ -38,6 +38,8 @@ releaseTools.sourceTarball {
doCheck = true;
checkPhase = ''
set -o pipefail
export NIX_DB_DIR=$TMPDIR
export NIX_STATE_DIR=$TMPDIR
export NIX_PATH=nixpkgs=$TMPDIR/barf.nix
@ -83,12 +85,10 @@ releaseTools.sourceTarball {
--show-trace --argstr system "$platform" \
-qa --drv-path --system-filter \* --system --meta --xml \
"''${opts[@]}" > /dev/null
stopNest
done
header "checking eval-release.nix"
nix-instantiate --eval --strict --show-trace ./maintainers/scripts/eval-release.nix > /dev/null
stopNest
header "checking find-tarballs.nix"
nix-instantiate --readonly-mode --eval --strict --show-trace --json \
@ -100,7 +100,16 @@ releaseTools.sourceTarball {
echo "suspiciously low number of URLs"
exit 1
fi
stopNest
header "generating packages.json"
mkdir -p $out/nix-support
echo -n '{"version":2,"packages":' > tmp
nix-env -f . -I nixpkgs=${src} -qa --json --arg config 'import ${./packages-config.nix}' "''${opts[@]}" >> tmp
echo -n '}' >> tmp
packages=$out/packages.json.br
jq -c < tmp | brotli -9 > $packages
echo "file json-br $packages" >> $out/nix-support/hydra-build-products
'';
distPhase = ''

View File

@ -0,0 +1,13 @@
# Used in the generation of package search database.
{
# Ensures no aliases are in the results.
allowAliases = false;
# Enable recursion into attribute sets that nix-env normally doesn't look into
# so that we can get a more complete picture of the available packages for the
# purposes of the index.
packageOverrides = super: {
haskellPackages = super.recurseIntoAttrs super.haskellPackages;
rPackages = super.recurseIntoAttrs super.rPackages;
};
}