diff --git a/pkgs/development/r-modules/default.nix b/pkgs/development/r-modules/default.nix index d17cf9941491a..6e28d3ab601a5 100644 --- a/pkgs/development/r-modules/default.nix +++ b/pkgs/development/r-modules/default.nix @@ -801,7 +801,7 @@ let sphereTessellation = with pkgs; [ gmp.dev mpfr.dev ]; vapour = with pkgs; [ proj.dev gdal ]; MedianaDesigner = [ pkgs.zlib.dev ]; - ChemmineOB = [ pkgs.eigen ]; + ChemmineOB = with pkgs; [ eigen openbabel ]; DGP4LCF = [ pkgs.lapack pkgs.blas ]; }; @@ -1582,29 +1582,26 @@ let PKGCONFIG_LIBS = "-Wl,-rpath,${lib.getLib pkgs.openssl}/lib -L${lib.getLib pkgs.openssl}/lib -L${pkgs.cyrus_sasl.out}/lib -L${pkgs.zlib.out}/lib -lssl -lcrypto -lsasl2 -lz"; }); - ChemmineOB = let - # R package doesn't compile with the latest (unstable) version. - # Override from nixpkgs-23.11 - openbabel3 = pkgs.openbabel.overrideAttrs (attrs: { - version = "3.1.1"; - src = pkgs.fetchFromGitHub { - owner = "openbabel"; - repo = "openbabel"; - rev = "openbabel-${lib.replaceStrings ["."] ["-"] attrs.version}"; - sha256 = "sha256-wQpgdfCyBAoh4pmj9j7wPTlMtraJ62w/EShxi/olVMY="; - }; - }); - in - old.ChemmineOB.overrideAttrs (attrs: { + ChemmineOB = old.ChemmineOB.overrideAttrs (attrs: { # pkg-config knows openbabel-3 without the .0 # Eigen3 is also looked for in the wrong location + # pointer was changed in newer version of openbabel: + # https://github.com/openbabel/openbabel/commit/305a6fd3183540e4a8ae1d79d10bf1860e6aa373 postPatch = '' substituteInPlace configure \ --replace-fail openbabel-3.0 openbabel-3 substituteInPlace src/Makevars.in \ --replace-fail "-I/usr/include/eigen3" "-I${pkgs.eigen}/include/eigen3" + substituteInPlace src/ChemmineOB.cpp \ + --replace-fail "obsharedptr<" "std::shared_ptr<" ''; - buildInputs = attrs.buildInputs ++ [openbabel3]; + + # copied from fastnlo-toolkit: + # None of our currently packaged versions of swig are C++17-friendly + # Use a workaround from https://github.com/swig/swig/issues/1538 + env = (attrs.env or { }) // { + NIX_CFLAGS_COMPILE = (attrs.env.NIX_CFLAGS_COMPILE or "") + lib.optionalString stdenv.hostPlatform.isDarwin " -D_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES"; + }; }); ps = old.ps.overrideAttrs (attrs: {