Failure to use shell.nix to add OpenGL Libraries

I’m trying to revive an old project that I’ve neglected. When I first started the project, I installed “sbcl_2_0_2”, “SDL2”, “libGL”, and “libGL_driver”, and exported LD_LIBRARY_PATH=“$env/lib” and LIBGL_DRIVERS_PATH=“$env/lib/dri”. At the time, it was on a Debian system, and thus there was no “system” support for this – but I was able to get it to work at the time!

Since then, I have moved to a computer with NixOS installed, but I still want to keep the dependencies “tracked” in a “shell.nix” file; I have updated SBCL to “sbcl_2_3_9”, I cannot get it to find the libraries. When I try to install “libGL_driver”, I find it’s no longer available, and without it, I get the following errors (using LIBGL_DEBUG=“verbose”):

This is SBCL 2.3.9.nixos, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
To load "sdl2":
  Load 1 ASDF system:
    sdl2
; Loading "sdl2"
..................
* (load "first-window")
hello, world!

T
* (first-window)
Using SDL2 Library Version:  2.0.20

So far, so good!
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /home/odin/alphy/.drirc: No such file or directory.
libGL: using driver amdgpu for 15
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /home/odin/alphy/.drirc: No such file or directory.
libGL: pci id for fd 15: 1002:1636, driver radeonsi
libGL: MESA-LOADER: failed to open /nix/store/208frkc81rdw5s0jcdp5rfgkiq0mlmf5-hamilton-iv-epsilon-env/lib/dri/radeonsi_dri.so: /nix/store/208frkc81rdw5s0jcdp5rfgkiq0mlmf5-hamilton-iv-epsilon-env/lib/dri/radeonsi_dri.so: cannot open shared object file: No such file or directory
libGL error: MESA-LOADER: failed to open radeonsi: /nix/store/208frkc81rdw5s0jcdp5rfgkiq0mlmf5-hamilton-iv-epsilon-env/lib/dri/radeonsi_dri.so: cannot open shared object file: No such file or directory (search paths /nix/store/208frkc81rdw5s0jcdp5rfgkiq0mlmf5-hamilton-iv-epsilon-env/lib/dri, suffix _dri)
libGL error: failed to load driver: radeonsi
libGL: MESA-LOADER: failed to open /nix/store/208frkc81rdw5s0jcdp5rfgkiq0mlmf5-hamilton-iv-epsilon-env/lib/dri/swrast_dri.so: /nix/store/208frkc81rdw5s0jcdp5rfgkiq0mlmf5-hamilton-iv-epsilon-env/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory
libGL error: MESA-LOADER: failed to open swrast: /nix/store/208frkc81rdw5s0jcdp5rfgkiq0mlmf5-hamilton-iv-epsilon-env/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /nix/store/208frkc81rdw5s0jcdp5rfgkiq0mlmf5-hamilton-iv-epsilon-env/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  150 (GLX)
  Minor opcode of failed request:  3 (X_GLXCreateContext)
  Value in failed request:  0x0
  Serial number of failed request:  112
  Current serial number in output stream:  113

I have seen a tutorial describing how to use “configuration.nix” to install these libraries, but besides the fact that this goes counter to the spirit of “shell.nix”, when I try to use “configuration.nix” to install these libraries, they are unavailable to the shell environment! (As they should be, I might add! :wink: )

How do I install these drivers? Ideally, I’d like to install them by “shell.nix”, but if that’s not possible, I may need help understanding how to access the system versions of these drivers from a “shell.nix” shell.

Ok, I got it to work!

I was reviewing what I could find (again), and this time, through some trial and error, I found that installing “mesa.driver” instead of “libGL_driver” is what I needed!

(I also tried installing the “mesa” package, but for whatever reasons I don’t fully understand, that wasn’t sufficient for providing the libraries.)

I cannot help but fear that this is an esoteric problem that only affects me, but if not, I hope this saves someone from some grief!