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-dm5xfYAnn5N/8ZKTMyZNFM5/j3LLBrG+NOgmtxCAI6I=";
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)
65 ++ lib.optionals pythonSupport [
66 python3Packages.python
67 python3Packages.pythonImportsCheckHook
70 propagatedBuildInputs =
76 ++ lib.optionals (!pythonSupport) [
80 ++ lib.optionals (!pythonSupport && collisionSupport) [ coal ]
81 ++ lib.optionals pythonSupport [
83 python3Packages.eigenpy
85 ++ lib.optionals (pythonSupport && collisionSupport) [ python3Packages.coal ]
86 ++ lib.optionals (!pythonSupport && casadiSupport) [ casadi ]
87 ++ lib.optionals (pythonSupport && casadiSupport) [ python3Packages.casadi ];
89 checkInputs = lib.optionals (pythonSupport && casadiSupport) [ python3Packages.matplotlib ];
93 (lib.cmakeBool "BUILD_PYTHON_INTERFACE" pythonSupport)
94 (lib.cmakeBool "BUILD_WITH_LIBPYTHON" pythonSupport)
95 (lib.cmakeBool "BUILD_WITH_CASADI_SUPPORT" casadiSupport)
96 (lib.cmakeBool "BUILD_WITH_COLLISION_SUPPORT" collisionSupport)
97 (lib.cmakeBool "INSTALL_DOCUMENTATION" true)
98 # Disable test that fails on darwin
99 # https://github.com/stack-of-tasks/pinocchio/blob/42306ed023b301aafef91e2e76cb070c5e9c3f7d/flake.nix#L24C1-L27C17
101 ++ lib.optionals stdenv.hostPlatform.isDarwin [
102 (lib.cmakeFeature "CMAKE_CTEST_ARGUMENTS" "--exclude-regex;pinocchio-example-py-casadi-quadrotor-ocp")
106 pythonImportsCheck = [ "pinocchio" ];
109 description = "Fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives";
110 homepage = "https://github.com/stack-of-tasks/pinocchio";
111 license = lib.licenses.bsd2;
112 maintainers = with lib.maintainers; [
116 platforms = lib.platforms.unix;