Proposed kernel alias for Nvidia driver compatibility in NixOS

As you know, on Nix, working with proprietary Nvidia drivers causes some issues. This is related to the fact that the drivers may be incompatible with the latest kernel version in the repository. During the discussion, user joeljosephreji suggested creating a separate alias for the latest kernel version compatible with the current driver version.
For example:
boot.kernelPackages = pkgs.linuxPackages_nvidia_latest;

This would improve update stability, and users would not have to manually monitor which kernel version matches the current driver. What do you think about this?

This sounds like a maintenance burden.

Someone will have to continually monitor this. It is also not clear as to which driver will be the default target for support, e.g. beta stable production. I can envisage many enumerations to be considered.

I would say that if you want stability, use the LTS kernel with a stable NixOS channel.

1 Like

Available kernels are the same on stable and unstable, as it’s a security-critical component. But yes, stick to the LTS kernel.

Anyway, there used to be some alias like that for zfs, and maintenance burden aside, it truly didn’t make sense as sometimes the “latest compatible” verison resulted in a downgrade (mainline → LTS as the previous mainline expired and current mainline wasn’t compatible yet). No need to repeat that mistake.

3 Likes

You basically answered my question. It really is better to just use the LTS driver. Thank you.

Just to drive the point further home; even if it compiles fine, the nvidia driver will not officially be “compatible” with newer kernels; its source code was fundamentally written for an older kernel.

It’ll often work fine, but you get zero guarantees for actual compatibility from anyone, while effectively mixing together random kernel source code without even reading the patches - to actually provide the type of guarantee such an alias implies, someone would have to do extensive testing to make sure it doesn’t in practice set your computer on fire.

Use LTS when you use nvidia. Seriously.

1 Like

I think this important point should be reflected in the official documentation dedicated to Nvidia drivers for Nix.

If you could point me at this documentation I’d be much obliged :stuck_out_tongue:

Well, it kind of exists, but it is sparse to the point of uselessness. It doesn’t even mention the now-mandatory open option: NixOS Manual

@TLATER, NVIDIA - Official NixOS Wiki

That’s the wiki, which is explicitly not documentation. You’re free to add that note if you like, the handful of times I’ve tried it’s bitrotted away pretty rapidly.

1 Like