Commit 07942cdb authored by Adam Joseph's avatar Adam Joseph
Browse files

setup-hooks/reproducible-builds.sh: NIX_OUTPATH_USED_AS_RANDOM_SEED

For reproducibility, nixpkgs sets `-frandom-seed` to the first 10
characters of the outpath of the derivation being built.

This PR allows to manually select from which outpath the
10-character prefix is taken, by setting
`NIX_OUTPATH_USED_AS_RANDOM_SEED` as a derivation attribute (or
directly as an environment variable).

For an example use of this functionality, see:

  https://github.com/NixOS/nixpkgs/pull/209870
parent b9577233
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3,7 +3,8 @@
# 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=$(
    outbase="${out##*/}"
    randSeed=${NIX_OUTPATH_USED_AS_RANDOM_SEED:-$out}
    outbase="${randSeed##*/}"
    randomseed="${outbase:0:10}"
    echo $randomseed
)"