Skip to content
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

Closed
wants to merge 1 commit into from

Conversation

raboof
Copy link
Member

@raboof raboof commented Sep 19, 2020

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
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@doronbehar
Copy link
Contributor

cc @gebner we were just talking about this in #89731 .

Copy link
Member

@gebner gebner left a 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 ? [
Copy link
Member

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.)

@raboof
Copy link
Member Author

raboof commented Sep 20, 2020

The only reason to have it is to reduce disk space, right?

Yes, basically. I also like having the jre.nix derivation so it's easy for people who want to build a 'minimal image' to generate a JRE containing only the modules they need.

The jre derivations cost an extra 650 megabytes.

Right, though perhaps many 'end users' would only need to get the JRE, so they would save some space.

How did you choose the list of modules? (Notably, it excludes javafx.)

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'.

@raboof
Copy link
Member Author

raboof commented Sep 20, 2020

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)

@raboof raboof closed this Sep 20, 2020
@doronbehar
Copy link
Contributor

Thanks for the attempt any way @raboof :).

@raboof
Copy link
Member Author

raboof commented Sep 22, 2020

Thanks for the attempt any way @raboof :).

😄 👍

I think there's some value in the jre.nix

Proposed separately as #98383

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants