diff options
author | Ryan Burns <rtburns@protonmail.com> | 2020-12-15 00:05:57 -0800 |
---|---|---|
committer | Ryan Burns <rtburns@protonmail.com> | 2020-12-23 16:46:39 -0800 |
commit | 61a6d1aae2f20ca7e714480907d87c6419ef1e80 (patch) | |
tree | 9999b84e3fa6c80c7a1c34389dcfd095d6e42de1 /pkgs/build-support/setup-hooks | |
parent | 85298db412bc3f768d0eba099f69a8014525c5dc (diff) | |
download | nixpkgs-61a6d1aae2f20ca7e714480907d87c6419ef1e80.tar nixpkgs-61a6d1aae2f20ca7e714480907d87c6419ef1e80.tar.gz nixpkgs-61a6d1aae2f20ca7e714480907d87c6419ef1e80.tar.bz2 nixpkgs-61a6d1aae2f20ca7e714480907d87c6419ef1e80.tar.lz nixpkgs-61a6d1aae2f20ca7e714480907d87c6419ef1e80.tar.xz nixpkgs-61a6d1aae2f20ca7e714480907d87c6419ef1e80.tar.zst nixpkgs-61a6d1aae2f20ca7e714480907d87c6419ef1e80.zip |
stdenv: trim random seed to avoid reference cycles
Using the full store hash as the random seed occasionally caused reference cycles when the invocation was stored in output artifacts. For example, cross-compiled gcc was failing due to this: https://hydra.nixos.org/eval/1631713#tabs-now-fail Simply truncating the hash is sufficient to avoid this.
Diffstat (limited to 'pkgs/build-support/setup-hooks')
-rw-r--r-- | pkgs/build-support/setup-hooks/reproducible-builds.sh | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/pkgs/build-support/setup-hooks/reproducible-builds.sh b/pkgs/build-support/setup-hooks/reproducible-builds.sh index 2d8db6ff7d3..5b01c213fe4 100644 --- a/pkgs/build-support/setup-hooks/reproducible-builds.sh +++ b/pkgs/build-support/setup-hooks/reproducible-builds.sh @@ -1,4 +1,9 @@ # Use the last part of the out path as hash input for the build. # This should ensure that it is deterministic across rebuilds of the same # derivation and not easily collide with other builds. -export NIX_CFLAGS_COMPILE+=" -frandom-seed=${out##*/}" +# We also truncate the hash so that it cannot cause reference cycles. +export NIX_CFLAGS_COMPILE+=" -frandom-seed=$( + outbase="${out##*/}" + randomseed="${outbase:0:10}" + echo $randomseed +)" |