OpenGL unusable on my machine

I found that running nix run nixpkgs.glxinfo -c glxinfo on my machine sends back :

libGL error: MESA-LOADER: failed to open radeonsi (search paths /run/opengl-driver/lib/dri)
libGL error: failed to load driver: radeonsi
libGL error: MESA-LOADER: failed to open radeonsi (search paths /run/opengl-driver/lib/dri)
libGL error: failed to load driver: radeonsi
libGL error: MESA-LOADER: failed to open swrast (search paths /run/opengl-driver/lib/dri)
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  152 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  60
  Current serial number in output stream:  59

while still the search paths do contain the libraries :

dr-xr-xr-x    - root  1 janv.  1970 d3d
dr-xr-xr-x    - root  1 janv.  1970 dri
lrwxrwxrwx   16 root  1 janv.  1970 libEGL_mesa.so -> libEGL_mesa.so.0
lrwxrwxrwx   20 root  1 janv.  1970 libEGL_mesa.so.0 -> libEGL_mesa.so.0.0.0
.r-xr-xr-x 326k root  1 janv.  1970 libEGL_mesa.so.0.0.0
lrwxrwxrwx   16 root  1 janv.  1970 libGLX_mesa.so -> libGLX_mesa.so.0
lrwxrwxrwx   20 root  1 janv.  1970 libGLX_mesa.so.0 -> libGLX_mesa.so.0.0.0
.r-xr-xr-x 657k root  1 janv.  1970 libGLX_mesa.so.0.0.0
.r-xr-xr-x 8,4M root  1 janv.  1970 libvulkan_intel.so
.r-xr-xr-x 7,0M root  1 janv.  1970 libvulkan_radeon.so
lrwxrwxrwx   17 root  1 janv.  1970 libxatracker.so -> libxatracker.so.2
lrwxrwxrwx   21 root  1 janv.  1970 libxatracker.so.2 -> libxatracker.so.2.5.0
.r-xr-xr-x 6,4M root  1 janv.  1970 libxatracker.so.2.5.0
.r-xr-xr-x 7,1M root  1 janv.  1970 libXvMCnouveau.so
.r-xr-xr-x 7,1M root  1 janv.  1970 libXvMCr600.so
dr-xr-xr-x    - root  1 janv.  1970 vdpau

The module controlling my configuration for this is just :

{ config, pkgs, lib, ... }:

with lib;
{
  options.perso.gaming = mkEnableOption "Enable the gaming configuration on Hyperion";
  config = mkIf config.perso.gaming {
   # Using kernel parameters that supports the GPU (AMD Radeon R9 290X (Hawaii XT))
  boot = with pkgs; {
    kernelParams = [
      "radeon.si_support=0"
      "radeon.cik_support=0" # Disables Radeon CIK(Sea Island) Support
      "amdgpu.si_support=0"
      "amdgpu.cik_support=1" # Enables AMDGPU CIK(Sea Island) Support
      "amdgpu.modeset=1"
      "amdgpu.dc=1" # Enables Display Core driver
    ];
  };
  # Using the aforementionned driver
  services.xserver.videoDrivers = [ "amdgpu" ];

  # Using OpenGL as a fallback in case of non-working GPU config
   hardware.opengl = {
     driSupport = true;
     driSupport32Bit = true;
   };
  };
}

The output of nix-shell -p nix-info --run "nix-info -m" is :

- system: `"x86_64-linux"`
 - host os: `Linux 5.7.8, NixOS, 20.03.2533.76adfc180c0 (Markhor)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.6`
 - channels(root): `"nixos-20.03.2593.aaa66d8d887, home-manager-19.03"`
 - channels(sirc): `"home-manager-19.03, nixos-20.03-20.03.2528.e69cfc351be, nixos-unstable-20.09pre234242.c71518e75bf, nixpkgs-20.09pre234831.e97fdce4e1b"`
 - nixpkgs: `/home/sirc/.nix-defexpr/channels/nixpkgs`

Would anyone have an idea of why is that ?

No solution, but I have the exact same problem on my config.
I also use the amdgpu video driver with a “Sea Island” AMD gpu. Using the default video driver (I don’t know which it is) gives the same result with glxinfo.

Might be caused by mixing different Nixpkgs revisions (with a glibc update between the two revisions?). See e.g. https://github.com/NixOS/nixpkgs/issues/94315#issuecomment-667942575.

Yeah this is very likely OP’s issue. You can test with:

nix run -f channel:nixos-20.03 glxinfo -c glxgears
nix run -f channel:nixos-unstable glxinfo -c glxgears

If you’re running NixOS 20.03 the latter should give the same error as in OP. So I guess we have two choices: roll back the user channel, or upgrade the system. I opted for the former by

nix-channel --add https://nixos.org/channels/nixos-20.03 nixpkgs
nix-channel --add https://nixos.org/channels/nixos-unstable unstable
nix-channel --update

I’ve also pinned my home-manager Nixpkgs as well so it’s more obvious when a channel upgrade breaks something.