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