From d5151915776a4980c09f483769899d282f23b382 Mon Sep 17 00:00:00 2001 From: natsukium Date: Thu, 18 May 2023 02:06:25 +0900 Subject: [PATCH] autodock-vina: init at 1.2.3 --- .../chemistry/autodock-vina/default.nix | 57 +++++++++++++++++++ .../autodock-vina/python-bindings.nix | 56 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + pkgs/top-level/python-packages.nix | 2 + 4 files changed, 117 insertions(+) create mode 100644 pkgs/applications/science/chemistry/autodock-vina/default.nix create mode 100644 pkgs/applications/science/chemistry/autodock-vina/python-bindings.nix diff --git a/pkgs/applications/science/chemistry/autodock-vina/default.nix b/pkgs/applications/science/chemistry/autodock-vina/default.nix new file mode 100644 index 000000000000..415c2e32973f --- /dev/null +++ b/pkgs/applications/science/chemistry/autodock-vina/default.nix @@ -0,0 +1,57 @@ +{ lib +, stdenv +, fetchFromGitHub +, boost +, glibc +}: +let + boost' = boost.override { + enableShared = false; + }; +in +stdenv.mkDerivation (finalAttrs: { + pname = "autodock-vina"; + version = "1.2.3"; + + src = fetchFromGitHub { + owner = "ccsb-scripps"; + repo = "autodock-vina"; + rev = "refs/tags/v${finalAttrs.version}"; + hash = "sha256-oOpwhRmpS5WfnuqxkjxGsGtrofPxUt8bH9ggzm5rrR8="; + }; + + sourceRoot = + if stdenv.isDarwin + then "source/build/mac/release" + else "source/build/linux/release"; + + buildInputs = [ + boost' + ] ++ lib.optionals stdenv.isLinux [ + glibc.static + ]; + + makeFlags = [ + "GPP=${stdenv.cc.targetPrefix}c++" + "BASE=${boost'}" + "BOOST_INCLUDE=${lib.getDev boost'}/include" + ]; + + installPhase = '' + runHook preInstall + + install -Dm755 vina vina_split -t $out/bin/ + + runHook postInstall + ''; + + meta = with lib; { + description = "One of the fastest and most widely used open-source docking engines"; + homepage = "https://vina.scripps.edu/"; + changelog = "https://github.com/ccsb-scripps/AutoDock-Vina/releases/tag/v${finalAttrs.version}"; + license = licenses.asl20; + maintainers = with maintainers; [ natsukium ]; + platforms = platforms.unix; + mainProgram = "vina"; + }; +}) diff --git a/pkgs/applications/science/chemistry/autodock-vina/python-bindings.nix b/pkgs/applications/science/chemistry/autodock-vina/python-bindings.nix new file mode 100644 index 000000000000..99d132912e2f --- /dev/null +++ b/pkgs/applications/science/chemistry/autodock-vina/python-bindings.nix @@ -0,0 +1,56 @@ +{ lib +, buildPythonPackage +, autodock-vina +, boost +, swig +, setuptools +, numpy +}: + +buildPythonPackage { + inherit (autodock-vina) pname version src meta; + + format = "pyproject"; + + sourceRoot = "source/build/python"; + + postPatch = '' + # wildcards are not allowed + # https://github.com/ccsb-scripps/AutoDock-Vina/issues/176 + substituteInPlace setup.py \ + --replace "python_requires='>=3.5.*'" "python_requires='>=3.5'" + + # setupPyBuildFlags are not applied with `format = "pyproject"` + substituteInPlace setup.py \ + --replace "= locate_boost()" "= '${lib.getDev boost}/include', '${boost}/lib'" + + # this line attempts to delete the source code + substituteInPlace setup.py \ + --replace "shutil.rmtree('src')" "..." + + # np.int is deprecated + # https://github.com/ccsb-scripps/AutoDock-Vina/pull/167 and so on + substituteInPlace vina/vina.py \ + --replace "np.int" "int" + ''; + + nativeBuildInputs = [ + setuptools + swig + ]; + + buildInputs = [ + boost + ]; + + propagatedBuildInputs = [ + numpy + ]; + + # upstrem has no tests + doCheck = false; + + pythonImportsCheck = [ + "vina" + ]; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 78db7fe2748e..6fe3f026adc4 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -37332,6 +37332,8 @@ with pkgs; gstreamerSupport = true; }; + autodock-vina = callPackage ../applications/science/chemistry/autodock-vina { }; + dkh = callPackage ../applications/science/chemistry/dkh { }; openmolcas = callPackage ../applications/science/chemistry/openmolcas { }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 54e547458708..b1b876b184b3 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -12673,6 +12673,8 @@ self: super: with self; { vilfo-api-client = callPackage ../development/python-modules/vilfo-api-client { }; + vina = callPackage ../applications/science/chemistry/autodock-vina/python-bindings.nix { }; + vincenty = callPackage ../development/python-modules/vincenty { }; vine = callPackage ../development/python-modules/vine { };