2018-05-17 16:45:41 +00:00
|
|
|
{ enableMultiThreading ? true
|
2014-09-04 07:21:42 +00:00
|
|
|
, enableInventor ? false
|
2022-06-30 14:31:11 +00:00
|
|
|
, enableQT ? false # deprecated name
|
|
|
|
, enableQt ? enableQT
|
2014-09-04 07:21:42 +00:00
|
|
|
, enableXM ? false
|
2018-05-17 16:45:41 +00:00
|
|
|
, enableOpenGLX11 ? true
|
2020-06-06 18:24:13 +00:00
|
|
|
, enablePython ? false
|
2014-09-04 07:21:42 +00:00
|
|
|
, enableRaytracerX11 ? false
|
|
|
|
|
|
|
|
# Standard build environment with cmake.
|
2021-01-21 17:00:13 +00:00
|
|
|
, lib, stdenv, fetchurl, fetchpatch, cmake
|
2014-09-04 07:21:42 +00:00
|
|
|
|
2022-07-16 23:49:36 +00:00
|
|
|
, clhep
|
2018-05-17 16:45:41 +00:00
|
|
|
, expat
|
|
|
|
, xercesc
|
2022-06-30 14:24:20 +00:00
|
|
|
, zlib
|
2014-09-04 07:21:42 +00:00
|
|
|
|
2022-06-30 14:31:11 +00:00
|
|
|
# For enableQt.
|
2018-05-17 16:45:41 +00:00
|
|
|
, qtbase
|
2021-02-20 18:17:15 +00:00
|
|
|
, wrapQtAppsHook
|
2014-09-04 07:21:42 +00:00
|
|
|
|
|
|
|
# For enableXM.
|
2018-05-17 16:45:41 +00:00
|
|
|
, motif
|
2014-09-04 07:21:42 +00:00
|
|
|
|
2018-04-25 23:39:11 +00:00
|
|
|
# For enableInventor
|
|
|
|
, coin3d
|
|
|
|
, soxt
|
2018-05-17 16:45:41 +00:00
|
|
|
, libXpm
|
2018-04-25 23:39:11 +00:00
|
|
|
|
2022-06-30 14:31:11 +00:00
|
|
|
# For enableQt, enableXM, enableOpenGLX11, enableRaytracerX11.
|
2019-11-10 16:44:34 +00:00
|
|
|
, libGLU, libGL
|
2022-11-29 10:13:12 +00:00
|
|
|
, libXext
|
2018-05-17 16:45:41 +00:00
|
|
|
, libXmu
|
2020-06-06 18:24:13 +00:00
|
|
|
|
|
|
|
# For enablePython
|
|
|
|
, boost
|
|
|
|
, python3
|
2020-11-10 02:51:27 +00:00
|
|
|
|
|
|
|
# For tests
|
|
|
|
, callPackage
|
2014-09-04 07:21:42 +00:00
|
|
|
}:
|
|
|
|
|
2020-06-06 18:24:13 +00:00
|
|
|
let
|
|
|
|
boost_python = boost.override { enablePython = true; python = python3; };
|
|
|
|
in
|
|
|
|
|
2022-06-30 14:31:11 +00:00
|
|
|
lib.warnIf (enableQT != false) "geant4: enableQT is deprecated, please use enableQt"
|
|
|
|
|
2019-10-19 22:23:42 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2023-03-20 11:40:17 +00:00
|
|
|
version = "11.0.4";
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "geant4";
|
2018-05-16 21:09:07 +00:00
|
|
|
|
2023-03-20 11:40:17 +00:00
|
|
|
src = fetchurl {
|
2021-12-15 14:20:40 +00:00
|
|
|
url = "https://cern.ch/geant4-data/releases/geant4-v${version}.tar.gz";
|
2023-03-20 11:40:17 +00:00
|
|
|
hash = "sha256-4wofoo0vLPd8/9CFY8EonpL8R9mcg5Wa9H/ve9UDSyc=";
|
2014-09-04 07:21:42 +00:00
|
|
|
};
|
|
|
|
|
2018-05-16 21:09:07 +00:00
|
|
|
cmakeFlags = [
|
|
|
|
"-DGEANT4_INSTALL_DATA=OFF"
|
2022-06-30 14:24:20 +00:00
|
|
|
"-DGEANT4_USE_GDML=ON"
|
|
|
|
"-DGEANT4_USE_G3TOG4=ON"
|
2022-06-30 14:31:11 +00:00
|
|
|
"-DGEANT4_USE_QT=${if enableQt then "ON" else "OFF"}"
|
2018-05-16 21:09:07 +00:00
|
|
|
"-DGEANT4_USE_XM=${if enableXM then "ON" else "OFF"}"
|
|
|
|
"-DGEANT4_USE_OPENGL_X11=${if enableOpenGLX11 then "ON" else "OFF"}"
|
|
|
|
"-DGEANT4_USE_INVENTOR=${if enableInventor then "ON" else "OFF"}"
|
2020-06-06 18:24:13 +00:00
|
|
|
"-DGEANT4_USE_PYTHON=${if enablePython then "ON" else "OFF"}"
|
2018-05-16 21:09:07 +00:00
|
|
|
"-DGEANT4_USE_RAYTRACER_X11=${if enableRaytracerX11 then "ON" else "OFF"}"
|
2022-07-16 23:49:36 +00:00
|
|
|
"-DGEANT4_USE_SYSTEM_CLHEP=ON"
|
2022-06-30 14:24:20 +00:00
|
|
|
"-DGEANT4_USE_SYSTEM_EXPAT=ON"
|
|
|
|
"-DGEANT4_USE_SYSTEM_ZLIB=ON"
|
2018-05-16 21:09:07 +00:00
|
|
|
"-DGEANT4_BUILD_MULTITHREADED=${if enableMultiThreading then "ON" else "OFF"}"
|
2022-06-16 21:06:37 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
"-DXQuartzGL_INCLUDE_DIR=${libGL.dev}/include"
|
|
|
|
"-DXQuartzGL_gl_LIBRARY=${libGL}/lib/libGL.dylib"
|
2021-01-21 17:00:13 +00:00
|
|
|
] ++ lib.optionals (enableMultiThreading && enablePython) [
|
2020-06-06 18:24:13 +00:00
|
|
|
"-DGEANT4_BUILD_TLS_MODEL=global-dynamic"
|
2021-01-21 17:00:13 +00:00
|
|
|
] ++ lib.optionals enableInventor [
|
2018-05-16 21:09:07 +00:00
|
|
|
"-DINVENTOR_INCLUDE_DIR=${coin3d}/include"
|
|
|
|
"-DINVENTOR_LIBRARY_RELEASE=${coin3d}/lib/libCoin.so"
|
|
|
|
];
|
|
|
|
|
2021-02-20 18:17:15 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
];
|
|
|
|
|
2022-06-30 14:34:18 +00:00
|
|
|
propagatedNativeBuildInputs = lib.optionals enableQt [
|
|
|
|
wrapQtAppsHook
|
|
|
|
];
|
|
|
|
dontWrapQtApps = true; # no binaries
|
2020-02-03 03:58:00 +00:00
|
|
|
|
2022-11-29 10:13:12 +00:00
|
|
|
buildInputs = [ libGLU libXext libXmu ]
|
2021-01-21 17:00:13 +00:00
|
|
|
++ lib.optionals enableInventor [ libXpm coin3d soxt motif ]
|
|
|
|
++ lib.optionals enablePython [ boost_python python3 ];
|
2020-02-03 03:58:00 +00:00
|
|
|
|
2022-08-16 19:06:43 +00:00
|
|
|
propagatedBuildInputs = [ clhep expat xercesc zlib libGL ]
|
2021-01-21 17:00:13 +00:00
|
|
|
++ lib.optionals enableXM [ motif ]
|
2022-06-30 14:31:11 +00:00
|
|
|
++ lib.optionals enableQt [ qtbase ];
|
2018-05-16 21:09:07 +00:00
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
# Don't try to export invalid environment variables.
|
|
|
|
sed -i 's/export G4\([A-Z]*\)DATA/#export G4\1DATA/' "$out"/bin/geant4.sh
|
2022-06-30 14:31:11 +00:00
|
|
|
'' + lib.optionalString enableQt ''
|
2021-02-20 18:17:15 +00:00
|
|
|
wrapQtAppsHook
|
2018-05-16 21:09:07 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
setupHook = ./geant4-hook.sh;
|
|
|
|
|
|
|
|
passthru = {
|
2022-06-30 15:26:16 +00:00
|
|
|
data = callPackage ./datasets.nix {};
|
2020-11-10 02:51:27 +00:00
|
|
|
|
|
|
|
tests = callPackage ./tests.nix {};
|
2022-06-30 14:32:46 +00:00
|
|
|
|
|
|
|
inherit enableQt;
|
2014-09-04 07:21:42 +00:00
|
|
|
};
|
2018-04-25 23:39:11 +00:00
|
|
|
|
2018-05-16 21:09:07 +00:00
|
|
|
# Set the myriad of envars required by Geant4 if we use a nix-shell.
|
|
|
|
shellHook = ''
|
|
|
|
source $out/nix-support/setup-hook
|
|
|
|
'';
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2022-05-29 10:10:05 +00:00
|
|
|
broken = (stdenv.isLinux && stdenv.isAarch64);
|
2018-05-16 21:09:07 +00:00
|
|
|
description = "A toolkit for the simulation of the passage of particles through matter";
|
|
|
|
longDescription = ''
|
|
|
|
Geant4 is a toolkit for the simulation of the passage of particles through matter.
|
|
|
|
Its areas of application include high energy, nuclear and accelerator physics, as well as studies in medical and space science.
|
|
|
|
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.
|
|
|
|
'';
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "http://www.geant4.org";
|
2018-05-16 21:09:07 +00:00
|
|
|
license = licenses.g4sl;
|
2022-06-16 21:06:14 +00:00
|
|
|
maintainers = with maintainers; [ omnipotententity veprbl ];
|
2022-06-16 21:06:37 +00:00
|
|
|
platforms = platforms.unix;
|
2018-04-25 23:39:11 +00:00
|
|
|
};
|
|
|
|
}
|