summary refs log tree commit diff
path: root/pkgs/applications/science/math
diff options
context:
space:
mode:
authorBen Siraphob <bensiraphob@gmail.com>2021-01-15 20:21:58 +0700
committerBen Siraphob <bensiraphob@gmail.com>2021-01-16 17:58:11 +0700
commitbadf51221db8fae81bf9948c39eaf8342dfd5597 (patch)
tree34eeb35ca97f0b081da465e9ddd6c120a9d2b7df /pkgs/applications/science/math
parenta9bb54359eeedf2594fdf191de5b673fd1dd102d (diff)
treewide: stdenv.lib -> lib
Diffstat (limited to 'pkgs/applications/science/math')
-rw-r--r--pkgs/applications/science/math/LiE/default.nix6
-rw-r--r--pkgs/applications/science/math/R/default.nix10
-rw-r--r--pkgs/applications/science/math/bcal/default.nix4
-rw-r--r--pkgs/applications/science/math/cplex/default.nix18
-rw-r--r--pkgs/applications/science/math/csdp/default.nix2
-rw-r--r--pkgs/applications/science/math/ecm/default.nix10
-rw-r--r--pkgs/applications/science/math/eukleides/default.nix8
-rw-r--r--pkgs/applications/science/math/fricas/default.nix8
-rw-r--r--pkgs/applications/science/math/geogebra/geogebra6.nix6
-rw-r--r--pkgs/applications/science/math/gfan/default.nix10
-rw-r--r--pkgs/applications/science/math/giac/default.nix12
-rw-r--r--pkgs/applications/science/math/ginac/default.nix2
-rw-r--r--pkgs/applications/science/math/glsurf/default.nix4
-rw-r--r--pkgs/applications/science/math/gmsh/default.nix4
-rw-r--r--pkgs/applications/science/math/gurobi/default.nix2
-rw-r--r--pkgs/applications/science/math/mathematica/10.nix14
-rw-r--r--pkgs/applications/science/math/mathematica/11.nix14
-rw-r--r--pkgs/applications/science/math/mathematica/9.nix12
-rw-r--r--pkgs/applications/science/math/mathematica/default.nix12
-rw-r--r--pkgs/applications/science/math/maxima/default.nix18
-rw-r--r--pkgs/applications/science/math/msieve/default.nix8
-rw-r--r--pkgs/applications/science/math/palp/default.nix4
-rw-r--r--pkgs/applications/science/math/pari/default.nix10
-rw-r--r--pkgs/applications/science/math/pcalc/default.nix8
-rw-r--r--pkgs/applications/science/math/perseus/default.nix8
-rw-r--r--pkgs/applications/science/math/polymake/default.nix8
-rw-r--r--pkgs/applications/science/math/pspp/default.nix8
-rw-r--r--pkgs/applications/science/math/ratpoints/default.nix10
-rw-r--r--pkgs/applications/science/math/ripser/default.nix12
-rw-r--r--pkgs/applications/science/math/sage/sage.nix2
-rw-r--r--pkgs/applications/science/math/scilab/default.nix8
-rw-r--r--pkgs/applications/science/math/scotch/default.nix10
-rw-r--r--pkgs/applications/science/math/weka/default.nix10
-rw-r--r--pkgs/applications/science/math/yacas/default.nix12
34 files changed, 147 insertions, 147 deletions
diff --git a/pkgs/applications/science/math/LiE/default.nix b/pkgs/applications/science/math/LiE/default.nix
index f5f3bb0a42b18..9b16fc1d67f6e 100644
--- a/pkgs/applications/science/math/LiE/default.nix
+++ b/pkgs/applications/science/math/LiE/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , bison, readline }:
 
 stdenv.mkDerivation {
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
   meta = {
     description = "A Computer algebra package for Lie group computations";
     homepage = "http://wwwmathlabo.univ-poitiers.fr/~maavl/LiE/";
-    license = stdenv.lib.licenses.lgpl3; # see the website
+    license = lib.licenses.lgpl3; # see the website
 
     longDescription = ''
       LiE is a computer algebra system that is specialised in computations
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
       characteristics, we refer to the following sources of information.
     ''; # take from the website
 
-    platforms = stdenv.lib.platforms.linux;
+    platforms = lib.platforms.linux;
     maintainers = [ ]; # this package is probably not going to change anyway
   };
 
diff --git a/pkgs/applications/science/math/R/default.nix b/pkgs/applications/science/math/R/default.nix
index 2191511a9c57c..d9fbc626e009a 100644
--- a/pkgs/applications/science/math/R/default.nix
+++ b/pkgs/applications/science/math/R/default.nix
@@ -25,14 +25,14 @@ stdenv.mkDerivation rec {
     bzip2 gfortran libX11 libXmu libXt libXt libjpeg libpng libtiff ncurses
     pango pcre2 perl readline texLive xz zlib less texinfo graphviz icu
     pkgconfig bison imake which blas lapack curl tcl tk jdk
-  ] ++ stdenv.lib.optionals stdenv.isDarwin [ Cocoa Foundation libobjc libcxx ];
+  ] ++ lib.optionals stdenv.isDarwin [ Cocoa Foundation libobjc libcxx ];
 
   patches = [
     ./no-usr-local-search-paths.patch
     ./fix-failing-test.patch
   ];
 
-  prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
+  prePatch = lib.optionalString stdenv.isDarwin ''
     substituteInPlace configure --replace "-install_name libR.dylib" "-install_name $out/lib/R/lib/libR.dylib"
   '';
 
@@ -41,7 +41,7 @@ stdenv.mkDerivation rec {
   preConfigure = ''
     configureFlagsArray=(
       --disable-lto
-      --with${stdenv.lib.optionalString (!withRecommendedPackages) "out"}-recommended-packages
+      --with${lib.optionalString (!withRecommendedPackages) "out"}-recommended-packages
       --with-blas="-L${blas}/lib -lblas"
       --with-lapack="-L${lapack}/lib -llapack"
       --with-readline
@@ -51,7 +51,7 @@ stdenv.mkDerivation rec {
       --with-jpeglib
       --with-libtiff
       --with-ICU
-      ${stdenv.lib.optionalString enableStrictBarrier "--enable-strict-barrier"}
+      ${lib.optionalString enableStrictBarrier "--enable-strict-barrier"}
       ${if static then "--enable-R-static-lib" else "--enable-R-shlib"}
       AR=$(type -p ar)
       AWK=$(type -p gawk)
@@ -61,7 +61,7 @@ stdenv.mkDerivation rec {
       JAVA_HOME="${jdk}"
       RANLIB=$(type -p ranlib)
       R_SHELL="${stdenv.shell}"
-  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+  '' + lib.optionalString stdenv.isDarwin ''
       --disable-R-framework
       OBJC="clang"
       CPPFLAGS="-isystem ${libcxx}/include/c++/v1"
diff --git a/pkgs/applications/science/math/bcal/default.nix b/pkgs/applications/science/math/bcal/default.nix
index 5df2d20549c2b..8cbf90a7187c4 100644
--- a/pkgs/applications/science/math/bcal/default.nix
+++ b/pkgs/applications/science/math/bcal/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchFromGitHub, python3Packages, readline, bc }:
+{ lib, stdenv, fetchFromGitHub, python3Packages, readline, bc }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "bcal";
diff --git a/pkgs/applications/science/math/cplex/default.nix b/pkgs/applications/science/math/cplex/default.nix
index 39213aff09a6e..068f9f0ea3c14 100644
--- a/pkgs/applications/science/math/cplex/default.nix
+++ b/pkgs/applications/science/math/cplex/default.nix
@@ -1,7 +1,7 @@
 { lib, stdenv, makeWrapper, openjdk, gtk2, xorg, glibcLocales, releasePath ? null }:
 
 # To use this package, you need to download your own cplex installer from IBM
-# and override the releasePath attribute to point to the location of the file.  
+# and override the releasePath attribute to point to the location of the file.
 #
 # Note: cplex creates an individual build for each license which screws
 # somewhat with the use of functions like requireFile as the hash will be
@@ -10,13 +10,13 @@
 stdenv.mkDerivation rec {
   pname = "cplex";
   version = "128";
-  
+
   src =
     if releasePath == null then
       throw ''
         This nix expression requires that the cplex installer is already
-        downloaded to your machine. Get it from IBM: 
-        https://developer.ibm.com/docloud/blog/2017/12/20/cplex-optimization-studio-12-8-now-available/ 
+        downloaded to your machine. Get it from IBM:
+        https://developer.ibm.com/docloud/blog/2017/12/20/cplex-optimization-studio-12-8-now-available/
 
         Set `cplex.releasePath = /path/to/download;` in your
         ~/.config/nixpkgs/config.nix for `nix-*` commands, or
@@ -49,9 +49,9 @@ stdenv.mkDerivation rec {
       $out/bin
   '';
 
-  fixupPhase = 
-  let 
-    libraryPath = stdenv.lib.makeLibraryPath [ stdenv.cc.cc gtk2 xorg.libXtst ];
+  fixupPhase =
+  let
+    libraryPath = lib.makeLibraryPath [ stdenv.cc.cc gtk2 xorg.libXtst ];
   in ''
     interpreter=${stdenv.glibc}/lib/ld-linux-x86-64.so.2
 
@@ -63,7 +63,7 @@ stdenv.mkDerivation rec {
         --set LOCALE_ARCHIVE ${glibcLocales}/lib/locale/locale-archive;
     done
 
-    for pgm in $out/cplex/bin/x86-64_linux/cplex $out/cpoptimizer/bin/x86-64_linux/cpoptimizer $out/opl/oplide/jre/bin/*; 
+    for pgm in $out/cplex/bin/x86-64_linux/cplex $out/cpoptimizer/bin/x86-64_linux/cpoptimizer $out/opl/oplide/jre/bin/*;
     do
       if grep ELF $pgm > /dev/null;
       then
@@ -76,7 +76,7 @@ stdenv.mkDerivation rec {
     libArch = "x86-64_linux";
     libSuffix = "${version}0";
   };
-  
+
   meta = with lib; {
     description = "Optimization solver for mathematical programming";
     homepage = "https://www.ibm.com/be-en/marketplace/ibm-ilog-cplex";
diff --git a/pkgs/applications/science/math/csdp/default.nix b/pkgs/applications/science/math/csdp/default.nix
index ef9d5e733ca73..02c4c134f92e9 100644
--- a/pkgs/applications/science/math/csdp/default.nix
+++ b/pkgs/applications/science/math/csdp/default.nix
@@ -24,6 +24,6 @@ stdenv.mkDerivation {
     license = lib.licenses.cpl10;
     maintainers = [ lib.maintainers.roconnor ];
     description = "A C Library for Semidefinite Programming";
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/applications/science/math/ecm/default.nix b/pkgs/applications/science/math/ecm/default.nix
index 3e8e5879950b2..c59b1a8729a28 100644
--- a/pkgs/applications/science/math/ecm/default.nix
+++ b/pkgs/applications/science/math/ecm/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, gmp, m4 }:
+{ lib, stdenv, fetchurl, gmp, m4 }:
 
 let
   pname = "ecm";
@@ -15,7 +15,7 @@ stdenv.mkDerivation {
   };
 
   # See https://trac.sagemath.org/ticket/19233
-  configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-asm-redc";
+  configureFlags = lib.optional stdenv.isDarwin "--disable-asm-redc";
 
   buildInputs = [ m4 gmp ];
 
@@ -23,9 +23,9 @@ stdenv.mkDerivation {
 
   meta = {
     description = "Elliptic Curve Method for Integer Factorization";
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
     homepage = "http://ecm.gforge.inria.fr/";
-    maintainers = [ stdenv.lib.maintainers.roconnor ];
-    platforms = with stdenv.lib.platforms; linux ++ darwin;
+    maintainers = [ lib.maintainers.roconnor ];
+    platforms = with lib.platforms; linux ++ darwin;
   };
 }
diff --git a/pkgs/applications/science/math/eukleides/default.nix b/pkgs/applications/science/math/eukleides/default.nix
index 879ad96a93675..5f7fe58465d00 100644
--- a/pkgs/applications/science/math/eukleides/default.nix
+++ b/pkgs/applications/science/math/eukleides/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, bison, flex, texinfo, readline, texLive }:
+{ lib, stdenv, fetchurl, bison, flex, texinfo, readline, texLive }:
 
 let
   name    = "eukleides";
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
   meta = {
     description = "Geometry Drawing Language";
     homepage = "http://www.eukleides.org/";
-    license = stdenv.lib.licenses.gpl2;
+    license = lib.licenses.gpl2;
 
     longDescription = ''
       Eukleides is a computer language devoted to elementary plane
@@ -31,7 +31,7 @@ stdenv.mkDerivation {
       circles and conics.
     '';
 
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.peti ];
+    platforms = lib.platforms.linux;
+    maintainers = [ lib.maintainers.peti ];
   };
 }
diff --git a/pkgs/applications/science/math/fricas/default.nix b/pkgs/applications/science/math/fricas/default.nix
index 39ca53c47e6e6..a29d403672876 100644
--- a/pkgs/applications/science/math/fricas/default.nix
+++ b/pkgs/applications/science/math/fricas/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, sbcl, libX11, libXpm, libICE, libSM, libXt, libXau, libXdmcp }:
+{ lib, stdenv, fetchurl, sbcl, libX11, libXpm, libICE, libSM, libXt, libXau, libXdmcp }:
 
 let
   version = "1.3.4";
@@ -19,9 +19,9 @@ stdenv.mkDerivation {
   meta = {
     homepage = "http://fricas.sourceforge.net/";
     description = "An advanced computer algebra system";
-    license = stdenv.lib.licenses.bsd3;
+    license = lib.licenses.bsd3;
 
-    platforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.sprock ];
+    platforms = lib.platforms.linux;
+    maintainers = [ lib.maintainers.sprock ];
   };
 }
diff --git a/pkgs/applications/science/math/geogebra/geogebra6.nix b/pkgs/applications/science/math/geogebra/geogebra6.nix
index 7bd5826489371..4ed66d9693036 100644
--- a/pkgs/applications/science/math/geogebra/geogebra6.nix
+++ b/pkgs/applications/science/math/geogebra/geogebra6.nix
@@ -1,4 +1,4 @@
-{ stdenv, unzip, fetchurl, electron_6, makeWrapper, geogebra }:
+{ lib, stdenv, unzip, fetchurl, electron_6, makeWrapper, geogebra }:
 let
   pname = "geogebra";
   version = "6-0-609-0";
@@ -6,7 +6,7 @@ let
   srcIcon = geogebra.srcIcon;
   desktopItem = geogebra.desktopItem;
 
-  meta = with stdenv.lib; geogebra.meta // {
+  meta = with lib; geogebra.meta // {
     license = licenses.geogebra;
     maintainers = with maintainers; [ voidless ];
     platforms = with platforms; linux ++ darwin;
@@ -38,7 +38,7 @@ let
     installPhase = ''
       mkdir -p $out/libexec/geogebra/ $out/bin
       cp -r GeoGebra-linux-x64/{resources,locales} "$out/"
-      makeWrapper ${stdenv.lib.getBin electron_6}/bin/electron $out/bin/geogebra --add-flags "$out/resources/app"
+      makeWrapper ${lib.getBin electron_6}/bin/electron $out/bin/geogebra --add-flags "$out/resources/app"
       install -Dm644 "${desktopItem}/share/applications/"* \
         -t $out/share/applications/
 
diff --git a/pkgs/applications/science/math/gfan/default.nix b/pkgs/applications/science/math/gfan/default.nix
index 7e2a4625d3011..fd657963c390f 100644
--- a/pkgs/applications/science/math/gfan/default.nix
+++ b/pkgs/applications/science/math/gfan/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, gmp, mpir, cddlib}:
+{lib, stdenv, fetchurl, gmp, mpir, cddlib}:
 stdenv.mkDerivation rec {
   pname = "gfan";
   version = "0.6.2";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
     ./gfan-0.6.2-cddlib-prefix.patch
   ];
 
-  postPatch = stdenv.lib.optionalString stdenv.cc.isClang ''
+  postPatch = lib.optionalString stdenv.cc.isClang ''
     substituteInPlace Makefile --replace "-fno-guess-branch-probability" ""
   '';
 
@@ -23,9 +23,9 @@ stdenv.mkDerivation rec {
   meta = {
     inherit version;
     description = ''A software package for computing Gröbner fans and tropical varieties'';
-    license = stdenv.lib.licenses.gpl2 ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2 ;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.unix;
     homepage = "http://home.math.au.dk/jensen/software/gfan/gfan.html";
   };
 }
diff --git a/pkgs/applications/science/math/giac/default.nix b/pkgs/applications/science/math/giac/default.nix
index 7825fc1d9a2e2..8c391e2532244 100644
--- a/pkgs/applications/science/math/giac/default.nix
+++ b/pkgs/applications/science/math/giac/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     sha256 = "1d0h1yb7qvh9x7wwv9yrzmcp712f49w1iljkxp4y6g9pzsmg1mmv";
   };
 
-  patches = stdenv.lib.optionals (!enableGUI) [
+  patches = 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 {
@@ -41,9 +41,9 @@ stdenv.mkDerivation rec {
     readline gettext libpng libao perl ecm
     # gfortran.cc default output contains static libraries compiled without -fPIC
     # we want libgfortran.so.3 instead
-    (stdenv.lib.getLib gfortran.cc)
+    (lib.getLib gfortran.cc)
     lapack blas
-  ] ++ stdenv.lib.optionals enableGUI [
+  ] ++ lib.optionals enableGUI [
     libGL libGLU fltk xorg.libX11
   ];
 
@@ -56,7 +56,7 @@ stdenv.mkDerivation rec {
 
   # xcas Phys and Turtle menus are broken with split outputs
   # and interactive use is likely to need docs
-  outputs = [ "out" ] ++ stdenv.lib.optional (!enableGUI) "doc";
+  outputs = [ "out" ] ++ lib.optional (!enableGUI) "doc";
 
   doCheck = true;
   preCheck = ''
@@ -74,7 +74,7 @@ stdenv.mkDerivation rec {
     "--enable-gc" "--enable-png" "--enable-gsl" "--enable-lapack"
     "--enable-pari" "--enable-ntl" "--enable-gmpxx" # "--enable-cocoa"
     "--enable-ao" "--enable-ecm" "--enable-glpk"
-  ] ++ stdenv.lib.optionals enableGUI [
+  ] ++ lib.optionals enableGUI [
     "--enable-gui" "--with-x"
   ];
 
@@ -94,7 +94,7 @@ stdenv.mkDerivation rec {
       mv "$out/share/giac/doc" "$doc/share/giac"
       mv "$out/share/giac/examples" "$doc/share/giac"
     fi
-  '' + stdenv.lib.optionalString (!enableGUI) ''
+  '' + lib.optionalString (!enableGUI) ''
     for i in pixmaps application-registry applications icons; do
       rm -r "$out/share/$i";
     done;
diff --git a/pkgs/applications/science/math/ginac/default.nix b/pkgs/applications/science/math/ginac/default.nix
index e20e15edeff1a..c55e8d9adffa2 100644
--- a/pkgs/applications/science/math/ginac/default.nix
+++ b/pkgs/applications/science/math/ginac/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ cln ];
 
-  buildInputs = [ readline ] ++ stdenv.lib.optional stdenv.isDarwin gmp;
+  buildInputs = [ readline ] ++ lib.optional stdenv.isDarwin gmp;
 
   nativeBuildInputs = [ pkgconfig python ];
 
diff --git a/pkgs/applications/science/math/glsurf/default.nix b/pkgs/applications/science/math/glsurf/default.nix
index 09d0d5241687f..599d4bac8e76b 100644
--- a/pkgs/applications/science/math/glsurf/default.nix
+++ b/pkgs/applications/science/math/glsurf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ocamlPackages, libGLU, libGL, freeglut
+{ lib, stdenv, fetchurl, ocamlPackages, libGLU, libGL, freeglut
 , libmysqlclient, mpfr, gmp, libtiff, libjpeg, libpng, giflib
 }:
 
@@ -26,6 +26,6 @@ stdenv.mkDerivation {
   meta = {
     homepage = "https://raffalli.eu/~christophe/glsurf/";
     description = "A program to draw implicit surfaces and curves";
-    license = stdenv.lib.licenses.lgpl21;
+    license = lib.licenses.lgpl21;
   };
 }
diff --git a/pkgs/applications/science/math/gmsh/default.nix b/pkgs/applications/science/math/gmsh/default.nix
index 1b6dc2ae00760..4ed9c963ba399 100644
--- a/pkgs/applications/science/math/gmsh/default.nix
+++ b/pkgs/applications/science/math/gmsh/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, blas, lapack, gfortran, gmm, fltk, libjpeg
+{ lib, stdenv, fetchurl, cmake, blas, lapack, gfortran, gmm, fltk, libjpeg
 , zlib, libGL, libGLU, xorg, opencascade-occt }:
 
 assert (!blas.isILP64) && (!lapack.isILP64);
@@ -24,6 +24,6 @@ stdenv.mkDerivation rec {
     description = "A three-dimensional finite element mesh generator";
     homepage = "http://gmsh.info/";
     platforms = [ "x86_64-linux" ];
-    license = stdenv.lib.licenses.gpl2Plus;
+    license = lib.licenses.gpl2Plus;
   };
 }
diff --git a/pkgs/applications/science/math/gurobi/default.nix b/pkgs/applications/science/math/gurobi/default.nix
index f2f406991e304..6066d0325f543 100644
--- a/pkgs/applications/science/math/gurobi/default.nix
+++ b/pkgs/applications/science/math/gurobi/default.nix
@@ -6,7 +6,7 @@ in stdenv.mkDerivation rec {
   pname = "gurobi";
   version = "${majorVersion}.0";
 
-  src = with stdenv.lib; fetchurl {
+  src = with lib; fetchurl {
     url = "http://packages.gurobi.com/${versions.majorMinor version}/gurobi${version}_linux64.tar.gz";
     sha256 = "1yjqbzqnq4jjkjm616d36bgd3rmqr0a1ii17n0prpdjzmdlq63dz";
   };
diff --git a/pkgs/applications/science/math/mathematica/10.nix b/pkgs/applications/science/math/mathematica/10.nix
index 277fb1984c44a..9a8f05bc575fb 100644
--- a/pkgs/applications/science/math/mathematica/10.nix
+++ b/pkgs/applications/science/math/mathematica/10.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , coreutils
 , patchelf
 , requireFile
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
 
   src = requireFile rec {
     name = "Mathematica_${version}_LINUX.sh";
-    message = '' 
+    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>.
@@ -69,9 +69,9 @@ stdenv.mkDerivation rec {
     libSM
   ]);
 
-  ldpath = stdenv.lib.makeLibraryPath buildInputs
-    + stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
-      (":" + stdenv.lib.makeSearchPathOutput "lib" "lib64" buildInputs);
+  ldpath = lib.makeLibraryPath buildInputs
+    + lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
+      (":" + lib.makeSearchPathOutput "lib" "lib64" buildInputs);
 
   phases = "unpackPhase installPhase fixupPhase";
 
@@ -104,7 +104,7 @@ stdenv.mkDerivation rec {
         echo "patching $f executable <<"
         patchelf --shrink-rpath "$f"
         patchelf \
-	  --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
+    --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
           --set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \
           "$f" \
           && patchelf --shrink-rpath "$f" \
@@ -131,6 +131,6 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Wolfram Mathematica computational software system";
     homepage = "http://www.wolfram.com/mathematica/";
-    license = stdenv.lib.licenses.unfree;
+    license = lib.licenses.unfree;
   };
 }
diff --git a/pkgs/applications/science/math/mathematica/11.nix b/pkgs/applications/science/math/mathematica/11.nix
index 1c698a5e5428e..b8270cca90858 100644
--- a/pkgs/applications/science/math/mathematica/11.nix
+++ b/pkgs/applications/science/math/mathematica/11.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , coreutils
 , patchelf
 , requireFile
@@ -26,7 +26,7 @@
 let
   l10n =
     import ./l10ns.nix {
-      lib = stdenv.lib;
+      lib = lib;
       inherit requireFile lang;
       majorVersion = "11";
     };
@@ -70,9 +70,9 @@ stdenv.mkDerivation rec {
     libSM
   ]);
 
-  ldpath = stdenv.lib.makeLibraryPath buildInputs
-    + stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
-      (":" + stdenv.lib.makeSearchPathOutput "lib" "lib64" buildInputs);
+  ldpath = lib.makeLibraryPath buildInputs
+    + lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
+      (":" + lib.makeSearchPathOutput "lib" "lib64" buildInputs);
 
   phases = "unpackPhase installPhase fixupPhase";
 
@@ -118,7 +118,7 @@ stdenv.mkDerivation rec {
         echo "patching $f executable <<"
         patchelf --shrink-rpath "$f"
         patchelf \
-	  --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
+    --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
           --set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \
           "$f" \
           && patchelf --shrink-rpath "$f" \
@@ -145,6 +145,6 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Wolfram Mathematica computational software system";
     homepage = "http://www.wolfram.com/mathematica/";
-    license = stdenv.lib.licenses.unfree;
+    license = lib.licenses.unfree;
   };
 }
diff --git a/pkgs/applications/science/math/mathematica/9.nix b/pkgs/applications/science/math/mathematica/9.nix
index d0967485c01fa..43d7853e3d9af 100644
--- a/pkgs/applications/science/math/mathematica/9.nix
+++ b/pkgs/applications/science/math/mathematica/9.nix
@@ -1,4 +1,4 @@
-{ stdenv
+{ lib, stdenv
 , coreutils
 , patchelf
 , requireFile
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
 
   src = requireFile {
     name = "Mathematica_9.0.0_LINUX.sh";
-    message = '' 
+    message = ''
       This nix expression requires that Mathematica_9.0.0_LINUX.sh 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>.
@@ -59,9 +59,9 @@ stdenv.mkDerivation rec {
     libxcb
   ]);
 
-  ldpath = stdenv.lib.makeLibraryPath buildInputs
-    + stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
-      (":" + stdenv.lib.makeSearchPathOutput "lib" "lib64" buildInputs);
+  ldpath = lib.makeLibraryPath buildInputs
+    + lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
+      (":" + lib.makeSearchPathOutput "lib" "lib64" buildInputs);
 
   phases = "unpackPhase installPhase fixupPhase";
 
@@ -117,6 +117,6 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Wolfram Mathematica computational software system";
     homepage = "http://www.wolfram.com/mathematica/";
-    license = stdenv.lib.licenses.unfree;
+    license = lib.licenses.unfree;
   };
 }
diff --git a/pkgs/applications/science/math/mathematica/default.nix b/pkgs/applications/science/math/mathematica/default.nix
index e91ad5e5f8c95..497592f1c068b 100644
--- a/pkgs/applications/science/math/mathematica/default.nix
+++ b/pkgs/applications/science/math/mathematica/default.nix
@@ -28,7 +28,7 @@
 let
   l10n =
     import ./l10ns.nix {
-      lib = stdenv.lib;
+      lib = lib;
       inherit requireFile lang;
     };
 in
@@ -74,9 +74,9 @@ stdenv.mkDerivation rec {
     libSM
   ]);
 
-  ldpath = stdenv.lib.makeLibraryPath buildInputs
-    + stdenv.lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
-      (":" + stdenv.lib.makeSearchPathOutput "lib" "lib64" buildInputs);
+  ldpath = lib.makeLibraryPath buildInputs
+    + lib.optionalString (stdenv.hostPlatform.system == "x86_64-linux")
+      (":" + lib.makeSearchPathOutput "lib" "lib64" buildInputs);
 
   unpackPhase = ''
     echo "=== Extracting makeself archive ==="
@@ -125,7 +125,7 @@ stdenv.mkDerivation rec {
         echo "patching $f executable <<"
         patchelf --shrink-rpath "$f"
         patchelf \
-	  --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
+    --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
           --set-rpath "$(patchelf --print-rpath "$f"):${ldpath}" \
           "$f" \
           && patchelf --shrink-rpath "$f" \
@@ -144,7 +144,7 @@ stdenv.mkDerivation rec {
   '';
 
   dontBuild = true;
-  
+
   # This is primarily an IO bound build; there's little benefit to building remotely.
   preferLocalBuild = true;
 
diff --git a/pkgs/applications/science/math/maxima/default.nix b/pkgs/applications/science/math/maxima/default.nix
index cdc81a8764656..01f086c92c755 100644
--- a/pkgs/applications/science/math/maxima/default.nix
+++ b/pkgs/applications/science/math/maxima/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, sbcl, texinfo, perl, python, makeWrapper, autoreconfHook
+{ lib, stdenv, fetchurl, fetchpatch, sbcl, texinfo, perl, python, makeWrapper, autoreconfHook
 , rlwrap ? null, tk ? null, gnuplot ? null, ecl ? null, ecl-fasl ? false
 }:
 
@@ -7,8 +7,8 @@ let
   version = "5.44.0";
 
   searchPath =
-    stdenv.lib.makeBinPath
-      (stdenv.lib.filter (x: x != null) [ sbcl ecl rlwrap tk gnuplot ]);
+    lib.makeBinPath
+      (lib.filter (x: x != null) [ sbcl ecl rlwrap tk gnuplot ]);
 in
 stdenv.mkDerivation ({
   inherit version;
@@ -21,7 +21,7 @@ stdenv.mkDerivation ({
 
   nativeBuildInputs = [ autoreconfHook ];
 
-  buildInputs = stdenv.lib.filter (x: x != null) [
+  buildInputs = lib.filter (x: x != null) [
     sbcl ecl texinfo perl python makeWrapper
     gnuplot   # required in the test suite
   ];
@@ -40,7 +40,7 @@ stdenv.mkDerivation ({
     ln -s ../maxima/${version}/emacs $out/share/emacs/site-lisp
     ln -s ../maxima/${version}/doc $out/share/doc/maxima
   ''
-   + (stdenv.lib.optionalString ecl-fasl ''
+   + (lib.optionalString ecl-fasl ''
      cp src/binary-ecl/maxima.fas* "$out/lib/maxima/${version}/binary-ecl/"
    '')
   ;
@@ -63,7 +63,7 @@ stdenv.mkDerivation ({
       url = "https://git.sagemath.org/sage.git/plain/build/pkgs/maxima/patches/undoing_true_false_printing_patch.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
       sha256 = "0fvi3rcjv6743sqsbgdzazy9jb6r1p1yq63zyj9fx42wd1hgf7yx";
     })
-  ] ++ stdenv.lib.optionals ecl-fasl [
+  ] ++ lib.optionals ecl-fasl [
     # build fasl, needed for ECL support
     (fetchpatch {
       url = "https://git.sagemath.org/sage.git/plain/build/pkgs/maxima/patches/maxima.system.patch?id=07d6c37d18811e2b377a9689790a7c5e24da16ba";
@@ -94,7 +94,7 @@ stdenv.mkDerivation ({
   meta = {
     description = "Computer algebra system";
     homepage = "http://maxima.sourceforge.net";
-    license = stdenv.lib.licenses.gpl2;
+    license = lib.licenses.gpl2;
 
     longDescription = ''
       Maxima is a fairly complete computer algebra system written in
@@ -103,7 +103,7 @@ stdenv.mkDerivation ({
       symbolic integration, 3D plotting, and an ODE solver.
     '';
 
-    platforms = stdenv.lib.platforms.unix;
-    maintainers = [ stdenv.lib.maintainers.peti ];
+    platforms = lib.platforms.unix;
+    maintainers = [ lib.maintainers.peti ];
   };
 })
diff --git a/pkgs/applications/science/math/msieve/default.nix b/pkgs/applications/science/math/msieve/default.nix
index db7a1c1490680..679b29cb062bc 100644
--- a/pkgs/applications/science/math/msieve/default.nix
+++ b/pkgs/applications/science/math/msieve/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, zlib, gmp, ecm }:
+{lib, stdenv, fetchurl, zlib, gmp, ecm }:
 
 stdenv.mkDerivation {
   name = "msieve-1.53";
@@ -22,9 +22,9 @@ stdenv.mkDerivation {
 
   meta = {
     description = "A C library implementing a suite of algorithms to factor large integers";
-    license = stdenv.lib.licenses.publicDomain;
+    license = lib.licenses.publicDomain;
     homepage = "http://msieve.sourceforge.net/";
-    maintainers = [ stdenv.lib.maintainers.roconnor ];
-    platforms = [ "x86_64-linux" ] ++ stdenv.lib.platforms.darwin;
+    maintainers = [ lib.maintainers.roconnor ];
+    platforms = [ "x86_64-linux" ] ++ lib.platforms.darwin;
   };
 }
diff --git a/pkgs/applications/science/math/palp/default.nix b/pkgs/applications/science/math/palp/default.nix
index b5b9577d4930b..97b5f88e55b44 100644
--- a/pkgs/applications/science/math/palp/default.nix
+++ b/pkgs/applications/science/math/palp/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     "format"
   ];
 
-  patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
+  patchPhase = lib.optionalString stdenv.isDarwin ''
     substituteInPlace GNUmakefile --replace gcc cc
   '';
 
@@ -46,7 +46,7 @@ stdenv.mkDerivation rec {
     for file in poly class cws nef mori; do
         cp -p $file.x "$out/bin/$file-${dim}d.x"
     done
-  '' + stdenv.lib.optionalString doSymlink ''
+  '' + lib.optionalString doSymlink ''
     cd "$out/bin"
     for file in poly class cws nef mori; do
         ln -sf $file-6d.x $file.x
diff --git a/pkgs/applications/science/math/pari/default.nix b/pkgs/applications/science/math/pari/default.nix
index dd965e17c73c6..a99cbbbe0dfdb 100644
--- a/pkgs/applications/science/math/pari/default.nix
+++ b/pkgs/applications/science/math/pari/default.nix
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     # Versions with current majorMinor values are at http://pari.math.u-bordeaux.fr/pub/pari/unix/${pname}-${version}.tar.gz
-    url = "https://pari.math.u-bordeaux.fr/pub/pari/OLD/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.gz";
+    url = "https://pari.math.u-bordeaux.fr/pub/pari/OLD/${lib.versions.majorMinor version}/${pname}-${version}.tar.gz";
     sha256 = "sha256-v8iPxPc1L0hA5uNSxy8DacvqikVAOxg0piafNwmXCxw=";
   };
 
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
     libX11
     tex
     perl
-  ] ++ stdenv.lib.optionals withThread [
+  ] ++ lib.optionals withThread [
     libpthreadstubs
   ];
 
@@ -34,14 +34,14 @@ stdenv.mkDerivation rec {
   configureFlags = [
     "--with-gmp=${gmp.dev}"
     "--with-readline=${readline.dev}"
-  ] ++ stdenv.lib.optional stdenv.isDarwin "--host=x86_64-darwin"
-  ++ stdenv.lib.optional withThread "--mt=pthread";
+  ] ++ lib.optional stdenv.isDarwin "--host=x86_64-darwin"
+  ++ lib.optional withThread "--mt=pthread";
 
   preConfigure = ''
     export LD=$CC
   '';
 
-  postConfigure = stdenv.lib.optionalString stdenv.isDarwin ''
+  postConfigure = lib.optionalString stdenv.isDarwin ''
     echo 'echo x86_64-darwin' > config/arch-osname
   '';
 
diff --git a/pkgs/applications/science/math/pcalc/default.nix b/pkgs/applications/science/math/pcalc/default.nix
index f372357fe7d8e..1ee45ca266a1d 100644
--- a/pkgs/applications/science/math/pcalc/default.nix
+++ b/pkgs/applications/science/math/pcalc/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchgit, bison, flex }:
+{ lib, stdenv, fetchgit, bison, flex }:
 
-with stdenv.lib;
+with lib;
 
 stdenv.mkDerivation rec {
   pname = "pcalc";
@@ -19,8 +19,8 @@ stdenv.mkDerivation rec {
     homepage = "http://pcalc.sourceforge.net/";
     description = "Programmer's calculator";
     license = licenses.gpl2;
-    maintainers = with stdenv.lib.maintainers; [ ftrvxmtrx ];
-    platforms = stdenv.lib.platforms.linux;
+    maintainers = with lib.maintainers; [ ftrvxmtrx ];
+    platforms = lib.platforms.linux;
     inherit version;
   };
 }
diff --git a/pkgs/applications/science/math/perseus/default.nix b/pkgs/applications/science/math/perseus/default.nix
index 55293e6c8a79a..242f2e2cea5db 100644
--- a/pkgs/applications/science/math/perseus/default.nix
+++ b/pkgs/applications/science/math/perseus/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, unzip }:
+{ lib, stdenv, fetchurl, unzip }:
 
 stdenv.mkDerivation {
   name = "perseus-4-beta";
@@ -33,8 +33,8 @@ stdenv.mkDerivation {
       matrices and so forth.
     '';
     homepage = "http://www.sas.upenn.edu/~vnanda/perseus/index.html";
-    license = stdenv.lib.licenses.gpl3;
-    maintainers = with stdenv.lib.maintainers; [erikryb];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl3;
+    maintainers = with lib.maintainers; [erikryb];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/applications/science/math/polymake/default.nix b/pkgs/applications/science/math/polymake/default.nix
index d4f13f84f81c5..552881c5f1ad5 100644
--- a/pkgs/applications/science/math/polymake/default.nix
+++ b/pkgs/applications/science/math/polymake/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl
+{ lib, stdenv, fetchurl
 , ninja, libxml2, libxslt, readline, perl, gmp, mpfr, boost
 , bliss, ppl, singular, cddlib, lrs, nauty
 , ant, openjdk
@@ -39,9 +39,9 @@ stdenv.mkDerivation rec {
   meta = {
     inherit version;
     description = "Software for research in polyhedral geometry";
-    license = stdenv.lib.licenses.gpl2 ;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.gpl2 ;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.linux;
     homepage = "https://www.polymake.org/doku.php";
   };
 }
diff --git a/pkgs/applications/science/math/pspp/default.nix b/pkgs/applications/science/math/pspp/default.nix
index d6c5b58f0d561..9d76ef75d2684 100644
--- a/pkgs/applications/science/math/pspp/default.nix
+++ b/pkgs/applications/science/math/pspp/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, libxml2, readline, zlib, perl, cairo, gtk3, gsl
+{ lib, stdenv, fetchurl, libxml2, readline, zlib, perl, cairo, gtk3, gsl
 , pkgconfig, gtksourceview, pango, gettext, dconf
 , makeWrapper, gsettings-desktop-schemas, hicolor-icon-theme
 , texinfo, ssw, python3
@@ -28,13 +28,13 @@ stdenv.mkDerivation rec {
      --prefix XDG_DATA_DIRS : "$out/share" \
      --prefix XDG_DATA_DIRS : "$XDG_ICON_DIRS" \
      --prefix XDG_DATA_DIRS : "$GSETTINGS_SCHEMAS_PATH" \
-     --prefix GIO_EXTRA_MODULES : "${stdenv.lib.getLib dconf}/lib/gio/modules"
+     --prefix GIO_EXTRA_MODULES : "${lib.getLib dconf}/lib/gio/modules"
   '';
 
   meta = {
     homepage = "https://www.gnu.org/software/pspp/";
     description = "A free replacement for SPSS, a program for statistical analysis of sampled data";
-    license = stdenv.lib.licenses.gpl3Plus;
+    license = lib.licenses.gpl3Plus;
 
     longDescription = ''
       PSPP is a program for statistical analysis of sampled data. It is
@@ -48,6 +48,6 @@ stdenv.mkDerivation rec {
       more traditional syntax commands.
     '';
 
-    platforms = stdenv.lib.platforms.unix;
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/applications/science/math/ratpoints/default.nix b/pkgs/applications/science/math/ratpoints/default.nix
index fb205a69f0385..823c8abf52993 100644
--- a/pkgs/applications/science/math/ratpoints/default.nix
+++ b/pkgs/applications/science/math/ratpoints/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, gmp }:
+{ lib, stdenv, fetchurl, fetchpatch, gmp }:
 stdenv.mkDerivation rec {
   pname = "ratpoints";
   version = "2.1.3.p4";
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ gmp ];
 
   makeFlags = [ "CC=cc" ];
-  buildFlags = stdenv.lib.optional stdenv.isDarwin ["CCFLAGS2=-lgmp -lc -lm" "CCFLAGS=-UUSE_SSE"];
+  buildFlags = lib.optional stdenv.isDarwin ["CCFLAGS2=-lgmp -lc -lm" "CCFLAGS=-UUSE_SSE"];
   installFlags = [ "INSTALL_DIR=$(out)" ];
 
   preInstall = ''mkdir -p "$out"/{bin,share,lib,include}'';
@@ -28,9 +28,9 @@ stdenv.mkDerivation rec {
   meta = {
     inherit version;
     description = ''A program to find rational points on hyperelliptic curves'';
-    license = stdenv.lib.licenses.gpl2Plus;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2Plus;
+    maintainers = [lib.maintainers.raskin];
+    platforms = lib.platforms.unix;
     homepage = "http://www.mathe2.uni-bayreuth.de/stoll/programs/";
     updateWalker = true;
   };
diff --git a/pkgs/applications/science/math/ripser/default.nix b/pkgs/applications/science/math/ripser/default.nix
index 1c8ced5ed222c..21f0d00339151 100644
--- a/pkgs/applications/science/math/ripser/default.nix
+++ b/pkgs/applications/science/math/ripser/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchFromGitHub
+{ lib, stdenv, fetchurl, fetchFromGitHub
 , assembleReductionMatrix ? false
 , useCoefficients ? false
 , indicateProgress ? false
@@ -6,14 +6,14 @@
 , fileFormat ? "lowerTriangularCsv"
 }:
 
-with stdenv.lib;
+with lib;
 
 assert assertOneOf "fileFormat" fileFormat
   ["lowerTriangularCsv" "upperTriangularCsv" "dipha"];
 assert useGoogleHashmap -> sparsehash != null;
 
 let
-  inherit (stdenv.lib) optional;
+  inherit (lib) optional;
   version = "1.0";
 in
 stdenv.mkDerivation {
@@ -60,8 +60,8 @@ stdenv.mkDerivation {
   meta = {
     description = "A lean C++ code for the computation of Vietoris–Rips persistence barcodes";
     homepage = "https://github.com/Ripser/ripser";
-    license = stdenv.lib.licenses.lgpl3;
-    maintainers = with stdenv.lib.maintainers; [erikryb];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.lgpl3;
+    maintainers = with lib.maintainers; [erikryb];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/applications/science/math/sage/sage.nix b/pkgs/applications/science/math/sage/sage.nix
index b9256e32f8b13..106f9eea3097e 100644
--- a/pkgs/applications/science/math/sage/sage.nix
+++ b/pkgs/applications/science/math/sage/sage.nix
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
     mkdir -p "$out/bin"
     makeWrapper "${sage-with-env}/bin/sage" "$out/bin/sage" \
       --set SAGE_DOC_SRC_OVERRIDE "${src}/src/doc" ${
-        stdenv.lib.optionalString withDoc "--set SAGE_DOC_OVERRIDE ${sagedoc}/share/doc/sage"
+        lib.optionalString withDoc "--set SAGE_DOC_OVERRIDE ${sagedoc}/share/doc/sage"
       } \
       --prefix JUPYTER_PATH : "${kernel-specs}"
   '';
diff --git a/pkgs/applications/science/math/scilab/default.nix b/pkgs/applications/science/math/scilab/default.nix
index 24b3feef51e11..95c6c23fb09ad 100644
--- a/pkgs/applications/science/math/scilab/default.nix
+++ b/pkgs/applications/science/math/scilab/default.nix
@@ -35,14 +35,14 @@ stdenv.mkDerivation rec {
     # do not compile with PVM library
     "--without-pvm"
     # compile with GTK
-    (stdenv.lib.enableFeature withGtk "gtk")
-    (stdenv.lib.enableFeature withGtk "gtk2")
+    (lib.enableFeature withGtk "gtk")
+    (lib.enableFeature withGtk "gtk2")
     # compile with ocaml
-    (stdenv.lib.withFeature withOCaml "ocaml")
+    (lib.withFeature withOCaml "ocaml")
     # do not compile Java interface
     "--without-java"
     # use the X Window System
-    (stdenv.lib.withFeature withX "x")
+    (lib.withFeature withX "x")
     # compile with TCL/TK
   ] ++ lib.optionals withTk [
     "--with-tk"
diff --git a/pkgs/applications/science/math/scotch/default.nix b/pkgs/applications/science/math/scotch/default.nix
index 75a6b2dba68c3..6f8753ff38ac0 100644
--- a/pkgs/applications/science/math/scotch/default.nix
+++ b/pkgs/applications/science/math/scotch/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, bison, openmpi, flex, zlib}:
+{ lib, stdenv, fetchurl, bison, openmpi, flex, zlib}:
 
 stdenv.mkDerivation rec {
   version = "6.0.4";
@@ -24,13 +24,13 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Graph and mesh/hypergraph partitioning, graph clustering, and sparse matrix ordering";
     longDescription = ''
-      Scotch is a software package for graph and mesh/hypergraph partitioning, graph clustering, 
+      Scotch is a software package for graph and mesh/hypergraph partitioning, graph clustering,
       and sparse matrix ordering.
     '';
     homepage = "http://www.labri.fr/perso/pelegrin/scotch";
-    license = stdenv.lib.licenses.cecill-c;
-    maintainers = [ stdenv.lib.maintainers.bzizou ];
-    platforms = stdenv.lib.platforms.linux;
+    license = lib.licenses.cecill-c;
+    maintainers = [ lib.maintainers.bzizou ];
+    platforms = lib.platforms.linux;
   };
 }
 
diff --git a/pkgs/applications/science/math/weka/default.nix b/pkgs/applications/science/math/weka/default.nix
index c4fc19d6c6b71..179801da379fa 100644
--- a/pkgs/applications/science/math/weka/default.nix
+++ b/pkgs/applications/science/math/weka/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, jre, unzip, makeWrapper }:
+{ lib, stdenv, fetchurl, jre, unzip, makeWrapper }:
 
 stdenv.mkDerivation rec {
   pname = "weka";
   version = "3.9.2";
 
   src = fetchurl {
-    url = "mirror://sourceforge/weka/${stdenv.lib.replaceChars ["."]["-"] "${pname}-${version}"}.zip";
+    url = "mirror://sourceforge/weka/${lib.replaceChars ["."]["-"] "${pname}-${version}"}.zip";
     sha256 = "0zwmhspmqb0a7cm6k6i0s6q3w19ws1g9dx3cp2v3g3vsif6cdh31";
   };
 
@@ -24,8 +24,8 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = "http://www.cs.waikato.ac.nz/ml/weka/";
     description = "Collection of machine learning algorithms for data mining tasks";
-    license = stdenv.lib.licenses.gpl2Plus;
-    maintainers = [ stdenv.lib.maintainers.mimame ];
-    platforms = stdenv.lib.platforms.unix;
+    license = lib.licenses.gpl2Plus;
+    maintainers = [ lib.maintainers.mimame ];
+    platforms = lib.platforms.unix;
   };
 }
diff --git a/pkgs/applications/science/math/yacas/default.nix b/pkgs/applications/science/math/yacas/default.nix
index 06aab669df5a8..05d1f780bf30e 100644
--- a/pkgs/applications/science/math/yacas/default.nix
+++ b/pkgs/applications/science/math/yacas/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, perl
+{ lib, stdenv, fetchFromGitHub, cmake, perl
 , enableGui ? false, qt5
 , enableJupyter ? false, boost, jsoncpp, openssl, zmqpp
 }:
@@ -24,16 +24,16 @@ stdenv.mkDerivation rec {
   # Perl is only for the documentation
   nativeBuildInputs = [ cmake perl ];
   buildInputs = [
-  ] ++ stdenv.lib.optionals enableGui (with qt5; [ qtbase qtwebkit ])
-    ++ stdenv.lib.optionals enableJupyter [ boost jsoncpp openssl zmqpp ]
+  ] ++ lib.optionals enableGui (with qt5; [ qtbase qtwebkit ])
+    ++ lib.optionals enableJupyter [ boost jsoncpp openssl zmqpp ]
     ;
 
   meta = {
     description = "Easy to use, general purpose Computer Algebra System";
     homepage = "http://www.yacas.org/";
-    license = stdenv.lib.licenses.gpl2Plus;
-    maintainers = with stdenv.lib.maintainers; [viric];
-    platforms = with stdenv.lib.platforms; linux;
+    license = lib.licenses.gpl2Plus;
+    maintainers = with lib.maintainers; [viric];
+    platforms = with lib.platforms; linux;
     broken = enableGui || enableJupyter;
   };
 }