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

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 Aug 16 '17 at 6:04
  • @MadRunner: This solution saved me dearly on a related error. Are you aware of a more elegant Nixish solution ? – George Sep 14 '17 at 15:40
  • @George using NixOS, I presume. They will likely to have some script or another mechanism to handle different drivers. – MadRunner Sep 15 '17 at 4:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.