bazel: move configuration file to a proper nix store entry
Easier to read and maintain
This commit is contained in:
parent
273ec23322
commit
5b9e350fd4
1 changed files with 10 additions and 8 deletions
|
@ -21,6 +21,7 @@
|
||||||
, autoPatchelfHook
|
, autoPatchelfHook
|
||||||
, file
|
, file
|
||||||
, substituteAll
|
, substituteAll
|
||||||
|
, writeTextFile
|
||||||
}:
|
}:
|
||||||
|
|
||||||
let
|
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
|
in
|
||||||
stdenv.mkDerivation rec {
|
stdenv.mkDerivation rec {
|
||||||
pname = "bazel";
|
pname = "bazel";
|
||||||
|
@ -423,7 +432,7 @@ stdenv.mkDerivation rec {
|
||||||
# override this path to a builtin one
|
# override this path to a builtin one
|
||||||
substituteInPlace \
|
substituteInPlace \
|
||||||
src/main/cpp/option_processor.cc \
|
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
|
in lib.optionalString stdenv.hostPlatform.isDarwin darwinPatches
|
||||||
+ genericPatches;
|
+ genericPatches;
|
||||||
|
@ -477,13 +486,6 @@ stdenv.mkDerivation rec {
|
||||||
|
|
||||||
wrapProgram "$out/bin/bazel" --add-flags --server_javabase="${runJdk}"
|
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
|
# shell completion files
|
||||||
mkdir -p $out/share/bash-completion/completions $out/share/zsh/site-functions
|
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
|
mv ./bazel_src/output/bazel-complete.bash $out/share/bash-completion/completions/bazel
|
||||||
|
|
Loading…
Reference in a new issue