lol
at master 121 lines 3.0 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 readline, 6 xorg, 7 mpi, 8 cmake, 9 bison, 10 flex, 11 git, 12 perl, 13 gsl, 14 xcbuild, 15 python3, 16 useMpi ? false, 17 useIv ? true, 18 useCore ? false, 19 useRx3d ? false, 20}: 21let 22 inherit (lib.lists) optionals; 23 inherit (lib.strings) cmakeBool; 24in 25stdenv.mkDerivation (finalAttrs: { 26 pname = "neuron"; 27 version = "8.2.7"; 28 29 # format is for pythonModule conversion 30 format = "other"; 31 32 nativeBuildInputs = [ 33 cmake 34 bison 35 flex 36 git 37 ] 38 ++ optionals useCore [ 39 perl 40 gsl 41 ] 42 ++ optionals stdenv.hostPlatform.isDarwin [ xcbuild ]; 43 44 buildInputs = optionals useIv [ 45 xorg.libX11.dev 46 xorg.libXcomposite.dev 47 xorg.libXext.dev 48 ]; 49 50 propagatedBuildInputs = [ 51 readline 52 python3 53 python3.pkgs.wheel 54 python3.pkgs.setuptools 55 python3.pkgs.scikit-build 56 python3.pkgs.matplotlib 57 ] 58 ++ optionals useMpi [ 59 mpi 60 ] 61 ++ optionals useMpi [ 62 python3.pkgs.mpi4py 63 ] 64 ++ optionals useRx3d [ 65 python3.pkgs.cython_0 # NOTE: cython<3 is required as of 8.2.7 66 python3.pkgs.numpy 67 ]; 68 69 # Patch build shells for cmake (bin, src, cmake) and submodules (external) 70 postPatch = '' 71 patchShebangs ./bin ./src ./external ./cmake 72 substituteInPlace external/coreneuron/extra/nrnivmodl_core_makefile.in \ 73 --replace-fail \ 74 "DESTDIR =" \ 75 "DESTDIR = $out" 76 ''; 77 78 cmakeFlags = [ 79 (cmakeBool "NRN_ENABLE_INTERVIEWS" useIv) 80 (cmakeBool "NRN_ENABLE_MPI" useMpi) 81 (cmakeBool "NRN_ENABLE_CORENEURON" useCore) 82 (cmakeBool "NRN_ENABLE_RX3D" useRx3d) 83 ]; 84 85 postInstall = '' 86 mkdir -p $out/${python3.sitePackages} 87 mv $out/lib/python/* $out/${python3.sitePackages}/ 88 rm -rf $out/lib/python build 89 for entry in $out/lib/*.so; do 90 # remove references to build 91 patchelf --set-rpath $(patchelf --print-rpath $entry | tr ':' '\n' | sed '/^\/build/d' | tr '\n' ':') $entry 92 done 93 ''; 94 95 src = fetchFromGitHub { 96 owner = "neuronsimulator"; 97 repo = "nrn"; 98 tag = finalAttrs.version; 99 fetchSubmodules = true; 100 hash = "sha256-dmpx0Wud0IhdFvvTJuW/w1Uq6vFYaNal9n27LAqV1Qc="; 101 }; 102 103 meta = with lib; { 104 description = "Simulation environment for empirically-based simulations of neurons and networks of neurons"; 105 longDescription = '' 106 NEURON is a simulation environment for developing and exercising models of 107 neurons and networks of neurons. It is particularly well-suited to problems where 108 cable properties of cells play an important role, possibly including extracellular 109 potential close to the membrane), and where cell membrane properties are complex, 110 involving many ion-specific channels, ion accumulation, and second messengers 111 ''; 112 sourceProvenance = with sourceTypes; [ fromSource ]; 113 license = licenses.bsd3; 114 homepage = "http://www.neuron.yale.edu/neuron"; 115 maintainers = with maintainers; [ 116 adev 117 davidcromp 118 ]; 119 platforms = platforms.all; 120 }; 121})