24.11 & AMD GPU: How to use Mesa RADV instead of amdvlk

tldr: After the update to NixOS 24.11 I could not get the RADV Vulkan driver installed on my Laptop. It has an AMD Ryzen 7 4800H CPU/GPU.

Before 24.11 Vulkan was enabled by default (using Mesa RADV) [1]:

hardware.opengl = {
  driSupport = true;
  driSupport32Bit = true;
};

Now these settings were changed to [2]:

hardware.graphics = {
  enable = true;
  enable32Bit = true;
};

However, with these new settings both vulkaninfo and vkcube-wayland indicate that no Vulkan drivers are available on my device.

I’ll post the output of those two commands in some minutes.

You shouldn’t have to do anything other than those two hardware.graphics settings; mesa and radv should be included out of the box. And indeed that works for me on 24.11 with an AMD GPU.

Many thanks for confirming this so quickly @ElvishJerricco! I don’t know why, but I can’t reproduce my error anymore - sorry for taking your time with this false-positive. All I did is update nixpkgs and some config cleanup :see_no_evil: Vulkan (and OpenGL, VA-API) work with only the two hardware.graphics options!

I even tried it without setting any hardware.graphics, as the hardware.graphics.enable option has this comment:

Enabled by default by the corresponding modules, so you do not usually have to set it yourself.

And Vulkan does still work :tada:


Only thing left regarding hardware acceleration is VDPAU. But here I am not quite sure if that was working before upgrading to NixOS 24.11. Here is the error I get when verifying it:

nix-shell -p vdpauinfo --run vdpauinfo
display: :0   screen: 0
Failed to open VDPAU backend libvdpau_nvidia.so: cannot open shared object file: No such file or directory
Error creating VDPAU device: 1

I’ll try out hardware.graphics.extraPackages for that and report back soon.

Even with the following extraPackages, VDPAU was not working:

# VDPAU driver with OpenGL/VAAPI backend
pkgs.libvdpau-va-gl
# VDPAU driver for the VAAPI library
pkgs.vaapiVdpau

According to the Arch wiki, VDPAU might need configuration [3]. This did the trick for me:

env VDPAU_DRIVER=radeonsi nix-shell -p vdpauinfo --run vdpauinfo
display: :0   screen: 0
API version: 1
Information string: G3DVL VDPAU Driver Shared Library version 1.0

Video surface:

name   width height types
-------------------------------------------
420    16384 16384  NV12 YV12 
...

Edit: I just confirmed that VDPAU still works without (redundantly) providing those extraPackages. The only thing that is missing is the environment variable VDPAU_DRIVER with the correct driver in use.

This seems to be an older issue, see e.g. Vdpau through vaapi - #2 by ony