From d6ec410a471a5f26fcaaf8f4f440b41fe3f13738 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 24 Mar 2020 16:31:51 +0100 Subject: [PATCH] Add packages.json to the tarball job Moved from nixos-homepage. --- pkgs/top-level/make-tarball.nix | 17 +++++++++++++---- pkgs/top-level/packages-config.nix | 13 +++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 pkgs/top-level/packages-config.nix diff --git a/pkgs/top-level/make-tarball.nix b/pkgs/top-level/make-tarball.nix index ff0b0568819c..23542e4afe0a 100644 --- a/pkgs/top-level/make-tarball.nix +++ b/pkgs/top-level/make-tarball.nix @@ -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 = '' diff --git a/pkgs/top-level/packages-config.nix b/pkgs/top-level/packages-config.nix new file mode 100644 index 000000000000..8ce855780cf9 --- /dev/null +++ b/pkgs/top-level/packages-config.nix @@ -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; + }; +}