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

Scan /nix/store for JDKs #3

Open
msgilligan opened this issue Mar 31, 2024 · 9 comments
Open

Scan /nix/store for JDKs #3

msgilligan opened this issue Mar 31, 2024 · 9 comments

Comments

@msgilligan
Copy link

msgilligan commented Mar 31, 2024

I am finding the Nix package manager very useful these days. Especially since I am using JDK 22 + Panama to interface to a native 'C" library.

It would be nice if JDK-Updater could know about and display JDKs installed via Nix.

p.s. I'm not sure how this can be done efficiently. Maybe there should be some mechanism for JDKs installed via Nix to register somehow.

@HanSolo
Copy link
Owner

HanSolo commented Apr 1, 2024

JDKUpdater in principle simply scans the disk and tries to identify JVM‘s it found. Because some installer like sdkman use their own folders to manage installed software, JDKUpdater can identify the installer too. Meaning to say, if you can tell me where Nix does install JDK‘s, I can add this location to the search path and display them as installed by Nix. If Nix offers a mechanism to install JDK‘s via shell commands I might even be able to offer an update procedure but that’s probably not possible. In case Nix installs the JDK‘s in the default folder /Library/Java/JavaVirtualMachines, I won’t be able to figure where the JDK was „coming“ from.

@HanSolo
Copy link
Owner

HanSolo commented Apr 1, 2024

Just did a quick check and if I‘m right, the Nix package manager stores it‘s pkgs in /nix/store. Is that also true for JDK‘s? In that case I could scan this path to find JVM‘s.

@msgilligan
Copy link
Author

msgilligan commented Apr 1, 2024

Yes, JDKs are also in /nix/store, for example: /nix/store/6amvs3wxc0lv382igpryc25dfcmgfcyv-graalvm-ce-22.0.0/ and
/nix/store/cvmim67ikqj3wd42ys6vrdslyfmjgbcz-zulu-ca-jdk-22.0.0/. Because of the way Nix manages dependencies (similar in some ways to local Maven repos) there can be quite a few JDKs in /nix/store including multiple copies of the same version (but with different hashes).

As far as I know, Nix JDKs are not put into /Library/Java/JavaVirtualMachines, but there might be an add-on somewhere that does that. (Nix has a lot of add-ons, it seems)

@msgilligan
Copy link
Author

Nix is powerful, exciting and frustrating. I would recommend this article for getting started:
https://tonyfinn.com/blog/nix-from-first-principles-flake-edition/

It's best to set experimental-features = nix-command flakes and use the new commands and flakes features, but the frustrating part is that most of the documentation doesn't cover this.

@HanSolo
Copy link
Owner

HanSolo commented Apr 1, 2024

Added scanning for the /nix/store path. Will come with the next release. Please let me know if it works once it will be available.

@msgilligan
Copy link
Author

Added scanning for the /nix/store path. Will come with the next release. Please let me know if it works once it will be available.

Can I install from source?

@HanSolo
Copy link
Owner

HanSolo commented Apr 1, 2024

Nope, there is only the dmg or pkg available atm

@msgilligan
Copy link
Author

Nope, there is only the dmg or pkg available atm

I'm still running macOS 13, so I'll have to wait until I upgrade (which should be soon) to give it a try.

@HanSolo
Copy link
Owner

HanSolo commented Apr 1, 2024

Check 👍🏻

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

No branches or pull requests

2 participants