GL not finding library in nix-shell

Hi! I’m trying to use ebiten for game programming in Go, and I’m having issues getting it to find my libraries. I read the docs and found that you need to use nix-shell in order for programs to get access to the libraries, so i followed suit.

Without nix-shell, as expected, gcc does not find any of the required libraries to compile.

go run github.com/hajimehoshi/ebiten/v2/examples/animation@latest
# github.com/hajimehoshi/ebiten/v2/examples/animation
/nix/store/y7abhs9glxfcg7lgcdc8i4ml5wg5ly92-go-1.21.4/share/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/nix/store/1fn92b0783crypjcxvdv6ycmvi27by0j-binutils-2.40/bin/ld: cannot find -lX11: No such file or directory
/nix/store/1fn92b0783crypjcxvdv6ycmvi27by0j-binutils-2.40/bin/ld: cannot find -lXrandr: No such file or directory
/nix/store/1fn92b0783crypjcxvdv6ycmvi27by0j-binutils-2.40/bin/ld: cannot find -lXxf86vm: No such file or directory
/nix/store/1fn92b0783crypjcxvdv6ycmvi27by0j-binutils-2.40/bin/ld: cannot find -lXi: No such file or directory
/nix/store/1fn92b0783crypjcxvdv6ycmvi27by0j-binutils-2.40/bin/ld: cannot find -lXcursor: No such file or directory
collect2: error: ld returned 1 exit status

but once I enter a nix-shell with all of the required libraries, I get a runtime error about gl somehow not finding them.

nix-shell -p gcc go pkg-config xorg.libX11 xorg.libXrandr xorg.libXcursor xorg.libXinerama xorg.libXi xorg.libXxf86vm libglvnd

[nix-shell:~]$ go run github.com/hajimehoshi/ebiten/v2/examples/animation@latest
2024/01/07 11:16:20 gl: failed to load libGL.so and libGLESv2.so
exit status 1

note that gcc does find the libraries, so in theory they’re in the linker path.

How would I go about debugging this? Is this an ebiten issue? Should I be doing something I’m not to get access to the libraries? Any pointers or answers would be welcome.

nix-info

system: "x86_64-linux", multi-user?: yes, version: nix-env (Nix) 2.18.1, channels(root): "nixos-23.11, nixos-unstable", nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos