There’s a small open-source game (https://tsoding.itch.io/eepers) I’d like to run on NixOS. The game, written in Ada, uses raylib.
The pre-compiled binary, of course, won’t run on NixOS out of the box, so I tried using patchelf.
# enter a nix-shell
nix-shell -p binutils stdenv wget stdenv.cc raylib glfw xorg.libX11.dev
# download the binary
wget https://github.com/tsoding/eepers/releases/download/v1.3/eepers-1.3.zip
unzip eepers-1.3.zip
# Set interpreter
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" eepers-1.3/eepers-linux
patchelf --print-interpreter eepers-1.3/eepers-linux
# /nix/store/9la894yvmmksqlapd4v16wvxpaw3rg70-glibc-2.37-8/lib/ld-linux-x86-64.so.2
# Print needed libraries
patchelf --print-needed eepers-1.3/eepers-linux
# libm.so.6
# libgcc_s.so.1
# libc.so.6
# ld-linux-x86-64.so.2
# All the libraries appear to be present
ldd eepers-1.3/eepers-linux
linux-vdso.so.1 (0x00007fff83dcd000)
libm.so.6 => /nix/store/9la894yvmmksqlapd4v16wvxpaw3rg70-glibc-2.37-8/lib/libm.so.6 (0x00007f3ec8ee5000)
libgcc_s.so.1 => /nix/store/ibw4h4lp57820gi5i46iwdnp9i58k8li-xgcc-12.3.0-libgcc/lib/libgcc_s.so.1 (0x00007f3ec8ec4000)
libc.so.6 => /nix/store/9la894yvmmksqlapd4v16wvxpaw3rg70-glibc-2.37-8/lib/libc.so.6 (0x00007f3ec8a1a000)
/nix/store/9la894yvmmksqlapd4v16wvxpaw3rg70-glibc-2.37-8/lib/ld-linux-x86-64.so.2 => /nix/store/9la894yvmmksqlapd4v16wvxpaw3rg70-glibc-2.37-8/lib64/ld-linux-x86-64.so.2 (0x00007f3ec8fc7000)
However, when I try to run the patched binary, I get an error:
eepers-1.3/eepers-linux
# INFO: FILEIO: [assets/icon.png] File loaded successfully
# INFO: IMAGE: Data loaded successfully (64x64 | R8G8B8A8 | 1 mipmaps)
# INFO: Initializing raylib 5.0
# INFO: Platform backend: DESKTOP (GLFW)
# INFO: Supported raylib modules:
# INFO: > rcore:..... loaded (mandatory)
# INFO: > rlgl:...... loaded (mandatory)
# INFO: > rshapes:... loaded (optional)
# INFO: > rtextures:. loaded (optional)
# INFO: > rtext:..... loaded (optional)
# INFO: > rmodels:... loaded (optional)
# INFO: > raudio:.... loaded (optional)
# WARNING: GLFW: Error: 65544 Description: X11: Failed to load Xlib
# WARNING: GLFW: Failed to initialize GLFW
#
# raised STORAGE_ERROR : stack overflow or erroneous memory access
Any idea what I’m missing?