about summary refs log tree commit diff
path: root/pkgs/applications/science
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/science')
-rw-r--r--pkgs/applications/science/biology/EZminc/default.nix32
-rw-r--r--pkgs/applications/science/biology/N3/default.nix38
-rw-r--r--pkgs/applications/science/biology/inormalize/default.nix39
-rw-r--r--pkgs/applications/science/biology/inormalize/lgmask-interp.patch10
-rw-r--r--pkgs/applications/science/biology/inormalize/nu_correct_norm-interp.patch10
-rw-r--r--pkgs/applications/science/biology/minc-tools/default.nix27
-rw-r--r--pkgs/applications/science/biology/minc-widgets/default.nix34
-rw-r--r--pkgs/applications/science/biology/mni_autoreg/default.nix36
-rw-r--r--pkgs/applications/science/biology/picard-tools/default.nix4
-rw-r--r--pkgs/applications/science/chemistry/jmol/default.nix44
-rw-r--r--pkgs/applications/science/chemistry/octopus/default.nix4
-rw-r--r--pkgs/applications/science/logic/coq/default.nix9
-rw-r--r--pkgs/applications/science/machine-learning/shogun/default.nix4
-rw-r--r--pkgs/applications/science/math/R/default.nix7
-rw-r--r--pkgs/applications/science/math/calc/default.nix62
-rw-r--r--pkgs/applications/science/math/giac/default.nix23
-rw-r--r--pkgs/applications/science/math/lrcalc/default.nix41
-rw-r--r--pkgs/applications/science/math/mathematica/default.nix23
-rw-r--r--pkgs/applications/science/math/mathematica/l10ns.nix33
-rw-r--r--pkgs/applications/science/math/maxima/default.nix4
-rw-r--r--pkgs/applications/science/math/maxima/known-ecl-failures.patch21
-rw-r--r--pkgs/applications/science/math/palp/default.nix67
-rw-r--r--pkgs/applications/science/math/pari/default.nix20
-rw-r--r--pkgs/applications/science/math/pari/unstable.nix31
-rw-r--r--pkgs/applications/science/math/pynac/default.nix47
-rw-r--r--pkgs/applications/science/math/singular/default.nix21
-rw-r--r--pkgs/applications/science/misc/cytoscape/default.nix4
-rw-r--r--pkgs/applications/science/misc/motu-client/default.nix6
28 files changed, 588 insertions, 113 deletions
diff --git a/pkgs/applications/science/biology/EZminc/default.nix b/pkgs/applications/science/biology/EZminc/default.nix
new file mode 100644
index 000000000000..20d88eb3aafb
--- /dev/null
+++ b/pkgs/applications/science/biology/EZminc/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, cmake, libminc, bicpl, itk, fftwFloat, gsl }:
+
+stdenv.mkDerivation rec { pname = "EZminc";
+  name  = "${pname}-2017-08-29";
+
+  src = fetchFromGitHub {
+    owner  = "BIC-MNI";
+    repo   = pname;
+    rev    = "4e017236cb6e7f6e07507446b18b759c584b6fc3";
+    sha256 = "1pg06x42pgsg7zy7dz9wf6ajakkm2n8by64lg9z64qi8qqy82b8v";
+  };
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ itk libminc bicpl fftwFloat gsl ];
+
+  cmakeFlags = [ "-DLIBMINC_DIR=${libminc}/lib/"
+                 "-DEZMINC_BUILD_TOOLS=TRUE"
+                 "-DEZMINC_BUILD_MRFSEG=TRUE"
+                 "-DEZMINC_BUILD_DD=TRUE" ];
+
+  checkPhase = "ctest --output-on-failure ../tests/";  # but ctest doesn't find the tests ...
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/BIC-MNI/${pname}";
+    description = "Collection of Perl and shell scripts for processing MINC files";
+    maintainers = with maintainers; [ bcdarwin ];
+    platforms = platforms.unix;
+    license = licenses.free;
+  };
+}
diff --git a/pkgs/applications/science/biology/N3/default.nix b/pkgs/applications/science/biology/N3/default.nix
new file mode 100644
index 000000000000..c14846beec2f
--- /dev/null
+++ b/pkgs/applications/science/biology/N3/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, cmake, makeWrapper,
+  perl, MNI-Perllib, GetoptTabular,
+  libminc, EBTKS }:
+
+stdenv.mkDerivation rec {
+  pname = "N3";
+  name  = "${pname}-2017-09-18";
+
+  src = fetchFromGitHub {
+    owner  = "BIC-MNI";
+    repo   = pname;
+    rev    = "2fdd939f0f2b24a4039bc6a8ade4a190a1d8e75d";
+    sha256 = "13z21c4r09hna3q1csvcn4i7ws5ixbdaja6ch421xv6nydjh2w5g";
+  };
+
+  nativeBuildInputs = [ cmake makeWrapper ];
+  buildInputs = [ libminc EBTKS ];
+  propagatedBuildInputs = [ perl MNI-Perllib GetoptTabular ];
+
+  cmakeFlags = [ "-DLIBMINC_DIR=${libminc}/lib/" "-DEBTKS_DIR=${EBTKS}/lib/" ];
+
+  checkPhase = "ctest --output-on-failure";
+  # don't run the tests as they fail at least due to missing program wrappers in this phase ...
+
+  postFixup = ''
+    for p in $out/bin/*; do
+      wrapProgram $p --prefix PERL5LIB : $PERL5LIB
+    done
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/BIC-MNI/${pname}";
+    description = "MRI non-uniformity correction for MINC files";
+    maintainers = with maintainers; [ bcdarwin ];
+    platforms = platforms.unix;
+    license   = licenses.free;
+  };
+}
diff --git a/pkgs/applications/science/biology/inormalize/default.nix b/pkgs/applications/science/biology/inormalize/default.nix
new file mode 100644
index 000000000000..f17143ad06bb
--- /dev/null
+++ b/pkgs/applications/science/biology/inormalize/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchFromGitHub, cmake, makeWrapper,
+  perl, GetoptTabular, MNI-Perllib,
+  libminc, EBTKS }:
+
+stdenv.mkDerivation rec {
+  pname = "inormalize";
+  name  = "${pname}-2014-10-21";
+
+  src = fetchFromGitHub {
+    owner  = "BIC-MNI";
+    repo   = pname;
+    rev    = "79cea9cdfe7b99abfd40afda89ab2253b596ad2f";
+    sha256 = "1ahqv5q0ljvji99a5q8azjkdf6bgp6nr8lwivkqwqs3jm0k5clq7";
+  };
+
+  patches = [ ./lgmask-interp.patch ./nu_correct_norm-interp.patch ];
+
+  nativeBuildInputs = [ cmake makeWrapper ];
+  buildInputs = [ libminc EBTKS ];
+  propagatedBuildInputs = [ perl GetoptTabular MNI-Perllib ];
+
+  cmakeFlags = [ "-DLIBMINC_DIR=${libminc}/lib/" "-DEBTKS_DIR=${EBTKS}/lib/" ];
+
+  checkPhase = "ctest --output-on-failure";  # but no tests
+
+  postFixup = ''
+    for p in $out/bin/*; do
+      wrapProgram $p --prefix PERL5LIB : $PERL5LIB
+    done
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/BIC-MNI/${pname}";
+    description = "Program to normalize intensity of MINC files";
+    maintainers = with maintainers; [ bcdarwin ];
+    platforms = platforms.unix;
+    license   = licenses.free;
+  };
+}
diff --git a/pkgs/applications/science/biology/inormalize/lgmask-interp.patch b/pkgs/applications/science/biology/inormalize/lgmask-interp.patch
new file mode 100644
index 000000000000..953bce9a1848
--- /dev/null
+++ b/pkgs/applications/science/biology/inormalize/lgmask-interp.patch
@@ -0,0 +1,10 @@
+diff --git a/lgmask.in b/lgmask.in
+index 17dbe4d..2195d91 100644
+--- a/lgmask.in
++++ b/lgmask.in
+@@ -1,4 +1,4 @@
+-#! @PERL@
++#! /usr/bin/env perl
+ 
+ #---------------------------------------------------------------------------
+ #@COPYRIGHT :
diff --git a/pkgs/applications/science/biology/inormalize/nu_correct_norm-interp.patch b/pkgs/applications/science/biology/inormalize/nu_correct_norm-interp.patch
new file mode 100644
index 000000000000..75dc46a799ce
--- /dev/null
+++ b/pkgs/applications/science/biology/inormalize/nu_correct_norm-interp.patch
@@ -0,0 +1,10 @@
+diff --git a/nu_correct_norm.in b/nu_correct_norm.in
+index 1dc84ac..1bc6235 100644
+--- a/nu_correct_norm.in
++++ b/nu_correct_norm.in
+@@ -1,4 +1,4 @@
+-#! @PERL@
++#! /usr/bin/perl
+  
+ #---------------------------------------------------------------------------
+ #@COPYRIGHT :
diff --git a/pkgs/applications/science/biology/minc-tools/default.nix b/pkgs/applications/science/biology/minc-tools/default.nix
index 7864658c9582..8e1f74686d1f 100644
--- a/pkgs/applications/science/biology/minc-tools/default.nix
+++ b/pkgs/applications/science/biology/minc-tools/default.nix
@@ -1,23 +1,29 @@
-{ stdenv, fetchFromGitHub, perl, cmake, flex, bison, libminc }:
+{ stdenv, fetchFromGitHub, cmake, makeWrapper, flex, bison, perl, TextFormat, libminc, libjpeg, zlib }:
 
 stdenv.mkDerivation rec {
-  name = "${pname}-2.3.00";
   pname = "minc-tools";
+  name  = "${pname}-2017-09-11";
 
   src = fetchFromGitHub {
-    owner = "BIC-MNI";
-    repo = pname;
-    rev = builtins.replaceStrings [ "." ] [ "-" ] name;
-    sha256 = "0px5paprx4ds9aln3jdg1pywszgyz2aykgkdbj1y8gc1lwcizsl9";
+    owner  = "BIC-MNI";
+    repo   = pname;
+    rev    = "5b7c40425cd4f67a018055cb85c0157ee50a3056";
+    sha256 = "0zkcs05svp1gj5h0cdgc0k20c7lrk8m7wg3ks3xc5mkaiannj8g7";
   };
 
-  nativeBuildInputs = [ cmake flex bison ] ++ (if doCheck then [ perl ] else [ ]);
-  buildInputs = [ libminc ];
+  nativeBuildInputs = [ cmake flex bison makeWrapper ];
+  buildInputs = [ libminc libjpeg zlib ];
+  propagatedBuildInputs = [ perl TextFormat ];
 
   cmakeFlags = [ "-DLIBMINC_DIR=${libminc}/lib/" ];
 
-  checkPhase = "ctest";
-  doCheck = false;
+  checkPhase = "ctest --output-on-failure";  # still some weird test failures though
+
+  postFixup = ''
+    for prog in minccomplete minchistory mincpik; do
+      wrapProgram $out/bin/$prog --prefix PERL5LIB : $PERL5LIB
+    done
+  '';
 
   enableParallelBuilding = true;
 
@@ -26,5 +32,6 @@ stdenv.mkDerivation rec {
     description = "Command-line utilities for working with MINC files";
     maintainers = with maintainers; [ bcdarwin ];
     platforms = platforms.unix;
+    license   = licenses.free;
   };
 }
diff --git a/pkgs/applications/science/biology/minc-widgets/default.nix b/pkgs/applications/science/biology/minc-widgets/default.nix
new file mode 100644
index 000000000000..9084dfb2e1c3
--- /dev/null
+++ b/pkgs/applications/science/biology/minc-widgets/default.nix
@@ -0,0 +1,34 @@
+{ stdenv, fetchFromGitHub, cmake, makeWrapper,
+  perl, GetoptTabular, MNI-Perllib,
+  libminc, octave, coreutils, minc_tools }:
+
+stdenv.mkDerivation rec {
+  pname = "minc-widgets";
+  name  = "${pname}-2016-04-20";
+
+
+  src = fetchFromGitHub {
+    owner  = "BIC-MNI";
+    repo   = pname;
+    rev    = "f08b643894c81a1a2e0fbfe595a17a42ba8906db";
+    sha256 = "1b9g6lf37wpp211ikaji4rf74rl9xcmrlyqcw1zq3z12ji9y33bm";
+  };
+
+  nativeBuildInputs = [ cmake makeWrapper ];
+  buildInputs = [ libminc ];
+  propagatedBuildInputs = [ perl GetoptTabular MNI-Perllib octave coreutils minc_tools ];
+
+  postFixup = ''
+    for p in $out/bin/*; do
+      wrapProgram $p --prefix PERL5LIB : $PERL5LIB --set PATH "${stdenv.lib.makeBinPath [ coreutils minc_tools ]}";
+    done
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/BIC-MNI/${pname}";
+    description = "Collection of Perl and shell scripts for processing MINC files";
+    maintainers = with maintainers; [ bcdarwin ];
+    platforms = platforms.unix;
+    license = licenses.free;
+  };
+}
diff --git a/pkgs/applications/science/biology/mni_autoreg/default.nix b/pkgs/applications/science/biology/mni_autoreg/default.nix
new file mode 100644
index 000000000000..076ecd03a1b1
--- /dev/null
+++ b/pkgs/applications/science/biology/mni_autoreg/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub, cmake, makeWrapper, perl, GetoptTabular, MNI-Perllib, libminc }:
+
+stdenv.mkDerivation rec {
+  pname = "mni_autoreg";
+  name  = "${pname}-2017-09-22";
+
+  src = fetchFromGitHub {
+    owner = "BIC-MNI";
+    repo = pname;
+    rev = "ab99e29987dc029737785baebf24896ec37a2d76";
+    sha256 = "0axl069nv57vmb2wvqq7s9v3bfxwspzmk37bxm4973ai1irgppjq";
+  };
+
+  nativeBuildInputs = [ cmake makeWrapper ];
+  buildInputs = [ libminc ];
+  propagatedBuildInputs = [ perl GetoptTabular MNI-Perllib ];
+
+  cmakeFlags = [ "-DLIBMINC_DIR=${libminc}/lib/" "-DBUILD_TESTING=FALSE" ];
+  # testing broken: './minc_wrapper: Permission denied' from Testing/ellipse0.mnc
+
+  postFixup = ''
+    for prog in autocrop mritoself mritotal xfmtool; do
+      echo $out/bin/$prog
+      wrapProgram $out/bin/$prog --prefix PERL5LIB : $PERL5LIB;
+    done
+  '';
+
+  meta = with stdenv.lib; {
+    homepage = https://github.com/BIC-MNI/mni_autoreg;
+    description = "Tools for automated registration using the MINC image format";
+    maintainers = with maintainers; [ bcdarwin ];
+    platforms = platforms.unix;
+    license = licenses.free;
+  };
+}
+
diff --git a/pkgs/applications/science/biology/picard-tools/default.nix b/pkgs/applications/science/biology/picard-tools/default.nix
index 3fc84228efe9..7af1669dc45e 100644
--- a/pkgs/applications/science/biology/picard-tools/default.nix
+++ b/pkgs/applications/science/biology/picard-tools/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "picard-tools-${version}";
-  version = "2.18.1";
+  version = "2.18.2";
 
   src = fetchurl {
     url = "https://github.com/broadinstitute/picard/releases/download/${version}/picard.jar";
-    sha256 = "0wcihlgaif79r0fa47kq77igxzq0lpyn74414v9n6k9rl5nj8x1a";
+    sha256 = "0w3b2jz4n9irslsg85r4x9dc3y4ziykn8fs4iqqiq4sfdcz259fz";
   };
 
   buildInputs = [ jre makeWrapper ];
diff --git a/pkgs/applications/science/chemistry/jmol/default.nix b/pkgs/applications/science/chemistry/jmol/default.nix
new file mode 100644
index 000000000000..c85e1143d103
--- /dev/null
+++ b/pkgs/applications/science/chemistry/jmol/default.nix
@@ -0,0 +1,44 @@
+{ stdenv
+, fetchurl
+, unzip
+, jre
+}:
+
+stdenv.mkDerivation rec {
+  version = "${baseVersion}.${patchVersion}";
+  baseVersion = "14.29";
+  patchVersion = "12";
+  pname = "jmol";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/jmol/Jmol/Version%20${baseVersion}/Jmol%20${version}/Jmol-${version}-binary.tar.gz";
+    sha256 = "1ndq9am75janshrnk26334z1nmyh3k4bp20napvf2zv0lfp8k3bv";
+  };
+
+  buildInputs = [
+    jre
+  ];
+
+  installPhase = ''
+    mkdir -p "$out/share/jmol"
+    mkdir -p "$out/bin"
+
+    ${unzip}/bin/unzip jsmol.zip -d "$out/share/"
+
+    sed -i -e 's|command=java|command=${jre}/bin/java|' jmol.sh
+    cp *.jar jmol.sh "$out/share/jmol"
+    ln -s $out/share/jmol/jmol.sh "$out/bin/jmol"
+  '';
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+     description = "A Java 3D viewer for chemical structures";
+     homepage = https://sourceforge.net/projects/jmol;
+     license = licenses.lgpl2;
+     platforms = platforms.all;
+     maintainers = with maintainers; [ timokau ];
+  };
+}
+
diff --git a/pkgs/applications/science/chemistry/octopus/default.nix b/pkgs/applications/science/chemistry/octopus/default.nix
index 2ff20fef40e8..bf8ccee4a635 100644
--- a/pkgs/applications/science/chemistry/octopus/default.nix
+++ b/pkgs/applications/science/chemistry/octopus/default.nix
@@ -3,7 +3,7 @@
 }:
 
 let
-  version = "7.2";
+  version = "7.3";
   fftwAll = symlinkJoin { name ="ftw-dev-out"; paths = [ fftw.dev fftw.out ]; };
 
 in stdenv.mkDerivation {
@@ -11,7 +11,7 @@ in stdenv.mkDerivation {
 
   src = fetchurl {
     url = "http://www.tddft.org/programs/octopus/down.php?file=${version}/octopus-${version}.tar.gz";
-    sha256 = "03zzmq72zdnjkhifbmlxs7ig7x6sf6mv8zv9mxhakm9hzwa9yn7m";
+    sha256 = "0hnpqjjxdxh2ggf6ckrsy4hs9iglnazscb4siczddvmysi4kv15d";
   };
 
   nativeBuildInputs = [ perl procps fftw.dev ];
diff --git a/pkgs/applications/science/logic/coq/default.nix b/pkgs/applications/science/logic/coq/default.nix
index b989b1eb9748..2b35c91d10c4 100644
--- a/pkgs/applications/science/logic/coq/default.nix
+++ b/pkgs/applications/science/logic/coq/default.nix
@@ -34,11 +34,9 @@ let
 self = stdenv.mkDerivation {
   name = "coq-${version}";
 
-  inherit coq-version;
-  inherit camlp5;
-  inherit (ocamlPackages) ocaml;
   passthru = {
-    inherit (ocamlPackages) findlib num;
+    inherit coq-version camlp5;
+    inherit (ocamlPackages) ocaml findlib num;
     emacsBufferSetup = pkgs: ''
       ; Propagate coq paths to children
       (inherit-local-permanent coq-prog-name "${self}/bin/coqtop")
@@ -125,8 +123,11 @@ self = stdenv.mkDerivation {
 
   buildFlags = "revision coq coqide bin/votour";
 
+  createFindlibDestdir = true;
+
   postInstall = ''
     cp bin/votour $out/bin/
+    ln -s $out/lib/coq $OCAMLFIND_DESTDIR/coq
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/science/machine-learning/shogun/default.nix b/pkgs/applications/science/machine-learning/shogun/default.nix
index e33b55503bd6..0ac40b1e7d42 100644
--- a/pkgs/applications/science/machine-learning/shogun/default.nix
+++ b/pkgs/applications/science/machine-learning/shogun/default.nix
@@ -52,6 +52,10 @@ stdenv.mkDerivation rec {
     ++ (optional (opencvSupport) "-DOpenCV=ON")
     ;
 
+  # Previous attempts to fix parallel builds (see patch above) were not entirely successful.
+  # Sporadic build failures still exist. Dislable parallel builds for now.
+  enableParallelBuilding = false;
+
   meta = with stdenv.lib; {
     description = "A toolbox which offers a wide range of efficient and unified machine learning methods";
     homepage = "http://shogun-toolbox.org/";
diff --git a/pkgs/applications/science/math/R/default.nix b/pkgs/applications/science/math/R/default.nix
index a9b2de1a00c5..953f4e62c22b 100644
--- a/pkgs/applications/science/math/R/default.nix
+++ b/pkgs/applications/science/math/R/default.nix
@@ -7,11 +7,11 @@
 }:
 
 stdenv.mkDerivation rec {
-  name = "R-3.4.4";
+  name = "R-3.5.0";
 
   src = fetchurl {
     url = "http://cran.r-project.org/src/base/R-3/${name}.tar.gz";
-    sha256 = "0dq3jsnwsb5j3fhl0wi3p5ycv8avf8s5j1y4ap3d2mkjmcppvsdk";
+    sha256 = "0w38865laqg28cdhikxdxhx4rfp0kgcn72gakwypsy91br9ja5zx";
   };
 
   buildInputs = [
@@ -65,7 +65,8 @@ stdenv.mkDerivation rec {
 
   installTargets = [ "install" "install-info" "install-pdf" ];
 
-  doCheck = true;
+  doCheck = withRecommendedPackages;  # R 3.5.0 fails the test suite if the
+                                      # recommended packages are not built
   preCheck = "export TZ=CET; bin/Rscript -e 'sessionInfo()'";
 
   enableParallelBuilding = true;
diff --git a/pkgs/applications/science/math/calc/default.nix b/pkgs/applications/science/math/calc/default.nix
index efd38f053451..9d95960bde27 100644
--- a/pkgs/applications/science/math/calc/default.nix
+++ b/pkgs/applications/science/math/calc/default.nix
@@ -1,47 +1,49 @@
-{ stdenv, fetchurl, makeWrapper, glibc, readline, ncurses, utillinux }:
+{ stdenv, lib, fetchurl, utillinux, makeWrapper
+, enableReadline ? true, readline, ncurses }:
 
-with stdenv.lib;
-let
-  makeFlags = ''
-    INCDIR=${glibc.dev}/include \
-    BINDIR=$out/bin LIBDIR=$out/lib CALC_INCDIR=$out/include/calc CALC_SHAREDIR=$out/share/calc MANDIR=$out/share/man/man1 \
-    USE_READLINE=-DUSE_READLINE READLINE_LIB=-lreadline READLINE_EXTRAS='-lhistory -lncurses' \
-    TERMCONTROL=-DUSE_TERMIOS \
-  '';
-in
 stdenv.mkDerivation rec {
-
   name = "calc-${version}";
   version = "2.12.6.6";
 
   src = fetchurl {
-    url = "https://github.com/lcn2/calc/releases/download/${version}/${name}.tar.bz2";
+    urls = [
+      "https://github.com/lcn2/calc/releases/download/${version}/${name}.tar.bz2"
+      "http://www.isthe.com/chongo/src/calc/${name}.tar.bz2"
+    ];
     sha256 = "03sg1xhin6qsrz82scf96mmzw8lz1yj68rhj4p4npp4s0fawc9d5";
   };
 
-  buildInputs = [ makeWrapper readline ncurses utillinux ];
-
-  configurePhase = ''
-    sed -i 's/all: check_include/all:/' Makefile
-  '';
-
-  buildPhase = ''
-    make ${makeFlags}
-  '';
-
-  installPhase = ''
-    make install ${makeFlags}
-    wrapProgram $out/bin/calc --prefix LD_LIBRARY_PATH : $out/lib
+  patchPhase = ''
+    substituteInPlace Makefile \
+      --replace 'all: check_include' 'all:' \
+      --replace '-install_name ''${LIBDIR}/libcalc''${LIB_EXT_VERSION}' '-install_name ''${T}''${LIBDIR}/libcalc''${LIB_EXT_VERSION}' \
+      --replace '-install_name ''${LIBDIR}/libcustcalc''${LIB_EXT_VERSION}' '-install_name ''${T}''${LIBDIR}/libcustcalc''${LIB_EXT_VERSION}'
   '';
 
-  # Hack to avoid TMPDIR in RPATHs.
-  preFixup = ''rm -rf "$(pwd)" '';
-
-  meta = {
+  buildInputs = [ utillinux makeWrapper ]
+             ++ lib.optionals enableReadline [ readline ncurses ];
+
+  makeFlags = [
+    "T=$(out)"
+    "INCDIR=${lib.getDev stdenv.cc.libc}/include"
+    "BINDIR=/bin"
+    "LIBDIR=/lib"
+    "CALC_SHAREDIR=/share/calc"
+    "CALC_INCDIR=/include"
+    "MANDIR=/share/man/man1"
+
+    # Handle LDFLAGS defaults in calc
+    "DEFAULT_LIB_INSTALL_PATH=$(out)/lib"
+  ] ++ lib.optionals enableReadline [
+    "READLINE_LIB=-lreadline"
+    "USE_READLINE=-DUSE_READLINE"
+  ];
+
+  meta = with lib; {
     description = "C-style arbitrary precision calculator";
     homepage = http://www.isthe.com/chongo/tech/comp/calc/;
     license = licenses.lgpl21;
-    maintainers = [ ];
+    maintainers = with maintainers; [ matthewbauer ];
     platforms = platforms.all;
   };
 }
diff --git a/pkgs/applications/science/math/giac/default.nix b/pkgs/applications/science/math/giac/default.nix
index 6acaa4067440..dd92e264889f 100644
--- a/pkgs/applications/science/math/giac/default.nix
+++ b/pkgs/applications/science/math/giac/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, texlive, bison, flex
+{ stdenv, fetchurl, fetchpatch, texlive, bison, flex
 , gmp, mpfr, pari, ntl, gsl, blas, mpfi, liblapackWithAtlas
 , readline, gettext, libpng, libao, gfortran, perl
 , enableGUI ? false, libGLU_combined ? null, xorg ? null, fltk ? null
@@ -16,6 +16,15 @@ stdenv.mkDerivation rec {
     sha256 = "0dv5p5y6gkrsmz3xa7fw87rjyabwdwk09mqb09kb7gai9n9dgayk";
   };
 
+  patches = stdenv.lib.optionals (!enableGUI) [
+    # when enableGui is false, giac is compiled without fltk. That means some
+    # outputs differ in the make check. Patch around this:
+    (fetchpatch {
+      url    = "https://git.sagemath.org/sage.git/plain/build/pkgs/giac/patches/nofltk-check.patch?id=7553a3c8dfa7bcec07241a07e6a4e7dcf5bb4f26";
+      sha256 = "0xkmfc028vg5w6va04gp2x2iv31n8v4shd6vbyvk4blzgfmpj2cw";
+    })
+  ];
+
   postPatch = ''
     for i in doc/*/Makefile*; do
       substituteInPlace "$i" --replace "/bin/cp" "cp";
@@ -37,10 +46,11 @@ stdenv.mkDerivation rec {
     libGLU_combined fltk xorg.libX11
   ];
 
-  outputs = [ "out" ];
+  outputs = [ "out" "doc" ];
+
+  doCheck = true;
 
   enableParallelBuilding = true;
-  hardeningDisable = [ "format" "bindnow" "relro" ];
 
   configureFlags = [
     "--enable-gc" "--enable-png" "--enable-gsl" "--enable-lapack"
@@ -57,6 +67,13 @@ stdenv.mkDerivation rec {
     for file in $(find $out -name Makefile) ; do
       sed -i "s@/nix/store/[^/]*/bin/@@" "$file" ;
     done;
+
+    # reference cycle
+    rm "$out/share/giac/doc/el/"{casinter,tutoriel}/Makefile
+
+    mkdir -p "$doc/share/giac"
+    mv "$out/share/giac/doc" "$doc/share/giac"
+    mv "$out/share/giac/examples" "$doc/share/giac"
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/science/math/lrcalc/default.nix b/pkgs/applications/science/math/lrcalc/default.nix
new file mode 100644
index 000000000000..9e02b08c8ad0
--- /dev/null
+++ b/pkgs/applications/science/math/lrcalc/default.nix
@@ -0,0 +1,41 @@
+{ stdenv
+, fetchFromBitbucket
+, fetchpatch
+, autoreconfHook
+}:
+
+stdenv.mkDerivation rec {
+  version = "1.2";
+  pname = "lrcalc";
+  name = "${pname}-${version}";
+
+  src = fetchFromBitbucket {
+    owner = "asbuch";
+    repo = "lrcalc";
+    rev = "lrcalc-${version}";
+    sha256 = "1c12d04jdyxkkav4ak8d1aqrv594gzihwhpxvc6p9js0ry1fahss";
+  };
+
+  doCheck = true;
+
+  nativeBuildInputs = [
+    autoreconfHook
+  ];
+
+  patches = [
+    # Fix include syntax:
+    # For private includes, use `#include "..."` instead of `#include <...>`
+    (fetchpatch {
+      url = "https://bitbucket.org/asbuch/lrcalc/commits/226981a0/raw/";
+      sha256 = "02kaqx5s3l642rhh28kn2wg9wr098vzpknxyl4pv627lqa3lv9vm";
+    })
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Littlewood-Richardson calculator";
+    homepage = http://math.rutgers.edu/~asbuch/lrcalc/;
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ timokau ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/applications/science/math/mathematica/default.nix b/pkgs/applications/science/math/mathematica/default.nix
index 1c86097f2ee4..9b9d5b250ef6 100644
--- a/pkgs/applications/science/math/mathematica/default.nix
+++ b/pkgs/applications/science/math/mathematica/default.nix
@@ -1,7 +1,7 @@
 { stdenv
 , coreutils
 , patchelf
-, requireFile
+, callPackage
 , alsaLib
 , dbus
 , fontconfig
@@ -18,6 +18,7 @@
 , zlib
 , libxml2
 , libuuid
+, lang ? "en"
 }:
 
 let
@@ -26,21 +27,15 @@ let
       "Linux"
     else
       throw "Mathematica requires i686-linux or x86_64 linux";
+
+  l10n =
+    with stdenv.lib;
+    with callPackage ./l10ns.nix {};
+    flip (findFirst (l: l.lang == lang)) l10ns
+      (throw "Language '${lang}' not supported");
 in
 stdenv.mkDerivation rec {
-  version = "11.2.0";
-
-  name = "mathematica-${version}";
-
-  src = requireFile rec {
-    name = "Mathematica_${version}_LINUX.sh";
-    message = '' 
-      This nix expression requires that ${name} is
-      already part of the store. Find the file on your Mathematica CD
-      and add it to the nix store with nix-store --add-fixed sha256 <FILE>.
-    '';
-    sha256 = "4a1293cc1c404303aa1cab1bd273c7be151d37ac5ed928fbbb18e9c5ab2d8df9";
-  };
+  inherit (l10n) version name src;
 
   buildInputs = [
     coreutils
diff --git a/pkgs/applications/science/math/mathematica/l10ns.nix b/pkgs/applications/science/math/mathematica/l10ns.nix
new file mode 100644
index 000000000000..2158021c7548
--- /dev/null
+++ b/pkgs/applications/science/math/mathematica/l10ns.nix
@@ -0,0 +1,33 @@
+{ lib, requireFile }:
+
+with lib;
+{
+  l10ns = flip map
+  [
+    {
+      version = "11.2.0";
+      lang = "en";
+      language = "English";
+      sha256 = "4a1293cc1c404303aa1cab1bd273c7be151d37ac5ed928fbbb18e9c5ab2d8df9";
+    }
+    {
+      version = "11.2.0";
+      lang = "ja";
+      language = "Japanese";
+      sha256 = "916392edd32bed8622238df435dd8e86426bb043038a3336f30df10d819b49b1";
+    }
+  ]
+  ({ version, lang, language, sha256 }: {
+    inherit version lang;
+    name = "mathematica-${version}" + optionalString (lang != "en") "-${lang}";
+    src = requireFile rec {
+      name = "Mathematica_${version}" + optionalString (lang != "en") "_${language}" + "_LINUX.sh";
+      message = ''
+        This nix expression requires that ${name} is
+        already part of the store. Find the file on your Mathematica CD
+        and add it to the nix store with nix-store --add-fixed sha256 <FILE>.
+      '';
+      inherit sha256;
+    };
+  });
+}
diff --git a/pkgs/applications/science/math/maxima/default.nix b/pkgs/applications/science/math/maxima/default.nix
index c3eeddef6694..892b9d9520e3 100644
--- a/pkgs/applications/science/math/maxima/default.nix
+++ b/pkgs/applications/science/math/maxima/default.nix
@@ -69,6 +69,10 @@ stdenv.mkDerivation ({
       url = "https://git.sagemath.org/sage.git/plain/build/pkgs/maxima/patches/maxima.system.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
       sha256 = "18zafig8vflhkr80jq2ivk46k92dkszqlyq8cfmj0b2vcfjwwbar";
     })
+    # There are some transient test failures. I hope this disables all those tests.
+    # If those test failures ever happen in the non-ecl version, that should be
+    # reportetd upstream.
+    ./known-ecl-failures.patch
   ];
 
   # Failures in the regression test suite won't abort the build process. We run
diff --git a/pkgs/applications/science/math/maxima/known-ecl-failures.patch b/pkgs/applications/science/math/maxima/known-ecl-failures.patch
new file mode 100644
index 000000000000..f1d612d993e6
--- /dev/null
+++ b/pkgs/applications/science/math/maxima/known-ecl-failures.patch
@@ -0,0 +1,21 @@
+diff --git a/tests/testsuite.lisp b/tests/testsuite.lisp
+index 45a81f4..36c35b8 100644
+--- a/tests/testsuite.lisp
++++ b/tests/testsuite.lisp
+@@ -25,13 +25,14 @@
+         ((mlist simp) "rtest10" 24 25)
+         ((mlist) "rtest11" #+(or gcl cmucl ccl64) 158 #+(or gcl cmucl ccl64) 174 #+gcl 175)
+         "rtest13" "rtest13s"
+-        "rtest14"
++        ;; "rtest14" ;; some tests sometimes fail with ecl, hard to reproduce. Observed failing: 250, 267, 297, 307, 310, 312, 315, 319
+         "rtest15"
+ 	;; ccl versions 1.11 and earlier fail test 50.  Mark it as a
+ 	;; known failure.  Presumably 1.12 will have this fixed.
+         ((mlist simp) "rtest16" #+ccl 50)
+         "rtestode" "rtestode_zp"
+-        "rtest3" "rtest8"
++        "rtest3"
++        ((mlist simp) "rtest8" 104) ;; fails with ecl
+         ((mlist simp) "rtest12" 76 78)
+         "rexamples"
+         ((mlist simp) "rtesthyp" 105 112 113 123 124 128)
diff --git a/pkgs/applications/science/math/palp/default.nix b/pkgs/applications/science/math/palp/default.nix
new file mode 100644
index 000000000000..3484c369db3b
--- /dev/null
+++ b/pkgs/applications/science/math/palp/default.nix
@@ -0,0 +1,67 @@
+{ stdenv
+, fetchurl
+, dimensions ? 6 # works for <= dimensions dimensions, but is only optimized for that exact value
+, doSymlink ? true # symlink the executables to the default location (without dimension postfix)
+}:
+
+stdenv.mkDerivation rec {
+  version = "2.1";
+  dim = toString dimensions;
+  name = "palp-${dim}d-${version}";
+
+  src = fetchurl {
+    url = "http://hep.itp.tuwien.ac.at/~kreuzer/CY/palp/palp-${version}.tar.gz";
+    sha256 = "1s7s2lc5f0ig1yy7ygsh3sddm3sbq4mxwybqsj8lp9wjdxs7qfrs";
+  };
+
+  hardeningDisable = [ "format" ];
+
+  preBuild = ''
+      echo Building PALP optimized for ${dim} dimensions
+      sed -i "s/^#define[^a-zA-Z]*POLY_Dmax.*/#define POLY_Dmax ${dim}/" Global.h
+  '';
+
+  installPhase = ''
+    mkdir -p "$out/bin"
+    for file in poly class cws nef mori; do
+        cp -p $file.x "$out/bin/$file-${dim}d.x"
+    done
+  '' + stdenv.lib.optionalString doSymlink ''
+    cd "$out/bin"
+    for file in poly class cws nef mori; do
+        ln -sf $file-6d.x $file.x
+    done
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A Package for Analyzing Lattice Polytopes";
+    longDescription = ''
+      A Package for Analyzing Lattice Polytopes (PALP) is a set of C
+      programs for calculations with lattice polytopes and applications to
+      toric geometry.
+
+      It contains routines for vertex and facet enumeration, computation of
+      incidences and symmetries, as well as completion of the set of lattice
+      points in the convex hull of a given set of points. In addition, there
+      are procedures specialised to reflexive polytopes such as the
+      enumeration of reflexive subpolytopes, and applications to toric
+      geometry and string theory, like the computation of Hodge data and
+      fibration structures for toric Calabi-Yau varieties.  The package is
+      well tested and optimised in speed as it was used for time consuming
+      tasks such as the classification of reflexive polyhedra in 4
+      dimensions and the creation and manipulation of very large lists of
+      5-dimensional polyhedra.
+
+      While originally intended for low-dimensional applications, the
+      algorithms work in any dimension and our key routine for vertex and
+      facet enumeration compares well with existing packages.
+    '';
+    homepage = http://hep.itp.tuwien.ac.at/~kreuzer/CY/CYpalp.html;
+    # Just a link on the website pointing to gpl -- now gplv3. When the last
+    # version was released that pointed to gplv2 however, so thats probably
+    # the right license.
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ timokau ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/applications/science/math/pari/default.nix b/pkgs/applications/science/math/pari/default.nix
index a1ddbd9ab17d..8c24881f2152 100644
--- a/pkgs/applications/science/math/pari/default.nix
+++ b/pkgs/applications/science/math/pari/default.nix
@@ -1,5 +1,9 @@
 { stdenv, fetchurl
-, gmp, readline, libX11, libpthreadstubs, tex, perl }:
+, gmp, readline, libX11, tex, perl
+, withThread ? true, libpthreadstubs
+}:
+
+assert withThread -> libpthreadstubs != null;
 
 stdenv.mkDerivation rec {
 
@@ -11,14 +15,22 @@ stdenv.mkDerivation rec {
     sha256 = "0ir6m3a8r46md5x6zk4xf159qra7aqparby9zk03k81hjrrxr72g";
   };
 
-  buildInputs = [ gmp readline libX11 libpthreadstubs tex perl ];
+  buildInputs = [
+    gmp
+    readline
+    libX11
+    tex
+    perl
+  ] ++ stdenv.lib.optionals withThread [
+    libpthreadstubs
+  ];
 
   configureScript = "./Configure";
   configureFlags = [
-    "--mt=pthread"
     "--with-gmp=${gmp.dev}"
     "--with-readline=${readline.dev}"
-  ] ++ stdenv.lib.optional stdenv.isDarwin "--host=x86_64-darwin";
+  ] ++ stdenv.lib.optional stdenv.isDarwin "--host=x86_64-darwin"
+  ++ stdenv.lib.optional withThread "--mt=pthread";
 
   preConfigure = ''
     export LD=$CC
diff --git a/pkgs/applications/science/math/pari/unstable.nix b/pkgs/applications/science/math/pari/unstable.nix
deleted file mode 100644
index 65dd3005b4ab..000000000000
--- a/pkgs/applications/science/math/pari/unstable.nix
+++ /dev/null
@@ -1,31 +0,0 @@
-{ stdenv, fetchurl, gmp, readline, perl }:
-
-stdenv.mkDerivation rec {
-  version = "2.9.3";
-  name = "pari-unstable-${version}";
-
-  src = fetchurl {
-    url = "http://pari.math.u-bordeaux.fr/pub/pari/unstable/pari-${version}.tar.gz";
-    sha256 = "0qqal1lpggd6dvs19svnz0dil86xk0xkcj5s3b7104ibkmvjfsp7";
-  };
-
-  buildInputs = [gmp readline];
-  nativeBuildInputs = [perl];
-
-  configureScript = "./Configure";
-  configureFlags =
-    "--with-gmp=${gmp.dev} " +
-    "--with-readline=${readline.dev}";
-
-  meta = with stdenv.lib; {
-    description = "Computer algebra system for high-performance number theory computations";
-    homepage    = "http://pari.math.u-bordeaux.fr/";
-    license     = licenses.gpl2Plus;
-    maintainers = with maintainers; [ ertes raskin ];
-    platforms   = platforms.linux;
-
-    inherit version;
-    downloadPage = "http://pari.math.u-bordeaux.fr/download.html";
-    updateWalker = true;
-  };
-}
diff --git a/pkgs/applications/science/math/pynac/default.nix b/pkgs/applications/science/math/pynac/default.nix
new file mode 100644
index 000000000000..fd566abd9a9a
--- /dev/null
+++ b/pkgs/applications/science/math/pynac/default.nix
@@ -0,0 +1,47 @@
+{ stdenv
+, fetchFromGitHub
+, autoreconfHook
+, pkgconfig
+, flint
+, gmp
+, python2
+, singular
+}:
+
+stdenv.mkDerivation rec {
+  version = "0.7.19";
+  name = "pynac-${version}";
+
+  src = fetchFromGitHub {
+    owner = "pynac";
+    repo = "pynac";
+    rev = "pynac-${version}";
+    sha256 = "132bibvapm245c5xy29j3xmjs0pawvw7lv05374m8vv1m39127d3";
+  };
+
+  buildInputs = [
+    flint
+    gmp
+    singular
+    singular
+    python2
+  ];
+
+  nativeBuildInputs = [
+    autoreconfHook
+    pkgconfig
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Python is Not a CAS -- modified version of Ginac";
+    longDescription = ''
+      Pynac -- "Python is Not a CAS" is a modified version of Ginac that
+      replaces the depency of GiNaC on CLN by a dependency instead of Python.
+      It is a lite version of GiNaC as well, not implementing all the features
+      of the full GiNaC, and it is *only* meant to be used as a Python library.
+    '';
+    homepage    = http://pynac.org;
+    maintainers = with maintainers; [ timokau ];
+    platforms   = platforms.linux;
+  };
+}
diff --git a/pkgs/applications/science/math/singular/default.nix b/pkgs/applications/science/math/singular/default.nix
index 882d481a7f98..cec1a831c912 100644
--- a/pkgs/applications/science/math/singular/default.nix
+++ b/pkgs/applications/science/math/singular/default.nix
@@ -1,5 +1,6 @@
 { stdenv, fetchurl, gmp, bison, perl, autoconf, ncurses, readline, coreutils, pkgconfig
 , autoreconfHook
+, file
 , flint
 , ntl
 , cddlib
@@ -18,7 +19,9 @@ stdenv.mkDerivation rec {
     sha256 = "0wvgz7l1b7zkpmim0r3mvv4fp8xnhlbz4c7hc90rn30snlansnf1";
   };
 
-  configureFlags = stdenv.lib.optionals enableFactory [
+  configureFlags = [
+    "--with-ntl=${ntl}"
+  ] ++stdenv.lib.optionals enableFactory [
     "--enable-factory"
   ] ++ stdenv.lib.optionals enableGfanlib [
     "--enable-gfanlib"
@@ -42,11 +45,19 @@ stdenv.mkDerivation rec {
   ] ++ stdenv.lib.optionals enableGfanlib [
     cddlib
   ];
-  nativeBuildInputs = [ autoconf bison perl pkgconfig autoreconfHook ];
+  nativeBuildInputs = [
+    bison
+    perl
+    pkgconfig
+    autoreconfHook
+  ];
 
-  preConfigure = ''
-    find . -type f -exec sed -e 's@/bin/rm@${coreutils}&@g' -i '{}' ';'
-    find . -type f -exec sed -e 's@/bin/uname@${coreutils}&@g' -i '{}' ';'
+  preAutoreconf = ''
+    find . -type f -readable -writable -exec sed \
+      -e 's@/bin/rm@${coreutils}&@g' \
+      -e 's@/bin/uname@${coreutils}&@g' \
+      -e 's@/usr/bin/file@${file}/bin/file@g' \
+      -i '{}' ';'
   '';
 
   hardeningDisable = stdenv.lib.optional stdenv.isi686 "stackprotector";
diff --git a/pkgs/applications/science/misc/cytoscape/default.nix b/pkgs/applications/science/misc/cytoscape/default.nix
index 0194ee0b83c0..36c7884d108b 100644
--- a/pkgs/applications/science/misc/cytoscape/default.nix
+++ b/pkgs/applications/science/misc/cytoscape/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "cytoscape-${version}";
-  version = "3.6.0";
+  version = "3.6.1";
 
   src = fetchurl {
     url = "http://chianti.ucsd.edu/${name}/${name}.tar.gz";
-    sha256 = "13q8caksbzi6j7xy8v5f0pi6766yfawys6jcm50ng78mnhrv2v97";
+    sha256 = "1pkdilv1nw6vvdxk71bwjngr8yafrsqwaqvlakhp8yb342r1jd4s";
   };
 
   buildInputs = [jre makeWrapper];
diff --git a/pkgs/applications/science/misc/motu-client/default.nix b/pkgs/applications/science/misc/motu-client/default.nix
index 0d5c79fde900..0994bb1ca38d 100644
--- a/pkgs/applications/science/misc/motu-client/default.nix
+++ b/pkgs/applications/science/misc/motu-client/default.nix
@@ -1,11 +1,11 @@
 { python27Packages, fetchurl, lib } :
 python27Packages.buildPythonApplication rec {
-  name = "motu-client-${version}";
-  version = "1.4.00";
+  pname = "motu-client";
+  version = "1.5.00";
 
   src = fetchurl {
     url = "https://github.com/quiet-oceans/motuclient-setuptools/archive/${version}.tar.gz";
-    sha256 = "0v0h90mylhaamd1vm4nc64q63vmlafhijm47hs0xfam33y1q2yvb";
+    sha256 = "1iqsws3wa2gpb36ms21xmaxfi83i8p8cdya4cxpn4r47c8mz74x8";
   };
 
   meta = with lib; {