diff --git a/pkgs/development/python-modules/nanoeigenpy/default.nix b/pkgs/development/python-modules/nanoeigenpy/default.nix new file mode 100644 index 000000000000..9e1f0378dc3f --- /dev/null +++ b/pkgs/development/python-modules/nanoeigenpy/default.nix @@ -0,0 +1,106 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + nix-update-script, + python, + + # nativeBuildInputs + cmake, + doxygen, + nanobind, + + # propagatedBuildInputs + suitesparse, + eigen, + jrl-cmakemodules, + + # dependencies + numpy, + + # checkInputs + pytest, + scipy, +}: + +buildPythonPackage rec { + pname = "nanoeigenpy"; + version = "0.3.0"; + pyproject = false; # Built with cmake + + src = fetchFromGitHub { + owner = "Simple-Robotics"; + repo = "nanoeigenpy"; + tag = "v${version}"; + hash = "sha256-asDe1mrTsAxVl0gAo7zlWqQRfWYBiSLqQk1d8bEBsn4="; + }; + + # Fix: + # > PermissionError: [Errno 13] Permission denied: + # > '/nix/store/…-python3-3.12.9/lib/python3.12/site-packages/nanoeigenpy.pyi' + postPatch = '' + substituteInPlace CMakeLists.txt --replace-fail \ + "$""{Python_SITELIB}" \ + "${python.sitePackages}" + ''; + + outputs = [ + "dev" + "doc" + "out" + ]; + + cmakeFlags = [ + (lib.cmakeBool "INSTALL_DOCUMENTATION" true) + (lib.cmakeBool "BUILD_TESTING" true) + (lib.cmakeBool "BUILD_WITH_CHOLMOD_SUPPORT" true) + # Accelerate support in eigen requires + # https://gitlab.com/libeigen/eigen/-/merge_requests/856 + # which is not in the current eigen v3.4.0-unstable-2022-05-19 + # (lib.cmakeBool "BUILD_WITH_ACCELERATE_SUPPORT" stdenv.hostPlatform.isDarwin) + ]; + + strictDeps = true; + + nativeBuildInputs = [ + cmake + doxygen + nanobind + ]; + + propagatedBuildInputs = [ + suitesparse + eigen + jrl-cmakemodules + ]; + + dependencies = [ + numpy + ]; + + checkInputs = [ + pytest + scipy + ]; + + # Ensure the unit tests are built + preInstallCheck = "make test"; + + pythonImportsCheck = [ "nanoeigenpy" ]; + + passthru.updateScript = nix-update-script { }; + + postFixup = '' + substituteInPlace $dev/lib/cmake/nanoeigenpy/nanoeigenpyConfig.cmake \ + --replace-fail $out $dev + ''; + + meta = { + description = "Support library for bindings between Eigen in C++ and Python, based on nanobind"; + homepage = "https://github.com/Simple-Robotics/nanoeigenpy"; + changelog = "https://github.com/Simple-Robotics/nanoeigenpy/releases/tag/${src.tag}"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ nim65s ]; + platforms = lib.platforms.unix ++ lib.platforms.windows; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 1b091dda03be..e2c95f778198 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -9928,6 +9928,8 @@ self: super: with self; { nanobind = callPackage ../development/python-modules/nanobind { }; + nanoeigenpy = callPackage ../development/python-modules/nanoeigenpy { }; + nanoemoji = callPackage ../development/python-modules/nanoemoji { }; nanoid = callPackage ../development/python-modules/nanoid { };