Merge pull request #198093 from DavidCromp/update/Neuron-and-python-bind
This commit is contained in:
commit
ccb52a0024
7 changed files with 107 additions and 134 deletions
|
@ -3404,6 +3404,12 @@
|
|||
githubId = 6754950;
|
||||
name = "David Armstrong Lewis";
|
||||
};
|
||||
davidcromp = {
|
||||
email = "davidcrompton1192@gmail.com";
|
||||
github = "DavidCromp";
|
||||
githubId = 10701143;
|
||||
name = "David Crompton";
|
||||
};
|
||||
davidrusu = {
|
||||
email = "davidrusu.me@gmail.com";
|
||||
github = "davidrusu";
|
||||
|
|
|
@ -1,94 +1,104 @@
|
|||
{ lib, stdenv
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchurl
|
||||
, pkg-config
|
||||
, automake
|
||||
, autoconf
|
||||
, libtool
|
||||
, ncurses
|
||||
, readline
|
||||
, which
|
||||
, python ? null
|
||||
, useMpi ? false
|
||||
, xorg
|
||||
, mpi
|
||||
, iv
|
||||
, cmake
|
||||
, bison
|
||||
, flex
|
||||
, git
|
||||
, perl
|
||||
, gsl
|
||||
, xcbuild
|
||||
, python3
|
||||
, useMpi ? false
|
||||
, useIv ? true
|
||||
, useCore ? false
|
||||
, useRx3d ? false
|
||||
}:
|
||||
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "neuron${lib.optionalString useMpi "-mpi"}";
|
||||
version = "7.5";
|
||||
pname = "neuron";
|
||||
version = "8.2.1";
|
||||
|
||||
nativeBuildInputs = [ which pkg-config automake autoconf libtool ];
|
||||
buildInputs = [ ncurses readline python iv ]
|
||||
++ lib.optional useMpi mpi;
|
||||
# format is for pythonModule conversion
|
||||
format = "other";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://www.neuron.yale.edu/ftp/neuron/versions/v${version}/nrn-${version}.tar.gz";
|
||||
sha256 = "0f26v3qvzblcdjg7isq0m9j2q8q7x3vhmkfllv8lsr3gyj44lljf";
|
||||
};
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
bison
|
||||
flex
|
||||
git
|
||||
] ++ lib.optional useCore [ perl gsl ]
|
||||
++ lib.optional stdenv.isDarwin [ xcbuild ];
|
||||
|
||||
patches = (lib.optionals (stdenv.isDarwin) [ ./neuron-carbon-disable.patch ]);
|
||||
buildInputs = lib.optional useIv [
|
||||
xorg.libX11.dev
|
||||
xorg.libXcomposite.dev
|
||||
xorg.libXext.dev
|
||||
];
|
||||
|
||||
# With LLVM 3.8 and above, clang (really libc++) gets upset if you attempt to redefine these...
|
||||
postPatch = 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);' ""
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
# we are darwin, but we don't have all the quirks the source wants to compensate for
|
||||
substituteInPlace src/nrnpython/setup.py.in --replace 'readline="edit"' 'readline="readline"'
|
||||
for f in src/nrnpython/*.[ch] ; do
|
||||
substituteInPlace $f --replace "<Python/Python.h>" "<Python.h>"
|
||||
propagatedBuildInputs = [
|
||||
readline
|
||||
python3
|
||||
python3.pkgs.wheel
|
||||
python3.pkgs.setuptools
|
||||
python3.pkgs.scikit-build
|
||||
python3.pkgs.matplotlib
|
||||
] ++ lib.optional useMpi [
|
||||
mpi
|
||||
] ++ lib.optional useMpi [
|
||||
python3.pkgs.mpi4py
|
||||
] ++ lib.optional useRx3d [
|
||||
python3.pkgs.cython
|
||||
python3.pkgs.numpy
|
||||
];
|
||||
|
||||
patches = [ ./neuron_darwin_rpath.patch ];
|
||||
|
||||
# Patch build shells for cmake (bin, src, cmake) and submodules (external)
|
||||
postPatch = ''
|
||||
patchShebangs ./bin ./src ./external ./cmake
|
||||
sed -e 's#DESTDIR =#DESTDIR = '"$out"'#' -i external/coreneuron/extra/nrnivmodl_core_makefile.in
|
||||
'';
|
||||
|
||||
cmakeFlags = [
|
||||
"-DNRN_ENABLE_INTERVIEWS=${if useIv then "ON" else "OFF"}"
|
||||
"-DNRN_ENABLE_MPI=${if useMpi then "ON" else "OFF"}"
|
||||
"-DNRN_ENABLE_CORENEURON=${if useCore then "ON" else "OFF"}"
|
||||
"-DNRN_ENABLE_RX3D=${if useRx3d then "ON" else "OFF"}"
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
mkdir -p $out/${python3.sitePackages}
|
||||
mv $out/lib/python/* $out/${python3.sitePackages}/
|
||||
rm -rf $out/lib/python build
|
||||
for entry in $out/lib/*.so; do
|
||||
# remove references to build
|
||||
patchelf --set-rpath $(patchelf --print-rpath $entry | tr ':' '\n' | sed '/^\/build/d' | tr '\n' ':') $entry
|
||||
done
|
||||
'';
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
## neuron install by default everything under prefix/${host_arch}/*
|
||||
## override this to support nix standard file hierarchy
|
||||
## without issues: install everything under prefix/
|
||||
preConfigure = ''
|
||||
./build.sh
|
||||
export prefix="''${prefix} --exec-prefix=''${out}"
|
||||
'';
|
||||
|
||||
configureFlags = with lib;
|
||||
[ "--with-readline=${readline}" "--with-iv=${iv}" ]
|
||||
++ optionals (python != null) [ "--with-nrnpython=${python.interpreter}" ]
|
||||
++ (if useMpi then ["--with-mpi" "--with-paranrn"]
|
||||
else ["--without-mpi"]);
|
||||
|
||||
|
||||
postInstall = lib.optionalString (python != null) ''
|
||||
## standardise python neuron install dir if any
|
||||
if [[ -d $out/lib/python ]]; then
|
||||
mkdir -p ''${out}/${python.sitePackages}
|
||||
mv ''${out}/lib/python/* ''${out}/${python.sitePackages}/
|
||||
fi
|
||||
'';
|
||||
|
||||
propagatedBuildInputs = [ readline ncurses which libtool ];
|
||||
src = fetchurl {
|
||||
url = "https://github.com/neuronsimulator/nrn/releases/download/${version}/full-src-package-${version}.tar.gz";
|
||||
sha256 = "0kb0dn7nmivv3zflzkbj2fj3184zwp2crkxp0mdxkwm4kpnxqz0v";
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
broken = stdenv.isDarwin;
|
||||
description = "Simulation environment for empirically-based simulations of neurons and networks of neurons";
|
||||
|
||||
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,
|
||||
involving many ion-specific channels, ion accumulation, and second messengers";
|
||||
|
||||
sourceProvenance = with sourceTypes; [
|
||||
fromSource
|
||||
] ++ lib.optionals (python != null) [
|
||||
binaryNativeCode # "geometry3d" bundled libraries
|
||||
];
|
||||
license = licenses.bsd3;
|
||||
homepage = "http://www.neuron.yale.edu/neuron";
|
||||
maintainers = [ maintainers.adev ];
|
||||
# source claims it's only tested for x86 and powerpc
|
||||
platforms = platforms.x86_64 ++ platforms.i686;
|
||||
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,
|
||||
involving many ion-specific channels, ion accumulation, and second messengers
|
||||
'';
|
||||
sourceProvenance = with sourceTypes; [ fromSource ];
|
||||
license = licenses.bsd3;
|
||||
homepage = "http://www.neuron.yale.edu/neuron";
|
||||
maintainers = with maintainers; [ adev davidcromp ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
--- nrn-7.4/src/mac/Makefile.am 2015-11-12 21:42:45.000000000 +0100
|
||||
+++ nrn-7.4.new/src/mac/Makefile.am 2016-08-24 17:43:39.000000000 +0200
|
||||
@@ -15,18 +15,8 @@
|
||||
host_cpu = @host_cpu@
|
||||
|
||||
if MAC_DARWIN
|
||||
-carbon = @enable_carbon@
|
||||
bin_SCRIPTS = $(launch_scripts)
|
||||
install: install-am
|
||||
-if UniversalMacBinary
|
||||
- $(CC) -arch ppc -o aoutppc -Dcpu="\"$(host_cpu)\"" -I. $(srcdir)/launch.c $(srcdir)/mac2uxarg.c -framework Carbon
|
||||
- $(CC) -arch i386 -o aouti386 -Dcpu="\"$(host_cpu)\"" -I. $(srcdir)/launch.c $(srcdir)/mac2uxarg.c -framework Carbon
|
||||
- lipo aouti386 aoutppc -create -output a.out
|
||||
-else
|
||||
- gcc -g -arch i386 -Dncpu="\"$(host_cpu)\"" -I. $(srcdir)/launch.c $(srcdir)/mac2uxarg.c -framework Carbon
|
||||
-
|
||||
-endif
|
||||
- carbon=$(carbon) sh $(srcdir)/launch_inst.sh "$(host_cpu)" "$(DESTDIR)$(prefix)" "$(srcdir)"
|
||||
for i in $(S) ; do \
|
||||
sed "s/^CPU.*/CPU=\"$(host_cpu)\"/" < $(DESTDIR)$(bindir)/$$i > temp; \
|
||||
mv temp $(DESTDIR)$(bindir)/$$i; \
|
|
@ -0,0 +1,11 @@
|
|||
--- a/src/nrnpython/setup.py.in
|
||||
+++ b/src/nrnpython/setup.py.in
|
||||
@@ -124,7 +124,7 @@ libdirs = [destdir + get_escaped_path("@NRN_LIBDIR@"),
|
||||
rpath_prefix_flag='-Wl,-R'
|
||||
extra_link_args = [@NRN_LINK_FLAGS_COMMA_SEPARATED_STRINGS@]
|
||||
@MAC_DARWIN_FALSE@extra_link_args += [rpath_prefix_flag+lib_path for lib_path in libdirs]
|
||||
-@MAC_DARWIN_TRUE@extra_link_args.append("-Wl,-rpath,@loader_path/../../")
|
||||
+@MAC_DARWIN_TRUE@extra_link_args.append("-Wl,-rpath,@loader_path/../../../")
|
||||
@MAC_DARWIN_TRUE@extra_link_args.append("-Wl,-rpath,%s" % ivlibdir)
|
||||
|
||||
# as neuron module will be built during make, add build/lib
|
|
@ -1,31 +0,0 @@
|
|||
{ lib
|
||||
, buildPythonPackage
|
||||
, fetchPypi
|
||||
, numpy
|
||||
, matplotlib
|
||||
, scipy
|
||||
, isPy27
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "neuronpy";
|
||||
version = "0.1.6";
|
||||
disabled = !isPy27;
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "1clhc2b5fy2l8nfrji4dagmj9419nj6kam090yqxhq5c28sngk25";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [ numpy matplotlib scipy ];
|
||||
|
||||
#No tests included
|
||||
doCheck = false;
|
||||
|
||||
meta = with lib; {
|
||||
description = "Interfaces and utilities for the NEURON simulator and analysis of neural data";
|
||||
maintainers = [ maintainers.nico202 ];
|
||||
license = licenses.mit;
|
||||
};
|
||||
|
||||
}
|
|
@ -36424,11 +36424,11 @@ with pkgs;
|
|||
|
||||
nest-mpi = callPackage ../applications/science/biology/nest { withMpi = true; };
|
||||
|
||||
neuron = callPackage ../applications/science/biology/neuron { python = null; };
|
||||
neuron = callPackage ../applications/science/biology/neuron { };
|
||||
|
||||
neuron-mpi = neuron.override {useMpi = true; };
|
||||
|
||||
neuron-full = neuron-mpi.override { python = python2; };
|
||||
neuron-full = neuron-mpi.override { useCore = true; useRx3d = true; };
|
||||
|
||||
mrbayes = callPackage ../applications/science/biology/mrbayes { };
|
||||
|
||||
|
|
|
@ -6334,11 +6334,9 @@ self: super: with self; {
|
|||
|
||||
networkx = callPackage ../development/python-modules/networkx { };
|
||||
|
||||
neuron-mpi = toPythonModule (pkgs.neuron-mpi.override { inherit python; });
|
||||
neuron-full = pkgs.neuron-full.override { python3 = python; };
|
||||
|
||||
neuron = toPythonModule (pkgs.neuron.override { inherit python; });
|
||||
|
||||
neuronpy = callPackage ../development/python-modules/neuronpy { };
|
||||
neuronpy = python.pkgs.toPythonModule neuron-full;
|
||||
|
||||
nevow = callPackage ../development/python-modules/nevow { };
|
||||
|
||||
|
|
Loading…
Reference in a new issue