1{ 2 lib, 3 buildPythonPackage, 4 pythonOlder, 5 fetchFromGitHub, 6 fetchpatch, 7 setuptools, 8 freetype-py, 9 imageio, 10 networkx, 11 numpy, 12 pillow, 13 pyglet, 14 pyopengl, 15 scipy, 16 six, 17 trimesh, 18 pytestCheckHook, 19}: 20 21buildPythonPackage rec { 22 pname = "pyrender"; 23 version = "0.1.45"; 24 pyproject = true; 25 26 disabled = pythonOlder "3.5"; 27 28 src = fetchFromGitHub { 29 owner = "mmatl"; 30 repo = "pyrender"; 31 rev = "refs/tags/${version}"; 32 hash = "sha256-V2G8QWXMxFDQpT4XDOJhIFI2V9VhDQCaXYBb/QVLxgM="; 33 }; 34 35 patches = [ 36 (fetchpatch { 37 # yet to be tagged 38 name = "relax-pyopengl.patch"; 39 url = "https://github.com/mmatl/pyrender/commit/7c613e8aed7142df9ff40767a8f10b7a19b6255c.patch"; 40 hash = "sha256-SXRV9RC3PfQGjjIQ+n97HZrSDPae3rAHnTBiHXSFLaY="; 41 }) 42 ]; 43 44 # trimesh too new 45 # issue: https://github.com/mmatl/pyrender/issues/203 46 # mega pr: https://github.com/mmatl/pyrender/pull/216 47 # relevant pr commit: https://github.com/mmatl/pyrender/pull/216/commits/5069aeb957addff8919f05dc9be4040f55bff329 48 # the commit does not apply as a patch when cherry picked, hence the substituteInPlace 49 postPatch = '' 50 substituteInPlace tests/unit/test_meshes.py \ 51 --replace-fail \ 52 "bm = trimesh.load('tests/data/WaterBottle.glb').dump()[0]" \ 53 'bm = trimesh.load("tests/data/WaterBottle.glb").geometry["WaterBottle"]' 54 ''; 55 56 nativeBuildInputs = [ setuptools ]; 57 58 dependencies = [ 59 freetype-py 60 imageio 61 networkx 62 numpy 63 pillow 64 pyglet 65 pyopengl 66 scipy 67 six 68 trimesh 69 ]; 70 71 env.PYOPENGL_PLATFORM = "egl"; # enables headless rendering during check 72 73 nativeCheckInputs = [ pytestCheckHook ]; 74 75 disabledTestPaths = [ 76 # does not work inside sandbox, no GPU 77 "tests/unit/test_offscreen.py" 78 ]; 79 80 pythonImportsCheck = [ "pyrender" ]; 81 82 meta = with lib; { 83 homepage = "https://pyrender.readthedocs.io/en/latest/"; 84 description = "Easy-to-use glTF 2.0-compliant OpenGL renderer for visualization of 3D scenes"; 85 license = licenses.mit; 86 maintainers = with maintainers; [ pbsds ]; 87 }; 88}