Vulkan error when enabling nvidia-settings

Hey, I managed to set up Nvidia successfully on my NixOS machine. However, when I enable hardware.nvidia.nvidiaSettings = true, I am getting the following build error:

error: builder for '/nix/store/4bk8cmp2jld3i48zi4wyzlkqbc9cfgwg-nvidia-settings-565.57.01.drv' failed with exit code 2;
       last 10 log lines:
       > make[1]: *** [Makefile:381: _out/Linux_x86_64/gtk3/ctkframelock.o] Error 1
       > make[1]: *** [Makefile:381: _out/Linux_x86_64/gtk3/ctkcolorcorrectionpage.o] Error 1
       > In file included from gtk+-2.x/ctkcolorcorrection.c:22:
       > libXNVCtrlAttributes/NvCtrlAttributes.h:24:10: fatal error: vulkan/vulkan.h: No such file or directory
       >    24 | #include <vulkan/vulkan.h>
       >       |          ^~~~~~~~~~~~~~~~~
       > compilation terminated.
       > make[1]: *** [Makefile:381: _out/Linux_x86_64/gtk3/ctkcolorcorrection.o] Error 1
       > make[1]: Leaving directory '/build/source/src'
       > make: *** [Makefile:23: all] Error 2
       For full logs, run 'nix log /nix/store/4bk8cmp2jld3i48zi4wyzlkqbc9cfgwg-nvidia-settings-565.57.01.drv'.
error: 1 dependencies of derivation '/nix/store/gxc49746gd20aqf7xm2di50v5vy21pwp-system-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/p5ddjxj07g6yrhjdxqflpxn83nqkbmiw-nixos-system-vega-24.05.20241127.0c5b4ec.drv' failed to build

I am on the following Nvidia version:

    package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
      version = "565.57.01";
      sha256_64bit = "sha256-buvpTlheOF6IBPWnQVLfQUiHv4GcwhvZW3Ks0PsYLHo=";
      openSha256 = lib.fakeSha256;
      settingsSha256 = "sha256-H7uEe34LdmUFcMcS6bz7sbpYhg9zPCb/5AmZZFTx1QA=";
      # settingsSha256 = "sha256-H7uEe34LdmUFcMcS6bz7sbpYhg9zPCb/5AmZZFTx1QA=";
      sha256_aarch64 = lib.fakeSha256;
      persistencedSha256 = lib.fakeSha256;
    };

and my entire Nvidia config can be found here.

Does anyone have a similar experience and maybe a fix for this? I thought about an overlay, but I failed (nothing changed) at setting one up.

This was fixed in 24.11. You should stop using 24.05 anyway, it’s EOL.

Oh, good to know. Thanks!

Having had a quick look at your config, you’re also definitely using the (outdated) unofficial wiki. Use this page instead: NVIDIA - NixOS Wiki

Particularly, you’ll want to change those powermanagement and “open” settings - unless your GPU is quite old, but usually this is myths from the old wiki page perpetuating themselves.

I have an RTX 2080, but according to the docs open = true should be fine. What are the benefits of power management and open = true?

Without it, sleep will either completely fail or there will be significant artifacts upon wake. It’s recommended by nvidia now, ~3-4 years ago it was experimental, though still necessary for suspend on some machines. It’s a service that handles restoring video buffers from memory.

“Finegrained” is only necessary for devices that do prime, it allows the GPU to actually turn off when not in use, but see the nvidia docs for details: Chapter 22. PCI-Express Runtime D3 (RTD3) Power Management

Leaving the default or setting it to false (though prefer defaults, always, if you aren’t sure you know better than the nixpkgs maintainers) should work on most devices these days, tbh, setting x03 used to not exist, which is why that option exists.

As for the open driver, the nvidia docs go into more detail on the exact differences as well: Chapter 44. Open Linux Kernel Modules

But ultimately, open is preferred unless you specifically need a feature that’s stuck on the proprietary side now (basically just some small powermanagement details at this point, wow, that’s some quick dev). That way you’ll run into the same bugs other people run into.