Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchurl,
5 fastjet,
6 fastjet-contrib,
7 ghostscript,
8 graphicsmagick-imagemagick-compat,
9 hdf5,
10 hepmc3,
11 highfive,
12 less,
13 pkg-config,
14 python3,
15 rsync,
16 texliveBasic,
17 yoda,
18 which,
19 makeWrapper,
20}:
21
22stdenv.mkDerivation rec {
23 pname = "rivet";
24 version = "4.1.0";
25
26 src = fetchurl {
27 url = "https://www.hepforge.org/archive/rivet/Rivet-${version}.tar.bz2";
28 hash = "sha256-ZUijUaROWkMD+yJ351IWkKnYQZXfltkscHuBbztAyEM=";
29 };
30
31 latex = texliveBasic.withPackages (
32 ps: with ps; [
33 collection-pstricks
34 collection-fontsrecommended
35 l3kernel
36 l3packages
37 mathastext
38 pgf
39 relsize
40 sansmath
41 sfmath
42 siunitx
43 xcolor
44 xkeyval
45 xstring
46 ]
47 );
48
49 nativeBuildInputs = [
50 rsync
51 makeWrapper
52 pkg-config
53 ];
54 buildInputs = [
55 graphicsmagick-imagemagick-compat
56 hepmc3
57 highfive
58 python3
59 latex
60 python3.pkgs.yoda
61 ];
62 propagatedBuildInputs = [
63 hdf5
64 fastjet
65 fastjet-contrib
66 ];
67
68 preConfigure = ''
69 substituteInPlace configure \
70 --replace-fail 'if test $HEPMC_VERSION -le 310; then' 'if false; then'
71 substituteInPlace bin/rivet-build.in \
72 --replace-fail 'num_jobs=$(getconf _NPROCESSORS_ONLN)' 'num_jobs=''${NIX_BUILD_CORES:-$(getconf _NPROCESSORS_ONLN)}' \
73 --replace-fail 'which' '"${which}/bin/which"' \
74 --replace-fail 'mycxx=' 'mycxx=${stdenv.cc}/bin/${
75 if stdenv.cc.isClang or false then "clang++" else "g++"
76 } #' \
77 --replace-fail 'mycxxflags="' "mycxxflags=\"$NIX_CFLAGS_COMPILE $NIX_CXXSTDLIB_COMPILE $NIX_CFLAGS_LINK "
78 '';
79
80 preInstall = ''
81 substituteInPlace bin/make-plots \
82 --replace-fail '"which"' '"${which}/bin/which"' \
83 --replace-fail '"latex"' '"'$latex'/bin/latex"' \
84 --replace-fail '"dvips"' '"'$latex'/bin/dvips"' \
85 --replace-fail '"ps2pdf"' '"${ghostscript}/bin/ps2pdf"' \
86 --replace-fail '"ps2eps"' '"${ghostscript}/bin/ps2eps"' \
87 --replace-fail '"kpsewhich"' '"'$latex'/bin/kpsewhich"' \
88 --replace-fail '"convert"' '"${graphicsmagick-imagemagick-compat.out}/bin/convert"'
89 substituteInPlace bin/rivet \
90 --replace-fail '"less"' '"${less}/bin/less"'
91 substituteInPlace bin/rivet-mkhtml-tex \
92 --replace-fail '"make-plots"' \"$out/bin/make-plots\" \
93 --replace-fail '"rivet-cmphistos"' \"$out/bin/rivet-cmphistos\" \
94 --replace-fail 'ch_cmd = [sys.executable, os.path.join(os.path.dirname(__file__),' 'ch_cmd = [('
95 '';
96
97 configureFlags = [
98 "--with-fastjet=${fastjet}"
99 "--with-yoda=${yoda}"
100 "--with-hepmc3=${hepmc3}"
101 "--with-highfive=${highfive}"
102 ];
103
104 enableParallelBuilding = true;
105
106 postInstall = ''
107 for prog in "$out"/bin/*; do
108 wrapProgram "$prog" --set PYTHONPATH $PYTHONPATH:$(toPythonPath "$out")
109 done
110 '';
111
112 meta = {
113 description = "Framework for comparison of experimental measurements from high-energy particle colliders to theory predictions";
114 license = lib.licenses.gpl3;
115 homepage = "https://rivet.hepforge.org";
116 platforms = lib.platforms.unix;
117 maintainers = with lib.maintainers; [ veprbl ];
118 };
119}