It’s pretty common for the nvidia kernel module to not be compatible with a new kernel.
NixOS pulls kernels immediately when they become unsupported, too, so you usually won’t be able to downgrade to a recent-but-not-too-recent kernel without a fair bit of hassle.
Hence, when using nvidia, it’s usually best not to use linuxPackages_latest
. It’s the issue with third party kernel modules, none of this would be a problem if nvidia didn’t demand their special cookie.
Usually a week or two in someone posts a patch on a weird forum, but by then a driver patch is close enough that NixOS just updates the nvidia package, and then eventually backports it to stable, and the issue disappears.
In this case you might be able to work around it by patching out -Werror
or such, though, given that the error looks a lot like a warning.