ZFS needs to be kept in sync with the kernel version. If you use Nix on Ubuntu, Ubuntu manages the kernel, so Nix can’t do anything.
ZFS on NixOS is pretty neat though. The exact version pinning means that ZFS and the kernel can be updated together and only once both packages build at a new version.
There’s also an open issue for more extensive checks, so hopefully eventually NixOS CI will be able to check not just that the ZFS and kernel are compatible (header-wise), but actually go through the motion of creating test ZFS dataset and make sure it actually works.
I tend to use stable for everything then overlay the unstable/git master versions of the packages I need.
EDIT: Actually ignore me, of course stable won’t have problems because updates are held back….
I don’t think the CI thing will help. I think what’s happening here is a build time check that prevents any new kernel version with ZFS until the upstream announces support. I don’t think this check will be removed even if there was better CI.
Also, possibly your issues might go away if you used ‘config.boot.zfs.package.latestCompatibleLinuxPackages’ (from NixOS wiki for ZFS). I think that version is only updated once upstream announces support for a newer kernel.