diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 3d48c75ff0dc..30dc99c21a59 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -2037,6 +2037,12 @@ githubId = 23366017; name = "Dan Haraj"; }; + danielbarter = { + email = "danielbarter@gmail.com"; + github = "danielbarter"; + githubId = 8081722; + name = "Daniel Barter"; + }; danieldk = { email = "me@danieldk.eu"; github = "danieldk"; diff --git a/pkgs/applications/science/chemistry/avogadro/default.nix b/pkgs/applications/science/chemistry/avogadro/default.nix index 14ceb91b06ce..a1e775135e0f 100644 --- a/pkgs/applications/science/chemistry/avogadro/default.nix +++ b/pkgs/applications/science/chemistry/avogadro/default.nix @@ -21,9 +21,9 @@ stdenv.mkDerivation rec { }) ]; - meta = { + meta = with lib; { description = "Molecule editor and visualizer"; - maintainers = [ ]; - platforms = lib.platforms.mesaPlatforms; + maintainers = with maintainers; [ danielbarter ]; + platforms = platforms.mesaPlatforms; }; } diff --git a/pkgs/development/libraries/openbabel/2.nix b/pkgs/development/libraries/openbabel/2.nix new file mode 100644 index 000000000000..41631da12416 --- /dev/null +++ b/pkgs/development/libraries/openbabel/2.nix @@ -0,0 +1,31 @@ +{stdenv, lib, fetchurl, fetchpatch, cmake, zlib, libxml2, eigen, python, cairo, pcre, pkg-config }: + +stdenv.mkDerivation rec { + pname = "openbabel"; + version = "2.4.1"; + + src = fetchurl { + url = "https://github.com/openbabel/openbabel/archive/openbabel-${stdenv.lib.replaceStrings ["."] ["-"] version}.tar.gz"; + sha256 = "0xm7y859ivq2cp0q08mwshfxm0jq31xkyr4x8s0j6l7khf57yk2r"; + }; + + patches = [ + # ARM / AArch64 fixes. + (fetchpatch { + url = "https://github.com/openbabel/openbabel/commit/ee11c98a655296550710db1207b294f00e168216.patch"; + sha256 = "0wjqjrkr4pfirzzicdvlyr591vppydk572ix28jd2sagnfnf566g"; + }) + ]; + + buildInputs = [ zlib libxml2 eigen python cairo pcre ]; + + nativeBuildInputs = [ cmake pkg-config ]; + + meta = with lib; { + description = "A toolbox designed to speak the many languages of chemical data"; + homepage = "http://openbabel.org"; + platforms = platforms.all; + maintainers = with maintainers; [ danielbarter ]; + license = licenses.gpl2Plus; + }; +} diff --git a/pkgs/development/libraries/openbabel/default.nix b/pkgs/development/libraries/openbabel/default.nix index d074db7d165c..301025dfd20b 100644 --- a/pkgs/development/libraries/openbabel/default.nix +++ b/pkgs/development/libraries/openbabel/default.nix @@ -1,34 +1,45 @@ -{stdenv, fetchurl, fetchpatch, cmake, zlib, libxml2, eigen, python, cairo, pcre, pkgconfig }: +{stdenv, lib, fetchurl, cmake, zlib, libxml2, eigen, python, cairo, pcre, pkg-config, swig, rapidjson }: stdenv.mkDerivation rec { pname = "openbabel"; - version = "2.4.1"; + version = "3.1.1"; src = fetchurl { url = "https://github.com/openbabel/openbabel/archive/openbabel-${stdenv.lib.replaceStrings ["."] ["-"] version}.tar.gz"; - sha256 = "0xm7y859ivq2cp0q08mwshfxm0jq31xkyr4x8s0j6l7khf57yk2r"; + sha256 = "c97023ac6300d26176c97d4ef39957f06e68848d64f1a04b0b284ccff2744f02"; }; - patches = [ - # ARM / AArch64 fixes. - (fetchpatch { - url = "https://github.com/openbabel/openbabel/commit/ee11c98a655296550710db1207b294f00e168216.patch"; - sha256 = "0wjqjrkr4pfirzzicdvlyr591vppydk572ix28jd2sagnfnf566g"; - }) + + buildInputs = [ zlib libxml2 eigen python cairo pcre swig rapidjson ]; + + nativeBuildInputs = [ cmake pkg-config ]; + + pythonMajorMinor = "${python.sourceVersion.major}.${python.sourceVersion.minor}"; + + cmakeFlags = [ + "-DRUN_SWIG=ON" + "-DPYTHON_BINDINGS=ON" ]; - # TODO : perl & python bindings; - # TODO : wxGTK: I have no time to compile - # TODO : separate lib and apps - buildInputs = [ zlib libxml2 eigen python cairo pcre ]; - nativeBuildInputs = [ cmake pkgconfig ]; + postFixup = '' + cat < $out/lib/python$pythonMajorMinor/site-packages/setup.py + from distutils.core import setup - meta = { + setup( + name = 'pyopenbabel', + version = '${version}', + packages = ['openbabel'], + package_data = {'openbabel' : ['_openbabel.so']} + ) + EOF + ''; + + meta = with lib; { description = "A toolbox designed to speak the many languages of chemical data"; homepage = "http://openbabel.org"; - platforms = stdenv.lib.platforms.all; - maintainers = [ ]; - license = stdenv.lib.licenses.gpl2Plus; + platforms = platforms.all; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ danielbarter ]; }; } diff --git a/pkgs/development/python-modules/openbabel-bindings/default.nix b/pkgs/development/python-modules/openbabel-bindings/default.nix new file mode 100644 index 000000000000..18a6a8dd032c --- /dev/null +++ b/pkgs/development/python-modules/openbabel-bindings/default.nix @@ -0,0 +1,27 @@ +{ stdenv, lib, openbabel, python, buildPythonPackage }: + +buildPythonPackage rec { + pname = "openbabel"; + version = "3.1.1"; + + src = "${openbabel}/lib/python${python.sourceVersion.major}.${python.sourceVersion.minor}/site-packages"; + + nativeBuildInputs = [ openbabel ]; + + # these env variables are used by the bindings to find libraries + # they need to be included explicitly in your nix-shell for + # some functionality to work (inparticular, pybel). + # see https://openbabel.org/docs/dev/Installation/install.html + BABEL_LIBDIR = "${openbabel}/lib/openbabel/3.1.0"; + LD_LIBRARY_PATH = "$LD_LIBRARY_PATH:${openbabel}/lib"; + + doCheck = false; + pythonImportsCheck = [ "openbabel" ]; + + meta = with lib; { + homepage = "http://openbabel.org/wiki/Main_Page"; + description = "Python bindings for openbabel"; + license = licenses.gpl2Plus; + maintainers = with maintainers; [ danielbarter ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 579bac12bb5c..50b5549c5bea 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -15799,7 +15799,11 @@ in }; openal = openalSoft; - openbabel = callPackage ../development/libraries/openbabel { }; + openbabel = openbabel3; + + openbabel2 = callPackage ../development/libraries/openbabel/2.nix { }; + + openbabel3 = callPackages ../development/libraries/openbabel { }; opencascade = callPackage ../development/libraries/opencascade { inherit (darwin.apple_sdk.frameworks) OpenCL Cocoa; @@ -27369,6 +27373,7 @@ in ### SCIENCE/CHEMISTY avogadro = callPackage ../applications/science/chemistry/avogadro { + openbabel = openbabel2; eigen = eigen2; }; diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 314c952ee346..97b48ffa1f0d 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4468,6 +4468,10 @@ in { openapi-spec-validator = callPackage ../development/python-modules/openapi-spec-validator { }; + openbabel-bindings = callPackage ../development/python-modules/openbabel-bindings { + openbabel = (callPackage ../development/libraries/openbabel { python = self.python; }); + }; + opencv3 = toPythonModule (pkgs.opencv3.override { enablePython = true; pythonPackages = self;