diff options
Diffstat (limited to 'pkgs/development/tools/build-managers/bazel/bazel_6/default.nix')
-rw-r--r-- | pkgs/development/tools/build-managers/bazel/bazel_6/default.nix | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix index 545236b561c..35f1c9980b4 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix @@ -22,15 +22,16 @@ , file , substituteAll , writeTextFile +, writeShellApplication }: let - version = "6.3.2"; + version = "6.4.0"; sourceRoot = "."; src = fetchurl { url = "https://github.com/bazelbuild/bazel/releases/download/${version}/bazel-${version}-dist.zip"; - hash = "sha256-jNf+rFgZO+K8ukUbpmiKRoJNN8pjWf9Y4NROuY8EKUg="; + hash = "sha256-vYj/YCyLuynugroqaxKtCS1R7GaMZXf5Yo8Y5I/05R4="; }; # Update with @@ -128,6 +129,17 @@ let defaultShellPath = lib.makeBinPath defaultShellUtils; + bashWithDefaultShellUtils = writeShellApplication { + name = "bash"; + runtimeInputs = defaultShellUtils; + text = '' + if [[ "$PATH" == "/no-such-path" ]]; then + export PATH=${defaultShellPath} + fi + exec ${bash}/bin/bash "$@" + ''; + }; + platforms = lib.platforms.linux ++ lib.platforms.darwin; system = if stdenv.hostPlatform.isDarwin then "darwin" else "linux"; @@ -330,6 +342,8 @@ stdenv.mkDerivation rec { installPhase = '' runHook preInstall + # prevent bazel version check failing in the updater + rm .bazelversion cp -r . "$out" runHook postInstall @@ -418,8 +432,8 @@ stdenv.mkDerivation rec { # If you add more replacements here, you must change the grep above! # Only files containing /bin are taken into account. substituteInPlace "$path" \ - --replace /bin/bash ${bash}/bin/bash \ - --replace "/usr/bin/env bash" ${bash}/bin/bash \ + --replace /bin/bash ${bashWithDefaultShellUtils}/bin/bash \ + --replace "/usr/bin/env bash" ${bashWithDefaultShellUtils}/bin/bash \ --replace "/usr/bin/env python" ${python3}/bin/python \ --replace /usr/bin/env ${coreutils}/bin/env \ --replace /bin/true ${coreutils}/bin/true @@ -434,17 +448,17 @@ stdenv.mkDerivation rec { # bazel test runner include references to /bin/bash substituteInPlace tools/build_rules/test_rules.bzl \ - --replace /bin/bash ${bash}/bin/bash + --replace /bin/bash ${bashWithDefaultShellUtils}/bin/bash for i in $(find tools/cpp/ -type f) do substituteInPlace $i \ - --replace /bin/bash ${bash}/bin/bash + --replace /bin/bash ${bashWithDefaultShellUtils}/bin/bash done # Fixup scripts that generate scripts. Not fixed up by patchShebangs below. substituteInPlace scripts/bootstrap/compile.sh \ - --replace /bin/bash ${bash}/bin/bash + --replace /bin/bash ${bashWithDefaultShellUtils}/bin/bash # add nix environment vars to .bazelrc cat >> .bazelrc <<EOF @@ -521,7 +535,7 @@ stdenv.mkDerivation rec { in lib.optionalString stdenv.hostPlatform.isDarwin darwinPatches + genericPatches; - buildInputs = [buildJdk] ++ defaultShellUtils; + buildInputs = [buildJdk bashWithDefaultShellUtils] ++ defaultShellUtils; # when a command can’t be found in a bazel build, you might also # need to add it to `defaultShellPath`. |