2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2023-05-24 13:37:59 +00:00
|
|
|
, stdenv
|
2021-02-05 17:12:51 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
2022-12-02 08:20:57 +00:00
|
|
|
, comic-neue
|
2021-02-05 17:12:51 +00:00
|
|
|
, boost
|
2024-01-02 11:29:13 +00:00
|
|
|
, catch2_3
|
2021-02-05 17:12:51 +00:00
|
|
|
, inchi
|
|
|
|
, cairo
|
|
|
|
, eigen
|
|
|
|
, python
|
|
|
|
, rapidjson
|
|
|
|
, maeparser
|
|
|
|
, coordgenlibs
|
|
|
|
, numpy
|
|
|
|
, pandas
|
|
|
|
, pillow
|
2023-05-24 13:37:59 +00:00
|
|
|
, memorymappingHook
|
2021-02-05 17:12:51 +00:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
external = {
|
2022-12-02 08:20:57 +00:00
|
|
|
avalon = fetchFromGitHub {
|
2023-10-19 13:55:26 +00:00
|
|
|
owner = "rdkit";
|
2022-12-02 08:20:57 +00:00
|
|
|
repo = "ava-formake";
|
2023-10-19 13:55:26 +00:00
|
|
|
rev = "AvalonToolkit_2.0.5-pre.3";
|
|
|
|
hash = "sha256-2MuFZgRIHXnkV7Nc1da4fa7wDx57VHUtwLthrmjk+5o=";
|
2021-02-05 17:12:51 +00:00
|
|
|
};
|
|
|
|
yaehmop = fetchFromGitHub {
|
|
|
|
owner = "greglandrum";
|
|
|
|
repo = "yaehmop";
|
2023-10-19 13:55:26 +00:00
|
|
|
rev = "v2023.03.1";
|
|
|
|
hash = "sha256-K9//cDN69U4sLETfIZq9NUaBE3RXOReH53qfiCzutqM=";
|
2022-06-16 17:23:12 +00:00
|
|
|
};
|
|
|
|
freesasa = fetchFromGitHub {
|
|
|
|
owner = "mittinatten";
|
|
|
|
repo = "freesasa";
|
2022-12-02 08:20:57 +00:00
|
|
|
rev = "2.0.3";
|
|
|
|
hash = "sha256-7E+imvfDAJFnXQRWb5hNaSu+Xrf9NXeIKc9fl+o3yHQ=";
|
2021-02-05 17:12:51 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
in
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "rdkit";
|
2024-02-07 01:22:34 +00:00
|
|
|
version = "2023.09.4";
|
2024-01-02 11:29:13 +00:00
|
|
|
pyproject = false;
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
src =
|
|
|
|
let
|
|
|
|
versionTag = lib.replaceStrings [ "." ] [ "_" ] version;
|
|
|
|
in
|
|
|
|
fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = "Release_${versionTag}";
|
2024-02-07 01:22:34 +00:00
|
|
|
hash = "sha256-yPpt7F3w17tZEe+HECODZ7p27QidNt1sd5f/T2V87NE=";
|
2021-02-05 17:12:51 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
unpackPhase = ''
|
2022-12-02 08:20:57 +00:00
|
|
|
cp -r $src/* .
|
|
|
|
find . -type d -exec chmod +w {} +
|
|
|
|
|
|
|
|
mkdir External/AvalonTools/avalon
|
2023-04-29 16:46:19 +00:00
|
|
|
# In buildPhase, CMake patches the file in this directory
|
|
|
|
# see https://github.com/rdkit/rdkit/pull/5928
|
|
|
|
cp -r ${external.avalon}/* External/AvalonTools/avalon
|
2022-12-02 08:20:57 +00:00
|
|
|
|
|
|
|
mkdir External/YAeHMOP/yaehmop
|
|
|
|
ln -s ${external.yaehmop}/* External/YAeHMOP/yaehmop
|
2021-02-05 17:12:51 +00:00
|
|
|
|
2022-12-02 08:20:57 +00:00
|
|
|
mkdir -p External/FreeSASA/freesasa
|
|
|
|
cp -r ${external.freesasa}/* External/FreeSASA/freesasa
|
|
|
|
chmod +w External/FreeSASA/freesasa/src
|
|
|
|
cp External/FreeSASA/freesasa2.c External/FreeSASA/freesasa/src
|
|
|
|
|
|
|
|
ln -s ${rapidjson} External/rapidjson-1.1.0
|
|
|
|
ln -s ${comic-neue}/share/fonts/truetype/ComicNeue-Regular.ttf Data/Fonts/
|
|
|
|
'';
|
2021-02-05 17:12:51 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
boost
|
|
|
|
cairo
|
2024-01-02 11:29:13 +00:00
|
|
|
catch2_3
|
2023-05-24 13:37:59 +00:00
|
|
|
] ++ lib.optionals (stdenv.system == "x86_64-darwin") [
|
|
|
|
memorymappingHook
|
2021-02-05 17:12:51 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
numpy
|
|
|
|
pandas
|
|
|
|
pillow
|
|
|
|
];
|
|
|
|
|
|
|
|
hardeningDisable = [ "format" ]; # required by yaehmop
|
2021-03-23 19:22:30 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
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"
|
2022-08-12 12:06:08 +00:00
|
|
|
"-DCMAKE_SKIP_BUILD_RPATH=ON" # fails to find libs in pythonImportsCheckPhase otherwise
|
2021-02-05 17:12:51 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
export QT_QPA_PLATFORM='offscreen'
|
|
|
|
export RDBASE=$(realpath ..)
|
2024-02-07 01:22:34 +00:00
|
|
|
export PYTHONPATH="$out/${python.sitePackages}:$PYTHONPATH"
|
2021-02-05 17:12:51 +00:00
|
|
|
(cd $RDBASE/rdkit/Chem && python $RDBASE/rdkit/TestRunner.py test_list.py)
|
|
|
|
'';
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
2022-12-02 08:20:57 +00:00
|
|
|
"rdkit"
|
|
|
|
"rdkit.Chem"
|
|
|
|
"rdkit.Chem.AllChem"
|
2021-02-05 17:12:51 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Open source toolkit for cheminformatics";
|
2023-05-24 13:37:59 +00:00
|
|
|
maintainers = with maintainers; [ rmcgibbo natsukium ];
|
2021-02-05 17:12:51 +00:00
|
|
|
license = licenses.bsd3;
|
|
|
|
homepage = "https://www.rdkit.org";
|
2023-07-15 17:15:38 +00:00
|
|
|
changelog = "https://github.com/rdkit/rdkit/releases/tag/${src.rev}";
|
2021-02-05 17:12:51 +00:00
|
|
|
};
|
|
|
|
}
|