1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 nix-update-script, 6 python, 7 8 # nativeBuildInputs 9 cmake, 10 doxygen, 11 nanobind, 12 13 # propagatedBuildInputs 14 suitesparse, 15 eigen, 16 jrl-cmakemodules, 17 18 # dependencies 19 numpy, 20 21 # checkInputs 22 pytest, 23 scipy, 24}: 25 26buildPythonPackage rec { 27 pname = "nanoeigenpy"; 28 version = "0.4.0"; 29 pyproject = false; # Built with cmake 30 31 src = fetchFromGitHub { 32 owner = "Simple-Robotics"; 33 repo = "nanoeigenpy"; 34 tag = "v${version}"; 35 hash = "sha256-2Lp3fYw3rQYxjkCQCeHI+N32Y4vTJ8l+PoKqLCmAXIU="; 36 }; 37 38 # Fix: 39 # > PermissionError: [Errno 13] Permission denied: 40 # > '/nix/store/…-python3-3.12.9/lib/python3.12/site-packages/nanoeigenpy.pyi' 41 postPatch = '' 42 substituteInPlace CMakeLists.txt --replace-fail \ 43 "$""{Python_SITELIB}" \ 44 "${python.sitePackages}" 45 ''; 46 47 outputs = [ 48 "dev" 49 "doc" 50 "out" 51 ]; 52 53 cmakeFlags = [ 54 (lib.cmakeBool "INSTALL_DOCUMENTATION" true) 55 (lib.cmakeBool "BUILD_TESTING" true) 56 (lib.cmakeBool "BUILD_WITH_CHOLMOD_SUPPORT" true) 57 # Accelerate support in eigen requires 58 # https://gitlab.com/libeigen/eigen/-/merge_requests/856 59 # which is not in the current eigen v3.4.0-unstable-2022-05-19 60 # (lib.cmakeBool "BUILD_WITH_ACCELERATE_SUPPORT" stdenv.hostPlatform.isDarwin) 61 ]; 62 63 strictDeps = true; 64 65 nativeBuildInputs = [ 66 cmake 67 doxygen 68 nanobind 69 ]; 70 71 propagatedBuildInputs = [ 72 suitesparse 73 eigen 74 jrl-cmakemodules 75 ]; 76 77 dependencies = [ 78 numpy 79 ]; 80 81 checkInputs = [ 82 pytest 83 scipy 84 ]; 85 86 # Ensure the unit tests are built 87 preInstallCheck = "make test"; 88 89 pythonImportsCheck = [ "nanoeigenpy" ]; 90 91 passthru.updateScript = nix-update-script { }; 92 93 postFixup = '' 94 substituteInPlace $dev/lib/cmake/nanoeigenpy/nanoeigenpyConfig.cmake \ 95 --replace-fail $out $dev 96 ''; 97 98 meta = { 99 description = "Support library for bindings between Eigen in C++ and Python, based on nanobind"; 100 homepage = "https://github.com/Simple-Robotics/nanoeigenpy"; 101 changelog = "https://github.com/Simple-Robotics/nanoeigenpy/releases/tag/${src.tag}"; 102 license = lib.licenses.bsd3; 103 maintainers = with lib.maintainers; [ nim65s ]; 104 platforms = lib.platforms.unix ++ lib.platforms.windows; 105 }; 106}