buildGoModule: share the buildFlagsArray with the parallel subprocesses

This commit is contained in:
Shea Levy 2017-03-15 11:00:55 -04:00
parent 162845d5b1
commit d6c3e74425

View File

@ -116,6 +116,7 @@ go.stdenv.mkDerivation (
local d; local cmd;
cmd="$1"
d="$2"
. $TMPDIR/buildFlagsArray
echo "$d" | grep -q "\(/_\|examples\|Godeps\)" && return 0
[ -n "$excludedPackages" ] && echo "$d" | grep -q "$excludedPackages" && return 0
local OUT
@ -143,6 +144,11 @@ go.stdenv.mkDerivation (
fi
}
if [ ''${#buildFlagsArray[@]} -ne 0 ]; then
declare -p buildFlagsArray > $TMPDIR/buildFlagsArray
else
touch $TMPDIR/buildFlagsArray
fi
export -f buildGoDir # parallel needs to see the function
if [ -z "$enableParallelBuilding" ]; then
export NIX_BUILD_CORES=1