depot/third_party/nixpkgs/pkgs/build-support/setup-hooks/reproducible-builds.sh
Default email 83405b6dd2 Project import generated by Copybara.
GitOrigin-RevId: ac718d02867a84b42522a0ece52d841188208f2c
2023-03-15 17:39:30 +01:00

11 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