about summary refs log tree commit diff
path: root/pkgs/by-name/op/openturns/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/op/openturns/package.nix')
-rw-r--r--pkgs/by-name/op/openturns/package.nix98
1 files changed, 98 insertions, 0 deletions
diff --git a/pkgs/by-name/op/openturns/package.nix b/pkgs/by-name/op/openturns/package.nix
new file mode 100644
index 0000000000000..e6f3fb3a5ff7f
--- /dev/null
+++ b/pkgs/by-name/op/openturns/package.nix
@@ -0,0 +1,98 @@
+{
+  lib,
+  boost,
+  ceres-solver,
+  cmake,
+  cminpack,
+  darwin,
+  dlib,
+  fetchFromGitHub,
+  hdf5,
+  hmat-oss,
+  ipopt,
+  libxml2,
+  nlopt,
+  pagmo2,
+  primesieve,
+  python3Packages,
+  spectra,
+  stdenv,
+  swig,
+  tbb,
+  # Boolean flags
+  runTests ? false, # tests take an hour to build on a 48-core machine
+  enablePython ? false,
+}:
+
+let
+  inherit (darwin.apple_sdk.frameworks) Accelerate;
+in
+stdenv.mkDerivation (finalAttrs: {
+  pname = "openturns";
+  version = "1.22";
+
+  src = fetchFromGitHub {
+    owner = "openturns";
+    repo = "openturns";
+    rev = "v${finalAttrs.version}";
+    hash = "sha256-ku3/mPoa1YJVJB99R/kWlOubIO+OZAiKfPqS/DrtJQk=";
+  };
+
+  nativeBuildInputs = [
+    cmake
+  ]
+  ++ lib.optionals enablePython [ python3Packages.sphinx ];
+
+  buildInputs = [
+    (lib.getLib primesieve)
+    boost
+    ceres-solver
+    cminpack
+    dlib
+    hdf5
+    hmat-oss
+    ipopt
+    libxml2
+    nlopt
+    pagmo2
+    spectra
+    swig
+    tbb
+  ]
+  ++ lib.optionals enablePython [
+    python3Packages.dill
+    python3Packages.matplotlib
+    python3Packages.psutil
+    python3Packages.python
+  ]
+  ++ lib.optionals stdenv.isDarwin [
+    Accelerate
+  ];
+
+  cmakeFlags = [
+    (lib.cmakeBool "BUILD_PYTHON" enablePython)
+    (lib.cmakeBool "CMAKE_UNITY_BUILD" true)
+    (lib.cmakeBool "USE_SPHINX" enablePython)
+    (lib.cmakeFeature "CMAKE_UNITY_BUILD_BATCH_SIZE" "32")
+    (lib.cmakeFeature "SWIG_COMPILE_FLAGS" "-O1")
+    (lib.cmakeOptionType "PATH" "OPENTURNS_SYSCONFIG_PATH" "$out/etc")
+  ];
+
+  checkTarget = lib.concatStringsSep " " [
+    "tests"
+    "check"
+  ];
+
+  strictDeps = true;
+
+  doCheck = runTests;
+
+  meta = {
+    homepage = "https://openturns.github.io/www/";
+    description = "Multivariate probabilistic modeling and uncertainty treatment library";
+    changelog = "https://github.com/openturns/openturns/raw/v${finalAttrs.version}/ChangeLog";
+    license = with lib.licenses; [ lgpl3Plus gpl3Plus ];
+    maintainers = with lib.maintainers; [ gdinh ];
+    platforms = lib.platforms.unix;
+  };
+})