Installing older version of graalvm-ce (for example 21)


My JDK was graalvm-ce version 21, but after flakes update, it is now graalvm-ce 22.

Gradle is not supporting JDK 22 yet, so I want to get back to graalvm-ce 21.
How can I get this done with nixos flakes? Please help.

Thank you.

You can add a second input to your flake, something like

nixpkgs-pinned = {
  url = "github:NixOS/nixpkgs/OLD_COMMIT_WITH_V21";

to pin an old commit of nixpkgs. Check here to find which commit you can use for getting this old version.

And then use it to get the old version, maybe like

environment.systemPackages = with nixpkgs-pinned.legacyPackages.x86_64-linux; [ graalvm-ce ];

If you don’t like having an old version of nixpkgs just for this one package, you could also copy the old version from nixpkgs itself (say, into the file graalvm-ce.nix), and then use it like

environment.systemPackages = [ (pkgs.callPackage ./graalvm-ce.nix { }) ];
1 Like

Thank you, it worked for me.