summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Bouchard <guillaume.bouchard@tweag.io>2019-12-05 11:14:51 +0100
committerGuillaume Bouchard <guillaume.bouchard@tweag.io>2019-12-05 11:45:36 +0100
commit4fdea7312e8cfe13306cd8d70ee6b060dae956e3 (patch)
tree704627a864be693e4f6fe417cb7980e99f719515
parent1ce0375b2f76976956fe07ee344cdc861a0dca70 (diff)
downloadnixpkgs-4fdea7312e8cfe13306cd8d70ee6b060dae956e3.tar
nixpkgs-4fdea7312e8cfe13306cd8d70ee6b060dae956e3.tar.gz
nixpkgs-4fdea7312e8cfe13306cd8d70ee6b060dae956e3.tar.bz2
nixpkgs-4fdea7312e8cfe13306cd8d70ee6b060dae956e3.tar.lz
nixpkgs-4fdea7312e8cfe13306cd8d70ee6b060dae956e3.tar.xz
nixpkgs-4fdea7312e8cfe13306cd8d70ee6b060dae956e3.tar.zst
nixpkgs-4fdea7312e8cfe13306cd8d70ee6b060dae956e3.zip
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.
-rw-r--r--pkgs/development/tools/build-managers/bazel/bazel_rc.patch13
-rw-r--r--pkgs/development/tools/build-managers/bazel/default.nix13
2 files changed, 20 insertions, 6 deletions
diff --git a/pkgs/development/tools/build-managers/bazel/bazel_rc.patch b/pkgs/development/tools/build-managers/bazel/bazel_rc.patch
new file mode 100644
index 00000000000..a599ac3ec72
--- /dev/null
+++ b/pkgs/development/tools/build-managers/bazel/bazel_rc.patch
@@ -0,0 +1,13 @@
+diff --git a/src/main/cpp/option_processor.cc b/src/main/cpp/option_processor.cc
+index 8f8f15685f..a7ae52d1e4 100644
+--- a/src/main/cpp/option_processor.cc
++++ b/src/main/cpp/option_processor.cc
+@@ -56,7 +56,7 @@ OptionProcessor::OptionProcessor(
+     : workspace_layout_(workspace_layout),
+       startup_options_(std::move(default_startup_options)),
+       parse_options_called_(false),
+-      system_bazelrc_path_(BAZEL_SYSTEM_BAZELRC_PATH) {}
++      system_bazelrc_path_("@bazelSystemBazelRCPath@") {}
+ 
+ OptionProcessor::OptionProcessor(
+     const WorkspaceLayout* workspace_layout,
diff --git a/pkgs/development/tools/build-managers/bazel/default.nix b/pkgs/development/tools/build-managers/bazel/default.nix
index 2be3cac1748..e82bbb4aba1 100644
--- a/pkgs/development/tools/build-managers/bazel/default.nix
+++ b/pkgs/development/tools/build-managers/bazel/default.nix
@@ -171,6 +171,13 @@ stdenv.mkDerivation rec {
       src = ./strict_action_env.patch;
       strictActionEnvPatch = defaultShellPath;
     })
+
+    # bazel reads its system bazelrc in /etc
+    # override this path to a builtin one
+    (substituteAll {
+      src = ./bazel_rc.patch;
+      bazelSystemBazelRCPath = bazelRC;
+    })
   ] ++ lib.optional enableNixHacks ./nix-hacks.patch;
 
 
@@ -431,12 +438,6 @@ stdenv.mkDerivation rec {
       mv runfiles.bash.tmp tools/bash/runfiles/runfiles.bash
 
       patchShebangs .
-
-      # bazel reads its system bazelrc in /etc
-      # override this path to a builtin one
-      substituteInPlace \
-        src/main/cpp/option_processor.cc \
-        --replace BAZEL_SYSTEM_BAZELRC_PATH "\"${bazelRC}\""
     '';
     in lib.optionalString stdenv.hostPlatform.isDarwin darwinPatches
      + genericPatches;