nixpkgs/pkgs/development/libraries/physics/rivet/default.nix

85 lines
2.7 KiB
Nix
Raw Normal View History

2019-11-18 21:04:36 +00:00
{ stdenv, fetchurl, fastjet, fastjet-contrib, ghostscript, gsl, hepmc, imagemagick, less, python3, rsync, texlive, yoda, which, makeWrapper }:
2016-06-11 21:48:18 +01:00
stdenv.mkDerivation rec {
pname = "rivet";
2019-11-18 21:04:36 +00:00
version = "3.1.1";
2016-06-11 21:48:18 +01:00
src = fetchurl {
url = "https://www.hepforge.org/archive/rivet/Rivet-${version}.tar.bz2";
2019-11-18 21:04:36 +00:00
sha256 = "1cgr9jyfd9r7dwbk8fr3rys5dc74cmbx368441jvqngqymmb563w";
2016-06-11 21:48:18 +01:00
};
2017-01-07 08:00:04 +00:00
patches = [
./darwin.patch # configure relies on impure sw_vers to -Dunix
];
2016-06-11 21:48:18 +01:00
latex = texlive.combine { inherit (texlive)
scheme-basic
collection-pstricks
collection-fontsrecommended
2019-06-10 23:00:18 +01:00
l3kernel
l3packages
2016-06-11 21:48:18 +01:00
mathastext
pgf
relsize
sfmath
2019-06-10 23:00:18 +01:00
siunitx
2016-06-11 21:48:18 +01:00
xcolor
xkeyval
2019-06-10 23:00:18 +01:00
xstring
2016-06-11 21:48:18 +01:00
;};
2019-11-18 21:04:36 +00:00
nativeBuildInputs = [ rsync makeWrapper ];
buildInputs = [ hepmc imagemagick python3 latex python3.pkgs.yoda ];
propagatedBuildInputs = [ fastjet fastjet-contrib ];
2016-06-11 21:48:18 +01:00
2017-12-23 23:13:03 +00:00
preConfigure = ''
2019-11-18 21:04:36 +00:00
substituteInPlace bin/rivet-build.in \
--replace 'num_jobs=$(getconf _NPROCESSORS_ONLN)' 'num_jobs=''${NIX_BUILD_CORES:-$(getconf _NPROCESSORS_ONLN)}' \
2019-02-18 17:42:40 +00:00
--replace 'which' '"${which}/bin/which"' \
2017-12-23 23:13:03 +00:00
--replace 'mycxx=' 'mycxx=${stdenv.cc}/bin/${if stdenv.cc.isClang or false then "clang++" else "g++"} #' \
2019-11-18 21:04:36 +00:00
--replace 'mycxxflags="' "mycxxflags=\"$NIX_CFLAGS_COMPILE $NIX_CXXSTDLIB_COMPILE $NIX_CFLAGS_LINK "
2017-12-23 23:13:03 +00:00
'';
2016-06-11 21:48:18 +01:00
preInstall = ''
substituteInPlace bin/make-plots \
--replace '"which"' '"${which}/bin/which"' \
2019-11-18 21:04:36 +00:00
--replace '"latex"' '"'$latex'/bin/latex"' \
--replace '"dvips"' '"'$latex'/bin/dvips"' \
2016-06-11 21:48:18 +01:00
--replace '"ps2pdf"' '"${ghostscript}/bin/ps2pdf"' \
--replace '"ps2eps"' '"${ghostscript}/bin/ps2eps"' \
2019-11-18 21:04:36 +00:00
--replace '"kpsewhich"' '"'$latex'/bin/kpsewhich"' \
2016-06-11 21:48:18 +01: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}"
2019-11-18 21:04:36 +00:00
] ++ (if stdenv.lib.versions.major hepmc.version == "3" then [
"--with-hepmc3=${hepmc}"
] else [
"--with-hepmc=${hepmc}"
]);
2016-06-11 21:48:18 +01:00
enableParallelBuilding = true;
postInstall = ''
for prog in "$out"/bin/*; do
wrapProgram "$prog" --set PYTHONPATH $PYTHONPATH:$(toPythonPath "$out")
done
'';
2019-11-18 19:41:17 +00:00
meta = with stdenv.lib; {
2016-06-11 21:48:18 +01:00
description = "A framework for comparison of experimental measurements from high-energy particle colliders to theory predictions";
2019-11-18 19:41:17 +00:00
license = licenses.gpl3;
homepage = "https://rivet.hepforge.org";
2019-11-18 19:41:17 +00:00
platforms = platforms.unix;
maintainers = with maintainers; [ veprbl ];
2016-06-11 21:48:18 +01:00
};
}