summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks
diff options
context:
space:
mode:
authorAndreas Rammhold <andreas@rammhold.de>2021-01-02 11:01:34 +0100
committerGitHub <noreply@github.com>2021-01-02 11:01:34 +0100
commitc2884c4011a9496b67ae2ccd8af126854628014b (patch)
tree5fac6558de0bd7920412e7ab8a324c3cb2735d32 /pkgs/build-support/setup-hooks
parent3050545e41b71b0be996b634b27d3a519f3b8b13 (diff)
parent61a6d1aae2f20ca7e714480907d87c6419ef1e80 (diff)
downloadnixpkgs-c2884c4011a9496b67ae2ccd8af126854628014b.tar
nixpkgs-c2884c4011a9496b67ae2ccd8af126854628014b.tar.gz
nixpkgs-c2884c4011a9496b67ae2ccd8af126854628014b.tar.bz2
nixpkgs-c2884c4011a9496b67ae2ccd8af126854628014b.tar.lz
nixpkgs-c2884c4011a9496b67ae2ccd8af126854628014b.tar.xz
nixpkgs-c2884c4011a9496b67ae2ccd8af126854628014b.tar.zst
nixpkgs-c2884c4011a9496b67ae2ccd8af126854628014b.zip
Merge pull request #106954 from r-burns/randomseed
[staging] stdenv: trim random seed to avoid reference cycles
Diffstat (limited to 'pkgs/build-support/setup-hooks')
-rw-r--r--pkgs/build-support/setup-hooks/reproducible-builds.sh7
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
+)"