lol

Add the Geant4 Monte Carlo radiation transport toolkit and its Python bindings.

+412
+181
pkgs/development/libraries/physics/geant4/default.nix
··· 1 + { enableMultiThreading ? false 2 + , enableG3toG4 ? false 3 + , enableInventor ? false 4 + , enableGDML ? false 5 + , enableQT ? false 6 + , enableXM ? false 7 + , enableOpenGLX11 ? false 8 + , enableRaytracerX11 ? false 9 + 10 + # Standard build environment with cmake. 11 + , stdenv, fetchurl, cmake 12 + 13 + # Optional system packages, otherwise internal GEANT4 packages are used. 14 + , clhep ? null 15 + , expat ? null 16 + , zlib ? null 17 + 18 + # For enableGDML. 19 + , xercesc ? null 20 + 21 + # For enableQT. 22 + , qt ? null # qt4SDK or qt5SDK 23 + 24 + # For enableXM. 25 + , motif ? null # motif or lesstif 26 + 27 + # For enableQT, enableXM, enableOpenGLX11, enableRaytracerX11. 28 + , mesa ? null 29 + , x11 ? null 30 + , libXmu ? null 31 + }: 32 + 33 + # G4persistency library with support for GDML 34 + assert enableGDML -> xercesc != null; 35 + 36 + # If enableQT, Qt4/5 User Interface and Visualization drivers. 37 + assert enableQT -> qt != null; 38 + 39 + # Motif User Interface and Visualisation drivers. 40 + assert enableXM -> motif != null; 41 + 42 + # OpenGL/X11 User Interface and Visualisation drivers. 43 + assert enableQT || enableXM || enableOpenGLX11 || enableRaytracerX11 -> mesa != null; 44 + assert enableQT || enableXM || enableOpenGLX11 || enableRaytracerX11 -> x11 != null; 45 + assert enableQT || enableXM || enableOpenGLX11 || enableRaytracerX11 -> libXmu != null; 46 + 47 + let 48 + buildGeant4 = 49 + { version, src, multiThreadingCapable ? false }: 50 + 51 + stdenv.mkDerivation rec { 52 + inherit version src; 53 + name = "geant4-${version}"; 54 + 55 + # The data directory holds not just interaction cross section data, but other 56 + # files which the installer needs to write, so we link to the previously installed 57 + # data instead. This assumes the default data installation location of $out/share. 58 + preConfigure = '' 59 + mkdir -p $out/share/Geant4-${version} 60 + ln -s ${g4data}/Geant4-${version}/data $out/share/Geant4-${version}/data 61 + ''; 62 + 63 + multiThreadingFlag = if multiThreadingCapable then "-DGEANT4_BUILD_MULTITHREADED=${if enableMultiThreading then "ON" else "OFF"}" else ""; 64 + 65 + cmakeFlags = '' 66 + ${multiThreadingFlag} 67 + -DGEANT4_USE_GDML=${if enableGDML then "ON" else "OFF"} 68 + -DGEANT4_USE_G3TOG4=${if enableG3toG4 then "ON" else "OFF"} 69 + -DGEANT4_USE_QT=${if enableQT then "ON" else "OFF"} 70 + -DGEANT4_USE_XM=${if enableXM then "ON" else "OFF"} 71 + -DGEANT4_USE_OPENGL_X11=${if enableOpenGLX11 then "ON" else "OFF"} 72 + -DGEANT4_USE_INVENTOR=${if enableInventor then "ON" else "OFF"} 73 + -DGEANT4_USE_RAYTRACER_X11=${if enableRaytracerX11 then "ON" else "OFF"} 74 + -DGEANT4_USE_SYSTEM_CLHEP=${if clhep != null then "ON" else "OFF"} 75 + -DGEANT4_USE_SYSTEM_EXPAT=${if expat != null then "ON" else "OFF"} 76 + -DGEANT4_USE_SYSTEM_ZLIB=${if zlib != null then "ON" else "OFF"} 77 + ''; 78 + 79 + g4data = installData { 80 + inherit version src; 81 + }; 82 + 83 + enableParallelBuilding = true; 84 + buildInputs = [ cmake clhep expat zlib xercesc qt motif mesa x11 libXmu ]; 85 + propagatedBuildInputs = [ g4data clhep expat zlib xercesc qt motif mesa x11 libXmu ]; 86 + 87 + setupHook = ./setup-hook.sh; 88 + 89 + # Set the myriad of envars required by Geant4 if we use a nix-shell. 90 + shellHook = '' 91 + source $out/nix-support/setup-hook 92 + ''; 93 + 94 + meta = { 95 + description = "A toolkit for the simulation of the passage of particles through matter."; 96 + longDescription = '' 97 + Geant4 is a toolkit for the simulation of the passage of particles through matter. 98 + Its areas of application include high energy, nuclear and accelerator physics, as well as studies in medical and space science. 99 + The two main reference papers for Geant4 are published in Nuclear Instruments and Methods in Physics Research A 506 (2003) 250-303, and IEEE Transactions on Nuclear Science 53 No. 1 (2006) 270-278. 100 + ''; 101 + homepage = http://www.geant4.org; 102 + license = stdenv.lib.licenses.g4sl; 103 + maintainers = [ ]; 104 + platforms = stdenv.lib.platforms.all; 105 + }; 106 + }; 107 + 108 + installData = 109 + { version, src }: 110 + 111 + stdenv.mkDerivation rec { 112 + inherit version src; 113 + name = "g4data-${version}"; 114 + 115 + cmakeFlags = '' 116 + -DGEANT4_INSTALL_DATA="ON" 117 + ''; 118 + 119 + buildInputs = [ cmake expat ]; 120 + 121 + enableParallelBuilding = true; 122 + buildPhase = '' 123 + make G4EMLOW G4NDL G4NEUTRONXS G4PII G4SAIDDATA PhotonEvaporation RadioactiveDecay RealSurface 124 + ''; 125 + 126 + installPhase = '' 127 + mkdir -p $out/Geant4-${version} 128 + cp -R data/ $out/Geant4-${version} 129 + ''; 130 + 131 + meta = { 132 + description = "Data files for the Geant4 toolkit."; 133 + homepage = http://www.geant4.org; 134 + license = stdenv.lib.licenses.g4sl; 135 + maintainers = [ ]; 136 + platforms = stdenv.lib.platforms.all; 137 + }; 138 + }; 139 + 140 + fetchGeant4 = import ./fetch.nix { 141 + inherit stdenv fetchurl; 142 + }; 143 + 144 + in { 145 + 146 + ### VERSION 9.6 147 + 148 + v9_6 = buildGeant4 { 149 + inherit (fetchGeant4.v9_6) version src; 150 + }; 151 + 152 + v9_6_1 = buildGeant4 { 153 + inherit (fetchGeant4.v9_6_1) version src; 154 + }; 155 + 156 + v9_6_2 = buildGeant4 { 157 + inherit (fetchGeant4.v9_6_2) version src; 158 + }; 159 + 160 + v9_6_3 = buildGeant4 { 161 + inherit (fetchGeant4.v9_6_3) version src; 162 + }; 163 + 164 + ## VERSION 10.0 165 + 166 + v10_0 = buildGeant4 { 167 + inherit (fetchGeant4.v10_0) version src; 168 + multiThreadingCapable = true; 169 + }; 170 + 171 + v10_0_1 = buildGeant4 { 172 + inherit (fetchGeant4.v10_0_1) version src; 173 + multiThreadingCapable = true; 174 + }; 175 + 176 + v10_0_2 = buildGeant4 { 177 + inherit (fetchGeant4.v10_0_2) version src; 178 + multiThreadingCapable = true; 179 + }; 180 + } 181 +
+78
pkgs/development/libraries/physics/geant4/fetch.nix
··· 1 + { stdenv, fetchurl }: 2 + 3 + let 4 + fetch = { version, src ? builtins.getAttr stdenv.system sources, sources ? null }: 5 + { 6 + inherit version src; 7 + }; 8 + 9 + in { 10 + 11 + ### VERSION 9.6 12 + 13 + v9_6 = fetch { 14 + version = "9.6"; 15 + 16 + src = fetchurl{ 17 + url = "http://geant4.cern.ch/support/source/geant4.9.6.tar.gz"; 18 + sha256 = "3b1caf87664ef35cab25563b2911653701e98c75a9bd6c64f364d1a1213247e5"; 19 + }; 20 + }; 21 + 22 + v9_6_1 = fetch { 23 + version = "9.6.1"; 24 + 25 + src = fetchurl{ 26 + url = "http://geant4.cern.ch/support/source/geant4.9.6.p01.tar.gz"; 27 + sha256 = "575c45029afc2405d70c38e6dcfd1a752564b2540f33a922230039be81c8e4b6"; 28 + }; 29 + }; 30 + 31 + v9_6_2 = fetch { 32 + version = "9.6.2"; 33 + 34 + src = fetchurl{ 35 + url = "http://geant4.cern.ch/support/source/geant4.9.6.p02.tar.gz"; 36 + sha256 = "cf5df83b7e2c99e6729449b32d3ecb0727b4692317426b66fc7fd41951c7351f"; 37 + }; 38 + }; 39 + 40 + v9_6_3 = fetch { 41 + version = "9.6.3"; 42 + 43 + src = fetchurl{ 44 + url = "http://geant4.cern.ch/support/source/geant4.9.6.p03.tar.gz"; 45 + sha256 = "3a7e969039e8992716b3bc33b44cbdbff9c8d5850385f1a02fdd756a4fa6305c"; 46 + }; 47 + }; 48 + 49 + ### Version 10.0 50 + 51 + v10_0 = fetch { 52 + version = "10.0"; 53 + 54 + src = fetchurl{ 55 + url = "http://geant4.cern.ch/support/source/geant4.10.00.tar.gz"; 56 + sha256 = "ffec1714b03748b6d691eb0b91906f4c74422c1ad1f8afa918e03be421af8a17"; 57 + }; 58 + }; 59 + 60 + v10_0_1 = fetch { 61 + version = "10.0.1"; 62 + 63 + src = fetchurl{ 64 + url = "http://geant4.cern.ch/support/source/geant4.10.00.p01.tar.gz"; 65 + sha256 = "09c431ff3ef81034282c46501cea01046d4a20438c2ea2a7339576e1ecf26ba0"; 66 + }; 67 + }; 68 + 69 + v10_0_2 = fetch { 70 + version = "10.0.2"; 71 + 72 + src = fetchurl{ 73 + url = "http://geant4.cern.ch/support/source/geant4.10.00.p02.tar.gz"; 74 + sha256 = "9d615200901f1a5760970e8f5970625ea146253e4f7c5ad9df2a9cf84549e848"; 75 + }; 76 + }; 77 + } 78 +
+12
pkgs/development/libraries/physics/geant4/g4py/configure.patch
··· 1 + --- environments/g4py/configure 2014-03-17 22:47:05.000000000 +1100 2 + +++ environments/g4py/configure 2014-09-01 15:33:46.523637686 +1000 3 + @@ -4,9 +4,6 @@ 4 + # ====================================================================== 5 + export LANG=C 6 + 7 + -PATH=/bin:/usr/bin 8 + -export PATH 9 + - 10 + # ====================================================================== 11 + # testing the echo features 12 + # ======================================================================
+105
pkgs/development/libraries/physics/geant4/g4py/default.nix
··· 1 + { stdenv, fetchurl 2 + 3 + # The target version of Geant4 4 + , geant4 5 + 6 + # Python (obviously) and boost::python for wrapping. 7 + , python 8 + , boost 9 + }: 10 + 11 + let 12 + buildG4py = 13 + { version, src, geant4}: 14 + 15 + stdenv.mkDerivation rec { 16 + inherit version src geant4; 17 + name = "g4py-${version}"; 18 + 19 + # ./configure overwrites $PATH, which clobbers everything. 20 + patches = [ ./configure.patch ]; 21 + patchFlags = "-p0"; 22 + 23 + configurePhase = '' 24 + export PYTHONPATH=$PYTHONPATH:${geant4}/lib64:$prefix 25 + 26 + source ${geant4}/share/Geant4-*/geant4make/geant4make.sh 27 + cd environments/g4py 28 + 29 + ./configure linux64 --prefix=$prefix \ 30 + --with-g4install-dir=${geant4} \ 31 + --with-python-incdir=${python}/include/python${python.majorVersion} \ 32 + --with-python-libdir=${python}/lib \ 33 + --with-boost-incdir=${boost}/include \ 34 + --with-boost-libdir=${boost}/lib 35 + ''; 36 + 37 + enableParallelBuilding = true; 38 + buildInputs = [ geant4 boost python ]; 39 + 40 + setupHook = ./setup-hook.sh; 41 + 42 + # Make sure we set PYTHONPATH 43 + shellHook = '' 44 + source $out/nix-support/setup-hook 45 + ''; 46 + 47 + meta = { 48 + description = "Python bindings and utilities for Geant4."; 49 + longDescription = '' 50 + Geant4 is a toolkit for the simulation of the passage of particles through matter. 51 + Its areas of application include high energy, nuclear and accelerator physics, as well as studies in medical and space science. 52 + The two main reference papers for Geant4 are published in Nuclear Instruments and Methods in Physics Research A 506 (2003) 250-303, and IEEE Transactions on Nuclear Science 53 No. 1 (2006) 270-278. 53 + ''; 54 + homepage = http://www.geant4.org; 55 + license = stdenv.lib.licenses.g4sl; 56 + maintainers = [ ]; 57 + platforms = stdenv.lib.platforms.all; 58 + }; 59 + }; 60 + 61 + fetchGeant4 = import ../fetch.nix { 62 + inherit stdenv fetchurl; 63 + }; 64 + 65 + in { 66 + 67 + ### VERSION 9.6 68 + 69 + v9_6 = buildG4py { 70 + inherit (fetchGeant4.v9_6) version src; 71 + geant4 = geant4.v9_6; 72 + }; 73 + 74 + v9_6_1 = buildG4py { 75 + inherit (fetchGeant4.v9_6_1) version src; 76 + geant4 = geant4.v9_6_1; 77 + }; 78 + 79 + v9_6_2 = buildG4py { 80 + inherit (fetchGeant4.v9_6_2) version src; 81 + geant4 = geant4.v9_6_2; 82 + }; 83 + 84 + v9_6_3 = buildG4py { 85 + inherit (fetchGeant4.v9_6_3) version src; 86 + geant4 = geant4.v9_6_3; 87 + }; 88 + 89 + ## VERSION 10.0 90 + 91 + v10_0 = buildG4py { 92 + inherit (fetchGeant4.v10_0) version src; 93 + geant4 = geant4.v10_0; 94 + }; 95 + 96 + v10_0_1 = buildG4py { 97 + inherit (fetchGeant4.v10_0_1) version src; 98 + geant4 = geant4.v10_0_1; 99 + }; 100 + 101 + v10_0_2 = buildG4py { 102 + inherit (fetchGeant4.v10_0_2) version src; 103 + geant4 = geant4.v10_0_2; 104 + }; 105 + }
+1
pkgs/development/libraries/physics/geant4/g4py/setup-hook.sh
··· 1 + export PYTHONPATH=$PYTHONPATH:@out@/lib
+1
pkgs/development/libraries/physics/geant4/setup-hook.sh
··· 1 + source @out@/bin/geant4.sh
+34
pkgs/top-level/all-packages.nix
··· 11273 11273 11274 11274 xplanet = callPackage ../applications/science/astronomy/xplanet { }; 11275 11275 11276 + ### SCIENCE / PHYSICS 11277 + 11278 + geant4 = callPackage ../development/libraries/physics/geant4 { 11279 + enableMultiThreading = true; 11280 + enableG3toG4 = false; 11281 + enableInventor = false; 11282 + enableGDML = false; 11283 + enableQT = false; 11284 + enableXM = false; 11285 + enableOpenGLX11 = true; 11286 + enableRaytracerX11 = false; 11287 + 11288 + # Optional system packages, otherwise internal GEANT4 packages are used. 11289 + clhep = null; 11290 + expat = expat; 11291 + zlib = null; 11292 + 11293 + # For enableGDML. 11294 + xercesc = null; 11295 + 11296 + # For enableQT. 11297 + qt = null; # qt4SDK or qt5SDK 11298 + 11299 + # For enableXM. 11300 + motif = null; # motif or lesstif 11301 + 11302 + # For enableQT, enableXM, enableOpenGLX11, enableRaytracerX11. 11303 + mesa = mesa; 11304 + x11 = x11; 11305 + inherit (xlibs) libXmu; 11306 + }; 11307 + 11308 + g4py = callPackage ../development/libraries/physics/geant4/g4py { }; 11309 + 11276 11310 ### MISC 11277 11311 11278 11312 atari800 = callPackage ../misc/emulators/atari800 { };