[solved] What are the options for hardware.nvidia.package? (docs seem out-of-date)

Update: Solution here. The options are here:

hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.beta
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.vulkan_beta
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.legacy_390
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.legacy_340

(see the github link for current version of Nvidia driver for each option)

I’m trying to figure out how to use hardware.nvidia.package to test different Nvidia driver versions.

However, both examples given in the docs are broken:

hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable

hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.legacy_340

Both give the error:

definition for option hardware.nvidia.package' is not of type package’. Definition values:
In `/etc/nixos/configuration.nix’: “config.boot.kernelPackages.nvidiaPackages.stable”

And nvidiaPackages is nowhere to be found in Options Search, so looks like that was deprecated/removed and the docs are out of date.

So how do we use this config property?


I also had a few Problems at the update from 20.09 to 21.05 as the system for configuring these drivers has changed and was not really documented / had confusing errors. After trying some things the following combination of options seemed to have worked (for my GT560M):

services.xserver.videoDrivers = [ "nvidia"];
hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.legacy_390;

boot.kernelPackages = pkgs.linuxPackages_5_4;

So you need to select the type of driver (nvidia), the package (version), and you might have to use an older kernel, as this binary / non-free Nvidia drivers are not compatible to newer kernels.


I also found this confusing. I recently updated the wiki page to hopefully help clear things up a bit. Hopefully it helps!