summary refs log tree commit diff
diff options
context:
space:
mode:
-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.9.3.nix124
-rw-r--r--pkgs/development/interpreters/ruby/ruby-2.0.0.nix103
-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.1.6.nix124
-rw-r--r--pkgs/development/interpreters/ruby/ruby-2.2.0.nix113
-rw-r--r--pkgs/development/interpreters/ruby/ruby-2.2.2.nix112
-rw-r--r--pkgs/top-level/all-packages.nix24
12 files changed, 381 insertions, 1069 deletions
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.9.3.nix b/pkgs/development/interpreters/ruby/ruby-1.9.3.nix
deleted file mode 100644
index 1c4318e0168..00000000000
--- a/pkgs/development/interpreters/ruby/ruby-1.9.3.nix
+++ /dev/null
@@ -1,124 +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
-, libiconv, libobjc
-}:
-
-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 = "1r9xzzxmci2ajb34qb4y1w424mz878zdgzxkfp9w60agldxnb36s";
-  } else fetchurl {
-    url = "http://cache.ruby-lang.org/pub/ruby/1.9/${name}.tar.bz2";
-    sha256 = "07kpvv2z7g6shflls7fyfga8giifahwlnl30l49qdm9i6izf7idh";
-  };
-
-  # 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)
-    ++ (ops stdenv.isDarwin [ libiconv libobjc ]);
-
-  enableParallelBuilding = true;
-
-  patches = [
-    ./ruby19-parallel-install.patch
-    ./bitperfect-rdoc.patch
-  ] ++ ops useRailsExpress [
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/01-fix-make-clean.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/02-zero-broken-tests.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/03-railsbench-gc.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/04-display-more-detailed-stack-trace.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/05-fork-support-for-gc-logging.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/06-track-live-dataset-size.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/07-webrick_204_304_keep_alive_fix.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/08-export-a-few-more-symbols-for-ruby-prof.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/09-thread-variables.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/10-faster-loading.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/11-falcon-st-opt.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/12-falcon-sparse-array.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/13-falcon-array-queue.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/14-railsbench-gc-fixes.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/15-show-full-backtrace-on-stack-overflow.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/16-configurable-fiber-stack-sizes.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/17-backport-psych-20.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/18-fix-missing-c-return-event.patch"
-    "${patchSet}/patches/ruby/1.9.3/p${passthru.patchLevel}/railsexpress/19-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 = with stdenv.lib; {
-    license     = licenses.ruby;
-    homepage    = "http://www.ruby-lang.org/en/";
-    description = "The Ruby language";
-    maintainers = with maintainers; [ lovek323 ];
-    platforms   = platforms.all;
-  };
-
-  passthru = rec {
-    majorVersion = "1";
-    minorVersion = "9";
-    teenyVersion = "3";
-    patchLevel = "551";
-    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 dc6c70b676d..00000000000
--- a/pkgs/development/interpreters/ruby/ruby-2.0.0.nix
+++ /dev/null
@@ -1,103 +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 = "14bnas1iif2shyaz4ylb0832x96y2mda52x0v0aglkvqmcz1cfxb";
-  } else fetchurl {
-    url = "https://cache.ruby-lang.org/pub/ruby/2.0/${name}.tar.bz2";
-    sha256 = "1sc36qxqhziqbrvp99z4qdx9j0f8r1xhcbb6scb3m4nb02cwzk9d";
-  };
-
-  # 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/p${passthru.patchLevel}/railsexpress/01-zero-broken-tests.patch"
-    "${patchSet}/patches/ruby/2.0.0/p${passthru.patchLevel}/railsexpress/02-railsexpress-gc.patch"
-    "${patchSet}/patches/ruby/2.0.0/p${passthru.patchLevel}/railsexpress/03-display-more-detailed-stack-trace.patch"
-    "${patchSet}/patches/ruby/2.0.0/p${passthru.patchLevel}/railsexpress/04-show-full-backtrace-on-stack-overflow.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 = "645";
-    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 0fe9daa50e4..00000000000
--- a/pkgs/development/interpreters/ruby/ruby-2.1.0.nix
+++ /dev/null
@@ -1,120 +0,0 @@
-{ stdenv, lib, fetchurl, fetchFromSavannah, 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 { inherit fetchFromSavannah; };
-  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 8b2c04e853f..00000000000
--- a/pkgs/development/interpreters/ruby/ruby-2.1.1.nix
+++ /dev/null
@@ -1,118 +0,0 @@
-{ stdenv, lib, fetchurl, fetchFromSavannah, 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 { inherit fetchFromSavannah; };
-  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 2cad52cc56d..00000000000
--- a/pkgs/development/interpreters/ruby/ruby-2.1.2.nix
+++ /dev/null
@@ -1,117 +0,0 @@
-{ stdenv, lib, fetchurl, fetchFromSavannah, 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 { inherit fetchFromSavannah; };
-  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 50cc3484730..00000000000
--- a/pkgs/development/interpreters/ruby/ruby-2.1.3.nix
+++ /dev/null
@@ -1,121 +0,0 @@
-{ stdenv, lib, fetchurl, fetchFromSavannah, 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 { inherit fetchFromSavannah; };
-  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.1.6.nix b/pkgs/development/interpreters/ruby/ruby-2.1.6.nix
deleted file mode 100644
index 0bf89de1d98..00000000000
--- a/pkgs/development/interpreters/ruby/ruby-2.1.6.nix
+++ /dev/null
@@ -1,124 +0,0 @@
-{ stdenv, lib, fetchurl, fetchFromSavannah, 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_6, autoreconfHook, bison, useRailsExpress ? true
-, libiconv, libobjc, libunwind
-}:
-
-let
-  op = stdenv.lib.optional;
-  ops = stdenv.lib.optionals;
-  patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
-  config = import ./config.nix { inherit fetchFromSavannah; };
-  baseruby = ruby_2_1_6.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_6";
-    sha256 = "18kbjsbmgv6l3p1qxgmjnhh4jl7xdk3c20ycjpp62vrhq7pyzjsm";
-  } else fetchurl {
-    url = "http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.6.tar.gz";
-    sha256 = "1r4bs8lfwsypbcf8j2lpv3by40729vp5mh697njizj97fjp644qy";
-  };
-
-  # 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 [ libiconv libobjc libunwind ]);
-
-  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.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"
-  ];
-
-  # 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 = "6";
-    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 a29b7466400..00000000000
--- a/pkgs/development/interpreters/ruby/ruby-2.2.0.nix
+++ /dev/null
@@ -1,113 +0,0 @@
-{ stdenv, lib, fetchurl, fetchFromSavannah, 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
-, libiconv, libobjc, libunwind
-}:
-
-let
-  op = stdenv.lib.optional;
-  ops = stdenv.lib.optionals;
-  patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
-  config = import ./config.nix { inherit fetchFromSavannah; };
-  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)
-    ++ (ops stdenv.isDarwin [ libiconv libobjc libunwind ]);
-
-  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"
-  ];
-
-  postPatch = ops useRailsExpress ''
-    sed -i configure.in -e '/config.guess/d'
-    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/ruby-2.2.2.nix b/pkgs/development/interpreters/ruby/ruby-2.2.2.nix
deleted file mode 100644
index df40f674989..00000000000
--- a/pkgs/development/interpreters/ruby/ruby-2.2.2.nix
+++ /dev/null
@@ -1,112 +0,0 @@
-{ stdenv, lib, fetchurl, fetchFromSavannah, 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_2, autoreconfHook, bison, useRailsExpress ? true
-, libiconv, libobjc, libunwind
-}:
-
-let
-  op = stdenv.lib.optional;
-  ops = stdenv.lib.optionals;
-  patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
-  config = import ./config.nix { inherit fetchFromSavannah; };
-  baseruby = ruby_2_2_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_2_2";
-    sha256 = "08mw1ql2ghy483cp8xzzm78q17simn4l6phgm2gah7kjh9y3vbrn";
-  } else fetchurl {
-    url = "http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz";
-    sha256 = "0i4v7l8pnam0by2cza12zldlhrffqchwb2m9shlnp7j2gqqhzz2z";
-  };
-
-  # 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 [ libiconv libobjc libunwind ]);
-
-  enableParallelBuilding = true;
-
-  patches = 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"
-  ];
-
-  postPatch = ops useRailsExpress ''
-    sed -i configure.in -e '/config.guess/d'
-    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 = "2";
-    patchLevel = "0";
-    rubyEngine = "ruby";
-    libPath = "lib/${rubyEngine}/${majorVersion}.${minorVersion}.${teenyVersion}";
-    gemPath = "lib/${rubyEngine}/gems/${majorVersion}.${minorVersion}.${teenyVersion}";
-  };
-}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 5d5b7771d42..24a183f43eb 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -5091,23 +5091,13 @@ let
   bundlerEnv = callPackage ../development/interpreters/ruby/bundler-env { };
 
   ruby_1_8_7 = callPackage ../development/interpreters/ruby/ruby-1.8.7.nix { };
-  ruby_1_9_3 = callPackage ../development/interpreters/ruby/ruby-1.9.3.nix {
-    inherit (darwin) libobjc;
-  };
-  ruby_2_0_0 = callPackage ../development/interpreters/ruby/ruby-2.0.0.nix { };
-  ruby_2_1_0 = callPackage ../development/interpreters/ruby/ruby-2.1.0.nix { };
-  ruby_2_1_1 = callPackage ../development/interpreters/ruby/ruby-2.1.1.nix { };
-  ruby_2_1_2 = callPackage ../development/interpreters/ruby/ruby-2.1.2.nix { };
-  ruby_2_1_3 = callPackage ../development/interpreters/ruby/ruby-2.1.3.nix { };
-  ruby_2_1_6 = callPackage ../development/interpreters/ruby/ruby-2.1.6.nix {
-    inherit (darwin) libobjc libunwind;
-  };
-  ruby_2_2_0 = callPackage ../development/interpreters/ruby/ruby-2.2.0.nix {
-    inherit (darwin) libobjc libunwind;
-  };
-  ruby_2_2_2 = callPackage ../development/interpreters/ruby/ruby-2.2.2.nix {
-    inherit (darwin) libobjc libunwind;
-  };
+  inherit (callPackages ../development/interpreters/ruby {})
+    # TODO: uncomment when ruby_1_8_7 doesn't need autoconf
+    # ruby_1_8_7
+    ruby_1_9_3
+    ruby_2_0_0
+    ruby_2_1_0 ruby_2_1_1 ruby_2_1_2 ruby_2_1_3 ruby_2_1_6
+    ruby_2_2_0 ruby_2_2_2;
 
   # Ruby aliases
   ruby = ruby_2_2;