summary refs log tree commit diff
diff options
context:
space:
mode:
authorWael Nasreddine <wael.nasreddine@gmail.com>2019-06-22 17:47:15 -0700
committerGitHub <noreply@github.com>2019-06-22 17:47:15 -0700
commite0c8a45d5d476954c0b593f031af8e8c33d5d279 (patch)
tree61bcdc96a05f40b6a81e0d867004f628b00ee6f5
parent203ea0d5be74cc850ca2c8c689e9d43388e8c485 (diff)
parent883725b22fc8e22048e315b743b03192565b1a1a (diff)
downloadnixpkgs-e0c8a45d5d476954c0b593f031af8e8c33d5d279.tar
nixpkgs-e0c8a45d5d476954c0b593f031af8e8c33d5d279.tar.gz
nixpkgs-e0c8a45d5d476954c0b593f031af8e8c33d5d279.tar.bz2
nixpkgs-e0c8a45d5d476954c0b593f031af8e8c33d5d279.tar.lz
nixpkgs-e0c8a45d5d476954c0b593f031af8e8c33d5d279.tar.xz
nixpkgs-e0c8a45d5d476954c0b593f031af8e8c33d5d279.tar.zst
nixpkgs-e0c8a45d5d476954c0b593f031af8e8c33d5d279.zip
Merge pull request #63580 from timokau/bazel-symlink-fix
buildBazelPackage: fix directory symlink handling, disable multithreaded fetching
-rw-r--r--pkgs/build-support/build-bazel-package/default.nix10
1 files changed, 7 insertions, 3 deletions
diff --git a/pkgs/build-support/build-bazel-package/default.nix b/pkgs/build-support/build-bazel-package/default.nix
index b0840192ece..1004a7ce3f9 100644
--- a/pkgs/build-support/build-bazel-package/default.nix
+++ b/pkgs/build-support/build-bazel-package/default.nix
@@ -34,8 +34,10 @@ in stdenv.mkDerivation (fBuildAttrs // {
       # https://github.com/bazelbuild/bazel/blob/9323c57607d37f9c949b60e293b573584906da46/src/main/cpp/startup_options.cc#L123-L124
       #
       # On macOS Bazel will use the system installed Xcode or CLT toolchain instead of the one in the PATH unless we pass BAZEL_USE_CPP_ONLY_TOOLCHAIN
-      #
-      BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 USER=homeless-shelter bazel --output_base="$bazelOut" --output_user_root="$bazelUserRoot" fetch $bazelFlags $bazelTarget
+
+      # We disable multithreading for the fetching phase since it can lead to timeouts with many dependencies/threads:
+      # https://github.com/bazelbuild/bazel/issues/6502
+      BAZEL_USE_CPP_ONLY_TOOLCHAIN=1 USER=homeless-shelter bazel --output_base="$bazelOut" --output_user_root="$bazelUserRoot" fetch --loading_phase_threads=1 $bazelFlags $bazelTarget
 
       runHook postBuild
     '';
@@ -59,7 +61,9 @@ in stdenv.mkDerivation (fBuildAttrs // {
 
       # Patching symlinks to remove build directory reference
       find $bazelOut/external -type l | while read symlink; do
-        ln -sf $(readlink "$symlink" | sed "s,$NIX_BUILD_TOP,NIX_BUILD_TOP,") "$symlink"
+        new_target="$(readlink "$symlink" | sed "s,$NIX_BUILD_TOP,NIX_BUILD_TOP,")"
+        rm "$symlink"
+        ln -sf "$new_target" "$symlink"
       done
 
       cp -r $bazelOut/external $out