21 inherit (lib.lists) optionals;
22 inherit (lib.strings) cmakeBool;
24 stdenv.mkDerivation (finalAttrs: {
28 # format is for pythonModule conversion
36 ] ++ optionals useCore [ perl gsl ]
37 ++ optionals stdenv.hostPlatform.isDarwin [ xcbuild ];
39 buildInputs = optionals useIv [
41 xorg.libXcomposite.dev
45 propagatedBuildInputs = [
49 python3.pkgs.setuptools
50 python3.pkgs.scikit-build
51 python3.pkgs.matplotlib
52 ] ++ optionals useMpi [
54 ] ++ optionals useMpi [
56 ] ++ optionals useRx3d [
57 python3.pkgs.cython_0 # NOTE: cython<3 is required as of 8.2.6
61 # Patch build shells for cmake (bin, src, cmake) and submodules (external)
63 patchShebangs ./bin ./src ./external ./cmake
64 substituteInPlace external/coreneuron/extra/nrnivmodl_core_makefile.in \
71 (cmakeBool "NRN_ENABLE_INTERVIEWS" useIv)
72 (cmakeBool "NRN_ENABLE_MPI" useMpi)
73 (cmakeBool "NRN_ENABLE_CORENEURON" useCore)
74 (cmakeBool "NRN_ENABLE_RX3D" useRx3d)
78 mkdir -p $out/${python3.sitePackages}
79 mv $out/lib/python/* $out/${python3.sitePackages}/
80 rm -rf $out/lib/python build
81 for entry in $out/lib/*.so; do
82 # remove references to build
83 patchelf --set-rpath $(patchelf --print-rpath $entry | tr ':' '\n' | sed '/^\/build/d' | tr '\n' ':') $entry
87 src = fetchFromGitHub {
88 owner = "neuronsimulator";
90 rev = finalAttrs.version;
91 fetchSubmodules = true;
92 hash = "sha256-xASBpsF8rIzrb5G+4Qi6rvWC2wqL7nAGlSeMsBAI6WM=";
96 description = "Simulation environment for empirically-based simulations of neurons and networks of neurons";
98 NEURON is a simulation environment for developing and exercising models of
99 neurons and networks of neurons. It is particularly well-suited to problems where
100 cable properties of cells play an important role, possibly including extracellular
101 potential close to the membrane), and where cell membrane properties are complex,
102 involving many ion-specific channels, ion accumulation, and second messengers
104 sourceProvenance = with sourceTypes; [ fromSource ];
105 license = licenses.bsd3;
106 homepage = "http://www.neuron.yale.edu/neuron";
107 maintainers = with maintainers; [ adev davidcromp ];
108 platforms = platforms.all;