Zfs latestCompatibleLinuxPackages

The option config.boot.zfs.package.latestCompatibleLinuxPackages; got deprecated. Is there a way to restore this functionality (get the latest zfs compatible kernel) if I am willing to accept the risk?

Just set boot.kernelPackages = pkgs.linuxPackages_x_y; where x_y is the kernel version you want to use.

Reason why it was removed is because say the latest compatible is 6.8, but then it goes EOL so nixpkgs drops 6.8 and now the latest compatible is 6.6, but that version is missing the display driver for your laptop.

2 Likes

I think the request was to not have to pin to a specific kernel minor. Understandable, but this attribute has caused so much confusion around users that it was ultimately considered a bad idea (I agree with that).

4 Likes

Also, If you really need a minimum version of a kernel, add an assertion!

{ config, lib, ... }:
{
  config = {
    assertions = [
      {
        assertion = lib.strings.versionAtLeast config.boot.kernelPackages.kernel.version "6.8";
        message = "Kernel versions below 6.8 will break my monitor!";
      }
    ];

    # other config here
  };
}
2 Likes

Not a bad idea, if you know which kernel version will break your machine :slight_smile:

1 Like

I am aware of all the issues. I still would like to have the original functionality.

Check the zfs releases page (Releases · openzfs/zfs · GitHub) and figure out which latest kernel is compatible. Yes, this is manual work.

if you dont want to pin a version just pick the default lts kernel.

1 Like

Personally, I would have preferred for latestCompatibleLinuxPackages to simply point to the latest compatible linuxPackages, whether nixpkgs is packaging it or not. We do keep around attributes for EOL removed kernels; they just throw errors about them being removed. I would have preferred latestCompatibleLinuxPackages to just point to the upper bound of the ZFS release and use that attribute, even if it’s going to throw an error at me. That way I get an eval error if I have to downgrade rather than silent downgrading, and I actually get to use the latest kernel that ZFS supports if we happen to have it, without having to know and manually choose the right one.

3 Likes

Thx. I know how to do this manually. I specifically asked how to get back the original functionality.

Thx. But I want the latest compatible kernel. I know how to do this manually. I specifically asked how to get back the original functionality.

You could check up this external logic for similar function zfs: deprecate latestCompatibleLinuxPackages by adamcstephens · Pull Request #341596 · NixOS/nixpkgs · GitHub

I linked you the overall PR that removed the function as it contains the motivation/ interest of all parties.

1 Like
2 Likes