This is also my experience, and because of this, my personal preference is to:
- generally: use
jdkindefault.nix(pointing to the latest JDK) - when a package does not work with the latest JDK: use
jdk8(or whatever) in the package’sdefault.nix.
This helps us detect problems as soon as possible, and reduces spreading information between all-packages.nix and default.nix.
You’re right that, for packages that need a particular JDK version, overriding the JDK becomes a bit awkward - but that should be the exception rather than the norm anyway.
(I’m not strongly opposed to using jdk in default.nix and overriding it as needed in all-packages.nix, though. By the way, for python we should explicitly use python3 as discussed in Should `python` point to python3? - #7 by jonringer)
This recently also came up in Retirement of old OpenJDK releases? and there doesn’t seem to be consensus about it, btw
.