When I try to run application which uses OpenGL installed or built with Nix package manager, GLX errors shows up:

$ /nix/store/p6fwy23nfcadxr4i780knajvmzga17aa-glxinfo-8.1.0/bin/glxinfo 
libGL error: failed to open drm device: No such file or directory
libGL error: failed to load driver: r600
libGL error: unable to load driver: swrast_dri.so
libGL error: failed to load driver: swrast
X Error of failed request:  GLXBadContext
  Major opcode of failed request:  156 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  50
  Current serial number in output stream:  49

1 Answer 1


In Nix mesa is patched to search drivers in /run/opengl-driver directory.

Install mesa-noglu:

$ nix-env -i mesa-noglu

and create symlink

$ sudo ln -s /nix/store/*-mesa-noglu-*-drivers /run/opengl-driver
  • swrast is not under any nix store?
    – don bright
    Commented Aug 16, 2017 at 6:04
  • @MadRunner: This solution saved me dearly on a related error. Are you aware of a more elegant Nixish solution ?
    – George
    Commented Sep 14, 2017 at 15:40
  • @George using NixOS, I presume. They will likely to have some script or another mechanism to handle different drivers.
    – MadRunner
    Commented Sep 15, 2017 at 4:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .