1 /* Hydra job to build a tarball for Nixpkgs from a Git checkout. It
2 also builds the documentation and tests whether the Nix expressions
8 , pkgs ? import nixpkgs.outPath {}
10 , lib-tests ? import ../../lib/tests/release.nix { inherit pkgs; }
13 pkgs.releaseTools.sourceTarball {
14 name = "nixpkgs-tarball";
17 inherit officialRelease;
18 version = pkgs.lib.fileContents ../../.version;
19 versionSuffix = "pre${
20 if nixpkgs ? lastModified
21 then builtins.substring 0 8 (nixpkgs.lastModifiedDate or nixpkgs.lastModified)
22 else toString (nixpkgs.revCount or 0)}.${nixpkgs.shortRev or "dirty"}";
24 buildInputs = with pkgs; [ nix.out jq lib-tests brotli ];
28 releaseName=nixpkgs-$VERSION$VERSION_SUFFIX
29 echo -n $VERSION_SUFFIX > .version-suffix
30 echo -n ${nixpkgs.rev or nixpkgs.shortRev or "dirty"} > .git-revision
31 echo "release name is $releaseName"
32 echo "git-revision is $(cat .git-revision)"
35 requiredSystemFeatures = [ "big-parallel" ]; # 1 thread but ~36G RAM (!) see #227945
37 nixpkgs-basic-release-checks = import ./nixpkgs-basic-release-checks.nix
38 { inherit nix pkgs nixpkgs supportedSystems; };
47 export NIX_STATE_DIR=$TMPDIR
48 export NIX_PATH=nixpkgs=$TMPDIR/barf.nix
49 opts=(--option build-users-group "")
52 echo "checking eval-release.nix"
53 nix-instantiate --eval --strict --show-trace ./maintainers/scripts/eval-release.nix > /dev/null
55 echo "checking find-tarballs.nix"
56 nix-instantiate --readonly-mode --eval --strict --show-trace --json \
57 ./maintainers/scripts/find-tarballs.nix \
58 --arg expr 'import ./maintainers/scripts/all-tarballs.nix' > $TMPDIR/tarballs.json
59 nrUrls=$(jq -r '.[].url' < $TMPDIR/tarballs.json | wc -l)
60 echo "found $nrUrls URLs"
61 if [ "$nrUrls" -lt 10000 ]; then
62 echo "suspiciously low number of URLs"
66 echo "generating packages.json"
67 mkdir -p $out/nix-support
68 echo -n '{"version":2,"packages":' > tmp
69 nix-env -f . -I nixpkgs=$src -qa --meta --json --show-trace --arg config 'import ${./packages-config.nix}' "''${opts[@]}" >> tmp
71 packages=$out/packages.json.br
72 < tmp sed "s|$(pwd)/||g" | jq -c | brotli -9 > $packages
75 echo "file json-br $packages" >> $out/nix-support/hydra-build-products
79 mkdir -p $out/tarballs
81 cp -prd . ../$releaseName
82 (cd .. && tar cfa $out/tarballs/$releaseName.tar.xz $releaseName) || false