about summary refs log tree commit diff
path: root/pkgs/by-name/cr/crocoddyl/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/cr/crocoddyl/package.nix')
-rw-r--r--pkgs/by-name/cr/crocoddyl/package.nix89
1 files changed, 89 insertions, 0 deletions
diff --git a/pkgs/by-name/cr/crocoddyl/package.nix b/pkgs/by-name/cr/crocoddyl/package.nix
new file mode 100644
index 000000000000..a1a283727743
--- /dev/null
+++ b/pkgs/by-name/cr/crocoddyl/package.nix
@@ -0,0 +1,89 @@
+{
+  blas,
+  cmake,
+  doxygen,
+  example-robot-data,
+  fetchFromGitHub,
+  ipopt,
+  lapack,
+  lib,
+  pinocchio,
+  pkg-config,
+  pythonSupport ? false,
+  python3Packages,
+  stdenv,
+}:
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "crocoddyl";
+  version = "2.1.0";
+
+  src = fetchFromGitHub {
+    owner = "loco-3d";
+    repo = "crocoddyl";
+    rev = "v${finalAttrs.version}";
+    hash = "sha256-SVV9sleDXLm2QJmNgL25XLHC3y5bfKab4GSlE8jbT8w=";
+  };
+
+  outputs = [
+    "out"
+    "doc"
+  ];
+
+  strictDeps = true;
+
+  nativeBuildInputs =
+    [
+      cmake
+      doxygen
+      pkg-config
+    ]
+    ++ lib.optionals pythonSupport [
+      python3Packages.python
+      python3Packages.pythonImportsCheckHook
+    ];
+
+  propagatedBuildInputs =
+    [
+      blas
+      ipopt
+      lapack
+    ]
+    ++ lib.optionals (!pythonSupport) [
+      example-robot-data
+      pinocchio
+    ]
+    ++ lib.optionals pythonSupport [
+      python3Packages.example-robot-data
+      python3Packages.pinocchio
+      python3Packages.scipy
+    ];
+
+  cmakeFlags = [
+    (lib.cmakeBool "INSTALL_DOCUMENTATION" true)
+    (lib.cmakeBool "BUILD_EXAMPLES" pythonSupport)
+    (lib.cmakeBool "BUILD_PYTHON_INTERFACE" pythonSupport)
+  ];
+
+  prePatch = ''
+    substituteInPlace \
+      examples/CMakeLists.txt \
+      examples/log/check_logfiles.sh \
+      --replace-fail /bin/bash ${stdenv.shell}
+  '';
+
+  doCheck = true;
+  pythonImportsCheck = [ "crocoddyl" ];
+  checkInputs = lib.optionals pythonSupport [ python3Packages.scipy ];
+
+  meta = with lib; {
+    description = "Crocoddyl optimal control library";
+    homepage = "https://github.com/loco-3d/crocoddyl";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [
+      nim65s
+      wegank
+    ];
+    platforms = platforms.unix;
+  };
+})