reproducible-builds.sh: fatal: += not allowed in assignment

take in account undefined case
assign and export in separate step
https://github.com/koalaman/shellcheck/wiki/SC2155
This commit is contained in:
happysalada 2021-06-26 04:40:07 +09:00 committed by Raphael Megzari
parent db78412f25
commit db37d37d84

View File

@ -1,9 +1,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.
export NIX_CFLAGS_COMPILE+=" -frandom-seed=$(
# 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
echo "$randomseed"
)"
export NIX_CFLAGS_COMPILE