2021-03-20 04:20:00 +00:00
|
|
|
{ lib, stdenv, fetchurl, fetchpatch, fastjet, fastjet-contrib, ghostscript, hepmc, imagemagick, less, python3, rsync, texlive, yoda, which, makeWrapper }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "rivet";
|
2020-12-25 13:55:36 +00:00
|
|
|
version = "3.1.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://www.hepforge.org/archive/rivet/Rivet-${version}.tar.bz2";
|
2020-12-25 13:55:36 +00:00
|
|
|
sha256 = "08g0f84l7r6vm4n7gn36qi3bzacscpv061m9xar2572vf10wxpak";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
./darwin.patch # configure relies on impure sw_vers to -Dunix
|
2021-03-20 04:20:00 +00:00
|
|
|
|
|
|
|
# fix compilation errors (fails depending on number of cores filesystem ordering?)
|
|
|
|
# https://gitlab.com/hepcedar/rivet/-/merge_requests/220
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://gitlab.com/hepcedar/rivet/commit/3203bf12a4bef81f880789eb9cde7ff489ae5115.diff";
|
|
|
|
sha256 = "0zn5yxlv6dk4vcqgz0syzb9mp4qc9smpmgshcqimcvii7qcp20mc";
|
|
|
|
})
|
|
|
|
# https://gitlab.com/hepcedar/rivet/-/merge_requests/223
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://gitlab.com/hepcedar/rivet/commit/476f267c46b126fa163a92aa6cbcb7806c4624c3.diff";
|
|
|
|
sha256 = "0dhkraddzp06v5z0d2wf0c8vsd50hl5pqsjgsrb8x14d0vwi8rnc";
|
|
|
|
})
|
|
|
|
|
|
|
|
# fix for new python and fix transparency gs 9.52
|
|
|
|
# gs 9.52 opacity fix
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://gitlab.com/hepcedar/rivet/commit/25c4bee19882fc56407b0a438f86e1a11753d5e6.diff";
|
|
|
|
sha256 = "18p2wk54r0qfq6l27z6805zq1z5jhk5sbxbjixgibzq8prj1a78v";
|
|
|
|
})
|
|
|
|
|
|
|
|
# make-plots: fix wrong logic in Plot.set_xmax()
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://gitlab.com/hepcedar/rivet/commit/d371c6c10cf67a41c0e4e27c16ff5723d6276ad2.diff";
|
|
|
|
sha256 = "0w622rd5darj7qafbbc84blznvy5rnhsdyr2n1i1fkz19mrf5h2p";
|
|
|
|
})
|
|
|
|
|
|
|
|
# fix https://gitlab.com/hepcedar/rivet/-/issues/200
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://gitlab.com/hepcedar/rivet/commit/442dbd17dcb3bd6e30b26e54c50f6a8237f966f9.diff";
|
|
|
|
includes = [ "bin/make-pgfplots" "bin/make-plots" "bin/make-plots-fast" ];
|
|
|
|
sha256 = "0c3rysgcib49km1zdpgsdai3xi4s6ijqgxp4whn04mrh3qf4bmr3";
|
|
|
|
})
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
latex = texlive.combine { inherit (texlive)
|
|
|
|
scheme-basic
|
|
|
|
collection-pstricks
|
|
|
|
collection-fontsrecommended
|
|
|
|
l3kernel
|
|
|
|
l3packages
|
|
|
|
mathastext
|
|
|
|
pgf
|
|
|
|
relsize
|
2021-02-22 21:28:39 +00:00
|
|
|
sansmath
|
2020-04-24 23:36:52 +00:00
|
|
|
sfmath
|
|
|
|
siunitx
|
|
|
|
xcolor
|
|
|
|
xkeyval
|
|
|
|
xstring
|
|
|
|
;};
|
2020-05-29 06:06:01 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [ rsync makeWrapper ];
|
|
|
|
buildInputs = [ hepmc imagemagick python3 latex python3.pkgs.yoda ];
|
|
|
|
propagatedBuildInputs = [ fastjet fastjet-contrib ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
preConfigure = ''
|
2020-05-29 06:06:01 +00:00
|
|
|
substituteInPlace bin/rivet-build.in \
|
|
|
|
--replace 'num_jobs=$(getconf _NPROCESSORS_ONLN)' 'num_jobs=''${NIX_BUILD_CORES:-$(getconf _NPROCESSORS_ONLN)}' \
|
2020-04-24 23:36:52 +00:00
|
|
|
--replace 'which' '"${which}/bin/which"' \
|
|
|
|
--replace 'mycxx=' 'mycxx=${stdenv.cc}/bin/${if stdenv.cc.isClang or false then "clang++" else "g++"} #' \
|
2020-05-29 06:06:01 +00:00
|
|
|
--replace 'mycxxflags="' "mycxxflags=\"$NIX_CFLAGS_COMPILE $NIX_CXXSTDLIB_COMPILE $NIX_CFLAGS_LINK "
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
preInstall = ''
|
|
|
|
substituteInPlace bin/make-plots \
|
|
|
|
--replace '"which"' '"${which}/bin/which"' \
|
2020-05-29 06:06:01 +00:00
|
|
|
--replace '"latex"' '"'$latex'/bin/latex"' \
|
|
|
|
--replace '"dvips"' '"'$latex'/bin/dvips"' \
|
2020-04-24 23:36:52 +00:00
|
|
|
--replace '"ps2pdf"' '"${ghostscript}/bin/ps2pdf"' \
|
|
|
|
--replace '"ps2eps"' '"${ghostscript}/bin/ps2eps"' \
|
2020-05-29 06:06:01 +00:00
|
|
|
--replace '"kpsewhich"' '"'$latex'/bin/kpsewhich"' \
|
2020-04-24 23:36:52 +00:00
|
|
|
--replace '"convert"' '"${imagemagick.out}/bin/convert"'
|
|
|
|
substituteInPlace bin/rivet \
|
|
|
|
--replace '"less"' '"${less}/bin/less"'
|
|
|
|
substituteInPlace bin/rivet-mkhtml \
|
|
|
|
--replace '"make-plots"' \"$out/bin/make-plots\" \
|
|
|
|
--replace '"rivet-cmphistos"' \"$out/bin/rivet-cmphistos\"
|
|
|
|
'';
|
|
|
|
|
|
|
|
configureFlags = [
|
|
|
|
"--with-fastjet=${fastjet}"
|
|
|
|
"--with-yoda=${yoda}"
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ (if lib.versions.major hepmc.version == "3" then [
|
2020-05-29 06:06:01 +00:00
|
|
|
"--with-hepmc3=${hepmc}"
|
|
|
|
] else [
|
|
|
|
"--with-hepmc=${hepmc}"
|
|
|
|
]);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
for prog in "$out"/bin/*; do
|
|
|
|
wrapProgram "$prog" --set PYTHONPATH $PYTHONPATH:$(toPythonPath "$out")
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "A framework for comparison of experimental measurements from high-energy particle colliders to theory predictions";
|
2020-05-29 06:06:01 +00:00
|
|
|
license = licenses.gpl3;
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://rivet.hepforge.org";
|
2020-05-29 06:06:01 +00:00
|
|
|
platforms = platforms.unix;
|
|
|
|
maintainers = with maintainers; [ veprbl ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|