2016-01-19 20:25:08 +00:00
|
|
|
{ nixpkgs
|
|
|
|
, officialRelease
|
|
|
|
, pkgs ? import nixpkgs.outPath {}
|
|
|
|
, nix ? pkgs.nix
|
2019-07-10 09:45:52 +00:00
|
|
|
, lib-tests ? import ../../lib/tests/release.nix { inherit pkgs; }
|
2016-01-19 20:25:08 +00:00
|
|
|
}:
|
2009-03-09 17:49:13 +00:00
|
|
|
|
2021-07-06 11:05:32 +00:00
|
|
|
pkgs.releaseTools.sourceTarball {
|
2009-03-09 17:49:13 +00:00
|
|
|
name = "nixpkgs-tarball";
|
|
|
|
src = nixpkgs;
|
|
|
|
|
2013-10-01 11:45:14 +00:00
|
|
|
inherit officialRelease;
|
2016-08-01 09:34:54 +00:00
|
|
|
version = pkgs.lib.fileContents ../../.version;
|
2019-05-29 19:28:33 +00:00
|
|
|
versionSuffix = "pre${
|
|
|
|
if nixpkgs ? lastModified
|
2020-04-02 16:01:45 +00:00
|
|
|
then builtins.substring 0 8 (nixpkgs.lastModifiedDate or nixpkgs.lastModified)
|
2023-05-29 02:30:53 +00:00
|
|
|
else toString (nixpkgs.revCount or 0)}.${nixpkgs.shortRev or "dirty"}";
|
2012-06-04 04:12:17 +00:00
|
|
|
|
2021-07-08 11:03:57 +00:00
|
|
|
buildInputs = with pkgs; [ nix.out jq lib-tests brotli ];
|
2009-03-09 17:49:13 +00:00
|
|
|
|
|
|
|
configurePhase = ''
|
|
|
|
eval "$preConfigure"
|
2012-06-04 04:12:17 +00:00
|
|
|
releaseName=nixpkgs-$VERSION$VERSION_SUFFIX
|
2013-10-01 11:45:14 +00:00
|
|
|
echo -n $VERSION_SUFFIX > .version-suffix
|
2020-02-10 15:25:33 +00:00
|
|
|
echo -n ${nixpkgs.rev or nixpkgs.shortRev or "dirty"} > .git-revision
|
2009-03-09 17:49:13 +00:00
|
|
|
echo "release name is $releaseName"
|
2017-10-11 03:06:45 +00:00
|
|
|
echo "git-revision is $(cat .git-revision)"
|
2009-03-09 17:49:13 +00:00
|
|
|
'';
|
|
|
|
|
2024-04-23 05:54:07 +00:00
|
|
|
dontUnpack = true;
|
|
|
|
|
2009-03-09 17:49:13 +00:00
|
|
|
dontBuild = false;
|
|
|
|
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
checkPhase = ''
|
2024-04-22 19:59:43 +00:00
|
|
|
echo "generating packages.json"
|
2012-11-29 13:10:49 +00:00
|
|
|
|
2024-04-22 19:59:43 +00:00
|
|
|
(
|
|
|
|
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 '}'
|
2024-04-22 20:39:40 +00:00
|
|
|
) | 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
|
2020-03-24 15:31:51 +00:00
|
|
|
|
|
|
|
mkdir -p $out/nix-support
|
2024-04-23 05:54:07 +00:00
|
|
|
brotli -9 < packages.json > $packages
|
2020-03-24 15:31:51 +00:00
|
|
|
echo "file json-br $packages" >> $out/nix-support/hydra-build-products
|
2009-03-09 17:49:13 +00:00
|
|
|
'';
|
|
|
|
|
2024-06-04 06:45:40 +00:00
|
|
|
# --hard-dereference: reproducibility for src if auto-optimise-store = true
|
|
|
|
# Some context: https://github.com/NixOS/infra/issues/438
|
2009-03-09 17:49:13 +00:00
|
|
|
distPhase = ''
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/tarballs
|
2024-04-22 19:59:43 +00:00
|
|
|
XZ_OPT="-T0" tar \
|
|
|
|
--create \
|
|
|
|
--xz \
|
|
|
|
--file=$out/tarballs/$releaseName.tar.xz \
|
2024-04-23 06:13:59 +00:00
|
|
|
--absolute-names \
|
|
|
|
--transform="s|^$src|$releaseName|g" \
|
|
|
|
--transform="s|^$(pwd)|$releaseName|g" \
|
|
|
|
--owner=0 \
|
|
|
|
--group=0 \
|
|
|
|
--numeric-owner \
|
|
|
|
--format=gnu \
|
|
|
|
--sort=name \
|
|
|
|
--mtime="@$SOURCE_DATE_EPOCH" \
|
|
|
|
--mode=ug+w \
|
2024-06-04 06:45:40 +00:00
|
|
|
--hard-dereference \
|
2024-04-23 05:54:07 +00:00
|
|
|
$src $(pwd)/{.version-suffix,.git-revision}
|
2009-03-09 17:49:13 +00:00
|
|
|
'';
|
|
|
|
}
|