2017-03-21 05:00:18 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchurl
|
2016-08-23 12:30:40 +01:00
|
|
|
, pkgconfig
|
|
|
|
, automake
|
|
|
|
, autoconf
|
|
|
|
, libtool
|
|
|
|
, ncurses
|
|
|
|
, readline
|
|
|
|
, which
|
2017-03-21 05:00:18 +00:00
|
|
|
, python ? null
|
2016-02-19 10:52:22 +00:00
|
|
|
, mpi ? null
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2016-08-23 12:30:40 +01:00
|
|
|
name = "neuron-${version}";
|
|
|
|
version = "7.4";
|
2017-03-21 05:00:18 +00:00
|
|
|
|
2016-08-23 12:30:40 +01:00
|
|
|
nativeBuildInputs = [ which pkgconfig automake autoconf libtool ];
|
|
|
|
buildInputs = [ ncurses readline python mpi ];
|
2016-02-19 10:52:22 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2016-08-23 12:30:40 +01:00
|
|
|
url = "http://www.neuron.yale.edu/ftp/neuron/versions/v${version}/nrn-${version}.tar.gz";
|
2016-02-19 10:52:22 +00:00
|
|
|
sha256 = "1rid8cmv5mca0vqkgwahm0prkwkbdvchgw2bdwvx4adkn8bbl0ql";
|
|
|
|
};
|
|
|
|
|
2016-08-23 12:30:40 +01:00
|
|
|
patches = (stdenv.lib.optional (stdenv.isDarwin) [ ./neuron-carbon-disable.patch ]);
|
2016-02-19 10:52:22 +00:00
|
|
|
|
2017-03-21 05:00:18 +00:00
|
|
|
# With LLVM 3.8 and above, clang (really libc++) gets upset if you attempt to redefine these...
|
|
|
|
postPatch = stdenv.lib.optionalString stdenv.cc.isClang ''
|
|
|
|
substituteInPlace src/gnu/neuron_gnu_builtin.h \
|
|
|
|
--replace 'double abs(double arg);' "" \
|
|
|
|
--replace 'float abs(float arg);' "" \
|
|
|
|
--replace 'short abs(short arg);' "" \
|
|
|
|
--replace 'long abs(long arg);' ""
|
|
|
|
'';
|
|
|
|
|
2016-02-19 10:52:22 +00:00
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
2016-08-23 12:30:40 +01:00
|
|
|
## neuron install by default everything under prefix/${host_arch}/*
|
2017-03-21 05:00:18 +00:00
|
|
|
## override this to support nix standard file hierarchy
|
2016-08-23 12:30:40 +01:00
|
|
|
## without issues: install everything under prefix/
|
|
|
|
preConfigure = ''
|
|
|
|
./build.sh
|
2017-03-21 05:00:18 +00:00
|
|
|
export prefix="''${prefix} --exec-prefix=''${out}"
|
2016-08-23 12:30:40 +01:00
|
|
|
'';
|
|
|
|
|
2016-09-01 11:02:42 +01:00
|
|
|
configureFlags = with stdenv.lib;
|
|
|
|
[ "--without-x" "--with-readline=${readline}" ]
|
2016-08-23 12:30:40 +01:00
|
|
|
++ optionals (python != null) [ "--with-nrnpython=${python.interpreter}" ]
|
2017-03-21 05:00:18 +00:00
|
|
|
++ (if mpi != null then ["--with-mpi" "--with-paranrn"]
|
2016-08-23 12:30:40 +01:00
|
|
|
else ["--without-mpi"]);
|
2017-03-21 05:00:18 +00:00
|
|
|
|
|
|
|
|
2016-08-23 12:30:40 +01:00
|
|
|
postInstall = stdenv.lib.optionals (python != null) [ ''
|
|
|
|
## standardise python neuron install dir if any
|
|
|
|
if [[ -d $out/lib/python ]]; then
|
|
|
|
mkdir -p ''${out}/${python.sitePackages}
|
2016-09-01 12:41:26 +01:00
|
|
|
mv ''${out}/lib/python/* ''${out}/${python.sitePackages}/
|
2016-08-23 12:30:40 +01:00
|
|
|
fi
|
|
|
|
''];
|
2017-03-21 05:00:18 +00:00
|
|
|
|
|
|
|
propagatedBuildInputs = [ readline ncurses which libtool ];
|
2016-02-19 10:52:22 +00:00
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Simulation environment for empirically-based simulations of neurons and networks of neurons";
|
|
|
|
|
2017-03-21 05:00:18 +00:00
|
|
|
longDescription = "NEURON is a simulation environment for developing and exercising models of
|
|
|
|
neurons and networks of neurons. It is particularly well-suited to problems where
|
|
|
|
cable properties of cells play an important role, possibly including extracellular
|
|
|
|
potential close to the membrane), and where cell membrane properties are complex,
|
2016-08-23 12:30:40 +01:00
|
|
|
involving many ion-specific channels, ion accumulation, and second messengers";
|
2016-02-19 10:52:22 +00:00
|
|
|
|
|
|
|
license = licenses.bsd3;
|
|
|
|
homepage = http://www.neuron.yale.edu/neuron;
|
|
|
|
maintainers = [ maintainers.adev ];
|
|
|
|
platforms = platforms.all;
|
2017-03-21 05:00:18 +00:00
|
|
|
};
|
2016-02-19 10:52:22 +00:00
|
|
|
}
|
|
|
|
|