From 8b807a89ffbe4e9059af10ea1c13e7bb42f9c953 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Fri, 28 Jun 2024 16:38:58 +0200 Subject: [PATCH 01/14] proxsuite: init at 0.6.6 --- pkgs/by-name/pr/proxsuite/package.nix | 97 +++++++++++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 99 insertions(+) create mode 100644 pkgs/by-name/pr/proxsuite/package.nix diff --git a/pkgs/by-name/pr/proxsuite/package.nix b/pkgs/by-name/pr/proxsuite/package.nix new file mode 100644 index 0000000000000..66b04d9300082 --- /dev/null +++ b/pkgs/by-name/pr/proxsuite/package.nix @@ -0,0 +1,97 @@ +{ + lib, + stdenv, + fetchFromGitHub, + fetchpatch, + cereal, + cmake, + doxygen, + eigen, + jrl-cmakemodules, + simde, + matio, + pythonSupport ? false, + python3Packages, +}: +stdenv.mkDerivation (finalAttrs: { + pname = "proxsuite"; + version = "0.6.6"; + + src = fetchFromGitHub { + owner = "simple-robotics"; + repo = "proxsuite"; + rev = "v${finalAttrs.version}"; + hash = "sha256-3kzFYADk3sCMU827KowilPlmOqgv69DJ3mOb7623Qdg="; + }; + + patches = [ + # Allow use of system jrl-cmakemodules + # This was merged upstream, and can be removed on next release + (fetchpatch { + url = "https://github.com/Simple-Robotics/proxsuite/pull/334/commits/2bcadd4993a9940c545136faa71bf1e97a972735.patch"; + hash = "sha256-BPtwogSwSXcEd5FM4eTTCq6LpGWvQ1SOCFmv/GVhl18="; + }) + # Allow use of system cereal + # This was merged upstream, and can be removed on next release + (fetchpatch { + url = "https://github.com/Simple-Robotics/proxsuite/pull/334/commits/878337c6284c9fd73b19f1f80d5fa802def8cdc6.patch"; + hash = "sha256-+HWYHLGtygjlvjM+FSD9WFDIwO+qPLlzci+7q42bo0I="; + }) + # Allow use of system pybind11 + # upstream will move to nanobind for next release, so this can be dismissed + (fetchpatch { + url = "https://github.com/Simple-Robotics/proxsuite/pull/337/commits/bbed9bdfb214da7c6c6909582971bd8b877f87c2.patch"; + hash = "sha256-pYikPZinjmk7gsagiaIcQspmGFYwlhdiKdZPnqo7pcQ="; + }) + ]; + + postPatch = '' + # discard failing tests for now + substituteInPlace test/CMakeLists.txt \ + --replace-fail "proxsuite_test(dense_maros_meszaros src/dense_maros_meszaros.cpp)" "" \ + --replace-fail "proxsuite_test(sparse_maros_meszaros src/sparse_maros_meszaros.cpp)" "" + + # fix CMake syntax + substituteInPlace bindings/python/CMakeLists.txt \ + --replace-fail "SYSTEM PRIVATE" "PRIVATE" + ''; + + outputs = [ + "doc" + "out" + ]; + + cmakeFlags = [ + (lib.cmakeBool "BUILD_DOCUMENTATION" true) + (lib.cmakeBool "INSTALL_DOCUMENTATION" true) + (lib.cmakeBool "BUILD_PYTHON_INTERFACE" pythonSupport) + ]; + + strictDeps = true; + + nativeBuildInputs = [ + cmake + doxygen + ]; + propagatedBuildInputs = [ + cereal + eigen + jrl-cmakemodules + simde + ] ++ lib.optionals pythonSupport [ python3Packages.pybind11 ]; + checkInputs = + [ matio ] + ++ lib.optionals pythonSupport [ + python3Packages.numpy + python3Packages.scipy + ]; + + doCheck = true; + + meta = { + description = "The Advanced Proximal Optimization Toolbox"; + homepage = "https://github.com/Simple-Robotics/proxsuite"; + license = lib.licenses.bsd2; + maintainers = with lib.maintainers; [ nim65s ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 74e7138a77473..df111bfad8e22 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -10219,6 +10219,8 @@ self: super: with self; { propka = callPackage ../development/python-modules/propka { }; + proxsuite = toPythonModule (pkgs.proxsuite.override { pythonSupport = true; python3Packages = self; }); + proxy-tools = callPackage ../development/python-modules/proxy-tools { }; proxy-db = callPackage ../development/python-modules/proxy-db { }; From 1c48fcff9c43a00a965e044df8fe226a1a4f781d Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Tue, 30 Jul 2024 16:42:37 +0200 Subject: [PATCH 02/14] superscs: init at 1.3.2 --- pkgs/by-name/su/superscs/package.nix | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 pkgs/by-name/su/superscs/package.nix diff --git a/pkgs/by-name/su/superscs/package.nix b/pkgs/by-name/su/superscs/package.nix new file mode 100644 index 0000000000000..f558bec8a2089 --- /dev/null +++ b/pkgs/by-name/su/superscs/package.nix @@ -0,0 +1,44 @@ +{ + blas, + lapack, + lib, + fetchFromGitHub, + stdenv, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "superscs"; + version = "1.3.3"; + + src = fetchFromGitHub { + owner = "kul-optec"; + repo = "superscs"; + #rev = "v${finalAttrs.version}"; + # ref. https://github.com/kul-optec/superscs/pull/38 + rev = "500070e807f92347a7c6cbdc96739521a256b71e"; + hash = "sha256-Qu7RM6Ew4hEmoIXO0utDDVmjmNX3yt3FxWZXCQ/Xjp4="; + }; + + postPatch = lib.optionalString stdenv.isDarwin '' + substituteInPlace Makefile --replace-fail \ + ".so" \ + ".dylib" + ''; + + buildInputs = [ + blas + lapack + ]; + + makeFlags = [ "PREFIX=$(out)" ]; + + doCheck = true; + + meta = { + description = "Fast conic optimization in C"; + homepage = "https://github.com/kul-optec/superscs"; + changelog = "https://github.com/kul-optec/superscs/blob/${finalAttrs.src.rev}/CHANGELOG.md"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ nim65s ]; + }; +}) From 59573a150243af7582b277e1c972d5f1e885bb48 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Tue, 30 Jul 2024 17:01:26 +0200 Subject: [PATCH 03/14] trlib: init at 0.4 --- pkgs/by-name/tr/trlib/package.nix | 49 ++++++++++++++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 ++ 2 files changed, 51 insertions(+) create mode 100644 pkgs/by-name/tr/trlib/package.nix diff --git a/pkgs/by-name/tr/trlib/package.nix b/pkgs/by-name/tr/trlib/package.nix new file mode 100644 index 0000000000000..a3770293dd026 --- /dev/null +++ b/pkgs/by-name/tr/trlib/package.nix @@ -0,0 +1,49 @@ +{ + blas, + cmake, + fetchFromGitHub, + fetchpatch, + lib, + pythonSupport ? false, + python3Packages, + stdenv, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "trlib"; + version = "0.4"; + + src = fetchFromGitHub { + owner = "felixlen"; + repo = "trlib"; + rev = finalAttrs.version; + hash = "sha256-pD2MGsIQgMO4798Gp9oLprKhmV0lcjgtUHh1rvEjSIY="; + }; + + patches = [ + # update use of distutils + # This PR was merged upstream, so the patch can be removed on next release + (fetchpatch { + name = "python312-support.patch"; + url = "https://github.com/felixlen/trlib/pull/26/commits/6b72f3b2afebee4ae179bc760f93b16c60fd72d8.patch"; + hash = "sha256-+6iiALFhMSiE44kpkDrhwrYt4miHlPkiffRZAgsM1Jo="; + }) + ]; + + nativeBuildInputs = [ cmake ]; + buildInputs = + [ blas ] + ++ lib.optionals pythonSupport [ + python3Packages.cython + python3Packages.numpy + ]; + + cmakeFlags = [ (lib.cmakeBool "TRLIB_BUILD_PYTHON3" pythonSupport) ]; + + meta = { + description = "Trust Region Subproblem Solver Library"; + homepage = "https://github.com/felixlen/trlib"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ nim65s ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index df111bfad8e22..adbe8fa74186d 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -15876,6 +15876,8 @@ self: super: with self; { tritonclient = callPackage ../development/python-modules/tritonclient { }; + trlib = toPythonModule (pkgs.trlib.override { pythonSupport = true; python3Packages = self;}); + troposphere = callPackage ../development/python-modules/troposphere { }; trove-classifiers = callPackage ../development/python-modules/trove-classifiers { }; From 2064b01da307387d0546511157dd023d3b3c0017 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Tue, 30 Jul 2024 16:54:03 +0200 Subject: [PATCH 04/14] sleqp: init at 1.0.2 --- pkgs/by-name/sl/sleqp/package.nix | 71 ++++++++++++++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 73 insertions(+) create mode 100644 pkgs/by-name/sl/sleqp/package.nix diff --git a/pkgs/by-name/sl/sleqp/package.nix b/pkgs/by-name/sl/sleqp/package.nix new file mode 100644 index 0000000000000..4ca9983ba2a70 --- /dev/null +++ b/pkgs/by-name/sl/sleqp/package.nix @@ -0,0 +1,71 @@ +{ + blas, + check, + cmake, + doxygen, + fetchFromGitHub, + highs, + lapack, + lib, + pkg-config, + pythonSupport ? false, + python3Packages, + suitesparse, + stdenv, + trlib, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "sleqp"; + version = "1.0.2"; + + src = fetchFromGitHub { + owner = "chrhansk"; + repo = "sleqp"; + rev = "v${finalAttrs.version}"; + hash = "sha256-ycO7s13LT/Gi01XFjTeZQCN+TiAVlp2zXjrlI7vfgTk="; + }; + + postPatch = '' + substituteInPlace bindings/python/cmake/python_install.cmake.in \ + --replace-fail "--no-deps" "--no-deps --no-cache-dir --no-build-isolation --prefix $out" + ''; + + nativeBuildInputs = [ + doxygen + cmake + pkg-config + ]; + buildInputs = + [ + blas + check + highs + lapack + suitesparse + trlib + ] + ++ lib.optionals pythonSupport [ + python3Packages.cython + python3Packages.numpy + python3Packages.pip + python3Packages.pytest + python3Packages.setuptools + python3Packages.scipy + python3Packages.tox + python3Packages.wheel + ]; + + cmakeFlags = [ + (lib.cmakeBool "SLEQP_ENABLE_PYTHON" pythonSupport) + "-DSLEQP_LPS=HiGHS" + ]; + + meta = { + description = "An active set-based NLP solver"; + homepage = "https://github.com/chrhansk/sleqp"; + changelog = "https://github.com/chrhansk/sleqp/blob/${finalAttrs.src.rev}/CHANGELOG.md"; + license = lib.licenses.lgpl3Only; + maintainers = with lib.maintainers; [ nim65s ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index adbe8fa74186d..0c4088511f765 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -14436,6 +14436,8 @@ self: super: with self; { sleepyq = callPackage ../development/python-modules/sleepyq { }; + sleqp = toPythonModule (pkgs.sleqp.override { pythonSupport = true; python3Packages = self; }); + slicedimage = callPackage ../development/python-modules/slicedimage { }; slicer = callPackage ../development/python-modules/slicer { }; From af6c05456c406430736eb4de5dd8c4aaac9f5c82 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Wed, 31 Jul 2024 14:38:19 +0200 Subject: [PATCH 05/14] osqp: fix cmake export ref. https://github.com/osqp/osqp/pull/481 closes https://github.com/NixOS/nixpkgs/pull/235850 --- pkgs/development/libraries/science/math/osqp/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/libraries/science/math/osqp/default.nix b/pkgs/development/libraries/science/math/osqp/default.nix index bcb1031684668..55f00d01636a2 100644 --- a/pkgs/development/libraries/science/math/osqp/default.nix +++ b/pkgs/development/libraries/science/math/osqp/default.nix @@ -15,6 +15,14 @@ stdenv.mkDerivation rec { fetchSubmodules = true; }; + # ref https://github.com/osqp/osqp/pull/481 + # but this patch does not apply directly on v0.6.3 + postPatch = '' + substituteInPlace CMakeLists.txt --replace-fail \ + "$/\''${CMAKE_INSTALL_INCLUDEDIR}" \ + "\''${CMAKE_INSTALL_FULL_INCLUDEDIR}" + ''; + nativeBuildInputs = [ cmake ]; meta = with lib; { From 640f5d612bebe755f2a69992fff7d23a8d2a8fd5 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Wed, 31 Jul 2024 22:12:23 +0200 Subject: [PATCH 06/14] blasfeo: init at 0.1.3 --- pkgs/by-name/bl/blasfeo/package.nix | 31 +++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 pkgs/by-name/bl/blasfeo/package.nix diff --git a/pkgs/by-name/bl/blasfeo/package.nix b/pkgs/by-name/bl/blasfeo/package.nix new file mode 100644 index 0000000000000..d11e9b5593099 --- /dev/null +++ b/pkgs/by-name/bl/blasfeo/package.nix @@ -0,0 +1,31 @@ +{ + cmake, + fetchFromGitHub, + lib, + stdenv, + withTarget ? "GENERIC", +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "blasfeo"; + version = "0.1.3"; + + src = fetchFromGitHub { + owner = "giaf"; + repo = "blasfeo"; + rev = finalAttrs.version; + hash = "sha256-e8InqyUMWRdL4CBHUOtrZkuabaTLiNPMNPRCnWzWkQ4="; + }; + + nativeBuildInputs = [ cmake ]; + + cmakeFlags = [ "-DTARGET=${withTarget}" ]; + + meta = { + description = "Basic linear algebra subroutines for embedded optimization"; + homepage = "https://github.com/giaf/blasfeo"; + changelog = "https://github.com/giaf/blasfeo/blob/${finalAttrs.version}/Changelog.txt"; + license = lib.licenses.bsd2; + maintainers = with lib.maintainers; [ nim65s ]; + }; +}) From f7ea2a5f25a5ecde786acfcaa747c7cb58ee1d14 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Wed, 31 Jul 2024 22:32:39 +0200 Subject: [PATCH 07/14] hpipm: init at 0.1.3 --- pkgs/by-name/hp/hpipm/package.nix | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 pkgs/by-name/hp/hpipm/package.nix diff --git a/pkgs/by-name/hp/hpipm/package.nix b/pkgs/by-name/hp/hpipm/package.nix new file mode 100644 index 0000000000000..be4cfe50f80f5 --- /dev/null +++ b/pkgs/by-name/hp/hpipm/package.nix @@ -0,0 +1,39 @@ +{ + blas, + blasfeo, + cmake, + fetchFromGitHub, + lib, + stdenv, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "hpipm"; + #version = "0.1.3"; not building, use master instead + version = "0-unstable-2024-07-30"; + + src = fetchFromGitHub { + owner = "giaf"; + repo = "hpipm"; + rev = "3ab7d6059d9d7da31ec9ff6a8ca84fd8ec5ab5e2"; + hash = "sha256-TRNHjW2/YDfGJHTG9sy2nmHyk6+HlBGIabPm87TETE8="; + }; + + nativeBuildInputs = [ cmake ]; + buildInputs = [ + blas + blasfeo + ]; + + cmakeFlags = [ + "-DBLASFEO_PATH=${blasfeo}" + ] ++ lib.optionals (!stdenv.isx86_64) [ "-DTARGET=GENERIC" ]; + + meta = { + description = "High-performance interior-point-method QP and QCQP solvers"; + homepage = "https://github.com/giaf/hpipm"; + changelog = "https://github.com/giaf/hpipm/blob/${finalAttrs.src.rev}/Changelog.txt"; + license = lib.licenses.bsd2; + maintainers = with lib.maintainers; [ nim65s ]; + }; +}) From 38f97d09b303d523098764f8b8b77f79871aeaa1 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Fri, 2 Aug 2024 16:06:46 +0200 Subject: [PATCH 08/14] fatrop: init at 0.0.1 --- pkgs/by-name/fa/fatrop/package.nix | 56 ++++++++++++++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 ++ 2 files changed, 58 insertions(+) create mode 100644 pkgs/by-name/fa/fatrop/package.nix diff --git a/pkgs/by-name/fa/fatrop/package.nix b/pkgs/by-name/fa/fatrop/package.nix new file mode 100644 index 0000000000000..e85eede1e2d92 --- /dev/null +++ b/pkgs/by-name/fa/fatrop/package.nix @@ -0,0 +1,56 @@ +{ + blasfeo, + cmake, + fetchFromGitHub, + lib, + llvmPackages, + python3Packages, + pythonSupport ? false, + stdenv, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "fatrop"; + version = "0.0.1"; + + src = fetchFromGitHub { + owner = "meco-group"; + repo = "fatrop"; + rev = "v${finalAttrs.version}"; + hash = "sha256-c4qYh8RutRsMIx3m0oxXy73fnLTBGVZ1QjFcLEJ413Y="; + }; + + postPatch = lib.optionalString pythonSupport '' + # avoid submodule + rmdir external/pybind11 + ln -s ${python3Packages.pybind11.src} external/pybind11 + + # install python module + echo "" >> fatropy/CMakeLists.txt + echo "install(DIRECTORY fatropy DESTINATION ${python3Packages.python.sitePackages})" >> fatropy/CMakeLists.txt + echo "install(TARGETS _fatropy DESTINATION ${python3Packages.python.sitePackages}/fatropy)" >> fatropy/CMakeLists.txt + ''; + + nativeBuildInputs = [ cmake ]; + buildInputs = + [ blasfeo ] + ++ lib.optionals pythonSupport [ python3Packages.pybind11 ] + ++ lib.optionals stdenv.isDarwin [ llvmPackages.openmp ]; + + cmakeFlags = [ + (lib.cmakeBool "BUILD_DOCS" true) + (lib.cmakeBool "ENABLE_MULTITHREADING" true) + (lib.cmakeBool "BUILD_WITH_BLASFEO" false) + (lib.cmakeBool "WITH_PYTHON" pythonSupport) + (lib.cmakeBool "WITH_SPECTOOL" false) # this depends on casadi + ]; + + doCheck = true; + + meta = { + description = "nonlinear optimal control problem solver that aims to be fast, support a broad class of optimal control problems and achieve a high numerical robustness"; + homepage = "https://github.com/meco-group/fatrop"; + license = lib.licenses.lgpl3Only; + maintainers = with lib.maintainers; [ nim65s ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 0c4088511f765..b552c507334f2 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4266,6 +4266,8 @@ self: super: with self; { fasttext-predict = callPackage ../development/python-modules/fasttext-predict { }; + fatrop = toPythonModule (pkgs.fatrop.override { pythonSupport = true; python3Packages = self; }); + faust-cchardet = callPackage ../development/python-modules/faust-cchardet { }; favicon = callPackage ../development/python-modules/favicon { }; From 7788dbb2e53677e9f4029960d909108b3dcc007a Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Fri, 2 Aug 2024 17:03:42 +0200 Subject: [PATCH 09/14] scotch: also install libesmumps for mumps while here, update packaging to CMake, and build on darwin --- pkgs/by-name/sc/scotch/package.nix | 39 +++++++++++++++--------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/pkgs/by-name/sc/scotch/package.nix b/pkgs/by-name/sc/scotch/package.nix index a76eb47c014f2..8455b4d22648f 100644 --- a/pkgs/by-name/sc/scotch/package.nix +++ b/pkgs/by-name/sc/scotch/package.nix @@ -1,24 +1,21 @@ { - lib, - stdenv, - fetchFromGitLab, bison, - mpi, + bzip2, + cmake, + fetchFromGitLab, flex, + gfortran, + lib, + mpi, + stdenv, zlib, + xz, }: stdenv.mkDerivation (finalAttrs: { pname = "scotch"; version = "7.0.4"; - buildInputs = [ - bison - mpi - flex - zlib - ]; - src = fetchFromGitLab { domain = "gitlab.inria.fr"; owner = "scotch"; @@ -27,14 +24,19 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-uaox4Q9pTF1r2BZjvnU2LE6XkZw3x9mGSKLdRVUobGU="; }; - preConfigure = '' - cd src - ln -s Make.inc/Makefile.inc.x86-64_pc_linux2 Makefile.inc - ''; - - buildFlags = [ "scotch ptscotch" ]; + nativeBuildInputs = [ + cmake + gfortran + ]; - installFlags = [ "prefix=\${out}" ]; + buildInputs = [ + bison + bzip2 + mpi + flex + xz + zlib + ]; meta = { description = "Graph and mesh/hypergraph partitioning, graph clustering, and sparse matrix ordering"; @@ -45,6 +47,5 @@ stdenv.mkDerivation (finalAttrs: { homepage = "http://www.labri.fr/perso/pelegrin/scotch"; license = lib.licenses.cecill-c; maintainers = [ lib.maintainers.bzizou ]; - platforms = lib.platforms.linux; }; }) From 05fb9b070f5eede965f8b6e867a7ace0eef824ad Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Fri, 2 Aug 2024 17:03:23 +0200 Subject: [PATCH 10/14] mumps: init at 5.7.3 --- pkgs/by-name/mu/mumps/package.nix | 77 +++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 pkgs/by-name/mu/mumps/package.nix diff --git a/pkgs/by-name/mu/mumps/package.nix b/pkgs/by-name/mu/mumps/package.nix new file mode 100644 index 0000000000000..978ee246084ac --- /dev/null +++ b/pkgs/by-name/mu/mumps/package.nix @@ -0,0 +1,77 @@ +{ + blas, + fetchzip, + fetchpatch, + gfortran, + lapack, + lib, + metis, + scotch, + stdenv, +}: +stdenv.mkDerivation (finalAttrs: { + name = "mumps"; + version = "5.7.3"; + + src = fetchzip { + url = "https://mumps-solver.org/MUMPS_${finalAttrs.version}.tar.gz"; + hash = "sha256-ZnIfAuvOBJDYqCtKGlWs0r39nG6X2lAVRuUmeIJenZw="; + }; + + patches = [ + # Compatibility with coin-or-mumps version + (fetchpatch { + url = "https://raw.githubusercontent.com/coin-or-tools/ThirdParty-Mumps/bd0bdf9baa3f3677bd34fb36ce63b2b32cc6cc7d/mumps_mpi.patch"; + hash = "sha256-70qZUKBVBpJOSRxYxng5Y6ct1fdCUQUGur3chDhGabQ="; + }) + ]; + + postPatch = '' + # Compatibility with coin-or-mumps version + # https://github.com/coin-or-tools/ThirdParty-Mumps/blob/stable/3.0/get.Mumps#L66 + cp libseq/mpi.h libseq/mumps_mpi.h + ''; + + configurePhase = '' + cp Make.inc/Makefile.debian.SEQ ./Makefile.inc + ''; + + makeFlags = + lib.optionals stdenv.isDarwin [ + "SONAME=" + "LIBEXT_SHARED=.dylib" + ] + ++ [ + "LSCOTCHDIR=${scotch}/lib" + "ISCOTCH=-I${scotch}/include" + "LMETISDIR=${metis}/lib" + "IMETIS=-I${metis}/include" + "allshared" + ]; + + installPhase = '' + mkdir $out + cp -r include lib $out + + # Add some compatibility with coin-or-mumps + ln -s $out/include $out/include/mumps + cp libseq/mumps_mpi.h $out/include + ''; + + nativeBuildInputs = [ gfortran ]; + + buildInputs = [ + blas + lapack + metis + scotch + ]; + + meta = { + description = "MUltifrontal Massively Parallel sparse direct Solver"; + homepage = "http://mumps-solver.org/"; + license = lib.licenses.cecill-c; + maintainers = with lib.maintainers; [ nim65s ]; + broken = stdenv.isDarwin; + }; +}) From e006f8483ebec4170f15431df4fcb2d04970efc3 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Tue, 6 Aug 2024 01:38:41 +0200 Subject: [PATCH 11/14] spral: init at 2024.05.08 --- pkgs/by-name/sp/spral/package.nix | 65 +++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 pkgs/by-name/sp/spral/package.nix diff --git a/pkgs/by-name/sp/spral/package.nix b/pkgs/by-name/sp/spral/package.nix new file mode 100644 index 0000000000000..720f0137338bd --- /dev/null +++ b/pkgs/by-name/sp/spral/package.nix @@ -0,0 +1,65 @@ +{ + blas, + fetchFromGitHub, + gfortran, + lapack, + lib, + llvmPackages, + meson, + metis, + ninja, + stdenv, +}: + +stdenv.mkDerivation rec { + pname = "spral"; + version = "2024.05.08"; + + src = fetchFromGitHub { + owner = "ralna"; + repo = "spral"; + rev = "v${version}"; + hash = "sha256-1CdRwQ0LQrYcXvoGtGxR9Ug3Q2N4skXq8z+LdNpv8p4="; + }; + + postPatch = + '' + # Skipped test: ssidst + # hwloc/linux: failed to find sysfs cpu topology directory, aborting linux discovery. + substituteInPlace tests/meson.build --replace-fail \ + "subdir('ssids')" \ + "" + '' + + lib.optionalString stdenv.isDarwin '' + # Skipped test: lsmrt, segfault + substituteInPlace tests/meson.build --replace-fail \ + "['lsmrt', files('lsmr.f90')]," \ + "" + ''; + + nativeBuildInputs = [ + gfortran + meson + ninja + ]; + + buildInputs = [ + blas + lapack + metis + ] ++ lib.optionals stdenv.isDarwin [ llvmPackages.openmp ]; + + mesonFlags = [ (lib.mesonBool "tests" true) ]; + + LDFLAGS = lib.optionals stdenv.isDarwin [ "-lomp" ]; + + doCheck = true; + + meta = { + description = "Sparse Parallel Robust Algorithms Library"; + homepage = "https://github.com/ralna/spral"; + changelog = "https://github.com/ralna/spral/blob/${src.rev}/ChangeLog"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ nim65s ]; + }; +} From 7c9c23c5970ff42028195b70a58ba79168df6514 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Tue, 30 Jul 2024 16:25:31 +0200 Subject: [PATCH 12/14] casadi: init at 3.6.5 --- pkgs/by-name/ca/casadi/package.nix | 205 +++++++++++++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 207 insertions(+) create mode 100644 pkgs/by-name/ca/casadi/package.nix diff --git a/pkgs/by-name/ca/casadi/package.nix b/pkgs/by-name/ca/casadi/package.nix new file mode 100644 index 0000000000000..b29f6aad0cf36 --- /dev/null +++ b/pkgs/by-name/ca/casadi/package.nix @@ -0,0 +1,205 @@ +{ + #alpaqa, + blas, + blasfeo, + bonmin, + bzip2, + cbc, + clp, + cmake, + cplex, + fatrop, + fetchFromGitHub, + fetchpatch, + gurobi, + highs, + hpipm, + lib, + ipopt, + lapack, + llvmPackages_17, # llvm/Support/Host.h required by casadi 3.6.5 and not available in llvm 18 + mumps, + osqp, + pkg-config, + pythonSupport ? false, + python3Packages, + proxsuite, + stdenv, + sleqp, + suitesparse, + #sundials, + superscs, + spral, + swig, + tinyxml-2, + withUnfree ? false, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "casadi"; + version = "3.6.6"; + + src = fetchFromGitHub { + owner = "casadi"; + repo = "casadi"; + rev = finalAttrs.version; + hash = "sha256-T4aaBS918NbUEwWkSx0URi0W9uhCB8IFmzRcOR7T8Og="; + }; + + patches = [ + (fetchpatch { + name = "add-FindSPRAL.cmake.patch"; + url = "https://github.com/casadi/casadi/pull/3792/commits/28bc1b03e67ae06dea0c8557057020f5651be7ad.patch"; + hash = "sha256-t0+RnXoFakmoX93MhN08RWAbCg6Nerh42LicBBgAkRQ="; + }) + ]; + + postPatch = + '' + # fix case of fatropConfig.cmake & hpipmConfig.cmake + substituteInPlace CMakeLists.txt --replace-fail \ + "FATROP HPIPM" \ + "fatrop hpipm" + + # nix provide lib/clang headers in libclang, not in llvm. + substituteInPlace casadi/interfaces/clang/CMakeLists.txt --replace-fail \ + '$'{CLANG_LLVM_LIB_DIR} \ + ${llvmPackages_17.libclang.lib}/lib + + # fix fatrop includes + substituteInPlace casadi/interfaces/fatrop/fatrop_conic_interface.hpp --replace-fail \ + " search_paths;" \ + "std::vector search_paths; + search_paths.push_back(\"$out/lib\");" + '' + + lib.optionalString pythonSupport '' + # fix including Python.h issue + substituteInPlace swig/python/CMakeLists.txt --replace-fail \ + "add_library(_casadi MODULE \''${PYTHON_FILE})" \ + "add_library(_casadi MODULE \''${PYTHON_FILE}) + target_include_directories(_casadi SYSTEM PRIVATE + ${python3Packages.python}/include/python3.${python3Packages.python.sourceVersion.minor})" + + # I have no clue. without this, it tries to install a non existent file. + # maybe a run without SWIG_IMPORT is required before a run with SWIG_IMPORT. + # but we need SWIG_IMPORT at some point for something else TODO + substituteInPlace swig/python/CMakeLists.txt --replace-fail \ + "if (SWIG_IMPORT)" \ + "if (NOT SWIG_IMPORT)" + ''; + + nativeBuildInputs = [ + cmake + pkg-config + ]; + + buildInputs = + [ + #alpaqa + blas + blasfeo + bzip2 + bonmin + cbc + clp + fatrop + highs + hpipm + ipopt + lapack + llvmPackages_17.clang + llvmPackages_17.libclang + llvmPackages_17.llvm + mumps + osqp + proxsuite + sleqp + suitesparse + #sundials + superscs + spral + swig + tinyxml-2 + ] + ++ lib.optionals withUnfree [ + cplex + gurobi + ] + ++ lib.optionals pythonSupport [ + python3Packages.numpy + python3Packages.python + ]; + + cmakeFlags = [ + (lib.cmakeBool "WITH_PYTHON" pythonSupport) + (lib.cmakeBool "WITH_PYTHON3" pythonSupport) + (lib.cmakeBool "WITH_JSON" false) + (lib.cmakeBool "WITH_INSTALL_INTERNAL_HEADERS" true) + (lib.cmakeBool "INSTALL_INTERNAL_HEADERS" true) + (lib.cmakeBool "ENABLE_EXPORT_ALL" true) + (lib.cmakeBool "SWIG_EXPORT" true) + (lib.cmakeBool "SWIG_IMPORT" false) + (lib.cmakeBool "WITH_OPENMP" true) + (lib.cmakeBool "WITH_THREAD" true) + (lib.cmakeBool "WITH_OPENCL" false) + (lib.cmakeBool "WITH_BUILD_SUNDIALS" true) # ref. https://github.com/casadi/casadi/issues/2125 + (lib.cmakeBool "WITH_SUNDIALS" true) + (lib.cmakeBool "WITH_BUILD_CSPARSE" false) + (lib.cmakeBool "WITH_CSPARSE" true) + (lib.cmakeBool "WITH_BLASFEO" true) + (lib.cmakeBool "WITH_HPIPM" true) + (lib.cmakeBool "WITH_FATROP" false) # invalid new-expression of abstract class type 'casadi::CasadiStructuredQP' + (lib.cmakeBool "WITH_BUILD_FATROP" false) + (lib.cmakeBool "WITH_SUPERSCS" false) # packaging too chaotic + (lib.cmakeBool "WITH_BUILD_OSQP" false) + (lib.cmakeBool "WITH_OSQP" true) + (lib.cmakeBool "WITH_PROXQP" true) + (lib.cmakeBool "WITH_BUILD_TINYXML" false) + (lib.cmakeBool "WITH_TINYXML" true) + (lib.cmakeBool "WITH_BUILD_DSDP" true) # not sure where this come from + (lib.cmakeBool "WITH_DSDP" true) + (lib.cmakeBool "WITH_CLANG" true) + (lib.cmakeBool "WITH_LAPACK" true) + (lib.cmakeBool "WITH_QPOASES" true) + (lib.cmakeBool "WITH_BLOCKSQP" true) + (lib.cmakeBool "WITH_SLEQP" true) + (lib.cmakeBool "WITH_IPOPT" true) + (lib.cmakeBool "WITH_KNITRO" withUnfree) + (lib.cmakeBool "WITH_SNOPT" withUnfree) + (lib.cmakeBool "WITH_WORHP" withUnfree) + (lib.cmakeBool "WITH_CPLEX" withUnfree) + (lib.cmakeBool "WITH_GUROBI" withUnfree) + (lib.cmakeBool "WITH_BONMIN" true) + (lib.cmakeBool "WITH_CBC" true) + (lib.cmakeBool "WITH_CLP" true) + (lib.cmakeBool "WITH_MUMPS" true) + (lib.cmakeBool "WITH_SPRAL" true) + (lib.cmakeBool "WITH_HSL" withUnfree) + (lib.cmakeBool "WITH_HIGHS" true) + #(lib.cmakeBool "WITH_ALPAQA" true) # this requires casadi... + ]; + + # I don't know how to pass absolute $out path from cmakeFlags + postConfigure = lib.optionalString pythonSupport '' + cmake -DPYTHON_PREFIX=$out/${python3Packages.python.sitePackages} .. + ''; + + doCheck = true; + + meta = { + description = "CasADi is a symbolic framework for numeric optimization implementing automatic differentiation in forward and reverse modes on sparse matrix-valued computational graphs. It supports self-contained C-code generation and interfaces state-of-the-art codes such as SUNDIALS, IPOPT etc. It can be used from C++, Python or Matlab/Octave"; + homepage = "https://github.com/casadi/casadi"; + license = lib.licenses.lgpl3Only; + maintainers = with lib.maintainers; [ nim65s ]; + }; +}) diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index b552c507334f2..7010d1d8a4102 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1994,6 +1994,8 @@ self: super: with self; { casa-formats-io = callPackage ../development/python-modules/casa-formats-io { }; + casadi = toPythonModule (pkgs.casadi.override { pythonSupport = true; python3Packages = self; }); + casbin = callPackage ../development/python-modules/casbin { }; cashaddress = callPackage ../development/python-modules/cashaddress { }; From 73f6b8ac942f8caa72f81142c57bc256227ffe42 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Tue, 6 Aug 2024 16:42:47 +0200 Subject: [PATCH 13/14] pinocchio: add casadiSupport --- pkgs/development/libraries/pinocchio/default.nix | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/pinocchio/default.nix b/pkgs/development/libraries/pinocchio/default.nix index 347d8b4b2856c..d922a7b3ce4dc 100644 --- a/pkgs/development/libraries/pinocchio/default.nix +++ b/pkgs/development/libraries/pinocchio/default.nix @@ -2,10 +2,12 @@ , stdenv , fetchFromGitHub , fetchpatch +, casadi , cmake , boost , eigen , example-robot-data +, casadiSupport ? !stdenv.isDarwin , collisionSupport ? true , console-bridge , jrl-cmakemodules @@ -41,11 +43,14 @@ stdenv.mkDerivation (finalAttrs: { }) ]; - # example-robot-data models are used in checks. - # Upstream provide them as git submodule, but we can use our own version instead. postPatch = '' + # example-robot-data models are used in checks. + # Upstream provide them as git submodule, but we can use our own version instead. rmdir models/example-robot-data ln -s ${example-robot-data.src} models/example-robot-data + + # allow package:// uri use in examples + export ROS_PACKAGE_PATH=${example-robot-data}/share ''; # CMAKE_BUILD_TYPE defaults to Release in this package, @@ -75,11 +80,18 @@ stdenv.mkDerivation (finalAttrs: { python3Packages.eigenpy ] ++ lib.optionals (pythonSupport && collisionSupport) [ python3Packages.hpp-fcl + ] ++ lib.optionals (!pythonSupport && casadiSupport) [ + casadi + ] ++ lib.optionals (pythonSupport && casadiSupport) [ + python3Packages.casadi ]; + checkInputs = lib.optionals (pythonSupport && casadiSupport) [ python3Packages.matplotlib ]; + cmakeFlags = [ (lib.cmakeBool "BUILD_PYTHON_INTERFACE" pythonSupport) (lib.cmakeBool "BUILD_WITH_LIBPYTHON" pythonSupport) + (lib.cmakeBool "BUILD_WITH_CASADI_SUPPORT" casadiSupport) (lib.cmakeBool "BUILD_WITH_COLLISION_SUPPORT" collisionSupport) ]; From 5cdcd1a2051bb0013cc3e1e8f2bac4f7493f8235 Mon Sep 17 00:00:00 2001 From: Guilhem Saurel Date: Tue, 6 Aug 2024 15:17:24 +0200 Subject: [PATCH 14/14] ipopt: enable mumps & spral --- .../libraries/science/math/ipopt/default.nix | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/science/math/ipopt/default.nix b/pkgs/development/libraries/science/math/ipopt/default.nix index ac04711ff71f8..22879067a9246 100644 --- a/pkgs/development/libraries/science/math/ipopt/default.nix +++ b/pkgs/development/libraries/science/math/ipopt/default.nix @@ -6,6 +6,8 @@ , lapack , gfortran , enableAMPL ? true, libamplsolver +, enableMUMPS ? !stdenv.isDarwin, mumps, mpi +, enableSPRAL ? true, spral }: assert (!blas.isILP64) && (!lapack.isILP64); @@ -23,21 +25,30 @@ stdenv.mkDerivation rec { CXXDEFS = [ "-DHAVE_RAND" "-DHAVE_CSTRING" "-DHAVE_CSTDIO" ]; - configureFlags = [ + configureFlags = lib.optionals enableAMPL [ "--with-asl-cflags=-I${libamplsolver}/include" "--with-asl-lflags=-lamplsolver" + ] ++ lib.optionals enableMUMPS [ + "--with-mumps-cflags=-I${mumps}/include" + "--with-mumps-lflags=-ldmumps" + ] ++ lib.optionals enableSPRAL [ + "--with-spral-cflags=-I${spral}/include" + "--with-spral-lflags=-lspral" ]; nativeBuildInputs = [ pkg-config gfortran ]; - buildInputs = [ blas lapack ] ++ lib.optionals enableAMPL [ libamplsolver ]; + buildInputs = [ blas lapack ] + ++ lib.optionals enableAMPL [ libamplsolver ] + ++ lib.optionals enableMUMPS [ mumps mpi ] + ++ lib.optionals enableSPRAL [ spral ]; enableParallelBuilding = true; - meta = with lib; { + meta = { description = "Software package for large-scale nonlinear optimization"; homepage = "https://projects.coin-or.org/Ipopt"; - license = licenses.epl10; - platforms = platforms.unix; - maintainers = with maintainers; [ abbradar ]; + license = lib.licenses.epl10; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ abbradar ]; }; }