summary refs log tree commit diff
path: root/pkgs/development/interpreters
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2015-10-03 13:33:13 +0200
committerVladimír Čunát <vcunat@gmail.com>2015-10-03 13:33:37 +0200
commit5227fb1dd53fcb5918b9342dff4868f4ad68427e (patch)
treed6cd521e3f67944031216a27f740f28f22b73b41 /pkgs/development/interpreters
parentd6dd3b8bd1eaeeb21dfdb5051cd4732c748ce5d7 (diff)
parent33373d939a19f465228ddede6d38ce9032b5916b (diff)
downloadnixpkgs-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar
nixpkgs-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar.gz
nixpkgs-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar.bz2
nixpkgs-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar.lz
nixpkgs-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar.xz
nixpkgs-5227fb1dd53fcb5918b9342dff4868f4ad68427e.tar.zst
nixpkgs-5227fb1dd53fcb5918b9342dff4868f4ad68427e.zip
Merge commit staging+systemd into closure-size
Many non-conflict problems weren't (fully) resolved in this commit yet.
Diffstat (limited to 'pkgs/development/interpreters')
-rw-r--r--pkgs/development/interpreters/angelscript/default.nix4
-rw-r--r--pkgs/development/interpreters/ceptre/default.nix24
-rw-r--r--pkgs/development/interpreters/elixir/default.nix17
-rw-r--r--pkgs/development/interpreters/erlang/R15.nix6
-rw-r--r--pkgs/development/interpreters/erlang/R16.nix6
-rw-r--r--pkgs/development/interpreters/erlang/R17.nix20
-rw-r--r--pkgs/development/interpreters/erlang/R18.nix87
-rw-r--r--pkgs/development/interpreters/gnu-apl/default.nix4
-rw-r--r--pkgs/development/interpreters/hugs/default.nix38
-rw-r--r--pkgs/development/interpreters/jruby/default.nix4
-rw-r--r--pkgs/development/interpreters/lua-5/5.2.darwin.patch16
-rw-r--r--pkgs/development/interpreters/lua-5/5.2.nix2
-rw-r--r--pkgs/development/interpreters/lua-5/5.3.nix102
-rw-r--r--pkgs/development/interpreters/lua-5/lua-5.3-dso.make8
-rw-r--r--pkgs/development/interpreters/luajit/default.nix4
-rw-r--r--pkgs/development/interpreters/mujs/default.nix6
-rw-r--r--pkgs/development/interpreters/nix-exec/default.nix6
-rw-r--r--pkgs/development/interpreters/octave/default.nix32
-rw-r--r--pkgs/development/interpreters/perl/5.16/default.nix17
-rw-r--r--pkgs/development/interpreters/perl/5.20/default.nix18
-rw-r--r--pkgs/development/interpreters/perl/5.20/perl-5.20.2-gcc5_fixes-1.patch127
-rw-r--r--pkgs/development/interpreters/perl/5.22/cpp-precomp.patch11
-rw-r--r--pkgs/development/interpreters/perl/5.22/default.nix110
-rw-r--r--pkgs/development/interpreters/perl/5.22/ld-shared.patch11
-rw-r--r--pkgs/development/interpreters/perl/5.22/no-libutil.patch12
-rw-r--r--pkgs/development/interpreters/perl/5.22/no-sys-dirs.patch250
-rw-r--r--pkgs/development/interpreters/perl/5.22/setup-hook.sh5
-rw-r--r--pkgs/development/interpreters/perl/sys-perl/default.nix19
-rw-r--r--pkgs/development/interpreters/perl/sys-perl/setup-hook.sh5
-rw-r--r--pkgs/development/interpreters/php/5.4.nix6
-rw-r--r--pkgs/development/interpreters/php/5.5.nix6
-rw-r--r--pkgs/development/interpreters/php/5.6.nix6
-rw-r--r--pkgs/development/interpreters/php/default.nix308
-rw-r--r--pkgs/development/interpreters/php/fix-paths-php7.patch23
-rw-r--r--pkgs/development/interpreters/php/generic.nix283
-rw-r--r--pkgs/development/interpreters/picoc/default.nix53
-rw-r--r--pkgs/development/interpreters/picolisp/default.nix91
-rw-r--r--pkgs/development/interpreters/pure/default.nix6
-rw-r--r--pkgs/development/interpreters/pypy/default.nix33
-rw-r--r--pkgs/development/interpreters/pypy/setup-hook.sh4
-rw-r--r--pkgs/development/interpreters/python/2.6/default.nix23
-rw-r--r--pkgs/development/interpreters/python/2.7/2.5.2-ctypes-util-find_library.patch34
-rw-r--r--pkgs/development/interpreters/python/2.7/2.5.2-tkinter-x11.patch27
-rw-r--r--pkgs/development/interpreters/python/2.7/2.6.2-ssl-threads.patch13
-rw-r--r--pkgs/development/interpreters/python/2.7/2.6.5-FD_SETSIZE.patch41
-rw-r--r--pkgs/development/interpreters/python/2.7/2.6.5-export-PySignal_SetWakeupFd.patch11
-rw-r--r--pkgs/development/interpreters/python/2.7/2.6.5-ncurses-abi6.patch16
-rw-r--r--pkgs/development/interpreters/python/2.7/2.7.3-dbm.patch27
-rw-r--r--pkgs/development/interpreters/python/2.7/2.7.3-dylib.patch10
-rw-r--r--pkgs/development/interpreters/python/2.7/2.7.3-getpath-exe-extension.patch31
-rw-r--r--pkgs/development/interpreters/python/2.7/2.7.3-no-libm.patch11
-rw-r--r--pkgs/development/interpreters/python/2.7/default.nix83
-rw-r--r--pkgs/development/interpreters/python/2.7/properly-detect-curses.patch116
-rw-r--r--pkgs/development/interpreters/python/3.2/default.nix2
-rw-r--r--pkgs/development/interpreters/python/3.5/default.nix112
-rw-r--r--pkgs/development/interpreters/python/3.5/setup-hook.sh15
-rw-r--r--pkgs/development/interpreters/python/wrapper.nix54
-rw-r--r--pkgs/development/interpreters/racket/default.nix6
-rw-r--r--pkgs/development/interpreters/regina/default.nix4
-rw-r--r--pkgs/development/interpreters/ruby/bundler-env/default-gem-config.nix10
-rw-r--r--pkgs/development/interpreters/ruby/bundler-head.nix6
-rw-r--r--pkgs/development/interpreters/ruby/bundler.nix12
-rw-r--r--pkgs/development/interpreters/ruby/config.nix6
-rw-r--r--pkgs/development/interpreters/ruby/default.nix248
-rw-r--r--pkgs/development/interpreters/ruby/patchsets.nix126
-rw-r--r--pkgs/development/interpreters/ruby/ruby-1.8.7.nix3
-rw-r--r--pkgs/development/interpreters/ruby/ruby-1.9.3.nix121
-rw-r--r--pkgs/development/interpreters/ruby/ruby-2.0.0.nix104
-rw-r--r--pkgs/development/interpreters/ruby/ruby-2.1.0.nix120
-rw-r--r--pkgs/development/interpreters/ruby/ruby-2.1.1.nix118
-rw-r--r--pkgs/development/interpreters/ruby/ruby-2.1.2.nix117
-rw-r--r--pkgs/development/interpreters/ruby/ruby-2.1.3.nix121
-rw-r--r--pkgs/development/interpreters/ruby/ruby-2.2.0.nix112
-rw-r--r--pkgs/development/interpreters/ruby/rubygems.nix4
-rw-r--r--pkgs/development/interpreters/ruby/rvm-patchsets.nix4
-rw-r--r--pkgs/development/interpreters/scsh/default.nix30
-rw-r--r--pkgs/development/interpreters/self/default.nix4
-rw-r--r--pkgs/development/interpreters/spidermonkey/17.0.nix18
-rw-r--r--pkgs/development/interpreters/spidermonkey/24.2.nix16
-rw-r--r--pkgs/development/interpreters/spidermonkey/31.5.nix65
-rw-r--r--pkgs/development/interpreters/supercollider/default.nix4
-rw-r--r--pkgs/development/interpreters/tcl/generic.nix5
-rw-r--r--pkgs/development/interpreters/xulrunner/default.nix13
83 files changed, 2444 insertions, 1369 deletions
diff --git a/pkgs/development/interpreters/angelscript/default.nix b/pkgs/development/interpreters/angelscript/default.nix
index 4691b8be564..a6e6cce9a8e 100644
--- a/pkgs/development/interpreters/angelscript/default.nix
+++ b/pkgs/development/interpreters/angelscript/default.nix
@@ -3,10 +3,10 @@ let
   s = # Generated upstream information
   rec {
     baseName="angelscript";
-    version = "2.30.0";
+    version = "2.30.1";
     name="${baseName}-${version}";
     url="http://www.angelcode.com/angelscript/sdk/files/angelscript_${version}.zip";
-    sha256 = "00w7h2g6g1lkq9ahsvzyk78nbdzhn1adsrns9mrqb2fbxv2wbz5d";
+    sha256 = "10ym7185h26gzmw5v6wz8zlycw8gzygv0aw87dmgjcyy7qfk74m4";
   };
   buildInputs = [
     unzip
diff --git a/pkgs/development/interpreters/ceptre/default.nix b/pkgs/development/interpreters/ceptre/default.nix
new file mode 100644
index 00000000000..13cd9f1c8ee
--- /dev/null
+++ b/pkgs/development/interpreters/ceptre/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchgit, mlton }:
+
+stdenv.mkDerivation rec {
+  name = "ceptre-2015-08-30";
+
+  src = fetchgit {
+    url = https://github.com/chrisamaphone/interactive-lp;
+    rev = "f16ebee257d63396b8456c48698d255c118d7157";
+    sha256 = "0d5s8nzsjl3l7g723588l19j3pyxkdrqnfs9nngv1d9syqyb5395";
+  };
+
+  nativeBuildInputs = [ mlton ];
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp ceptre $out/bin
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A linear logic programming language for modeling generative interactive systems";
+    homepage = https://github.com/chrisamaphone/interactive-lp;
+    maintainers = with maintainers; [ pSub ];
+  };
+}
diff --git a/pkgs/development/interpreters/elixir/default.nix b/pkgs/development/interpreters/elixir/default.nix
index 1166c7075c8..380da51da77 100644
--- a/pkgs/development/interpreters/elixir/default.nix
+++ b/pkgs/development/interpreters/elixir/default.nix
@@ -1,14 +1,14 @@
-{ stdenv, fetchurl, erlang, rebar, makeWrapper, coreutils, curl, bash, cacert }:
+{ stdenv, fetchurl, erlang, rebar, makeWrapper, coreutils, curl, bash }:
 
 let
-  version = "1.0.4";
+  version = "1.1.1";
 in
 stdenv.mkDerivation {
   name = "elixir-${version}";
 
   src = fetchurl {
     url = "https://github.com/elixir-lang/elixir/archive/v${version}.tar.gz";
-    sha256 = "1babp3ff6hajdm247zl9rc311k973cdnv6dqaai7l8817gg1yd3r";
+    sha256 = "0shh5brhcrvbvhl4bw0fs2y5llw7i97khkkglygx30ncvd7nwz9v";
   };
 
   buildInputs = [ erlang rebar makeWrapper ];
@@ -20,8 +20,6 @@ stdenv.mkDerivation {
 
     substituteInPlace Makefile \
       --replace "/usr/local" $out
-    substituteInPlace bin/mix \
-      --replace "/usr/bin/env elixir" "$out/bin/elixir"
   '';
 
   postFixup = ''
@@ -32,9 +30,12 @@ stdenv.mkDerivation {
      b=$(basename $f)
       if [ $b == "mix" ]; then continue; fi
       wrapProgram $f \
-      --prefix PATH ":" "${erlang}/bin:${coreutils}/bin:${curl}/bin:${bash}/bin" \
-      --set CURL_CA_BUNDLE "${cacert}/etc/ca-bundle.crt"
+        --prefix PATH ":" "${erlang}/bin:${coreutils}/bin:${curl}/bin:${bash}/bin" \
+        --set CURL_CA_BUNDLE /etc/ssl/certs/ca-certificates.crt
     done
+
+    substituteInPlace $out/bin/mix \
+          --replace "/usr/bin/env elixir" "${coreutils}/bin/env elixir"
   '';
 
   meta = with stdenv.lib; {
@@ -51,6 +52,6 @@ stdenv.mkDerivation {
 
     license = licenses.epl10;
     platforms = platforms.unix;
-    maintainers = [ maintainers.the-kenny ];
+    maintainers = [ maintainers.the-kenny maintainers.havvy ];
   };
 }
diff --git a/pkgs/development/interpreters/erlang/R15.nix b/pkgs/development/interpreters/erlang/R15.nix
index e9c8380c35a..12f7a020032 100644
--- a/pkgs/development/interpreters/erlang/R15.nix
+++ b/pkgs/development/interpreters/erlang/R15.nix
@@ -1,8 +1,8 @@
 { stdenv, fetchurl, perl, gnum4, ncurses, openssl
 , makeWrapper, gnused, gawk
-, wxSupport ? false, mesa ? null, wxGTK ? null, xlibs ? null }:
+, wxSupport ? false, mesa ? null, wxGTK ? null, xorg ? null }:
 
-assert wxSupport -> mesa != null && wxGTK != null && xlibs != null;
+assert wxSupport -> mesa != null && wxGTK != null && xorg != null;
 
 let version = "15B03"; in
 
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
   buildInputs =
     [ perl gnum4 ncurses openssl
       makeWrapper
-    ] ++ stdenv.lib.optional wxSupport [ mesa wxGTK xlibs.libX11 ];
+    ] ++ stdenv.lib.optional wxSupport [ mesa wxGTK xorg.libX11 ];
 
   patchPhase = '' sed -i "s@/bin/rm@rm@" lib/odbc/configure erts/configure '';
 
diff --git a/pkgs/development/interpreters/erlang/R16.nix b/pkgs/development/interpreters/erlang/R16.nix
index 23243803e8d..cc15a2d21f5 100644
--- a/pkgs/development/interpreters/erlang/R16.nix
+++ b/pkgs/development/interpreters/erlang/R16.nix
@@ -1,9 +1,9 @@
 { stdenv, fetchurl, perl, gnum4, ncurses, openssl
 , gnused, gawk, makeWrapper
 , odbcSupport ? false, unixODBC ? null
-, wxSupport ? false, mesa ? null, wxGTK ? null, xlibs ? null }:
+, wxSupport ? false, mesa ? null, wxGTK ? null, xorg ? null }:
 
-assert wxSupport -> mesa != null && wxGTK != null && xlibs != null;
+assert wxSupport -> mesa != null && wxGTK != null && xorg != null;
 assert odbcSupport -> unixODBC != null;
 
 with stdenv.lib;
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   buildInputs =
     [ perl gnum4 ncurses openssl makeWrapper
-    ] ++ optional wxSupport [ mesa wxGTK xlibs.libX11 ]
+    ] ++ optional wxSupport [ mesa wxGTK xorg.libX11 ]
       ++ optional odbcSupport [ unixODBC ];
 
   patchPhase = '' sed -i "s@/bin/rm@rm@" lib/odbc/configure erts/configure '';
diff --git a/pkgs/development/interpreters/erlang/R17.nix b/pkgs/development/interpreters/erlang/R17.nix
index 6b64fc32e12..6c24f6ecb79 100644
--- a/pkgs/development/interpreters/erlang/R17.nix
+++ b/pkgs/development/interpreters/erlang/R17.nix
@@ -1,11 +1,15 @@
 { stdenv, fetchurl, perl, gnum4, ncurses, openssl
 , gnused, gawk, makeWrapper
 , odbcSupport ? false, unixODBC ? null
-, wxSupport ? true, mesa ? null, wxGTK ? null, xlibs ? null
+, wxSupport ? true, mesa ? null, wxGTK ? null, xorg ? null, wxmac ? null
 , javacSupport ? false, openjdk ? null
-, enableHipe ? true}:
+, enableHipe ? true
+}:
+
+assert wxSupport -> (if stdenv.isDarwin
+  then wxmac != null
+  else mesa != null && wxGTK != null && xorg != null);
 
-assert wxSupport -> mesa != null && wxGTK != null && xlibs != null;
 assert odbcSupport -> unixODBC != null;
 assert javacSupport ->  openjdk != null;
 
@@ -23,7 +27,7 @@ stdenv.mkDerivation rec {
 
   buildInputs =
     [ perl gnum4 ncurses openssl makeWrapper
-    ] ++ optional wxSupport [ mesa wxGTK xlibs.libX11 ]
+    ] ++ optional wxSupport (if stdenv.isDarwin then [ wxmac ] else [ mesa wxGTK xorg.libX11 ])
       ++ optional odbcSupport [ unixODBC ]
       ++ optional javacSupport [ openjdk ];
 
@@ -34,7 +38,13 @@ stdenv.mkDerivation rec {
     sed -e s@/bin/pwd@pwd@g -i otp_build
   '';
 
-  configureFlags= "--with-ssl=${openssl} ${optionalString enableHipe "--enable-hipe"} ${optionalString odbcSupport "--with-odbc=${unixODBC}"} ${optionalString stdenv.isDarwin "--enable-darwin-64bit"} ${optionalString javacSupport "--with-javac"}";
+  configureFlags= [
+    "--with-ssl=${openssl}"
+  ] ++ optional enableHipe "--enable-hipe"
+    ++ optional wxSupport "--enable-wx"
+    ++ optional odbcSupport "--with-odbc=${unixODBC}"
+    ++ optional javacSupport "--with-javac"
+    ++ optional stdenv.isDarwin "--enable-darwin-64bit";
 
   postInstall = let
     manpages = fetchurl {
diff --git a/pkgs/development/interpreters/erlang/R18.nix b/pkgs/development/interpreters/erlang/R18.nix
new file mode 100644
index 00000000000..7646de28a85
--- /dev/null
+++ b/pkgs/development/interpreters/erlang/R18.nix
@@ -0,0 +1,87 @@
+{ stdenv, fetchurl, perl, gnum4, ncurses, openssl
+, gnused, gawk, makeWrapper
+, odbcSupport ? false, unixODBC ? null
+, wxSupport ? true, mesa ? null, wxGTK ? null, xorg ? null, wxmac ? null
+, javacSupport ? false, openjdk ? null
+, enableHipe ? true
+}:
+
+assert wxSupport -> (if stdenv.isDarwin
+  then wxmac != null
+  else mesa != null && wxGTK != null && xorg != null);
+
+assert odbcSupport -> unixODBC != null;
+assert javacSupport ->  openjdk != null;
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "erlang-" + version + "${optionalString odbcSupport "-odbc"}"
+  + "${optionalString javacSupport "-javac"}";
+  version = "18.0";
+
+  src = fetchurl {
+    url = "http://www.erlang.org/download/otp_src_${version}.tar.gz";
+    sha256 = "1ahi865ii3iqzd00yyn3nrxjb9qa2by9d7ixssvqw8ag9firvdm0";
+  };
+
+  buildInputs =
+    [ perl gnum4 ncurses openssl makeWrapper
+    ] ++ optional wxSupport (if stdenv.isDarwin then [ wxmac ] else [ mesa wxGTK xorg.libX11 ])
+      ++ optional odbcSupport [ unixODBC ]
+      ++ optional javacSupport [ openjdk ];
+
+  patchPhase = '' 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
+  '';
+
+  configureFlags= [
+    "--with-ssl=${openssl}"
+  ] ++ optional enableHipe "--enable-hipe"
+    ++ optional wxSupport "--enable-wx"
+    ++ optional odbcSupport "--with-odbc=${unixODBC}"
+    ++ optional javacSupport "--with-javac"
+    ++ optional stdenv.isDarwin "--enable-darwin-64bit";
+
+  postInstall = let
+    manpages = fetchurl {
+      url = "http://www.erlang.org/download/otp_doc_man_${version}.tar.gz";
+      sha256 = "0wsnp7sp21ydinwkg3rkazyrs382pdzwra9apikkhs70dv1hwkz4";
+    };
+  in ''
+    ln -s $out/lib/erlang/lib/erl_interface*/bin/erl_call $out/bin/erl_call
+    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
+  '';
+
+  # Some erlang bin/ scripts run sed and awk
+  postFixup = ''
+    wrapProgram $out/lib/erlang/bin/erl --prefix PATH ":" "${gnused}/bin/"
+    wrapProgram $out/lib/erlang/bin/start_erl --prefix PATH ":" "${gnused}/bin/:${gawk}/bin"
+  '';
+
+  meta = {
+    homepage = "http://www.erlang.org/";
+    description = "Programming language used for massively scalable soft real-time systems";
+
+    longDescription = ''
+      Erlang is a programming language used to build massively scalable
+      soft real-time systems with requirements on high availability.
+      Some of its uses are in telecoms, banking, e-commerce, computer
+      telephony and instant messaging. Erlang's runtime system has
+      built-in support for concurrency, distribution and fault
+      tolerance.
+    '';
+
+    platforms = platforms.unix;
+    maintainers = with maintainers; [ the-kenny sjmackenzie couchemar ];
+    license = licenses.asl20;
+  };
+}
diff --git a/pkgs/development/interpreters/gnu-apl/default.nix b/pkgs/development/interpreters/gnu-apl/default.nix
index 687b7319cf4..44462161407 100644
--- a/pkgs/development/interpreters/gnu-apl/default.nix
+++ b/pkgs/development/interpreters/gnu-apl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, liblapack, readline, gettext, ncurses }:
+{ stdenv, fetchurl, readline, gettext, ncurses }:
 
 stdenv.mkDerivation rec {
   name = "gnu-apl-${version}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "0h4diq3wfbdwxp5nm0z4b0p1zq13lwip0y7v28r9v0mbbk8xsfh1";
   };
 
-  buildInputs = [ liblapack readline gettext ncurses ];
+  buildInputs = [ readline gettext ncurses ];
 
   postInstall = ''
     cp -r support-files/ $out/share/doc/
diff --git a/pkgs/development/interpreters/hugs/default.nix b/pkgs/development/interpreters/hugs/default.nix
new file mode 100644
index 00000000000..b1c3df28d1f
--- /dev/null
+++ b/pkgs/development/interpreters/hugs/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchurl, bison }:
+
+stdenv.mkDerivation {
+
+  name = "hugs98-200609";
+
+  src = fetchurl {
+    url = http://cvs.haskell.org/Hugs/downloads/2006-09/hugs98-Sep2006.tar.gz;
+    sha256 = "3cf4d27673564cffe691bd14032369f646233f14daf2bc37c6c6df9f062b46b6";
+  };
+
+  buildInputs = [ bison ];
+
+  postUnpack = "find -type f -exec sed -i 's@/bin/cp@cp@' {} +";
+
+  configureFlags = [
+    "--enable-char-encoding=utf8"       # require that the UTF-8 encoding is always used
+    "--disable-path-canonicalization"
+    "--disable-timer"                   # evaluation timing (for benchmarking Hugs)
+    "--disable-profiling"               # heap profiler
+    "--disable-stack-dumps"             # stack dump on stack overflow
+    "--enable-large-banner"             # multiline startup banner
+    "--disable-internal-prims"          # experimental primitives to access Hugs's innards
+    "--disable-debug"                   # include C debugging information (for debugging Hugs)
+    "--disable-tag"                     # runtime tag checking (for debugging Hugs)
+    "--disable-lint"                    # "lint" flags (for debugging Hugs)
+    "--disable-only98"                  # build Hugs to understand Haskell 98 only
+    "--enable-ffi"
+    "--enable-pthreads"                 # build Hugs using POSIX threads C library
+  ];
+
+  meta = {
+    homepage = http://www.haskell.org/hugs;
+    description = "Haskell interpreter";
+    license = "as-is";                          # gentoo labels it this way
+    platforms = stdenv.lib.platforms.unix;      # arbitrary choice
+  };
+}
diff --git a/pkgs/development/interpreters/jruby/default.nix b/pkgs/development/interpreters/jruby/default.nix
index ab559aa9e65..bc76abb4546 100644
--- a/pkgs/development/interpreters/jruby/default.nix
+++ b/pkgs/development/interpreters/jruby/default.nix
@@ -3,11 +3,11 @@
 stdenv.mkDerivation rec {
   name = "jruby-${version}";
 
-  version = "1.7.12";
+  version = "1.7.21";
 
   src = fetchurl {
     url = "http://jruby.org.s3.amazonaws.com/downloads/${version}/jruby-bin-${version}.tar.gz";
-    sha1 = "056cee1138e49da40a77f179b771372692479002";
+    sha1 = "4955b69a913b22f96bd599eff2a133d8d1ed42c6";
   };
 
   buildInputs = [ makeWrapper ];
diff --git a/pkgs/development/interpreters/lua-5/5.2.darwin.patch b/pkgs/development/interpreters/lua-5/5.2.darwin.patch
index ffc3ff34be7..b314bd2abac 100644
--- a/pkgs/development/interpreters/lua-5/5.2.darwin.patch
+++ b/pkgs/development/interpreters/lua-5/5.2.darwin.patch
@@ -1,27 +1,27 @@
 diff --git a/Makefile b/Makefile
-index 209a132..9387b09 100644
+index d2c7db4..dc107b3 100644
 --- a/Makefile
 +++ b/Makefile
-@@ -43,5 +43,5 @@ PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
+@@ -41,7 +41,7 @@ PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
  # What to install.
  TO_BIN= lua luac
  TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp
 -TO_LIB= liblua.a
 +TO_LIB= liblua.${version}.dylib
  TO_MAN= lua.1 luac.1
-
+ 
  # Lua version and release.
-@@ -64,3 +64,5 @@ install: dummy
+@@ -63,6 +63,8 @@ install: dummy
  	cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
  	cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
  	cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
 +	ln -s -f liblua.${version}.dylib $(INSTALL_LIB)/liblua.${majorVersion}.dylib
 +	ln -s -f liblua.${majorVersion}.dylib $(INSTALL_LIB)/liblua.dylib
-
- ranlib:
- 	cd src && cd $(INSTALL_LIB) && $(RANLIB) $(TO_LIB)
+ 
+ uninstall:
+ 	cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN)
 diff --git a/src/Makefile b/src/Makefile
-index fea895b..d9146d0 100644
+index 7b4b2b7..25001e5 100644
 --- a/src/Makefile
 +++ b/src/Makefile
 @@ -28,7 +28,7 @@ MYOBJS=
diff --git a/pkgs/development/interpreters/lua-5/5.2.nix b/pkgs/development/interpreters/lua-5/5.2.nix
index 1812ccbf7d6..313db1038b8 100644
--- a/pkgs/development/interpreters/lua-5/5.2.nix
+++ b/pkgs/development/interpreters/lua-5/5.2.nix
@@ -2,7 +2,7 @@
 
 let
   dsoPatch = fetchurl {
-    url = "https://projects.archlinux.org/svntogit/packages.git/plain/trunk/liblua.so.patch?h=packages/lua";
+    url = "https://projects.archlinux.org/svntogit/packages.git/plain/trunk/liblua.so.patch?h=packages/lua52";
     sha256 = "1by1dy4ql61f5c6njq9ibf9kaqm3y633g2q8j54iyjr4cxvqwqz9";
     name = "lua-arch.patch";
   };
diff --git a/pkgs/development/interpreters/lua-5/5.3.nix b/pkgs/development/interpreters/lua-5/5.3.nix
new file mode 100644
index 00000000000..faa4b7694ee
--- /dev/null
+++ b/pkgs/development/interpreters/lua-5/5.3.nix
@@ -0,0 +1,102 @@
+{ stdenv, fetchurl, readline, compat ? false }:
+
+stdenv.mkDerivation rec {
+  name = "lua-${version}";
+  luaversion = "5.3";
+  version = "${luaversion}.0";
+
+  src = fetchurl {
+    url = "http://www.lua.org/ftp/${name}.tar.gz";
+    sha1 = "1c46d1c78c44039939e820126b86a6ae12dadfba";
+  };
+
+  nativeBuildInputs = [ readline ];
+
+  patches = if stdenv.isDarwin then [ ./5.2.darwin.patch ] else [];
+
+  configurePhase =
+    if stdenv.isDarwin
+    then ''
+    makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=macosx CFLAGS="-DLUA_USE_LINUX -fno-common -O2 -fPIC${if compat then " -DLUA_COMPAT_ALL" else ""}" LDFLAGS="-fPIC" V=${luaversion} R=${version} )
+    installFlagsArray=( TO_BIN="lua luac" TO_LIB="liblua.${version}.dylib" INSTALL_DATA='cp -d' )
+  '' else ''
+    makeFlagsArray=( INSTALL_TOP=$out INSTALL_MAN=$out/share/man/man1 PLAT=linux CFLAGS="-DLUA_USE_LINUX -O2 -fPIC${if compat then " -DLUA_COMPAT_ALL" else ""}" LDFLAGS="-fPIC" V=${luaversion} R=${version})
+    installFlagsArray=( TO_BIN="lua luac" TO_LIB="liblua.a liblua.so liblua.so.${luaversion} liblua.so.${version}" INSTALL_DATA='cp -d' )
+    cat ${./lua-5.3-dso.make} >> src/Makefile
+    sed -e 's/ALL_T *= */& $(LUA_SO)/' -i src/Makefile
+  '';
+
+  postBuild = stdenv.lib.optionalString (! stdenv.isDarwin) ''
+    ( cd src; make liblua.so "''${makeFlagsArray[@]}" )
+  '';
+
+  postInstall = ''
+    mkdir -p "$out/share/doc/lua" "$out/lib/pkgconfig"
+    mv "doc/"*.{gif,png,css,html} "$out/share/doc/lua/"
+    rmdir $out/{share,lib}/lua/${luaversion} $out/{share,lib}/lua
+    mkdir -p "$out/lib/pkgconfig"
+    cat >"$out/lib/pkgconfig/lua.pc" <<EOF
+    prefix=$out
+    libdir=$out/lib
+    includedir=$out/include
+    INSTALL_BIN=$out/bin
+    INSTALL_INC=$out/include
+    INSTALL_LIB=$out/lib
+    INSTALL_MAN=$out/man/man1
+
+    Name: Lua
+    Description: An Extensible Extension Language
+    Version: ${version}
+    Requires:
+    Libs: -L$out/lib -llua -lm
+    Cflags: -I$out/include
+    EOF
+  '';
+
+  crossAttrs = let
+    isMingw = stdenv.cross.libc == "msvcrt";
+    isDarwin = stdenv.cross.libc == "libSystem";
+  in {
+    configurePhase = ''
+      makeFlagsArray=(
+        INSTALL_TOP=$out
+        INSTALL_MAN=$out/share/man/man1
+        CC=${stdenv.cross.config}-gcc
+        STRIP=:
+        RANLIB=${stdenv.cross.config}-ranlib
+        V=${luaversion}
+        R=${version}
+        ${if isMingw then "mingw" else stdenv.lib.optionalString isDarwin ''
+        AR="${stdenv.cross.config}-ar rcu"
+        macosx
+        ''}
+      )
+    '' + stdenv.lib.optionalString isMingw ''
+      installFlagsArray=(
+        TO_BIN="lua.exe luac.exe"
+        TO_LIB="liblua.a lua52.dll"
+        INSTALL_DATA="cp -d"
+      )
+    '';
+  } // stdenv.lib.optionalAttrs isDarwin {
+    postPatch = ''
+      sed -i -e 's/-Wl,-soname[^ ]* *//' src/Makefile
+    '';
+  };
+
+  meta = {
+    homepage = "http://www.lua.org";
+    description = "Powerful, fast, lightweight, embeddable scripting language";
+    longDescription = ''
+      Lua combines simple procedural syntax with powerful data
+      description constructs based on associative arrays and extensible
+      semantics. Lua is dynamically typed, runs by interpreting bytecode
+      for a register-based virtual machine, and has automatic memory
+      management with incremental garbage collection, making it ideal
+      for configuration, scripting, and rapid prototyping.
+    '';
+    license = stdenv.lib.licenses.mit;
+    hydraPlatforms = stdenv.lib.platforms.linux;
+    maintainers = [ stdenv.lib.maintainers.simons ];
+  };
+}
diff --git a/pkgs/development/interpreters/lua-5/lua-5.3-dso.make b/pkgs/development/interpreters/lua-5/lua-5.3-dso.make
new file mode 100644
index 00000000000..c70dbc4f9cc
--- /dev/null
+++ b/pkgs/development/interpreters/lua-5/lua-5.3-dso.make
@@ -0,0 +1,8 @@
+
+LUA_SO=liblua.so
+
+$(LUA_SO): $(CORE_O) $(LIB_O)
+	$(CC) -shared -ldl -Wl,-soname,$(LUA_SO).$(V) -o $@.$(R) $? -lm $(MYLDFLAGS)
+	ln -sf $(LUA_SO).$(R) $(LUA_SO).$(V)
+	ln -sf $(LUA_SO).$(R) $(LUA_SO)
+
diff --git a/pkgs/development/interpreters/luajit/default.nix b/pkgs/development/interpreters/luajit/default.nix
index 6e596ba4374..0d4a5ef2d6a 100644
--- a/pkgs/development/interpreters/luajit/default.nix
+++ b/pkgs/development/interpreters/luajit/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name    = "luajit-${version}";
-  version = "2.0.3";
+  version = "2.0.4";
 
   src = fetchurl {
     url    = "http://luajit.org/download/LuaJIT-${version}.tar.gz";
-    sha256 = "0ydxpqkmsn2c341j4r2v6r5r0ig3kbwv3i9jran3iv81s6r6rgjm";
+    sha256 = "0zc0y7p6nx1c0pp4nhgbdgjljpfxsb5kgwp4ysz22l1p2bms83v2";
   };
 
   enableParallelBuilding = true;
diff --git a/pkgs/development/interpreters/mujs/default.nix b/pkgs/development/interpreters/mujs/default.nix
index bebacc87817..1faf913a2d6 100644
--- a/pkgs/development/interpreters/mujs/default.nix
+++ b/pkgs/development/interpreters/mujs/default.nix
@@ -1,12 +1,12 @@
 { stdenv, fetchgit, clang }:
 
 stdenv.mkDerivation rec {
-  name = "mujs-2015-01-22";
+  name = "mujs-2015-09-15";
 
   src = fetchgit {
     url = git://git.ghostscript.com/mujs.git;
-    rev  = "c1ad1ba1e482e7d01743e3f4f9517572bebf99ac";
-    sha256 = "1713h82zzd189nb54ilpa8fj9xhinhn0jvmd3li4c2fwh6xfjpcy";
+    rev  = "17019d29e5494d4b0ae148a3043a940be78e3215";
+    sha256 = "07192f4va733dr3v4ywfaqhz21iyydjwm84ij7zafwjvfi5z2b38";
   };
 
   buildInputs = [ clang ];
diff --git a/pkgs/development/interpreters/nix-exec/default.nix b/pkgs/development/interpreters/nix-exec/default.nix
index 6e7ffa656a0..071680c4e9b 100644
--- a/pkgs/development/interpreters/nix-exec/default.nix
+++ b/pkgs/development/interpreters/nix-exec/default.nix
@@ -1,12 +1,12 @@
 { stdenv, fetchurl, pkgconfig, nix, git }: let
-  version = "4.0.0";
+  version = "4.1.2";
 in stdenv.mkDerivation {
   name = "nix-exec-${version}";
 
   src = fetchurl {
     url = "https://github.com/shlevy/nix-exec/releases/download/v${version}/nix-exec-${version}.tar.xz";
 
-    sha256 = "0qw25v8pzx08mirhy46dmqj93nwnxfvgw2jsn8rvxh2d7x4nc8jv";
+    sha256 = "03dphdkf33zi2wm92wghfvadghljh6q1a9zdj9rcbx2jh7fp3k8y";
   };
 
   buildInputs = [ pkgconfig nix git ];
@@ -18,8 +18,6 @@ in stdenv.mkDerivation {
 
     license = stdenv.lib.licenses.mit;
 
-    maintainers = [ stdenv.lib.maintainers.shlevy ];
-
     platforms = nix.meta.platforms;
   };
 }
diff --git a/pkgs/development/interpreters/octave/default.nix b/pkgs/development/interpreters/octave/default.nix
index a0906a09a78..bdf6f775277 100644
--- a/pkgs/development/interpreters/octave/default.nix
+++ b/pkgs/development/interpreters/octave/default.nix
@@ -1,20 +1,32 @@
 { stdenv, fetchurl, gfortran, readline, ncurses, perl, flex, texinfo, qhull
-, libX11, graphicsmagick, pcre, liblapack, pkgconfig, mesa, fltk
-, fftw, fftwSinglePrec, zlib, curl, qrupdate
+, libX11, graphicsmagick, pcre, pkgconfig, mesa, fltk
+, fftw, fftwSinglePrec, zlib, curl, qrupdate, openblas
 , qt ? null, qscintilla ? null, ghostscript ? null, llvm ? null, hdf5 ? null,glpk ? null
 , suitesparse ? null, gnuplot ? null, jdk ? null, python ? null
 }:
 
+let
+  suitesparseOrig = suitesparse;
+  qrupdateOrig = qrupdate;
+in
+# integer width is determined by openblas, so all dependencies must be built
+# with exactly the same openblas
+let
+  suitesparse =
+    if suitesparseOrig != null then suitesparseOrig.override { inherit openblas; } else null;
+  qrupdate = if qrupdateOrig != null then qrupdateOrig.override { inherit openblas; } else null;
+in
+
 stdenv.mkDerivation rec {
-  version = "3.8.2";
+  version = "4.0.0";
   name = "octave-${version}";
   src = fetchurl {
-    url = "mirror://gnu/octave/${name}.tar.bz2";
-    sha256 = "83bbd701aab04e7e57d0d5b8373dd54719bebb64ce0a850e69bf3d7454f33bae";
+    url = "mirror://gnu/octave/${name}.tar.xz";
+    sha256 = "0x64b2lna4vrlm4wwx6h1qdlmki6s2b9q90yjxldlvvrqvxf4syg";
   };
 
   buildInputs = [ gfortran readline ncurses perl flex texinfo qhull libX11
-    graphicsmagick pcre liblapack pkgconfig mesa fltk zlib curl
+    graphicsmagick pcre pkgconfig mesa fltk zlib curl openblas
     fftw fftwSinglePrec qrupdate ]
     ++ (stdenv.lib.optional (qt != null) qt)
     ++ (stdenv.lib.optional (qscintilla != null) qscintilla)
@@ -34,7 +46,13 @@ stdenv.mkDerivation rec {
   # problems on Hydra
   enableParallelBuilding = false;
 
-  configureFlags = [ "--enable-readline" "--enable-dl" ];
+  configureFlags =
+    [ "--enable-readline"
+      "--enable-dl"
+      "--with-blas=openblas"
+      "--with-lapack=openblas"
+    ]
+    ++ stdenv.lib.optional openblas.blas64 "--enable-64";
 
   # Keep a copy of the octave tests detailed results in the output
   # derivation, because someone may care
diff --git a/pkgs/development/interpreters/perl/5.16/default.nix b/pkgs/development/interpreters/perl/5.16/default.nix
index b293aa2541f..989d24950b9 100644
--- a/pkgs/development/interpreters/perl/5.16/default.nix
+++ b/pkgs/development/interpreters/perl/5.16/default.nix
@@ -19,8 +19,6 @@ stdenv.mkDerivation rec {
 
   setOutputFlags = false;
 
-  setOutputConfigureFlags = false;
-
   patches =
     [ # Do not look in /usr etc. for dependencies.
       ./no-sys-dirs.patch
@@ -31,6 +29,17 @@ stdenv.mkDerivation rec {
     ++ lib.optional stdenv.isSunOS  ./ld-shared.patch
     ++ lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
 
+  # There's an annoying bug on sandboxed Darwin in Perl's Cwd.pm where it looks for pwd
+  # in /bin/pwd and /usr/bin/pwd and then falls back on just "pwd" if it can't get them
+  # while at the same time erasing the PATH environment variable so it unconditionally
+  # fails. The code in question is guarded by a check for Mac OS, but the patch below
+  # doesn't have any runtime effect on other platforms.
+  postPatch = ''
+    pwd="$(type -P pwd)"
+    substituteInPlace dist/Cwd/Cwd.pm \
+      --replace "pwd_cmd = 'pwd'" "pwd_cmd = '$pwd'"
+  '';
+
   # Build a thread-safe Perl with a dynamic libperls.o.  We need the
   # "installstyle" option to ensure that modules are put under
   # $out/lib/perl5 - this is the general default, but because $out
@@ -41,8 +50,8 @@ stdenv.mkDerivation rec {
       "-Uinstallusrbinperl"
       "-Dinstallstyle=lib/perl5"
       "-Duseshrplib"
-      "-Dlocincpth=${libc}/include"
-      "-Dloclibpth=${libc.out}/lib"
+      "-Dlocincpth=${libc.dev or libc}/include"
+      "-Dloclibpth=${libc.out or libc}/lib"
     ]
     ++ lib.optional enableThreading "-Dusethreads";
 
diff --git a/pkgs/development/interpreters/perl/5.20/default.nix b/pkgs/development/interpreters/perl/5.20/default.nix
index cafbe5141c1..bcf22654969 100644
--- a/pkgs/development/interpreters/perl/5.20/default.nix
+++ b/pkgs/development/interpreters/perl/5.20/default.nix
@@ -28,13 +28,31 @@ stdenv.mkDerivation rec {
     sha256 = "17cvplgpxbm1hshxlkra2fldn4da1iap1lsnb04hdm8ply93k95i";
   };
 
+  # TODO: Add a "dev" output containing the header files.
+  outputs = [ "out" "man" ];
+
+  setOutputFlags = false;
+
   patches =
     [ # Do not look in /usr etc. for dependencies.
       ./no-sys-dirs.patch
+      # Remove in 5.20.3
+      ./perl-5.20.2-gcc5_fixes-1.patch
     ]
     ++ optional stdenv.isSunOS ./ld-shared.patch
     ++ stdenv.lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ] ;
 
+  # There's an annoying bug on sandboxed Darwin in Perl's Cwd.pm where it looks for pwd
+  # in /bin/pwd and /usr/bin/pwd and then falls back on just "pwd" if it can't get them
+  # while at the same time erasing the PATH environment variable so it unconditionally
+  # fails. The code in question is guarded by a check for Mac OS, but the patch below
+  # doesn't have any runtime effect on other platforms.
+  postPatch = stdenv.lib.optional (stdenv.isDarwin && !stdenv.cc.nativeLibc) ''
+    pwd="$(type -P pwd)"
+    substituteInPlace dist/PathTools/Cwd.pm \
+      --replace "pwd_cmd = 'pwd'" "pwd_cmd = '$pwd'"
+  '';
+
   # Build a thread-safe Perl with a dynamic libperls.o.  We need the
   # "installstyle" option to ensure that modules are put under
   # $out/lib/perl5 - this is the general default, but because $out
diff --git a/pkgs/development/interpreters/perl/5.20/perl-5.20.2-gcc5_fixes-1.patch b/pkgs/development/interpreters/perl/5.20/perl-5.20.2-gcc5_fixes-1.patch
new file mode 100644
index 00000000000..21f3ca8d7a5
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.20/perl-5.20.2-gcc5_fixes-1.patch
@@ -0,0 +1,127 @@
+Submitted By: Ken Moffat <ken at linuxfromscratch dot org>
+Date: 2015-04-17
+Initial Package Version: 5.20.2
+Upstream Status: Committed
+Origin: Petr Pisař and Tony Cook
+Description: Fixes Errno.pm and h2ph with gcc-5.
+
+1. cherry-picked because the change to $version will not apply, from
+commit 816b056ffb99ae54642320e20dc30a59fd1effef
+Author: Petr Písař <ppisar@redhat.com>
+Date:   Wed Feb 11 15:46:37 2015 +0100
+
+    Fix Errno.pm generation for gcc-5.0
+    
+    gcc-5.0 -E interleaves now line numbers with expended macros, so that
+    the generated errno.c will be preprocessed to
+    
+    EBFONT => [[
+               59
+                    ]]
+    
+    which is hard to parse in in line-based reader.
+    
+    So use -P option with gcc >= 5.0. Global -P usage would break makedepend,
+    global -ftrack-macro-expansion=0 would break lib/h2ph.t.
+    
+    RT#123784
+
+diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
+index 3dadfce..c6bfa06 100644
+--- a/ext/Errno/Errno_pm.PL
++++ b/ext/Errno/Errno_pm.PL
+@@ -215,20 +215,31 @@ sub write_errno_pm {
+     {	# BeOS (support now removed) did not enter this block
+     # invoke CPP and read the output
+ 
++	my $inhibit_linemarkers = '';
++	if ($Config{gccversion} =~ /\A(\d+)\./ and $1 >= 5) {
++	    # GCC 5.0 interleaves expanded macros with line numbers breaking
++	    # each line into multiple lines. RT#123784
++	    $inhibit_linemarkers = ' -P';
++	}
++
+ 	if ($^O eq 'VMS') {
+-	    my $cpp = "$Config{cppstdin} $Config{cppflags} $Config{cppminus}";
++	    my $cpp = "$Config{cppstdin} $Config{cppflags}" .
++		$inhibit_linemarkers . " $Config{cppminus}";
+ 	    $cpp =~ s/sys\$input//i;
+ 	    open(CPPO,"$cpp  errno.c |") or
+ 		die "Cannot exec $Config{cppstdin}";
+ 	} elsif ($IsMSWin32 || $^O eq 'NetWare') {
+-	    open(CPPO,"$Config{cpprun} $Config{cppflags} errno.c |") or
+-		die "Cannot run '$Config{cpprun} $Config{cppflags} errno.c'";
++	    my $cpp = "$Config{cpprun} $Config{cppflags}" .
++		$inhibit_linemarkers;
++	    open(CPPO,"$cpp errno.c |") or
++		die "Cannot run '$cpp errno.c'";
+ 	} elsif ($IsSymbian) {
+-            my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc -";
++            my $cpp = "gcc -E -I$ENV{SDK}\\epoc32\\include\\libc" .
++		$inhibit_linemarkers ." -";
+ 	    open(CPPO,"$cpp < errno.c |")
+ 		or die "Cannot exec $cpp";
+         } else {
+-	    my $cpp = default_cpp();
++	    my $cpp = default_cpp() . $inhibit_linemarkers;
+ 	    open(CPPO,"$cpp < errno.c |")
+ 		or die "Cannot exec $cpp";
+ 	}
+
+commit 3bea78d24634e630b610f59957e7a019205a67b2
+Author: Tony Cook <tony@develop-help.com>
+Date:   Mon Feb 16 15:57:00 2015 +1100
+
+    h2ph: correct handling of hex constants for the preamble
+    
+    Previously they were treated as identifiers resulting in code
+    generated like C< &0xFFF >.
+    
+    We also try to prevent compile-time warnings from large hex integers,
+    the user isn't responsible for the generated code, so we delay those
+    warnings to run-time.
+
+diff --git a/utils/h2ph.PL b/utils/h2ph.PL
+index 9a8b14d..d082f22 100644
+--- a/utils/h2ph.PL
++++ b/utils/h2ph.PL
+@@ -769,7 +769,7 @@ sub inc_dirs
+ sub build_preamble_if_necessary
+ {
+     # Increment $VERSION every time this function is modified:
+-    my $VERSION     = 3;
++    my $VERSION     = 4;
+     my $preamble    = "$Dest_dir/_h2ph_pre.ph";
+ 
+     # Can we skip building the preamble file?
+@@ -788,6 +788,11 @@ sub build_preamble_if_necessary
+ 
+     open  PREAMBLE, ">$preamble" or die "Cannot open $preamble:  $!";
+ 	print PREAMBLE "# This file was created by h2ph version $VERSION\n";
++        # Prevent non-portable hex constants from warning.
++        #
++        # We still produce an overflow warning if we can't represent
++        # a hex constant as an integer.
++        print PREAMBLE "no warnings qw(portable);\n";
+ 
+ 	foreach (sort keys %define) {
+ 	    if ($opt_D) {
+@@ -814,6 +819,18 @@ DEFINE
+ 		# integer:
+ 		print PREAMBLE
+ 		    "unless (defined &$_) { sub $_() { $1 } }\n\n";
++            } elsif ($define{$_} =~ /^([+-]?0x[\da-f]+)U?L{0,2}$/i) {
++                # hex integer
++                # Special cased, since perl warns on hex integers
++                # that can't be represented in a UV.
++                #
++                # This way we get the warning at time of use, so the user
++                # only gets the warning if they happen to use this
++                # platform-specific definition.
++                my $code = $1;
++                $code = "hex('$code')" if length $code > 10;
++                print PREAMBLE
++                    "unless (defined &$_) { sub $_() { $code } }\n\n";
+ 	    } elsif ($define{$_} =~ /^\w+$/) {
+ 		my $def = $define{$_};
+ 		if ($isatype{$def}) {
diff --git a/pkgs/development/interpreters/perl/5.22/cpp-precomp.patch b/pkgs/development/interpreters/perl/5.22/cpp-precomp.patch
new file mode 100644
index 00000000000..231853fe51a
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.22/cpp-precomp.patch
@@ -0,0 +1,11 @@
+--- a/hints/darwin.sh	2013-05-08 11:13:45.000000000 -0600
++++ b/hints/darwin.sh	2013-05-08 11:15:04.000000000 -0600
+@@ -129,7 +129,7 @@
+ 
+ # Avoid Apple's cpp precompiler, better for extensions
+ if [ "X`echo | ${cc} -no-cpp-precomp -E - 2>&1 >/dev/null`" = "X" ]; then
+-    cppflags="${cppflags} -no-cpp-precomp"
++    #cppflags="${cppflags} -no-cpp-precomp"
+ 
+     # This is necessary because perl's build system doesn't
+     # apply cppflags to cc compile lines as it should.
diff --git a/pkgs/development/interpreters/perl/5.22/default.nix b/pkgs/development/interpreters/perl/5.22/default.nix
new file mode 100644
index 00000000000..2cf6981c763
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.22/default.nix
@@ -0,0 +1,110 @@
+{ stdenv, fetchurl, enableThreading ? stdenv ? glibc }:
+
+# We can only compile perl with threading on platforms where we have a
+# real glibc in the stdenv.
+#
+# Instead of silently building an unthreaded perl if this is not the
+# case, we force callers to disableThreading explicitly, therefore
+# documenting the platforms where the perl is not threaded.
+#
+# In the case of stdenv linux boot stage1 it's not possible to use
+# threading because of the simpleness of the bootstrap glibc, so we
+# use enableThreading = false there.
+assert enableThreading -> (stdenv ? glibc);
+
+let
+
+  libc = if stdenv.cc.libc or null != null then stdenv.cc.libc else "/usr";
+
+in
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "perl-5.22.0";
+
+  src = fetchurl {
+    url = "mirror://cpan/src/5.0/${name}.tar.gz";
+    sha256 = "0g5bl8sdpzx9gx2g5jq3py4bj07z2ylk7s1qn0fvsss2yl3hhs8c";
+  };
+
+  # TODO: Add a "dev" output containing the header files.
+  outputs = [ "out" "man" ];
+
+  setOutputFlags = false;
+
+  patches =
+    [ # Do not look in /usr etc. for dependencies.
+      ./no-sys-dirs.patch
+    ]
+    ++ optional stdenv.isSunOS ./ld-shared.patch
+    ++ stdenv.lib.optional stdenv.isDarwin [ ./cpp-precomp.patch ./no-libutil.patch ];
+
+  # Build a thread-safe Perl with a dynamic libperls.o.  We need the
+  # "installstyle" option to ensure that modules are put under
+  # $out/lib/perl5 - this is the general default, but because $out
+  # contains the string "perl", Configure would select $out/lib.
+  # Miniperl needs -lm. perl needs -lrt.
+  configureFlags =
+    [ "-de"
+      "-Dcc=cc"
+      "-Uinstallusrbinperl"
+      "-Dinstallstyle=lib/perl5"
+      "-Duseshrplib"
+      "-Dlocincpth=${libc.dev or libc}/include"
+      "-Dloclibpth=${libc.out or libc}/lib"
+    ]
+    ++ optional enableThreading "-Dusethreads";
+
+  configureScript = "${stdenv.shell} ./Configure";
+
+  dontAddPrefix = true;
+
+  enableParallelBuilding = true;
+
+  preConfigure =
+    ''
+
+      configureFlags="$configureFlags -Dprefix=$out -Dman1dir=$out/share/man/man1 -Dman3dir=$out/share/man/man3"
+
+      ${optionalString stdenv.isArm ''
+        configureFlagsArray=(-Dldflags="-lm -lrt")
+      ''}
+    '' + optionalString stdenv.isDarwin ''
+      substituteInPlace hints/darwin.sh --replace "env MACOSX_DEPLOYMENT_TARGET=10.3" ""
+    '' + optionalString (!enableThreading) ''
+      # We need to do this because the bootstrap doesn't have a static libpthread
+      sed -i 's,\(libswanted.*\)pthread,\1,g' Configure
+    '';
+
+  preBuild = optionalString (!(stdenv ? cc && stdenv.cc.nativeTools))
+    ''
+      # Make Cwd work on NixOS (where we don't have a /bin/pwd).
+      substituteInPlace dist/PathTools/Cwd.pm --replace "'/bin/pwd'" "'$(type -tP pwd)'"
+    '';
+
+  setupHook = ./setup-hook.sh;
+
+  passthru.libPrefix = "lib/perl5/site_perl";
+
+  preCheck = ''
+    # Try and setup a local hosts file
+    if [ -f "${libc}/lib/libnss_files.so" ]; then
+      mkdir $TMPDIR/fakelib
+      cp "${libc}/lib/libnss_files.so" $TMPDIR/fakelib
+      sed -i 's,/etc/hosts,/dev/fd/3,g' $TMPDIR/fakelib/libnss_files.so
+      export LD_LIBRARY_PATH=$TMPDIR/fakelib
+    fi
+  '';
+
+  postCheck = ''
+    unset LD_LIBRARY_PATH
+  '';
+
+  meta = {
+    homepage = https://www.perl.org/;
+    description = "The standard implementation of the Perl 5 programmming language";
+    maintainers = [ maintainers.eelco ];
+    platforms = platforms.all;
+  };
+}
diff --git a/pkgs/development/interpreters/perl/5.22/ld-shared.patch b/pkgs/development/interpreters/perl/5.22/ld-shared.patch
new file mode 100644
index 00000000000..be45230c8a7
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.22/ld-shared.patch
@@ -0,0 +1,11 @@
+--- perl-5.16.2/hints/solaris_2.sh.orig	2013-02-14 19:29:49.453988140 +0000
++++ perl-5.16.2/hints/solaris_2.sh	2013-02-14 19:30:31.681631019 +0000
+@@ -568,7 +568,7 @@
+ #		    ccflags="$ccflags -Wa,`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
+ #		fi
+ 		ldflags="$ldflags -m64"
+-		lddlflags="$lddlflags -G -m64"
++		lddlflags="$lddlflags -shared -m64"
+ 		;;
+ 	    *)
+ 		getconfccflags="`getconf XBS5_LP64_OFF64_CFLAGS 2>/dev/null`"
diff --git a/pkgs/development/interpreters/perl/5.22/no-libutil.patch b/pkgs/development/interpreters/perl/5.22/no-libutil.patch
new file mode 100644
index 00000000000..68d44612bfe
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.22/no-libutil.patch
@@ -0,0 +1,12 @@
+diff -ru -x '*~' perl-5.14.2-orig/Configure perl-5.14.2/Configure
+--- perl-5.14.2-orig/Configure	2011-09-26 11:44:34.000000000 +0200
++++ perl-5.14.2/Configure	2012-02-16 17:24:50.779839039 +0100
+@@ -1368,7 +1368,7 @@
+ : List of libraries we want.
+ : If anyone needs extra -lxxx, put those in a hint file.
+ libswanted="socket bind inet nsl nm ndbm gdbm dbm db malloc dl ld sun"
+-libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
++libswanted="$libswanted m crypt sec 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 ! !'`
diff --git a/pkgs/development/interpreters/perl/5.22/no-sys-dirs.patch b/pkgs/development/interpreters/perl/5.22/no-sys-dirs.patch
new file mode 100644
index 00000000000..1793273a76f
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.22/no-sys-dirs.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
+-
+ # Are we using ELF?  Thanks to Kenneth Albanowski <kjahds@kjahds.com>
+ # for this test.
+ cat >try.c <<'EOM'
+@@ -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/5.22/setup-hook.sh b/pkgs/development/interpreters/perl/5.22/setup-hook.sh
new file mode 100644
index 00000000000..a8656b8531d
--- /dev/null
+++ b/pkgs/development/interpreters/perl/5.22/setup-hook.sh
@@ -0,0 +1,5 @@
+addPerlLibPath () {
+    addToSearchPath PERL5LIB $1/lib/perl5/site_perl
+}
+
+envHooks+=(addPerlLibPath)
diff --git a/pkgs/development/interpreters/perl/sys-perl/default.nix b/pkgs/development/interpreters/perl/sys-perl/default.nix
deleted file mode 100644
index e30ce92c61e..00000000000
--- a/pkgs/development/interpreters/perl/sys-perl/default.nix
+++ /dev/null
@@ -1,19 +0,0 @@
-{ stdenv }:
-
-stdenv.mkDerivation rec {
-  name = "perl";
-
-  unpackPhase = "true";
-  
-  installPhase =
-    ''
-      mkdir -p $out/bin
-      ln -s /usr/bin/perl $out/bin
-    '';
-
-  setupHook = ./setup-hook.sh;
-
-  libPrefix = "lib/perl5/site_perl/5.10/i686-cygwin";
-
-  passthru.libPrefix = libPrefix;
-}
diff --git a/pkgs/development/interpreters/perl/sys-perl/setup-hook.sh b/pkgs/development/interpreters/perl/sys-perl/setup-hook.sh
deleted file mode 100644
index 7b03c15ec5a..00000000000
--- a/pkgs/development/interpreters/perl/sys-perl/setup-hook.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-addPerlLibPath () {
-    addToSearchPath PERL5LIB $1/@libPrefix@
-}
-
-envHooks+=(addPerlLibPath)
diff --git a/pkgs/development/interpreters/php/5.4.nix b/pkgs/development/interpreters/php/5.4.nix
deleted file mode 100644
index 7133b1e0824..00000000000
--- a/pkgs/development/interpreters/php/5.4.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{ callPackage, apacheHttpd }:
-callPackage ./generic.nix {
-  phpVersion = "5.4.40";
-  sha = "06m5b3hw5kgwvnarhiylymadj504xalpczagr662vjrwmklgz628";
-  apacheHttpd = apacheHttpd;
-}
diff --git a/pkgs/development/interpreters/php/5.5.nix b/pkgs/development/interpreters/php/5.5.nix
deleted file mode 100644
index fdc1ab79c76..00000000000
--- a/pkgs/development/interpreters/php/5.5.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{ callPackage, apacheHttpd  }:
-callPackage ./generic.nix {
-  phpVersion = "5.5.21";
-  sha = "1zl3valcak5hb4fmivpfa66arwpvi19js1d5cxq5vjn4fncl5sb2";
-  apacheHttpd = apacheHttpd;
-}
diff --git a/pkgs/development/interpreters/php/5.6.nix b/pkgs/development/interpreters/php/5.6.nix
deleted file mode 100644
index 5f69e46189f..00000000000
--- a/pkgs/development/interpreters/php/5.6.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{ callPackage, apacheHttpd  }:
-callPackage ./generic.nix {
-  phpVersion = "5.6.6";
-  sha = "0k5vml94p5809bk2d5a8lhzf3h7f1xgs75b9qy6ikj70cndmqqh9";
-  apacheHttpd = apacheHttpd;
-}
diff --git a/pkgs/development/interpreters/php/default.nix b/pkgs/development/interpreters/php/default.nix
new file mode 100644
index 00000000000..7da631a3cbd
--- /dev/null
+++ b/pkgs/development/interpreters/php/default.nix
@@ -0,0 +1,308 @@
+{ lib, stdenv, fetchurl, composableDerivation, autoconf, automake, flex, bison
+, mysql, libxml2, readline, zlib, curl, postgresql, gettext
+, openssl, pkgconfig, sqlite, config, libjpeg, libpng, freetype
+, libxslt, libmcrypt, bzip2, icu, openldap, cyrus_sasl, libmhash, freetds
+, uwimap, pam, gmp, apacheHttpd }:
+
+let
+
+  generic =
+    { version, sha256, url ? "http://www.php.net/distributions/php-${version}.tar.bz2" }:
+
+    let php7 = lib.versionAtLeast version "7.0"; in
+
+    composableDerivation.composableDerivation {} (fixed: {
+
+      inherit version;
+
+      name = "php-${version}";
+
+      enableParallelBuilding = true;
+
+      buildInputs = [ flex bison pkgconfig ];
+
+      flags = {
+
+        # much left to do here...
+
+        # SAPI modules:
+
+        apxs2 = {
+          configureFlags = ["--with-apxs2=${apacheHttpd}/bin/apxs"];
+          buildInputs = [apacheHttpd];
+        };
+
+        # Extensions
+        imap = {
+          configureFlags = [
+            "--with-imap=${uwimap}"
+            "--with-imap-ssl"
+            ];
+          buildInputs = [ uwimap openssl pam ];
+        };
+
+        ldap = {
+          configureFlags = ["--with-ldap=${openldap}"];
+          buildInputs = [openldap cyrus_sasl openssl];
+        };
+
+        mhash = {
+          configureFlags = ["--with-mhash"];
+          buildInputs = [libmhash];
+        };
+
+        curl = {
+          configureFlags = ["--with-curl=${curl}"];
+          buildInputs = [curl openssl];
+        };
+
+        curlWrappers = {
+          configureFlags = ["--with-curlwrappers"];
+        };
+
+        zlib = {
+          configureFlags = ["--with-zlib=${zlib}"];
+          buildInputs = [zlib];
+        };
+
+        libxml2 = {
+          configureFlags = [
+            "--with-libxml-dir=${libxml2}"
+            ];
+          buildInputs = [ libxml2 ];
+        };
+
+        pcntl = {
+          configureFlags = [ "--enable-pcntl" ];
+        };
+
+        readline = {
+          configureFlags = ["--with-readline=${readline}"];
+          buildInputs = [ readline ];
+        };
+
+        sqlite = {
+          configureFlags = ["--with-pdo-sqlite=${sqlite}"];
+          buildInputs = [ sqlite ];
+        };
+
+        postgresql = {
+          configureFlags = ["--with-pgsql=${postgresql}"];
+          buildInputs = [ postgresql ];
+        };
+
+        pdo_pgsql = {
+          configureFlags = ["--with-pdo-pgsql=${postgresql}"];
+          buildInputs = [ postgresql ];
+        };
+
+        mysql = {
+          configureFlags = ["--with-mysql=${mysql.lib}"];
+          buildInputs = [ mysql.lib ];
+        };
+
+        mysqli = {
+          configureFlags = ["--with-mysqli=${mysql.lib}/bin/mysql_config"];
+          buildInputs = [ mysql.lib ];
+        };
+
+        mysqli_embedded = {
+          configureFlags = ["--enable-embedded-mysqli"];
+          depends = "mysqli";
+          assertion = fixed.mysqliSupport;
+        };
+
+        pdo_mysql = {
+          configureFlags = ["--with-pdo-mysql=${mysql.lib}"];
+          buildInputs = [ mysql.lib ];
+        };
+
+        bcmath = {
+          configureFlags = ["--enable-bcmath"];
+        };
+
+        gd = {
+          # FIXME: Our own gd package doesn't work, see https://bugs.php.net/bug.php?id=60108.
+          configureFlags = [
+            "--with-gd"
+            "--with-freetype-dir=${freetype}"
+            "--with-png-dir=${libpng}"
+            "--with-jpeg-dir=${libjpeg}"
+          ];
+          buildInputs = [ libpng libjpeg freetype ];
+        };
+
+        gmp = {
+          configureFlags = ["--with-gmp=${gmp}"];
+          buildInputs = [ gmp ];
+        };
+
+        soap = {
+          configureFlags = ["--enable-soap"];
+        };
+
+        sockets = {
+          configureFlags = ["--enable-sockets"];
+        };
+
+        openssl = {
+          configureFlags = ["--with-openssl=${openssl}"];
+          buildInputs = [openssl];
+        };
+
+        mbstring = {
+          configureFlags = ["--enable-mbstring"];
+        };
+
+        gettext = {
+          configureFlags = ["--with-gettext=${gettext}"];
+          buildInputs = [gettext];
+        };
+
+        intl = {
+          configureFlags = ["--enable-intl"];
+          buildInputs = [icu];
+        };
+
+        exif = {
+          configureFlags = ["--enable-exif"];
+        };
+
+        xsl = {
+          configureFlags = ["--with-xsl=${libxslt}"];
+          buildInputs = [libxslt];
+        };
+
+        mcrypt = let libmcrypt' = libmcrypt.override { disablePosixThreads = true; }; in {
+          configureFlags = ["--with-mcrypt=${libmcrypt'}"];
+          buildInputs = [libmcrypt'];
+        };
+
+        bz2 = {
+          configureFlags = ["--with-bz2=${bzip2}"];
+          buildInputs = [bzip2];
+        };
+
+        zip = {
+          configureFlags = ["--enable-zip"];
+        };
+
+        ftp = {
+          configureFlags = ["--enable-ftp"];
+        };
+
+        fpm = {
+          configureFlags = ["--enable-fpm"];
+        };
+
+        mssql = stdenv.lib.optionalAttrs (!stdenv.isDarwin) {
+          configureFlags = ["--with-mssql=${freetds}"];
+          buildInputs = [freetds];
+        };
+
+        zts = {
+          configureFlags = ["--enable-maintainer-zts"];
+        };
+
+        calendar = {
+          configureFlags = ["--enable-calendar"];
+        };
+      };
+
+      cfg = {
+        imapSupport = config.php.imap or true;
+        ldapSupport = config.php.ldap or true;
+        mhashSupport = config.php.mhash or true;
+        mysqlSupport = (!php7) && (config.php.mysql or true);
+        mysqliSupport = config.php.mysqli or true;
+        pdo_mysqlSupport = config.php.pdo_mysql or true;
+        libxml2Support = config.php.libxml2 or true;
+        apxs2Support = config.php.apxs2 or true;
+        bcmathSupport = config.php.bcmath or true;
+        socketsSupport = config.php.sockets or true;
+        curlSupport = config.php.curl or true;
+        curlWrappersSupport = (!php7) && (config.php.curlWrappers or true);
+        gettextSupport = config.php.gettext or true;
+        pcntlSupport = config.php.pcntl or true;
+        postgresqlSupport = config.php.postgresql or true;
+        pdo_pgsqlSupport = config.php.pdo_pgsql or true;
+        readlineSupport = config.php.readline or true;
+        sqliteSupport = config.php.sqlite or true;
+        soapSupport = config.php.soap or true;
+        zlibSupport = config.php.zlib or true;
+        opensslSupport = config.php.openssl or true;
+        mbstringSupport = config.php.mbstring or true;
+        gdSupport = config.php.gd or true;
+        intlSupport = config.php.intl or true;
+        exifSupport = config.php.exif or true;
+        xslSupport = config.php.xsl or false;
+        mcryptSupport = config.php.mcrypt or true;
+        bz2Support = config.php.bz2 or false;
+        zipSupport = config.php.zip or true;
+        ftpSupport = config.php.ftp or true;
+        fpmSupport = config.php.fpm or true;
+        gmpSupport = config.php.gmp or true;
+        mssqlSupport = (!php7) && (config.php.mssql or (!stdenv.isDarwin));
+        ztsSupport = config.php.zts or false;
+        calendarSupport = config.php.calendar or true;
+      };
+
+      configurePhase = ''
+        # Don't record the configure flags since this causes unnecessary
+        # runtime dependencies.
+        for i in main/build-defs.h.in scripts/php-config.in; do
+          substituteInPlace $i \
+            --replace '@CONFIGURE_COMMAND@' '(omitted)' \
+            --replace '@CONFIGURE_OPTIONS@' "" \
+            --replace '@PHP_LDFLAGS@' ""
+        done
+
+        iniFile=$out/etc/php-recommended.ini
+        [[ -z "$libxml2" ]] || export PATH=$PATH:$libxml2/bin
+        ./configure --with-config-file-scan-dir=/etc --with-config-file-path=$out/etc --prefix=$out $configureFlags
+      '';
+
+      installPhase = ''
+        unset installPhase; installPhase;
+        cp php.ini-production $iniFile
+      '';
+
+      src = fetchurl {
+        inherit url sha256;
+      };
+
+      meta = with stdenv.lib; {
+        description = "An HTML-embedded scripting language";
+        homepage = http://www.php.net/;
+        license = stdenv.lib.licenses.php301;
+        maintainers = with maintainers; [ globin ];
+      };
+
+      patches = if !php7 then [ ./fix-paths.patch ] else [ ./fix-paths-php7.patch ];
+
+    });
+
+in {
+
+  php54 = generic {
+    version = "5.4.45";
+    sha256 = "10k59j7zjx2mrldmgfvjrrcg2cslr2m68azslspcz5acanqjh3af";
+  };
+
+  php55 = generic {
+    version = "5.5.29";
+    sha256 = "0imr8c48ffjhc2zm96ndq92z3736xrm12hd5c1lssz67xiwybkpv";
+  };
+
+  php56 = generic {
+    version = "5.6.13";
+    sha256 = "14zq40j229salk0wp7inl4jvj3xff03bz7g5xn8ipd5skiy86n33";
+  };
+
+  php70 = lib.lowPrio (generic {
+    version = "7.0.0beta1";
+    url = "https://downloads.php.net/~ab/php-7.0.0beta1.tar.bz2";
+    sha256 = "1pj3ysfhswg2r370ivp33fv9zbcl3yvhmxgnc731k08hv6hmd984";
+  });
+
+}
diff --git a/pkgs/development/interpreters/php/fix-paths-php7.patch b/pkgs/development/interpreters/php/fix-paths-php7.patch
new file mode 100644
index 00000000000..2b9e4ad0ebb
--- /dev/null
+++ b/pkgs/development/interpreters/php/fix-paths-php7.patch
@@ -0,0 +1,23 @@
+--- php-7.0.0beta1/configure	    2015-07-10 12:11:41.810045613 +0000
++++ php-7.0.0beta1-new/configure	2015-07-17 16:10:21.775528267 +0000
+@@ -6172,7 +6172,7 @@
+     as_fn_error $? "Please note that Apache version >= 2.0.44 is required" "$LINENO" 5
+   fi
+ 
+-  APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
++  APXS_LIBEXECDIR="$prefix/modules"
+   if test -z `$APXS -q SYSCONFDIR`; then
+     INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
+                  $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
+@@ -37303,9 +37303,7 @@
+ 
+ 
+ if test "$PHP_GETTEXT" != "no"; then
+-  for i in $PHP_GETTEXT /usr/local /usr; do
+-    test -r $i/include/libintl.h && GETTEXT_DIR=$i && break
+-  done
++  GETTEXT_DIR=$PHP_GETTEXT
+ 
+   if test -z "$GETTEXT_DIR"; then
+     as_fn_error $? "Cannot locate header file libintl.h" "$LINENO" 5
+
diff --git a/pkgs/development/interpreters/php/generic.nix b/pkgs/development/interpreters/php/generic.nix
deleted file mode 100644
index 33b5b0f9024..00000000000
--- a/pkgs/development/interpreters/php/generic.nix
+++ /dev/null
@@ -1,283 +0,0 @@
-{ stdenv, fetchurl, composableDerivation, autoconf, automake, flex, bison
-, mysql, libxml2, readline, zlib, curl, postgresql, gettext
-, openssl, pkgconfig, sqlite, config, libjpeg, libpng, freetype
-, libxslt, libmcrypt, bzip2, icu, openldap, cyrus_sasl, libmhash, freetds
-, uwimap, pam, gmp
-
-, phpVersion, apacheHttpd, sha }:
-
-let
-  libmcryptOverride = libmcrypt.override { disablePosixThreads = true; };
-in
-
-composableDerivation.composableDerivation {} ( fixed : let inherit (fixed.fixed) version; in {
-
-  version = "${phpVersion}";
-
-  name = "php-${version}";
-
-  enableParallelBuilding = true;
-
-  buildInputs = ["flex" "bison" "pkgconfig"];
-
-  flags = {
-
-    # much left to do here...
-
-    # SAPI modules:
-
-    apxs2 = {
-      configureFlags = ["--with-apxs2=${apacheHttpd}/bin/apxs"];
-      buildInputs = [apacheHttpd];
-    };
-
-    # Extensions
-    imap = {
-      configureFlags = [
-        "--with-imap=${uwimap}"
-        "--with-imap-ssl"
-        ];
-      buildInputs = [ uwimap openssl pam ];
-    };
-
-    ldap = {
-      configureFlags = ["--with-ldap=${openldap}"];
-      buildInputs = [openldap cyrus_sasl openssl];
-    };
-
-    mhash = {
-      configureFlags = ["--with-mhash"];
-      buildInputs = [libmhash];
-    };
-
-    curl = {
-      configureFlags = ["--with-curl=${curl}"];
-      buildInputs = [curl openssl];
-    };
-
-    curlWrappers = {
-      configureFlags = ["--with-curlwrappers"];
-    };
-
-    zlib = {
-      configureFlags = ["--with-zlib=${zlib}"];
-      buildInputs = [zlib];
-    };
-
-    libxml2 = {
-      configureFlags = [
-        "--with-libxml-dir=${libxml2}"
-        ];
-      buildInputs = [ libxml2 ];
-    };
-
-    pcntl = {
-      configureFlags = [ "--enable-pcntl" ];
-    };
-
-    readline = {
-      configureFlags = ["--with-readline=${readline}"];
-      buildInputs = [ readline ];
-    };
-
-    sqlite = {
-      configureFlags = ["--with-pdo-sqlite=${sqlite}"];
-      buildInputs = [ sqlite ];
-    };
-
-    postgresql = {
-      configureFlags = ["--with-pgsql=${postgresql}"];
-      buildInputs = [ postgresql ];
-    };
-
-    pdo_pgsql = {
-      configureFlags = ["--with-pdo-pgsql=${postgresql}"];
-      buildInputs = [ postgresql ];
-    };
-
-    mysql = {
-      configureFlags = ["--with-mysql=${mysql.lib}"];
-      buildInputs = [ mysql.lib ];
-    };
-
-    mysqli = {
-      configureFlags = ["--with-mysqli=${mysql.lib}/bin/mysql_config"];
-      buildInputs = [ mysql.lib ];
-    };
-
-    mysqli_embedded = {
-      configureFlags = ["--enable-embedded-mysqli"];
-      depends = "mysqli";
-      assertion = fixed.mysqliSupport;
-    };
-
-    pdo_mysql = {
-      configureFlags = ["--with-pdo-mysql=${mysql.lib}"];
-      buildInputs = [ mysql.lib ];
-    };
-
-    bcmath = {
-      configureFlags = ["--enable-bcmath"];
-    };
-
-    gd = {
-      # FIXME: Our own gd package doesn't work, see https://bugs.php.net/bug.php?id=60108.
-      configureFlags = [
-        "--with-gd"
-        "--with-freetype-dir=${freetype}"
-        "--with-png-dir=${libpng}"
-        "--with-jpeg-dir=${libjpeg}"
-      ];
-      buildInputs = [ libpng libjpeg freetype ];
-    };
-
-    gmp = {
-      configureFlags = ["--with-gmp=${gmp}"];
-      buildInputs = [ gmp ];
-    };
-
-    soap = {
-      configureFlags = ["--enable-soap"];
-    };
-
-    sockets = {
-      configureFlags = ["--enable-sockets"];
-    };
-
-    openssl = {
-      configureFlags = ["--with-openssl=${openssl}"];
-      buildInputs = ["openssl"];
-    };
-
-    mbstring = {
-      configureFlags = ["--enable-mbstring"];
-    };
-
-    gettext = {
-      configureFlags = ["--with-gettext=${gettext}"];
-      buildInputs = [gettext];
-    };
-
-    intl = {
-      configureFlags = ["--enable-intl"];
-      buildInputs = [icu];
-    };
-
-    exif = {
-      configureFlags = ["--enable-exif"];
-    };
-
-    xsl = {
-      configureFlags = ["--with-xsl=${libxslt}"];
-      buildInputs = [libxslt];
-    };
-
-    mcrypt = {
-      configureFlags = ["--with-mcrypt=${libmcryptOverride}"];
-      buildInputs = [libmcryptOverride];
-    };
-
-    bz2 = {
-      configureFlags = ["--with-bz2=${bzip2}"];
-      buildInputs = [bzip2];
-    };
-
-    zip = {
-      configureFlags = ["--enable-zip"];
-    };
-
-    ftp = {
-      configureFlags = ["--enable-ftp"];
-    };
-
-    fpm = {
-      configureFlags = ["--enable-fpm"];
-    };
-
-    mssql = stdenv.lib.optionalAttrs (!stdenv.isDarwin) {
-      configureFlags = ["--with-mssql=${freetds}"];
-      buildInputs = [freetds];
-    };
-
-    zts = {
-      configureFlags = ["--enable-maintainer-zts"];
-    };
-
-    calendar = {
-      configureFlags = ["--enable-calendar"];
-    };
-  };
-
-  cfg = {
-    imapSupport = config.php.imap or true;
-    ldapSupport = config.php.ldap or true;
-    mhashSupport = config.php.mhash or true;
-    mysqlSupport = config.php.mysql or true;
-    mysqliSupport = config.php.mysqli or true;
-    pdo_mysqlSupport = config.php.pdo_mysql or true;
-    libxml2Support = config.php.libxml2 or true;
-    apxs2Support = config.php.apxs2 or true;
-    bcmathSupport = config.php.bcmath or true;
-    socketsSupport = config.php.sockets or true;
-    curlSupport = config.php.curl or true;
-    curlWrappersSupport = config.php.curlWrappers or true;
-    gettextSupport = config.php.gettext or true;
-    pcntlSupport = config.php.pcntl or true;
-    postgresqlSupport = config.php.postgresql or true;
-    pdo_pgsqlSupport = config.php.pdo_pgsql or true;
-    readlineSupport = config.php.readline or true;
-    sqliteSupport = config.php.sqlite or true;
-    soapSupport = config.php.soap or true;
-    zlibSupport = config.php.zlib or true;
-    opensslSupport = config.php.openssl or true;
-    mbstringSupport = config.php.mbstring or true;
-    gdSupport = config.php.gd or true;
-    intlSupport = config.php.intl or true;
-    exifSupport = config.php.exif or true;
-    xslSupport = config.php.xsl or false;
-    mcryptSupport = config.php.mcrypt or true;
-    bz2Support = config.php.bz2 or false;
-    zipSupport = config.php.zip or true;
-    ftpSupport = config.php.ftp or true;
-    fpmSupport = config.php.fpm or true;
-    gmpSupport = config.php.gmp or true;
-    mssqlSupport = config.php.mssql or (!stdenv.isDarwin);
-    ztsSupport = config.php.zts or false;
-    calendarSupport = config.php.calendar or true;
-  };
-
-  configurePhase = ''
-    # Don't record the configure flags since this causes unnecessary
-    # runtime dependencies.
-    for i in main/build-defs.h.in scripts/php-config.in; do
-      substituteInPlace $i \
-        --replace '@CONFIGURE_COMMAND@' '(omitted)' \
-        --replace '@CONFIGURE_OPTIONS@' "" \
-        --replace '@PHP_LDFLAGS@' ""
-    done
-
-    iniFile=$out/etc/php-recommended.ini
-    [[ -z "$libxml2" ]] || export PATH=$PATH:$libxml2/bin
-    ./configure --with-config-file-scan-dir=/etc --with-config-file-path=$out/etc --prefix=$out $configureFlags
-  '';
-
-  installPhase = ''
-    unset installPhase; installPhase;
-    cp php.ini-production $iniFile
-  '';
-
-  src = fetchurl {
-    url = "http://www.php.net/distributions/php-${version}.tar.bz2";
-    sha256 = sha;
-  };
-
-  meta = with stdenv.lib; {
-    description = "An HTML-embedded scripting language";
-    homepage = http://www.php.net/;
-    license = stdenv.lib.licenses.php301;
-    maintainers = with maintainers; [ globin ];
-  };
-
-  patches = [ ./fix-paths.patch ];
-
-})
diff --git a/pkgs/development/interpreters/picoc/default.nix b/pkgs/development/interpreters/picoc/default.nix
new file mode 100644
index 00000000000..e9893dfd1c7
--- /dev/null
+++ b/pkgs/development/interpreters/picoc/default.nix
@@ -0,0 +1,53 @@
+{ stdenv, fetchFromGitHub, readline }:
+
+let version = "2015-05-04"; in
+stdenv.mkDerivation {
+  name = "picoc-${version}";
+
+  src = fetchFromGitHub {
+    sha256 = "01w3jwl0vn9fsmh7p20ad4nl9ljzgfn576yvncd9pk9frx3pd8y4";
+    rev = "4555e8456f020554bcac50751fbb9b36c7d8c13b";
+    repo = "picoc";
+    owner = "zsaleeba";
+  };
+
+  meta = with stdenv.lib; {
+    inherit version;
+    description = "Very small C interpreter for scripting";
+    longDescription = ''
+      PicoC is a very small C interpreter for scripting. It was originally
+      written as a script language for a UAV's on-board flight system. It's
+      also very suitable for other robotic, embedded and non-embedded
+      applications. The core C source code is around 3500 lines of code. It's
+      not intended to be a complete implementation of ISO C but it has all the
+      essentials. When compiled it only takes a few k of code space and is also
+      very sparing of data space. This means it can work well in small embedded
+      devices.
+    '';
+    homepage = https://github.com/zsaleeba/picoc;
+    downloadPage = https://code.google.com/p/picoc/downloads/list;
+    license = licenses.bsd3;
+    platforms = with platforms; linux;
+    maintainers = with maintainers; [ nckx ];
+  };
+
+  buildInputs = [ readline ];
+
+  postPatch = ''
+    substituteInPlace Makefile --replace '`svnversion -n`' "${version}"
+  '';
+
+  enableParallelBuilding = true;
+
+  # Tests are currently broken on i686 see
+  # http://hydra.nixos.org/build/24003763/nixlog/1
+  doCheck = if stdenv.isi686 then false else true;
+  checkTarget = "test";
+
+  installPhase = ''
+    install -Dm755 picoc $out/bin/picoc
+
+    mkdir -p $out/include
+    install -m644 *.h $out/include
+  '';
+}
diff --git a/pkgs/development/interpreters/picolisp/default.nix b/pkgs/development/interpreters/picolisp/default.nix
index ddb2a26bab2..c43a3ce2429 100644
--- a/pkgs/development/interpreters/picolisp/default.nix
+++ b/pkgs/development/interpreters/picolisp/default.nix
@@ -1,66 +1,53 @@
-x@{builderDefsPackage
-  , jdk /* only used in bootstrap */
-  , ...}:
-builderDefsPackage
-(a :  
-let 
-  helperArgNames = ["stdenv" "fetchurl" "builderDefsPackage"] ++ 
-    [];
-
-  buildInputs = map (n: builtins.getAttr n x)
-    (builtins.attrNames (builtins.removeAttrs x helperArgNames));
-  sourceInfo = rec {
-    baseName="picolisp";
-    tarballBaseName="picoLisp";
-    version="3.1.9";
-    name="${baseName}-${version}";
-    tarballName="${tarballBaseName}-${version}";
-    extension="tgz";
-    url="http://www.software-lab.de/${tarballName}.${extension}";
-    sha256="1rhfd743ga9qsgn4h2aw1xcgrc7amsllli2zqg8cgm408vxkr6j1";
-  };
-in
-rec {
-  src = a.fetchurl {
-    url = sourceInfo.url;
-    sha256 = sourceInfo.sha256;
+{ stdenv, fetchurl, jdk }:
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "picoLisp-${version}";
+  version = "3.1.11";
+  src = fetchurl {
+    url = "http://www.software-lab.de/${name}.tgz";
+    sha256 = "01kgyz0lkz36lxvibv07qd06gwdxvvbain9f9cnya7a12kq3009i";
   };
-
-  inherit (sourceInfo) name version;
-  inherit buildInputs;
-
-  /* doConfigure should be removed if not needed */
-  phaseNames = ["doMake" "doDeploy"];
-
-  goSrcDir = if a.stdenv.system == "x86_64-linux" then 
-    "cd src64" else "cd src";
-  makeFlags = [''PREFIX=$out''];
-
-  doDeploy = a.fullDepEntry (''
+  buildInputs = optional stdenv.is64bit jdk;
+  patchPhase = optionalString stdenv.isArm ''
+    sed -i s/-m32//g Makefile
+    cat >>Makefile <<EOF
+    ext.o: ext.c
+    	\$(CC) \$(CFLAGS) -fPIC -D_OS='"\$(OS)"' \$*.c
+    ht.o: ht.c
+    	\$(CC) \$(CFLAGS) -fPIC -D_OS='"\$(OS)"' \$*.c
+    EOF
+  '';
+  sourceRoot = ''picoLisp/src${optionalString stdenv.is64bit "64"}'';
+  installPhase = ''
     cd ..
 
-    sed -e "s@/usr/@$out/@g" -i bin/pil
-
     mkdir -p "$out/share/picolisp" "$out/lib" "$out/bin"
     cp -r . "$out/share/picolisp/build-dir"
     ln -s "$out/share/picolisp/build-dir" "$out/lib/picolisp"
     ln -s "$out/lib/picolisp/bin/picolisp" "$out/bin/picolisp"
-  '') ["minInit" "defEnsureDir" "doMake"];
-      
+
+    cat >"$out/bin/pil" <<EOF
+    #! /bin/sh
+    $out/bin/picolisp $out/lib/picolisp/lib.l @lib/misc.l @lib/btree.l @lib/db.l @lib/pilog.l
+    EOF
+    chmod +x "$out/bin/pil"
+
+    mkdir -p "$out/share/emacs"
+    ln -s "$out/lib/picolisp/lib/el" "$out/share/emacs/site-lisp"
+  '';
+
   meta = {
-    description = "An interpreter for a small Lisp dialect with builtin DB";
-    maintainers = with a.lib.maintainers;
-    [
-      raskin
-    ];
-    platforms = with a.lib.platforms;
-      linux;
-    license = a.lib.licenses.mit;
+    description = "A simple Lisp with an integrated database.";
+    homepage = http://picolisp.com/;
+    license = licenses.mit;
+    platform = platforms.all;
+    maintainers = with maintainers; [ raskin ];
   };
+
   passthru = {
     updateInfo = {
       downloadPage = "http://www.software-lab.de/down.html";
     };
   };
-}) x
-
+}
diff --git a/pkgs/development/interpreters/pure/default.nix b/pkgs/development/interpreters/pure/default.nix
index 2860aceb383..c471a3cdc0f 100644
--- a/pkgs/development/interpreters/pure/default.nix
+++ b/pkgs/development/interpreters/pure/default.nix
@@ -16,6 +16,12 @@ stdenv.mkDerivation rec {
   buildInputs = [ bison flex makeWrapper ];
   propagatedBuildInputs = [ llvm gmp mpfr readline ];
 
+  postPatch = ''
+    for f in expr.cc matcher.cc printer.cc symtable.cc parserdefs.hh; do
+      sed -i '1i\#include <stddef.h>' $f
+    done
+  '';
+
   configureFlags = [ "--enable-release" ];
   doCheck = true;
   checkPhase = ''
diff --git a/pkgs/development/interpreters/pypy/default.nix b/pkgs/development/interpreters/pypy/default.nix
index 10d03103b1b..fe209f6f114 100644
--- a/pkgs/development/interpreters/pypy/default.nix
+++ b/pkgs/development/interpreters/pypy/default.nix
@@ -1,12 +1,12 @@
 { stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2, pkgconfig, libffi
-, sqlite, openssl, ncurses, pythonFull, expat, tcl, tk, x11, libX11
+, sqlite, openssl, ncurses, pythonFull, expat, tcl, tk, xlibsWrapper, libX11
 , makeWrapper, callPackage, self }:
 
 assert zlibSupport -> zlib != null;
 
 let
 
-  majorVersion = "2.5";
+  majorVersion = "2.6";
   version = "${majorVersion}.0";
   libPrefix = "pypy${majorVersion}";
 
@@ -18,10 +18,10 @@ let
 
     src = fetchurl {
       url = "https://bitbucket.org/pypy/pypy/get/release-${version}.tar.bz2";
-      sha256 = "126zrsx6663n9w60018mii1z7cqb87iq9irnhp8z630mldallr4d";
+      sha256 = "0xympj874cnjpxj68xm5gllq2f8bbvz8hr0md8mh1yd6fgzzxibh";
     };
 
-    buildInputs = [ bzip2 openssl pkgconfig pythonFull libffi ncurses expat sqlite tk tcl x11 libX11 makeWrapper ]
+    buildInputs = [ bzip2 openssl pkgconfig pythonFull libffi ncurses expat sqlite tk tcl xlibsWrapper libX11 makeWrapper ]
       ++ stdenv.lib.optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc
       ++ stdenv.lib.optional zlibSupport zlib;
 
@@ -49,16 +49,27 @@ let
         --replace "libraries=['curses']" "libraries=['ncurses']"
 
       # tkinter hints
-      substituteInPlace lib_pypy/_tkinter/tklib.py \
+      substituteInPlace lib_pypy/_tkinter/tklib_build.py \
         --replace "'/usr/include/tcl'" "'${tk}/include', '${tcl}/include'" \
-        --replace "linklibs=['tcl', 'tk']" "linklibs=['${tcl.libPrefix}', '${tk.libPrefix}']" \
+        --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}/include'], library_dirs=['${sqlite}/lib']@" lib_pypy/_sqlite3.py
+      sed -i "s@libraries=\['sqlite3'\]\$@libraries=['sqlite3'], include_dirs=['${sqlite}/include'], library_dirs=['${sqlite}/lib']@" lib_pypy/_sqlite3_build.py
     '';
 
     setupHook = ./setup-hook.sh;
 
+    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}/share/terminfo/";
@@ -89,7 +100,12 @@ let
        ln -s $out/pypy-c/include $out/include/${libPrefix}
        ln -s $out/pypy-c/lib-python/${pythonVersion} $out/lib/${libPrefix}
 
-       wrapProgram "$out/bin/pypy" \
+       # 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"
 
@@ -103,6 +119,7 @@ let
       isPypy = true;
       buildEnv = callPackage ../python/wrapper.nix { python = self; };
       interpreter = "${self}/bin/${executable}";
+      sitePackages = "lib/${libPrefix}/site-packages";
     };
 
     enableParallelBuilding = true;  # almost no parallelization without STM
diff --git a/pkgs/development/interpreters/pypy/setup-hook.sh b/pkgs/development/interpreters/pypy/setup-hook.sh
index 057e619ebc8..c82179d9e87 100644
--- a/pkgs/development/interpreters/pypy/setup-hook.sh
+++ b/pkgs/development/interpreters/pypy/setup-hook.sh
@@ -1,12 +1,12 @@
 addPythonPath() {
-    addToSearchPathWithCustomDelimiter : PYTHONPATH $1/lib/pypy2.5/site-packages
+    addToSearchPathWithCustomDelimiter : PYTHONPATH $1/lib/pypy2.6/site-packages
 }
 
 toPythonPath() {
     local paths="$1"
     local result=
     for i in $paths; do
-        p="$i/lib/pypy2.5/site-packages"
+        p="$i/lib/pypy2.6/site-packages"
         result="${result}${result:+:}$p"
     done
     echo $result
diff --git a/pkgs/development/interpreters/python/2.6/default.nix b/pkgs/development/interpreters/python/2.6/default.nix
index 83787fdb1e2..96b44ddc17f 100644
--- a/pkgs/development/interpreters/python/2.6/default.nix
+++ b/pkgs/development/interpreters/python/2.6/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, zlib ? null, zlibSupport ? true, bzip2, includeModules ? false
-, sqlite, tcl, tk, x11, openssl, readline, db, ncurses, gdbm, self, callPackage }:
+, sqlite, tcl, tk, xlibsWrapper, openssl, readline, db, ncurses, gdbm, self, callPackage }:
 
 assert zlibSupport -> zlib != null;
 
@@ -9,7 +9,6 @@ let
   majorVersion = "2.6";
   version = "${majorVersion}.9";
 
-  # python 2.6 will receive security fixes until Oct 2013
   src = fetchurl {
     url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.xz";
     sha256 = "0hbfs2691b60c7arbysbzr0w9528d5pl8a4x7mq5psh6a2cvprya";
@@ -46,9 +45,11 @@ let
       touch $out/include/python${majorVersion}/pyconfig.h
     '';
 
+  configureFlags = "--enable-shared --with-threads --enable-unicode=ucs4";
+
   buildInputs =
     optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc ++
-    [ bzip2 openssl ]++ optionals includeModules [ db openssl ncurses gdbm readline x11 tcl tk sqlite ]
+    [ bzip2 openssl ]++ optionals includeModules [ db openssl ncurses gdbm readline xlibsWrapper tcl tk sqlite ]
     ++ optional zlibSupport zlib;
 
   mkPaths = paths: {
@@ -62,12 +63,11 @@ let
     name = "python${if includeModules then "" else "-minimal"}-${version}";
     pythonVersion = majorVersion;
 
-    inherit majorVersion version src patches buildInputs preConfigure;
+    inherit majorVersion version src patches buildInputs preConfigure
+            configureFlags;
 
     inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH;
 
-    configureFlags = "--enable-shared --with-threads --enable-unicode";
-
     NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2";
 
     setupHook = ./setup-hook.sh;
@@ -120,6 +120,10 @@ let
       license = stdenv.lib.licenses.psfl;
       platforms = stdenv.lib.platforms.all;
       maintainers = with stdenv.lib.maintainers; [ simons chaoflow iElectric ];
+      # If you want to use Python 2.6, remove "broken = true;" at your own
+      # risk.  Python 2.6 has known security vulnerabilities is not receiving
+      # security updates as of October 2013.
+      broken = true;
     };
   };
 
@@ -134,7 +138,7 @@ let
     if includeModules then null else stdenv.mkDerivation rec {
       name = "python-${moduleName}-${python.version}";
 
-      inherit src patches preConfigure;
+      inherit src patches preConfigure configureFlags;
 
       buildInputs = [ python ] ++ deps;
 
@@ -146,6 +150,7 @@ let
             'self.extensions = [ext for ext in self.extensions if ext.name in ["${internalName}"]]'
 
           python ./setup.py build_ext
+          [ -z "$(find build -name '*_failed.so' -print)" ]
         '';
 
       installPhase =
@@ -169,7 +174,7 @@ let
     crypt = buildInternalPythonModule {
       moduleName = "crypt";
       internalName = "crypt";
-      deps = [ ];
+      deps = optional (stdenv ? glibc) stdenv.glibc;
     };
 
     curses = buildInternalPythonModule {
@@ -195,7 +200,7 @@ let
 
     tkinter = buildInternalPythonModule {
       moduleName = "tkinter";
-      deps = [ tcl tk x11 ];
+      deps = [ tcl tk xlibsWrapper ];
     };
 
     readline = buildInternalPythonModule {
diff --git a/pkgs/development/interpreters/python/2.7/2.5.2-ctypes-util-find_library.patch b/pkgs/development/interpreters/python/2.7/2.5.2-ctypes-util-find_library.patch
new file mode 100644
index 00000000000..22bc0f7ced0
--- /dev/null
+++ b/pkgs/development/interpreters/python/2.7/2.5.2-ctypes-util-find_library.patch
@@ -0,0 +1,34 @@
+--- origsrc/Lib/ctypes/util.py	2007-09-14 15:05:26.000000000 -0500
++++ src/Lib/ctypes/util.py	2008-11-25 17:54:47.319296200 -0600
+@@ -41,6 +41,20 @@
+                 continue
+         return None
+ 
++elif sys.platform == "cygwin":
++    def find_library(name):
++        for libdir in ['/usr/lib', '/usr/local/lib']:
++            for libext in ['lib%s.dll.a' % name, 'lib%s.a' % name]:
++                implib = os.path.join(libdir, libext)
++                if not os.path.exists(implib):
++                    continue
++                cmd = "dlltool -I " + implib + " 2>/dev/null"
++                res = os.popen(cmd).read().replace("\n","")
++                if not res:
++                    continue
++                return res
++        return None
++
+ elif os.name == "posix":
+     # Andreas Degert's find functions, using gcc, /sbin/ldconfig, objdump
+     import re, tempfile, errno
+@@ -157,6 +173,10 @@
+             print cdll.LoadLibrary("libcrypto.dylib")
+             print cdll.LoadLibrary("libSystem.dylib")
+             print cdll.LoadLibrary("System.framework/System")
++        elif sys.platform == "cygwin":
++            print cdll.LoadLibrary("cygbz2-1.dll") 
++            print find_library("crypt")
++            print cdll.LoadLibrary("cygcrypt-0.dll") 
+         else:
+             print cdll.LoadLibrary("libm.so")
+             print cdll.LoadLibrary("libcrypt.so")
diff --git a/pkgs/development/interpreters/python/2.7/2.5.2-tkinter-x11.patch b/pkgs/development/interpreters/python/2.7/2.5.2-tkinter-x11.patch
new file mode 100644
index 00000000000..28b6dafc3f1
--- /dev/null
+++ b/pkgs/development/interpreters/python/2.7/2.5.2-tkinter-x11.patch
@@ -0,0 +1,27 @@
+--- origsrc/setup.py	2008-02-04 17:41:02.000000000 -0600
++++ src/setup.py	2008-07-02 02:11:28.671875000 -0500
+@@ -1277,12 +1279,6 @@
+             include_dirs.append('/usr/X11/include')
+             added_lib_dirs.append('/usr/X11/lib')
+ 
+-        # If Cygwin, then verify that X is installed before proceeding
+-        if host_platform == 'cygwin':
+-            x11_inc = find_file('X11/Xlib.h', [], include_dirs)
+-            if x11_inc is None:
+-                return
+-
+         # Check for BLT extension
+         if self.compiler.find_library_file(lib_dirs + added_lib_dirs,
+                                            'BLT8.0'):
+@@ -1300,9 +1296,8 @@
+         if host_platform in ['aix3', 'aix4']:
+             libs.append('ld')
+ 
+-        # Finally, link with the X11 libraries (not appropriate on cygwin)
+-        if host_platform != "cygwin":
+-            libs.append('X11')
++        # Finally, link with the X11 libraries
++        libs.append('X11')
+ 
+         ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
+                         define_macros=[('WITH_APPINIT', 1)] + defs,
diff --git a/pkgs/development/interpreters/python/2.7/2.6.2-ssl-threads.patch b/pkgs/development/interpreters/python/2.7/2.6.2-ssl-threads.patch
new file mode 100644
index 00000000000..bef137efda7
--- /dev/null
+++ b/pkgs/development/interpreters/python/2.7/2.6.2-ssl-threads.patch
@@ -0,0 +1,13 @@
+--- origsrc/Modules/_ssl.c	2009-01-26 10:55:41.000000000 -0600
++++ src/Modules/_ssl.c	2009-08-20 00:04:59.346816700 -0500
+@@ -15,6 +15,10 @@
+ 
+ #include "Python.h"
+ 
++#ifdef __CYGWIN__
++#undef WITH_THREAD
++#endif
++
+ #ifdef WITH_THREAD
+ #include "pythread.h"
+ #define PySSL_BEGIN_ALLOW_THREADS { \
diff --git a/pkgs/development/interpreters/python/2.7/2.6.5-FD_SETSIZE.patch b/pkgs/development/interpreters/python/2.7/2.6.5-FD_SETSIZE.patch
new file mode 100644
index 00000000000..d1dae8c47dc
--- /dev/null
+++ b/pkgs/development/interpreters/python/2.7/2.6.5-FD_SETSIZE.patch
@@ -0,0 +1,41 @@
+--- Python-2.6.5.orig/Modules/selectmodule.c	2012-02-02 22:35:21.835125000 -0500
++++ Python-2.6.5/Modules/selectmodule.c	2012-02-02 22:41:41.210125000 -0500
+@@ -6,6 +6,21 @@
+    >= 0.
+ */
+ 
++/* Windows #defines FD_SETSIZE to 64 if FD_SETSIZE isn't already defined.
++   64 is too small (too many people have bumped into that limit).
++   Here we boost it.
++
++   Cygwin also defines FD_SETSIZE to 64, so also increase the limit on
++   Cygwin.  We must do this before sys/types.h is included, which otherwise
++   sets FD_SETSIZE to the default.
++
++   Users who want even more than the boosted limit should #define
++   FD_SETSIZE higher before this; e.g., via compiler /D switch.
++*/
++#if (defined(MS_WINDOWS) || defined(__CYGWIN__)) && !defined(FD_SETSIZE)
++#define FD_SETSIZE 512
++#endif
++
+ #include "Python.h"
+ #include <structmember.h>
+ 
+@@ -16,16 +31,6 @@
+ #undef HAVE_BROKEN_POLL
+ #endif
+ 
+-/* Windows #defines FD_SETSIZE to 64 if FD_SETSIZE isn't already defined.
+-   64 is too small (too many people have bumped into that limit).
+-   Here we boost it.
+-   Users who want even more than the boosted limit should #define
+-   FD_SETSIZE higher before this; e.g., via compiler /D switch.
+-*/
+-#if defined(MS_WINDOWS) && !defined(FD_SETSIZE)
+-#define FD_SETSIZE 512
+-#endif
+-
+ #if defined(HAVE_POLL_H)
+ #include <poll.h>
+ #elif defined(HAVE_SYS_POLL_H)
diff --git a/pkgs/development/interpreters/python/2.7/2.6.5-export-PySignal_SetWakeupFd.patch b/pkgs/development/interpreters/python/2.7/2.6.5-export-PySignal_SetWakeupFd.patch
new file mode 100644
index 00000000000..ea696978236
--- /dev/null
+++ b/pkgs/development/interpreters/python/2.7/2.6.5-export-PySignal_SetWakeupFd.patch
@@ -0,0 +1,11 @@
+--- origsrc/Include/pyerrors.h	2008-06-08 23:58:54.000000000 -0500
++++ src/Include/pyerrors.h	2010-05-12 04:19:31.535297200 -0500
+@@ -232,7 +232,7 @@ PyAPI_FUNC(int) PyErr_CheckSignals(void)
+ PyAPI_FUNC(void) PyErr_SetInterrupt(void);
+ 
+ /* In signalmodule.c */
+-int PySignal_SetWakeupFd(int fd);
++PyAPI_FUNC(int) PySignal_SetWakeupFd(int fd);
+ 
+ /* Support for adding program text to SyntaxErrors */
+ PyAPI_FUNC(void) PyErr_SyntaxLocation(const char *, int);
diff --git a/pkgs/development/interpreters/python/2.7/2.6.5-ncurses-abi6.patch b/pkgs/development/interpreters/python/2.7/2.6.5-ncurses-abi6.patch
new file mode 100644
index 00000000000..e1cf5ad4bbf
--- /dev/null
+++ b/pkgs/development/interpreters/python/2.7/2.6.5-ncurses-abi6.patch
@@ -0,0 +1,16 @@
+--- origsrc/Include/py_curses.h	2009-09-06 16:23:05.000000000 -0500
++++ src/Include/py_curses.h	2010-04-14 15:21:23.008971400 -0500
+@@ -17,6 +17,13 @@
+ #define NCURSES_OPAQUE 0
+ #endif /* __APPLE__ */
+ 
++#ifdef __CYGWIN__
++/* the following define is necessary for Cygwin; without it, the
++   Cygwin-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python
++   can't get at the WINDOW flags field. */
++#define NCURSES_INTERNALS
++#endif /* __CYGWIN__ */
++
+ #ifdef __FreeBSD__
+ /*
+ ** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards
diff --git a/pkgs/development/interpreters/python/2.7/2.7.3-dbm.patch b/pkgs/development/interpreters/python/2.7/2.7.3-dbm.patch
new file mode 100644
index 00000000000..bfaeb37c287
--- /dev/null
+++ b/pkgs/development/interpreters/python/2.7/2.7.3-dbm.patch
@@ -0,0 +1,27 @@
+--- origsrc/setup.py.orig	2012-11-27 10:20:47.442395900 -0500
++++ src/setup.py	2012-11-27 10:53:15.583020900 -0500
+@@ -1141,7 +1141,7 @@
+ 
+         dbm_order = ['gdbm']
+         # The standard Unix dbm module:
+-        if host_platform not in ['cygwin']:
++        if host_platform not in ['win32']:
+             config_args = [arg.strip("'")
+                            for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
+             dbm_args = [arg for arg in config_args
+@@ -1192,6 +1192,15 @@
+                                     ],
+                                 libraries = gdbm_libs)
+                             break
++                        if find_file("ndbm.h", inc_dirs, []) is not None:
++                            print("building dbm using gdbm")
++                            dbmext = Extension(
++                                'dbm', ['dbmmodule.c'],
++                                define_macros=[
++                                    ('HAVE_NDBM_H', None),
++                                    ],
++                                libraries = gdbm_libs)
++                            break
+                 elif cand == "bdb":
+                     if db_incs is not None:
+                         print "building dbm using bdb"
diff --git a/pkgs/development/interpreters/python/2.7/2.7.3-dylib.patch b/pkgs/development/interpreters/python/2.7/2.7.3-dylib.patch
new file mode 100644
index 00000000000..6e1fc8b53e8
--- /dev/null
+++ b/pkgs/development/interpreters/python/2.7/2.7.3-dylib.patch
@@ -0,0 +1,10 @@
+--- origsrc/Lib/distutils/unixccompiler.py.orig	2012-11-27 07:44:15.409993500 -0500
++++ src/Lib/distutils/unixccompiler.py	2012-11-27 08:09:57.801770900 -0500
+@@ -141,6 +141,7 @@
+     static_lib_format = shared_lib_format = dylib_lib_format = "lib%s%s"
+     if sys.platform == "cygwin":
+         exe_extension = ".exe"
++        dylib_lib_extension = ".dll.a"
+ 
+     def preprocess(self, source,
+                    output_file=None, macros=None, include_dirs=None,
diff --git a/pkgs/development/interpreters/python/2.7/2.7.3-getpath-exe-extension.patch b/pkgs/development/interpreters/python/2.7/2.7.3-getpath-exe-extension.patch
new file mode 100644
index 00000000000..68f6921ba6a
--- /dev/null
+++ b/pkgs/development/interpreters/python/2.7/2.7.3-getpath-exe-extension.patch
@@ -0,0 +1,31 @@
+--- origsrc/Modules/getpath.c.orig	2012-11-27 12:07:56.098645900 -0500
++++ src/Modules/getpath.c	2012-11-27 12:10:11.254895900 -0500
+@@ -436,6 +436,28 @@
+                         if (isxfile(progpath))
+                                 break;
+ 
++#ifdef __CYGWIN__
++                        /*
++                         * Cygwin automatically removes the ".exe" extension from argv[0]
++                         * to make programs feel like they are in a more Unix-like
++                         * environment.  Unfortunately, this can make it problemmatic for
++                         * Cygwin to distinguish between a directory and an executable with
++                         * the same name excluding the ".exe" extension.  For example, the
++                         * Cygwin Python build directory has a "Python" directory and a
++                         * "python.exe" executable.  This causes isxfile() to erroneously
++                         * return false.  If isdir() returns true and there is enough space
++                         * to append the ".exe" extension, then we try again with the
++                         * extension appended.
++                         */
++#define EXE ".exe"
++                        if (isdir(progpath) && strlen(progpath) + strlen(EXE) <= MAXPATHLEN)
++                        {
++                            strcat(progpath, EXE);
++                            if (isxfile(progpath))
++                                break;
++                        }
++#endif /* __CYGWIN__ */
++
+                         if (!delim) {
+                                 progpath[0] = '\0';
+                                 break;
diff --git a/pkgs/development/interpreters/python/2.7/2.7.3-no-libm.patch b/pkgs/development/interpreters/python/2.7/2.7.3-no-libm.patch
new file mode 100644
index 00000000000..55281db6768
--- /dev/null
+++ b/pkgs/development/interpreters/python/2.7/2.7.3-no-libm.patch
@@ -0,0 +1,11 @@
+--- origsrc/setup.py.orig	2012-11-27 09:28:34.051770900 -0500
++++ src/setup.py	2012-11-27 09:28:47.239270900 -0500
+@@ -470,7 +470,7 @@
+ 
+         # Check for MacOS X, which doesn't need libm.a at all
+         math_libs = ['m']
+-        if host_platform in ['darwin', 'beos']:
++        if host_platform in ['darwin', 'beos', 'cygwin']:
+             math_libs = []
+ 
+         # XXX Omitted modules: gl, pure, dl, SGI-specific modules
diff --git a/pkgs/development/interpreters/python/2.7/default.nix b/pkgs/development/interpreters/python/2.7/default.nix
index 1c2f2f592ce..a756bfde373 100644
--- a/pkgs/development/interpreters/python/2.7/default.nix
+++ b/pkgs/development/interpreters/python/2.7/default.nix
@@ -1,29 +1,32 @@
 { stdenv, fetchurl, self, callPackage
-, bzip2, openssl
+, bzip2, openssl, gettext
 
 , includeModules ? false
 
 , db, gdbm, ncurses, sqlite, readline
 
-, tcl ? null, tk ? null, x11 ? null, libX11 ? null, x11Support ? true
+, tcl ? null, tk ? null, xlibsWrapper ? null, libX11 ? null, x11Support ? !stdenv.isCygwin
 , zlib ? null, zlibSupport ? true
+, expat, libffi
+
+, CF, configd
 }:
 
 assert zlibSupport -> zlib != null;
 assert x11Support -> tcl != null
                   && tk != null
-                  && x11 != null
+                  && xlibsWrapper != null
                   && libX11 != null;
 
 with stdenv.lib;
 
 let
   majorVersion = "2.7";
-  version = "${majorVersion}.9";
+  version = "${majorVersion}.10";
 
   src = fetchurl {
     url = "http://www.python.org/ftp/python/${version}/Python-${version}.tar.xz";
-    sha256 = "05j9in7yygfgl6nml0rixfvj1bbip982w3l54q05f0vyx8a7xllh";
+    sha256 = "1h7zbrf9pkj29hlm18b10548ch9757f75m64l47sy75rh43p7lqw";
   };
 
   patches =
@@ -39,6 +42,19 @@ let
       # patch python to put zero timestamp into pyc
       # if DETERMINISTIC_BUILD env var is set
       ./deterministic-build.patch
+
+      ./properly-detect-curses.patch
+    ] ++ optionals stdenv.isCygwin [
+      ./2.5.2-ctypes-util-find_library.patch
+      ./2.5.2-tkinter-x11.patch
+      ./2.6.2-ssl-threads.patch
+      ./2.6.5-export-PySignal_SetWakeupFd.patch
+      ./2.6.5-FD_SETSIZE.patch
+      ./2.6.5-ncurses-abi6.patch
+      ./2.7.3-dbm.patch
+      ./2.7.3-dylib.patch
+      ./2.7.3-getpath-exe-extension.patch
+      ./2.7.3-no-libm.patch
     ];
 
   preConfigure = ''
@@ -50,22 +66,40 @@ let
       for i in Lib/plat-*/regen; do
         substituteInPlace $i --replace /usr/include/ ${stdenv.cc.libc}/include/
       done
-    '' + optionalString stdenv.isCygwin ''
-      # On Cygwin, `make install' tries to read this Makefile.
-      mkdir -p $out/lib/python${majorVersion}/config
-      touch $out/lib/python${majorVersion}/config/Makefile
-      mkdir -p $out/include/python${majorVersion}
-      touch $out/include/python${majorVersion}/pyconfig.h
+    '' + optionalString stdenv.isDarwin ''
+      substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"'
     '';
 
+  configureFlags = [
+    "--enable-shared"
+    "--with-threads"
+    "--enable-unicode=ucs4"
+  ] ++ optionals stdenv.isCygwin [
+    "--with-system-ffi"
+    "--with-system-expat"
+    "ac_cv_func_bind_textdomain_codeset=yes"
+  ] ++ optionals stdenv.isDarwin [
+    "--disable-toolbox-glue"
+  ];
+
+  postConfigure = if stdenv.isCygwin then ''
+    sed -i Makefile -e 's,PYTHONPATH="$(srcdir),PYTHONPATH="$(abs_srcdir),'
+  '' else null;
+
   buildInputs =
     optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc ++
     [ bzip2 openssl ]
+    ++ optionals stdenv.isCygwin [ expat libffi ]
     ++ optionals includeModules (
         [ db gdbm ncurses sqlite readline
-        ] ++ optionals x11Support [ tcl tk x11 libX11 ]
+        ] ++ optionals x11Support [ tcl tk xlibsWrapper libX11 ]
     )
-    ++ optional zlibSupport zlib;
+    ++ optional zlibSupport zlib
+
+    # depend on CF and configd only if purity is an issue
+    # the impure bootstrap compiler can't build CoreFoundation currently. it requires
+    # <mach-o/dyld.h> which is in our pure bootstrapTools, but not in the system headers.
+    ++ optionals (stdenv.isDarwin && !stdenv.cc.nativeLibc) [ CF configd ];
 
   mkPaths = paths: {
     C_INCLUDE_PATH = concatStringsSep ":" (map (p: "${p.dev or p}/include") paths);
@@ -78,13 +112,12 @@ let
     name = "python-${version}";
     pythonVersion = majorVersion;
 
-    inherit majorVersion version src patches buildInputs preConfigure;
+    inherit majorVersion version src patches buildInputs preConfigure
+            configureFlags;
 
     LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s";
     inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH;
 
-    configureFlags = "--enable-shared --with-threads --enable-unicode";
-
     NIX_CFLAGS_COMPILE = optionalString stdenv.isDarwin "-msse2";
     DETERMINISTIC_BUILD = 1;
 
@@ -155,17 +188,21 @@ let
     if includeModules then null else stdenv.mkDerivation rec {
       name = "python-${moduleName}-${python.version}";
 
-      inherit src patches preConfigure;
+      inherit src patches preConfigure postConfigure configureFlags;
 
       buildInputs = [ python ] ++ deps;
 
       inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH;
 
-      buildPhase = ''
+      # non-python gdbm has a libintl dependency on i686-cygwin, not on x86_64-cygwin
+      buildPhase = (if (stdenv.system == "i686-cygwin" && moduleName == "gdbm") then ''
+          sed -i setup.py -e "s:libraries = \['gdbm'\]:libraries = ['gdbm', 'intl']:"
+      '' else '''') + ''
           substituteInPlace setup.py --replace 'self.extensions = extensions' \
             'self.extensions = [ext for ext in self.extensions if ext.name in ["${internalName}"]]'
 
           python ./setup.py build_ext
+          [ -z "$(find build -name '*_failed.so' -print)" ]
         '';
 
       installPhase =
@@ -199,13 +236,13 @@ let
     crypt = buildInternalPythonModule {
       moduleName = "crypt";
       internalName = "crypt";
-      deps = [ ];
+      deps = optional (stdenv ? glibc) stdenv.glibc;
     };
 
     gdbm = buildInternalPythonModule {
       moduleName = "gdbm";
       internalName = "gdbm";
-      deps = [ gdbm ];
+      deps = [ gdbm ] ++ stdenv.lib.optional stdenv.isCygwin gettext;
     };
 
     sqlite3 = buildInternalPythonModule {
@@ -215,10 +252,10 @@ let
 
   } // optionalAttrs x11Support {
 
-    tkinter = buildInternalPythonModule {
+    tkinter = if stdenv.isCygwin then null else (buildInternalPythonModule {
       moduleName = "tkinter";
-      deps = [ tcl tk x11 libX11 ];
-    };
+      deps = [ tcl tk xlibsWrapper libX11 ];
+    });
 
   } // {
 
diff --git a/pkgs/development/interpreters/python/2.7/properly-detect-curses.patch b/pkgs/development/interpreters/python/2.7/properly-detect-curses.patch
new file mode 100644
index 00000000000..e2640bab0e9
--- /dev/null
+++ b/pkgs/development/interpreters/python/2.7/properly-detect-curses.patch
@@ -0,0 +1,116 @@
+From 6dc83db69b5e29d25ba6d73646ea2e9a1097848a Mon Sep 17 00:00:00 2001
+From: Roumen Petrov <local@example.net>
+Date: Sun, 19 Feb 2012 16:13:24 +0200
+Subject: [PATCH] CROSS-properly detect WINDOW _flags for different ncurses versions
+
+---
+ Include/py_curses.h |    5 +++++
+ configure.ac        |   40 ++++++++++++++++++++++++++++++++++++++--
+ pyconfig.h.in       |    6 ++++++
+ 3 files changed, 49 insertions(+), 2 deletions(-)
+
+diff --git a/Include/py_curses.h b/Include/py_curses.h
+index f2c08f6..a9b5260 100644
+--- a/Include/py_curses.h
++++ b/Include/py_curses.h
+@@ -14,7 +14,9 @@
+ /* the following define is necessary for OS X 10.6; without it, the
+    Apple-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python
+    can't get at the WINDOW flags field. */
++/* NOTE configure check if ncurses require such definition
+ #define NCURSES_OPAQUE 0
++*/
+ #endif /* __APPLE__ */
+ 
+ #ifdef __FreeBSD__
+@@ -57,9 +59,12 @@
+ #ifdef HAVE_NCURSES_H
+ /* configure was checking <curses.h>, but we will
+    use <ncurses.h>, which has all these features. */
++/* NOTE configure check for existence of flags
++ * Also flags are visible only if WINDOW structure is not opaque
+ #ifndef WINDOW_HAS_FLAGS
+ #define WINDOW_HAS_FLAGS 1
+ #endif
++*/
+ #ifndef MVWDELCH_IS_EXPRESSION
+ #define MVWDELCH_IS_EXPRESSION 1
+ #endif
+diff --git a/configure.ac b/configure.ac
+index 0a3a186..75f5142 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -4150,15 +4150,51 @@ then
+ fi
+ 
+ AC_MSG_CHECKING(whether WINDOW has _flags)
+-AC_CACHE_VAL(ac_cv_window_has_flags,
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[
+   WINDOW *w;
+   w->_flags = 0;
+ ]])],
+ [ac_cv_window_has_flags=yes],
+-[ac_cv_window_has_flags=no]))
++[ac_cv_window_has_flags=no])
+ AC_MSG_RESULT($ac_cv_window_has_flags)
+ 
++py_curses_window_is_opaque=no
++if test no = $ac_cv_window_has_flags; then
++  AC_MSG_CHECKING([whether WINDOW has _flags in non-opaque structure])
++  AC_COMPILE_IFELSE([
++  AC_LANG_PROGRAM([[
++    #define NCURSES_OPAQUE 0
++    #include <curses.h>
++  ]],[[
++    WINDOW *w;
++    w->_flags = 0;
++  ]])],
++  [py_curses_window_is_opaque=yes])
++  AC_MSG_RESULT([$py_curses_window_is_opaque])
++fi
++if test yes = $py_curses_window_is_opaque; then
++  ac_cv_window_has_flags=yes
++  AC_DEFINE([NCURSES_OPAQUE], [0], [Define to 0 if you have WINDOW _flags in non-opaque structure.])
++fi
++
++py_curses_window_is_internal=no
++if test no = $ac_cv_window_has_flags; then
++  AC_MSG_CHECKING([whether WINDOW has _flags as internal structure])
++  AC_COMPILE_IFELSE([
++  AC_LANG_PROGRAM([[
++    #define NCURSES_INTERNALS 1
++    #include <curses.h>
++  ]],[[
++    WINDOW *w;
++    w->_flags = 0;
++  ]])],
++  [py_curses_window_is_internal=yes])
++  AC_MSG_RESULT([$py_curses_window_is_internal])
++fi
++if test yes = $py_curses_window_is_internal; then
++  ac_cv_window_has_flags=yes
++  AC_DEFINE([NCURSES_INTERNALS], [1], [Define to 1 if you have WINDOW _flags as internal structure.])
++fi
+ 
+ if test "$ac_cv_window_has_flags" = yes
+ then
+diff --git a/pyconfig.h.in b/pyconfig.h.in
+index 3ca3a4f..484c817 100644
+--- a/pyconfig.h.in
++++ b/pyconfig.h.in
+@@ -1130,6 +1130,12 @@
+ /* Define if mvwdelch in curses.h is an expression. */
+ #undef MVWDELCH_IS_EXPRESSION
+ 
++/* Define to 1 if you have WINDOW _flags as internal structure. */
++#undef NCURSES_INTERNALS
++
++/* Define to 0 if you have WINDOW _flags in non-opaque structure. */
++#undef NCURSES_OPAQUE
++
+ /* Define to the address where bug reports for this package should be sent. */
+ #undef PACKAGE_BUGREPORT
+ 
+-- 
+1.6.4
+
diff --git a/pkgs/development/interpreters/python/3.2/default.nix b/pkgs/development/interpreters/python/3.2/default.nix
index 2645b503344..f4103662316 100644
--- a/pkgs/development/interpreters/python/3.2/default.nix
+++ b/pkgs/development/interpreters/python/3.2/default.nix
@@ -43,7 +43,7 @@ stdenv.mkDerivation {
     done
     ${optionalString stdenv.isDarwin ''export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2"''}
 
-    configureFlagsArray=( --enable-shared --with-threads
+    configureFlagsArray=( --enable-shared --with-threads --with-wide-unicode
                           CPPFLAGS="${concatStringsSep " " (map (p: "-I${p}/include") buildInputs)}"
                           LDFLAGS="${concatStringsSep " " (map (p: "-L${p}/lib") buildInputs)}"
                           LIBS="${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}"
diff --git a/pkgs/development/interpreters/python/3.5/default.nix b/pkgs/development/interpreters/python/3.5/default.nix
new file mode 100644
index 00000000000..d689fdeee4c
--- /dev/null
+++ b/pkgs/development/interpreters/python/3.5/default.nix
@@ -0,0 +1,112 @@
+{ stdenv, fetchurl
+, bzip2
+, db
+, gdbm
+, libX11, xproto
+, lzma
+, ncurses
+, openssl
+, readline
+, sqlite
+, tcl, tk
+, zlib
+, callPackage
+, self
+}:
+
+assert readline != null -> ncurses != null;
+
+with stdenv.lib;
+
+let
+  majorVersion = "3.5";
+  pythonVersion = majorVersion;
+  version = "${majorVersion}.0";
+  fullVersion = "${version}";
+
+  buildInputs = filter (p: p != null) [
+    zlib bzip2 lzma gdbm sqlite db readline ncurses openssl tcl tk libX11 xproto
+  ];
+in
+stdenv.mkDerivation {
+  name = "python3-${fullVersion}";
+  pythonVersion = majorVersion;
+  inherit majorVersion version;
+
+  src = fetchurl {
+    url = "http://www.python.org/ftp/python/${version}/Python-${fullVersion}.tar.xz";
+    sha256 = "14dywb94mci0kqbsji9riyyq8kx0h9ljdjjgxnkfrvm56hbammyn";
+  };
+
+  NIX_LDFLAGS = stdenv.lib.optionalString stdenv.isLinux "-lgcc_s";
+
+  preConfigure = ''
+    for i in /usr /sw /opt /pkg; do	# improve purity
+      substituteInPlace ./setup.py --replace $i /no-such-path
+    done
+    ${optionalString stdenv.isDarwin ''
+       export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -msse2"
+       export MACOSX_DEPLOYMENT_TARGET=10.6
+     ''}
+
+    configureFlagsArray=( --enable-shared --with-threads
+                          CPPFLAGS="${concatStringsSep " " (map (p: "-I${p}/include") buildInputs)}"
+                          LDFLAGS="${concatStringsSep " " (map (p: "-L${p}/lib") buildInputs)}"
+                          LIBS="${optionalString (!stdenv.isDarwin) "-lcrypt"} ${optionalString (ncurses != null) "-lncurses"}"
+                        )
+  '';
+
+  setupHook = ./setup-hook.sh;
+
+  postInstall = ''
+    # needed for some packages, especially packages that backport functionality
+    # to 2.x from 3.x
+    for item in $out/lib/python${majorVersion}/test/*; do
+      if [[ "$item" != */test_support.py* ]]; then
+        rm -rf "$item"
+      else
+        echo $item
+      fi
+    done
+    touch $out/lib/python${majorVersion}/test/__init__.py
+
+    ln -s "$out/include/python${majorVersion}m" "$out/include/python${majorVersion}"
+    paxmark E $out/bin/python${majorVersion}
+  '';
+
+  passthru = rec {
+    zlibSupport = zlib != null;
+    sqliteSupport = sqlite != null;
+    dbSupport = db != null;
+    readlineSupport = readline != null;
+    opensslSupport = openssl != null;
+    tkSupport = (tk != null) && (tcl != null) && (libX11 != null) && (xproto != null);
+    libPrefix = "python${majorVersion}";
+    executable = "python${majorVersion}m";
+    buildEnv = callPackage ../wrapper.nix { python = self; };
+    isPy3 = true;
+    isPy35 = true;
+    is_py3k = true;  # deprecated
+    sitePackages = "lib/${libPrefix}/site-packages";
+    interpreter = "${self}/bin/${executable}";
+  };
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = http://python.org;
+    description = "A high-level dynamically-typed programming language";
+    longDescription = ''
+      Python is a remarkably powerful dynamic programming language that
+      is used in a wide variety of application domains. Some of its key
+      distinguishing features include: clear, readable syntax; strong
+      introspection capabilities; intuitive object orientation; natural
+      expression of procedural code; full modularity, supporting
+      hierarchical packages; exception-based error handling; and very
+      high level dynamic data types.
+    '';
+    license = stdenv.lib.licenses.psfl;
+    platforms = with stdenv.lib.platforms; linux ++ darwin;
+    maintainers = with stdenv.lib.maintainers; [ simons chaoflow iElectric cstrahan ];
+  };
+}
diff --git a/pkgs/development/interpreters/python/3.5/setup-hook.sh b/pkgs/development/interpreters/python/3.5/setup-hook.sh
new file mode 100644
index 00000000000..2836ad7e8f5
--- /dev/null
+++ b/pkgs/development/interpreters/python/3.5/setup-hook.sh
@@ -0,0 +1,15 @@
+addPythonPath() {
+    addToSearchPathWithCustomDelimiter : PYTHONPATH $1/lib/python3.5/site-packages
+}
+
+toPythonPath() {
+    local paths="$1"
+    local result=
+    for i in $paths; do
+        p="$i/lib/python3.5/site-packages"
+        result="${result}${result:+:}$p"
+    done
+    echo $result
+}
+
+envHooks+=(addPythonPath)
diff --git a/pkgs/development/interpreters/python/wrapper.nix b/pkgs/development/interpreters/python/wrapper.nix
index 163e8d7194b..f757147b047 100644
--- a/pkgs/development/interpreters/python/wrapper.nix
+++ b/pkgs/development/interpreters/python/wrapper.nix
@@ -6,28 +6,40 @@
 # Create a python executable that knows about additional packages.
 let
   recursivePthLoader = import ../../python-modules/recursive-pth-loader/default.nix { stdenv = stdenv; python = python; };
-in
-(buildEnv {
-  name = "${python.name}-env";
-  paths = stdenv.lib.filter (x : x ? pythonPath) (stdenv.lib.closePropagation extraLibs) ++ [ python recursivePthLoader ];
+  env = (buildEnv {
+    name = "${python.name}-env";
+    paths = stdenv.lib.filter (x : x ? pythonPath) (stdenv.lib.closePropagation extraLibs) ++ [ python recursivePthLoader ];
 
-  inherit ignoreCollisions;
+    inherit ignoreCollisions;
 
-  postBuild = ''
-    . "${makeWrapper}/nix-support/setup-hook"
+    postBuild = ''
+      . "${makeWrapper}/nix-support/setup-hook"
 
-    if [ -L "$out/bin" ]; then
-        unlink "$out/bin"
-    fi
-    mkdir -p "$out/bin"
+      if [ -L "$out/bin" ]; then
+          unlink "$out/bin"
+      fi
+      mkdir -p "$out/bin"
 
-    cd "${python}/bin"
-    for prg in *; do
-      rm -f "$out/bin/$prg"
-      makeWrapper "${python}/bin/$prg" "$out/bin/$prg" --set PYTHONHOME "$out"
-    done
-  '' + postBuild;
-}) // {
-  inherit python;
-  inherit (python) meta;
-}
+      cd "${python}/bin"
+      for prg in *; do
+        rm -f "$out/bin/$prg"
+        makeWrapper "${python}/bin/$prg" "$out/bin/$prg" --set PYTHONHOME "$out"
+      done
+    '' + postBuild;
+
+    passthru.env = stdenv.mkDerivation {
+      name = "interactive-${python.name}-environment";
+      nativeBuildInputs = [ env ];
+
+      buildCommand = ''
+        echo >&2 ""
+        echo >&2 "*** Python 'env' attributes are intended for interactive nix-shell sessions, not for building! ***"
+        echo >&2 ""
+        exit 1
+      '';
+    };
+  }) // {
+    inherit python;
+    inherit (python) meta;
+  };
+in env
diff --git a/pkgs/development/interpreters/racket/default.nix b/pkgs/development/interpreters/racket/default.nix
index e0181c6ed58..8aa75829554 100644
--- a/pkgs/development/interpreters/racket/default.nix
+++ b/pkgs/development/interpreters/racket/default.nix
@@ -31,11 +31,11 @@ in
 
 stdenv.mkDerivation rec {
   name = "racket-${version}";
-  version = "6.1.1";
+  version = "6.2.1";
 
   src = fetchurl {
     url = "http://mirror.racket-lang.org/installers/${version}/${name}-src.tgz";
-    sha256 = "090269522d20e7a5ce85d2251a126745746ebf5e87554c05efe03f3b7173da75";
+    sha256 = "0555j63k7fs10iv0icmivlxpzgp6s7gwcbfddmbwxlf2rk80qhq0";
   };
 
   FONTCONFIG_FILE = fontsConf;
@@ -50,7 +50,7 @@ stdenv.mkDerivation rec {
     cd src/build
   '';
 
-  configureFlags = [ "--enable-shared" "--enable-lt=${libtool}/bin/libtool" ];
+  configureFlags = [ "--enable-shared" "--enable-lt=${libtool}/bin/libtool" "--disable-docs"];
 
   configureScript = "../configure";
 
diff --git a/pkgs/development/interpreters/regina/default.nix b/pkgs/development/interpreters/regina/default.nix
index e6c84edacaf..596b748a4f6 100644
--- a/pkgs/development/interpreters/regina/default.nix
+++ b/pkgs/development/interpreters/regina/default.nix
@@ -12,7 +12,7 @@ let
   sourceInfo = rec {
     baseName="Regina-REXX";
     pname="regina-rexx";
-    version = "3.9.0";
+    version = "3.9.1";
     name="${baseName}-${version}";
     url="mirror://sourceforge/${pname}/${pname}/${version}/${name}.tar.gz";
   };
@@ -20,7 +20,7 @@ in
 rec {
   src = a.fetchurl {
     url = sourceInfo.url;
-    sha256 = "051w6i5xyjq7j9yrhw4r14kw105gpylby6z5x9v31f5g824n4mfr";
+    sha256 = "1vpksnjmg6y5zag9li6sxqxj2xapgalfz8krfxgg49vyk0kdy4sx";
   };
 
   inherit (sourceInfo) name version;
diff --git a/pkgs/development/interpreters/ruby/bundler-env/default-gem-config.nix b/pkgs/development/interpreters/ruby/bundler-env/default-gem-config.nix
index 38b7ce530ae..b4e04f6ec90 100644
--- a/pkgs/development/interpreters/ruby/bundler-env/default-gem-config.nix
+++ b/pkgs/development/interpreters/ruby/bundler-env/default-gem-config.nix
@@ -18,14 +18,13 @@
 # (to make gems behave if necessary).
 
 { lib, fetchurl, writeScript, ruby, libxml2, libxslt, python, stdenv, which
-, libiconv, postgresql, v8, v8_3_16_14, clang, sqlite, zlib, imagemagick
+, libiconv, postgresql, v8_3_16_14, clang, sqlite, zlib, imagemagick
 , pkgconfig , ncurses, xapian, gpgme, utillinux, fetchpatch, tzdata, icu, libffi
 , cmake, libssh2, openssl, mysql
 }:
 
 let
   v8 = v8_3_16_14;
-
 in
 
 {
@@ -46,13 +45,6 @@ in
     buildFlags = [
       "--with-system-v8=true"
     ];
-    patches = [
-      # see: https://github.com/cowboyd/libv8/pull/161
-      (fetchpatch {
-        url = https://github.com/cstrahan/libv8/commit/c79378bf346d4ed2429af36d745d17c478ffbe96.patch;
-        sha256 = "1l6572cmigc22g249jj8h0xlbig88mj43kdqdbimhw2pmpv3q0rs";
-      })
-    ];
   };
 
   mysql2 = attrs: {
diff --git a/pkgs/development/interpreters/ruby/bundler-head.nix b/pkgs/development/interpreters/ruby/bundler-head.nix
index 35b8823d22a..e31f63dccf0 100644
--- a/pkgs/development/interpreters/ruby/bundler-head.nix
+++ b/pkgs/development/interpreters/ruby/bundler-head.nix
@@ -1,16 +1,16 @@
 { buildRubyGem, coreutils, fetchgit }:
 
 buildRubyGem {
-  name = "bundler-HEAD";
+  name = "bundler-2015-01-11";
   src = fetchgit {
     url = "https://github.com/bundler/bundler.git";
     rev = "a2343c9eabf5403d8ffcbca4dea33d18a60fc157";
-    sha256 = "0q7cjmz1fsrw3yfsr3h274qjamwnw01xgaqq3h5cjbqlrni4iq7k";
+    sha256 = "06qsai4ac3i2xlr7nbc4anh4cy6jd9jjf3rpj254g9gwshqv0qgr";
     leaveDotGit = true;
   };
   dontPatchShebangs = true;
   postInstall = ''
-    find $out -type f -perm +0100 | while read f; do
+    find $out -type f -perm -0100 | while read f; do
       substituteInPlace $f \
          --replace "/usr/bin/env" "${coreutils}/bin/env"
     done
diff --git a/pkgs/development/interpreters/ruby/bundler.nix b/pkgs/development/interpreters/ruby/bundler.nix
index 88e0af2a21b..3789170f57f 100644
--- a/pkgs/development/interpreters/ruby/bundler.nix
+++ b/pkgs/development/interpreters/ruby/bundler.nix
@@ -1,13 +1,17 @@
-{ buildRubyGem, coreutils }:
+{ buildRubyGem, makeWrapper, ruby, coreutils }:
 
 buildRubyGem {
-  name = "bundler-1.9.2";
-  sha256 = "0ck9bnqg7miimggj1d6qlabrsa5h9yaw241fqn15cvqh915209zk";
+  name = "bundler-1.10.6";
+  namePrefix = "";
+  sha256 = "1vlzfq0bkkj4jyq6av0y55mh5nj5n0f3mfbmmifwgkh44g8k6agv";
   dontPatchShebangs = true;
   postInstall = ''
-    find $out -type f -perm +0100 | while read f; do
+    find $out -type f -perm -0100 | while read f; do
       substituteInPlace $f \
          --replace "/usr/bin/env" "${coreutils}/bin/env"
     done
+
+    wrapProgram $out/bin/bundler \
+      --prefix PATH ":" ${ruby}/bin
   '';
 }
diff --git a/pkgs/development/interpreters/ruby/config.nix b/pkgs/development/interpreters/ruby/config.nix
index c03c0520d7a..c4f3160d160 100644
--- a/pkgs/development/interpreters/ruby/config.nix
+++ b/pkgs/development/interpreters/ruby/config.nix
@@ -1,6 +1,8 @@
 # Ruby >= 2.1.0 tries to download config.{guess,sub}
-fetchgit: fetchgit {
-  url = "git://git.sv.gnu.org/config.git";
+{ fetchFromSavannah }:
+
+fetchFromSavannah {
+  repo = "config";
   rev = "576c839acca0e082e536fd27568b90a446ce5b96";
   sha256 = "11bjngchjhj0qq0ppp8c37rfw0yhp230nvhs2jvlx15i9qbf56a0";
 }
diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix
new file mode 100644
index 00000000000..89e0016f98d
--- /dev/null
+++ b/pkgs/development/interpreters/ruby/default.nix
@@ -0,0 +1,248 @@
+{ stdenv, lib, fetchurl, fetchFromSavannah, fetchFromGitHub
+, zlib, openssl, gdbm, ncurses, readline, groff, libyaml, libffi, autoreconfHook, bison
+, autoconf, darwin ? null
+} @ args:
+
+let
+  op = stdenv.lib.optional;
+  ops = stdenv.lib.optionals;
+  opString = stdenv.lib.optionalString;
+  patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
+  config = import ./config.nix { inherit fetchFromSavannah; };
+
+  generic = { majorVersion, minorVersion, teenyVersion, patchLevel, sha256 }: let
+    versionNoPatch = "${majorVersion}.${minorVersion}.${teenyVersion}";
+    version = "${versionNoPatch}-p${patchLevel}";
+    fullVersionName = if patchLevel != "0" && stdenv.lib.versionOlder versionNoPatch "2.1"
+      then version
+      else versionNoPatch;
+    tag = "v" + stdenv.lib.replaceChars ["." "p" "-"] ["_" "_" ""] fullVersionName;
+    isRuby21 = majorVersion == "2" && minorVersion == "1";
+    isRuby18 = majorVersion == "1" && minorVersion == "8";
+    baseruby = self.override { useRailsExpress = false; };
+    self = lib.makeOverridable (
+      { stdenv, lib, fetchurl, fetchFromSavannah, fetchFromGitHub
+      , useRailsExpress ? true
+      , zlib, zlibSupport ? true
+      , openssl, opensslSupport ? true
+      , gdbm, gdbmSupport ? true
+      , ncurses, readline, cursesSupport ? true
+      , groff, docSupport ? false
+      , libyaml, yamlSupport ? true
+      , libffi, fiddleSupport ? true
+      , autoreconfHook, bison, autoconf
+      , darwin ? null
+      }:
+      stdenv.mkDerivation rec {
+        inherit version;
+
+        name = "ruby-${version}";
+
+        src = if useRailsExpress then fetchFromGitHub {
+          owner  = "ruby";
+          repo   = "ruby";
+          rev    = tag;
+          sha256 = sha256.git;
+        } else fetchurl {
+          url = "http://cache.ruby-lang.org/pub/ruby/${majorVersion}.${minorVersion}/ruby-${fullVersionName}.tar.gz";
+          sha256 = sha256.src;
+        };
+
+        # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
+        NROFF = "${groff}/bin/nroff";
+
+        buildInputs = ops useRailsExpress [ autoreconfHook bison ]
+          ++ (op fiddleSupport libffi)
+          ++ (ops cursesSupport [ ncurses readline ])
+          ++ (op docSupport groff)
+          ++ (op zlibSupport zlib)
+          ++ (op opensslSupport openssl)
+          ++ (op gdbmSupport gdbm)
+          ++ (op yamlSupport libyaml)
+          # 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)
+          ++ (ops stdenv.isDarwin (with darwin; [ libiconv libobjc libunwind ]))
+          ++ op isRuby18 autoconf;
+
+        enableParallelBuilding = true;
+
+        patches = (import ./patchsets.nix {
+          inherit patchSet useRailsExpress ops patchLevel;
+        })."${versionNoPatch}";
+
+        postUnpack = opString isRuby21 ''
+          rm "$sourceRoot/enc/unicode/name2ctype.h"
+        '';
+
+        postPatch = opString (!isRuby18) (if isRuby21 then ''
+          rm tool/config_files.rb
+          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/
+          cp ${config}/config.sub tool/
+        '');
+
+        configureFlags = ["--enable-shared" "--enable-pthread"]
+          ++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"
+          ++ ops stdenv.isDarwin [
+            # on darwin, we have /usr/include/tk.h -- so the configure script detects
+            # that tk is installed
+            "--with-out-ext=tk"
+            # on yosemite, "generating encdb.h" will hang for a very long time without this flag
+            "--with-setjmp-type=setjmp"
+          ];
+
+        installFlags = stdenv.lib.optionalString docSupport "install-doc";
+        # Bundler tries to create this directory
+        postInstall = ''
+          # Bundler tries to create this directory
+          mkdir -pv $out/${passthru.gemPath}
+          mkdir -p $out/nix-support
+          cat > $out/nix-support/setup-hook <<EOF
+          addGemPath() {
+            addToSearchPath GEM_PATH \$1/${passthru.gemPath}
+          }
+
+          envHooks+=(addGemPath)
+          EOF
+        '' + opString useRailsExpress ''
+          rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
+
+          # Prevent the baseruby from being included in the closure.
+          sed -i '/^  CONFIG\["BASERUBY"\]/d' $rbConfig
+          sed -i "s|'--with-baseruby=${baseruby}/bin/ruby'||" $rbConfig
+        '';
+
+        meta = {
+          license = stdenv.lib.licenses.ruby;
+          homepage = "http://www.ruby-lang.org/en/";
+          description = "The Ruby language";
+          platforms = stdenv.lib.platforms.all;
+        };
+
+        passthru = rec {
+          inherit majorVersion minorVersion teenyVersion patchLevel;
+          rubyEngine = "ruby";
+          baseRuby = baseruby;
+          libPath = "lib/${versionNoPatch}";
+          gemPath = "lib/${rubyEngine}/gems/${versionNoPatch}";
+        };
+      }
+    ) args; in self;
+
+in {
+  ruby_1_8_7 = generic {
+    majorVersion = "1";
+    minorVersion = "8";
+    teenyVersion = "7";
+    patchLevel = "374";
+    sha256 = {
+      src = "0v17cmm95f3xwa4kvza8xwbnfvfqcrym8cvqfvscn45bxsmfwvl7";
+      git = "1xddhxr0j26hpxfixvhqdscwk2ri846w2129fcfwfjzvy19igswx";
+    };
+  };
+
+  ruby_1_9_3 = generic {
+    majorVersion = "1";
+    minorVersion = "9";
+    teenyVersion = "3";
+    patchLevel = "551";
+    sha256 = {
+      src = "1s2ibg3s2iflzdv7rfxi1qqkvdbn2dq8gxdn0nxrb77ls5ffanxv";
+      git = "1r9xzzxmci2ajb34qb4y1w424mz878zdgzxkfp9w60agldxnb36s";
+    };
+  };
+
+  ruby_2_0_0 = generic {
+    majorVersion = "2";
+    minorVersion = "0";
+    teenyVersion = "0";
+    patchLevel = "645";
+    sha256 = {
+      src = "1azl3kbqqw3jvwfcsy6fdb7vmwz5w73fwpq1y1gblz79zzzqx7sy";
+      git = "14bnas1iif2shyaz4ylb0832x96y2mda52x0v0aglkvqmcz1cfxb";
+    };
+  };
+
+  ruby_2_1_0 = generic {
+    majorVersion = "2";
+    minorVersion = "1";
+    teenyVersion = "0";
+    patchLevel = "0";
+    sha256 = {
+      src = "17fhfbw8sr13rxfn58wvrhk2f5i88lkna2afn3gdjvprd8gyqf1m";
+      git = "12sn532yvznqfz85378ys0b9ggmj7w8ddhzc1pnnlx7mbyy7r2hx";
+    };
+  };
+
+  ruby_2_1_1 = generic {
+    majorVersion = "2";
+    minorVersion = "1";
+    teenyVersion = "1";
+    patchLevel = "0";
+    sha256 = {
+      src = "0hc9x3mazyvnk94gs19q8mbnanlzk8mv0hii77slkvc8mqqxyhy8";
+      git = "1v2ffvyd0xx1h1qd70431zczhvsdiyyw5kjxih4rszd5avzh5grl";
+    };
+  };
+
+  ruby_2_1_2 = generic {
+    majorVersion = "2";
+    minorVersion = "1";
+    teenyVersion = "2";
+    patchLevel = "353";
+    sha256 = {
+      src = "0db6krc2bd7yha8p96lcqrahjpsz7g7abhni134g708sh53n8apj";
+      git = "14f8w3zwngnxsgigffh6h9z3ng53xq8mk126xmwrsmz9n3ypm6l0";
+    };
+  };
+
+  ruby_2_1_3 = generic {
+    majorVersion = "2";
+    minorVersion = "1";
+    teenyVersion = "3";
+    patchLevel = "0";
+    sha256 = {
+      src = "00bz6jcbxgnllplk4b9lnyc3w8yd3pz5rn11rmca1s8cn6vvw608";
+      git = "1pnam9jry2l2mbji3gvrbb7jyisxl99xjz6l1qrccwnfinxxbmhv";
+    };
+  };
+
+  ruby_2_1_6 = generic {
+    majorVersion = "2";
+    minorVersion = "1";
+    teenyVersion = "6";
+    patchLevel = "0";
+    sha256 = {
+      src = "1r4bs8lfwsypbcf8j2lpv3by40729vp5mh697njizj97fjp644qy";
+      git = "18kbjsbmgv6l3p1qxgmjnhh4jl7xdk3c20ycjpp62vrhq7pyzjsm";
+    };
+  };
+
+  ruby_2_2_0 = generic {
+    majorVersion = "2";
+    minorVersion = "2";
+    teenyVersion = "0";
+    patchLevel = "0";
+    sha256 = {
+      src = "1z2092fbpc2qkv1j3yj7jdz7qwvqpxqpmcnkphpjcpgvmfaf6wbn";
+      git = "1w7rr2nq1bbw6aiagddzlrr3rl95kk33x4pv6570nm072g55ybpi";
+    };
+  };
+
+  ruby_2_2_2 = generic {
+    majorVersion = "2";
+    minorVersion = "2";
+    teenyVersion = "2";
+    patchLevel = "0";
+    sha256 = {
+      src = "0i4v7l8pnam0by2cza12zldlhrffqchwb2m9shlnp7j2gqqhzz2z";
+      git = "08mw1ql2ghy483cp8xzzm78q17simn4l6phgm2gah7kjh9y3vbrn";
+    };
+  };
+}
diff --git a/pkgs/development/interpreters/ruby/patchsets.nix b/pkgs/development/interpreters/ruby/patchsets.nix
new file mode 100644
index 00000000000..44f4c25a685
--- /dev/null
+++ b/pkgs/development/interpreters/ruby/patchsets.nix
@@ -0,0 +1,126 @@
+{ patchSet, useRailsExpress, ops, patchLevel }:
+
+let self = rec {
+  "1.8.7" = [
+    "${patchSet}/patches/ruby/1.8.7/p${patchLevel}/railsexpress/01-ignore-generated-files.patch"
+    "${patchSet}/patches/ruby/1.8.7/p${patchLevel}/railsexpress/02-fix-tests-for-osx.patch"
+    "${patchSet}/patches/ruby/1.8.7/p${patchLevel}/railsexpress/03-sigvtalrm-fix.patch"
+    "${patchSet}/patches/ruby/1.8.7/p${patchLevel}/railsexpress/04-railsbench-gc-patch.patch"
+    "${patchSet}/patches/ruby/1.8.7/p${patchLevel}/railsexpress/05-display-full-stack-trace.patch"
+    "${patchSet}/patches/ruby/1.8.7/p${patchLevel}/railsexpress/06-better-source-file-tracing.patch"
+    "${patchSet}/patches/ruby/1.8.7/p${patchLevel}/railsexpress/07-heap-dump-support.patch"
+    "${patchSet}/patches/ruby/1.8.7/p${patchLevel}/railsexpress/08-fork-support-for-gc-logging.patch"
+    "${patchSet}/patches/ruby/1.8.7/p${patchLevel}/railsexpress/09-track-malloc-size.patch"
+    "${patchSet}/patches/ruby/1.8.7/p${patchLevel}/railsexpress/10-track-object-allocation.patch"
+    "${patchSet}/patches/ruby/1.8.7/p${patchLevel}/railsexpress/11-expose-heap-slots.patch"
+    "${patchSet}/patches/ruby/1.8.7/p${patchLevel}/railsexpress/12-fix-heap-size-growth-logic.patch"
+    "${patchSet}/patches/ruby/1.8.7/p${patchLevel}/railsexpress/13-heap-slot-size.patch"
+    "${patchSet}/patches/ruby/1.8.7/p${patchLevel}/railsexpress/14-add-trace-stats-enabled-methods.patch"
+    "${patchSet}/patches/ruby/1.8.7/p${patchLevel}/railsexpress/15-track-live-dataset-size.patch"
+    "${patchSet}/patches/ruby/1.8.7/p${patchLevel}/railsexpress/16-add-object-size-information-to-heap-dump.patch"
+    "${patchSet}/patches/ruby/1.8.7/p${patchLevel}/railsexpress/17-caller-for-all-threads.patch"
+  ];
+  "1.9.3" = [
+    ./ruby19-parallel-install.patch
+    ./bitperfect-rdoc.patch
+  ] ++ ops useRailsExpress [
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/01-fix-make-clean.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/02-zero-broken-tests.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/03-railsbench-gc.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/04-display-more-detailed-stack-trace.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/05-fork-support-for-gc-logging.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/06-track-live-dataset-size.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/07-webrick_204_304_keep_alive_fix.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/08-export-a-few-more-symbols-for-ruby-prof.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/09-thread-variables.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/10-faster-loading.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/11-falcon-st-opt.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/12-falcon-sparse-array.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/13-falcon-array-queue.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/14-railsbench-gc-fixes.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/15-show-full-backtrace-on-stack-overflow.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/16-configurable-fiber-stack-sizes.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/17-backport-psych-20.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/18-fix-missing-c-return-event.patch"
+    "${patchSet}/patches/ruby/1.9.3/p${patchLevel}/railsexpress/19-fix-process-daemon-call.patch"
+  ];
+  "2.0.0" = ops useRailsExpress [
+    "${patchSet}/patches/ruby/2.0.0/p${patchLevel}/railsexpress/01-zero-broken-tests.patch"
+    "${patchSet}/patches/ruby/2.0.0/p${patchLevel}/railsexpress/02-railsexpress-gc.patch"
+    "${patchSet}/patches/ruby/2.0.0/p${patchLevel}/railsexpress/03-display-more-detailed-stack-trace.patch"
+    "${patchSet}/patches/ruby/2.0.0/p${patchLevel}/railsexpress/04-show-full-backtrace-on-stack-overflow.patch"
+  ];
+  "2.1.0" = ops useRailsExpress [
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/01-current-2.1.1-fixes.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/02-zero-broken-tests.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/03-improve-gc-stats.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/04-display-more-detailed-stack-trace.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/05-show-full-backtrace-on-stack-overflow.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/06-fix-missing-c-return-event.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/07-backport-006e66b6680f60adfb434ee7397f0dbc77de7873.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/08-funny-falcon-stc-density.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/09-funny-falcon-stc-pool-allocation.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/10-aman-opt-aset-aref-str.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/11-funny-falcon-method-cache.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/12-backport-r44370.patch"
+  ];
+  "2.1.1" = ops useRailsExpress [
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/01-zero-broken-tests.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/02-improve-gc-stats.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/03-display-more-detailed-stack-trace.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/04-show-full-backtrace-on-stack-overflow.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/05-fix-missing-c-return-event.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/07-backport-006e66b6680f60adfb434ee7397f0dbc77de7873.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/08-funny-falcon-stc-density.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/09-funny-falcon-stc-pool-allocation.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/10-aman-opt-aset-aref-str.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/11-funny-falcon-method-cache.patch"
+    "${patchSet}/patches/ruby/2.1.0/railsexpress/12-backport-r44370.patch"
+  ];
+  "2.1.2" = ops useRailsExpress [
+    "${patchSet}/patches/ruby/2.1.2/railsexpress/01-zero-broken-tests.patch"
+    "${patchSet}/patches/ruby/2.1.2/railsexpress/02-improve-gc-stats.patch"
+    "${patchSet}/patches/ruby/2.1.2/railsexpress/03-display-more-detailed-stack-trace.patch"
+    "${patchSet}/patches/ruby/2.1.2/railsexpress/04-show-full-backtrace-on-stack-overflow.patch"
+    "${patchSet}/patches/ruby/2.1.2/railsexpress/05-fix-missing-c-return-event.patch"
+    "${patchSet}/patches/ruby/2.1.2/railsexpress/06-backport-006e66b6680f60adfb434ee7397f0dbc77de7873.patch"
+    "${patchSet}/patches/ruby/2.1.2/railsexpress/07-funny-falcon-stc-density.patch"
+    "${patchSet}/patches/ruby/2.1.2/railsexpress/08-funny-falcon-stc-pool-allocation.patch"
+    "${patchSet}/patches/ruby/2.1.2/railsexpress/09-aman-opt-aset-aref-str.patch"
+    "${patchSet}/patches/ruby/2.1.2/railsexpress/10-funny-falcon-method-cache.patch"
+  ];
+  "2.1.3" = ops useRailsExpress [
+    "${patchSet}/patches/ruby/2.1.3/railsexpress/01-zero-broken-tests.patch"
+    "${patchSet}/patches/ruby/2.1.3/railsexpress/02-improve-gc-stats.patch"
+    "${patchSet}/patches/ruby/2.1.3/railsexpress/03-display-more-detailed-stack-trace.patch"
+    "${patchSet}/patches/ruby/2.1.3/railsexpress/04-show-full-backtrace-on-stack-overflow.patch"
+    "${patchSet}/patches/ruby/2.1.3/railsexpress/05-funny-falcon-stc-density.patch"
+    "${patchSet}/patches/ruby/2.1.3/railsexpress/06-funny-falcon-stc-pool-allocation.patch"
+    "${patchSet}/patches/ruby/2.1.3/railsexpress/07-aman-opt-aset-aref-str.patch"
+    "${patchSet}/patches/ruby/2.1.3/railsexpress/08-funny-falcon-method-cache.patch"
+  ];
+  "2.1.6" = ops useRailsExpress [
+    "${patchSet}/patches/ruby/2.1.6/railsexpress/01-zero-broken-tests.patch"
+    "${patchSet}/patches/ruby/2.1.6/railsexpress/02-improve-gc-stats.patch"
+    "${patchSet}/patches/ruby/2.1.6/railsexpress/03-display-more-detailed-stack-trace.patch"
+    "${patchSet}/patches/ruby/2.1.6/railsexpress/04-show-full-backtrace-on-stack-overflow.patch"
+    "${patchSet}/patches/ruby/2.1.6/railsexpress/05-funny-falcon-stc-density.patch"
+    "${patchSet}/patches/ruby/2.1.6/railsexpress/06-funny-falcon-stc-pool-allocation.patch"
+    "${patchSet}/patches/ruby/2.1.6/railsexpress/07-aman-opt-aset-aref-str.patch"
+    "${patchSet}/patches/ruby/2.1.6/railsexpress/08-funny-falcon-method-cache.patch"
+    "${patchSet}/patches/ruby/2.1.6/railsexpress/09-heap-dump-support.patch"
+  ];
+  "2.2.0" = ops useRailsExpress [
+    "${patchSet}/patches/ruby/2.2.0/railsexpress/01-zero-broken-tests.patch"
+    "${patchSet}/patches/ruby/2.2.0/railsexpress/02-improve-gc-stats.patch"
+    "${patchSet}/patches/ruby/2.2.0/railsexpress/03-display-more-detailed-stack-trace.patch"
+    "${patchSet}/patches/ruby/2.2.0/railsexpress/04-backport-401c8bb.patch"
+    "${patchSet}/patches/ruby/2.2.0/railsexpress/05-fix-packed-bitfield-compat-warning-for-older-gccs.patch"
+  ];
+  "2.2.2" = ops useRailsExpress [
+    "${patchSet}/patches/ruby/2.2.2/railsexpress/01-zero-broken-tests.patch"
+    "${patchSet}/patches/ruby/2.2.2/railsexpress/02-improve-gc-stats.patch"
+    "${patchSet}/patches/ruby/2.2.2/railsexpress/03-display-more-detailed-stack-trace.patch"
+    "${patchSet}/patches/ruby/2.2.2/railsexpress/04-backported-bugfixes-222.patch"
+  ];
+}; in self
diff --git a/pkgs/development/interpreters/ruby/ruby-1.8.7.nix b/pkgs/development/interpreters/ruby/ruby-1.8.7.nix
index 3c2ea71ecf2..0ae1d1261ee 100644
--- a/pkgs/development/interpreters/ruby/ruby-1.8.7.nix
+++ b/pkgs/development/interpreters/ruby/ruby-1.8.7.nix
@@ -60,6 +60,9 @@ stdenv.mkDerivation rec {
   ];
 
   configureFlags = [ "--enable-shared" "--enable-pthread" ]
+    # Without this fails due to not finding X11/Xlib.h
+    # Not sure why this isn't required on Linux
+    ++ ops stdenv.isDarwin [ "--without-tcl" "--without-tk" ]
     ++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby";
 
   installFlags = stdenv.lib.optionalString docSupport "install-doc";
diff --git a/pkgs/development/interpreters/ruby/ruby-1.9.3.nix b/pkgs/development/interpreters/ruby/ruby-1.9.3.nix
deleted file mode 100644
index db807ebbd8b..00000000000
--- a/pkgs/development/interpreters/ruby/ruby-1.9.3.nix
+++ /dev/null
@@ -1,121 +0,0 @@
-{ stdenv, lib, fetchurl, fetchFromGitHub
-, zlib, zlibSupport ? true
-, openssl, opensslSupport ? true
-, gdbm, gdbmSupport ? true
-, ncurses, readline, cursesSupport ? true
-, groff, docSupport ? false
-, libyaml, yamlSupport ? true
-, ruby_1_9_3, autoreconfHook, bison, useRailsExpress ? true
-}:
-
-let
-  op = stdenv.lib.optional;
-  ops = stdenv.lib.optionals;
-  patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
-  baseruby = ruby_1_9_3.override { useRailsExpress = false; };
-in
-
-stdenv.mkDerivation rec {
-  version = with passthru; "${majorVersion}.${minorVersion}.${teenyVersion}-p${patchLevel}";
-
-  name = "ruby-${version}";
-
-  src = if useRailsExpress then fetchFromGitHub {
-    owner  = "ruby";
-    repo   = "ruby";
-    rev    = "v1_9_3_${passthru.patchLevel}";
-    sha256 = "040x67snfjrql5j7blizpm9j58jhwvh00v8h1h59aq90h52lkj68";
-  } else fetchurl {
-    url = "http://cache.ruby-lang.org/pub/ruby/1.9/${name}.tar.bz2";
-    sha256 = "0k7g0ahicjnd4sij2pml1p1dcb95ms3k3j1k3169n02kzz9qwn7g";
-  };
-
-  # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
-  NROFF = "${groff}/bin/nroff";
-
-  buildInputs = ops useRailsExpress [ autoreconfHook bison ]
-    ++ (ops cursesSupport [ ncurses readline ] )
-    ++ (op docSupport groff )
-    ++ (op zlibSupport zlib)
-    ++ (op opensslSupport openssl)
-    ++ (op gdbmSupport gdbm)
-    ++ (op yamlSupport libyaml)
-    # 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);
-
-  enableParallelBuilding = true;
-
-  patches = [
-    ./ruby19-parallel-install.patch
-    ./bitperfect-rdoc.patch
-  ] ++ ops useRailsExpress [
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/01-fix-make-clean.patch"
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/02-railsbench-gc.patch"
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/03-display-more-detailed-stack-trace.patch"
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/04-fork-support-for-gc-logging.patch"
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/05-track-live-dataset-size.patch"
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/06-webrick_204_304_keep_alive_fix.patch"
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/07-export-a-few-more-symbols-for-ruby-prof.patch"
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/08-thread-variables.patch"
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/09-faster-loading.patch"
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/10-falcon-st-opt.patch"
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/11-falcon-sparse-array.patch"
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/12-falcon-array-queue.patch"
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/13-railsbench-gc-fixes.patch"
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/14-show-full-backtrace-on-stack-overflow.patch"
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/15-configurable-fiber-stack-sizes.patch"
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/16-backport-psych-20.patch"
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/17-fix-missing-c-return-event.patch"
-    "${patchSet}/patches/ruby/1.9.3/p547/railsexpress/18-fix-process-daemon-call.patch"
-  ];
-
-  configureFlags = [ "--enable-shared" "--enable-pthread" ]
-    ++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"
-    # on darwin, we have /usr/include/tk.h -- so the configure script detects
-    # that tk is installed
-    ++ ( if stdenv.isDarwin then [ "--with-out-ext=tk " ] else [ ]);
-
-  installFlags = stdenv.lib.optionalString docSupport "install-doc";
-
-  CFLAGS = stdenv.lib.optionalString stdenv.isDarwin "-mmacosx-version-min=10.7";
-
-  postInstall = ''
-    # Bundler tries to create this directory
-    mkdir -pv $out/${passthru.gemPath}
-    mkdir -p $out/nix-support
-    cat > $out/nix-support/setup-hook <<EOF
-    addGemPath() {
-      addToSearchPath GEM_PATH \$1/${passthru.gemPath}
-    }
-
-    envHooks+=(addGemPath)
-    EOF
-  '' + lib.optionalString useRailsExpress ''
-    rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
-
-    # Prevent the baseruby from being included in the closure.
-    sed -i '/^  CONFIG\["BASERUBY"\]/d' $rbConfig
-    sed -i "s|'--with-baseruby=${baseruby}/bin/ruby'||" $rbConfig
-  '';
-
-  meta = {
-    license     = "Ruby";
-    homepage    = "http://www.ruby-lang.org/en/";
-    description = "The Ruby language";
-    maintainers = with stdenv.lib.maintainers; [ lovek323 ];
-    platforms   = stdenv.lib.platforms.all;
-  };
-
-  passthru = rec {
-    majorVersion = "1";
-    minorVersion = "9";
-    teenyVersion = "3";
-    patchLevel = "547";
-    rubyEngine = "ruby";
-    libPath = "lib/${rubyEngine}/${majorVersion}.${minorVersion}.${teenyVersion}";
-    gemPath = "lib/${rubyEngine}/gems/${majorVersion}.${minorVersion}.${teenyVersion}";
-  };
-}
diff --git a/pkgs/development/interpreters/ruby/ruby-2.0.0.nix b/pkgs/development/interpreters/ruby/ruby-2.0.0.nix
deleted file mode 100644
index 31408b73807..00000000000
--- a/pkgs/development/interpreters/ruby/ruby-2.0.0.nix
+++ /dev/null
@@ -1,104 +0,0 @@
-{ stdenv, lib, fetchurl, fetchFromGitHub
-, zlib, zlibSupport ? true
-, openssl, opensslSupport ? true
-, gdbm, gdbmSupport ? true
-, ncurses, readline, cursesSupport ? true
-, groff, docSupport ? false
-, libyaml, yamlSupport ? true
-, libffi, fiddleSupport ? true
-, ruby_2_0_0, autoreconfHook, bison, useRailsExpress ? true
-}:
-
-let
-  op = stdenv.lib.optional;
-  ops = stdenv.lib.optionals;
-  patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
-  baseruby = ruby_2_0_0.override { useRailsExpress = false; };
-in
-
-stdenv.mkDerivation rec {
-  version = with passthru; "${majorVersion}.${minorVersion}.${teenyVersion}-p${patchLevel}";
-
-  name = "ruby-${version}";
-
-  src = if useRailsExpress then fetchFromGitHub {
-    owner  = "ruby";
-    repo   = "ruby";
-    rev    = "v2_0_0_${passthru.patchLevel}";
-    sha256 = "07ccnxgiqxn5ycmq2wl7j3aqmndm4n358y35kzaivb488ayjg3pj";
-  } else fetchurl {
-    url = "http://cache.ruby-lang.org/pub/ruby/2.0/${name}.tar.bz2";
-    sha256 = "1qnqccyfhx0fykxqbzlxq0yvyvq6q9v32givyfyr303dx7bxlqh7";
-  };
-
-  # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
-  NROFF = "${groff}/bin/nroff";
-
-  buildInputs = ops useRailsExpress [ autoreconfHook bison ]
-    ++ (op fiddleSupport libffi)
-    ++ (ops cursesSupport [ ncurses readline ] )
-    ++ (op docSupport groff )
-    ++ (op zlibSupport zlib)
-    ++ (op opensslSupport openssl)
-    ++ (op gdbmSupport gdbm)
-    ++ (op yamlSupport libyaml)
-    # 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);
-
-  enableParallelBuilding = true;
-
-  patches = ops useRailsExpress [
-    "${patchSet}/patches/ruby/2.0.0/p481/railsexpress/01-zero-broken-tests.patch"
-    "${patchSet}/patches/ruby/2.0.0/p481/railsexpress/02-railsexpress-gc.patch"
-    "${patchSet}/patches/ruby/2.0.0/p481/railsexpress/03-display-more-detailed-stack-trace.patch"
-    "${patchSet}/patches/ruby/2.0.0/p481/railsexpress/04-show-full-backtrace-on-stack-overflow.patch"
-    "${patchSet}/patches/ruby/2.0.0/p481/railsexpress/05-fix-missing-c-return-event.patch"
-  ];
-
-  configureFlags = ["--enable-shared" ]
-    ++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"
-    # on darwin, we have /usr/include/tk.h -- so the configure script detects
-    # that tk is installed
-    ++ ( if stdenv.isDarwin then [ "--with-out-ext=tk " ] else [ ]);
-
-  installFlags = stdenv.lib.optionalString docSupport "install-doc";
-  # Bundler tries to create this directory
-  postInstall = ''
-    # Bundler tries to create this directory
-    mkdir -pv $out/${passthru.gemPath}
-    mkdir -p $out/nix-support
-    cat > $out/nix-support/setup-hook <<EOF
-    addGemPath() {
-      addToSearchPath GEM_PATH \$1/${passthru.gemPath}
-    }
-
-    envHooks+=(addGemPath)
-    EOF
-  '' + lib.optionalString useRailsExpress ''
-    rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
-
-    # Prevent the baseruby from being included in the closure.
-    sed -i '/^  CONFIG\["BASERUBY"\]/d' $rbConfig
-    sed -i "s|'--with-baseruby=${baseruby}/bin/ruby'||" $rbConfig
-  '';
-
-  meta = {
-    license = stdenv.lib.licenses.ruby;
-    homepage = "http://www.ruby-lang.org/en/";
-    description = "The Ruby language";
-    platforms = stdenv.lib.platforms.all;
-  };
-
-  passthru = rec {
-    majorVersion = "2";
-    minorVersion = "0";
-    teenyVersion = "0";
-    patchLevel = "481";
-    rubyEngine = "ruby";
-    libPath = "lib/${rubyEngine}/${majorVersion}.${minorVersion}.${teenyVersion}";
-    gemPath = "lib/${rubyEngine}/gems/${majorVersion}.${minorVersion}.${teenyVersion}";
-  };
-}
diff --git a/pkgs/development/interpreters/ruby/ruby-2.1.0.nix b/pkgs/development/interpreters/ruby/ruby-2.1.0.nix
deleted file mode 100644
index 95ab84eedb8..00000000000
--- a/pkgs/development/interpreters/ruby/ruby-2.1.0.nix
+++ /dev/null
@@ -1,120 +0,0 @@
-{ stdenv, lib, fetchurl, fetchgit, fetchFromGitHub
-, zlib, zlibSupport ? true
-, openssl, opensslSupport ? true
-, gdbm, gdbmSupport ? true
-, ncurses, readline, cursesSupport ? true
-, groff, docSupport ? false
-, libyaml, yamlSupport ? true
-, libffi, fiddleSupport ? true
-, ruby_2_1_0, autoreconfHook, bison, useRailsExpress ? true
-}:
-
-let
-  op = stdenv.lib.optional;
-  ops = stdenv.lib.optionals;
-  patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
-  config = import ./config.nix fetchgit;
-  baseruby = ruby_2_1_0.override { useRailsExpress = false; };
-in
-
-stdenv.mkDerivation rec {
-  version = with passthru; "${majorVersion}.${minorVersion}.${teenyVersion}-p${patchLevel}";
-
-  name = "ruby-${version}";
-
-  src = if useRailsExpress then fetchFromGitHub {
-    owner  = "ruby";
-    repo   = "ruby";
-    rev    = "v2_1_0";
-    sha256 = "12sn532yvznqfz85378ys0b9ggmj7w8ddhzc1pnnlx7mbyy7r2hx";
-  } else fetchurl {
-    url = "http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.0.tar.gz";
-    sha256 = "17fhfbw8sr13rxfn58wvrhk2f5i88lkna2afn3gdjvprd8gyqf1m";
-  };
-
-  # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
-  NROFF = "${groff}/bin/nroff";
-
-  buildInputs = ops useRailsExpress [ autoreconfHook bison ]
-    ++ (op fiddleSupport libffi)
-    ++ (ops cursesSupport [ ncurses readline ] )
-    ++ (op docSupport groff )
-    ++ (op zlibSupport zlib)
-    ++ (op opensslSupport openssl)
-    ++ (op gdbmSupport gdbm)
-    ++ (op yamlSupport libyaml)
-    # 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);
-
-  enableParallelBuilding = true;
-
-  patches = ops useRailsExpress [
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/01-current-2.1.1-fixes.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/02-zero-broken-tests.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/03-improve-gc-stats.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/04-display-more-detailed-stack-trace.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/05-show-full-backtrace-on-stack-overflow.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/06-fix-missing-c-return-event.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/07-backport-006e66b6680f60adfb434ee7397f0dbc77de7873.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/08-funny-falcon-stc-density.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/09-funny-falcon-stc-pool-allocation.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/10-aman-opt-aset-aref-str.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/11-funny-falcon-method-cache.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/12-backport-r44370.patch"
-  ];
-
-  # Ruby >= 2.1.0 tries to download config.{guess,sub}
-  postPatch = ''
-    rm tool/config_files.rb
-    cp ${config}/config.guess tool/
-    cp ${config}/config.sub tool/
-  '';
-
-  configureFlags = ["--enable-shared" ]
-    ++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"
-    # on darwin, we have /usr/include/tk.h -- so the configure script detects
-    # that tk is installed
-    ++ ( if stdenv.isDarwin then [ "--with-out-ext=tk " ] else [ ]);
-
-  installFlags = stdenv.lib.optionalString docSupport "install-doc";
-  # Bundler tries to create this directory
-  postInstall = ''
-    # Bundler tries to create this directory
-    mkdir -pv $out/${passthru.gemPath}
-    mkdir -p $out/nix-support
-    cat > $out/nix-support/setup-hook <<EOF
-    addGemPath() {
-      addToSearchPath GEM_PATH \$1/${passthru.gemPath}
-    }
-
-    envHooks+=(addGemPath)
-    EOF
-  '' + lib.optionalString useRailsExpress ''
-    rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
-
-    # Prevent the baseruby from being included in the closure.
-    sed -i '/^  CONFIG\["BASERUBY"\]/d' $rbConfig
-    sed -i "s|'--with-baseruby=${baseruby}/bin/ruby'||" $rbConfig
-  '';
-
-
-  meta = {
-    license = stdenv.lib.licenses.ruby;
-    homepage = "http://www.ruby-lang.org/en/";
-    description = "The Ruby language";
-    platforms = stdenv.lib.platforms.all;
-  };
-
-  passthru = rec {
-    majorVersion = "2";
-    minorVersion = "1";
-    teenyVersion = "0";
-    patchLevel = "0";
-    rubyEngine = "ruby";
-    libPath = "lib/${rubyEngine}/${majorVersion}.${minorVersion}.${teenyVersion}";
-    gemPath = "lib/${rubyEngine}/gems/${majorVersion}.${minorVersion}.${teenyVersion}";
-  };
-}
diff --git a/pkgs/development/interpreters/ruby/ruby-2.1.1.nix b/pkgs/development/interpreters/ruby/ruby-2.1.1.nix
deleted file mode 100644
index abd09c0f276..00000000000
--- a/pkgs/development/interpreters/ruby/ruby-2.1.1.nix
+++ /dev/null
@@ -1,118 +0,0 @@
-{ stdenv, lib, fetchurl, fetchgit, fetchFromGitHub
-, zlib, zlibSupport ? true
-, openssl, opensslSupport ? true
-, gdbm, gdbmSupport ? true
-, ncurses, readline, cursesSupport ? true
-, groff, docSupport ? false
-, libyaml, yamlSupport ? true
-, libffi, fiddleSupport ? true
-, ruby_2_1_1, autoreconfHook, bison, useRailsExpress ? true
-}:
-
-let
-  op = stdenv.lib.optional;
-  ops = stdenv.lib.optionals;
-  patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
-  config = import ./config.nix fetchgit;
-  baseruby = ruby_2_1_1.override { useRailsExpress = false; };
-in
-
-stdenv.mkDerivation rec {
-  version = with passthru; "${majorVersion}.${minorVersion}.${teenyVersion}-p${patchLevel}";
-
-  name = "ruby-${version}";
-
-  src = if useRailsExpress then fetchFromGitHub {
-    owner  = "ruby";
-    repo   = "ruby";
-    rev    = "v2_1_1";
-    sha256 = "1v2ffvyd0xx1h1qd70431zczhvsdiyyw5kjxih4rszd5avzh5grl";
-  } else fetchurl {
-    url = "http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.1.tar.gz";
-    sha256 = "0hc9x3mazyvnk94gs19q8mbnanlzk8mv0hii77slkvc8mqqxyhy8";
-  };
-
-  # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
-  NROFF = "${groff}/bin/nroff";
-
-  buildInputs = ops useRailsExpress [ autoreconfHook bison ]
-    ++ (op fiddleSupport libffi)
-    ++ (ops cursesSupport [ ncurses readline ] )
-    ++ (op docSupport groff )
-    ++ (op zlibSupport zlib)
-    ++ (op opensslSupport openssl)
-    ++ (op gdbmSupport gdbm)
-    ++ (op yamlSupport libyaml)
-    # 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);
-
-  enableParallelBuilding = true;
-
-  patches = ops useRailsExpress [
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/01-zero-broken-tests.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/02-improve-gc-stats.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/03-display-more-detailed-stack-trace.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/04-show-full-backtrace-on-stack-overflow.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/05-fix-missing-c-return-event.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/07-backport-006e66b6680f60adfb434ee7397f0dbc77de7873.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/08-funny-falcon-stc-density.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/09-funny-falcon-stc-pool-allocation.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/10-aman-opt-aset-aref-str.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/11-funny-falcon-method-cache.patch"
-    "${patchSet}/patches/ruby/2.1.0/railsexpress/12-backport-r44370.patch"
-  ];
-
-  # Ruby >= 2.1.0 tries to download config.{guess,sub}
-  postPatch = ''
-    rm tool/config_files.rb
-    cp ${config}/config.guess tool/
-    cp ${config}/config.sub tool/
-  '';
-
-  configureFlags = ["--enable-shared" ]
-    ++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"
-    # on darwin, we have /usr/include/tk.h -- so the configure script detects
-    # that tk is installed
-    ++ ( if stdenv.isDarwin then [ "--with-out-ext=tk " ] else [ ]);
-
-  installFlags = stdenv.lib.optionalString docSupport "install-doc";
-  # Bundler tries to create this directory
-  postInstall = ''
-    # Bundler tries to create this directory
-    mkdir -pv $out/${passthru.gemPath}
-    mkdir -p $out/nix-support
-    cat > $out/nix-support/setup-hook <<EOF
-    addGemPath() {
-      addToSearchPath GEM_PATH \$1/${passthru.gemPath}
-    }
-
-    envHooks+=(addGemPath)
-    EOF
-  '' + lib.optionalString useRailsExpress ''
-    rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
-
-    # Prevent the baseruby from being included in the closure.
-    sed -i '/^  CONFIG\["BASERUBY"\]/d' $rbConfig
-    sed -i "s|'--with-baseruby=${baseruby}/bin/ruby'||" $rbConfig
-  '';
-
-  meta = {
-    license = stdenv.lib.licenses.ruby;
-    homepage = "http://www.ruby-lang.org/en/";
-    description = "The Ruby language";
-    platforms = stdenv.lib.platforms.all;
-  };
-
-  passthru = rec {
-    majorVersion = "2";
-    minorVersion = "1";
-    teenyVersion = "1";
-    patchLevel = "0";
-    rubyEngine = "ruby";
-    libPath = "lib/${rubyEngine}/${majorVersion}.${minorVersion}.${teenyVersion}";
-    gemPath = "lib/${rubyEngine}/gems/${majorVersion}.${minorVersion}.${teenyVersion}";
-  };
-}
diff --git a/pkgs/development/interpreters/ruby/ruby-2.1.2.nix b/pkgs/development/interpreters/ruby/ruby-2.1.2.nix
deleted file mode 100644
index 8612cd6bd43..00000000000
--- a/pkgs/development/interpreters/ruby/ruby-2.1.2.nix
+++ /dev/null
@@ -1,117 +0,0 @@
-{ stdenv, lib, fetchurl, fetchgit, fetchFromGitHub
-, zlib, zlibSupport ? true
-, openssl, opensslSupport ? true
-, gdbm, gdbmSupport ? true
-, ncurses, readline, cursesSupport ? true
-, groff, docSupport ? false
-, libyaml, yamlSupport ? true
-, libffi, fiddleSupport ? true
-, ruby_2_1_2, autoreconfHook, bison, useRailsExpress ? true
-}:
-
-let
-  op = stdenv.lib.optional;
-  ops = stdenv.lib.optionals;
-  patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
-  config = import ./config.nix fetchgit;
-  baseruby = ruby_2_1_2.override { useRailsExpress = false; };
-in
-
-stdenv.mkDerivation rec {
-  version = with passthru; "${majorVersion}.${minorVersion}.${teenyVersion}-p${patchLevel}";
-
-  name = "ruby-${version}";
-
-  src = if useRailsExpress then fetchFromGitHub {
-    owner  = "ruby";
-    repo   = "ruby";
-    rev    = "v2_1_2";
-    sha256 = "14f8w3zwngnxsgigffh6h9z3ng53xq8mk126xmwrsmz9n3ypm6l0";
-  } else fetchurl {
-    url = "http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz";
-    sha256 = "0db6krc2bd7yha8p96lcqrahjpsz7g7abhni134g708sh53n8apj";
-  };
-
-  # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
-  NROFF = "${groff}/bin/nroff";
-
-  buildInputs = ops useRailsExpress [ autoreconfHook bison ]
-    ++ (op fiddleSupport libffi)
-    ++ (ops cursesSupport [ ncurses readline ] )
-    ++ (op docSupport groff )
-    ++ (op zlibSupport zlib)
-    ++ (op opensslSupport openssl)
-    ++ (op gdbmSupport gdbm)
-    ++ (op yamlSupport libyaml)
-    # 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);
-
-  enableParallelBuilding = true;
-
-  patches = ops useRailsExpress [
-    "${patchSet}/patches/ruby/2.1.2/railsexpress/01-zero-broken-tests.patch"
-    "${patchSet}/patches/ruby/2.1.2/railsexpress/02-improve-gc-stats.patch"
-    "${patchSet}/patches/ruby/2.1.2/railsexpress/03-display-more-detailed-stack-trace.patch"
-    "${patchSet}/patches/ruby/2.1.2/railsexpress/04-show-full-backtrace-on-stack-overflow.patch"
-    "${patchSet}/patches/ruby/2.1.2/railsexpress/05-fix-missing-c-return-event.patch"
-    "${patchSet}/patches/ruby/2.1.2/railsexpress/06-backport-006e66b6680f60adfb434ee7397f0dbc77de7873.patch"
-    "${patchSet}/patches/ruby/2.1.2/railsexpress/07-funny-falcon-stc-density.patch"
-    "${patchSet}/patches/ruby/2.1.2/railsexpress/08-funny-falcon-stc-pool-allocation.patch"
-    "${patchSet}/patches/ruby/2.1.2/railsexpress/09-aman-opt-aset-aref-str.patch"
-    "${patchSet}/patches/ruby/2.1.2/railsexpress/10-funny-falcon-method-cache.patch"
-  ];
-
-  # Ruby >= 2.1.0 tries to download config.{guess,sub}
-  postPatch = ''
-    rm tool/config_files.rb
-    cp ${config}/config.guess tool/
-    cp ${config}/config.sub tool/
-  '';
-
-  configureFlags = ["--enable-shared" ]
-    ++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"
-    # on darwin, we have /usr/include/tk.h -- so the configure script detects
-    # that tk is installed
-    ++ ( if stdenv.isDarwin then [ "--with-out-ext=tk " ] else [ ]);
-
-  installFlags = stdenv.lib.optionalString docSupport "install-doc";
-  # Bundler tries to create this directory
-  postInstall = ''
-    # Bundler tries to create this directory
-    mkdir -pv $out/${passthru.gemPath}
-    mkdir -p $out/nix-support
-    cat > $out/nix-support/setup-hook <<EOF
-    addGemPath() {
-      addToSearchPath GEM_PATH \$1/${passthru.gemPath}
-    }
-
-    envHooks+=(addGemPath)
-    EOF
-  '' + lib.optionalString useRailsExpress ''
-    rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
-
-    # Prevent the baseruby from being included in the closure.
-    sed -i '/^  CONFIG\["BASERUBY"\]/d' $rbConfig
-    sed -i "s|'--with-baseruby=${baseruby}/bin/ruby'||" $rbConfig
-  '';
-
-  meta = {
-    license = stdenv.lib.licenses.ruby;
-    homepage = "http://www.ruby-lang.org/en/";
-    description = "The Ruby language";
-    platforms = stdenv.lib.platforms.all;
-  };
-
-  passthru = rec {
-    majorVersion = "2";
-    minorVersion = "1";
-    teenyVersion = "2";
-    patchLevel = "353";
-    rubyEngine = "ruby";
-    libPath = "lib/${rubyEngine}/${majorVersion}.${minorVersion}.${teenyVersion}";
-    gemPath = "lib/${rubyEngine}/gems/${majorVersion}.${minorVersion}.${teenyVersion}";
-  };
-}
diff --git a/pkgs/development/interpreters/ruby/ruby-2.1.3.nix b/pkgs/development/interpreters/ruby/ruby-2.1.3.nix
deleted file mode 100644
index 1ba97daac04..00000000000
--- a/pkgs/development/interpreters/ruby/ruby-2.1.3.nix
+++ /dev/null
@@ -1,121 +0,0 @@
-{ stdenv, lib, fetchurl, fetchgit, fetchFromGitHub
-, zlib, zlibSupport ? true
-, openssl, opensslSupport ? true
-, gdbm, gdbmSupport ? true
-, ncurses, readline, cursesSupport ? true
-, groff, docSupport ? false
-, libyaml, yamlSupport ? true
-, libffi, fiddleSupport ? true
-, ruby_2_1_3, autoreconfHook, bison, useRailsExpress ? true
-}:
-
-let
-  op = stdenv.lib.optional;
-  ops = stdenv.lib.optionals;
-  patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
-  config = import ./config.nix fetchgit;
-  baseruby = ruby_2_1_3.override { useRailsExpress = false; };
-in
-
-stdenv.mkDerivation rec {
-  version = with passthru; "${majorVersion}.${minorVersion}.${teenyVersion}-p${patchLevel}";
-
-  name = "ruby-${version}";
-
-  src = if useRailsExpress then fetchFromGitHub {
-    owner  = "ruby";
-    repo   = "ruby";
-    rev    = "v2_1_3";
-    sha256 = "1pnam9jry2l2mbji3gvrbb7jyisxl99xjz6l1qrccwnfinxxbmhv";
-  } else fetchurl {
-    url = "http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.3.tar.gz";
-    sha256 = "00bz6jcbxgnllplk4b9lnyc3w8yd3pz5rn11rmca1s8cn6vvw608";
-  };
-
-  # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
-  NROFF = "${groff}/bin/nroff";
-
-  buildInputs = ops useRailsExpress [ autoreconfHook bison ]
-    ++ (op fiddleSupport libffi)
-    ++ (ops cursesSupport [ ncurses readline ])
-    ++ (op docSupport groff)
-    ++ (op zlibSupport zlib)
-    ++ (op opensslSupport openssl)
-    ++ (op gdbmSupport gdbm)
-    ++ (op yamlSupport libyaml)
-    # 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);
-
-  enableParallelBuilding = true;
-
-  # Fix a build failure on systems with nix store optimisation.
-  # (The build process attempted to copy file a overwriting file b, where a and
-  # b are hard-linked, which results in cp returning a non-zero exit code.)
-  # https://github.com/NixOS/nixpkgs/issues/4266
-  postUnpack = ''rm "$sourceRoot/enc/unicode/name2ctype.h"'';
-
-  patches = ops useRailsExpress [
-    "${patchSet}/patches/ruby/2.1.3/railsexpress/01-zero-broken-tests.patch"
-    "${patchSet}/patches/ruby/2.1.3/railsexpress/02-improve-gc-stats.patch"
-    "${patchSet}/patches/ruby/2.1.3/railsexpress/03-display-more-detailed-stack-trace.patch"
-    "${patchSet}/patches/ruby/2.1.3/railsexpress/04-show-full-backtrace-on-stack-overflow.patch"
-    "${patchSet}/patches/ruby/2.1.3/railsexpress/05-funny-falcon-stc-density.patch"
-    "${patchSet}/patches/ruby/2.1.3/railsexpress/06-funny-falcon-stc-pool-allocation.patch"
-    "${patchSet}/patches/ruby/2.1.3/railsexpress/07-aman-opt-aset-aref-str.patch"
-    "${patchSet}/patches/ruby/2.1.3/railsexpress/08-funny-falcon-method-cache.patch"
-  ];
-
-  # Ruby >= 2.1.0 tries to download config.{guess,sub}
-  postPatch = ''
-    rm tool/config_files.rb
-    cp ${config}/config.guess tool/
-    cp ${config}/config.sub tool/
-  '';
-
-  configureFlags = ["--enable-shared" ]
-    ++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"
-    # on darwin, we have /usr/include/tk.h -- so the configure script detects
-    # that tk is installed
-    ++ ( if stdenv.isDarwin then [ "--with-out-ext=tk " ] else [ ]);
-
-  installFlags = stdenv.lib.optionalString docSupport "install-doc";
-  # Bundler tries to create this directory
-  postInstall = ''
-    # Bundler tries to create this directory
-    mkdir -pv $out/${passthru.gemPath}
-    mkdir -p $out/nix-support
-    cat > $out/nix-support/setup-hook <<EOF
-    addGemPath() {
-      addToSearchPath GEM_PATH \$1/${passthru.gemPath}
-    }
-
-    envHooks+=(addGemPath)
-    EOF
-  '' + lib.optionalString useRailsExpress ''
-    rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
-
-    # Prevent the baseruby from being included in the closure.
-    sed -i '/^  CONFIG\["BASERUBY"\]/d' $rbConfig
-    sed -i "s|'--with-baseruby=${baseruby}/bin/ruby'||" $rbConfig
-  '';
-
-  meta = {
-    license = stdenv.lib.licenses.ruby;
-    homepage = "http://www.ruby-lang.org/en/";
-    description = "The Ruby language";
-    platforms = stdenv.lib.platforms.all;
-  };
-
-  passthru = rec {
-    majorVersion = "2";
-    minorVersion = "1";
-    teenyVersion = "3";
-    patchLevel = "0";
-    rubyEngine = "ruby";
-    libPath = "lib/${rubyEngine}/${majorVersion}.${minorVersion}.${teenyVersion}";
-    gemPath = "lib/${rubyEngine}/gems/${majorVersion}.${minorVersion}.${teenyVersion}";
-  };
-}
diff --git a/pkgs/development/interpreters/ruby/ruby-2.2.0.nix b/pkgs/development/interpreters/ruby/ruby-2.2.0.nix
deleted file mode 100644
index 0fb01a5a535..00000000000
--- a/pkgs/development/interpreters/ruby/ruby-2.2.0.nix
+++ /dev/null
@@ -1,112 +0,0 @@
-{ stdenv, lib, fetchurl, fetchgit, fetchFromGitHub
-, zlib, zlibSupport ? true
-, openssl, opensslSupport ? true
-, gdbm, gdbmSupport ? true
-, ncurses, readline, cursesSupport ? true
-, groff, docSupport ? false
-, libyaml, yamlSupport ? true
-, libffi, fiddleSupport ? true
-, ruby_2_2_0, autoreconfHook, bison, useRailsExpress ? true
-}:
-
-let
-  op = stdenv.lib.optional;
-  ops = stdenv.lib.optionals;
-  patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
-  config = import ./config.nix fetchgit;
-  baseruby = ruby_2_2_0.override { useRailsExpress = false; };
-in
-
-stdenv.mkDerivation rec {
-  version = with passthru; "${majorVersion}.${minorVersion}.${teenyVersion}-p${patchLevel}";
-
-  name = "ruby-${version}";
-
-  src = if useRailsExpress then fetchFromGitHub {
-    owner  = "ruby";
-    repo   = "ruby";
-    rev    = "v2_2_0";
-    sha256 = "1w7rr2nq1bbw6aiagddzlrr3rl95kk33x4pv6570nm072g55ybpi";
-  } else fetchurl {
-    url = "http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.0.tar.gz";
-    sha256 = "1z2092fbpc2qkv1j3yj7jdz7qwvqpxqpmcnkphpjcpgvmfaf6wbn";
-  };
-
-  # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
-  NROFF = "${groff}/bin/nroff";
-
-  buildInputs = ops useRailsExpress [ autoreconfHook bison ]
-    ++ (op fiddleSupport libffi)
-    ++ (ops cursesSupport [ ncurses readline ])
-    ++ (op docSupport groff)
-    ++ (op zlibSupport zlib)
-    ++ (op opensslSupport openssl)
-    ++ (op gdbmSupport gdbm)
-    ++ (op yamlSupport libyaml)
-    # 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);
-
-  enableParallelBuilding = true;
-
-  patches = ops useRailsExpress [
-    "${patchSet}/patches/ruby/2.2.0/railsexpress/01-zero-broken-tests.patch"
-    "${patchSet}/patches/ruby/2.2.0/railsexpress/02-improve-gc-stats.patch"
-    "${patchSet}/patches/ruby/2.2.0/railsexpress/03-display-more-detailed-stack-trace.patch"
-    "${patchSet}/patches/ruby/2.2.0/railsexpress/04-backport-401c8bb.patch"
-    "${patchSet}/patches/ruby/2.2.0/railsexpress/05-fix-packed-bitfield-compat-warning-for-older-gccs.patch"
-  ];
-
-  # Ruby >= 2.1.0 tries to download config.{guess,sub}
-  postPatch = ''
-    rm tool/config_files.rb
-    cp ${config}/config.guess tool/
-    cp ${config}/config.sub tool/
-  '';
-
-  configureFlags = ["--enable-shared" ]
-    ++ op useRailsExpress "--with-baseruby=${baseruby}/bin/ruby"
-    # on darwin, we have /usr/include/tk.h -- so the configure script detects
-    # that tk is installed
-    ++ ( if stdenv.isDarwin then [ "--with-out-ext=tk " ] else [ ]);
-
-  installFlags = stdenv.lib.optionalString docSupport "install-doc";
-  # Bundler tries to create this directory
-  postInstall = ''
-    # Bundler tries to create this directory
-    mkdir -pv $out/${passthru.gemPath}
-    mkdir -p $out/nix-support
-    cat > $out/nix-support/setup-hook <<EOF
-    addGemPath() {
-      addToSearchPath GEM_PATH \$1/${passthru.gemPath}
-    }
-
-    envHooks+=(addGemPath)
-    EOF
-  '' + lib.optionalString useRailsExpress ''
-    rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
-
-    # Prevent the baseruby from being included in the closure.
-    sed -i '/^  CONFIG\["BASERUBY"\]/d' $rbConfig
-    sed -i "s|'--with-baseruby=${baseruby}/bin/ruby'||" $rbConfig
-  '';
-
-  meta = {
-    license = stdenv.lib.licenses.ruby;
-    homepage = "http://www.ruby-lang.org/en/";
-    description = "The Ruby language";
-    platforms = stdenv.lib.platforms.all;
-  };
-
-  passthru = rec {
-    majorVersion = "2";
-    minorVersion = "2";
-    teenyVersion = "0";
-    patchLevel = "0";
-    rubyEngine = "ruby";
-    libPath = "lib/${rubyEngine}/${majorVersion}.${minorVersion}.${teenyVersion}";
-    gemPath = "lib/${rubyEngine}/gems/${majorVersion}.${minorVersion}.${teenyVersion}";
-  };
-}
diff --git a/pkgs/development/interpreters/ruby/rubygems.nix b/pkgs/development/interpreters/ruby/rubygems.nix
index 773a752ffef..f4942b84091 100644
--- a/pkgs/development/interpreters/ruby/rubygems.nix
+++ b/pkgs/development/interpreters/ruby/rubygems.nix
@@ -1,4 +1,4 @@
-args : with args; 
+args @ { makeWrapper, ruby, ... }: with args;
 
 rec {
   name = "rubygems-" + version;
@@ -23,7 +23,7 @@ rec {
 
   /* doConfigure should be specified separately */
   phaseNames = ["doPatch" "doInstall"];
-      
+
   meta = {
     description = "Ruby gems package collection";
     longDescription = ''
diff --git a/pkgs/development/interpreters/ruby/rvm-patchsets.nix b/pkgs/development/interpreters/ruby/rvm-patchsets.nix
index 7685bafddc9..908b4b36372 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    = "da2e5b4d81e18154befef1448e037b844cb5a326";
-  sha256 = "0fslnkpirgsm7gjd6g194vd24i3y7kl0ihbq5gr94cgvdzzjgad0";
+  rev    = "68be466019aa592e0321e894487f090aa459d602";
+  sha256 = "12dw5shirnqbw037jg1sqk1aixyzl32w94y2nlan9by3cv7k3643";
 }
diff --git a/pkgs/development/interpreters/scsh/default.nix b/pkgs/development/interpreters/scsh/default.nix
index 98b4f55f79b..ad2bf945f96 100644
--- a/pkgs/development/interpreters/scsh/default.nix
+++ b/pkgs/development/interpreters/scsh/default.nix
@@ -1,26 +1,22 @@
-{stdenv, fetchurl}:
-
-let
-  pname = "scsh";
-  version = "0.6.7";
-  name = "${pname}-${version}";
-in
+{ stdenv, fetchgit, autoconf, automake, autoreconfHook, scheme48 }:
 
 stdenv.mkDerivation {
-  inherit name;
+  name = "scsh-0.7pre";
 
-  src = fetchurl {
-    url = "mirror://sourceforge/${pname}/${name}.tar.gz";
-    sha256 = "c4a9f7df2a0bb7a7aa3dafc918aa9e9a566d4ad33a55f0192889de172d1ddb7f";
+  src = fetchgit {
+    url = "git://github.com/scheme/scsh.git";
+    rev = "f99b8c5293628cfeaeb792019072e3a96841104f";
+    fetchSubmodules = true;
+    sha256 = "0fz1r0bmiii9ld91r84dqkqwhnqk0h6drdycq93zcy5ndyn12fqp";
   };
 
-  meta = {
+  buildInputs = [ autoconf automake autoreconfHook scheme48 ];
+  configureFlags = ''--with-scheme48=${scheme48}'';
+
+  meta = with stdenv.lib; {
     description = "A Scheme shell";
-    longDescription = ''
-      SCSH is an implementation of the Scheme shell.  It is implemented as
-      a heap image which is interpreted by the Scheme 48 virtual machine.
-    '';
     homepage = http://www.scsh.net/;
-    license = stdenv.lib.licenses.bsd3;
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ joachifm ];
   };
 }
diff --git a/pkgs/development/interpreters/self/default.nix b/pkgs/development/interpreters/self/default.nix
index f53e42f0bde..d37d6099394 100644
--- a/pkgs/development/interpreters/self/default.nix
+++ b/pkgs/development/interpreters/self/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, fetchgit, stdenv, xlibs, gcc44, makeWrapper, ncurses, cmake }:
+{ fetchurl, fetchgit, stdenv, xorg, gcc44, makeWrapper, ncurses, cmake }:
 
 stdenv.mkDerivation rec {
   # The Self wrapper stores source in $XDG_DATA_HOME/self or ~/.local/share/self 
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
   };
 
   # gcc 4.6 and above causes crashes on Self startup but gcc 4.4 works.
-  buildInputs = [ gcc44 ncurses xlibs.libX11 xlibs.libXext makeWrapper cmake ];
+  buildInputs = [ gcc44 ncurses xorg.libX11 xorg.libXext makeWrapper cmake ];
 
   selfWrapper = ./self;
 
diff --git a/pkgs/development/interpreters/spidermonkey/17.0.nix b/pkgs/development/interpreters/spidermonkey/17.0.nix
index 74f0fe2b83a..7573b546164 100644
--- a/pkgs/development/interpreters/spidermonkey/17.0.nix
+++ b/pkgs/development/interpreters/spidermonkey/17.0.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, nspr, perl, python, zip }:
+{ stdenv, fetchurl, pkgconfig, nspr, perl, python, zip, libffi, readline }:
 
 stdenv.mkDerivation rec {
   version = "17.0.0";
@@ -11,16 +11,26 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ nspr ];
 
-  buildInputs = [ pkgconfig perl python zip ];
+  buildInputs = [ pkgconfig perl python zip libffi readline ];
 
   postUnpack = "sourceRoot=\${sourceRoot}/js/src";
 
+  postPatch = ''
+    # Fixes an issue with version detection under perl 5.22.x
+    sed -i 's/(defined\((@TEMPLATE_FILE)\))/\1/' config/milestone.pl
+  '';
+
   preConfigure = ''
     export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${nspr}/include/nspr"
     export LIBXUL_DIST=$out
   '';
 
-  configureFlags = [ "--enable-threadsafe" "--with-system-nspr" ];
+  configureFlags = [
+    "--enable-threadsafe"
+    "--with-system-nspr"
+    "--with-system-ffi"
+    "--enable-readline"
+  ];
 
   # hack around a make problem, see https://github.com/NixOS/nixpkgs/issues/1279#issuecomment-29547393
   preBuild = "touch -- {.,shell,jsapi-tests}/{-lpthread,-ldl}";
@@ -39,6 +49,8 @@ stdenv.mkDerivation rec {
     paxmark mr jsapi-tests/jsapi-tests
   '';
 
+  postInstall = ''rm "$out"/lib/*.a''; # halve the output size
+
   meta = with stdenv.lib; {
     description = "Mozilla's JavaScript engine written in C/C++";
     homepage = https://developer.mozilla.org/en/SpiderMonkey;
diff --git a/pkgs/development/interpreters/spidermonkey/24.2.nix b/pkgs/development/interpreters/spidermonkey/24.2.nix
index 44fe4f60d53..3a9bd8ad7a4 100644
--- a/pkgs/development/interpreters/spidermonkey/24.2.nix
+++ b/pkgs/development/interpreters/spidermonkey/24.2.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, nspr, perl, python, zip }:
+{ stdenv, fetchurl, pkgconfig, nspr, perl, python, zip, libffi, readline }:
 
 stdenv.mkDerivation rec {
   version = "24.2.0";
@@ -11,7 +11,12 @@ stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ nspr ];
 
-  buildInputs = [ pkgconfig perl python zip ];
+  buildInputs = [ pkgconfig perl python zip libffi readline ];
+
+  postPatch = ''
+    # Fixes an issue with version detection under perl 5.22.x
+    sed -i 's/(defined\((@TEMPLATE_FILE)\))/\1/' config/milestone.pl
+  '';
 
   postUnpack = "sourceRoot=\${sourceRoot}/js/src";
 
@@ -20,7 +25,12 @@ stdenv.mkDerivation rec {
     export LIBXUL_DIST=$out
   '';
 
-  configureFlags = [ "--enable-threadsafe" "--with-system-nspr" ];
+  configureFlags = [
+    "--enable-threadsafe"
+    "--with-system-nspr"
+    "--with-system-ffi"
+    "--enable-readline"
+  ];
 
   # hack around a make problem, see https://github.com/NixOS/nixpkgs/issues/1279#issuecomment-29547393
   preBuild = "touch -- {.,shell,jsapi-tests}/{-lpthread,-ldl}";
diff --git a/pkgs/development/interpreters/spidermonkey/31.5.nix b/pkgs/development/interpreters/spidermonkey/31.5.nix
new file mode 100644
index 00000000000..4ee6658f59c
--- /dev/null
+++ b/pkgs/development/interpreters/spidermonkey/31.5.nix
@@ -0,0 +1,65 @@
+{ stdenv, fetchurl, pkgconfig, perl, python, zip, libffi, readline }:
+
+stdenv.mkDerivation rec {
+  version = "31.5.0";
+  name = "spidermonkey-${version}";
+
+  # the release notes point to some guys home directory, see
+  # https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Releases/31
+  # 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";
+    sha256 = "1q8icql5hh1g3gzg5fp4rl9rfagyhm9gilfn3dgi7qn4i1mrfqsd";
+  };
+
+  buildInputs = [ pkgconfig perl python zip libffi readline ];
+
+  postUnpack = "sourceRoot=\${sourceRoot}/js/src";
+
+  preConfigure = ''
+    export LIBXUL_DIST=$out
+  '';
+
+  configureFlags = [
+    "--enable-threadsafe"
+    "--with-system-ffi"
+    "--enable-readline"
+
+    # there is at least one unfixed issue building the tests, so I didn't bother
+    "--disable-tests"
+
+    # enabling these because they're wanted by 0ad. They may or may
+    # not be good defaults for other uses.
+    "--enable-gcgenerational"
+    "--enable-shared-js"
+
+    # Due to a build-system bug, this means the exact opposite of what it says.
+    # It is required by gcgenerational.
+    "--disable-exact-rooting"
+  ];
+
+  # This addresses some build system bug. It's quite likely to be safe
+  # to re-enable parallel builds if the source revision changes.
+  enableParallelBuilding = false;
+
+  # see comment by --disable-tests
+  doCheck = false;
+
+  postFixup = ''
+    # The headers are symlinks to a directory that doesn't get put
+    # into $out, so they end up broken. Fix that by just resolving the
+    # symlinks.
+    for i in $(find $out -type l); do
+      cp --remove-destination "$(readlink "$i")" "$i";
+    done
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Mozilla's JavaScript engine written in C/C++";
+    homepage = https://developer.mozilla.org/en/SpiderMonkey;
+    # TODO: MPL/GPL/LGPL tri-license.
+
+    maintainers = [ maintainers.goibhniu ];
+  };
+}
diff --git a/pkgs/development/interpreters/supercollider/default.nix b/pkgs/development/interpreters/supercollider/default.nix
index a8c967b5967..f44347c61b7 100644
--- a/pkgs/development/interpreters/supercollider/default.nix
+++ b/pkgs/development/interpreters/supercollider/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, cmake, pkgconfig
-, jack2, libsndfile, fftw, curl
+, libjack2, libsndfile, fftw, curl, gcc
 , libXt, qt, readline
 , useSCEL ? false, emacs
 }:
@@ -35,6 +35,6 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake pkgconfig ];
 
   buildInputs = [ 
-    jack2 libsndfile fftw curl libXt qt readline ]
+    gcc libjack2 libsndfile fftw curl libXt qt readline ]
     ++ optional useSCEL emacs;
 }
diff --git a/pkgs/development/interpreters/tcl/generic.nix b/pkgs/development/interpreters/tcl/generic.nix
index 8b5722c79c8..cfa4bb48c19 100644
--- a/pkgs/development/interpreters/tcl/generic.nix
+++ b/pkgs/development/interpreters/tcl/generic.nix
@@ -10,7 +10,9 @@ stdenv.mkDerivation rec {
 
   inherit src;
 
-  preConfigure = "cd unix";
+  preConfigure = ''
+    cd unix
+  '';
 
   postInstall = ''
     make install-private-headers
@@ -22,6 +24,7 @@ stdenv.mkDerivation rec {
     homepage = http://www.tcl.tk/;
     license = licenses.tcltk;
     platforms = platforms.all;
+    maintainers = with maintainers; [ wkennington ];
   };
   
   passthru = rec {
diff --git a/pkgs/development/interpreters/xulrunner/default.nix b/pkgs/development/interpreters/xulrunner/default.nix
index 1f24b4dde54..e5c6397ff82 100644
--- a/pkgs/development/interpreters/xulrunner/default.nix
+++ b/pkgs/development/interpreters/xulrunner/default.nix
@@ -1,5 +1,5 @@
 { lib, stdenv, fetchurl, pkgconfig, gtk, pango, perl, python, zip, libIDL
-, libjpeg, zlib, dbus, dbus_glib, bzip2, xlibs
+, libjpeg, zlib, dbus, dbus_glib, bzip2, xorg
 , freetype, fontconfig, file, alsaLib, nspr, nss, libnotify
 , yasm, mesa, sqlite, unzip, makeWrapper, pysqlite
 , hunspell, libevent, libstartup_notification, libvpx
@@ -18,11 +18,11 @@ stdenv.mkDerivation rec {
 
   buildInputs =
     [ pkgconfig gtk perl zip libIDL libjpeg zlib bzip2
-      python dbus dbus_glib pango freetype fontconfig xlibs.libXi
-      xlibs.libX11 xlibs.libXrender xlibs.libXft xlibs.libXt file
-      alsaLib nspr nss libnotify xlibs.pixman yasm mesa
-      xlibs.libXScrnSaver xlibs.scrnsaverproto pysqlite
-      xlibs.libXext xlibs.xextproto sqlite unzip makeWrapper
+      python dbus dbus_glib pango freetype fontconfig xorg.libXi
+      xorg.libX11 xorg.libXrender xorg.libXft xorg.libXt file
+      alsaLib nspr nss libnotify xorg.pixman yasm mesa
+      xorg.libXScrnSaver xorg.scrnsaverproto pysqlite
+      xorg.libXext xorg.xextproto sqlite unzip makeWrapper
       hunspell libevent libstartup_notification libvpx cairo
       gstreamer gst_plugins_base icu
     ];
@@ -54,6 +54,7 @@ stdenv.mkDerivation rec {
       "--disable-installer"
       "--disable-updater"
       "--disable-pulseaudio"
+      "--disable-gconf"
     ]
     ++ (if debugBuild
         then [ "--enable-debug" "--enable-profiling"]