New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bazel: add bazel_jdk10 variant #46465
Conversation
Verified the |
590a4a7
to
769d677
Compare
@@ -3,7 +3,7 @@ | |||
, which, python, perl, gnused, gnugrep, findutils | |||
# Always assume all markers valid (don't redownload dependencies). | |||
# Also, don't clean up environment variables. | |||
, enableNixHacks ? false | |||
, enableNixHacks ? false, build_jdk ? jdk, run_jdk ? jdk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The jdk stuff should go to a newline to not be confused the comment above.
I think camel case is more commonly used for parameters that are meant to be overridden:
buildJdk
and runJdk
- then the it is less likely to collide with existing package names.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Reordered the lines and added a comment to make it clearer which are the straightforward dependencies being passed in and which are parameters to change the output of the derivation.
769d677
to
d1818ad
Compare
@@ -190,7 +192,7 @@ stdenv.mkDerivation rec { | |||
installPhase = '' | |||
mkdir -p $out/bin | |||
mv output/bazel $out/bin | |||
wrapProgram "$out/bin/bazel" --set JAVA_HOME "${jdk}" | |||
wrapProgram "$out/bin/bazel" --set JAVA_HOME "${runJdk}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if you should use --set-default
here? Then every user could also just set JAVA_HOME
instead of having to compile there own bazel version (for example oraclejdk
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JAVA_HOME is also set by the nix-shell itself:
$ nix-shell -p jdk --command 'echo $JAVA_HOME'
/nix/store/6ickqcxhghnlabk0hfzkmlz8za945dk3-openjdk-8u181b13/lib/openjdk
nix-shell -p jdk10 --command 'echo $JAVA_HOME'
these paths will be fetched (193.76 MiB download, 457.07 MiB unpacked):
/nix/store/d13mqf9gqqs52c8wv4s07rczvn3iqh46-openjdk-10.0.2-b13-jre
/nix/store/wdm57lny0nwhwfgwk0rgv6d606bv9m1d-openjdk-10.0.2-b13
copying path '/nix/store/d13mqf9gqqs52c8wv4s07rczvn3iqh46-openjdk-10.0.2-b13-jre' from 'https://cache.nixos.org'...
copying path '/nix/store/wdm57lny0nwhwfgwk0rgv6d606bv9m1d-openjdk-10.0.2-b13' from 'https://cache.nixos.org'...
bash: /run/user/1000/env-vars: cannot overwrite existing file
/nix/store/wdm57lny0nwhwfgwk0rgv6d606bv9m1d-openjdk-10.0.2-b13/lib/openjdk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see a lot of other derivations using this pattern, I think it's intentional to make them use the Nix jdk / jre instead of the system installed one: JAVA_HOME
tends to be set in many users' shell and they expect Nix packages to use the dependencies from Nix and not from their system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is from the point of view of using Nix as a package manager through profiles, rather than using nix-shell or NixOS.
Motivation for this change
To build Java 10 projects with Bazel, it needs to run with Java 10, but Bazel itself can only be built with Java 8.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)