bazel: bazelRC path set by a patch

In bazel source code change in the future, patch will fail and we'll
detect the regression sooner.

+20 -6
+13
pkgs/development/tools/build-managers/bazel/bazel_rc.patch
··· 1 + diff --git a/src/main/cpp/option_processor.cc b/src/main/cpp/option_processor.cc 2 + index 8f8f15685f..a7ae52d1e4 100644 3 + --- a/src/main/cpp/option_processor.cc 4 + +++ b/src/main/cpp/option_processor.cc 5 + @@ -56,7 +56,7 @@ OptionProcessor::OptionProcessor( 6 + : workspace_layout_(workspace_layout), 7 + startup_options_(std::move(default_startup_options)), 8 + parse_options_called_(false), 9 + - system_bazelrc_path_(BAZEL_SYSTEM_BAZELRC_PATH) {} 10 + + system_bazelrc_path_("@bazelSystemBazelRCPath@") {} 11 + 12 + OptionProcessor::OptionProcessor( 13 + const WorkspaceLayout* workspace_layout,
+7 -6
pkgs/development/tools/build-managers/bazel/default.nix
··· 171 171 src = ./strict_action_env.patch; 172 172 strictActionEnvPatch = defaultShellPath; 173 173 }) 174 + 175 + # bazel reads its system bazelrc in /etc 176 + # override this path to a builtin one 177 + (substituteAll { 178 + src = ./bazel_rc.patch; 179 + bazelSystemBazelRCPath = bazelRC; 180 + }) 174 181 ] ++ lib.optional enableNixHacks ./nix-hacks.patch; 175 182 176 183 ··· 431 438 mv runfiles.bash.tmp tools/bash/runfiles/runfiles.bash 432 439 433 440 patchShebangs . 434 - 435 - # bazel reads its system bazelrc in /etc 436 - # override this path to a builtin one 437 - substituteInPlace \ 438 - src/main/cpp/option_processor.cc \ 439 - --replace BAZEL_SYSTEM_BAZELRC_PATH "\"${bazelRC}\"" 440 441 ''; 441 442 in lib.optionalString stdenv.hostPlatform.isDarwin darwinPatches 442 443 + genericPatches;