1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 setuptools,
6 libGL,
7 libX11,
8}:
9
10buildPythonPackage rec {
11 pname = "glcontext";
12 version = "3.0.0";
13 pyproject = true;
14
15 src = fetchFromGitHub {
16 owner = "moderngl";
17 repo = "glcontext";
18 tag = version;
19 hash = "sha256-GC2sb6xQjg99xLcXSynLOOyyqNwCHZwZqrs9RZh99pY=";
20 };
21
22 build-system = [ setuptools ];
23
24 buildInputs = [
25 libGL
26 libX11
27 ];
28
29 postPatch = ''
30 substituteInPlace glcontext/x11.cpp \
31 --replace-fail '"libGL.so"' '"${libGL}/lib/libGL.so"' \
32 --replace-fail '"libX11.so"' '"${libX11}/lib/libX11.so"'
33 substituteInPlace glcontext/egl.cpp \
34 --replace-fail '"libGL.so"' '"${libGL}/lib/libGL.so"' \
35 --replace-fail '"libEGL.so"' '"${libGL}/lib/libEGL.so"'
36 '';
37
38 # Tests fail because they try to open display. See
39 # https://github.com/NixOS/nixpkgs/pull/121439
40 # for details.
41 doCheck = false;
42
43 pythonImportsCheck = [ "glcontext" ];
44
45 meta = with lib; {
46 homepage = "https://github.com/moderngl/glcontext";
47 description = "OpenGL implementation for ModernGL";
48 license = licenses.mit;
49 platforms = platforms.linux;
50 maintainers = [ ];
51 };
52}