1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-17 19:21:04 +00:00
nixpkgs/pkgs/build-support/setup-hooks/reproducible-builds.sh
Sergei Trofimovich f488b617ab
setup-hooks/reproducible-builds.sh: NIX_OUTPATH_USED_AS_RANDOM_SEED (take 2) (#216967)
This time the change targets `staging`.

This reverts commit e1f1c7eb79.
2023-02-18 15:53:42 +01:00

12 lines
492 B
Bash

# 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.
# We also truncate the hash so that it cannot cause reference cycles.
NIX_CFLAGS_COMPILE="${NIX_CFLAGS_COMPILE:-} -frandom-seed=$(
randSeed=${NIX_OUTPATH_USED_AS_RANDOM_SEED:-$out}
outbase="${randSeed##*/}"
randomseed="${outbase:0:10}"
echo $randomseed
)"
export NIX_CFLAGS_COMPILE