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