about summary refs log tree commit diff
path: root/pkgs/development/python-modules/rdkit/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/rdkit/default.nix')
-rw-r--r--pkgs/development/python-modules/rdkit/default.nix140
1 files changed, 68 insertions, 72 deletions
diff --git a/pkgs/development/python-modules/rdkit/default.nix b/pkgs/development/python-modules/rdkit/default.nix
index 2d5af44a068d..ec98f19c271f 100644
--- a/pkgs/development/python-modules/rdkit/default.nix
+++ b/pkgs/development/python-modules/rdkit/default.nix
@@ -1,22 +1,23 @@
-{ lib
-, stdenv
-, buildPythonPackage
-, fetchFromGitHub
-, cmake
-, comic-neue
-, boost
-, catch2_3
-, inchi
-, cairo
-, eigen
-, python
-, rapidjson
-, maeparser
-, coordgenlibs
-, numpy
-, pandas
-, pillow
-, memorymappingHook
+{
+  lib,
+  stdenv,
+  buildPythonPackage,
+  fetchFromGitHub,
+  cmake,
+  comic-neue,
+  boost,
+  catch2_3,
+  inchi,
+  cairo,
+  eigen,
+  python,
+  rapidjson,
+  maeparser,
+  coordgenlibs,
+  numpy,
+  pandas,
+  pillow,
+  memorymappingHook,
 }:
 let
   external = {
@@ -29,8 +30,8 @@ let
     yaehmop = fetchFromGitHub {
       owner = "greglandrum";
       repo = "yaehmop";
-      rev = "v2023.03.1";
-      hash = "sha256-K9//cDN69U4sLETfIZq9NUaBE3RXOReH53qfiCzutqM=";
+      rev = "v2024.03.1";
+      hash = "sha256-rhR7Ev+9Fk/Ks7R2x2SjWu1L/48a4zHDHUBohx1Dw/M=";
     };
     freesasa = fetchFromGitHub {
       owner = "mittinatten";
@@ -38,11 +39,18 @@ let
       rev = "2.0.3";
       hash = "sha256-7E+imvfDAJFnXQRWb5hNaSu+Xrf9NXeIKc9fl+o3yHQ=";
     };
+    pubchem-align3d = fetchFromGitHub {
+      owner = "ncbi";
+      repo = "pubchem-align3d";
+      rev = "daefab3dd0c90ca56da9d3d5e375fe4d651e6be3";
+      hash = "sha256-tQB4wqza9rlSoy4Uj9bA99ddawjxGyN9G7DYbcv/Qdo=";
+    };
   };
+  boost' = boost.override { enableNumpy = true; };
 in
 buildPythonPackage rec {
   pname = "rdkit";
-  version = "2023.09.5";
+  version = "2024.09.1";
   pyproject = false;
 
   src =
@@ -50,10 +58,10 @@ buildPythonPackage rec {
       versionTag = lib.replaceStrings [ "." ] [ "_" ] version;
     in
     fetchFromGitHub {
-      owner = pname;
-      repo = pname;
+      owner = "rdkit";
+      repo = "rdkit";
       rev = "Release_${versionTag}";
-      hash = "sha256-ZYNAHNBHQPx8rBJSvEWFEpdSpYyXcoqJ+nBA7tpHwQs=";
+      hash = "sha256-UsyPlAJ8FISblF8szEmRqWansunIhW/gbEBZx13YM+A=";
     };
 
   unpackPhase = ''
@@ -73,23 +81,24 @@ buildPythonPackage rec {
     chmod +w External/FreeSASA/freesasa/src
     cp External/FreeSASA/freesasa2.c External/FreeSASA/freesasa/src
 
+    ln -s ${external.pubchem-align3d} External/pubchem_shape/pubchem-align3d
     ln -s ${rapidjson} External/rapidjson-1.1.0
     ln -s ${comic-neue}/share/fonts/truetype/ComicNeue-Regular.ttf Data/Fonts/
   '';
 
-  nativeBuildInputs = [
-    cmake
-  ];
+  nativeBuildInputs = [ cmake ];
 
   buildInputs = [
-    boost
+    boost'
     cairo
     catch2_3
-  ] ++ lib.optionals (stdenv.system == "x86_64-darwin") [
-    memorymappingHook
-  ];
+    coordgenlibs
+    eigen
+    inchi
+    maeparser
+  ] ++ lib.optionals (stdenv.system == "x86_64-darwin") [ memorymappingHook ];
 
-  propagatedBuildInputs = [
+  dependencies = [
     numpy
     pandas
     pillow
@@ -97,45 +106,29 @@ buildPythonPackage rec {
 
   hardeningDisable = [ "format" ]; # required by yaehmop
 
-  dontUseSetuptoolsBuild = true;
-  dontUsePipInstall = true;
-  dontUseSetuptoolsCheck = true;
-
-  preConfigure = ''
-    # Since we can't expand with bash in cmakeFlags
-    cmakeFlags="$cmakeFlags -DPYTHON_NUMPY_INCLUDE_PATH=$(${python}/bin/python -c 'import numpy; print(numpy.get_include())')"
-    cmakeFlags="$cmakeFlags -DFREESASA_DIR=$PWD/External/FreeSASA/freesasa"
-    cmakeFlags="$cmakeFlags -DFREESASA_SRC_DIR=$PWD/External/FreeSASA/freesasa"
-    cmakeFlags="$cmakeFlags -DAVALONTOOLS_DIR=$PWD/External/AvalonTools/avalon"
-  '';
-
   cmakeFlags = [
-    "-DINCHI_LIBRARY=${inchi}/lib/libinchi.so"
-    "-DINCHI_LIBRARIES=${inchi}/lib/libinchi.so"
-    "-DINCHI_INCLUDE_DIR=${inchi}/include/inchi"
-    "-DEIGEN3_INCLUDE_DIR=${eigen}/include/eigen3"
-    "-DRDK_INSTALL_INTREE=OFF"
-    "-DRDK_INSTALL_STATIC_LIBS=OFF"
-    "-DRDK_BUILD_INCHI_SUPPORT=ON"
-    "-DRDK_BUILD_AVALON_SUPPORT=ON"
-    "-DRDK_BUILD_FREESASA_SUPPORT=ON"
-    "-DRDK_BUILD_YAEHMOP_SUPPORT=ON"
-    "-DRDK_BUILD_MAEPARSER_SUPPORT=ON"
-    "-DMAEPARSER_DIR=${maeparser}"
-    "-DRDK_BUILD_COORDGEN_SUPPORT=ON"
-    "-DCOORDGEN_DIR=${coordgenlibs}"
-    "-DRDK_USE_URF=OFF"
-    "-DRDK_USE_FLEXBISON=OFF"
-    "-DRDK_BUILD_CAIRO_SUPPORT=ON"
-    "-DRDK_BUILD_THREADSAFE_SSS=ON"
-    "-DRDK_TEST_MULTITHREADED=ON"
-    "-DRDK_BUILD_CPP_TESTS=ON"
-    "-DRDK_TEST_MULTITHREADED=ON"
-    "-DPYTHON_EXECUTABLE=${python}/bin/python"
-    "-DBOOST_ROOT=${boost}"
-    "-DBoost_NO_SYSTEM_PATHS=ON"
-    "-DBoost_NO_BOOST_CMAKE=TRUE"
-    "-DCMAKE_SKIP_BUILD_RPATH=ON" # fails to find libs in pythonImportsCheckPhase otherwise
+    (lib.cmakeBool "Boost_NO_BOOST_CMAKE" true)
+    (lib.cmakeBool "Boost_NO_SYSTEM_PATHS" true)
+    (lib.cmakeBool "CMAKE_SKIP_BUILD_RPATH" true) # fails to find libs in pythonImportsCheckPhase otherwise
+    (lib.cmakeBool "RDK_BUILD_AVALON_SUPPORT" true)
+    (lib.cmakeBool "RDK_BUILD_CAIRO_SUPPORT" true)
+    (lib.cmakeBool "RDK_BUILD_COORDGEN_SUPPORT" true)
+    (lib.cmakeBool "RDK_BUILD_CPP_TESTS" true)
+    (lib.cmakeBool "RDK_BUILD_FREESASA_SUPPORT" true)
+    (lib.cmakeBool "RDK_BUILD_INCHI_SUPPORT" true)
+    (lib.cmakeBool "RDK_BUILD_MAEPARSER_SUPPORT" true)
+    (lib.cmakeBool "RDK_BUILD_THREADSAFE_SSS" true)
+    (lib.cmakeBool "RDK_BUILD_YAEHMOP_SUPPORT" true)
+    (lib.cmakeBool "RDK_INSTALL_INTREE" false)
+    (lib.cmakeBool "RDK_INSTALL_STATIC_LIBS" false)
+    (lib.cmakeBool "RDK_TEST_MULTITHREADED" true)
+    (lib.cmakeBool "RDK_TEST_MULTITHREADED" true)
+    (lib.cmakeBool "RDK_USE_FLEXBISON" false)
+    (lib.cmakeBool "RDK_USE_URF" false)
+    (lib.cmakeFeature "AVALONTOOLS_DIR" "avalon")
+    (lib.cmakeFeature "FREESASA_SRC_DIR" "freesasa")
+    (lib.cmakeFeature "INCHI_INCLUDE_DIR" "${inchi}/include/inchi")
+    (lib.cmakeFeature "PUBCHEMSHAPE_DIR" "External/pubchem_shape/pubchem-align3d")
   ];
 
   checkPhase = ''
@@ -153,7 +146,10 @@ buildPythonPackage rec {
 
   meta = with lib; {
     description = "Open source toolkit for cheminformatics";
-    maintainers = with maintainers; [ rmcgibbo natsukium ];
+    maintainers = with maintainers; [
+      rmcgibbo
+      natsukium
+    ];
     license = licenses.bsd3;
     homepage = "https://www.rdkit.org";
     changelog = "https://github.com/rdkit/rdkit/releases/tag/${src.rev}";