diff --git a/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix index 6544db85a7f3..9703590bd4a7 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_3/default.nix @@ -211,6 +211,10 @@ stdenv.mkDerivation rec { src = ../bazel_rc.patch; bazelSystemBazelRCPath = bazelRC; }) + + # disable suspend detection during a build inside Nix as this is + # not available inside the darwin sandbox + ../bazel_darwin_sandbox.patch ] ++ lib.optional enableNixHacks ../nix-hacks.patch; diff --git a/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix index 511234a1e595..99897364e6af 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix @@ -246,6 +246,10 @@ stdenv.mkDerivation rec { src = ../bazel_rc.patch; bazelSystemBazelRCPath = bazelRC; }) + + # disable suspend detection during a build inside Nix as this is + # not available inside the darwin sandbox + ../bazel_darwin_sandbox.patch ] ++ lib.optional enableNixHacks ../nix-hacks.patch; diff --git a/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix index 0c06d6128317..45ac1b14b17d 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_5/default.nix @@ -208,6 +208,10 @@ stdenv.mkDerivation rec { src = ../bazel_rc.patch; bazelSystemBazelRCPath = bazelRC; }) + + # disable suspend detection during a build inside Nix as this is + # not available inside the darwin sandbox + ../bazel_darwin_sandbox.patch ] ++ lib.optional enableNixHacks ../nix-hacks.patch; diff --git a/pkgs/development/tools/build-managers/bazel/bazel_darwin_sandbox.patch b/pkgs/development/tools/build-managers/bazel/bazel_darwin_sandbox.patch new file mode 100644 index 000000000000..87e6c99287fb --- /dev/null +++ b/pkgs/development/tools/build-managers/bazel/bazel_darwin_sandbox.patch @@ -0,0 +1,11 @@ +diff -ru a/src/main/native/unix_jni_darwin.cc b/src/main/native/unix_jni_darwin.cc +--- a/src/main/native/unix_jni_darwin.cc 1980-01-01 00:00:00.000000000 -0500 ++++ b/src/main/native/unix_jni_darwin.cc 2021-11-27 20:35:29.000000000 -0500 +@@ -270,6 +270,7 @@ + } + + int portable_suspend_count() { ++ if (getenv("NIX_BUILD_TOP")) return 0; + static dispatch_once_t once_token; + static SuspendState suspend_state; + dispatch_once(&once_token, ^{