diff --git a/pkgs/development/tools/build-managers/bazel/default.nix b/pkgs/development/tools/build-managers/bazel/default.nix index aef940732193..7a5ca2f90d2a 100644 --- a/pkgs/development/tools/build-managers/bazel/default.nix +++ b/pkgs/development/tools/build-managers/bazel/default.nix @@ -21,6 +21,7 @@ , autoPatchelfHook , file , substituteAll +, writeTextFile }: let @@ -126,6 +127,14 @@ let ''; }; + bazelRC = writeTextFile { + name = "bazel-rc"; + text = '' + build --override_repository=${remote_java_tools.name}=${remote_java_tools} + build --distdir=${distDir} + ''; + }; + in stdenv.mkDerivation rec { pname = "bazel"; @@ -423,7 +432,7 @@ stdenv.mkDerivation rec { # override this path to a builtin one substituteInPlace \ src/main/cpp/option_processor.cc \ - --replace BAZEL_SYSTEM_BAZELRC_PATH "\"$out/etc/bazelrc\"" + --replace BAZEL_SYSTEM_BAZELRC_PATH "\"${bazelRC}\"" ''; in lib.optionalString stdenv.hostPlatform.isDarwin darwinPatches + genericPatches; @@ -477,13 +486,6 @@ stdenv.mkDerivation rec { wrapProgram "$out/bin/bazel" --add-flags --server_javabase="${runJdk}" - # generates the system bazelrc - # warning: the name of the repository depends on the system, hence - # the reference to .name - mkdir $out/etc - echo "build --override_repository=${remote_java_tools.name}=${remote_java_tools}" > $out/etc/bazelrc - echo "build --distdir=${distDir}" >> $out/etc/bazelrc - # shell completion files mkdir -p $out/share/bash-completion/completions $out/share/zsh/site-functions mv ./bazel_src/output/bazel-complete.bash $out/share/bash-completion/completions/bazel