12 pythonVersion = with lib.versions; "${major python.version}${minor python.version}";
13 withPython = python != null;
14 # ensure that root is built with the same python interpreter, as it links against numpy
15 root_py = if withPython then root.override { python3 = python; } else root;
18 stdenv.mkDerivation rec {
23 url = "http://hepmc.web.cern.ch/hepmc/releases/HepMC3-${version}.tar.gz";
24 sha256 = "sha256-b4dgke3PfubQwNsE4IAFbonvwaYavmI1XZfOjnNXadY=";
29 ] ++ lib.optional withPython python.pkgs.pythonImportsCheckHook;
33 ] ++ lib.optional withPython python;
35 # error: invalid version number in 'MACOSX_DEPLOYMENT_TARGET=11.0'
38 (stdenv.hostPlatform.isDarwin && lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11")
40 MACOSX_DEPLOYMENT_TARGET=10.16
45 "-DHEPMC3_CXX_STANDARD=17"
46 "-DHEPMC3_ENABLE_PYTHON=${if withPython then "ON" else "OFF"}"
48 ++ lib.optionals withPython [
49 "-DHEPMC3_PYTHON_VERSIONS=${if python.isPy3k then "3.X" else "2.X"}"
50 "-DHEPMC3_Python_SITEARCH${pythonVersion}=${placeholder "out"}/${python.sitePackages}"
54 substituteInPlace "$out"/bin/HepMC3-config \
55 --replace-fail '$(greadlink' '$(${coreutils}/bin/readlink' \
56 --replace-fail '$(readlink' '$(${coreutils}/bin/readlink'
59 pythonImportsCheck = [ "pyHepMC3" ];
62 description = "HepMC package is an object oriented, C++ event record for High Energy Physics Monte Carlo generators and simulation";
63 mainProgram = "HepMC3-config";
64 license = licenses.gpl3;
65 homepage = "http://hepmc.web.cern.ch/hepmc/";
66 platforms = platforms.unix;
67 maintainers = with maintainers; [ veprbl ];