Skip to content

Commit

Permalink
Fix packing nixexprs in release job, better compression
Browse files Browse the repository at this point in the history
upstream introduced a test which tests behaviour with broken symlinks,
related to RFC 140.
Our combined sources for the release tarball contain symlinks to the
various inputs (nixpkgs, fc, nixos-mailserver) which have to be
dereferenced by tar, thus using the -h option. This causes tar to
fail on the test symlink which points to nothing.

We use tar now without dereferencing which makes it a bit more
complicated to get the desired archive structure.

This change also modifies xz compression settings to reduce file size
and decompression time. xz now uses the default of -6 with additional
"extreme" tuning which reduces size even further without increasing
decompression time. We now also use all available cores for compression.
  • Loading branch information
dpausp committed Sep 8, 2023
1 parent 0c21a8f commit 96e3872
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions release/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -333,17 +333,27 @@ jobs // {

patchPhase = "touch .update-on-nixos-rebuild";

XZ_OPT = "-1";
tarOpts = ''
--owner=0 --group=0 --mtime="1970-01-01 00:00:00 UTC" \
--owner=0 --group=0 \
--mtime="1970-01-01 00:00:00 UTC" \
--exclude-vcs-ignores \
--transform='s!^\.!${name}!' \
'';

installPhase = ''
mkdir -p $out/{tarballs,nix-support}
cd nixos
tar cJhf $out/tarballs/nixexprs.tar.xz ${tarOpts} .
tarball=$out/tarballs/nixexprs.tar
for file in nixos/* nixos/.*; do
if [ -f "$file" ]; then
tar uf "$tarball" --transform "s|^nixos|${name}|" ${tarOpts} "$file"
fi
done
for d in nixos/*/; do
tar uf "$tarball" --transform "s|^$d\\.|${name}/$(basename "$d")|" ${tarOpts} "$d."
done
xz -T0 -e "$tarball"
echo "channel - $out/tarballs/nixexprs.tar.xz" > "$out/nix-support/hydra-build-products"
echo $constituents > "$out/nix-support/hydra-aggregate-constituents"
Expand Down

0 comments on commit 96e3872

Please sign in to comment.