6 collisionSupport ? true,
16 pythonSupport ? false,
22 stdenv.mkDerivation (finalAttrs: {
26 src = fetchFromGitHub {
27 owner = "stack-of-tasks";
29 rev = "v${finalAttrs.version}";
30 hash = "sha256-8V+n1TwFojXKOVkGG8k9aXVadt2NBFlZKba93L+NRNU=";
38 # test failure, ref https://github.com/stack-of-tasks/pinocchio/issues/2277
39 prePatch = lib.optionalString (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) ''
40 substituteInPlace unittest/algorithm/utils/CMakeLists.txt \
41 --replace-fail "add_pinocchio_unit_test(force)" ""
45 # example-robot-data models are used in checks.
46 # Upstream provide them as git submodule, but we can use our own version instead.
47 test -d models/example-robot-data && rmdir models/example-robot-data
48 ln -s ${example-robot-data.src} models/example-robot-data
50 # allow package:// uri use in examples
51 export ROS_PACKAGE_PATH=${example-robot-data}/share
53 # silence matplotlib warning
54 export MPLCONFIGDIR=$(mktemp -d)
57 # CMAKE_BUILD_TYPE defaults to Release in this package,
58 # which enable -O3, which break some tests
59 # ref. https://github.com/stack-of-tasks/pinocchio/issues/2304#issuecomment-2231018300
61 substituteInPlace CMakeCache.txt --replace-fail '-O3' '-O2'
72 ++ lib.optionals pythonSupport [
73 python3Packages.python
74 python3Packages.pythonImportsCheckHook
77 propagatedBuildInputs =
83 ++ lib.optionals (!pythonSupport) [
87 ++ lib.optionals (!pythonSupport && collisionSupport) [ hpp-fcl ]
88 ++ lib.optionals pythonSupport [
90 python3Packages.eigenpy
92 ++ lib.optionals (pythonSupport && collisionSupport) [ python3Packages.hpp-fcl ]
93 ++ lib.optionals (!pythonSupport && casadiSupport) [ casadi ]
94 ++ lib.optionals (pythonSupport && casadiSupport) [ python3Packages.casadi ];
96 checkInputs = lib.optionals (pythonSupport && casadiSupport) [ python3Packages.matplotlib ];
99 (lib.cmakeBool "BUILD_PYTHON_INTERFACE" pythonSupport)
100 (lib.cmakeBool "BUILD_WITH_LIBPYTHON" pythonSupport)
101 (lib.cmakeBool "BUILD_WITH_CASADI_SUPPORT" casadiSupport)
102 (lib.cmakeBool "BUILD_WITH_COLLISION_SUPPORT" collisionSupport)
103 (lib.cmakeBool "INSTALL_DOCUMENTATION" true)
107 pythonImportsCheck = [ "pinocchio" ];
110 description = "Fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives";
111 homepage = "https://github.com/stack-of-tasks/pinocchio";
112 license = lib.licenses.bsd2;
113 maintainers = with lib.maintainers; [
117 platforms = lib.platforms.unix;