Skip to content

Instantly share code, notes, and snippets.

@idontgetoutmuch
Created July 18, 2019 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save idontgetoutmuch/610fc1f5ecf393c53cc6dd2002980532 to your computer and use it in GitHub Desktop.
Save idontgetoutmuch/610fc1f5ecf393c53cc6dd2002980532 to your computer and use it in GitHub Desktop.
self: super:
{
mySundials = super.callPackage ./pkgs/sundials { };
myScikits-odes = super.callPackage ./pkgs/scikits-odes { };
}
{ stdenv
, lib
, buildPythonPackage
, fetchPypi
, cython
, enum34
, gfortran
, isPy3k
, numpy
, pytest
, python
, scipy
, sundials_3_lapack
}:
buildPythonPackage rec {
pname = "scikits.odes";
version = "2.4.0";
src = fetchPypi {
inherit pname version;
sha256 = "103xg1k1gps8sp7fmbqa570x3d7kscg6bzw1innl2jil1d416glf";
};
nativeBuildInputs = [
gfortran
cython
];
propagatedBuildInputs = [
numpy
sundials_3
scipy
] ++ lib.optionals (!isPy3k) [ enum34 ];
# https://grokbase.com/t/gg/cython-users/13987sentw/cython-inline-causing-errors-on-macos-with-clang#20130908e6otbth2q2uhx5hqe7ujqsrxe4
postPatch = lib.optionalString stdenv.cc.isClang ''
sed -i scikits/odes/sundials/common_defs.pxd -e "s|inline ||"
'';
doCheck = true;
checkInputs = [ pytest ];
checkPhase = ''
cd $out/${python.sitePackages}/scikits/odes/tests
# disable lapack tests, as we build numpy and scipy without it
sed -i test_odeint.py -e "s|^TEST_LAPACK =.*$|TEST_LAPACK = False|"
pytest
'';
meta = with stdenv.lib; {
description = "A scikit offering extra ode/dae solvers, as an extension to what is available in scipy";
homepage = https://github.com/bmcage/odes;
license = licenses.bsd3;
maintainers = with maintainers; [ flokli ];
};
}
{ cmake, fetchurl, python, stdenv,
openblas, liblapack,
gfortran }:
stdenv.mkDerivation rec {
pname = "sundials";
version = "3.2.1";
src = fetchurl {
url = "https://computation.llnl.gov/projects/${pname}/download/${pname}-${version}.tar.gz";
sha256 = "0238r1qnwqz13wcjzfsbcfi8rfnlxcjjmxq2vpf2qf5jgablvna7";
};
cmakeFlags = [
"-DEXAMPLES_INSTALL_PATH=${placeholder "out"}/share/examples"
"-DSUNDIALS_INDEX_TYPE=int32_t"
"-DLAPACK_ENABLE=ON"
"-DLAPACK_LIBRARIES=[${liblapack}/lib/liblapack.dylib,${openblas}/lib/libopenblas.dylib,${gfortran.cc.lib}/lib/libgfortran.a]"
];
nativeBuildInputs = [ cmake gfortran.cc.lib openblas liblapack];
buildInputs = [ python gfortran ];
meta = with stdenv.lib; {
description = "Suite of nonlinear differential/algebraic equation solvers";
homepage = https://computation.llnl.gov/projects/sundials;
platforms = platforms.all;
maintainers = [ maintainers.idontgetoutmuch ];
license = licenses.bsd3;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment