-
-
Notifications
You must be signed in to change notification settings - Fork 507
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
programs.jdks: init #988
base: master
Are you sure you want to change the base?
programs.jdks: init #988
Conversation
I've left stubs in place to allow setting the JDK in use, but I have not yet implemented that, so this only adds support for `programs.jdk.installed`
I thought I understood bash quoting. I do not. Here's an example: ``` [sam](~)$ for jdk in "/nix/store/fq62102p6snl4mix9w0wpzw9a91ck4l1-zulu-ca-jdk-8.0.402/*.jdk"; do echo $jdk; echo ${jdk//\//_}; done /nix/store/fq62102p6snl4mix9w0wpzw9a91ck4l1-zulu-ca-jdk-8.0.402/zulu-8.jdk _nix_store_fq62102p6snl4mix9w0wpzw9a91ck4l1-zulu-ca-jdk-8.0.402_*.jdk [sam](~)$ for jdk in /nix/store/fq62102p6snl4mix9w0wpzw9a91ck4l1-zulu-ca-jdk-8.0.402/*.jdk; do echo $jdk; echo ${jdk//\//_}; done /nix/store/fq62102p6snl4mix9w0wpzw9a91ck4l1-zulu-ca-jdk-8.0.402/zulu-8.jdk _nix_store_fq62102p6snl4mix9w0wpzw9a91ck4l1-zulu-ca-jdk-8.0.402_zulu-8.jdk ```
I'm marking this PR as a draft because the consensus we came to in the nix-darwin Matrix room was that we'd like to wait for an overhaul of managing files outside of the Nix store. If anyone has been waiting on this PR, though, we can reconsider. |
Depends on #1205, after which it should be as simple as something like system.file = builtins.listToAttrs
(builtins.map (jdk:
let
versionElems = lib.strings.splitString "." jdk.version;
majorVersion = builtins.elemAt versionElems 0;
in
lib.nameValuePair
"Library/Java/JavaVirtualMachines/zulu-${majorVersion}.jdk"
{ source = "${jdk}/zulu-${majorVersion}.jdk"; }
) cfg.jdks); |
As written, this PR only supports the Zulu JDKs in nixpkgs (which have macOS JDK bundles under the derivations). It should also be able to support other JDKs in nixpkgs (such as |
I'll also want to make a similar PR to home-manager because you can apparently link JDKs to |
NixOS/nixpkgs#375212 should make it easier to find JDK bundles from any JDK in nixpkgs |
With that nixpkgs PR, it becomes as simple as home.file = builtins.listToAttrs
(builtins.map (jdk:
lib.nameValuePair
"Library/Java/JavaVirtualMachines/${builtins.baseNameOf jdk.bundle}"
{ source = jdk.bundle; }
) cfg); for home-manager, and the equivalent with |
This PR allows you to install Java versions system-wide.
I've left stubs in place to allow setting the JDK to use, but I have not yet implemented that, so this only adds support for
programs.jdk.installed