You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{description="A very basic flake";inputs={nixpkgs.url="github:nixos/nixpkgs?ref=nixos-unstable";};outputs={self,nixpkgs}:
letjavaVersion=22;supportedSystems=["x86_64-linux""aarch64-linux""x86_64-darwin""aarch64-darwin"];forEachSupportedSystem=f: nixpkgs.lib.genAttrssupportedSystems(system: f{pkgs=importnixpkgs{inheritsystem;};});in{overlays.default=final: prev: rec{jdk=prev."jdk${toStringjavaVersion}";maven=prev.maven.override{jre=jdk;};};devShells=forEachSupportedSystem({pkgs}: {default=pkgs.mkShell{packages=withpkgs;[jdkmaven];MAVEN_OPTS="--enable-preview";};});};}
When I run nix shell .\#devShells.x86_64-linux.default (or activate the shell using direnv with use flake) and run java --version, I get openjdk 21.0.3 2024-04-16 instead of the expected Java 22.
My guess is, this is using the jdk package from nixpkgs, which is Java 21, instead of the jdk package from the overlay, which should be Java 22.
I'm not quite sure how to tell my flake to use the overlay...
Edit: Merging #53, #54 applying my comment from #54 seems to fix the issue for me.
The text was updated successfully, but these errors were encountered:
The template for Java projects seems to install the wrong JDK.
I'm using the following
flake.nix
on NixOS/nixpkgs@a58bc8a:When I run
nix shell .\#devShells.x86_64-linux.default
(or activate the shell using direnv withuse flake
) and runjava --version
, I getopenjdk 21.0.3 2024-04-16
instead of the expected Java 22.My guess is, this is using the
jdk
package fromnixpkgs
, which is Java 21, instead of thejdk
package from the overlay, which should be Java 22.I'm not quite sure how to tell my flake to use the overlay...
Edit: Merging #53, #54 applying my comment from #54 seems to fix the issue for me.
The text was updated successfully, but these errors were encountered: