lol
at 23.11-beta 88 lines 2.8 kB view raw
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 3 evaluate correctly. */ 4 5{ nixpkgs 6, officialRelease 7, supportedSystems 8, pkgs ? import nixpkgs.outPath {} 9, nix ? pkgs.nix 10, lib-tests ? import ../../lib/tests/release.nix { inherit pkgs; } 11}: 12 13pkgs.releaseTools.sourceTarball { 14 name = "nixpkgs-tarball"; 15 src = nixpkgs; 16 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"}"; 23 24 buildInputs = with pkgs; [ nix.out jq lib-tests brotli ]; 25 26 configurePhase = '' 27 eval "$preConfigure" 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)" 33 ''; 34 35 requiredSystemFeatures = [ "big-parallel" ]; # 1 thread but ~36G RAM (!) see #227945 36 37 nixpkgs-basic-release-checks = import ./nixpkgs-basic-release-checks.nix 38 { inherit nix pkgs nixpkgs supportedSystems; }; 39 40 dontBuild = false; 41 42 doCheck = true; 43 44 checkPhase = '' 45 set -o pipefail 46 47 export NIX_STATE_DIR=$TMPDIR 48 export NIX_PATH=nixpkgs=$TMPDIR/barf.nix 49 opts=(--option build-users-group "") 50 nix-store --init 51 52 echo "checking eval-release.nix" 53 nix-instantiate --eval --strict --show-trace ./maintainers/scripts/eval-release.nix > /dev/null 54 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" 63 exit 1 64 fi 65 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 70 echo -n '}' >> tmp 71 packages=$out/packages.json.br 72 < tmp sed "s|$(pwd)/||g" | jq -c | brotli -9 > $packages 73 rm tmp 74 75 echo "file json-br $packages" >> $out/nix-support/hydra-build-products 76 ''; 77 78 distPhase = '' 79 mkdir -p $out/tarballs 80 mkdir ../$releaseName 81 cp -prd . ../$releaseName 82 (cd .. && tar cfa $out/tarballs/$releaseName.tar.xz $releaseName) || false 83 ''; 84 85 meta = { 86 maintainers = [ ]; 87 }; 88}