{ lib, stdenv, buildPythonPackage, fetchFromGitHub, flit-core, libGL, libGLU, libxxf86vm, libxrender, libxrandr, libxi, libxinerama, libxext, libx11, pytestCheckHook, glibc, gtk2-x11, gdk-pixbuf, fontconfig, freetype, ffmpeg-full, openal, libpulseaudio, harfbuzz, apple-sdk, }: buildPythonPackage rec { version = "2.1.12"; pname = "pyglet"; pyproject = true; src = fetchFromGitHub { owner = "pyglet"; repo = "pyglet"; tag = "v${version}"; hash = "sha256-stzz7sxPH6cduhG2ySw/Zg+wdTE/Y0ZeBU90D0Aa2oU="; }; # find_library doesn't reliably work with nix (https://github.com/NixOS/nixpkgs/issues/7307). # Even naively searching `LD_LIBRARY_PATH` won't work since `libc.so` is a linker script and # ctypes.cdll.LoadLibrary cannot deal with those. Therefore, just hardcode the paths to the # necessary libraries. postPatch = let ext = stdenv.hostPlatform.extensions.sharedLibrary; in lib.optionalString stdenv.isLinux '' cat > pyglet/lib.py < pyglet/lib.py <