Consider the following two ways to access the jdk17
package in nixpkgs
.
The first:
$ nix develop nixpkgs#jdk17
$ which java
/nix/store/ckw7l158asjj1qpnqw6gfd2vq7z7h945-adoptopenjdk-hotspot-bin-17.0.7/bin/java
The second:
$ cat flake.nix
{
outputs = { nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.${system}.default = pkgs.mkShell {
packages = [ pkgs.jdk17 ];
};
};
}
$ nix develop
$ which java
/nix/store/12c2033fvjs8pp25zqzhc4pri4k2y6g6-openjdk-17.0.11+9/bin/java
I was expecting to get the same package since both ways get jdk17
from an indirection to the flake registry, but evidently, that is not what happened. I suspect it may have something to do with the flake registry and pins but have yet to find a concrete explanation after much toiling.
This versioning discrepancy is rather significant for me as I have a jar
file that works with the 17.0.7
version but not the 17.0.11+9
one.
Any help would be greatly appreciated.