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 35f1c9980b4db8a..9aee8c394f5c10f 100644 --- a/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix +++ b/pkgs/development/tools/build-managers/bazel/bazel_6/default.nix @@ -23,6 +23,7 @@ , substituteAll , writeTextFile , writeShellApplication +, makeBinaryWrapper }: let @@ -129,7 +130,7 @@ let defaultShellPath = lib.makeBinPath defaultShellUtils; - bashWithDefaultShellUtils = writeShellApplication { + bashWithDefaultShellUtilsSh = writeShellApplication { name = "bash"; runtimeInputs = defaultShellUtils; text = '' @@ -140,6 +141,17 @@ let ''; }; + # Sript-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 + ''; + }; + platforms = lib.platforms.linux ++ lib.platforms.darwin; system = if stdenv.hostPlatform.isDarwin then "darwin" else "linux";