diff --git a/pkgs/development/tools/build-managers/bazel/bazel_4/actions_path.patch b/pkgs/development/tools/build-managers/bazel/bazel_4/actions_path.patch index bade7fdb7165..1fa1e5748333 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_4/actions_path.patch +++ b/pkgs/development/tools/build-managers/bazel/bazel_4/actions_path.patch @@ -1,5 +1,5 @@ diff --git a/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java b/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java -index 6fff2af..7e2877e 100755 +index 6fff2af..7e2877e 100644 --- a/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java +++ b/src/main/java/com/google/devtools/build/lib/exec/local/PosixLocalEnvProvider.java @@ -47,6 +47,16 @@ public final class PosixLocalEnvProvider implements LocalEnvProvider { @@ -19,3 +19,23 @@ index 6fff2af..7e2877e 100755 String p = clientEnv.get("TMPDIR"); if (Strings.isNullOrEmpty(p)) { // Do not use `fallbackTmpDir`, use `/tmp` instead. This way if the user didn't export TMPDIR +index 95642767c6..39d3c62461 100644 +--- a/src/main/java/com/google/devtools/build/lib/exec/local/XcodeLocalEnvProvider.java ++++ b/src/main/java/com/google/devtools/build/lib/exec/local/XcodeLocalEnvProvider.java +@@ -74,6 +74,16 @@ public final class XcodeLocalEnvProvider implements LocalEnvProvider { + + ImmutableMap.Builder newEnvBuilder = ImmutableMap.builder(); + newEnvBuilder.putAll(Maps.filterKeys(env, k -> !k.equals("TMPDIR"))); ++ ++ // In case we are running on NixOS. ++ // If bash is called with an unset PATH on this platform, ++ // it will set it to /no-such-path and default tools will be missings. ++ // See, https://github.com/NixOS/nixpkgs/issues/94222 ++ // So we ensure that minimal dependencies are present. ++ if (!env.containsKey("PATH")){ ++ newEnvBuilder.put("PATH", "@actionsPathPatch@"); ++ } ++ + String p = clientEnv.get("TMPDIR"); + if (Strings.isNullOrEmpty(p)) { + // Do not use `fallbackTmpDir`, use `/tmp` instead. This way if the user didn't export TMPDIR 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 6bce4393e126..cabd0b512f7f 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_4/default.nix @@ -103,7 +103,22 @@ let # ], # ) # - [ bash coreutils findutils gawk gnugrep gnutar gnused gzip which unzip file zip python27 python3 ]; + [ + bash + coreutils + file + findutils + gawk + gnugrep + gnused + gnutar + gzip + python27 + python3 + unzip + which + zip + ]; # Java toolchain used for the build and tests javaToolchain = "@bazel_tools//tools/jdk:toolchain_${buildJdkName}"; @@ -516,12 +531,13 @@ stdenv.mkDerivation rec { # when a command can’t be found in a bazel build, you might also # need to add it to `defaultShellPath`. nativeBuildInputs = [ + coreutils installShellFiles - zip + makeWrapper python3 unzip - makeWrapper which + zip ] ++ lib.optionals (stdenv.isDarwin) [ cctools libcxx CoreFoundation CoreServices Foundation ]; # Bazel makes extensive use of symlinks in the WORKSPACE.