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
java: set an additional JAVA_HOME per major version #76699
Conversation
This makes it easier to discover multiple JDK installations, which can be required to be available side-by-side for some builds.
I'd argue this is something non-standard you should set in your environment, not in the nixpkgs derivations. But I am open to discussions. I have never had to use variables like these (I go though different |
It's definitely a niche use case, but a google search for
Yes, that is neater when possible. I have some builds that want to be able to find both JDK8 and JDK11 bootclasspaths during the same build (invocation/artifact), though, so that is where this would come in useful. |
Also |
If you introduce JAVA_?_HOME into nix derivations, then you create another de-facto standard only for nixpkgs. If this is not a standard respected by java but something which completely depends on how you handle it in a specific build, then I think, this should be set only for this build. Or is there any formal/generally accepted standard for handling multiple JDKs in one build? |
I agree that's not great, though https://www.google.com/search?client=firefox-b-d&q=JAVA_8_HOME suggests it's already not entirely unheard of. It's exotic, though, I agree - if there were some more widely used approach that would certainly be my preference.
Not as far as I know. |
Then why should the Nix community standardize it? This would also need to be documented and enforced. From the google search, my impression is that most of the time people set For your use case, @raboof (multiple JDKs at once): If there are the Is this use case very common? Or is your proposal an abstraction of multiple use cases? Are there others than this which would benefit from your proposal? Furthermore, why do you only assign |
I'll be the first to admit it's a somewhat niche situation, but it would definitely benefit other build tools and IDE's that allow 'interactively' switching between Java versions. |
I guess I also agree with the voices against this change since it contributes to promote non standard environments. If it's for niche situations why this should be rolled out in general and not be solved in user space. |
i think there is a real need for a standard way to discover the available JDK's. There is no standard way to achieve this, and such a standard isn't going to materialize spontaneously - it should emerge from smaller experiments. This could be such a smaller experiment.
I think one of the wonderful things of open source is that if someone cares enough about a certain niche, they can put in the work to have 'their' niche well-supported and contribute those improvements upstream. Having a single niche well-supported is of relatively little value, but accumulating and supporting many niches is an advantage for the project as a whole. Of course this has to be balanced against increased maintenance burden - but in this case I'd say that's pretty light. Anyway, this PR has gained a conflict, closing for now. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/auto-detecting-java-installations/4677/6 |
This makes it easier to discover multiple JDK installations
Motivation for this change
This can be useful for builds that require multiple JDK versions to be available side-by-side.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)Notify maintainers
cc @NeQuissimus @fpletz @edwtjo @volth @hlolli @taku0