Nvidia drivers update fails

Hello, I have a problem with updating my nvidia drivers. After I updated my flake input with sudo flake update I tried to rebuild my system. When I do I get the following error:

building the system configuration…
error: builder for ‘/nix/store/grrwpqkl4rjbk6wqf8lk9p4kwfk0pb07-nvidia-x11-565.77-6.14.4.drv’ failed with exit code 2;
last 25 log lines:
> CC [M] nvidia-drm/nvidia-drm-helper.o
> CC [M] nvidia-drm/nv-kthread-q.o
> CC [M] nvidia-drm/nv-pci-table.o
> CC [M] nvidia-drm/nvidia-drm-gem-nvkms-memory.o
> CC [M] nvidia-drm/nvidia-drm-gem-user-memory.o
> CC [M] nvidia-drm/nvidia-drm-gem-dma-buf.o
> CC [M] nvidia-drm/nvidia-drm-format.o
> CC [M] nvidia-drm/nvidia-drm-os-interface.o
> nvidia-drm/nvidia-drm-drv.c:1907:6: error: ‘struct drm_driver’ has no member named ‘date’
> 1907 | .date = “20160202”,
> | ^~~~
> nvidia-drm/nvidia-drm-drv.c:1907:31: warning: initialization of ‘unsigned int’ from ‘char *’ makes integer from pointer without a cast
> 1907 | .date = “20160202”,
> | ^~~~~~~~~~
> nvidia-drm/nvidia-drm-drv.c:1907:31: note: (near initialization for ‘nv_drm_driver.driver_features’)
> nvidia-drm/nvidia-drm-drv.c:1907:31: error: initializer element is not computable at load time
> nvidia-drm/nvidia-drm-drv.c:1907:31: note: (near initialization for ‘nv_drm_driver.driver_features’)
> make[4]: *** [/nix/store/gw7vcdz1g17pw2z44vm9qm0xxypfz02p-linux-zen-6.14.4-dev/lib/modules/6.14.4-zen1/source/scripts/Makefile.build:207: nvidia-drm/nvidia-drm-drv.o] Error 1
> make[4]: *** Waiting for unfinished jobs…
> make[3]: *** [/nix/store/gw7vcdz1g17pw2z44vm9qm0xxypfz02p-linux-zen-6.14.4-dev/lib/modules/6.14.4-zen1/source/Makefile:1994: .] Error 2
> make[2]: *** [/nix/store/gw7vcdz1g17pw2z44vm9qm0xxypfz02p-linux-zen-6.14.4-dev/lib/modules/6.14.4-zen1/source/Makefile:251: __sub-make] Error 2
> make[2]: Leaving directory ‘/build/NVIDIA-Linux-x86_64-565.77/kernel’
> make[1]: *** [Makefile:251: __sub-make] Error 2
> make[1]: Leaving directory ‘/nix/store/gw7vcdz1g17pw2z44vm9qm0xxypfz02p-linux-zen-6.14.4-dev/lib/modules/6.14.4-zen1/source’
> make: *** [Makefile:115: modules] Error 2
For full logs, run ‘nix log /nix/store/grrwpqkl4rjbk6wqf8lk9p4kwfk0pb07-nvidia-x11-565.77-6.14.4.drv’.
error: 1 dependencies of derivation ‘/nix/store/p2w0cxg3gyz62bcpv84hskxs3446sv44-etc.drv’ failed to build
error (ignored): error: cannot unlink ‘“/tmp/nix-build-nvidia-open-6.14.4-565.77.drv-0/build/source/kernel-open”’: Directory not empty
error: 1 dependencies of derivation ‘/nix/store/v34rja028ygnyd165yhxlb1ghmgaxxlv-firmware.drv’ failed to build
error: 1 dependencies of derivation ‘/nix/store/43wjp0pa8nf2ywfrsmv1l5qjncw0icwv-system-path.drv’ failed to build
error: 1 dependencies of derivation ‘/nix/store/f55yk1iykifvac0kkllz2n48fqw2gcmv-nixos-system-Desktop-24.11.20250502.bf3287d.drv’ failed to build

For my nvidia configuration I have:

services.xserver.videoDrivers = [ “nvidia” ];

hardware.nvidia = {
# Modesetting is required
modesetting.enable = true;

powerManagement = {
  enable = true;
  finegrained = false;
};

# Use open drivers for RTX 20-Series or newer
open = true;

# Enable the nvidia settings menu
nvidiaSettings = true;

# Select the appropriate driver version
package = config.boot.kernelPackages.nvidiaPackages.latest;

};

hardware.graphics.extraPackages = with pkgs; [ nvidia-vaapi-driver ];

boot.kernelParams = [ “nvidia-drm.modeset=1” ];

Extra information:
I have a nvidia rtx 4070 ti, use the stable nixpkgs channel and use the linux_zen kernel.
Thanks for helping.

Hey there!

I’ve had the same issue, solved by simply using an older kernel version, e.g. commenting this line out in your configuration.nix:

# boot.kernelPackages = pkgs.linuxPackages_latest;

Probably some inconsistency between nvidia drivers and the kernel, pretty common imo