bazel: move configuration file to a proper nix store entry

Easier to read and maintain
wip/yesman
Guillaume Bouchard 5 years ago
parent 273ec23322
commit 5b9e350fd4
  1. 18
      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

Loading…
Cancel
Save