Files
Alex O'Brien 81f13fc690 bazel_9: init at 9.0.1
This is almost the same as bazel_8. The differences are:
* Extra args for Darwin are passed by environment variable, since
  Bazel 9 is stricter about preventing include flags reaching outside
  the repository.
* The Java test is switched to vendor mode, to apply fixups to ijar.
* Various patch changes due to upstreaming and churn.
* --spawn_strategy=local passed for tests on Darwin, otherwise they
  fail due to nested sandboxing (this seems to be the case for bazel_8
  as well).
* --repo_contents_cache= passed for FOD generation. This is the old
  Bazel 8 default, and prevents an error because the contents cache is
  not allowed to be within the repository.
* Disabled universal binaries in protobuf on Darwin. This breaks the
  build when sandboxed.
* Patched out '/usr/bin/env bash' in generate_system_module_map.sh in
  tests, as this breaks under Darwin sandbox.
2026-03-14 18:12:33 +11:00

42 lines
1.2 KiB
Nix

{
lib,
makeBinaryWrapper,
writeShellApplication,
bash,
stdenv,
}:
{ defaultShellUtils }:
let
defaultShellPath = lib.makeBinPath defaultShellUtils;
bashWithDefaultShellUtilsSh = writeShellApplication {
name = "bash";
runtimeInputs = defaultShellUtils;
# Empty PATH in Nixpkgs Bash is translated to /no-such-path
# On other distros empty PATH search fallback is looking in standard
# locations like /bin,/usr/bin
# For Bazel many rules rely on such search finding some common utils,
# so we provide them in case rules or arguments didn't specify a precise PATH
text = ''
if [[ "$PATH" == "/no-such-path" ]]; then
export PATH=${defaultShellPath}
fi
exec ${bash}/bin/bash "$@"
'';
};
in
{
inherit defaultShellUtils defaultShellPath;
# Script-based interpreters in shebangs aren't guaranteed to work,
# especially on MacOS. So let's produce a binary
bashWithDefaultShellUtils = stdenv.mkDerivation {
name = "bash";
src = bashWithDefaultShellUtilsSh;
nativeBuildInputs = [ makeBinaryWrapper ];
buildPhase = ''
makeWrapper ${bashWithDefaultShellUtilsSh}/bin/bash $out/bin/bash
'';
};
}