about summary refs log tree commit diff
path: root/pkgs/development/interpreters
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas@tuxera.com>2018-01-26 16:46:43 +0200
committerTuomas Tynkkynen <tuomas@tuxera.com>2018-01-26 16:46:43 +0200
commit6a11ebfae93708d8156b11847d3bae6315d5cd4a (patch)
tree0cead5fe37f5d0f9be2cf8c95710b72f9cfc7808 /pkgs/development/interpreters
parent18300172897169e62d6140c34f5949a7a2232375 (diff)
parent4a2f7a73cc2bfde778194fafb8efb0c16de366bb (diff)
Merge remote-tracking branch 'upstream/master' into gcc-7
Conflicts:
	pkgs/development/compilers/gcc/7/default.nix
	pkgs/development/libraries/SDL2/default.nix
	pkgs/top-level/all-packages.nix
Diffstat (limited to 'pkgs/development/interpreters')
-rw-r--r--pkgs/development/interpreters/clisp/2.33.2.nix66
-rw-r--r--pkgs/development/interpreters/clisp/2.44.1.nix60
-rw-r--r--pkgs/development/interpreters/clisp/hg.nix7
-rw-r--r--pkgs/development/interpreters/clojure/default.nix22
-rw-r--r--pkgs/development/interpreters/elixir/1.5.nix4
-rw-r--r--pkgs/development/interpreters/elixir/1.6.nix7
-rw-r--r--pkgs/development/interpreters/elixir/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/erlang/R16.nix35
-rw-r--r--pkgs/development/interpreters/erlang/R16B02-basho.nix (renamed from pkgs/development/interpreters/erlang/R16B02-8-basho.nix)12
-rw-r--r--pkgs/development/interpreters/erlang/R17.nix35
-rw-r--r--pkgs/development/interpreters/erlang/R18.nix14
-rw-r--r--pkgs/development/interpreters/erlang/R19.nix4
-rw-r--r--pkgs/development/interpreters/erlang/R20.nix4
-rw-r--r--pkgs/development/interpreters/erlang/generic-builder.nix7
-rw-r--r--pkgs/development/interpreters/erlang/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/guile/default.nix4
-rw-r--r--pkgs/development/interpreters/guile/setup-hook-2.0.sh2
-rw-r--r--pkgs/development/interpreters/guile/setup-hook-2.2.sh2
-rw-r--r--pkgs/development/interpreters/guile/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/hy/default.nix2
-rw-r--r--pkgs/development/interpreters/j/default.nix88
-rw-r--r--pkgs/development/interpreters/joker/default.nix4
-rw-r--r--pkgs/development/interpreters/joker/deps.nix9
-rw-r--r--pkgs/development/interpreters/jruby/default.nix2
-rw-r--r--pkgs/development/interpreters/lua-5/5.1.nix3
-rw-r--r--pkgs/development/interpreters/lua-5/5.2.nix6
-rw-r--r--pkgs/development/interpreters/lua-5/5.3.nix6
-rw-r--r--pkgs/development/interpreters/lua-5/filesystem.nix2
-rw-r--r--pkgs/development/interpreters/lua-5/sockets.nix2
-rw-r--r--pkgs/development/interpreters/luajit/default.nix5
-rw-r--r--pkgs/development/interpreters/lush/default.nix4
-rw-r--r--pkgs/development/interpreters/nix-exec/default.nix1
-rw-r--r--pkgs/development/interpreters/perl/default.nix59
-rw-r--r--pkgs/development/interpreters/perl/no-sys-dirs-5.26.patch250
-rw-r--r--pkgs/development/interpreters/perl/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/php/default.nix39
-rw-r--r--pkgs/development/interpreters/picoc/default.nix1
-rw-r--r--pkgs/development/interpreters/pixie/default.nix9
-rw-r--r--pkgs/development/interpreters/pixie/dust.nix2
-rw-r--r--pkgs/development/interpreters/python/build-python-package-setuptools.nix8
-rw-r--r--pkgs/development/interpreters/python/build-python-package.nix16
-rw-r--r--pkgs/development/interpreters/python/cpython/2.7/default.nix10
-rw-r--r--pkgs/development/interpreters/python/cpython/3.4/default.nix4
-rw-r--r--pkgs/development/interpreters/python/cpython/3.5/default.nix4
-rw-r--r--pkgs/development/interpreters/python/cpython/3.6/default.nix8
-rw-r--r--pkgs/development/interpreters/python/mk-python-derivation.nix55
-rw-r--r--pkgs/development/interpreters/python/pypy/2.7/2604-skip-urandom-fd-test.patch21
-rw-r--r--pkgs/development/interpreters/python/pypy/2.7/default.nix249
-rw-r--r--pkgs/development/interpreters/python/pypy/2.7/tk_tcl_paths.patch17
-rw-r--r--pkgs/development/interpreters/python/setup-hook.sh5
-rw-r--r--pkgs/development/interpreters/python/wrap.sh4
-rw-r--r--pkgs/development/interpreters/python/wrapper.nix10
-rw-r--r--pkgs/development/interpreters/racket/default.nix2
-rw-r--r--pkgs/development/interpreters/ruby/default.nix46
-rw-r--r--pkgs/development/interpreters/ruby/patchsets.nix11
-rw-r--r--pkgs/development/interpreters/ruby/rvm-patchsets.nix4
-rw-r--r--pkgs/development/interpreters/spidermonkey/31.nix2
-rw-r--r--pkgs/development/interpreters/spidermonkey/38.nix2
-rw-r--r--pkgs/development/interpreters/supercollider/default.nix4
59 files changed, 725 insertions, 544 deletions
diff --git a/pkgs/development/interpreters/clisp/2.33.2.nix b/pkgs/development/interpreters/clisp/2.33.2.nix
deleted file mode 100644
index 18b325684ca5c..0000000000000
--- a/pkgs/development/interpreters/clisp/2.33.2.nix
+++ /dev/null
@@ -1,66 +0,0 @@
-{ stdenv, fetchurl, libsigsegv, gettext, ncurses, readline, libX11
-, libXau, libXt, pcre, zlib, libXpm, xproto, libXext, xextproto
-, libffi, libffcall, coreutils, automake, autoconf, linuxHeaders
-, groff
-}:
-        
-stdenv.mkDerivation rec {
-  version = "2.33.2";
-  name = "clisp-${version}";
-  
-  src = fetchurl {
-    url = "mirror://gnu/clisp/release/${version}/${name}.tar.gz";
-    sha256 = "0rqyggviixaa68n5ll092ll4a2xy4y7jraq65l0gn0hkjhjnm5zh";
-  };
-
-  buildInputs =
-    [ libsigsegv gettext ncurses readline libX11 libXau libXt pcre
-      zlib libXpm xproto libXext xextproto libffi libffcall 
-      automake autoconf groff
-    ]
-    ++ (stdenv.lib.optional stdenv.isLinux linuxHeaders)
-    ;
-
-  # First, replace port 9090 (rather low, can be used)
-  # with 64237 (much higher, IANA private area, not
-  # anything rememberable).
-  # Also remove reference to a type that disappeared from recent glibc
-  # (seems the correct thing to do, found no reference to any solution)
-  postPatch = ''
-    sed -i 's@/bin/pwd@${coreutils}&@' src/clisp-link.in
-    find . -type f | xargs sed -e 's/-lICE/-lXau &/' -i
-
-    substituteInPlace modules/bindings/glibc/linux.lisp --replace "(def-c-type __swblk_t)" ""
-  '';
-  
-  configureFlags =
-    ''
-      builddir
-      --with-readline --with-ffcall --with-dynamic-ffi
-      --with-module=readline --with-module=i18n --with-module=pcre
-      --with-module=syscalls --with-modules=zlib --with-module=curses
-    '';
-
-  preBuild = ''
-    echo Pre-build starting!
-    sed -e '/avcall.h/a\#include "config.h"' -i src/foreign.d
-    sed -e '/asm\/page.h/d' -i src/unix.d
-    cd builddir
-    ./makemake $configureFlags > Makefile
-    make config.lisp
-    cat config.lisp
-  '';
-
-  NIX_CFLAGS_COMPILE="-O0 -lreadline -lncursesw";
-
-  # TODO : make mod-check fails
-  doCheck = false;
-
-  meta = {
-    description = "ANSI Common Lisp Implementation";
-    homepage = http://clisp.cons.org;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
-    branch = "2.44";
-  };
-}
diff --git a/pkgs/development/interpreters/clisp/2.44.1.nix b/pkgs/development/interpreters/clisp/2.44.1.nix
deleted file mode 100644
index b7b329ea9560b..0000000000000
--- a/pkgs/development/interpreters/clisp/2.44.1.nix
+++ /dev/null
@@ -1,60 +0,0 @@
-{ stdenv, fetchurl, libsigsegv, gettext, ncurses, readline, libX11
-, libXau, libXt, pcre, zlib, libXpm, xproto, libXext, xextproto
-, libffi, libffcall, coreutils }:
-
-stdenv.mkDerivation rec {
-  v = "2.44.1";
-  name = "clisp-${v}";
-
-  src = fetchurl {
-    url = "mirror://gnu/clisp/release/${v}/${name}.tar.gz";
-    sha256 = "0rkp6j6rih4s5d9acifh7pi4b9xfgcspif512l269dqy9qgyy4j1";
-  };
-
-  buildInputs =
-    [ libsigsegv gettext ncurses readline libX11 libXau libXt pcre
-      zlib libXpm xproto libXext xextproto libffi libffcall ];
-
-  patches = [ ./bits_ipctypes_to_sys_ipc.patch ]; # from Gentoo
-
-  # First, replace port 9090 (rather low, can be used)
-  # with 64237 (much higher, IANA private area, not
-  # anything rememberable).
-  # Also remove reference to a type that disappeared from recent glibc
-  # (seems the correct thing to do, found no reference to any solution)
-  postPatch = ''
-    sed -e 's@9090@64237@g' -i tests/socket.tst
-    sed -i 's@/bin/pwd@${coreutils}&@' src/clisp-link.in
-    find . -type f | xargs sed -e 's/-lICE/-lXau &/' -i
-
-    substituteInPlace modules/bindings/glibc/linux.lisp --replace "(def-c-type __swblk_t)" ""
-  '';
-
-  configureFlags =
-    ''
-      --with-readline builddir --with-dynamic-ffi
-      --with-module=clx/new-clx --with-module=i18n --with-module=bindings/glibc
-      --with-module=pcre --with-module=rawsock --with-module=readline
-      --with-module=syscalls --with-module=wildcard --with-module=zlib
-    '';
-
-  preBuild = ''
-    sed -e '/avcall.h/a\#include "config.h"' -i src/foreign.d
-    cd builddir
-  '';
-
-  NIX_CFLAGS_COMPILE = "-O0 ${stdenv.lib.optionalString (!stdenv.is64bit) "-falign-functions=4"}";
-
-  hardeningDisable = [ "format" ];
-
-  # TODO : make mod-check fails
-  doCheck = false;
-
-  meta = {
-    description = "ANSI Common Lisp Implementation";
-    homepage = http://clisp.cons.org;
-    maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
-    branch = "2.44";
-  };
-}
diff --git a/pkgs/development/interpreters/clisp/hg.nix b/pkgs/development/interpreters/clisp/hg.nix
index 597f75c464565..9839220796c7d 100644
--- a/pkgs/development/interpreters/clisp/hg.nix
+++ b/pkgs/development/interpreters/clisp/hg.nix
@@ -23,13 +23,13 @@ assert x11Support -> (libX11 != null && libXau != null && libXt != null
   && libXpm != null && xproto != null && libXext != null && xextproto != null);
 
 stdenv.mkDerivation rec {
-  v = "2.50pre20170130";
+  v = "2.50pre20171114";
   name = "clisp-${v}";
 
   src = fetchhg {
     url = "http://hg.code.sf.net/p/clisp/clisp";
-    rev = "130e74c8ea17";
-    sha256 = "1aqaxskvghc4ipbs3m4syvzn6bzj165zqvjpw0xa696i07vkk19j";
+    rev = "36df6dc59b8f";
+    sha256 = "1pidiv1m55lvc4ln8vx0ylnnhlj95y6hrfdq96nrj14f4v8fkvmr";
   };
 
   inherit libsigsegv gettext coreutils;
@@ -74,6 +74,7 @@ stdenv.mkDerivation rec {
 
   preBuild = ''
     sed -e '/avcall.h/a\#include "config.h"' -i src/foreign.d
+    sed -i -re '/ cfree /d' -i modules/bindings/glibc/linux.lisp
     cd builddir
   '';
 
diff --git a/pkgs/development/interpreters/clojure/default.nix b/pkgs/development/interpreters/clojure/default.nix
index ed2c4db20f7cd..5aaa18e5ac687 100644
--- a/pkgs/development/interpreters/clojure/default.nix
+++ b/pkgs/development/interpreters/clojure/default.nix
@@ -1,23 +1,25 @@
-{ stdenv, fetchurl, unzip, ant, jdk, makeWrapper }:
+{ stdenv, fetchurl, jdk, makeWrapper }:
 
-let version = "1.8.0"; in
+let version = "1.9.0.273"; in
 
 stdenv.mkDerivation {
   name = "clojure-${version}";
 
   src = fetchurl {
-    url = "http://repo1.maven.org/maven2/org/clojure/clojure/${version}/clojure-${version}.zip";
-    sha256 = "1nip095fz5c492sw15skril60i1vd21ibg6szin4jcvyy3xr6cym";
+    url = "https://download.clojure.org/install/clojure-tools-${version}.tar.gz";
+    sha256 = "0xmrq3xvr002jgq8m1j0y5ld0rcr49608g3gqxgyxzjqswacglb4";
   };
 
-  buildInputs = [ unzip ant jdk makeWrapper ];
-
-  buildPhase = "ant jar";
+  buildInputs = [ jdk makeWrapper ];
 
   installPhase = ''
-    mkdir -p $out/share/java $out/bin
-    install -t $out/share/java clojure.jar
-    makeWrapper ${jdk.jre}/bin/java $out/bin/clojure --add-flags "-cp $out/share/java/clojure.jar clojure.main"
+    pwd
+    ls -la
+    mkdir -p $out/libexec $out/bin
+    cp -f deps.edn example-deps.edn $out
+    cp -f clojure-tools-${version}.jar $out/libexec
+    sed -i -e "s@PREFIX@$out@g" clojure
+    cp -f clj clojure $out/bin
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/interpreters/elixir/1.5.nix b/pkgs/development/interpreters/elixir/1.5.nix
index 469502a3f85e0..d32f91275652b 100644
--- a/pkgs/development/interpreters/elixir/1.5.nix
+++ b/pkgs/development/interpreters/elixir/1.5.nix
@@ -1,7 +1,7 @@
 { mkDerivation }:
 
 mkDerivation rec {
-  version = "1.5.2";
-  sha256 = "0ng7z2gz1c8lkn07fric18b3awcw886s9xb864kmnn2iah5gc65j";
+  version = "1.5.3";
+  sha256 = "00kgqcn9g6vflc551wniz9pwv7pszyf8v6smpkqs50j3kbliihy5";
   minimumOTPVersion = "18";
 }
diff --git a/pkgs/development/interpreters/elixir/1.6.nix b/pkgs/development/interpreters/elixir/1.6.nix
new file mode 100644
index 0000000000000..673a4b6e51bb7
--- /dev/null
+++ b/pkgs/development/interpreters/elixir/1.6.nix
@@ -0,0 +1,7 @@
+{ mkDerivation }:
+
+mkDerivation rec {
+  version = "1.6.0";
+  sha256 = "0wfmbrq70n85mx17kl9h2k0xzgnhncz3xygjx9cbvpmiwwdzgrdx";
+  minimumOTPVersion = "18";
+}
diff --git a/pkgs/development/interpreters/elixir/setup-hook.sh b/pkgs/development/interpreters/elixir/setup-hook.sh
index 2ed3b2e6454b1..501eca3cf02a3 100644
--- a/pkgs/development/interpreters/elixir/setup-hook.sh
+++ b/pkgs/development/interpreters/elixir/setup-hook.sh
@@ -2,4 +2,4 @@ addErlLibPath() {
     addToSearchPath ERL_LIBS $1/lib/elixir/lib
 }
 
-envHooks+=(addErlLibPath)
+addEnvHooks "$hostOffset" addErlLibPath
diff --git a/pkgs/development/interpreters/erlang/R16.nix b/pkgs/development/interpreters/erlang/R16.nix
deleted file mode 100644
index 123d813fc77ab..0000000000000
--- a/pkgs/development/interpreters/erlang/R16.nix
+++ /dev/null
@@ -1,35 +0,0 @@
-{ mkDerivation, fetchurl }:
-
-mkDerivation rec {
-  version = "16B03-1";
-
-  src = fetchurl {
-    url = "http://www.erlang.org/download/otp_src_R${version}.tar.gz";
-    sha256 = "1rvyfh22g1fir1i4xn7v2md868wcmhajwhfsq97v7kn5kd2m7khp";
-  };
-
-  prePatch = ''
-    sed -i "s@/bin/rm@rm@" lib/odbc/configure erts/configure
-  '';
-
-  preConfigure = ''
-    export HOME=$PWD/../
-    sed -e s@/bin/pwd@pwd@g -i otp_build
-  '';
-
-  # Do not install docs, instead use prebuilt versions.
-  installTargets = "install";
-  postInstall = let
-    manpages = fetchurl {
-      url = "http://www.erlang.org/download/otp_doc_man_R${version}.tar.gz";
-      sha256 = "17f3k5j17rdsah18gywjngip6cbfgp6nb9di6il4pahmf9yvqc8g";
-    };
-  in ''
-    tar xf "${manpages}" -C "$out/lib/erlang"
-    for i in "$out"/lib/erlang/man/man[0-9]/*.[0-9]; do
-      prefix="''${i%/*}"
-      ensureDir "$out/share/man/''${prefix##*/}"
-      ln -s "$i" "$out/share/man/''${prefix##*/}/''${i##*/}erl"
-    done
-  '';
-}
diff --git a/pkgs/development/interpreters/erlang/R16B02-8-basho.nix b/pkgs/development/interpreters/erlang/R16B02-basho.nix
index a5f79c197d637..714924514edb7 100644
--- a/pkgs/development/interpreters/erlang/R16B02-8-basho.nix
+++ b/pkgs/development/interpreters/erlang/R16B02-basho.nix
@@ -2,13 +2,13 @@
 
 mkDerivation rec {
   baseName = "erlang";
-  version = "16B02";
+  version = "16B02.basho10";
 
   src = pkgs.fetchFromGitHub {
     owner = "basho";
     repo = "otp";
-    rev = "OTP_R16B02_basho8";
-    sha256 = "1w0hbm0axxxa45v3kl6bywc9ayir5vwqxjpnjlzc616ldszb2m0x";
+    rev = "OTP_R16B02_basho10";
+    sha256 = "1s2c3ag9dnp6xmcr27kh95n1w50xly97n1mp8ivc2a3gpv4blqmj";
   };
 
   preConfigure = ''
@@ -27,7 +27,7 @@ mkDerivation rec {
   installTargets = "install";
   postInstall = let
     manpages = pkgs.fetchurl {
-      url = "http://www.erlang.org/download/otp_doc_man_R${version}.tar.gz";
+      url = "http://www.erlang.org/download/otp_doc_man_R16B02.tar.gz";
       sha256 = "12apxjmmd591y9g9bhr97z5jbd1jarqg7wj0y2sqhl21hc1yp75p";
     };
   in ''
@@ -36,7 +36,7 @@ mkDerivation rec {
     tar xf "${manpages}" -C "$out/lib/erlang"
     for i in "$out"/lib/erlang/man/man[0-9]/*.[0-9]; do
       prefix="''${i%/*}"
-      ensureDir "$out/share/man/''${prefix##*/}"
+      mkdir -p "$out/share/man/''${prefix##*/}"
       ln -s "$i" "$out/share/man/''${prefix##*/}/''${i##*/}erl"
     done
   '';
@@ -56,6 +56,8 @@ mkDerivation rec {
       repository.
     '';
 
+    knownVulnerabilities = [ "CVE-2017-1000385" ];
+
     platforms = ["x86_64-linux" "x86_64-darwin"];
     license = pkgs.stdenv.lib.licenses.asl20;
     maintainers = with pkgs.stdenv.lib.maintainers; [ mdaiter ];
diff --git a/pkgs/development/interpreters/erlang/R17.nix b/pkgs/development/interpreters/erlang/R17.nix
deleted file mode 100644
index 02d7513331eb0..0000000000000
--- a/pkgs/development/interpreters/erlang/R17.nix
+++ /dev/null
@@ -1,35 +0,0 @@
-{ mkDerivation, fetchurl }:
-
-mkDerivation rec {
-  version = "17.5";
-
-  src = fetchurl {
-    url = "http://www.erlang.org/download/otp_src_${version}.tar.gz";
-    sha256 = "0x34hj1a4j3rphqdaapdld7la4sqiqillamcz06wac0vk0684a1w";
-  };
-
-  prePatch = ''
-    sed -i "s@/bin/rm@rm@" lib/odbc/configure erts/configure
-  '';
-
-  preConfigure = ''
-    export HOME=$PWD/../
-    sed -e s@/bin/pwd@pwd@g -i otp_build
-  '';
-
-  # Do not install docs, instead use prebuilt versions.
-  installTargets = "install";
-  postInstall = let
-    manpages = fetchurl {
-      url = "http://www.erlang.org/download/otp_doc_man_${version}.tar.gz";
-      sha256 = "1hspm285bl7i9a0d4r6j6lm5yk4sb5d9xzpia3simh0z06hv5cc5";
-    };
-  in ''
-    tar xf "${manpages}" -C "$out/lib/erlang"
-    for i in "$out"/lib/erlang/man/man[0-9]/*.[0-9]; do
-      prefix="''${i%/*}"
-      ensureDir "$out/share/man/''${prefix##*/}"
-      ln -s "$i" "$out/share/man/''${prefix##*/}/''${i##*/}erl"
-    done
-  '';
-}
diff --git a/pkgs/development/interpreters/erlang/R18.nix b/pkgs/development/interpreters/erlang/R18.nix
index 0d20ae662a508..967940ca184f6 100644
--- a/pkgs/development/interpreters/erlang/R18.nix
+++ b/pkgs/development/interpreters/erlang/R18.nix
@@ -1,19 +1,19 @@
-{ mkDerivation, fetchurl }:
+{ mkDerivation, fetchpatch }:
 
 let
-  rmAndPwdPatch = fetchurl {
+  rmAndPwdPatch = fetchpatch {
      url = "https://github.com/erlang/otp/commit/98b8650d22e94a5ff839170833f691294f6276d0.patch";
-     sha256 = "0cd5pkqrigiqz6cyma5irqwzn0bi17k371k9vlg8ir31h3zmqfip";
+     sha256 = "0zjs7as83prgq4d5gaw2cmnajnsprdk8cjl5kklknx0pc2b3hfg5";
   };
 
-  envAndCpPatch = fetchurl {
+  envAndCpPatch = fetchpatch {
      url = "https://github.com/erlang/otp/commit/9f9841eb7327c9fe73e84e197fd2965a97b639cf.patch";
-     sha256 = "10h5348p6g279b4q01i5jdqlljww5chcvrx5b4b0dv79pk0p0m9f";
+     sha256 = "00fx5wc88ki3z71z5q4xzi9h3whhjw1zblpn09w995ygn07m9qhm";
   };
 
 in mkDerivation rec {
-  version = "18.3.4.4";
-  sha256 = "0wilm21yi9m3v6j26vc04hsa58cxca5z4q9yxx71hm81cbm1xbwk";
+  version = "18.3.4.7";
+  sha256 = "1l66vzbb1vidrmf6gr84l34kgrpb9k7z2170bac4c6aviah9r02l";
 
   patches = [
     rmAndPwdPatch
diff --git a/pkgs/development/interpreters/erlang/R19.nix b/pkgs/development/interpreters/erlang/R19.nix
index 5e2e1c7f215d1..aa8c941eb93be 100644
--- a/pkgs/development/interpreters/erlang/R19.nix
+++ b/pkgs/development/interpreters/erlang/R19.nix
@@ -1,8 +1,8 @@
 { mkDerivation, fetchurl, fetchpatch }:
 
 mkDerivation rec {
-  version = "19.3";
-  sha256 = "0pp2hl8jf4iafpnsmf0q7jbm313daqzif6ajqcmjyl87m5pssr86";
+  version = "19.3.6.4";
+  sha256 = "1w0h3wj2h58m3jrfgw56xab2352na3i9ccrbpfs4420dn7igf071";
 
   patches = [
     # macOS 10.13 crypto fix from OTP-20.1.2
diff --git a/pkgs/development/interpreters/erlang/R20.nix b/pkgs/development/interpreters/erlang/R20.nix
index cf94a8800f9c3..8e955349f2d71 100644
--- a/pkgs/development/interpreters/erlang/R20.nix
+++ b/pkgs/development/interpreters/erlang/R20.nix
@@ -1,8 +1,8 @@
 { mkDerivation, fetchurl }:
 
 mkDerivation rec {
-  version = "20.1";
-  sha256 = "13f53lzgq2himg9kax41f66rzv5pjfrb1ln8b54yv9spkqx2hqqi";
+  version = "20.2.2";
+  sha256 = "1cns1qcmmr00nyvcvcj4p4n2gvliyjynlwfqc7qzpkjjnkb7fzl6";
 
   prePatch = ''
     substituteInPlace configure.in --replace '`sw_vers -productVersion`' '10.10'
diff --git a/pkgs/development/interpreters/erlang/generic-builder.nix b/pkgs/development/interpreters/erlang/generic-builder.nix
index af728b942ebb8..eae4a50aa20ec 100644
--- a/pkgs/development/interpreters/erlang/generic-builder.nix
+++ b/pkgs/development/interpreters/erlang/generic-builder.nix
@@ -26,7 +26,7 @@
 , installTargets ? "install install-docs"
 , checkPhase ? "", preCheck ? "", postCheck ? ""
 , fixupPhase ? "", preFixup ? "", postFixup ? ""
-, meta ? null
+, meta ? {}
 }:
 
 assert wxSupport -> (if stdenv.isDarwin
@@ -101,7 +101,7 @@ in stdenv.mkDerivation ({
 
   setupHook = ./setup-hook.sh;
 
-  meta = with stdenv.lib; {
+  meta = with stdenv.lib; ({
     homepage = http://www.erlang.org/;
     downloadPage = "http://www.erlang.org/download.html";
     description = "Programming language used for massively scalable soft real-time systems";
@@ -118,7 +118,7 @@ in stdenv.mkDerivation ({
     platforms = platforms.unix;
     maintainers = with maintainers; [ the-kenny sjmackenzie couchemar gleber ];
     license = licenses.asl20;
-  };
+  } // meta);
 }
 // optionalAttrs (preUnpack != "")      { inherit preUnpack; }
 // optionalAttrs (postUnpack != "")     { inherit postUnpack; }
@@ -140,5 +140,4 @@ in stdenv.mkDerivation ({
 // optionalAttrs (fixupPhase != "")     { inherit fixupPhase; }
 // optionalAttrs (preFixup != "")       { inherit preFixup; }
 // optionalAttrs (postFixup != "")      { inherit postFixup; }
-// optionalAttrs (meta != null)         { inherit meta; }
 )
diff --git a/pkgs/development/interpreters/erlang/setup-hook.sh b/pkgs/development/interpreters/erlang/setup-hook.sh
index 68c0f762dfc5c..3962d154ba9f7 100644
--- a/pkgs/development/interpreters/erlang/setup-hook.sh
+++ b/pkgs/development/interpreters/erlang/setup-hook.sh
@@ -2,4 +2,4 @@ addErlangLibPath() {
     addToSearchPath ERL_LIBS $1/lib/erlang/lib
 }
 
-envHooks+=(addErlangLibPath)
+addEnvHooks "$hostOffset" addErlangLibPath
diff --git a/pkgs/development/interpreters/guile/default.nix b/pkgs/development/interpreters/guile/default.nix
index fe9f94beed17d..e10c5fbb56840 100644
--- a/pkgs/development/interpreters/guile/default.nix
+++ b/pkgs/development/interpreters/guile/default.nix
@@ -10,11 +10,11 @@
 
 (rec {
   name = "guile-${version}";
-  version = "2.2.0";
+  version = "2.2.3";
 
   src = fetchurl {
     url = "mirror://gnu/guile/${name}.tar.xz";
-    sha256 = "05dmvhd1y135x7w5qfw4my42cfp6l8bbhjfxvchcc1cbdvzri0f1";
+    sha256 = "11j01agvnci2cx32wwpqs9078856yxmvs15gcsz7ganpkj2ahlw3";
   };
 
   outputs = [ "out" "dev" "info" ];
diff --git a/pkgs/development/interpreters/guile/setup-hook-2.0.sh b/pkgs/development/interpreters/guile/setup-hook-2.0.sh
index fd1dc944ed44b..c7fb4f70fc6a8 100644
--- a/pkgs/development/interpreters/guile/setup-hook-2.0.sh
+++ b/pkgs/development/interpreters/guile/setup-hook-2.0.sh
@@ -10,4 +10,4 @@ addGuileLibPath () {
     fi
 }
 
-envHooks+=(addGuileLibPath)
+addEnvHooks "$hostOffset" addGuileLibPath
diff --git a/pkgs/development/interpreters/guile/setup-hook-2.2.sh b/pkgs/development/interpreters/guile/setup-hook-2.2.sh
index 86c1e0d3e4a9d..73e700bde026c 100644
--- a/pkgs/development/interpreters/guile/setup-hook-2.2.sh
+++ b/pkgs/development/interpreters/guile/setup-hook-2.2.sh
@@ -10,4 +10,4 @@ addGuileLibPath () {
     fi
 }
 
-envHooks+=(addGuileLibPath)
+addEnvHooks "$hostOffset" addGuileLibPath
diff --git a/pkgs/development/interpreters/guile/setup-hook.sh b/pkgs/development/interpreters/guile/setup-hook.sh
index c1d19e579ed53..bf04fee1e8936 100644
--- a/pkgs/development/interpreters/guile/setup-hook.sh
+++ b/pkgs/development/interpreters/guile/setup-hook.sh
@@ -5,4 +5,4 @@ addGuileLibPath () {
     fi
 }
 
-envHooks+=(addGuileLibPath)
+addEnvHooks "$hostOffset" addGuileLibPath
diff --git a/pkgs/development/interpreters/hy/default.nix b/pkgs/development/interpreters/hy/default.nix
index 3cafd956277ad..41e5e3d93be67 100644
--- a/pkgs/development/interpreters/hy/default.nix
+++ b/pkgs/development/interpreters/hy/default.nix
@@ -2,7 +2,7 @@
 
 pythonPackages.buildPythonApplication rec {
   name = "hy-${version}";
-  version = "0.12.1";
+  version = "0.13.1";
 
   src = fetchurl {
     url = "mirror://pypi/h/hy/${name}.tar.gz";
diff --git a/pkgs/development/interpreters/j/default.nix b/pkgs/development/interpreters/j/default.nix
index 94641e20e1bc2..698986e6b402b 100644
--- a/pkgs/development/interpreters/j/default.nix
+++ b/pkgs/development/interpreters/j/default.nix
@@ -1,57 +1,79 @@
-{ stdenv, fetchurl, readline }:
+{ stdenv, fetchFromGitHub, readline, libedit }:
 
 stdenv.mkDerivation rec {
   name = "j-${version}";
-  version = "701_b";
-  src = fetchurl {
-    url = "http://www.jsoftware.com/download/j${version}_source.tar.gz";
-    sha256 = "1gmjlpxcd647x690c4dxnf8h6ays8ndir6cib70h3zfnkrc34cys";
+  version = "806";
+  jtype = "release";
+  src = fetchFromGitHub {
+    owner = "jsoftware";
+    repo = "jsource";
+    rev = "j${version}-${jtype}";
+    sha256 = "0b9sbd5hbyr5454k0p53f03lpf03sz8mqwszaqi0vcs73bsprdjs";
   };
-  buildInputs = [ readline ];
+
+  buildInputs = [ readline libedit ];
   bits = if stdenv.is64bit then "64" else "32";
+  platform =
+    /*if stdenv.isRaspberryPi then "raspberry" else*/
+    if stdenv.isLinux then "linux" else
+    if stdenv.isDarwin then "darwin" else
+    "unknown";
 
   doCheck = true;
 
   buildPhase = ''
-    sed -i bin/jconfig -e '
-        s@bits=32@bits=${bits}@g;
-        s@readline=0@readline=1@;
-        s@LIBREADLINE=""@LIBREADLINE=" -lreadline "@;
-        s@-W1,soname,libj.so@-Wl,-soname,libj.so@
-        '
-    sed -i bin/build_libj -e 's@>& make.txt@ 2>\&1 | tee make.txt@'
+    export SOURCE_DIR=$(pwd)
+    export HOME=$TMPDIR
+    export JBIN=$HOME/j${bits}/bin
+    export JLIB=$SOURCE_DIR/jlibrary
+    mkdir -p $JBIN
+
+    cd make
+
+    patchShebangs .
+    sed -i jvars.sh -e '
+      s@~/gitdev/jsource@$SOURCE_DIR@;
+      s@~/jbld@$HOME@;
+      s@linux@${platform}@;
+      '
 
-    sed -i f2.c -e 's/_isnan(\*wv)/_isnan(y)/'
+    sed -i $JLIB/bin/profile.ijs -e "s@'/usr/share/j/.*'@'$out/share/j'@;"
 
-    touch *.c *.h
-    sh -o errexit bin/build_jconsole
-    [ -e j/bin/jconsole ]
-    sh -o errexit bin/build_libj
-    [ -e j/bin/libj.so ]
-    sh -o errexit bin/build_defs
-    [ -e defs/hostdefs.ijs ] && [ -e defs/netdefs.ijs ]
-    sh -o errexit bin/build_tsdll
-    [ -x libtsdll.so ]
+    # For future versions, watch
+    # https://github.com/jsoftware/jsource/pull/4
+    cp ./jvars.sh $HOME
 
-    sed -i j/bin/profile.ijs -e "
-        s@userx=[.] *'.j'@userx=. '/.j'@;
-        s@bin,'/profilex.ijs'@user,'/profilex.ijs'@ ;
-        /install=./ainstall=. install,'/share/j'
-        "
+    echo '
+      #define jversion   "${version}"
+      #define jplatform  "${platform}"
+      #define jtype      "${jtype}"         // release,beta,...
+      #define jlicense   "GPL3"
+      #define jbuilder   "unknown"  // website or email
+      ' > ../jsrc/jversion.h
+
+    ./build_jconsole.sh j${bits}
+    ./build_libj.sh j${bits}
   '';
 
   checkPhase = ''
-    echo 'i. 5' | j/bin/jconsole | fgrep "0 1 2 3 4"
+    echo 'i. 5' | $JBIN/jconsole | fgrep "0 1 2 3 4"
+
+    # Now run the real tests
+    cd $SOURCE_DIR/test
+    # for f in *.ijs
+    # do
+    #   echo $f
+    #   $JBIN/jconsole < $f
+    # done
   '';
 
   installPhase = ''
     mkdir -p "$out"
-    cp -r j/bin "$out/bin"
-    rm "$out/bin/profilex_template.ijs"
+    cp -r $JBIN "$out/bin"
 
     mkdir -p "$out/share/j"
-
-    cp -r docs j/addons j/system "$out/share/j"
+    cp -r $JLIB/{addons,system} "$out/share/j"
+    cp -r $JLIB/bin "$out"
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/interpreters/joker/default.nix b/pkgs/development/interpreters/joker/default.nix
index 8906c9c5d2493..dff3c1b201fbe 100644
--- a/pkgs/development/interpreters/joker/default.nix
+++ b/pkgs/development/interpreters/joker/default.nix
@@ -2,7 +2,7 @@
 
 buildGoPackage rec {
   name = "joker-${version}";
-  version = "0.8.6";
+  version = "0.8.7";
 
   goPackagePath = "github.com/candid82/joker";
 
@@ -10,7 +10,7 @@ buildGoPackage rec {
     rev = "v${version}";
     owner = "candid82";
     repo = "joker";
-    sha256 = "0m6xi1jgss6f4maxqpwjyyhyyc71wy5a7jpm908m49xx80mz5ams";
+    sha256 = "1cmvja8qdrrzacdfn944f22mdg8177qkxfrb10ykq59c2yp1xn01";
   };
 
   preBuild = "go generate ./...";
diff --git a/pkgs/development/interpreters/joker/deps.nix b/pkgs/development/interpreters/joker/deps.nix
index d5cc0bc44b0b4..ee99aeab69f88 100644
--- a/pkgs/development/interpreters/joker/deps.nix
+++ b/pkgs/development/interpreters/joker/deps.nix
@@ -8,4 +8,13 @@
       sha256 = "1ny3rws671sa9bj5phg6k1rprlgzys73kfdr14vxq4wnwz84zbrc";
     };
   }
+  {
+    goPackagePath = "gopkg.in/yaml.v2";
+    fetch = {
+      type = "git";
+      url = "https://gopkg.in/yaml.v2";
+      rev = "a83829b6f1293c91addabc89d0571c246397bbf4";
+      sha256 = "1m4dsmk90sbi17571h6pld44zxz7jc4lrnl4f27dpd1l8g5xvjhh";
+    };
+  }
 ]
diff --git a/pkgs/development/interpreters/jruby/default.nix b/pkgs/development/interpreters/jruby/default.nix
index ff192c072865f..2224a13ba7c06 100644
--- a/pkgs/development/interpreters/jruby/default.nix
+++ b/pkgs/development/interpreters/jruby/default.nix
@@ -36,7 +36,7 @@ jruby = stdenv.mkDerivation rec {
          addToSearchPath GEM_PATH \$1/${passthru.gemPath}
        }
 
-       envHooks+=(addGemPath)
+       addEnvHooks "$hostOffset" addGemPath
      EOF
   '';
 
diff --git a/pkgs/development/interpreters/lua-5/5.1.nix b/pkgs/development/interpreters/lua-5/5.1.nix
index cdbb2324dc65e..1981c15c5f3ee 100644
--- a/pkgs/development/interpreters/lua-5/5.1.nix
+++ b/pkgs/development/interpreters/lua-5/5.1.nix
@@ -8,7 +8,8 @@ let
   };
 in
 stdenv.mkDerivation rec {
-  name = "lua-5.1.5";
+  name = "lua-${version}";
+  version = "5.1.5";
   luaversion = "5.1";
 
   src = fetchurl {
diff --git a/pkgs/development/interpreters/lua-5/5.2.nix b/pkgs/development/interpreters/lua-5/5.2.nix
index 43e289cd36903..0cdc4770a9833 100644
--- a/pkgs/development/interpreters/lua-5/5.2.nix
+++ b/pkgs/development/interpreters/lua-5/5.2.nix
@@ -57,7 +57,7 @@ stdenv.mkDerivation rec {
   '';
 
   crossAttrs = let
-    inherit (hostPlatform) isDarwin isMingw;
+    inherit (hostPlatform) isDarwin isMinGW;
   in {
     configurePhase = ''
       makeFlagsArray=(
@@ -65,10 +65,10 @@ stdenv.mkDerivation rec {
         INSTALL_MAN=$out/share/man/man1
         V=${luaversion}
         R=${version}
-        ${if isMingw then "mingw" else stdenv.lib.optionalString isDarwin ''
+        ${if isMinGW then "mingw" else stdenv.lib.optionalString isDarwin ''
         ''}
       )
-    '' + stdenv.lib.optionalString isMingw ''
+    '' + stdenv.lib.optionalString isMinGW ''
       installFlagsArray=(
         TO_BIN="lua.exe luac.exe"
         TO_LIB="liblua.a lua52.dll"
diff --git a/pkgs/development/interpreters/lua-5/5.3.nix b/pkgs/development/interpreters/lua-5/5.3.nix
index a512a25131345..ad1dfa8823cb5 100644
--- a/pkgs/development/interpreters/lua-5/5.3.nix
+++ b/pkgs/development/interpreters/lua-5/5.3.nix
@@ -56,7 +56,7 @@ stdenv.mkDerivation rec {
   '';
 
   crossAttrs = let
-    inherit (hostPlatform) isDarwin isMingw;
+    inherit (hostPlatform) isDarwin isMinGW;
   in {
     configurePhase = ''
       makeFlagsArray=(
@@ -64,10 +64,10 @@ stdenv.mkDerivation rec {
         INSTALL_MAN=$out/share/man/man1
         V=${luaversion}
         R=${version}
-        ${if isMingw then "mingw" else stdenv.lib.optionalString isDarwin ''
+        ${if isMinGW then "mingw" else stdenv.lib.optionalString isDarwin ''
         ''}
       )
-    '' + stdenv.lib.optionalString isMingw ''
+    '' + stdenv.lib.optionalString isMinGW ''
       installFlagsArray=(
         TO_BIN="lua.exe luac.exe"
         TO_LIB="liblua.a lua52.dll"
diff --git a/pkgs/development/interpreters/lua-5/filesystem.nix b/pkgs/development/interpreters/lua-5/filesystem.nix
index 21f656044a339..7aa41e95cc9b7 100644
--- a/pkgs/development/interpreters/lua-5/filesystem.nix
+++ b/pkgs/development/interpreters/lua-5/filesystem.nix
@@ -21,6 +21,6 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = https://github.com/keplerproject/luafilesystem;
     hydraPlatforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.flosse ];
+    maintainers = [ ];
   };
 }
diff --git a/pkgs/development/interpreters/lua-5/sockets.nix b/pkgs/development/interpreters/lua-5/sockets.nix
index b83b920497de2..d8a789e9209e3 100644
--- a/pkgs/development/interpreters/lua-5/sockets.nix
+++ b/pkgs/development/interpreters/lua-5/sockets.nix
@@ -20,6 +20,6 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = http://w3.impa.br/~diego/software/luasocket/;
     hydraPlatforms = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.mornfall ];
+    maintainers = [ ];
   };
 }
diff --git a/pkgs/development/interpreters/luajit/default.nix b/pkgs/development/interpreters/luajit/default.nix
index 3f8554a298e4f..59394d3ccc887 100644
--- a/pkgs/development/interpreters/luajit/default.nix
+++ b/pkgs/development/interpreters/luajit/default.nix
@@ -26,7 +26,7 @@ rec {
     homepage    = http://luajit.org;
     license     = licenses.mit;
     platforms   = platforms.linux ++ platforms.darwin;
-    maintainers = with maintainers ; [ thoughtpolice smironov vcunat ];
+    maintainers = with maintainers ; [ thoughtpolice smironov vcunat andir ];
   };
 
   generic =
@@ -61,7 +61,8 @@ rec {
       enableParallelBuilding = true;
 
       installPhase   = ''
-        make install INSTALL_INC="$out"/include PREFIX="$out"
+        make install PREFIX="$out"
+        ( cd "$out/include"; ln -s luajit-*/* . )
         ln -s "$out"/bin/luajit-* "$out"/bin/lua
       ''
         + stdenv.lib.optionalString (!isStable)
diff --git a/pkgs/development/interpreters/lush/default.nix b/pkgs/development/interpreters/lush/default.nix
index a39e79badb6ca..6958bd2465f5f 100644
--- a/pkgs/development/interpreters/lush/default.nix
+++ b/pkgs/development/interpreters/lush/default.nix
@@ -1,5 +1,5 @@
 {stdenv, fetchurl, libX11, xproto, indent, readline, gsl, freeglut, mesa, SDL
-, blas, binutils, intltool, gettext, zlib, libSM}:
+, blas, libbfd, intltool, gettext, zlib, libSM}:
 
 stdenv.mkDerivation rec {
   baseName = "lush";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [
-    libX11 libSM xproto indent readline gsl freeglut mesa SDL blas binutils
+    libX11 libSM xproto indent readline gsl freeglut mesa SDL blas libbfd
     intltool gettext zlib
   ];
 
diff --git a/pkgs/development/interpreters/nix-exec/default.nix b/pkgs/development/interpreters/nix-exec/default.nix
index 7f38f388c3545..277993339e239 100644
--- a/pkgs/development/interpreters/nix-exec/default.nix
+++ b/pkgs/development/interpreters/nix-exec/default.nix
@@ -18,5 +18,6 @@ in stdenv.mkDerivation {
     homepage = https://github.com/shlevy/nix-exec;
     license = stdenv.lib.licenses.mit;
     platforms = nix.meta.platforms;
+    broken = true;
   };
 }
diff --git a/pkgs/development/interpreters/perl/default.nix b/pkgs/development/interpreters/perl/default.nix
index 97e395d2a6dfe..14a4bac47f625 100644
--- a/pkgs/development/interpreters/perl/default.nix
+++ b/pkgs/development/interpreters/perl/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurlBoot, enableThreading ? stdenv ? glibc }:
+{ lib, stdenv, fetchurlBoot, buildPackages, enableThreading ? stdenv ? glibc }:
 
 with lib;
 
@@ -19,7 +19,8 @@ let
   libc = if stdenv.cc.libc or null != null then stdenv.cc.libc else "/usr";
   libcInc = lib.getDev libc;
   libcLib = lib.getLib libc;
-  common = { version, sha256 }: stdenv.mkDerivation rec {
+  crossCompiling = stdenv.buildPlatform != stdenv.hostPlatform;
+  common = { version, sha256 }: stdenv.mkDerivation (rec {
     name = "perl-${version}";
 
     src = fetchurlBoot {
@@ -32,9 +33,16 @@ let
     setOutputFlags = false;
 
     patches =
-      [ # Do not look in /usr etc. for dependencies.
-        ./no-sys-dirs.patch
-      ]
+      [ ]
+      # Do not look in /usr etc. for dependencies.
+      ++ optional (versionOlder version "5.26") ./no-sys-dirs.patch
+      ++ optional (versionAtLeast version "5.26") ./no-sys-dirs-5.26.patch
+      ++ optional (versionAtLeast version "5.24") (
+        # Fix parallel building: https://rt.perl.org/Public/Bug/Display.html?id=132360
+        fetchurlBoot {
+          url = "https://rt.perl.org/Public/Ticket/Attachment/1502646/807252/0001-Fix-missing-build-dependency-for-pods.patch";
+          sha256 = "1bb4mldfp8kq1scv480wm64n2jdsqa3ar46cjp1mjpby8h5dr2r0";
+        })
       ++ optional stdenv.isSunOS ./ld-shared.patch
       ++ optional stdenv.isDarwin ./cpp-precomp.patch
       ++ optional (stdenv.isDarwin && versionAtLeast version "5.24") ./sw_vers.patch;
@@ -43,8 +51,9 @@ let
       pwd="$(type -P pwd)"
       substituteInPlace dist/PathTools/Cwd.pm \
         --replace "/bin/pwd" "$pwd"
+    '' + stdenv.lib.optionalString crossCompiling ''
+      substituteInPlace cnf/configure_tool.sh --replace "cc -E -P" "cc -E"
     '';
-    sandboxProfile = sandbox.allow "ipc-sysv-sem";
 
     # Build a thread-safe Perl with a dynamic libperls.o.  We need the
     # "installstyle" option to ensure that modules are put under
@@ -52,8 +61,10 @@ let
     # contains the string "perl", Configure would select $out/lib.
     # Miniperl needs -lm. perl needs -lrt.
     configureFlags =
-      [ "-de"
-        "-Dcc=cc"
+      (if crossCompiling
+       then [ "-Dlibpth=\"\"" "-Dglibpth=\"\"" ]
+       else [ "-de" "-Dcc=cc" ])
+      ++ [
         "-Uinstallusrbinperl"
         "-Dinstallstyle=lib/perl5"
         "-Duseshrplib"
@@ -63,14 +74,13 @@ let
       ++ optional stdenv.isSunOS "-Dcc=gcc"
       ++ optional enableThreading "-Dusethreads";
 
-    configureScript = "${stdenv.shell} ./Configure";
+    configureScript = stdenv.lib.optionalString (!crossCompiling) "${stdenv.shell} ./Configure";
 
-    dontAddPrefix = true;
+    dontAddPrefix = !crossCompiling;
 
-    enableParallelBuilding = true;
+    enableParallelBuilding = !crossCompiling;
 
-    preConfigure =
-      ''
+    preConfigure = optionalString (!crossCompiling) ''
         configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"
       '' + optionalString (stdenv.isArm || stdenv.isMips) ''
         configureFlagsArray=(-Dldflags="-lm -lrt")
@@ -115,7 +125,23 @@ let
       maintainers = [ maintainers.eelco ];
       platforms = platforms.all;
     };
-  };
+  } // stdenv.lib.optionalAttrs (stdenv.buildPlatform != stdenv.hostPlatform) rec {
+    crossVersion = "1.1.8";
+
+    perl-cross-src = fetchurlBoot {
+      url = "https://github.com/arsv/perl-cross/releases/download/${crossVersion}/perl-cross-${crossVersion}.tar.gz";
+      sha256 = "072j491rpz2qx2sngbg4flqh4lx5865zyql7b9lqm6s1kknjdrh8";
+    };
+
+    nativeBuildInputs = [ buildPackages.stdenv.cc ];
+
+    postUnpack = ''
+      unpackFile ${perl-cross-src}
+      cp -R perl-cross-${crossVersion}/* perl-${version}/
+    '';
+
+    configurePlatforms = [ "build" "host" "target" ];
+  });
 in rec {
   perl = perl524;
 
@@ -128,4 +154,9 @@ in rec {
     version = "5.24.3";
     sha256 = "1m2px85kq2fyp2d4rx3bw9kg3car67qfqwrs5vlv96dx0x8rl06b";
   };
+
+  perl526 = common {
+    version = "5.26.1";
+    sha256 = "1p81wwvr5jb81m41d07kfywk5gvbk0axdrnvhc2aghcdbr4alqz7";
+  };
 }
diff --git a/pkgs/development/interpreters/perl/no-sys-dirs-5.26.patch b/pkgs/development/interpreters/perl/no-sys-dirs-5.26.patch
new file mode 100644
index 0000000000000..ad65d1339f362
--- /dev/null
+++ b/pkgs/development/interpreters/perl/no-sys-dirs-5.26.patch
@@ -0,0 +1,250 @@
+diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/Configure perl-5.20.0/Configure
+--- perl-5.20.0-orig/Configure	2014-05-26 15:34:18.000000000 +0200
++++ perl-5.20.0/Configure	2014-06-25 10:43:35.368285986 +0200
+@@ -106,15 +106,7 @@
+ fi
+ 
+ : Proper PATH setting
+-paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
+-paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
+-paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
+-paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
+-paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
+-paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
+-paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
+-paths="$paths /sbin /usr/sbin /usr/libexec"
+-paths="$paths /system/gnu_library/bin"
++paths=''
+ 
+ for p in $paths
+ do
+@@ -1337,8 +1329,7 @@
+ archname=''
+ : Possible local include directories to search.
+ : Set locincpth to "" in a hint file to defeat local include searches.
+-locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
+-locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
++locincpth=""
+ :
+ : no include file wanted by default
+ inclwanted=''
+@@ -1349,17 +1340,12 @@
+ 
+ libnames=''
+ : change the next line if compiling for Xenix/286 on Xenix/386
+-xlibpth='/usr/lib/386 /lib/386'
++xlibpth=''
+ : Possible local library directories to search.
+-loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
+-loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
++loclibpth=""
+ 
+ : general looking path for locating libraries
+-glibpth="/lib /usr/lib $xlibpth"
+-glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
+-test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
+-test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
+-test -d /usr/lib64         && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
++glibpth=""
+ 
+ : Private path used by Configure to find libraries.  Its value
+ : is prepended to libpth. This variable takes care of special
+@@ -1391,8 +1377,6 @@
+ libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
+ : We probably want to search /usr/shlib before most other libraries.
+ : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
+-glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
+-glibpth="/usr/shlib $glibpth"
+ : Do not use vfork unless overridden by a hint file.
+ usevfork=false
+ 
+@@ -2446,7 +2430,6 @@
+ zip
+ "
+ pth=`echo $PATH | sed -e "s/$p_/ /g"`
+-pth="$pth $sysroot/lib $sysroot/usr/lib"
+ for file in $loclist; do
+ 	eval xxx=\$$file
+ 	case "$xxx" in
+@@ -4936,7 +4919,7 @@
+ : Set private lib path
+ case "$plibpth" in
+ '') if ./mips; then
+-	plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
++	plibpth="$incpath/usr/lib"
+     fi;;
+ esac
+ case "$libpth" in
+@@ -8600,13 +8583,8 @@
+ echo " "
+ case "$sysman" in
+ '')
+-	syspath='/usr/share/man/man1 /usr/man/man1'
+-	syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
+-	syspath="$syspath /usr/man/u_man/man1"
+-	syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
+-	syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
+-	syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
+-	sysman=`./loc . /usr/man/man1 $syspath`
++	syspath=''
++	sysman=''
+ 	;;
+ esac
+ if $test -d "$sysman"; then
+@@ -19900,9 +19878,10 @@
+ case "$full_ar" in
+ '') full_ar=$ar ;;
+ esac
++full_ar=ar
+ 
+ : Store the full pathname to the sed program for use in the C program
+-full_sed=$sed
++full_sed=sed
+ 
+ : see what type gids are declared as in the kernel
+ echo " "
+Only in perl-5.20.0/: Configure.orig
+diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/ext/Errno/Errno_pm.PL perl-5.20.0/ext/Errno/Errno_pm.PL
+--- perl-5.20.0-orig/ext/Errno/Errno_pm.PL	2014-05-26 15:34:20.000000000 +0200
++++ perl-5.20.0/ext/Errno/Errno_pm.PL	2014-06-25 10:31:24.317970047 +0200
+@@ -126,11 +126,7 @@
+ 	if ($dep =~ /(\S+errno\.h)/) {
+ 	     $file{$1} = 1;
+ 	}
+-    } elsif ($^O eq 'linux' &&
+-	      $Config{gccversion} ne '' && 
+-	      $Config{gccversion} !~ /intel/i
+-	      # might be using, say, Intel's icc
+-	     ) {
++    } elsif (0) {
+     # When cross-compiling we may store a path for gcc's "sysroot" option:
+     my $sysroot = $Config{sysroot} || '';
+ 	# Some Linuxes have weird errno.hs which generate
+Only in perl-5.20.0/ext/Errno: Errno_pm.PL.orig
+diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/freebsd.sh perl-5.20.0/hints/freebsd.sh
+--- perl-5.20.0-orig/hints/freebsd.sh	2014-01-31 22:55:51.000000000 +0100
++++ perl-5.20.0/hints/freebsd.sh	2014-06-25 10:25:53.263964680 +0200
+@@ -119,21 +119,21 @@
+         objformat=`/usr/bin/objformat`
+         if [ x$objformat = xaout ]; then
+             if [ -e /usr/lib/aout ]; then
+-                libpth="/usr/lib/aout /usr/local/lib /usr/lib"
+-                glibpth="/usr/lib/aout /usr/local/lib /usr/lib"
++                libpth=""
++                glibpth=""
+             fi
+             lddlflags='-Bshareable'
+         else
+-            libpth="/usr/lib /usr/local/lib"
+-            glibpth="/usr/lib /usr/local/lib"
++            libpth=""
++            glibpth=""
+             ldflags="-Wl,-E "
+             lddlflags="-shared "
+         fi
+         cccdlflags='-DPIC -fPIC'
+         ;;
+ *)
+-       libpth="/usr/lib /usr/local/lib"
+-       glibpth="/usr/lib /usr/local/lib"
++       libpth=""
++       glibpth=""
+        ldflags="-Wl,-E "
+         lddlflags="-shared "
+         cccdlflags='-DPIC -fPIC'
+diff -ru -x '*~' -x '*.rej' perl-5.20.0-orig/hints/linux.sh perl-5.20.0/hints/linux.sh
+--- perl-5.20.0-orig/hints/linux.sh	2014-05-26 15:34:20.000000000 +0200
++++ perl-5.20.0/hints/linux.sh	2014-06-25 10:33:47.354883843 +0200
+@@ -150,25 +150,6 @@
+     ;;
+ esac
+ 
+-# Ubuntu 11.04 (and later, presumably) doesn't keep most libraries
+-# (such as -lm) in /lib or /usr/lib.  So we have to ask gcc to tell us
+-# where to look.  We don't want gcc's own libraries, however, so we
+-# filter those out.
+-# This could be conditional on Unbuntu, but other distributions may
+-# follow suit, and this scheme seems to work even on rather old gcc's.
+-# This unconditionally uses gcc because even if the user is using another
+-# compiler, we still need to find the math library and friends, and I don't
+-# know how other compilers will cope with that situation.
+-# Morever, if the user has their own gcc earlier in $PATH than the system gcc,
+-# we don't want its libraries. So we try to prefer the system gcc
+-# Still, as an escape hatch, allow Configure command line overrides to
+-# plibpth to bypass this check.
+-if [ -x /usr/bin/gcc ] ; then
+-    gcc=/usr/bin/gcc
+-else
+-    gcc=gcc
+-fi
+-
+ case "$plibpth" in
+ '') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
+ 	cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
+@@ -178,32 +159,6 @@
+     ;;
+ esac
+ 
+-case "$libc" in
+-'')
+-# If you have glibc, then report the version for ./myconfig bug reporting.
+-# (Configure doesn't need to know the specific version since it just uses
+-# gcc to load the library for all tests.)
+-# We don't use __GLIBC__ and  __GLIBC_MINOR__ because they
+-# are insufficiently precise to distinguish things like
+-# libc-2.0.6 and libc-2.0.7.
+-    for p in $plibpth
+-    do
+-        for trylib in libc.so.6 libc.so
+-        do
+-            if $test -e $p/$trylib; then
+-                libc=`ls -l $p/$trylib | awk '{print $NF}'`
+-                if $test "X$libc" != X; then
+-                    break
+-                fi
+-            fi
+-        done
+-        if $test "X$libc" != X; then
+-            break
+-        fi
+-    done
+-    ;;
+-esac
+-
+ if ${sh:-/bin/sh} -c exit; then
+   echo ''
+   echo 'You appear to have a working bash.  Good.'
+@@ -367,33 +322,6 @@
+ 	;;
+ esac
+ 
+-# SuSE8.2 has /usr/lib/libndbm* which are ld scripts rather than
+-# true libraries. The scripts cause binding against static
+-# version of -lgdbm which is a bad idea. So if we have 'nm'
+-# make sure it can read the file
+-# NI-S 2003/08/07
+-case "$nm" in
+-    '') ;;
+-    *)
+-    for p in $plibpth
+-    do
+-        if $test -r $p/libndbm.so; then
+-            if $nm $p/libndbm.so >/dev/null 2>&1 ; then
+-                echo 'Your shared -lndbm seems to be a real library.'
+-                _libndbm_real=1
+-                break
+-            fi
+-        fi
+-    done
+-    if $test "X$_libndbm_real" = X; then
+-        echo 'Your shared -lndbm is not a real library.'
+-        set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
+-        shift
+-        libswanted="$*"
+-    fi
+-    ;;
+-esac
+-
+ # Linux on Synology.
+ if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
+     # Tested on Synology DS213 and DS413
diff --git a/pkgs/development/interpreters/perl/setup-hook.sh b/pkgs/development/interpreters/perl/setup-hook.sh
index a8656b8531dbc..7909412806c82 100644
--- a/pkgs/development/interpreters/perl/setup-hook.sh
+++ b/pkgs/development/interpreters/perl/setup-hook.sh
@@ -2,4 +2,4 @@ addPerlLibPath () {
     addToSearchPath PERL5LIB $1/lib/perl5/site_perl
 }
 
-envHooks+=(addPerlLibPath)
+addEnvHooks "$hostOffset" addPerlLibPath
diff --git a/pkgs/development/interpreters/php/default.nix b/pkgs/development/interpreters/php/default.nix
index de8ab8b718132..c547e3d8adafd 100644
--- a/pkgs/development/interpreters/php/default.nix
+++ b/pkgs/development/interpreters/php/default.nix
@@ -1,8 +1,10 @@
+# pcre functionality is tested in nixos/tests/php-pcre.nix
+
 { lib, stdenv, fetchurl, composableDerivation, autoconf, automake, flex, bison
 , mysql, libxml2, readline, zlib, curl, postgresql, gettext
-, openssl, pkgconfig, sqlite, config, libjpeg, libpng, freetype
+, openssl, pcre, pkgconfig, sqlite, config, libjpeg, libpng, freetype
 , libxslt, libmcrypt, bzip2, icu, openldap, cyrus_sasl, libmhash, freetds
-, uwimap, pam, gmp, apacheHttpd, libiconv, systemd }:
+, uwimap, pam, gmp, apacheHttpd, libiconv, systemd, libsodium }:
 
 let
 
@@ -10,9 +12,8 @@ let
     { version, sha256 }:
 
     let php7 = lib.versionAtLeast version "7.0";
-        mysqlHeaders = mysql.lib.dev or mysql;
         mysqlndSupport = config.php.mysqlnd or false;
-        mysqlBuildInputs = lib.optional (!mysqlndSupport) mysqlHeaders;
+        mysqlBuildInputs = lib.optional (!mysqlndSupport) mysql.connector-c;
 
     in composableDerivation.composableDerivation {} (fixed: {
 
@@ -23,7 +24,7 @@ let
       enableParallelBuilding = true;
 
       nativeBuildInputs = [ pkgconfig ];
-      buildInputs = [ flex bison ]
+      buildInputs = [ flex bison pcre ]
         ++ lib.optional stdenv.isLinux systemd;
 
       CXXFLAGS = lib.optional stdenv.cc.isClang "-std=c++11";
@@ -119,7 +120,7 @@ let
         };
 
         mysqli = {
-          configureFlags = ["--with-mysqli=${if mysqlndSupport then "mysqlnd" else "${mysqlHeaders}/bin/mysql_config"}"];
+          configureFlags = ["--with-mysqli=${if mysqlndSupport then "mysqlnd" else "${mysql.connector-c}/bin/mysql_config"}"];
           buildInputs = mysqlBuildInputs;
         };
 
@@ -130,7 +131,7 @@ let
         };
 
         pdo_mysql = {
-          configureFlags = ["--with-pdo-mysql=${if mysqlndSupport then "mysqlnd" else mysqlHeaders}"];
+          configureFlags = ["--with-pdo-mysql=${if mysqlndSupport then "mysqlnd" else mysql.connector-c}"];
           buildInputs = mysqlBuildInputs;
         };
 
@@ -224,6 +225,11 @@ let
         calendar = {
           configureFlags = ["--enable-calendar"];
         };
+
+        sodium = {
+          configureFlags = ["--with-sodium=${libsodium.dev}"];
+          buildInputs = [libsodium];
+        };
       };
 
       cfg = {
@@ -263,6 +269,7 @@ let
         mssqlSupport = (!php7) && (config.php.mssql or (!stdenv.isDarwin));
         ztsSupport = config.php.zts or false;
         calendarSupport = config.php.calendar or true;
+        sodiumSupport = (lib.versionAtLeast version "7.2") && config.php.sodium or true;
       };
 
       hardeningDisable = [ "bindnow" ];
@@ -287,6 +294,7 @@ let
 
       configureFlags = [
         "--with-config-file-scan-dir=/etc/php.d"
+        "--with-pcre-regex=${pcre.dev} PCRE_LIBDIR=${pcre}"
       ] ++ lib.optional stdenv.isDarwin "--with-iconv=${libiconv}"
         ++ lib.optional stdenv.isLinux  "--with-fpm-systemd";
 
@@ -330,17 +338,22 @@ let
 
 in {
   php56 = generic {
-    version = "5.6.32";
-    sha256 = "0lfbmdkvijkm6xc4p9sykv66y8xwhws0vsmka8v5cax4bxx4xr1y";
+    version = "5.6.33";
+    sha256 = "1k1ip1slk89hkp57qiqp8k2m5yrg9lx5rja542g87k8xfslrdxh7";
   };
 
   php70 = generic {
-    version = "7.0.25";
-    sha256 = "09fc2lj447phprvilvq2sb6n0r1snj142f8faphrd896s6b4v8lm";
+    version = "7.0.27";
+    sha256 = "0ca174kp2l3fjcp8z0mqnkbjfhijjzz7rs7bkzg1qk2cpdijbylr";
   };
 
   php71 = generic {
-    version = "7.1.11";
-    sha256 = "0ww5493w8w3jlks0xqlfm3v6mm53vpnv5vjy63inkj8zf3gdfikn";
+    version = "7.1.13";
+    sha256 = "18cqry8jy7q9fp82p3n9ndxffyba6f6q3maz3100jq245lfsbz9m";
+  };
+
+  php72 = generic {
+    version = "7.2.1";
+    sha256 = "0ygbcilbp3fiswd240ib2mvnhy0yy0az8kjzpjfd4kca4qzpj1py";
   };
 }
diff --git a/pkgs/development/interpreters/picoc/default.nix b/pkgs/development/interpreters/picoc/default.nix
index e78b743471981..62ab7b02585eb 100644
--- a/pkgs/development/interpreters/picoc/default.nix
+++ b/pkgs/development/interpreters/picoc/default.nix
@@ -47,6 +47,5 @@ stdenv.mkDerivation rec {
     downloadPage = https://code.google.com/p/picoc/downloads/list;
     license = licenses.bsd3;
     platforms = platforms.linux;
-    maintainers = with maintainers; [ nckx ];
   };
 }
diff --git a/pkgs/development/interpreters/pixie/default.nix b/pkgs/development/interpreters/pixie/default.nix
index b196af8e3ae4c..d41977b4f5ccd 100644
--- a/pkgs/development/interpreters/pixie/default.nix
+++ b/pkgs/development/interpreters/pixie/default.nix
@@ -63,15 +63,15 @@ let
       mkdir -p $out/share $out/bin
       cp pixie-src/pixie-vm $out/share/pixie-vm
       cp -R pixie-src/pixie $out/share/pixie
-      makeWrapper $out/share/pixie-vm $out/bin/pixie-vm \
+      makeWrapper $out/share/pixie-vm $out/bin/pixie \
         --prefix LD_LIBRARY_PATH : ${library-path} \
         --prefix C_INCLUDE_PATH : ${include-path} \
         --prefix LIBRARY_PATH : ${library-path} \
         --prefix PATH : ${bin-path}
       cat > $out/bin/pxi <<EOF
       #!$shell
-      >&2 echo "[\$\$] WARNING: 'pxi' is a deprecated alias for 'pixie-vm', please update your scripts."
-      exec $out/bin/pixie-vm "\$@"
+      >&2 echo "[\$\$] WARNING: 'pxi' and 'pixie-vm' are deprecated aliases for 'pixie', please update your scripts."
+      exec $out/bin/pixie "\$@"
       EOF
       chmod +x $out/bin/pxi
     '';
@@ -79,7 +79,8 @@ let
       description = "A clojure-like lisp, built with the pypy vm toolkit";
       homepage = https://github.com/pixie-lang/pixie;
       license = stdenv.lib.licenses.lgpl3;
-      platforms = ["x86_64-linux" "i686-linux"];
+      platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"];
+      maintainers = with stdenv.lib.maintainers; [ bendlas ];
     };
   };
 in build (builtins.getAttr variant variants)
diff --git a/pkgs/development/interpreters/pixie/dust.nix b/pkgs/development/interpreters/pixie/dust.nix
index 34b4711319383..4a7f3423defda 100644
--- a/pkgs/development/interpreters/pixie/dust.nix
+++ b/pkgs/development/interpreters/pixie/dust.nix
@@ -30,6 +30,6 @@ stdenv.mkDerivation rec {
     description = "Provides tooling around pixie, e.g. a nicer repl, running tests and fetching dependencies";
     homepage = src.meta.homepage;
     license = stdenv.lib.licenses.lgpl3;
-    platforms = stdenv.lib.platforms.linux;
+    platforms = stdenv.lib.platforms.linux ++ stdenv.lib.platforms.darwin;
   };
 }
diff --git a/pkgs/development/interpreters/python/build-python-package-setuptools.nix b/pkgs/development/interpreters/python/build-python-package-setuptools.nix
index a09febb492b1b..bc512357acd58 100644
--- a/pkgs/development/interpreters/python/build-python-package-setuptools.nix
+++ b/pkgs/development/interpreters/python/build-python-package-setuptools.nix
@@ -21,18 +21,18 @@ let
   setuppy = ./run_setup.py;
 
 in attrs // {
-  # we copy nix_run_setup.py over so it's executed relative to the root of the source
+  # we copy nix_run_setup over so it's executed relative to the root of the source
   # many project make that assumption
   buildPhase = attrs.buildPhase or ''
     runHook preBuild
-    cp ${setuppy} nix_run_setup.py
-    ${python.interpreter} nix_run_setup.py ${lib.optionalString (setupPyBuildFlags != []) ("build_ext " + (lib.concatStringsSep " " setupPyBuildFlags))} bdist_wheel
+    cp ${setuppy} nix_run_setup
+    ${python.interpreter} nix_run_setup ${lib.optionalString (setupPyBuildFlags != []) ("build_ext " + (lib.concatStringsSep " " setupPyBuildFlags))} bdist_wheel
     runHook postBuild
   '';
 
   installCheckPhase = attrs.checkPhase or ''
     runHook preCheck
-    ${python.interpreter} nix_run_setup.py test
+    ${python.interpreter} nix_run_setup test
     runHook postCheck
   '';
 
diff --git a/pkgs/development/interpreters/python/build-python-package.nix b/pkgs/development/interpreters/python/build-python-package.nix
index b26bf1539cd5c..12d17b2e83220 100644
--- a/pkgs/development/interpreters/python/build-python-package.nix
+++ b/pkgs/development/interpreters/python/build-python-package.nix
@@ -1,11 +1,14 @@
-/* This function provides a generic Python package builder.  It is
-   intended to work with packages that use `distutils/setuptools'
-   (http://pypi.python.org/pypi/setuptools/), which represents a large
-   number of Python packages nowadays.  */
+# This function provides a generic Python package builder,
+# and can build packages that use distutils, setuptools or flit.
 
 { lib
 , python
-, mkPythonDerivation
+, wrapPython
+, setuptools
+, unzip
+, ensureNewerSourcesHook
+, toPythonModule
+, namePrefix
 , bootstrapped-pip
 , flit
 }:
@@ -15,6 +18,9 @@ let
   flit-specific = import ./build-python-package-flit.nix { inherit python flit; };
   wheel-specific = import ./build-python-package-wheel.nix { };
   common = import ./build-python-package-common.nix { inherit python bootstrapped-pip; };
+  mkPythonDerivation = import ./mk-python-derivation.nix {
+    inherit lib python wrapPython setuptools unzip ensureNewerSourcesHook toPythonModule namePrefix;
+  };
 in
 
 {
diff --git a/pkgs/development/interpreters/python/cpython/2.7/default.nix b/pkgs/development/interpreters/python/cpython/2.7/default.nix
index eb2a46cb3b793..1cb739b4d29fa 100644
--- a/pkgs/development/interpreters/python/cpython/2.7/default.nix
+++ b/pkgs/development/interpreters/python/cpython/2.7/default.nix
@@ -16,6 +16,8 @@
 , libffi
 , CF, configd, coreutils
 , python-setup-hook
+# Some proprietary libs assume UCS2 unicode, especially on darwin :(
+, ucsEncoding ? 4
 # For the Python package set
 , pkgs, packageOverrides ? (self: super: {})
 }:
@@ -107,7 +109,7 @@ let
   configureFlags = [
     "--enable-shared"
     "--with-threads"
-    "--enable-unicode=ucs4"
+    "--enable-unicode=ucs${toString ucsEncoding}"
   ] ++ optionals (hostPlatform.isCygwin || hostPlatform.isAarch64) [
     "--with-system-ffi"
   ] ++ optionals hostPlatform.isCygwin [
@@ -199,9 +201,9 @@ in stdenv.mkDerivation {
     passthru = let
       pythonPackages = callPackage ../../../../../top-level/python-packages.nix {python=self; overrides=packageOverrides;};
     in rec {
-      inherit libPrefix sitePackages x11Support hasDistutilsCxxPatch;
+      inherit libPrefix sitePackages x11Support hasDistutilsCxxPatch ucsEncoding;
       executable = libPrefix;
-      buildEnv = callPackage ../../wrapper.nix { python = self; };
+      buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; };
       withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;};
       pkgs = pythonPackages;
       isPy2 = true;
@@ -225,7 +227,7 @@ in stdenv.mkDerivation {
       '';
       license = stdenv.lib.licenses.psfl;
       platforms = stdenv.lib.platforms.all;
-      maintainers = with stdenv.lib.maintainers; [ chaoflow domenkozar ];
+      maintainers = with stdenv.lib.maintainers; [ fridh ];
       # Higher priority than Python 3.x so that `/bin/python` points to `/bin/python2`
       # in case both 2 and 3 are installed.
       priority = -100;
diff --git a/pkgs/development/interpreters/python/cpython/3.4/default.nix b/pkgs/development/interpreters/python/cpython/3.4/default.nix
index a924b543fe385..2e8a95e7329b0 100644
--- a/pkgs/development/interpreters/python/cpython/3.4/default.nix
+++ b/pkgs/development/interpreters/python/cpython/3.4/default.nix
@@ -160,7 +160,7 @@ in stdenv.mkDerivation {
   in rec {
     inherit libPrefix sitePackages x11Support;
     executable = "${libPrefix}m";
-    buildEnv = callPackage ../../wrapper.nix { python = self; };
+    buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; };
     withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;};
     pkgs = pythonPackages;
     isPy3 = true;
@@ -185,6 +185,6 @@ in stdenv.mkDerivation {
     '';
     license = licenses.psfl;
     platforms = with platforms; linux ++ darwin;
-    maintainers = with maintainers; [ chaoflow domenkozar cstrahan ];
+    maintainers = with maintainers; [ fridh ];
   };
 }
diff --git a/pkgs/development/interpreters/python/cpython/3.5/default.nix b/pkgs/development/interpreters/python/cpython/3.5/default.nix
index abe220e0a3e50..eb8d0a2df38e7 100644
--- a/pkgs/development/interpreters/python/cpython/3.5/default.nix
+++ b/pkgs/development/interpreters/python/cpython/3.5/default.nix
@@ -154,7 +154,7 @@ in stdenv.mkDerivation {
   in rec {
     inherit libPrefix sitePackages x11Support;
     executable = "${libPrefix}m";
-    buildEnv = callPackage ../../wrapper.nix { python = self; };
+    buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; };
     withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;};
     pkgs = pythonPackages;
     isPy3 = true;
@@ -178,6 +178,6 @@ in stdenv.mkDerivation {
     '';
     license = licenses.psfl;
     platforms = with platforms; linux ++ darwin;
-    maintainers = with maintainers; [ chaoflow domenkozar cstrahan ];
+    maintainers = with maintainers; [ fridh ];
   };
 }
diff --git a/pkgs/development/interpreters/python/cpython/3.6/default.nix b/pkgs/development/interpreters/python/cpython/3.6/default.nix
index 1614159a7ef05..f48f2c19026c9 100644
--- a/pkgs/development/interpreters/python/cpython/3.6/default.nix
+++ b/pkgs/development/interpreters/python/cpython/3.6/default.nix
@@ -27,7 +27,7 @@ with stdenv.lib;
 
 let
   majorVersion = "3.6";
-  minorVersion = "3";
+  minorVersion = "4";
   minorVersionSuffix = "";
   pythonVersion = majorVersion;
   version = "${majorVersion}.${minorVersion}${minorVersionSuffix}";
@@ -48,7 +48,7 @@ in stdenv.mkDerivation {
 
   src = fetchurl {
     url = "https://www.python.org/ftp/python/${majorVersion}.${minorVersion}/Python-${version}.tar.xz";
-    sha256 = "1nl1raaagr4car787a2hmjv2dw6gqny53xfd6wisbgx4r5kxk9yd";
+    sha256 = "1fna7g8jxzl4kd2pqmmqhva5724c5m920x3fsrpsgskaylmr76qm";
   };
 
   NIX_LDFLAGS = optionalString stdenv.isLinux "-lgcc_s";
@@ -153,7 +153,7 @@ in stdenv.mkDerivation {
   in rec {
     inherit libPrefix sitePackages x11Support;
     executable = "${libPrefix}m";
-    buildEnv = callPackage ../../wrapper.nix { python = self; };
+    buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; };
     withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;};
     pkgs = pythonPackages;
     isPy3 = true;
@@ -178,6 +178,6 @@ in stdenv.mkDerivation {
     '';
     license = licenses.psfl;
     platforms = with platforms; linux ++ darwin;
-    maintainers = with maintainers; [ chaoflow domenkozar cstrahan kragniz ];
+    maintainers = with maintainers; [ fridh kragniz ];
   };
 }
diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix
index 098ab0b1719f8..d9cff16f448f8 100644
--- a/pkgs/development/interpreters/python/mk-python-derivation.nix
+++ b/pkgs/development/interpreters/python/mk-python-derivation.nix
@@ -1,4 +1,4 @@
-/* Generic builder for Python packages that come without a setup.py. */
+# Generic builder.
 
 { lib
 , python
@@ -6,14 +6,17 @@
 , setuptools
 , unzip
 , ensureNewerSourcesHook
+# Whether the derivation provides a Python module or not.
+, toPythonModule
+, namePrefix
 }:
 
 { name ? "${attrs.pname}-${attrs.version}"
 
-# by default prefix `name` e.g. "python3.3-${name}"
-, namePrefix ? python.libPrefix + "-"
+# Build-time dependencies for the package
+, nativeBuildInputs ? []
 
-# Dependencies for building the package
+# Run-time dependencies for the package
 , buildInputs ? []
 
 # Dependencies needed for running the checkPhase.
@@ -40,6 +43,12 @@
 # Skip wrapping of python programs altogether
 , dontWrapPythonPrograms ? false
 
+# Remove bytecode from bin folder.
+# When a Python script has the extension `.py`, bytecode is generated
+# Typically, executables in bin have no extension, so no bytecode is generated.
+# However, some packages do provide executables with extensions, and thus bytecode is generated.
+, removeBinBytecode ? true
+
 , meta ? {}
 
 , passthru ? {}
@@ -54,18 +63,23 @@ if disabled
 then throw "${name} not supported for interpreter ${python.executable}"
 else
 
-python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled" "checkInputs"] // {
+toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attrs [
+    "disabled" "checkInputs" "doCheck" "doInstallCheck" "dontWrapPythonPrograms" "catchConflicts"
+  ] // {
 
   name = namePrefix + name;
 
-  inherit pythonPath;
+  nativeBuildInputs = [ (ensureNewerSourcesHook { year = "1980"; }) ]
+    ++ nativeBuildInputs;
 
-  buildInputs = [ wrapPython ] ++ buildInputs ++ pythonPath
-    ++ [ (ensureNewerSourcesHook { year = "1980"; }) ]
-    ++ (lib.optional (lib.hasSuffix "zip" attrs.src.name or "") unzip)
-    ++ lib.optionals doCheck checkInputs;
+  buildInputs = [ wrapPython ]
+    ++ lib.optional (lib.hasSuffix "zip" (attrs.src.name or "")) unzip
+    ++ lib.optionals doCheck checkInputs
+    ++ lib.optional catchConflicts setuptools # If we no longer propagate setuptools
+    ++ buildInputs
+    ++ pythonPath;
 
-  # propagate python/setuptools to active setup-hook in nix-shell
+  # Propagate python and setuptools. We should stop propagating setuptools.
   propagatedBuildInputs = propagatedBuildInputs ++ [ python setuptools ];
 
   # Python packages don't have a checkPhase, only an installCheckPhase
@@ -74,6 +88,11 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled" "checkInputs"
 
   postFixup = lib.optionalString (!dontWrapPythonPrograms) ''
     wrapPythonPrograms
+  '' + lib.optionalString removeBinBytecode ''
+    if [ -d "$out/bin" ]; then
+      rm -rf "$out/bin/__pycache__"                 # Python 3
+      find "$out/bin" -type f -name "*.pyc" -delete # Python 2
+    fi
   '' + lib.optionalString catchConflicts ''
     # Check if we have two packages with the same name in the closure and fail.
     # If this happens, something went wrong with the dependencies specs.
@@ -81,17 +100,9 @@ python.stdenv.mkDerivation (builtins.removeAttrs attrs ["disabled" "checkInputs"
     ${python.interpreter} ${./catch_conflicts}/catch_conflicts.py
   '' + attrs.postFixup or '''';
 
-  passthru = {
-    inherit python; # The python interpreter
-  } // passthru;
-
-  meta = with lib.maintainers; {
+  meta = {
     # default to python's platforms
     platforms = python.meta.platforms;
-  } // meta // {
-    # add extra maintainer(s) to every package
-    maintainers = (meta.maintainers or []) ++ [ chaoflow ];
-    # a marker for release utilities to discover python packages
     isBuildPythonPackage = python.meta.platforms;
-  };
-})
+  } // meta;
+}))
diff --git a/pkgs/development/interpreters/python/pypy/2.7/2604-skip-urandom-fd-test.patch b/pkgs/development/interpreters/python/pypy/2.7/2604-skip-urandom-fd-test.patch
deleted file mode 100644
index d7040501b1367..0000000000000
--- a/pkgs/development/interpreters/python/pypy/2.7/2604-skip-urandom-fd-test.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-# HG changeset patch
-# User Armin Rigo <arigo@tunes.org>
-# Date 1500108588 -7200
-# Node ID 20f7723ff895430c2f45647e7d0c0ca56d93e40a
-# Parent  d135217574a6bd2e87a883e1d495f82c5e89bc8b
-(ronan, arigo)
-
-Issue #2604: skip this test (fails on some Linux because pypy uses the
-new getrandom() syscall)
-
-diff --git a/lib-python/2.7/test/test_os.py b/lib-python/2.7/test/test_os.py
---- a/lib-python/2.7/test/test_os.py
-+++ b/lib-python/2.7/test/test_os.py
-@@ -580,6 +580,7 @@
-                  "getentropy() does not use a file descriptor")
- class URandomFDTests(unittest.TestCase):
-     @unittest.skipUnless(resource, "test requires the resource module")
-+    @test_support.impl_detail(pypy=False)    # on Linux, may use getrandom()
-     def test_urandom_failure(self):
-         # Check urandom() failing when it is not able to open /dev/random.
-         # We spawn a new process to make the test more robust (if getrlimit()
diff --git a/pkgs/development/interpreters/python/pypy/2.7/default.nix b/pkgs/development/interpreters/python/pypy/2.7/default.nix
index 1d382207e9894..e68cfc3148ffd 100644
--- a/pkgs/development/interpreters/python/pypy/2.7/default.nix
+++ b/pkgs/development/interpreters/python/pypy/2.7/default.nix
@@ -1,4 +1,5 @@
-{ stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2, pkgconfig, libffi
+{ stdenv, substituteAll, fetchurl
+, zlib ? null, zlibSupport ? true, bzip2, pkgconfig, libffi
 , sqlite, openssl, ncurses, python, expat, tcl, tk, tix, xlibsWrapper, libX11
 , makeWrapper, callPackage, self, gdbm, db
 , python-setup-hook
@@ -9,7 +10,7 @@
 assert zlibSupport -> zlib != null;
 
 let
-  majorVersion = "5.8";
+  majorVersion = "5.10";
   minorVersion = "0";
   minorVersionSuffix = "";
   pythonVersion = "2.7";
@@ -20,128 +21,124 @@ let
   pythonForPypy = python.withPackages (ppkgs: [ ppkgs.pycparser ]);
 
 in stdenv.mkDerivation rec {
-    name = "pypy-${version}";
-    inherit majorVersion version pythonVersion;
-
-    src = fetchurl {
-      url = "https://bitbucket.org/pypy/pypy/get/release-pypy${pythonVersion}-v${version}.tar.bz2";
-      sha256 = "0dibf1bx4icrbi8zsqk7cfwgwsd3hfx6biz59k8j5rys3fx9z418";
-    };
-
-    patches = [
-      # https://bitbucket.org/pypy/pypy/issues/2604/lib-python-27-test-test_ospy
-      ./2604-skip-urandom-fd-test.patch
-    ];
-
-    postPatch = ''
-      substituteInPlace "lib-python/2.7/lib-tk/Tix.py" --replace "os.environ.get('TIX_LIBRARY')" "os.environ.get('TIX_LIBRARY') or '${tix}/lib'"
-    '';
-
-  nativeBuildInputs = [ pkgconfig ];
-    buildInputs = [ bzip2 openssl pythonForPypy libffi ncurses expat sqlite tk tcl xlibsWrapper libX11 makeWrapper gdbm db ]
-      ++ stdenv.lib.optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc
-      ++ stdenv.lib.optional zlibSupport zlib;
-
-    hardeningDisable = stdenv.lib.optional stdenv.isi686 "pic";
-
-    C_INCLUDE_PATH = stdenv.lib.makeSearchPathOutput "dev" "include" buildInputs;
-    LIBRARY_PATH = stdenv.lib.makeLibraryPath buildInputs;
-    LD_LIBRARY_PATH = stdenv.lib.makeLibraryPath (stdenv.lib.filter (x : x.outPath != stdenv.cc.libc.outPath or "") buildInputs);
-
-    preConfigure = ''
-      # hint pypy to find nix ncurses
-      substituteInPlace pypy/module/_minimal_curses/fficurses.py \
-        --replace "/usr/include/ncurses/curses.h" "${ncurses.dev}/include/curses.h" \
-        --replace "ncurses/curses.h" "${ncurses.dev}/include/curses.h" \
-        --replace "ncurses/term.h" "${ncurses.dev}/include/term.h" \
-        --replace "libraries=['curses']" "libraries=['ncurses']"
-
-      # tkinter hints
-      substituteInPlace lib_pypy/_tkinter/tklib_build.py \
-        --replace "'/usr/include/tcl'" "'${tk}/include', '${tcl}/include'" \
-        --replace "linklibs = ['tcl' + _ver, 'tk' + _ver]" "linklibs=['${tcl.libPrefix}', '${tk.libPrefix}']" \
-        --replace "libdirs = []" "libdirs = ['${tk}/lib', '${tcl}/lib']"
-
-      sed -i "s@libraries=\['sqlite3'\]\$@libraries=['sqlite3'], include_dirs=['${sqlite.dev}/include'], library_dirs=['${sqlite.out}/lib']@" lib_pypy/_sqlite3_build.py
-    '';
-
-    buildPhase = ''
-      ${pythonForPypy.interpreter} rpython/bin/rpython --make-jobs="$NIX_BUILD_CORES" -Ojit --batch pypy/goal/targetpypystandalone.py --withmod-_minimal_curses --withmod-unicodedata --withmod-thread --withmod-bz2 --withmod-_multiprocessing
-    '';
-
-    setupHook = python-setup-hook sitePackages;
-
-    postBuild = ''
-      cd ./lib_pypy
-        ../pypy-c ./_audioop_build.py
-        ../pypy-c ./_curses_build.py
-        ../pypy-c ./_pwdgrp_build.py
-        ../pypy-c ./_sqlite3_build.py
-        ../pypy-c ./_syslog_build.py
-        ../pypy-c ./_tkinter/tklib_build.py
-      cd ..
-    '';
-
-    doCheck = true;
-    checkPhase = ''
-       export TERMINFO="${ncurses.out}/share/terminfo/";
-       export TERM="xterm";
-       export HOME="$TMPDIR";
-       # disable shutils because it assumes gid 0 exists
-       # disable socket because it has two actual network tests that fail
-       # disable test_urllib2net, test_urllib2_localnet, and test_urllibnet because they require networking (example.com)
-       # disable test_ssl because no shared cipher' not found in '[Errno 1] error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
-       # disable test_zipfile64 because it causes ENOSPACE
-      ./pypy-c ./pypy/test_all.py --pypy=./pypy-c -k 'not ( test_ssl or test_urllib2net or test_urllibnet or test_urllib2_localnet or test_socket or test_shutil or test_zipfile64 )' lib-python
-    '';
-
-    installPhase = ''
-       mkdir -p $out/{bin,include,lib,pypy-c}
-
-       cp -R {include,lib_pypy,lib-python,pypy-c} $out/pypy-c
-       cp libpypy-c.so $out/lib/
-       ln -s $out/pypy-c/pypy-c $out/bin/pypy
-       chmod +x $out/bin/pypy
-
-       # other packages expect to find stuff according to libPrefix
-       ln -s $out/pypy-c/include $out/include/${libPrefix}
-       ln -s $out/pypy-c/lib-python/${pythonVersion} $out/lib/${libPrefix}
-
-       # We must wrap the original, not the symlink.
-       # PyPy uses argv[0] to find its standard library, and while it knows
-       # how to follow symlinks, it doesn't know about wrappers. So, it
-       # will think the wrapper is the original. As long as the wrapper has
-       # the same path as the original, this is OK.
-       wrapProgram "$out/pypy-c/pypy-c" \
-         --set LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:$out/lib" \
-         --set LIBRARY_PATH "${LIBRARY_PATH}:$out/lib"
-
-       # verify cffi modules
-       $out/bin/pypy -c "import Tkinter;import sqlite3;import curses"
-
-        # Python on Nix is not manylinux1 compatible. https://github.com/NixOS/nixpkgs/issues/18484
-        echo "manylinux1_compatible=False" >> $out/lib/${libPrefix}/_manylinux.py
-    '';
-
-    passthru = let
-      pythonPackages = callPackage ../../../../../top-level/python-packages.nix {python=self; overrides=packageOverrides;};
-    in rec {
-      inherit zlibSupport libPrefix sitePackages;
-      executable = "pypy";
-      isPypy = true;
-      buildEnv = callPackage ../../wrapper.nix { python = self; };
-      interpreter = "${self}/bin/${executable}";
-      withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;};
-      pkgs = pythonPackages;
-    };
-
-    enableParallelBuilding = true;  # almost no parallelization without STM
-
-    meta = with stdenv.lib; {
-      homepage = http://pypy.org/;
-      description = "Fast, compliant alternative implementation of the Python language (2.7.13)";
-      license = licenses.mit;
-      platforms = platforms.linux;
-      maintainers = with maintainers; [ domenkozar ];
-    };
+  name = "pypy-${version}";
+  inherit majorVersion version pythonVersion;
+
+  src = fetchurl {
+    url = "https://bitbucket.org/pypy/pypy/get/release-pypy${pythonVersion}-v${version}.tar.bz2";
+    sha256 = "10j1s6r6iv80nvpi6gv8w05v505h2ndj9xx31yz7d50ab04dfg23";
+  };
+
+  nativeBuildInputs = [ pkgconfig makeWrapper ];
+  buildInputs = [
+    bzip2 openssl pythonForPypy libffi ncurses expat sqlite tk tcl xlibsWrapper libX11 gdbm db
+  ] ++ stdenv.lib.optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc
+    ++ stdenv.lib.optional zlibSupport zlib;
+
+  hardeningDisable = stdenv.lib.optional stdenv.isi686 "pic";
+
+  C_INCLUDE_PATH = stdenv.lib.makeSearchPathOutput "dev" "include" buildInputs;
+  LIBRARY_PATH = stdenv.lib.makeLibraryPath buildInputs;
+  LD_LIBRARY_PATH = stdenv.lib.makeLibraryPath (stdenv.lib.filter (x : x.outPath != stdenv.cc.libc.outPath or "") buildInputs);
+
+  patches = [
+    (substituteAll {
+      src = ./tk_tcl_paths.patch;
+      inherit tk tcl;
+      tk_dev = tk.dev;
+      tcl_dev = tcl;
+      tk_libprefix = tk.libPrefix;
+      tcl_libprefix = tcl.libPrefix;
+    })
+  ];
+
+  postPatch = ''
+    substituteInPlace "lib-python/2.7/lib-tk/Tix.py" --replace "os.environ.get('TIX_LIBRARY')" "os.environ.get('TIX_LIBRARY') or '${tix}/lib'"
+
+    # hint pypy to find nix ncurses
+    substituteInPlace pypy/module/_minimal_curses/fficurses.py \
+      --replace "/usr/include/ncurses/curses.h" "${ncurses.dev}/include/curses.h" \
+      --replace "ncurses/curses.h" "${ncurses.dev}/include/curses.h" \
+      --replace "ncurses/term.h" "${ncurses.dev}/include/term.h" \
+      --replace "libraries=['curses']" "libraries=['ncurses']"
+
+    sed -i "s@libraries=\['sqlite3'\]\$@libraries=['sqlite3'], include_dirs=['${sqlite.dev}/include'], library_dirs=['${sqlite.out}/lib']@" lib_pypy/_sqlite3_build.py
+  '';
+
+  buildPhase = ''
+    ${pythonForPypy.interpreter} rpython/bin/rpython \
+      --make-jobs="$NIX_BUILD_CORES" \
+      -Ojit \
+      --batch pypy/goal/targetpypystandalone.py \
+      --withmod-_minimal_curses \
+      --withmod-unicodedata \
+      --withmod-thread \
+      --withmod-bz2 \
+      --withmod-_multiprocessing
+  '';
+
+  setupHook = python-setup-hook sitePackages;
+
+  doCheck = true;
+  checkPhase = ''
+    export TERMINFO="${ncurses.out}/share/terminfo/";
+    export TERM="xterm";
+    export HOME="$TMPDIR";
+    # disable shutils because it assumes gid 0 exists
+    # disable socket because it has two actual network tests that fail
+    # disable test_urllib2net, test_urllib2_localnet, and test_urllibnet because they require networking (example.com)
+    # disable test_ssl because no shared cipher' not found in '[Errno 1] error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure
+    # disable test_zipfile64 because it causes ENOSPACE
+    ./pypy-c ./pypy/test_all.py --pypy=./pypy-c -k 'not ( test_ssl or test_urllib2net or test_urllibnet or test_urllib2_localnet or test_socket or test_shutil or test_zipfile64 )' lib-python
+  '';
+
+  installPhase = ''
+    mkdir -p $out/{bin,include,lib,pypy-c}
+
+    cp -R {include,lib_pypy,lib-python,pypy-c} $out/pypy-c
+    cp libpypy-c.so $out/lib/
+    ln -s $out/pypy-c/pypy-c $out/bin/pypy
+    chmod +x $out/bin/pypy
+
+    # other packages expect to find stuff according to libPrefix
+    ln -s $out/pypy-c/include $out/include/${libPrefix}
+    ln -s $out/pypy-c/lib-python/${pythonVersion} $out/lib/${libPrefix}
+
+    # We must wrap the original, not the symlink.
+    # PyPy uses argv[0] to find its standard library, and while it knows
+    # how to follow symlinks, it doesn't know about wrappers. So, it
+    # will think the wrapper is the original. As long as the wrapper has
+    # the same path as the original, this is OK.
+    wrapProgram "$out/pypy-c/pypy-c" \
+      --set LD_LIBRARY_PATH "${LD_LIBRARY_PATH}:$out/lib" \
+      --set LIBRARY_PATH "${LIBRARY_PATH}:$out/lib"
+
+    # verify cffi modules
+    $out/bin/pypy -c "import Tkinter;import sqlite3;import curses"
+
+    # Python on Nix is not manylinux1 compatible. https://github.com/NixOS/nixpkgs/issues/18484
+    echo "manylinux1_compatible=False" >> $out/lib/${libPrefix}/_manylinux.py
+  '';
+
+  passthru = let
+    pythonPackages = callPackage ../../../../../top-level/python-packages.nix {python=self; overrides=packageOverrides;};
+  in rec {
+    inherit zlibSupport libPrefix sitePackages;
+    executable = "pypy";
+    isPypy = true;
+    buildEnv = callPackage ../../wrapper.nix { python = self; inherit (pythonPackages) requiredPythonModules; };
+    interpreter = "${self}/bin/${executable}";
+    withPackages = import ../../with-packages.nix { inherit buildEnv pythonPackages;};
+    pkgs = pythonPackages;
+  };
+
+  enableParallelBuilding = true;  # almost no parallelization without STM
+
+  meta = with stdenv.lib; {
+    homepage = http://pypy.org/;
+    description = "Fast, compliant alternative implementation of the Python language (2.7.13)";
+    license = licenses.mit;
+    platforms = [ "i686-linux" "x86_64-linux" ];
+    maintainers = with maintainers; [ ];
+  };
 }
diff --git a/pkgs/development/interpreters/python/pypy/2.7/tk_tcl_paths.patch b/pkgs/development/interpreters/python/pypy/2.7/tk_tcl_paths.patch
new file mode 100644
index 0000000000000..92bbfc557b359
--- /dev/null
+++ b/pkgs/development/interpreters/python/pypy/2.7/tk_tcl_paths.patch
@@ -0,0 +1,17 @@
+--- pypy-pypy-84a2f3e6a7f8.org/lib_pypy/_tkinter/tklib_build.py	2017-10-03 11:49:20.000000000 +0100
++++ pypy-pypy-84a2f3e6a7f8/lib_pypy/_tkinter/tklib_build.py	2017-11-21 13:20:51.398607530 +0000
+@@ -24,11 +24,11 @@
+ else:
+     # On some Linux distributions, the tcl and tk libraries are
+     # stored in /usr/include, so we must check this case also
+-    libdirs = []
++    libdirs = ["@tcl@/lib", "@tk@/lib"]
+     found = False
+     for _ver in ['', '8.6', '8.5']:
+-        incdirs = ['/usr/include/tcl' + _ver]
+-        linklibs = ['tcl' + _ver, 'tk' + _ver]
++        incdirs = ['@tcl_dev@/include', '@tk_dev@/include']
++        linklibs = ['@tcl_libprefix@', '@tk_libprefix@']
+         if os.path.isdir(incdirs[0]):
+             found = True
+             break
diff --git a/pkgs/development/interpreters/python/setup-hook.sh b/pkgs/development/interpreters/python/setup-hook.sh
index dda9bed39f85e..77ec9e9ac0bf8 100644
--- a/pkgs/development/interpreters/python/setup-hook.sh
+++ b/pkgs/development/interpreters/python/setup-hook.sh
@@ -12,10 +12,13 @@ toPythonPath() {
     echo $result
 }
 
-envHooks+=(addPythonPath)
+addEnvHooks "$hostOffset" addPythonPath
 
 # Determinism: The interpreter is patched to write null timestamps when compiling python files.
 # This way python doesn't try to update them when we freeze timestamps in nix store.
 export DETERMINISTIC_BUILD=1;
 # Determinism: We fix the hashes of str, bytes and datetime objects.
 export PYTHONHASHSEED=0;
+# Determinism. Whenever Python is included, it should not check user site-packages.
+# This option is only relevant when the sandbox is disabled.
+export PYTHONNOUSERSITE=1;
diff --git a/pkgs/development/interpreters/python/wrap.sh b/pkgs/development/interpreters/python/wrap.sh
index 37bd5b097395b..01b573e6ad5d8 100644
--- a/pkgs/development/interpreters/python/wrap.sh
+++ b/pkgs/development/interpreters/python/wrap.sh
@@ -83,7 +83,7 @@ wrapPythonProgramsIn() {
 
 # Adds the lib and bin directories to the PYTHONPATH and PATH variables,
 # respectively. Recurses on any paths declared in
-# `propagated-native-build-inputs`, while avoiding duplicating paths by
+# `propagated-build-inputs`, while avoiding duplicating paths by
 # flagging the directories it has visited in `pythonPathsSeen`.
 _addToPythonPath() {
     local dir="$1"
@@ -96,7 +96,7 @@ _addToPythonPath() {
     addToSearchPath program_PATH $dir/bin
 
     # Inspect the propagated inputs (if they exist) and recur on them.
-    local prop="$dir/nix-support/propagated-native-build-inputs"
+    local prop="$dir/nix-support/propagated-build-inputs"
     if [ -e $prop ]; then
         local new_path
         for new_path in $(cat $prop); do
diff --git a/pkgs/development/interpreters/python/wrapper.nix b/pkgs/development/interpreters/python/wrapper.nix
index f42caf92c1703..8d4e68bf57cae 100644
--- a/pkgs/development/interpreters/python/wrapper.nix
+++ b/pkgs/development/interpreters/python/wrapper.nix
@@ -2,18 +2,20 @@
 , extraLibs ? []
 , extraOutputsToInstall ? []
 , postBuild ? ""
-, ignoreCollisions ? false }:
+, ignoreCollisions ? false
+, requiredPythonModules
+, }:
 
 # Create a python executable that knows about additional packages.
 let
-  recursivePthLoader = import ../../python-modules/recursive-pth-loader/default.nix { stdenv = stdenv; python = python; };
   env = let
-    paths = stdenv.lib.closePropagation (extraLibs ++ [ python recursivePthLoader ] ) ;
+    paths = requiredPythonModules (extraLibs ++ [ python ] ) ;
   in buildEnv {
     name = "${python.name}-env";
 
     inherit paths;
-    inherit ignoreCollisions extraOutputsToInstall;
+    inherit ignoreCollisions;
+    extraOutputsToInstall = [ "out" ] ++ extraOutputsToInstall;
 
     postBuild = ''
       . "${makeWrapper}/nix-support/setup-hook"
diff --git a/pkgs/development/interpreters/racket/default.nix b/pkgs/development/interpreters/racket/default.nix
index 19517e2216b19..f949e16321dad 100644
--- a/pkgs/development/interpreters/racket/default.nix
+++ b/pkgs/development/interpreters/racket/default.nix
@@ -3,7 +3,7 @@
 , glib, gmp, gtk2, libedit, libffi, libjpeg
 , libpng, libtool, mpfr, openssl, pango, poppler
 , readline, sqlite
-, disableDocs ? true
+, disableDocs ? false
 }:
 
 let
diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix
index d664c00bc31dd..9d82810900f0f 100644
--- a/pkgs/development/interpreters/ruby/default.nix
+++ b/pkgs/development/interpreters/ruby/default.nix
@@ -1,7 +1,7 @@
 { stdenv, lib, fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub
 , zlib, openssl, gdbm, ncurses, readline, groff, libyaml, libffi, autoreconfHook, bison
 , autoconf, darwin ? null
-, buildEnv, bundler, bundix
+, buildEnv, bundler, bundix, Foundation
 } @ args:
 
 let
@@ -27,6 +27,7 @@ let
     tag = ver.gitTag;
     isRuby20 = ver.majMin == "2.0";
     isRuby21 = ver.majMin == "2.1";
+    isRuby25 = ver.majMin == "2.5";
     baseruby = self.override { useRailsExpress = false; };
     self = lib.makeOverridable (
       { stdenv, lib, fetchurl, fetchpatch, fetchFromSavannah, fetchFromGitHub
@@ -40,7 +41,7 @@ let
       , libffi, fiddleSupport ? true
       , autoreconfHook, bison, autoconf
       , darwin ? null
-      , buildEnv, bundler, bundix
+      , buildEnv, bundler, bundix, Foundation
       }:
       let rubySrc =
         if useRailsExpress then fetchFromGitHub {
@@ -75,11 +76,13 @@ let
           ++ (op opensslSupport openssl)
           ++ (op gdbmSupport gdbm)
           ++ (op yamlSupport libyaml)
+          ++ (op isRuby25 autoconf)
           # Looks like ruby fails to build on darwin without readline even if curses
           # support is not enabled, so add readline to the build inputs if curses
           # support is disabled (if it's enabled, we already have it) and we're
           # running on darwin
           ++ (op (!cursesSupport && stdenv.isDarwin) readline)
+          ++ (op (isRuby25 && stdenv.isDarwin) Foundation)
           ++ (ops stdenv.isDarwin (with darwin; [ libiconv libobjc libunwind ]));
 
         enableParallelBuilding = true;
@@ -106,6 +109,11 @@ let
           cp ${config}/config.guess tool/
           cp ${config}/config.sub tool/
         ''
+        else if isRuby25 then ''
+          sed -i configure.ac -e '/config.guess/d'
+          cp ${config}/config.guess tool/
+          cp ${config}/config.sub tool/
+        ''
         else opString useRailsExpress ''
           sed -i configure.in -e '/config.guess/d'
           cp ${config}/config.guess tool/
@@ -142,7 +150,7 @@ let
             addToSearchPath GEM_PATH \$1/${passthru.gemPath}
           }
 
-          envHooks+=(addGemPath)
+          addEnvHooks "$hostOffset" addGemPath
           EOF
         '' + opString useRailsExpress ''
           rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
@@ -197,27 +205,35 @@ in {
     };
   };
 
-  ruby_2_2_8 = generic {
-    version = rubyVersion "2" "2" "8" "";
+  ruby_2_2_9 = generic {
+    version = rubyVersion "2" "2" "9" "";
+    sha256 = {
+      src = "19m1ximl7vcrsvq595dgrjh4yb6kar944095wbywqh7waiqcfirg";
+      git = "03qrjh55098wcqh2khxryzkzfqkznjrcdgwf27r2bgcycbg5ca5q";
+    };
+  };
+
+  ruby_2_3_6 = generic {
+    version = rubyVersion "2" "3" "6" "";
     sha256 = {
-      src = "12i6v5i0djl4xx3x7fq12snqb5d4drqjmnwqs05fby4bagcbjdwg";
-      git = "16nw0795nhrj13crp5x4jis8hmi3gsyjl96pwk698wlrb89lf9bw";
+      src = "07jpa7fw1gyf069m7alf2b0zm53qm08w2ns45mhzmvgrg4r528l3";
+      git = "1bk59i0ygdc5z3zz3k6indfrxd2ix55np6rwvkcdpdw8svm749ds";
     };
   };
 
-  ruby_2_3_5 = generic {
-    version = rubyVersion "2" "3" "5" "";
+  ruby_2_4_3 = generic {
+    version = rubyVersion "2" "4" "3" "";
     sha256 = {
-      src = "1k6x4g68lq30i0myip5bn56rcbwjxmqq95j1fkdgbvwbnaxzfqjl";
-      git = "0spwqz4b5xxqzs13azsd4xz4jkc3is7d9q4s6s2qilb8ib4863jl";
+      src = "161smb52q19r9lrzy22b3bhnkd0z8wjffm0qsfkml14j5ic7a0zx";
+      git = "0x2lqbqm2rq9j5zh1p72dma56nqvdkfbgzb9wybm4y4hwhiw8c1m";
     };
   };
 
-  ruby_2_4_2 = generic {
-    version = rubyVersion "2" "4" "2" "";
+  ruby_2_5_0 = generic {
+    version = rubyVersion "2" "5" "0" "";
     sha256 = {
-      src = "174cdiz3am1f76vsnm3iqi9c5vqphypbf9kbxx6vqqmj01gfgfck";
-      git = "1w83kzak3m6vv3k09ynfw9vpgc7vpmij3x3zmgrhwm4ds1sp5irl";
+      src = "1azj0d2lzziw6iml7bx3sxpxzcdmfwfq3yhm7djyp20q1xiz7rj6";
+      git = "0d436nqmp3ykdkp4sck5bb8sf3qvx30x1p58xh8axv66mvsyc2jd";
     };
   };
 }
diff --git a/pkgs/development/interpreters/ruby/patchsets.nix b/pkgs/development/interpreters/ruby/patchsets.nix
index 3d3b17cd2f708..55f4a9ef237ba 100644
--- a/pkgs/development/interpreters/ruby/patchsets.nix
+++ b/pkgs/development/interpreters/ruby/patchsets.nix
@@ -24,19 +24,24 @@ rec {
     "${patchSet}/patches/ruby/2.1.8/railsexpress/08-funny-falcon-method-cache.patch"
     "${patchSet}/patches/ruby/2.1.8/railsexpress/09-heap-dump-support.patch"
   ];
-  "2.2.8" = ops useRailsExpress [
+  "2.2.9" = ops useRailsExpress [
     "${patchSet}/patches/ruby/2.2/head/railsexpress/01-zero-broken-tests.patch"
     "${patchSet}/patches/ruby/2.2/head/railsexpress/02-improve-gc-stats.patch"
     "${patchSet}/patches/ruby/2.2/head/railsexpress/03-display-more-detailed-stack-trace.patch"
   ];
-  "2.3.5" = ops useRailsExpress [
+  "2.3.6" = ops useRailsExpress [
     "${patchSet}/patches/ruby/2.3/head/railsexpress/01-skip-broken-tests.patch"
     "${patchSet}/patches/ruby/2.3/head/railsexpress/02-improve-gc-stats.patch"
     "${patchSet}/patches/ruby/2.3/head/railsexpress/03-display-more-detailed-stack-trace.patch"
   ];
-  "2.4.2" = ops useRailsExpress [
+  "2.4.3" = ops useRailsExpress [
     "${patchSet}/patches/ruby/2.4/head/railsexpress/01-skip-broken-tests.patch"
     "${patchSet}/patches/ruby/2.4/head/railsexpress/02-improve-gc-stats.patch"
     "${patchSet}/patches/ruby/2.4/head/railsexpress/03-display-more-detailed-stack-trace.patch"
   ];
+  "2.5.0" = ops useRailsExpress [
+    "${patchSet}/patches/ruby/2.5/head/railsexpress/01-fix-broken-tests-caused-by-ad.patch"
+    "${patchSet}/patches/ruby/2.5/head/railsexpress/02-improve-gc-stats.patch"
+    "${patchSet}/patches/ruby/2.5/head/railsexpress/03-more-detailed-stacktrace.patch"
+  ];
 }
diff --git a/pkgs/development/interpreters/ruby/rvm-patchsets.nix b/pkgs/development/interpreters/ruby/rvm-patchsets.nix
index c60d6e3728d04..1598cbc56e1db 100644
--- a/pkgs/development/interpreters/ruby/rvm-patchsets.nix
+++ b/pkgs/development/interpreters/ruby/rvm-patchsets.nix
@@ -3,6 +3,6 @@
 fetchFromGitHub {
   owner  = "skaes";
   repo   = "rvm-patchsets";
-  rev    = "15f5df0fba0e2fb489856b5bdb67a52fb9745f94";
-  sha256 = "0vdgr7xp3gbmsyaz4q78qlbwmp006b1gkgj0kwi6h8d80dclbzny";
+  rev    = "ba5a3c6f972e1b957b4b3fe28b5730ef0e27bff3";
+  sha256 = "0sjmhhb8hshxa58x062j44w0xdck8ykgpsg33wjr0wv9npwpkwrz";
 }
diff --git a/pkgs/development/interpreters/spidermonkey/31.nix b/pkgs/development/interpreters/spidermonkey/31.nix
index ae3e742e2ef44..e64ab1b39a7cf 100644
--- a/pkgs/development/interpreters/spidermonkey/31.nix
+++ b/pkgs/development/interpreters/spidermonkey/31.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   # probably it would be more ideal to pull a particular tag/revision
   # from the mercurial repo
   src = fetchurl {
-    url = "https://people.mozilla.org/~sstangl/mozjs-31.5.0.tar.bz2";
+    url = "https://people.freebsd.org/~sunpoet/sunpoet/mozjs-31.5.0.tar.bz2";
     sha256 = "1q8icql5hh1g3gzg5fp4rl9rfagyhm9gilfn3dgi7qn4i1mrfqsd";
   };
 
diff --git a/pkgs/development/interpreters/spidermonkey/38.nix b/pkgs/development/interpreters/spidermonkey/38.nix
index b4823817d4b70..f8fefd204e564 100644
--- a/pkgs/development/interpreters/spidermonkey/38.nix
+++ b/pkgs/development/interpreters/spidermonkey/38.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   # probably it would be more ideal to pull a particular tag/revision
   # from the mercurial repo
   src = fetchurl {
-    url = "https://people.mozilla.org/~sstangl/mozjs-${version}.tar.bz2";
+    url = "https://people.freebsd.org/~sunpoet/sunpoet/mozjs-${version}.tar.bz2";
     sha256 = "0p4bmbpgkfsj54xschcny0a118jdrdgg0q29rwxigg3lh5slr681";
   };
 
diff --git a/pkgs/development/interpreters/supercollider/default.nix b/pkgs/development/interpreters/supercollider/default.nix
index 642fd928f41d4..19abfe1cea271 100644
--- a/pkgs/development/interpreters/supercollider/default.nix
+++ b/pkgs/development/interpreters/supercollider/default.nix
@@ -9,12 +9,12 @@ in
 
 stdenv.mkDerivation rec {
   name = "supercollider-${version}";
-  version = "3.8.0";
+  version = "3.8.1";
 
 
   src = fetchurl {
     url = "https://github.com/supercollider/supercollider/releases/download/Version-${version}/SuperCollider-${version}-Source-linux.tar.bz2";
-    sha256 = "053b2xc2x1sczvlb41w6iciqlwy0zyfiv3jrynx4f8jgd6mizsm6";
+    sha256 = "1y8yb20k3lvj7c93qz2srrkvfv175n4n7p3qj89w0dp085mj0qmw";
   };
 
   hardeningDisable = [ "stackprotector" ];