Commit 77aed400 authored by DavidCrompton1192@gmail.com's avatar DavidCrompton1192@gmail.com
Browse files

neuron: 7.5 -> 8.2.1

parent ffdae3d3
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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";
+82 −72
Original line number Diff line number Diff line
{ 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>"
    done
  '';
  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
  ];

  enableParallelBuilding = true;
  patches = [ ./neuron_darwin_rpath.patch ];

  ## 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}"
  # 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
  '';

  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"]);

  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 = 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
  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
  '';

  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
    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
    ];
      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 = [ maintainers.adev ];
    # source claims it's only tested for x86 and powerpc
    platforms   = platforms.x86_64 ++ platforms.i686;
    maintainers = with maintainers; [ adev davidcromp ];
    platforms = platforms.all;
  };
}
+0 −21
Original line number Diff line number Diff line
--- 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; \
+11 −0
Original line number Diff line number Diff line
--- 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
+0 −31
Original line number Diff line number Diff line
{ 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;
  };

}
Loading