1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 libGL,
6 libX11,
7 setuptools,
8 glcontext,
9 pythonOlder,
10}:
11
12buildPythonPackage rec {
13 pname = "moderngl";
14 version = "5.12.0";
15 pyproject = true;
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchPypi {
20 inherit pname version;
21 hash = "sha256-UpNqmMyy8uHW48sYUospGfaDHn4/kk54i1hzutzlEps=";
22 };
23
24 postPatch = ''
25 substituteInPlace _moderngl.py \
26 --replace-fail '"libGL.so"' '"${libGL}/lib/libGL.so"' \
27 --replace-fail '"libEGL.so"' '"${libGL}/lib/libEGL.so"'
28 '';
29
30 build-system = [ setuptools ];
31
32 buildInputs = [
33 libGL
34 libX11
35 ];
36
37 dependencies = [ glcontext ];
38
39 # Tests need a display to run.
40 doCheck = false;
41
42 pythonImportsCheck = [ "moderngl" ];
43
44 meta = with lib; {
45 description = "High performance rendering for Python";
46 homepage = "https://github.com/moderngl/moderngl";
47 changelog = "https://github.com/moderngl/moderngl/releases/tag/${version}";
48 license = licenses.mit;
49 maintainers = with maintainers; [ c0deaddict ];
50 # should be mesa.meta.platforms, darwin build breaks.
51 platforms = platforms.linux;
52 };
53}