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

jabba: easy access to various JDK versions #105924

Closed
wants to merge 1 commit into from

Conversation

raboof
Copy link
Member

@raboof raboof commented Dec 4, 2020

Motivation for this change

As a developer it can sometimes be helpful to test/run code on a variety of different JDK variants and versions. Typically distributions ship only a few
variants/versions, and you'd rely on a tool like jabba or sdkman to install specific different ones. Now those tools are not very 'nix-like'.

This PR introduces a more 'nix-like' way of downloading and installing the binary JDK distributions offered by 'jabba'.

You can install one, for example, with nix-shell -p "jabba.adopt.\"1.13.0-2\"".

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.

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/retirement-of-old-openjdk-releases/9929/18

@taku0
Copy link
Contributor

taku0 commented Dec 5, 2020

It doesn't run GUI applications: https://github.com/taku0/JavaSample/blob/master/JavaSample.java

@raboof
Copy link
Member Author

raboof commented Dec 5, 2020

It doesn't run GUI applications: https://github.com/taku0/JavaSample/blob/master/JavaSample.java

Thanks! I added patchelf invocations to correctly link the X11 libraries - now the example starts, but doesn't work correctly yet (something around finding fonts)

@taku0
Copy link
Contributor

taku0 commented Dec 5, 2020

It seems that there are more libraries JDK depends on: pkgs/development/compilers/zulu/default.nix. It also set JAVA_HOME and CLASSPATH.

adoptopenjdk-bin (pkgs/development/compilers/adoptopenjdk-bin/jdk-linux-base.nix) also set passthru.jre and passthru.home. Some packages depend on the variables. It also states a problem of freetype on Raspberry Pis (#57733).

@raboof raboof marked this pull request as draft December 5, 2020 12:05
@jerith666
Copy link
Contributor

I think https://lazamar.co.uk/nix-versions/?channel=nixpkgs-unstable&package=openjdk already achieves something pretty close to what you want here. Obviously we can't go back in time to add versions that were missed, but over time it should get better. I don't think it makes sense to keep all these versions at the tip of nixpkgs forever.

As a developer it can sometimes be helpful to test/run code on a variety of different JDK variants and versions. Typically distributions ship only a few
variants/versions, and you'd rely on a tool like jabba or sdkman to install specific different ones. Now those tools are not very 'nix-like'.

This PR introduces a more 'nix-like' way of downloading and installing the binary JDK distributions offered by 'jabba'.

You can install one, for example, with `nix-shell -p "jabba.adopt.\"1.13.0-2\""`.
@raboof raboof marked this pull request as ready for review January 16, 2021 14:34
@raboof
Copy link
Member Author

raboof commented Mar 30, 2021

Abandoning this PR, doing this out-of-tree in https://git.sr.ht/~raboof/nix-jabba

@raboof raboof closed this Mar 30, 2021
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

4 participants