nvidiaPackages.production failed to build on 6.17 kernel

Here is my configuration. On 6.16.8 it works fine.

  boot.kernelPackages = pkgs.linuxPackages_latest;
  hardware.graphics.enable = true;
  services.xserver.videoDrivers = ["nvidia"];
  hardware.nvidia = {
    open = false;
    nvidiaSettings = true;
    package = config.boot.kernelPackages.nvidiaPackages.production;
  };

And here is error.

error: builder for '/nix/store/dwv0hixwsy898fx1fzxka51dqsbjqrpq-nvidia-x11-570.153.02-6.17.drv' failed with exit code 2;
       last 25 log lines:
       > In file included from /nix/store/zk1zwqbn97zn0mshy5v05q99h8b0pizk-linux-6.17-dev/lib/modules/6.17.0/source/include/drm/drm_atomic_helper.h:33,
       >                  from nvidia-drm/nvidia-drm-helper.h:191,
       >                  from nvidia-drm/nvidia-drm-fb.c:32:
       > /nix/store/zk1zwqbn97zn0mshy5v05q99h8b0pizk-linux-6.17-dev/lib/modules/6.17.0/source/include/drm/drm_modeset_helper.h:37:67: note: expected 'const struct drm_format_info *' but argument is of type 'struct drm_mode_fb_cmd2 *'
       >    37 |                                     const struct drm_format_info *info,
       >       |                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
       > nvidia-drm/nvidia-drm-fb.c:271:5: error: too few arguments to function 'drm_helper_mode_fill_fb_struct'
       >   271 |     drm_helper_mode_fill_fb_struct(
       >       |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       > /nix/store/zk1zwqbn97zn0mshy5v05q99h8b0pizk-linux-6.17-dev/lib/modules/6.17.0/source/include/drm/drm_modeset_helper.h:35:6: note: declared here
       >    35 | void drm_helper_mode_fill_fb_struct(struct drm_device *dev,
       >       |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       > make[4]: *** [/nix/store/zk1zwqbn97zn0mshy5v05q99h8b0pizk-linux-6.17-dev/lib/modules/6.17.0/source/scripts/Makefile.build:287: nvidia-drm/nvidia-drm-fb.o] Error 1
       > nvidia-drm/nvidia-drm-gem-user-memory.c: In function '__nv_drm_gem_user_memory_handle_vma_fault':
       > nvidia-drm/nvidia-drm-gem-user-memory.c:167:43: error: implicit declaration of function 'pfn_to_pfn_t'; did you mean 'pfn_to_nid'? [-Wimplicit-function-declaration]
       >   167 |     return vmf_insert_mixed(vma, address, pfn_to_pfn_t(pfn));
       >       |                                           ^~~~~~~~~~~~
       >       |                                           pfn_to_nid
       > make[4]: *** [/nix/store/zk1zwqbn97zn0mshy5v05q99h8b0pizk-linux-6.17-dev/lib/modules/6.17.0/source/scripts/Makefile.build:287: nvidia-drm/nvidia-drm-gem-user-memory.o] Error 1
       > make[3]: *** [/nix/store/zk1zwqbn97zn0mshy5v05q99h8b0pizk-linux-6.17-dev/lib/modules/6.17.0/source/Makefile:2011: .] Error 2
       > make[2]: *** [/nix/store/zk1zwqbn97zn0mshy5v05q99h8b0pizk-linux-6.17-dev/lib/modules/6.17.0/source/Makefile:248: __sub-make] Error 2
       > make[2]: Leaving directory '/build/NVIDIA-Linux-x86_64-570.153.02/kernel'
       > make[1]: *** [Makefile:248: __sub-make] Error 2
       > make[1]: Leaving directory '/nix/store/zk1zwqbn97zn0mshy5v05q99h8b0pizk-linux-6.17-dev/lib/modules/6.17.0/source'
       > make: *** [Makefile:115: modules] Error 2
       For full logs, run:
         nix log /nix/store/dwv0hixwsy898fx1fzxka51dqsbjqrpq-nvidia-x11-570.153.02-6.17.drv
error: 1 dependencies of derivation '/nix/store/mlhz4z87r7has9vx5dsyb17g67hcwf7l-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/vaz1g4piimni7bkvlpirqva2hbjzkr7a-firmware.drv' failed to build
error: 1 dependencies of derivation '/nix/store/65dwfr5hidkgchg9hrb0adjq09fka5f1-linux-6.17-modules.drv' failed to build
error: 1 dependencies of derivation '/nix/store/553m0g9f3kgb386yb1zb0mh8py2vkgx5-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/nsid24r9pn33w0blz432w1mivxpz1qnz-nixos-system-warthog-25.05.20251006.20c4598.drv' failed to build

570 drivers might indeed not be compatible with Linux 6.17. NixOS unstable already defaults to 580.95.05 as production driver (and so will NixOS 25.11). You can manually upgrade to 580 drivers by setting:

hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
    version = "580.95.05";
    sha256_64bit = "sha256-hJ7w746EK5gGss3p8RwTA9VPGpp2lGfk5dlhsv4Rgqc=";
    sha256_aarch64 = "sha256-zLRCbpiik2fGDa+d80wqV3ZV1U1b4lRjzNQJsLLlICk=";
    openSha256 = "sha256-RFwDGQOi9jVngVONCOB5m/IYKZIeGEle7h0+0yGnBEI=";
    settingsSha256 = "sha256-F2wmUEaRrpR1Vz0TQSwVK4Fv13f3J9NJLtBe4UP2f14=";
    persistencedSha256 = "sha256-QCwxXQfG/Pa7jSTBB0xD3lsIofcerAWWAHKvWjWGQtg=";
};
1 Like

Let me also just link my reply to the other post here: Issues with my nvidia drivers - #5 by TLATER

Rather than upgrading the nvidia driver, I suggest downgrading the kernel (i.e. omitting the boot.kernelPackages setting and using the default) - you’ll forget to upgrade your driver otherwise, since that becomes a manual step.

Or even if you don’t, at least some people will, and I don’t like recommending a solution that is likely to create insecure systems in the long term.

Fair point, that’s why my own config looks like this:

let
  selectHighestVersion = a: b: if lib.versionOlder a.version b.version then b else a;
  nvidia-driver = config.boot.kernelPackages.nvidiaPackages.mkDriver {
    version = "580.95.05";
    sha256_64bit = "sha256-hJ7w746EK5gGss3p8RwTA9VPGpp2lGfk5dlhsv4Rgqc=";
    sha256_aarch64 = "sha256-zLRCbpiik2fGDa+d80wqV3ZV1U1b4lRjzNQJsLLlICk=";
    openSha256 = "sha256-RFwDGQOi9jVngVONCOB5m/IYKZIeGEle7h0+0yGnBEI=";
    settingsSha256 = "sha256-F2wmUEaRrpR1Vz0TQSwVK4Fv13f3J9NJLtBe4UP2f14=";
    persistencedSha256 = "sha256-QCwxXQfG/Pa7jSTBB0xD3lsIofcerAWWAHKvWjWGQtg=";
  };
in
{
  services.xserver.videoDrivers = [ "nvidia" ];
  hardware.nvidia = {
    package = selectHighestVersion config.boot.kernelPackages.nvidiaPackages.latest nvidia-driver;
    open = true;
    powerManagement.enable = true;
  };
}
1 Like

NixOS 25.05 driver compatibility for Linux 6.17 will be fixed by [release-25.05] linuxPackages.nvidiaPackages.production: 570.153.02 -> 570.195.03 by niklaskorz · Pull Request #450729 · NixOS/nixpkgs · GitHub

1 Like

Thanks for the quick fix!

1 Like

Hey, I was aware of nix os for some time now, but last weekend was the first time giving git a try.

I was not able to get it to run nvidia drivers for my 50 series gpu, I did use the search in discourse, but wasn’t able to find a guide.

I did look into some guides recommending running a newer kernel 6.15+, but most people seem to be running laptops, and not desktops.

do you have pointers?

There should be nothing problematic about a default config at this point. In theory, the only configuration you should set is:

{
  services.xserver.videoDrivers = [ "nvidia" ];
}

Everything else you find in guides is either use case specific or people tautologically redefining default values (or worse, setting them to incorrect values).

Don’t set alternate kernel versions unless you know why you’re doing it.

Start with that, if you run into issues please share more details about your hardware and chosen desktop environment as well as the specific issue you have. It’s best to open a separate post instead of replying to an unrelated one at that point (or in general).

thanks for the quick reply, it was able to run, but it wasnt using nvidia drivers, so the display resolution and refresch rate were wrong.

I also added

hardware.nvidia = {
  modesetting.enable = true;
  powerManagement.enable = false;
  powerManagement.finegrained = false;
  open = true;
  nvidiaSettings = true;

Remove all of those. And again, please create a new post for your issue; share your full configuration and exact details there.

Particularly:

doesn’t make sense to me without much more detail.

1 Like

I will, and thank you! wasn’t aware that nix community has such responsive and nice people :smiley: