mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-30 17:43:42 +00:00
155 lines
4.0 KiB
Nix
155 lines
4.0 KiB
Nix
{ lib
|
|
, buildPythonPackage
|
|
, fetchFromGitHub
|
|
, cmake
|
|
, comic-neue
|
|
, boost
|
|
, catch2
|
|
, inchi
|
|
, cairo
|
|
, eigen
|
|
, python
|
|
, rapidjson
|
|
, maeparser
|
|
, coordgenlibs
|
|
, numpy
|
|
, pandas
|
|
, pillow
|
|
}:
|
|
let
|
|
external = {
|
|
avalon = fetchFromGitHub {
|
|
owner = "rohdebe1";
|
|
repo = "ava-formake";
|
|
rev = "AvalonToolkit_2.0.2";
|
|
hash = "sha256-YI39OknHiSyArNGqRKrSVzEJnFc1xJ0W3UcTZrTKeME=";
|
|
};
|
|
yaehmop = fetchFromGitHub {
|
|
owner = "greglandrum";
|
|
repo = "yaehmop";
|
|
rev = "v2022.09.1";
|
|
hash = "sha256-QMnc5RyHlY3giw9QmrkGntiA+Srs7OhCIKs9GGo5DfQ=";
|
|
};
|
|
freesasa = fetchFromGitHub {
|
|
owner = "mittinatten";
|
|
repo = "freesasa";
|
|
rev = "2.0.3";
|
|
hash = "sha256-7E+imvfDAJFnXQRWb5hNaSu+Xrf9NXeIKc9fl+o3yHQ=";
|
|
};
|
|
};
|
|
in
|
|
buildPythonPackage rec {
|
|
pname = "rdkit";
|
|
version = "2022.09.1";
|
|
format = "other";
|
|
|
|
src =
|
|
let
|
|
versionTag = lib.replaceStrings [ "." ] [ "_" ] version;
|
|
in
|
|
fetchFromGitHub {
|
|
owner = pname;
|
|
repo = pname;
|
|
rev = "Release_${versionTag}";
|
|
hash = "sha256-AaawjCv3/ShByOKU0c37/hjuyfD7NhFC8UngDoG7C0s=";
|
|
};
|
|
|
|
unpackPhase = ''
|
|
cp -r $src/* .
|
|
find . -type d -exec chmod +w {} +
|
|
|
|
mkdir External/AvalonTools/avalon
|
|
ln -s ${external.avalon}/* External/AvalonTools/avalon
|
|
|
|
mkdir External/YAeHMOP/yaehmop
|
|
ln -s ${external.yaehmop}/* External/YAeHMOP/yaehmop
|
|
|
|
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/
|
|
'';
|
|
|
|
nativeBuildInputs = [
|
|
cmake
|
|
];
|
|
|
|
buildInputs = [
|
|
boost
|
|
cairo
|
|
];
|
|
|
|
propagatedBuildInputs = [
|
|
numpy
|
|
pandas
|
|
pillow
|
|
];
|
|
|
|
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 = [
|
|
"-DCATCH_DIR=${catch2}/include/catch2"
|
|
"-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
|
|
];
|
|
|
|
checkPhase = ''
|
|
export QT_QPA_PLATFORM='offscreen'
|
|
export RDBASE=$(realpath ..)
|
|
export PYTHONPATH="$out/lib/${python.libPrefix}/site-packages:$PYTHONPATH"
|
|
(cd $RDBASE/rdkit/Chem && python $RDBASE/rdkit/TestRunner.py test_list.py)
|
|
'';
|
|
|
|
pythonImportsCheck = [
|
|
"rdkit"
|
|
"rdkit.Chem"
|
|
"rdkit.Chem.AllChem"
|
|
];
|
|
|
|
meta = with lib; {
|
|
description = "Open source toolkit for cheminformatics";
|
|
maintainers = [ maintainers.rmcgibbo ];
|
|
license = licenses.bsd3;
|
|
homepage = "https://www.rdkit.org";
|
|
};
|
|
}
|