···7575 }
7676 ''
7777 # Bazel needs a real home for self-extraction and internal cache
7878- export HOME=$(mktemp -d)
7878+ mkdir bazel_home
7979+ export HOME=$PWD/bazel_home
79808081 ${# Concurrent bazel invocations have the same workspace path.
8181- # On darwin, for some reason, it means they access and corrupt the same execroot.
8282- # Having a different workspace path ensures we use different execroots.
8383- # A different user seems to be enough for a different bazel cache root.
8282+ # On darwin, for some reason, it means they access and corrupt the
8383+ # same outputRoot, outputUserRoot and outputBase
8484+ # Ensure they use build-local outputRoot by setting TEST_TMPDIR
8485 lib.optionalString isDarwin ''
8585- export USER=$(basename $HOME)
8686- # cd $(mktemp --tmpdir=. -d)
8686+ export TEST_TMPDIR=$HOME/.cache/bazel
8787 ''
8888 }
8989 ${# Speed-up tests by caching bazel extraction.