Issues with openGL in minecraft development environments

libGL.so is available through libglvnd.

$ nix-locate --top-level libGL.so
xorg_sys_opengl.out                                   0 s /nix/store/5iwk3yqvkbxkmibphv5hkvgad1imr7d8-xorg-sys-opengl-3/lib/libGL.so.1
qt6.full.out                                          0 s /nix/store/0800mlxnhc2br7h0123dz92i6w873nnp-qt-full-6.6.1/lib/libGL.so
qt6.full.out                                          0 s /nix/store/0800mlxnhc2br7h0123dz92i6w873nnp-qt-full-6.6.1/lib/libGL.so.1
qt6.full.out                                          0 s /nix/store/0800mlxnhc2br7h0123dz92i6w873nnp-qt-full-6.6.1/lib/libGL.so.1.7.0
primusLib.out                                         0 s /nix/store/dy5yiw2r3lj9k8syfbwy8cwslk4hlamz-primus-lib-unstable-2015-04-28/lib/libGL.so
primusLib.out                                   390,192 x /nix/store/dy5yiw2r3lj9k8syfbwy8cwslk4hlamz-primus-lib-unstable-2015-04-28/lib/libGL.so.1
libglvnd.out                                          0 s /nix/store/yw48bqgswppkcrx303ybgbn6r2nqbda1-libglvnd-1.7.0/lib/libGL.so
libglvnd.out                                          0 s /nix/store/yw48bqgswppkcrx303ybgbn6r2nqbda1-libglvnd-1.7.0/lib/libGL.so.1
libglvnd.out                                    740,448 x /nix/store/yw48bqgswppkcrx303ybgbn6r2nqbda1-libglvnd-1.7.0/lib/libGL.so.1.7.0

running Minecraft from an IDE to develop mods no longer works, failing with an OpenGL exception:

To make this library available, you can use LD_LIBRARY_PATH which can extend the default locations for glibc to look for dynamic libraries. To do this, you want to run something like export LD_LIBRARYPATH="${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}/nix/store/yw48bqgswppkcrx303ybgbn6r2nqbda1-libglvnd-1.7.0/lib

Ideally, this would take the form of using nix develop:

# devShell.nix or shell.nix
{ mkShell
, libglvnd
...
}:

mkShell {
...
  shellHook = ''
    export LD_LIBRARY_PATH="''${LD_LIBRARY_PATH}''${LD_LIBRARY_PATH:+:}${libglvnd}/lib"
  '';
}
1 Like