summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks/reproducible-builds.sh
blob: 29efd22d9051e10ccbf6b6693253d37cf6ece9db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
# shellcheck disable=SC2148
# 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 might not have been defined before
NIX_CFLAGS_COMPILE="${NIX_CFLAGS_COMPILE:-} -frandom-seed=$(
    # shellcheck disable=SC2154
    outbase="${out##*/}"
    randomseed="${outbase:0:10}"
    echo "$randomseed"
)"
export NIX_CFLAGS_COMPILE