bazel: move configuration file to a proper nix store entry

Easier to read and maintain

+10 -8
+10 -8
pkgs/development/tools/build-managers/bazel/default.nix
··· 21 21 , autoPatchelfHook 22 22 , file 23 23 , substituteAll 24 + , writeTextFile 24 25 }: 25 26 26 27 let ··· 123 124 installPhase = '' 124 125 cp -Ra * $out/ 125 126 touch $out/WORKSPACE 127 + ''; 128 + }; 129 + 130 + bazelRC = writeTextFile { 131 + name = "bazel-rc"; 132 + text = '' 133 + build --override_repository=${remote_java_tools.name}=${remote_java_tools} 134 + build --distdir=${distDir} 126 135 ''; 127 136 }; 128 137 ··· 423 432 # override this path to a builtin one 424 433 substituteInPlace \ 425 434 src/main/cpp/option_processor.cc \ 426 - --replace BAZEL_SYSTEM_BAZELRC_PATH "\"$out/etc/bazelrc\"" 435 + --replace BAZEL_SYSTEM_BAZELRC_PATH "\"${bazelRC}\"" 427 436 ''; 428 437 in lib.optionalString stdenv.hostPlatform.isDarwin darwinPatches 429 438 + genericPatches; ··· 476 485 mv ./bazel_src/output/bazel $out/bin/bazel-real 477 486 478 487 wrapProgram "$out/bin/bazel" --add-flags --server_javabase="${runJdk}" 479 - 480 - # generates the system bazelrc 481 - # warning: the name of the repository depends on the system, hence 482 - # the reference to .name 483 - mkdir $out/etc 484 - echo "build --override_repository=${remote_java_tools.name}=${remote_java_tools}" > $out/etc/bazelrc 485 - echo "build --distdir=${distDir}" >> $out/etc/bazelrc 486 488 487 489 # shell completion files 488 490 mkdir -p $out/share/bash-completion/completions $out/share/zsh/site-functions