about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/biology/neuron/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/science/biology/neuron/default.nix')
-rw-r--r--nixpkgs/pkgs/applications/science/biology/neuron/default.nix27
1 files changed, 14 insertions, 13 deletions
diff --git a/nixpkgs/pkgs/applications/science/biology/neuron/default.nix b/nixpkgs/pkgs/applications/science/biology/neuron/default.nix
index 8cad5f466c5f..7bfef3a82fed 100644
--- a/nixpkgs/pkgs/applications/science/biology/neuron/default.nix
+++ b/nixpkgs/pkgs/applications/science/biology/neuron/default.nix
@@ -1,6 +1,6 @@
-{ stdenv
+{ lib, stdenv
 , fetchurl
-, pkgconfig
+, pkg-config
 , automake
 , autoconf
 , libtool
@@ -8,7 +8,8 @@
 , readline
 , which
 , python ? null
-, mpi ? null
+, useMpi ? false
+, mpi
 , iv
 }:
 
@@ -16,24 +17,25 @@ stdenv.mkDerivation rec {
   pname = "neuron";
   version = "7.5";
 
-  nativeBuildInputs = [ which pkgconfig automake autoconf libtool ];
-  buildInputs = [ ncurses readline python mpi iv ];
+  nativeBuildInputs = [ which pkg-config automake autoconf libtool ];
+  buildInputs = [ ncurses readline python iv ]
+    ++ lib.optional useMpi mpi;
 
   src = fetchurl {
     url = "https://www.neuron.yale.edu/ftp/neuron/versions/v${version}/nrn-${version}.tar.gz";
     sha256 = "0f26v3qvzblcdjg7isq0m9j2q8q7x3vhmkfllv8lsr3gyj44lljf";
   };
 
-  patches = (stdenv.lib.optional (stdenv.isDarwin) [ ./neuron-carbon-disable.patch ]);
+  patches = (lib.optional (stdenv.isDarwin) [ ./neuron-carbon-disable.patch ]);
 
   # With LLVM 3.8 and above, clang (really libc++) gets upset if you attempt to redefine these...
-  postPatch = stdenv.lib.optionalString stdenv.cc.isClang ''
+  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);' ""
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + 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
@@ -51,14 +53,14 @@ stdenv.mkDerivation rec {
     export prefix="''${prefix} --exec-prefix=''${out}"
   '';
 
-  configureFlags = with stdenv.lib;
+  configureFlags = with lib;
                     [ "--with-readline=${readline}" "--with-iv=${iv}" ]
                     ++  optionals (python != null)  [ "--with-nrnpython=${python.interpreter}" ]
-                    ++ (if mpi != null then ["--with-mpi" "--with-paranrn"]
+                    ++ (if useMpi then ["--with-mpi" "--with-paranrn"]
                         else ["--without-mpi"]);
 
 
-  postInstall = stdenv.lib.optionals (python != null) [ ''
+  postInstall = lib.optionals (python != null) [ ''
     ## standardise python neuron install dir if any
     if [[ -d $out/lib/python ]]; then
         mkdir -p ''${out}/${python.sitePackages}
@@ -68,7 +70,7 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ readline ncurses which libtool ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     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
@@ -84,4 +86,3 @@ stdenv.mkDerivation rec {
     platforms   = platforms.x86_64 ++ platforms.i686;
   };
 }
-