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
openjdk: add jdk11 jre and headless jre #98275
Conversation
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'm not sure that we gain anything by having a separate jre. The only reason to have it is to reduce disk space, right? With openjdk8, this worked because the jdk had a symlink to the jre and they shared the common parts. The jdk only contained ~90M of extra files.
However with openjdk11, these would all be duplicated:
$ nix path-info -shf. openjdk11{,_headless}{,_jre}
/nix/store/0lk952m5wd3mfxrky83fjvcabzl5p56m-openjdk-headless-11.0.8+10 533.1M
/nix/store/9rrfn0ym3k0viq320zym034cr9zwfz8n-openjdk-11.0.8+10-jre 327.2M
/nix/store/ly9hzlych5qsnnd6y65bzl1a4b64acvl-openjdk-headless-11.0.8+10-jre 325.8M
/nix/store/p2pl3kcd8zdc1d62yslgh8k02b9n6am2-openjdk-11.0.8+10 691.2M
The jre derivations cost an extra 650 megabytes.
In case anybody wonders why openjdk11 is almost 10x larger than openjdk8, you're not alone. By far the largest part is java.base.jmod
, which is of course required. These are the ten largest files:
245M result/lib/openjdk/jmods/java.base.jmod
153M result/lib/openjdk/lib/modules
87M result/lib/openjdk/lib/libjfxwebkit.so
62M result/lib/openjdk/lib/src.zip
31M result/lib/openjdk/jmods/javafx.web.jmod
22M result/lib/openjdk/jmods/java.desktop.jmod
21M result/lib/openjdk/lib/server/libjvm.so
9.2M result/lib/openjdk/jmods/jdk.localedata.jmod
6.4M result/lib/openjdk/jmods/jdk.compiler.jmod
5.9M result/lib/openjdk/jmods/jdk.internal.vm.compiler.jmod
, runCommand | ||
, patchelf | ||
, lib | ||
, modules ? [ |
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.
How did you choose the list of modules? (Notably, it excludes javafx.)
Yes, basically. I also like having the
Right, though perhaps many 'end users' would only need to get the JRE, so they would save some space.
That was kind of arbitrary :). I figured javafx is a bit niche. My main drive here was that I'd like to move away from jdk8 as the default Java version, and I assumed having a 'jre' package available would be a prerequisite. If we feel the advantage (people who only have the jre save space) does not weigh up to the disadvantage (people who have both a jdk and a jre lose space), I would be perfectly happy to just use the jdk as the 'default jre'. |
Oh, I see now #89731 was already merged, taking this exact approach. I'm happy to close this one. (I think there's some value in the jre.nix, but if we're not really going to use it in nixpkgs ourselves perhaps it shouldn't be in there) |
Thanks for the attempt any way @raboof :). |
Motivation for this change
See also #79490
This should bring jdk11 (mostly) up to par with jdk8, so the next step would be to switch the default Java version from 8 to 11.
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)