summary refs log tree commit diff
path: root/pkgs/development/libraries/physics/rivet
diff options
context:
space:
mode:
authorDmitry Kalinkin <dmitry.kalinkin@gmail.com>2016-06-11 16:48:18 -0400
committerDmitry Kalinkin <dmitry.kalinkin@gmail.com>2016-10-19 02:17:02 -0400
commit334b9e2a406b526d74babc6c120ff68a31df51ed (patch)
tree5237d05b75d683b61fdd50666515bdb63dcb077d /pkgs/development/libraries/physics/rivet
parent571d1111feff1595b322c8574142a4c094cbda7f (diff)
downloadnixpkgs-334b9e2a406b526d74babc6c120ff68a31df51ed.tar
nixpkgs-334b9e2a406b526d74babc6c120ff68a31df51ed.tar.gz
nixpkgs-334b9e2a406b526d74babc6c120ff68a31df51ed.tar.bz2
nixpkgs-334b9e2a406b526d74babc6c120ff68a31df51ed.tar.lz
nixpkgs-334b9e2a406b526d74babc6c120ff68a31df51ed.tar.xz
nixpkgs-334b9e2a406b526d74babc6c120ff68a31df51ed.tar.zst
nixpkgs-334b9e2a406b526d74babc6c120ff68a31df51ed.zip
rivet: init at 2.5.0
Diffstat (limited to 'pkgs/development/libraries/physics/rivet')
-rw-r--r--pkgs/development/libraries/physics/rivet/default.nix73
-rw-r--r--pkgs/development/libraries/physics/rivet/key_val.patch12
-rw-r--r--pkgs/development/libraries/physics/rivet/zaxis_fix.patch42
3 files changed, 127 insertions, 0 deletions
diff --git a/pkgs/development/libraries/physics/rivet/default.nix b/pkgs/development/libraries/physics/rivet/default.nix
new file mode 100644
index 00000000000..bffc0a703bb
--- /dev/null
+++ b/pkgs/development/libraries/physics/rivet/default.nix
@@ -0,0 +1,73 @@
+{ stdenv, fetchurl, fastjet, ghostscript, gsl, hepmc, imagemagick, less, python, texlive, yoda, which, makeWrapper }:
+
+stdenv.mkDerivation rec {
+  name = "rivet-${version}";
+  version = "2.5.2";
+
+  src = fetchurl {
+    url = "http://www.hepforge.org/archive/rivet/Rivet-${version}.tar.bz2";
+    sha256 = "01agf0bswqvci8nwp67kvrlwc2k0sg1s0lxpq2a9q58l99v2gakh";
+  };
+
+  pythonPath = []; # python wrapper support
+
+  patches = [
+    ./key_val.patch
+    ./zaxis_fix.patch
+  ];
+
+  latex = texlive.combine { inherit (texlive)
+    scheme-basic
+    collection-pstricks
+    collection-fontsrecommended
+    mathastext
+    pgf
+    relsize
+    sfmath
+    xcolor
+    xkeyval
+    ;};
+  buildInputs = [ ghostscript hepmc imagemagick python latex makeWrapper ];
+  propagatedBuildInputs = [ fastjet gsl yoda ];
+
+  preInstall = ''
+    substituteInPlace bin/make-plots \
+      --replace '"which"' '"${which}/bin/which"' \
+      --replace '"latex"' '"${latex}/bin/latex"' \
+      --replace '"dvips"' '"${latex}/bin/dvips"' \
+      --replace '"ps2pdf"' '"${ghostscript}/bin/ps2pdf"' \
+      --replace '"ps2eps"' '"${ghostscript}/bin/ps2eps"' \
+      --replace '"kpsewhich"' '"${latex}/bin/kpsewhich"' \
+      --replace '"convert"' '"${imagemagick.out}/bin/convert"'
+    substituteInPlace bin/rivet \
+      --replace '"less"' '"${less}/bin/less"'
+    substituteInPlace bin/rivet-buildplugin \
+      --replace '"which"' '"${which}/bin/which"' \
+      --replace 'mycxx=' 'mycxx=${stdenv.cc}/bin/${if stdenv.cc.isClang or false then "clang++" else "g++"}  #' \
+      --replace 'mycxxflags="' "mycxxflags=\"-std=c++11 $NIX_CFLAGS_COMPILE $NIX_CXXSTDLIB_COMPILE $NIX_CFLAGS_LINK "
+    substituteInPlace bin/rivet-mkhtml \
+      --replace '"make-plots"' \"$out/bin/make-plots\" \
+      --replace '"rivet-cmphistos"' \"$out/bin/rivet-cmphistos\"
+  '';
+
+  configureFlags = [
+    "--with-fastjet=${fastjet}"
+    "--with-hepmc=${hepmc}"
+    "--with-yoda=${yoda}"
+  ];
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    for prog in "$out"/bin/*; do
+      wrapProgram "$prog" --set PYTHONPATH $PYTHONPATH:$(toPythonPath "$out")
+    done
+  '';
+
+  meta = {
+    description = "A framework for comparison of experimental measurements from high-energy particle colliders to theory predictions";
+    license     = stdenv.lib.licenses.gpl2;
+    homepage    = https://rivet.hepforge.org;
+    platforms   = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/pkgs/development/libraries/physics/rivet/key_val.patch b/pkgs/development/libraries/physics/rivet/key_val.patch
new file mode 100644
index 00000000000..0b24d703dac
--- /dev/null
+++ b/pkgs/development/libraries/physics/rivet/key_val.patch
@@ -0,0 +1,12 @@
+diff --git a/bin/rivet-cmphistos b/bin/rivet-cmphistos
+--- a/bin/rivet-cmphistos
++++ b/bin/rivet-cmphistos
+@@ -371,7 +371,7 @@ if __name__ == '__main__':
+         #     plot[key] = val
+         if plotoptions.has_key("PLOT"):
+             for key_val in plotoptions["PLOT"]:
+-                key, val = [s.strip() for s in key_val.split("=")]
++                key, val = [s.strip() for s in key_val.split("=", 1)]
+                 plot[key] = val
+         if opts.LINEAR:
+             plot['LogY'] = '0'
diff --git a/pkgs/development/libraries/physics/rivet/zaxis_fix.patch b/pkgs/development/libraries/physics/rivet/zaxis_fix.patch
new file mode 100644
index 00000000000..c255db565e6
--- /dev/null
+++ b/pkgs/development/libraries/physics/rivet/zaxis_fix.patch
@@ -0,0 +1,42 @@
+diff --git a/bin/make-plots b/bin/make-plots
+index abb024d..f59293d 100755
+--- a/bin/make-plots
++++ b/bin/make-plots
+@@ -1152,8 +1152,8 @@ class ColorScale(Described):
+ 
+         zcustommajortickmarks = int(self.description.get('ZMajorTickMarks', -1))
+         zcustomminortickmarks = int(self.description.get('ZMinorTickMarks', -1))
+-        zcustommajorticks=[]
+-        zcustomminorticks=[]
++        zcustommajorticks=None
++        zcustomminorticks=None
+         if self.description.has_key('ZCustomMajorTicks') and self.description['ZCustomMajorTicks']!='':
+             # TODO: Would be nice to have less invisible separation of the custom ticks than split on tabs
+             ticks = self.description['ZCustomMajorTicks'].strip().split('\t')
+@@ -2214,7 +2214,7 @@ class Ticks(object):
+ 
+ class XTicks(Ticks):
+ 
+-    def draw(self, custommajorticks=[], customminorticks=[], custommajortickmarks=-1, customminortickmarks=-1,drawlabels=True):
++    def draw(self, custommajorticks=None, customminorticks=None, custommajortickmarks=-1, customminortickmarks=-1,drawlabels=True):
+         twosided = bool(int(self.description.get('XTwosidedTicks', '0')))
+         out = ""
+         out += ('\n%\n% X-Ticks\n%\n')
+@@ -2265,7 +2265,7 @@ class XTicks(Ticks):
+ 
+ class YTicks(Ticks):
+ 
+-    def draw(self, custommajorticks=[], customminorticks=[], custommajortickmarks=-1, customminortickmarks=-1, drawlabels=True):
++    def draw(self, custommajorticks=None, customminorticks=None, custommajortickmarks=-1, customminortickmarks=-1, drawlabels=True):
+         twosided = bool(int(self.description.get('YTwosidedTicks', '0')))
+         out = ""
+         out += ('\n%\n% Y-Ticks\n%\n')
+@@ -2320,7 +2320,7 @@ class ZTicks(Ticks):
+         self.description = description
+         self.coors = coors
+ 
+-    def draw(self, custommajorticks=[], customminorticks=[],
++    def draw(self, custommajorticks=None, customminorticks=None,
+             custommajortickmarks=-1, customminortickmarks=-1,
+             drawlabels=True):
+         out = ""