How do I get graphics drivers to work with glibc? (NixOS)

I am on NixOS and use home-manager to install most programs. When I was updating my home-manager packages, I had problems with some programs complaining that opengl drivers needed glibc 2.35, but my NixOS system only was on glibc 2.34, so I upgraded NixOS, and my NixOS config and home-manager config are now pinned to the same nixpkgs version (0cbe9f69c234a7700596e943bfae7ef27a31b735).

For NixOS, I have

hardware.opengl = {
    enable = true;
    extraPackages = [ pkgs.mesa.drivers ];
    driSupport = true;
    driSupport32Bit = true;
}

But things still don’t work:

> nix-shell -p glxinfo
>> LIBGL_DEBUG=verbose glxinfo
name of display: :0
Error: couldn't find RGB GLX visual or fbconfig
> nix-shell -p vulkan-tools
>> vulkaninfo
ERROR: [Loader Message] Code 0 : /nix/store/76l4v99sk83ylfwkz8wmwrm4s8h73rhd-glibc-2.35-224/lib/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/0lfnrz6nq5myv787cih78knzaqy9z9fc-mesa-23.1.9-drivers/lib/libvulkan_radeon.so)
ERROR: [Loader Message] Code 0 : loader_icd_scan: Failed loading library associated with ICD JSON /nix/store/0lfnrz6nq5myv787cih78knzaqy9z9fc-mesa-23.1.9-drivers/lib/libvulkan_radeon.so. Ignoring this JSON
ERROR: [Loader Message] Code 0 : /nix/store/76l4v99sk83ylfwkz8wmwrm4s8h73rhd-glibc-2.35-224/lib/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/0lfnrz6nq5myv787cih78knzaqy9z9fc-mesa-23.1.9-drivers/lib/libvulkan_intel_hasvk.so)
ERROR: [Loader Message] Code 0 : loader_icd_scan: Failed loading library associated with ICD JSON /nix/store/0lfnrz6nq5myv787cih78knzaqy9z9fc-mesa-23.1.9-drivers/lib/libvulkan_intel_hasvk.so. Ignoring this JSON
ERROR: [Loader Message] Code 0 : /nix/store/76l4v99sk83ylfwkz8wmwrm4s8h73rhd-glibc-2.35-224/lib/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/0lfnrz6nq5myv787cih78knzaqy9z9fc-mesa-23.1.9-drivers/lib/libvulkan_dzn.so)
ERROR: [Loader Message] Code 0 : loader_icd_scan: Failed loading library associated with ICD JSON /nix/store/0lfnrz6nq5myv787cih78knzaqy9z9fc-mesa-23.1.9-drivers/lib/libvulkan_dzn.so. Ignoring this JSON
ERROR: [Loader Message] Code 0 : /nix/store/76l4v99sk83ylfwkz8wmwrm4s8h73rhd-glibc-2.35-224/lib/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/0lfnrz6nq5myv787cih78knzaqy9z9fc-mesa-23.1.9-drivers/lib/libvulkan_lvp.so)
ERROR: [Loader Message] Code 0 : loader_icd_scan: Failed loading library associated with ICD JSON /nix/store/0lfnrz6nq5myv787cih78knzaqy9z9fc-mesa-23.1.9-drivers/lib/libvulkan_lvp.so. Ignoring this JSON
ERROR: [Loader Message] Code 0 : /nix/store/76l4v99sk83ylfwkz8wmwrm4s8h73rhd-glibc-2.35-224/lib/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/0lfnrz6nq5myv787cih78knzaqy9z9fc-mesa-23.1.9-drivers/lib/libvulkan_virtio.so)
ERROR: [Loader Message] Code 0 : loader_icd_scan: Failed loading library associated with ICD JSON /nix/store/0lfnrz6nq5myv787cih78knzaqy9z9fc-mesa-23.1.9-drivers/lib/libvulkan_virtio.so. Ignoring this JSON
ERROR: [Loader Message] Code 0 : /nix/store/76l4v99sk83ylfwkz8wmwrm4s8h73rhd-glibc-2.35-224/lib/libc.so.6: version `GLIBC_2.38' not found (required by /nix/store/0lfnrz6nq5myv787cih78knzaqy9z9fc-mesa-23.1.9-drivers/lib/libvulkan_intel.so)
ERROR: [Loader Message] Code 0 : loader_icd_scan: Failed loading library associated with ICD JSON /nix/store/0lfnrz6nq5myv787cih78knzaqy9z9fc-mesa-23.1.9-drivers/lib/libvulkan_intel.so. Ignoring this JSON
ERROR: [Loader Message] Code 0 : vkCreateInstance: Found no drivers!
Cannot create Vulkan instance.
This problem is often caused by a faulty installation of the Vulkan driver or attempting to use a GPU that does not support Vulkan.
ERROR at /build/source/vulkaninfo/vulkaninfo.h:674:vkCreateInstance failed with ERROR_INCOMPATIBLE_DRIVER

The system seems to now be on glibc 2.35, but now the graphics drivers want glibc 2.38.

How can I get a working system?

I don’t know by what magic mesa.drivers work (given they’re not from config.kernelPackages), but your system is “on glibc 2.38”:

❯ nix eval github:NixOS/nixpkgs/0cbe9f69c234a7700596e943bfae7ef27a31b735#glibc.version
"2.38"

…and mesa.drivers do use it:

❯ nix build github:NixOS/nixpkgs/0cbe9f69c234a7700596e943bfae7ef27a31b735#mesa.drivers
❯ ldd result-drivers/lib/libvulkan_intel.so 
...
        libc.so.6 => /nix/store/gqghjch4p1s69sv4mcjksb2kb65rwqjy-glibc-2.38-23/lib/libc.so.6 (0x00007f7f68018000)
...

What likely happens is that your vulkaninfo doesn’t actually come from 0cbe9f69c234a7700596e943bfae7ef27a31b735 and loads an older libc into the process, before libvulkan*.so can load theirs

1 Like

oh, you’re right. I thought home-manager was setting my NIX_PATH and/or channels based on its nixpkgs, but apparently I was wrong about that.

Thanks for the help in diagnosing the error messages!