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
11let
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.dev}/include \
34 --with-boost-libdir=${boost.out}/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
51 through matter. Its areas of application include high energy,
52 nuclear and accelerator physics, as well as studies in medical and
53 space science. The two main reference papers for Geant4 are
54 published in Nuclear Instruments and Methods in Physics Research A
55 506 (2003) 250-303, and IEEE Transactions on Nuclear Science 53 No. 1
56 (2006) 270-278.
57 '';
58 homepage = http://www.geant4.org;
59 license = stdenv.lib.licenses.g4sl;
60 maintainers = [ ];
61 platforms = stdenv.lib.platforms.all;
62 };
63 };
64
65 fetchGeant4 = import ../fetch.nix {
66 inherit stdenv fetchurl;
67 };
68
69in {
70 v10_0_2 = buildG4py {
71 inherit (fetchGeant4.v10_0_2) version src;
72 geant4 = geant4.v10_0_2;
73 };
74}