1{ 2 lib, 3 buildPythonPackage, 4 pythonOlder, 5 fetchFromGitHub, 6 cmake, 7 eigen, 8 ninja, 9 scikit-build, 10 pytestCheckHook, 11 numpy, 12 scipy, 13 torch, 14 jax, 15 jaxlib, 16 tensorflow, 17 setuptools, 18}: 19buildPythonPackage rec { 20 pname = "nanobind"; 21 version = "1.9.2"; 22 pyproject = true; 23 24 src = fetchFromGitHub { 25 owner = "wjakob"; 26 repo = pname; 27 rev = "v${version}"; 28 hash = "sha256-6swDqw7sEYOawQbNWD8VfSQoi+9wjhOhOOwPPkahDas="; 29 fetchSubmodules = true; 30 }; 31 32 disabled = pythonOlder "3.8"; 33 34 nativeBuildInputs = [ 35 cmake 36 ninja 37 scikit-build 38 setuptools 39 ]; 40 buildInputs = [ eigen ]; 41 dontUseCmakeBuildDir = true; 42 43 preCheck = '' 44 # build tests 45 make -j $NIX_BUILD_CORES 46 ''; 47 48 nativeCheckInputs = [ 49 pytestCheckHook 50 numpy 51 scipy 52 torch 53 tensorflow 54 # Uncomment at next release (1.9.3) 55 # See https://github.com/wjakob/nanobind/issues/578 56 # jax 57 # jaxlib 58 ]; 59 60 meta = with lib; { 61 homepage = "https://github.com/wjakob/nanobind"; 62 changelog = "https://github.com/wjakob/nanobind/blob/${src.rev}/docs/changelog.rst"; 63 description = "Tiny and efficient C++/Python bindings"; 64 longDescription = '' 65 nanobind is a small binding library that exposes C++ types in Python and 66 vice versa. It is reminiscent of Boost.Python and pybind11 and uses 67 near-identical syntax. In contrast to these existing tools, nanobind is 68 more efficient: bindings compile in a shorter amount of time, produce 69 smaller binaries, and have better runtime performance. 70 ''; 71 license = licenses.bsd3; 72 maintainers = with maintainers; [ parras ]; 73 }; 74}