summary refs log tree commit diff
path: root/pkgs/development/interpreters
diff options
context:
space:
mode:
authorRobin Gloster <mail@glob.in>2016-03-28 15:16:29 +0000
committerRobin Gloster <mail@glob.in>2016-03-28 15:16:29 +0000
commitf60c9df0ba66767dfa64bf2fb95eb6776cafa2c3 (patch)
tree0f17999d3a5444f16f09e0c1d7f3075e0224e731 /pkgs/development/interpreters
parent3f45f0948d6fe158bed063adb66850ded0ba4861 (diff)
parentc61445357e2a92470bee43a71a10baef1a3196e4 (diff)
downloadnixlib-f60c9df0ba66767dfa64bf2fb95eb6776cafa2c3.tar
nixlib-f60c9df0ba66767dfa64bf2fb95eb6776cafa2c3.tar.gz
nixlib-f60c9df0ba66767dfa64bf2fb95eb6776cafa2c3.tar.bz2
nixlib-f60c9df0ba66767dfa64bf2fb95eb6776cafa2c3.tar.lz
nixlib-f60c9df0ba66767dfa64bf2fb95eb6776cafa2c3.tar.xz
nixlib-f60c9df0ba66767dfa64bf2fb95eb6776cafa2c3.tar.zst
nixlib-f60c9df0ba66767dfa64bf2fb95eb6776cafa2c3.zip
Merge remote-tracking branch 'upstream/master' into hardened-stdenv
Diffstat (limited to 'pkgs/development/interpreters')
-rw-r--r--pkgs/development/interpreters/clisp/2.44.1.nix2
-rw-r--r--pkgs/development/interpreters/clisp/default.nix2
-rw-r--r--pkgs/development/interpreters/erlang/R15.nix69
-rw-r--r--pkgs/development/interpreters/guile/default.nix2
-rw-r--r--pkgs/development/interpreters/hugs/default.nix21
-rw-r--r--pkgs/development/interpreters/io/default.nix3
-rw-r--r--pkgs/development/interpreters/nix-exec/default.nix4
-rw-r--r--pkgs/development/interpreters/octave/default.nix10
-rw-r--r--pkgs/development/interpreters/perl/default.nix2
-rw-r--r--pkgs/development/interpreters/php/default.nix8
-rw-r--r--pkgs/development/interpreters/ruby/build-ruby-gem/default.nix212
-rw-r--r--pkgs/development/interpreters/ruby/build-ruby-gem/gem-post-build.rb77
-rw-r--r--pkgs/development/interpreters/ruby/build-ruby-gem/nix-bundle-install.rb152
-rw-r--r--pkgs/development/interpreters/ruby/bundix/default.nix44
-rw-r--r--pkgs/development/interpreters/ruby/bundler-env/default.nix113
-rw-r--r--pkgs/development/interpreters/ruby/bundler-env/gen-bin-stubs.rb46
-rw-r--r--pkgs/development/interpreters/ruby/bundler.nix10
-rw-r--r--pkgs/development/interpreters/ruby/default.nix51
-rw-r--r--pkgs/development/interpreters/ruby/dev.nix24
-rw-r--r--pkgs/development/interpreters/ruby/gem_hook.patch29
-rw-r--r--pkgs/development/interpreters/ruby/gemconfig/default.nix166
-rw-r--r--pkgs/development/interpreters/ruby/gemconfig/mkrf_conf_xapian.rb14
-rw-r--r--pkgs/development/interpreters/ruby/gemconfig/xapian-Rakefile38
-rw-r--r--pkgs/development/interpreters/ruby/patches.nix138
-rw-r--r--pkgs/development/interpreters/ruby/rubygems-src.nix8
-rw-r--r--pkgs/development/interpreters/ruby/rubygems.nix35
-rw-r--r--pkgs/development/interpreters/self/default.nix4
27 files changed, 121 insertions, 1163 deletions
diff --git a/pkgs/development/interpreters/clisp/2.44.1.nix b/pkgs/development/interpreters/clisp/2.44.1.nix
index 42709abc1432..b7b329ea9560 100644
--- a/pkgs/development/interpreters/clisp/2.44.1.nix
+++ b/pkgs/development/interpreters/clisp/2.44.1.nix
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
     cd builddir
   '';
 
-  NIX_CFLAGS_COMPILE="-O0";
+  NIX_CFLAGS_COMPILE = "-O0 ${stdenv.lib.optionalString (!stdenv.is64bit) "-falign-functions=4"}";
 
   hardeningDisable = [ "format" ];
 
diff --git a/pkgs/development/interpreters/clisp/default.nix b/pkgs/development/interpreters/clisp/default.nix
index b8af3f6d7479..919c3771bc5d 100644
--- a/pkgs/development/interpreters/clisp/default.nix
+++ b/pkgs/development/interpreters/clisp/default.nix
@@ -53,7 +53,7 @@ stdenv.mkDerivation rec {
         clx/new-clx bindings/glibc pcre rawsock wildcard zlib
   '';
 
-  NIX_CFLAGS_COMPILE="-O0";
+  NIX_CFLAGS_COMPILE = "-O0 ${stdenv.lib.optionalString (!stdenv.is64bit) "-falign-functions=4"}";
 
   # TODO : make mod-check fails
   doCheck = false;
diff --git a/pkgs/development/interpreters/erlang/R15.nix b/pkgs/development/interpreters/erlang/R15.nix
deleted file mode 100644
index 137bae6e4616..000000000000
--- a/pkgs/development/interpreters/erlang/R15.nix
+++ /dev/null
@@ -1,69 +0,0 @@
-{ stdenv, fetchurl, perl, gnum4, ncurses, openssl
-, makeWrapper, gnused, gawk
-, wxSupport ? false, mesa ? null, wxGTK ? null, xorg ? null }:
-
-assert wxSupport -> mesa != null && wxGTK != null && xorg != null;
-
-let version = "15B03"; in
-
-stdenv.mkDerivation {
-  name = "erlang-" + version;
-
-  src = fetchurl {
-    url = "http://www.erlang.org/download/otp_src_R15B03-1.tar.gz";
-    sha256 = "4bccac86dd76aec050252e44276a0283a0df9218e6470cf042a9b9f9dfc9476c";
-  };
-
-  buildInputs =
-    [ perl gnum4 ncurses openssl
-      makeWrapper
-    ] ++ stdenv.lib.optional wxSupport [ mesa wxGTK xorg.libX11 ];
-
-  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}";
-
-  postInstall = let
-    manpages = fetchurl {
-      url = "http://www.erlang.org/download/otp_doc_man_R${version}.tar.gz";
-      sha256 = "0sqamzbd7qyz3klgl9vm1qvl0rhsfd1dx485pb0m2185qvw02nha";
-    };
-  in ''
-    tar xf "${manpages}" -C "$out/lib/erlang"
-    for i in "$out"/lib/erlang/man/man[0-9]/*.[0-9]; do
-      prefix="''${i%/*}"
-      ensureDir "$out/share/man/''${prefix##*/}"
-      ln -s "$i" "$out/share/man/''${prefix##*/}/''${i##*/}erl"
-    done
-  '';
-
-  # 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"
-  '';
-
-  setupHook = ./setup-hook.sh;
-
-  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 = stdenv.lib.platforms.linux;
-    maintainers = [ stdenv.lib.maintainers.simons ];
-  };
-}
diff --git a/pkgs/development/interpreters/guile/default.nix b/pkgs/development/interpreters/guile/default.nix
index c4634de5d3f2..5e2883f9fb3c 100644
--- a/pkgs/development/interpreters/guile/default.nix
+++ b/pkgs/development/interpreters/guile/default.nix
@@ -40,6 +40,8 @@
   # don't have "libgcc_s.so.1" on darwin
   LDFLAGS = stdenv.lib.optionalString (!stdenv.isDarwin) "-lgcc_s";
 
+  configureFlags = [ "--with-libreadline-prefix" ];
+
   postInstall = ''
     wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin"
 
diff --git a/pkgs/development/interpreters/hugs/default.nix b/pkgs/development/interpreters/hugs/default.nix
index b1c3df28d1f2..14afe0279c38 100644
--- a/pkgs/development/interpreters/hugs/default.nix
+++ b/pkgs/development/interpreters/hugs/default.nix
@@ -6,10 +6,18 @@ stdenv.mkDerivation {
 
   src = fetchurl {
     url = http://cvs.haskell.org/Hugs/downloads/2006-09/hugs98-Sep2006.tar.gz;
-    sha256 = "3cf4d27673564cffe691bd14032369f646233f14daf2bc37c6c6df9f062b46b6";
+    sha256 = "1dj65c39zpy6qqvvrwns2hzj6ipnd4ih655xj7kgyk2nfdvd5x1w";
   };
 
-  buildInputs = [ bison ];
+  patches =
+    [ (fetchurl {
+        url = https://aur.archlinux.org/cgit/aur.git/plain/hsbase_inline.patch?h=hugs;
+        name = "hsbase_inline.patch";
+        sha256 = "1h0sp16d17hlm6gj7zdbgwrjwi2l4q02m8p0wd60dp4gn9i9js0v";
+      })
+    ];
+
+  nativeBuildInputs = [ bison ];
 
   postUnpack = "find -type f -exec sed -i 's@/bin/cp@cp@' {} +";
 
@@ -29,10 +37,11 @@ stdenv.mkDerivation {
     "--enable-pthreads"                 # build Hugs using POSIX threads C library
   ];
 
-  meta = {
-    homepage = http://www.haskell.org/hugs;
+  meta = with stdenv.lib; {
+    homepage = https://www.haskell.org/hugs;
     description = "Haskell interpreter";
-    license = "as-is";                          # gentoo labels it this way
-    platforms = stdenv.lib.platforms.unix;      # arbitrary choice
+    maintainers = with maintainers; [ joachifm ];
+    license = licenses.bsd3;
+    platforms = platforms.all;
   };
 }
diff --git a/pkgs/development/interpreters/io/default.nix b/pkgs/development/interpreters/io/default.nix
index f4854c237bd2..4f4880aaca72 100644
--- a/pkgs/development/interpreters/io/default.nix
+++ b/pkgs/development/interpreters/io/default.nix
@@ -18,7 +18,8 @@ stdenv.mkDerivation {
     freeglut libsamplerate pcre libevent libedit yajl
   ];
 
-  cmakeFlags = [ "-DCMAKE_BUILD_TYPE=release" ];
+  # for gcc5; c11 inline semantics breaks the build
+  NIX_CFLAGS_COMPILE = "-fgnu89-inline";
 
   meta = {
     description = "Io programming language";
diff --git a/pkgs/development/interpreters/nix-exec/default.nix b/pkgs/development/interpreters/nix-exec/default.nix
index 44c2a56d4fcb..ad585f085db9 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.1.3";
+  version = "4.1.5";
 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 = "0zhydidxj7dvgvszrlzwb0wj4s7xb42kdmn0fv5c7jz3nvnhdykp";
+    sha256 = "1npy1did5ysacshclpfxihgh5bc0i9jqmvgxi1fp8prhcdhall9m";
   };
 
   buildInputs = [ pkgconfig nix git ];
diff --git a/pkgs/development/interpreters/octave/default.nix b/pkgs/development/interpreters/octave/default.nix
index bdf6f7752777..e0dd5a65644b 100644
--- a/pkgs/development/interpreters/octave/default.nix
+++ b/pkgs/development/interpreters/octave/default.nix
@@ -18,11 +18,11 @@ let
 in
 
 stdenv.mkDerivation rec {
-  version = "4.0.0";
+  version = "4.0.1";
   name = "octave-${version}";
   src = fetchurl {
     url = "mirror://gnu/octave/${name}.tar.xz";
-    sha256 = "0x64b2lna4vrlm4wwx6h1qdlmki6s2b9q90yjxldlvvrqvxf4syg";
+    sha256 = "11y2w6jgngj4rxiy136mkcs02l52rxk60kapyfc4rgrxz5hli3ym";
   };
 
   buildInputs = [ gfortran readline ncurses perl flex texinfo qhull libX11
@@ -40,11 +40,9 @@ stdenv.mkDerivation rec {
     ++ (stdenv.lib.optional (python != null) python)
     ;
 
-  # there is a mysterious sh: command not found
-  doCheck = false;
+  doCheck = true;
 
-  # problems on Hydra
-  enableParallelBuilding = false;
+  enableParallelBuilding = true;
 
   configureFlags =
     [ "--enable-readline"
diff --git a/pkgs/development/interpreters/perl/default.nix b/pkgs/development/interpreters/perl/default.nix
index 1e14d386b138..021498300039 100644
--- a/pkgs/development/interpreters/perl/default.nix
+++ b/pkgs/development/interpreters/perl/default.nix
@@ -116,7 +116,7 @@ let
 
 in rec {
 
-  perl = perl520;
+  perl = perl522;
 
   perl520 = common {
     version = "5.20.3";
diff --git a/pkgs/development/interpreters/php/default.nix b/pkgs/development/interpreters/php/default.nix
index 0c28d9cb2991..91beac4cd285 100644
--- a/pkgs/development/interpreters/php/default.nix
+++ b/pkgs/development/interpreters/php/default.nix
@@ -290,13 +290,13 @@ let
 in {
 
   php55 = generic {
-    version = "5.5.32";
-    sha256 = "1vljdvyqsq0vas4yhvpqycqyxl2gfndbmak6cfgxn1cfvc4c3wmh";
+    version = "5.5.33";
+    sha256 = "1a8ac1zcq68irvdffh08cpi4aaaira4hsqwgns7b95pm9pnv3464";
   };
 
   php56 = generic {
-    version = "5.6.18";
-    sha256 = "1vgl2zjq6ws5cjjb3llhwpfwg9gasq3q84ibdv9hj8snm4llmkf3";
+    version = "5.6.19";
+    sha256 = "0s61fncsdgr1mqgh8jma6pi6xxz4gl350467lk00ls3i97wa691a";
   };
 
   php70 = generic {
diff --git a/pkgs/development/interpreters/ruby/build-ruby-gem/default.nix b/pkgs/development/interpreters/ruby/build-ruby-gem/default.nix
deleted file mode 100644
index db1ef4c6c439..000000000000
--- a/pkgs/development/interpreters/ruby/build-ruby-gem/default.nix
+++ /dev/null
@@ -1,212 +0,0 @@
-# This builds gems in a way that is compatible with bundler.
-#
-# Bundler installs gems from git sources _very_ differently from how RubyGems
-# installes gem packages, though they both install gem packages similarly.
-#
-# We monkey-patch Bundler to remove any impurities and then drive its internals
-# to install git gems.
-#
-# For the sake of simplicity, gem packages are installed with the standard `gem`
-# program.
-#
-# Note that bundler does not support multiple prefixes; it assumes that all
-# gems are installed in a common prefix, and has no support for specifying
-# otherwise. Therefore, if you want to be able to use the resulting derivations
-# with bundler, you need to create a symlink forrest first, which is what
-# `bundlerEnv` does for you.
-#
-# Normal gem packages can be used outside of bundler; a binstub is created in
-# $out/bin.
-
-{ lib, ruby, rubygems, bundler, fetchurl, fetchgit, makeWrapper, git,
-  buildRubyGem, darwin
-} @ defs:
-
-lib.makeOverridable (
-
-{ name ? null
-, gemName
-, version ? null
-, type ? "gem"
-, document ? [] # e.g. [ "ri" "rdoc" ]
-, platform ? "ruby"
-, ruby ? defs.ruby
-, stdenv ? ruby.stdenv
-, namePrefix ? (let
-    rubyName = builtins.parseDrvName ruby.name;
-  in "${rubyName.name}${rubyName.version}-")
-, buildInputs ? []
-, doCheck ? false
-, meta ? {}
-, patches ? []
-, gemPath ? []
-, dontStrip ? true
-, remotes ? ["https://rubygems.org"]
-# Assume we don't have to build unless strictly necessary (e.g. the source is a
-# git checkout).
-# If you need to apply patches, make sure to set `dontBuild = false`;
-, dontBuild ? true
-, propagatedBuildInputs ? []
-, propagatedUserEnvPkgs ? []
-, buildFlags ? null
-, passthru ? {}
-, ...} @ attrs:
-
-let
-  shellEscape = x: "'${lib.replaceChars ["'"] [("'\\'" + "'")] x}'";
-  rubygems = (attrs.rubygems or defs.rubygems).override {
-    inherit ruby;
-  };
-  src = attrs.src or (
-    if type == "gem" then
-      fetchurl {
-        urls = map (remote: "${remote}/gems/${gemName}-${version}.gem") remotes;
-        inherit (attrs) sha256;
-      }
-    else if type == "git" then
-      fetchgit {
-        inherit (attrs) url rev sha256 fetchSubmodules;
-        leaveDotGit = true;
-      }
-    else
-      throw "buildRubyGem: don't know how to build a gem of type \"${type}\""
-  );
-  documentFlag =
-    if document == []
-    then "-N"
-    else "--document ${lib.concatStringsSep "," document}";
-
-in
-
-stdenv.mkDerivation (attrs // {
-  inherit ruby rubygems;
-  inherit doCheck;
-  inherit dontBuild;
-  inherit dontStrip;
-  inherit type;
-
-  buildInputs = [
-    ruby rubygems makeWrapper
-  ] ++ lib.optionals (type == "git") [ git bundler ]
-    ++ lib.optional stdenv.isDarwin darwin.libobjc
-    ++ buildInputs;
-
-  name = attrs.name or "${namePrefix}${gemName}-${version}";
-
-  inherit src;
-
-  phases = attrs.phases or [ "unpackPhase" "patchPhase" "buildPhase" "installPhase" "fixupPhase" ];
-
-  unpackPhase = attrs.unpackPhase or ''
-    runHook preUnpack
-
-    if [[ -f $src && $src == *.gem ]]; then
-      if [[ -z "$dontBuild" ]]; then
-        # we won't know the name of the directory that RubyGems creates,
-        # so we'll just use a glob to find it and move it over.
-        gempkg="$src"
-        sourceRoot=source
-        gem unpack $gempkg --target=container
-        cp -r container/* $sourceRoot
-        rm -r container
-
-        # copy out the original gemspec, for convenience during patching /
-        # overrides.
-        gem specification $gempkg  --ruby > original.gemspec
-        gemspec=$(readlink -f .)/original.gemspec
-      else
-        gempkg="$src"
-      fi
-    else
-      # Fall back to the original thing for everything else.
-      dontBuild=""
-      preUnpack="" postUnpack="" unpackPhase
-    fi
-
-    runHook postUnpack
-  '';
-
-  buildPhase = attrs.buildPhase or ''
-    runHook preBuild
-
-    if [[ "$type" == "gem" ]]; then
-      if [[ -z "$gemspec" ]]; then
-        gemspec="$(find . -name '*.gemspec')"
-        echo "found the following gemspecs:"
-        echo "$gemspec"
-        gemspec="$(echo "$gemspec" | head -n1)"
-      fi
-
-      exec 3>&1
-      output="$(gem build $gemspec | tee >(cat - >&3))"
-      exec 3>&-
-
-      gempkg=$(echo "$output" | grep -oP 'File: \K(.*)')
-
-      echo "gem package built: $gempkg"
-    fi
-
-    runHook postBuild
-  '';
-
-  # Note:
-  #   We really do need to keep the $out/${ruby.gemPath}/cache.
-  #   This is very important in order for many parts of RubyGems/Bundler to not blow up.
-  #   See https://github.com/bundler/bundler/issues/3327
-  installPhase = attrs.installPhase or ''
-    runHook preInstall
-
-    export GEM_HOME=$out/${ruby.gemPath}
-    mkdir -p $GEM_HOME
-
-    echo "buildFlags: $buildFlags"
-
-    ${lib.optionalString (type == "git") ''
-    ruby ${./nix-bundle-install.rb} \
-      ${gemName} \
-      ${attrs.url} \
-      ${src} \
-      ${attrs.rev} \
-      ${version} \
-      ${shellEscape (toString buildFlags)}
-    ''}
-
-    ${lib.optionalString (type == "gem") ''
-    if [[ -z "$gempkg" ]]; then
-      echo "failure: \$gempkg path unspecified" 1>&2
-      exit 1
-    elif [[ ! -f "$gempkg" ]]; then
-      echo "failure: \$gempkg path invalid" 1>&2
-      exit 1
-    fi
-
-    gem install \
-      --local \
-      --force \
-      --http-proxy 'http://nodtd.invalid' \
-      --ignore-dependencies \
-      --build-root '/' \
-      --backtrace \
-      ${documentFlag} \
-      $gempkg $gemFlags -- $buildFlags
-
-    # looks like useless files which break build repeatability and consume space
-    rm -fv $out/${ruby.gemPath}/doc/*/*/created.rid || true
-    rm -fv $out/${ruby.gemPath}/gems/*/ext/*/mkmf.log || true
-
-    # write out metadata and binstubs
-    spec=$(echo $out/${ruby.gemPath}/specifications/*.gemspec)
-    ruby ${./gem-post-build.rb} "$spec"
-    ''}
-
-    runHook postInstall
-  '';
-
-  propagatedBuildInputs = gemPath ++ propagatedBuildInputs;
-  propagatedUserEnvPkgs = gemPath ++ propagatedUserEnvPkgs;
-
-  passthru = passthru // { isRubyGem = true; };
-  inherit meta;
-})
-
-)
diff --git a/pkgs/development/interpreters/ruby/build-ruby-gem/gem-post-build.rb b/pkgs/development/interpreters/ruby/build-ruby-gem/gem-post-build.rb
deleted file mode 100644
index 112a9accc335..000000000000
--- a/pkgs/development/interpreters/ruby/build-ruby-gem/gem-post-build.rb
+++ /dev/null
@@ -1,77 +0,0 @@
-require 'rbconfig'
-require 'rubygems'
-require 'rubygems/specification'
-require 'fileutils'
-
-ruby = File.join(ENV["ruby"], "bin", RbConfig::CONFIG['ruby_install_name'])
-out = ENV["out"]
-bin_path = File.join(ENV["out"], "bin")
-gem_home = ENV["GEM_HOME"]
-gem_path = ENV["GEM_PATH"].split(":")
-install_path = Dir.glob("#{gem_home}/gems/*").first
-gemspec_path = ARGV[0]
-
-if defined?(Encoding.default_internal)
-  Encoding.default_internal = Encoding::UTF_8
-  Encoding.default_external = Encoding::UTF_8
-end
-
-gemspec_content = File.read(gemspec_path)
-spec = nil
-if gemspec_content[0..2] == "---" # YAML header
-  spec = Gem::Specification.from_yaml(gemspec_content)
-else
-  spec = Gem::Specification.load(gemspec_path)
-end
-
-FileUtils.mkdir_p("#{out}/nix-support")
-
-# write meta-data
-meta = "#{out}/nix-support/gem-meta"
-FileUtils.mkdir_p(meta)
-FileUtils.ln_s(gemspec_path, "#{meta}/spec")
-File.open("#{meta}/name", "w") do |f|
-  f.write(spec.name)
-end
-File.open("#{meta}/install-path", "w") do |f|
-  f.write(install_path)
-end
-File.open("#{meta}/require-paths", "w") do |f|
-  f.write(spec.require_paths.join(" "))
-end
-File.open("#{meta}/executables", "w") do |f|
-  f.write(spec.executables.join(" "))
-end
-
-# add this gem to the GEM_PATH for dependencies
-File.open("#{out}/nix-support/setup-hook", "a") do |f|
-  f.puts("addToSearchPath GEM_PATH #{gem_home}")
-  spec.require_paths.each do |dir|
-    f.puts("addToSearchPath RUBYLIB #{install_path}/#{dir}")
-  end
-end
-
-# create regular rubygems binstubs
-FileUtils.mkdir_p(bin_path)
-spec.executables.each do |exe|
-  File.open("#{bin_path}/#{exe}", "w") do |f|
-    f.write(<<-EOF)
-#!#{ruby}
-#
-# This file was generated by Nix.
-#
-# The application '#{exe}' is installed as part of a gem, and
-# this file is here to facilitate running it.
-#
-
-gem_path = ENV["GEM_PATH"]
-ENV["GEM_PATH"] = "\#{gem_path}\#{":" unless gem_path.nil? || gem_path.empty?}#{(gem_path+[gem_home]).join(":")}"
-
-require 'rubygems'
-
-load Gem.bin_path(#{spec.name.inspect}, #{exe.inspect})
-    EOF
-  end
-
-  FileUtils.chmod("+x", "#{bin_path}/#{exe}")
-end
diff --git a/pkgs/development/interpreters/ruby/build-ruby-gem/nix-bundle-install.rb b/pkgs/development/interpreters/ruby/build-ruby-gem/nix-bundle-install.rb
deleted file mode 100644
index 48ab5270c22f..000000000000
--- a/pkgs/development/interpreters/ruby/build-ruby-gem/nix-bundle-install.rb
+++ /dev/null
@@ -1,152 +0,0 @@
-require 'rbconfig'
-require 'bundler/vendored_thor'
-require 'bundler'
-require 'rubygems/command'
-require 'fileutils'
-require 'pathname'
-require 'tmpdir'
-
-# Options:
-#
-#   name        - the gem name
-#   uri         - git repo uri
-#   repo        - path to local checkout
-#   ref         - the commit hash
-#   version     - gem version
-#   build-flags - build arguments
-
-ruby = File.join(ENV["ruby"], "bin", RbConfig::CONFIG['ruby_install_name'])
-out = ENV["out"]
-bin_dir = File.join(ENV["out"], "bin")
-
-name        = ARGV[0]
-uri         = ARGV[1]
-REPO        = ARGV[2]
-ref         = ARGV[3]
-version     = ARGV[4]
-build_flags = ARGV[5]
-
-# options to pass to bundler
-options = {
-  "name"    => name,
-  "uri"     => uri,
-  "ref"     => ref,
-  "version" => version,
-}
-
-# Monkey-patch Bundler to use our local checkout.
-# I wish we didn't have to do this, but bundler does not expose an API to do
-# these kinds of things.
-Bundler.module_eval do
-  def self.requires_sudo?
-    false
-  end
-
-  def self.root
-    # we don't have a Gemfile, so it doesn't make sense to try to make paths
-    # relative to the (non existent) parent directory thereof, so we give a
-    # nonsense path here.
-    Pathname.new("/no-root-path")
-  end
-
-  def self.bundle_path
-    Pathname.new(ENV["GEM_HOME"])
-  end
-
-  def self.locked_gems
-    nil
-  end
-end
-
-Bundler::Source::Git.class_eval do
-  def allow_git_ops?
-    true
-  end
-end
-
-Bundler::Source::Git::GitProxy.class_eval do
-  def checkout
-    unless path.exist?
-      FileUtils.mkdir_p(path.dirname)
-      FileUtils.cp_r(File.join(REPO, ".git"), path)
-      system("chmod -R +w #{path}")
-    end
-  end
-
-  def copy_to(destination, submodules=false)
-    unless File.exist?(destination.join(".git"))
-      FileUtils.mkdir_p(destination.dirname)
-      FileUtils.cp_r(REPO, destination)
-      system("chmod -R +w #{destination}")
-    end
-  end
-end
-
-# UI
-verbose = false
-no_color = false
-Bundler.ui = Bundler::UI::Shell.new({"no-color" => no_color})
-Bundler.ui.level = "debug" if verbose
-
-# Install
-source = Bundler::Source::Git.new(options)
-spec = source.specs.search_all(name).first
-Bundler.rubygems.with_build_args [build_flags] do
-  source.install(spec)
-end
-
-msg = spec.post_install_message
-if msg
-  Bundler.ui.confirm "Post-install message from #{name}:"
-  Bundler.ui.info msg
-end
-
-# Write out the binstubs
-if spec.executables.any?
-  FileUtils.mkdir_p(bin_dir)
-  spec.executables.each do |exe|
-    wrapper = File.join(bin_dir, exe)
-    File.open(wrapper, "w") do |f|
-      f.write(<<-EOF)
-#!#{ruby}
-#
-# This file was generated by Nix.
-#
-# The application '#{exe}' is installed as part of a gem, and
-# this file is here to facilitate running it.
-#
-
-require 'rubygems'
-require 'bundler/setup'
-
-load Gem.bin_path(#{spec.name.inspect}, #{exe.inspect})
-EOF
-    end
-
-    FileUtils.chmod("+x", wrapper)
-  end
-end
-
-# Write out metadata
-meta = "#{out}/nix-support/gem-meta"
-FileUtils.mkdir_p(meta)
-FileUtils.ln_s(spec.loaded_from.to_s, "#{meta}/spec")
-File.open("#{meta}/name", "w") do |f|
-  f.write spec.name
-end
-File.open("#{meta}/install-path", "w") do |f|
-  f.write source.install_path.to_s
-end
-File.open("#{meta}/require-paths", "w") do |f|
-  f.write spec.require_paths.join(" ")
-end
-File.open("#{meta}/executables", "w") do |f|
-  f.write spec.executables.join(" ")
-end
-
-# make the lib available during bundler/git installs
-File.open("#{out}/nix-support/setup-hook", "a") do |f|
-  spec.require_paths.each do |dir|
-    f.puts("addToSearchPath RUBYLIB #{source.install_path}/#{dir}")
-  end
-end
diff --git a/pkgs/development/interpreters/ruby/bundix/default.nix b/pkgs/development/interpreters/ruby/bundix/default.nix
deleted file mode 100644
index 21b42ae020a3..000000000000
--- a/pkgs/development/interpreters/ruby/bundix/default.nix
+++ /dev/null
@@ -1,44 +0,0 @@
-{ buildRubyGem, lib, bundler, ruby, nix, nix-prefetch-git }:
-
-buildRubyGem rec {
-  inherit ruby;
-
-  name = "${gemName}-${version}";
-  gemName = "bundix";
-  version = "2.0.6";
-
-  sha256 = "0yd960awd427mg29r2yzhccd0vjimn1ljr8d8hncj6m6wg84nvh5";
-
-  buildInputs = [bundler];
-
-  postInstall = ''
-    substituteInPlace $GEM_HOME/gems/${gemName}-${version}/lib/bundix.rb \
-      --replace \
-        "'nix-instantiate'" \
-        "'${nix}/bin/nix-instantiate'" \
-      --replace \
-        "'nix-hash'" \
-        "'${nix}/bin/nix-hash'" \
-      --replace \
-        "'nix-prefetch-url'" \
-        "'${nix}/bin/nix-prefetch-url'" \
-      --replace \
-        "'nix-prefetch-git'" \
-        "'${nix-prefetch-git}/bin/nix-prefetch-git'"
-  '';
-
-  meta = {
-    inherit version;
-    description = "Creates Nix packages from Gemfiles";
-    longDescription = ''
-      This is a tool that converts Gemfile.lock files to nix expressions.
-
-      The output is then usable by the bundlerEnv derivation to list all the
-      dependencies of a ruby package.
-    '';
-    homepage = "https://github.com/manveru/bundix";
-    license = "MIT";
-    maintainers = with lib.maintainers; [ manveru zimbatm ];
-    platforms = lib.platforms.all;
-  };
-}
diff --git a/pkgs/development/interpreters/ruby/bundler-env/default.nix b/pkgs/development/interpreters/ruby/bundler-env/default.nix
deleted file mode 100644
index 0c9ed40d3f82..000000000000
--- a/pkgs/development/interpreters/ruby/bundler-env/default.nix
+++ /dev/null
@@ -1,113 +0,0 @@
-{ stdenv, runCommand, writeText, writeScript, writeScriptBin, ruby, lib
-, callPackage, defaultGemConfig, fetchurl, fetchgit, buildRubyGem, buildEnv
-, rubygems
-, git
-, makeWrapper
-, bundler
-, tree
-}@defs:
-
-{ name, gemset, gemfile, lockfile, ruby ? defs.ruby, gemConfig ? defaultGemConfig
-, postBuild ? null
-, document ? []
-, meta ? {}
-, ignoreCollisions ? false
-, ...
-}@args:
-
-let
-
-  shellEscape = x: "'${lib.replaceChars ["'"] [("'\\'" + "'")] x}'";
-  importedGemset = import gemset;
-  applyGemConfigs = attrs:
-    (if gemConfig ? "${attrs.gemName}"
-    then attrs // gemConfig."${attrs.gemName}" attrs
-    else attrs);
-  configuredGemset = lib.flip lib.mapAttrs importedGemset (name: attrs:
-    applyGemConfigs (attrs // { gemName = name; })
-  );
-  hasBundler = builtins.hasAttr "bundler" importedGemset;
-  bundler = if hasBundler then gems.bundler else defs.bundler.override (attrs: { inherit ruby; });
-  rubygems = defs.rubygems.override (attrs: { inherit ruby; });
-  gems = lib.flip lib.mapAttrs configuredGemset (name: attrs:
-    buildRubyGem ((removeAttrs attrs ["source"]) // attrs.source // {
-      inherit ruby rubygems;
-      gemName = name;
-      gemPath = map (gemName: gems."${gemName}") (attrs.dependencies or []);
-    }));
-  # We have to normalize the Gemfile.lock, otherwise bundler tries to be
-  # helpful by doing so at run time, causing executables to immediately bail
-  # out. Yes, I'm serious.
-  confFiles = runCommand "gemfile-and-lockfile" {} ''
-    mkdir -p $out
-    cp ${gemfile} $out/Gemfile
-    cp ${lockfile} $out/Gemfile.lock
-
-    cd $out
-    chmod +w Gemfile.lock
-    source ${rubygems}/nix-support/setup-hook
-    export GEM_PATH=${bundler}/${ruby.gemPath}
-    ${ruby}/bin/ruby -rubygems -e \
-      "require 'bundler'; Bundler.definition.lock('Gemfile.lock')"
-  '';
-  envPaths = lib.attrValues gems ++ lib.optional (!hasBundler) bundler;
-  bundlerEnv = buildEnv {
-    inherit name ignoreCollisions;
-    paths = envPaths;
-    pathsToLink = [ "/lib" ];
-    postBuild = ''
-      source ${rubygems}/nix-support/setup-hook
-
-      ${ruby}/bin/ruby ${./gen-bin-stubs.rb} \
-        "${ruby}/bin/ruby" \
-        "${confFiles}/Gemfile" \
-        "$out/${ruby.gemPath}" \
-        "${bundler}/${ruby.gemPath}" \
-        ${shellEscape (toString envPaths)}
-    '' + lib.optionalString (postBuild != null) postBuild;
-    passthru = rec {
-      inherit ruby bundler meta gems;
-
-      wrappedRuby = stdenv.mkDerivation {
-        name = "wrapped-ruby-${name}";
-        nativeBuildInputs = [ makeWrapper ];
-        buildCommand = ''
-          mkdir -p $out/bin
-          for i in ${ruby}/bin/*; do
-            makeWrapper "$i" $out/bin/$(basename "$i") \
-              --set BUNDLE_GEMFILE ${confFiles}/Gemfile \
-              --set BUNDLE_PATH ${bundlerEnv}/${ruby.gemPath} \
-              --set GEM_HOME ${bundlerEnv}/${ruby.gemPath} \
-              --set GEM_PATH ${bundlerEnv}/${ruby.gemPath}
-          done
-        '';
-      };
-
-      env = let
-        irbrc = builtins.toFile "irbrc" ''
-          if !(ENV["OLD_IRBRC"].nil? || ENV["OLD_IRBRC"].empty?)
-            require ENV["OLD_IRBRC"]
-          end
-          require 'rubygems'
-          require 'bundler/setup'
-        '';
-        in stdenv.mkDerivation {
-          name = "interactive-${name}-environment";
-          nativeBuildInputs = [ wrappedRuby bundlerEnv ];
-          shellHook = ''
-            export OLD_IRBRC="$IRBRC"
-            export IRBRC=${irbrc}
-          '';
-          buildCommand = ''
-            echo >&2 ""
-            echo >&2 "*** Ruby 'env' attributes are intended for interactive nix-shell sessions, not for building! ***"
-            echo >&2 ""
-            exit 1
-          '';
-        };
-    };
-  };
-
-in
-
-bundlerEnv
diff --git a/pkgs/development/interpreters/ruby/bundler-env/gen-bin-stubs.rb b/pkgs/development/interpreters/ruby/bundler-env/gen-bin-stubs.rb
deleted file mode 100644
index fac9c9ad9446..000000000000
--- a/pkgs/development/interpreters/ruby/bundler-env/gen-bin-stubs.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-require 'rbconfig'
-require 'rubygems'
-require 'rubygems/specification'
-require 'fileutils'
-
-# args/settings
-out = ENV["out"]
-ruby = ARGV[0]
-gemfile = ARGV[1]
-bundle_path = ARGV[2]
-bundler_gem_path = ARGV[3]
-paths = ARGV[4].split
-
-# generate binstubs
-FileUtils.mkdir_p("#{out}/bin")
-paths.each do |path|
-  next unless File.directory?("#{path}/nix-support/gem-meta")
-
-  name = File.read("#{path}/nix-support/gem-meta/name")
-  executables = File.read("#{path}/nix-support/gem-meta/executables").split
-  executables.each do |exe|
-    File.open("#{out}/bin/#{exe}", "w") do |f|
-      f.write(<<-EOF)
-#!#{ruby}
-#
-# This file was generated by Nix.
-#
-# The application '#{exe}' is installed as part of a gem, and
-# this file is here to facilitate running it.
-#
-
-ENV["BUNDLE_GEMFILE"] = "#{gemfile}"
-ENV["BUNDLE_PATH"] = "#{bundle_path}"
-
-gem_path = ENV["GEM_PATH"]
-ENV["GEM_PATH"] = "\#{gem_path}\#{":" unless gem_path.nil? || gem_path.empty?}#{bundler_gem_path}"
-
-require 'rubygems'
-require 'bundler/setup'
-
-load Gem.bin_path(#{name.inspect}, #{exe.inspect})
-EOF
-      FileUtils.chmod("+x", "#{out}/bin/#{exe}")
-    end
-  end
-end
diff --git a/pkgs/development/interpreters/ruby/bundler.nix b/pkgs/development/interpreters/ruby/bundler.nix
deleted file mode 100644
index cdcd12990e27..000000000000
--- a/pkgs/development/interpreters/ruby/bundler.nix
+++ /dev/null
@@ -1,10 +0,0 @@
-{ buildRubyGem, makeWrapper, ruby, coreutils }:
-
-buildRubyGem rec {
-  inherit ruby;
-  name = "${gemName}-${version}";
-  gemName = "bundler";
-  version = "1.10.6";
-  sha256 = "1vlzfq0bkkj4jyq6av0y55mh5nj5n0f3mfbmmifwgkh44g8k6agv";
-  dontPatchShebangs = true;
-}
diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix
index 2a22cc74e754..2ff960f6fcc6 100644
--- a/pkgs/development/interpreters/ruby/default.nix
+++ b/pkgs/development/interpreters/ruby/default.nix
@@ -1,6 +1,7 @@
 { stdenv, lib, fetchurl, fetchFromSavannah, fetchFromGitHub
 , zlib, openssl, gdbm, ncurses, readline, groff, libyaml, libffi, autoreconfHook, bison
 , autoconf, darwin ? null
+, buildEnv, bundler, bundix
 } @ args:
 
 let
@@ -9,6 +10,10 @@ let
   opString = stdenv.lib.optionalString;
   patchSet = import ./rvm-patchsets.nix { inherit fetchFromGitHub; };
   config = import ./config.nix { inherit fetchFromSavannah; };
+  rubygemsSrc = import ./rubygems-src.nix { inherit fetchurl; };
+  unpackdir = obj:
+    lib.removeSuffix ".tgz"
+      (lib.removeSuffix ".tar.gz" obj.name);
 
   generic = { majorVersion, minorVersion, teenyVersion, patchLevel, sha256 }: let
     versionNoPatch = "${majorVersion}.${minorVersion}.${teenyVersion}";
@@ -31,13 +36,10 @@ let
       , libffi, fiddleSupport ? true
       , autoreconfHook, bison, autoconf
       , darwin ? null
+      , buildEnv, bundler, bundix
       }:
-      stdenv.mkDerivation rec {
-        inherit version;
-
-        name = "ruby-${version}";
-
-        src = if useRailsExpress then fetchFromGitHub {
+      let rubySrc =
+        if useRailsExpress then fetchFromGitHub {
           owner  = "ruby";
           repo   = "ruby";
           rev    = tag;
@@ -46,6 +48,18 @@ let
           url = "http://cache.ruby-lang.org/pub/ruby/${majorVersion}.${minorVersion}/ruby-${fullVersionName}.tar.gz";
           sha256 = sha256.src;
         };
+      in
+      stdenv.mkDerivation rec {
+        inherit version;
+
+        name = "ruby-${version}";
+
+        srcs = [ rubySrc rubygemsSrc ];
+        sourceRoot =
+          if useRailsExpress then
+            "ruby-${tag}-src"
+          else
+            unpackdir rubySrc;
 
         # Have `configure' avoid `/usr/bin/nroff' in non-chroot builds.
         NROFF = "${groff}/bin/nroff";
@@ -67,11 +81,15 @@ let
 
         enableParallelBuilding = true;
 
-        patches = (import ./patchsets.nix {
-          inherit patchSet useRailsExpress ops patchLevel;
-        })."${versionNoPatch}";
+        patches =
+          [ ./gem_hook.patch ] ++
+          (import ./patchsets.nix {
+            inherit patchSet useRailsExpress ops patchLevel;
+          })."${versionNoPatch}";
 
-        postUnpack = opString isRuby21 ''
+        postUnpack = ''
+          cp -r ${unpackdir rubygemsSrc} ${sourceRoot}/rubygems
+        '' + opString isRuby21 ''
           rm "$sourceRoot/enc/unicode/name2ctype.h"
         '';
 
@@ -99,6 +117,11 @@ let
         installFlags = stdenv.lib.optionalString docSupport "install-doc";
         # Bundler tries to create this directory
         postInstall = ''
+          # Update rubygems
+          pushd rubygems
+          $out/bin/ruby setup.rb
+          popd
+
           # Bundler tries to create this directory
           mkdir -pv $out/${passthru.gemPath}
           mkdir -p $out/nix-support
@@ -119,17 +142,21 @@ let
 
         meta = {
           license = stdenv.lib.licenses.ruby;
-          homepage = "http://www.ruby-lang.org/en/";
+          homepage = http://www.ruby-lang.org/en/;
           description = "The Ruby language";
           platforms = stdenv.lib.platforms.all;
         };
 
         passthru = rec {
-          inherit majorVersion minorVersion teenyVersion patchLevel;
+          inherit majorVersion minorVersion teenyVersion patchLevel version;
           rubyEngine = "ruby";
           baseRuby = baseruby;
           libPath = "lib/${rubyEngine}/${versionNoPatch}";
           gemPath = "lib/${rubyEngine}/gems/${versionNoPatch}";
+          dev = import ./dev.nix {
+            inherit buildEnv bundler bundix;
+            ruby = self;
+          };
         };
       }
     ) args; in self;
diff --git a/pkgs/development/interpreters/ruby/dev.nix b/pkgs/development/interpreters/ruby/dev.nix
new file mode 100644
index 000000000000..7787306eb324
--- /dev/null
+++ b/pkgs/development/interpreters/ruby/dev.nix
@@ -0,0 +1,24 @@
+/* An environment for development that bundles ruby, bundler and bundix
+   together. This avoids version conflicts where each is using a diferent
+   version of each-other.
+*/
+{ buildEnv, ruby, bundler, bundix }:
+let
+  bundler_ = bundler.override {
+    ruby = ruby;
+  };
+  bundix_ = bundix.override {
+    ruby = ruby;
+    bundler = bundler_;
+  };
+in
+buildEnv {
+  name = "${ruby.rubyEngine}-dev-${ruby.version}";
+  paths = [
+    bundix_
+    bundler_
+    ruby
+  ];
+  pathsToLink = [ "/bin" ];
+  ignoreCollisions = true;
+}
diff --git a/pkgs/development/interpreters/ruby/gem_hook.patch b/pkgs/development/interpreters/ruby/gem_hook.patch
index 07f942f505e5..78ff9ddbb1a9 100644
--- a/pkgs/development/interpreters/ruby/gem_hook.patch
+++ b/pkgs/development/interpreters/ruby/gem_hook.patch
@@ -1,18 +1,21 @@
-diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
-index d1ef3cb..bf15652 100755
---- a/lib/rubygems/installer.rb
-+++ b/lib/rubygems/installer.rb
-@@ -545,6 +545,13 @@ Results logged to #{File.join(Dir.pwd, 'gem_make.out')}
+diff --git a/rubygems/lib/rubygems/installer.rb b/rubygems/lib/rubygems/installer.rb
+index a88d393..8612901 100644
+--- a/rubygems/lib/rubygems/installer.rb
++++ b/rubygems/lib/rubygems/installer.rb
+@@ -766,7 +766,15 @@ TEXT
+   # Ensures that files can't be installed outside the gem directory.
  
-       say path if Gem.configuration.really_verbose
-     end
-+
-+    if !ENV['NIX_POST_EXTRACT_FILES_HOOK'].nil?
-+      print "\nrunning NIX_POST_EXTRACT_FILES_HOOK #{ENV['NIX_POST_EXTRACT_FILES_HOOK']} #{@gem_dir}\n"
-+      print `#{ENV['NIX_POST_EXTRACT_FILES_HOOK']} #{@gem_dir}`
-+      print "\nrunning NIX_POST_EXTRACT_FILES_HOOK done\n"
+   def extract_files
+-    @package.extract_files gem_dir
++    ret = @package.extract_files gem_dir
++    if ENV['NIX_POST_EXTRACT_FILES_HOOK']
++      puts
++      puts "running NIX_POST_EXTRACT_FILES_HOOK #{ENV['NIX_POST_EXTRACT_FILES_HOOK']} #{gem_dir}"
++      system("#{ENV['NIX_POST_EXTRACT_FILES_HOOK']} #{gem_dir}")
++      puts "running NIX_POST_EXTRACT_FILES_HOOK done"
++      puts
 +    end
-+
++    ret
    end
  
    ##
diff --git a/pkgs/development/interpreters/ruby/gemconfig/default.nix b/pkgs/development/interpreters/ruby/gemconfig/default.nix
deleted file mode 100644
index dd4ae725095d..000000000000
--- a/pkgs/development/interpreters/ruby/gemconfig/default.nix
+++ /dev/null
@@ -1,166 +0,0 @@
-# The standard set of gems in nixpkgs including potential fixes.
-#
-# The gemset is derived from two points of entry:
-# - An attrset describing a gem, including version, source and dependencies
-#   This is just meta data, most probably automatically generated by a tool
-#   like Bundix (https://github.com/aflatter/bundix).
-#   {
-#     name = "bundler";
-#     version = "1.6.5";
-#     sha256 = "1s4x0f5by9xs2y24jk6krq5ky7ffkzmxgr4z1nhdykdmpsi2zd0l";
-#     dependencies = [ "rake" ];
-#   }
-# - An optional derivation that may override how the gem is built. For popular
-#   gems that don't behave correctly, fixes are already provided in the form of
-#   derivations.
-#
-# This seperates "what to build" (the exact gem versions) from "how to build"
-# (to make gems behave if necessary).
-
-{ lib, fetchurl, writeScript, ruby, kerberos, libxml2, libxslt, python, stdenv, which
-, libiconv, postgresql, v8_3_16_14, clang, sqlite, zlib, imagemagick
-, pkgconfig , ncurses, xapian, gpgme, utillinux, fetchpatch, tzdata, icu, libffi
-, cmake, libssh2, openssl, mysql, darwin, git, perl, gecode_3, curl
-, libmsgpack
-}:
-
-let
-  v8 = v8_3_16_14;
-in
-
-{
-  charlock_holmes = attrs: {
-    buildInputs = [ which icu zlib ];
-  };
-
-  dep-selector-libgecode = attrs: {
-    USE_SYSTEM_GECODE = true;
-    postInstall = ''
-      installPath=$(cat $out/nix-support/gem-meta/install-path)
-      sed -i $installPath/lib/dep-selector-libgecode.rb -e 's@VENDORED_GECODE_DIR =.*@VENDORED_GECODE_DIR = "${gecode_3}"@'
-    '';
-  };
-
-  eventmachine = attrs: {
-    buildInputs = [ openssl ];
-  };
-
-  ffi = attrs: {
-    buildInputs = [ libffi pkgconfig ];
-  };
-
-  gpgme = attrs: {
-    buildInputs = [ gpgme ];
-  };
-
-  # note that you need version >= v3.16.14.8,
-  # otherwise the gem will fail to link to the libv8 binary.
-  # see: https://github.com/cowboyd/libv8/pull/161
-  libv8 = attrs: {
-    buildInputs = [ which v8 python ];
-    buildFlags = [ "--with-system-v8=true" ];
-  };
-
-  msgpack = attrs: {
-    buildInputs = [ libmsgpack ];
-  };
-
-  mysql2 = attrs: {
-    buildInputs = [ mysql.lib zlib openssl ];
-  };
-
-  ncursesw = attrs: {
-    buildInputs = [ ncurses ];
-    buildFlags = [
-      "--with-cflags=-I${ncurses}/include"
-      "--with-ldflags=-L${ncurses}/lib"
-    ];
-  };
-
-  nokogiri = attrs: {
-    buildFlags = [
-      "--use-system-libraries"
-      "--with-zlib-dir=${zlib}"
-      "--with-xml2-lib=${libxml2}/lib"
-      "--with-xml2-include=${libxml2}/include/libxml2"
-      "--with-xslt-lib=${libxslt}/lib"
-      "--with-xslt-include=${libxslt}/include"
-      "--with-exslt-lib=${libxslt}/lib"
-      "--with-exslt-include=${libxslt}/include"
-    ] ++ lib.optional stdenv.isDarwin "--with-iconv-dir=${libiconv}";
-  };
-
-  patron = attrs: {
-    buildInputs = [ curl ];
-  };
-
-  pg = attrs: {
-    buildFlags = [
-      "--with-pg-config=${postgresql}/bin/pg_config"
-    ];
-  };
-
-  puma = attrs: {
-    buildInputs = [ openssl ];
-  };
-
-  rmagick = attrs: {
-    buildInputs = [ imagemagick pkgconfig ];
-  };
-
-  rugged = attrs: {
-    buildInputs = [ cmake pkgconfig openssl libssh2 zlib ];
-  };
-
-  sqlite3 = attrs: {
-    buildFlags = [
-      "--with-sqlite3-include=${sqlite}/include"
-      "--with-sqlite3-lib=${sqlite}/lib"
-    ];
-  };
-
-  sup = attrs: {
-    dontBuild = false;
-    # prevent sup from trying to dynamically install `xapian-ruby`.
-    postPatch = ''
-      cp ${./mkrf_conf_xapian.rb} ext/mkrf_conf_xapian.rb
-
-      substituteInPlace lib/sup/crypto.rb \
-        --replace 'which gpg2' \
-                  '${which}/bin/which gpg2'
-    '';
-  };
-
-  timfel-krb5-auth = attrs: {
-    buildInputs = [ kerberos ];
-  };
-
-  therubyracer = attrs: {
-    buildFlags = [
-      "--with-v8-dir=${v8}"
-      "--with-v8-include=${v8}/include"
-      "--with-v8-lib=${v8}/lib"
-    ];
-  };
-
-  tzinfo = attrs: {
-    dontBuild = false;
-    postPatch = ''
-      substituteInPlace lib/tzinfo/zoneinfo_data_source.rb \
-        --replace "/usr/share/zoneinfo" "${tzdata}/share/zoneinfo"
-    '';
-  };
-
-  xapian-ruby = attrs: {
-    # use the system xapian
-    dontBuild = false;
-    buildInputs = [ xapian pkgconfig zlib ];
-    postPatch = ''
-      cp ${./xapian-Rakefile} Rakefile
-    '';
-    preInstall = ''
-      export XAPIAN_CONFIG=${xapian}/bin/xapian-config
-    '';
-  };
-}
-
diff --git a/pkgs/development/interpreters/ruby/gemconfig/mkrf_conf_xapian.rb b/pkgs/development/interpreters/ruby/gemconfig/mkrf_conf_xapian.rb
deleted file mode 100644
index e19f06e23ac2..000000000000
--- a/pkgs/development/interpreters/ruby/gemconfig/mkrf_conf_xapian.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-require 'rubygems'
-require 'rubygems/command.rb'
-require 'rubygems/dependency_installer.rb'
-require 'rbconfig'
-
-begin
-  Gem::Command.build_args = ARGV
-rescue NoMethodError
-end
-
-# create dummy rakefile to indicate success
-f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w")
-f.write("task :default\n")
-f.close
diff --git a/pkgs/development/interpreters/ruby/gemconfig/xapian-Rakefile b/pkgs/development/interpreters/ruby/gemconfig/xapian-Rakefile
deleted file mode 100644
index 9f0b8e72f08c..000000000000
--- a/pkgs/development/interpreters/ruby/gemconfig/xapian-Rakefile
+++ /dev/null
@@ -1,38 +0,0 @@
-# encoding: utf-8
-# Install the xapian binaries into the lib folder of the gem
-require 'rbconfig'
-
-c = RbConfig::CONFIG
-
-def system!(cmd)
-  puts cmd
-  system(cmd) or raise
-end
-
-source_dir = 'xapian_source'
-bindings = Dir["#{source_dir}/xapian-bindings-*"].first
-bindings = File.basename(bindings, ".tar.xz")
-
-task :default do
-  system! "tar -xJf #{source_dir}/#{bindings}.tar.xz"
-
-  prefix = Dir.pwd
-  ENV['LDFLAGS'] = "-L#{prefix}/lib"
-
-  system! "mkdir -p lib"
-
-  Dir.chdir bindings do
-    ENV['RUBY'] ||= "#{c['bindir']}/#{c['RUBY_INSTALL_NAME']}"
-    system! "./configure --prefix=#{prefix} --exec-prefix=#{prefix} --with-ruby"
-    system! "make clean all"
-  end
-
-  system! "cp -r #{bindings}/ruby/.libs/_xapian.* lib"
-  system! "cp #{bindings}/ruby/xapian.rb lib"
-
-  system! "rm lib/*.la"
-  system! "rm lib/*.lai"
-
-  system! "rm -R #{bindings}"
-  system! "rm -R #{source_dir}"
-end
diff --git a/pkgs/development/interpreters/ruby/patches.nix b/pkgs/development/interpreters/ruby/patches.nix
deleted file mode 100644
index 0cc477c991ef..000000000000
--- a/pkgs/development/interpreters/ruby/patches.nix
+++ /dev/null
@@ -1,138 +0,0 @@
-{ fetchurl, writeScript, ruby, ncurses, sqlite, libxml2, libxslt, libffi
-, zlib, libuuid, gems, jdk, python, stdenv, libiconv, imagemagick
-, pkgconfig }:
-
-let
-
-  patchUsrBinEnv = writeScript "path-usr-bin-env" ''
-    #!/bin/sh
-    echo "==================="
-    find "$1" -type f -name "*.rb" | xargs sed -i "s@/usr/bin/env@$(type -p env)@g"
-    find "$1" -type f -name "*.mk" | xargs sed -i "s@/usr/bin/env@$(type -p env)@g"
-  '';
-
-in
-
-{
-  buildr = {
-    # Many Buildfiles rely on RUBYLIB containing the current directory
-    # (as was the default in Ruby < 1.9.2).
-    extraWrapperFlags = "--prefix RUBYLIB : .";
-  };
-
-  fakes3 = {
-    postInstall = ''
-      cd $out/${ruby.gemPath}/gems/*
-      patch -Np1 -i ${../../ruby-modules/fake-s3-list-bucket.patch}
-    '';
-  };
-
-  ffi = {
-    postUnpack = "onetuh";
-    buildFlags = ["--with-ffi-dir=${libffi}"];
-    NIX_POST_EXTRACT_FILES_HOOK = patchUsrBinEnv;
-  };
-
-  iconv = { buildInputs = [ libiconv ]; };
-
-  libv8 = {
-    # This fix is needed to fool scons, which clears the environment by default.
-    # It's ugly, but it works.
-    #
-    # We create a gcc wrapper wrapper, which reexposes the environment variables
-    # that scons hides. Furthermore, they treat warnings as errors causing the
-    # build to fail, due to an unused variable.
-    #
-    # Finally, we must set CC and AR explicitly to allow scons to find the
-    # compiler and archiver
-
-    preBuild = ''
-      cat > $TMPDIR/g++ <<EOF
-      #! ${stdenv.shell}
-      $(export)
-
-      g++ \$(echo \$@ | sed 's/-Werror//g')
-      EOF
-      chmod +x $TMPDIR/g++
-
-      export CXX=$TMPDIR/g++
-      export AR=$(type -p ar)
-    '';
-    buildInputs = [ python ];
-    NIX_POST_EXTRACT_FILES_HOOK = writeScript "patch-scons" ''
-      #!/bin/sh
-      for i in `find "$1" -name scons`
-      do
-          sed -i -e "s@/usr/bin/env@$(type -p env)@g" $i
-      done
-    '';
-  };
-
-  ncurses = { propagatedBuildInputs = [ ncurses ]; };
-
-  ncursesw = { propagatedBuildInputs = [ ncurses ]; };
-
-  nix = {
-    postInstall = ''
-      cd $out/${ruby.gemPath}/gems/nix*
-      patch -Np1 -i ${./fix-gem-nix-versions.patch}
-    '';
-  };
-
-  nokogiri = {
-    buildInputs = [ libxml2 ];
-    buildFlags =
-      [ "--with-xml2-dir=${libxml2} --with-xml2-include=${libxml2}/include/libxml2"
-        "--with-xslt-dir=${libxslt}  --use-system-libraries"
-        libiconv
-      ];
-  };
-
-  pry = { gemFlags = "--no-ri --no-rdoc"; };
-
-  rails = { gemFlags = "--no-ri --no-rdoc"; };
-
-  rjb = {
-    buildInputs = [ jdk ];
-    JAVA_HOME = jdk;
-  };
-
-  rmagick = {
-    buildInputs = [ imagemagick pkgconfig ];
-
-    NIX_CFLAGS_COMPILE = "-I${imagemagick}/include/ImageMagick-6";
-  };
-
-  sqlite3 = { propagatedBuildInputs = [ sqlite ]; };
-
-  xapian_full = {
-    buildInputs = [ gems.rake zlib libuuid ];
-    gemFlags = "--no-rdoc --no-ri";
-  };
-
-  xapian_full_alaveteli = {
-    buildInputs = [ zlib libuuid ];
-  };
-
-  xapian_ruby = {
-    buildInputs = [ zlib libuuid ];
-  };
-
-  xrefresh_server =
-    let
-      patch = fetchurl {
-        url = "http://mawercer.de/~nix/xrefresh.diff.gz";
-        sha256 = "1f7bnmn1pgkmkml0ms15m5lx880hq2sxy7vsddb3sbzm7n1yyicq";
-      };
-    in {
-      propagatedBuildInputs = [ gems.rb_inotify ];
-
-      # monitor implementation for Linux
-      postInstall = ''
-        cd $out/${ruby.gemPath}/gems/*
-        zcat ${patch} | patch -p 1
-      ''; # */
-    };
-
-  bundler = { dontPatchShebangs=1; };
-}
diff --git a/pkgs/development/interpreters/ruby/rubygems-src.nix b/pkgs/development/interpreters/ruby/rubygems-src.nix
new file mode 100644
index 000000000000..fea749e7de0e
--- /dev/null
+++ b/pkgs/development/interpreters/ruby/rubygems-src.nix
@@ -0,0 +1,8 @@
+{ fetchurl
+, version ? "2.6.2"
+, sha256 ? "1j02ajici555f35vd6ky6m4bxs8lh8nqb1c59qqib4jp4ibcv6zy"
+}:
+fetchurl {
+  url = "http://production.cf.rubygems.org/rubygems/rubygems-${version}.tgz";
+  sha256 = sha256;
+}
diff --git a/pkgs/development/interpreters/ruby/rubygems.nix b/pkgs/development/interpreters/ruby/rubygems.nix
deleted file mode 100644
index fb210ceff4bf..000000000000
--- a/pkgs/development/interpreters/ruby/rubygems.nix
+++ /dev/null
@@ -1,35 +0,0 @@
-{ stdenv, lib, fetchurl, makeWrapper, ruby }:
-
-stdenv.mkDerivation rec {
-  name = "rubygems-${version}";
-  version = "2.4.8";
-  src = fetchurl {
-    url = "http://production.cf.rubygems.org/rubygems/${name}.tgz";
-    sha256 = "0pl4civyf0vhqsqbqaivvxrb3fsg8sid9a8jv5vfnk4hypz3ahss";
-  };
-
-  patches = [ ./gem_hook.patch ];
-
-  buildInputs = [ruby makeWrapper];
-
-  buildPhase = ":";
-
-  installPhase = ''
-    ruby setup.rb --prefix=$out/
-
-    wrapProgram $out/bin/gem --prefix RUBYLIB : $out/lib
-
-    find $out -type f -name "*.rb" |
-      xargs sed -i "s@/usr/bin/env@$(type -p env)@g"
-
-    mkdir -pv $out/nix-support
-    cat > $out/nix-support/setup-hook <<EOF
-    export RUBYOPT=rubygems
-    addToSearchPath RUBYLIB $out/lib
-    EOF
-  '';
-
-  meta = {
-    description = "A package management framework for Ruby";
-  };
-}
diff --git a/pkgs/development/interpreters/self/default.nix b/pkgs/development/interpreters/self/default.nix
index c00298c0fdc8..7a24e092fd3e 100644
--- a/pkgs/development/interpreters/self/default.nix
+++ b/pkgs/development/interpreters/self/default.nix
@@ -20,7 +20,6 @@ stdenv.mkDerivation rec {
     sha256 = "966025b71542e44fc830b951f404f5721ad410ed24f7236fd0cd820ea0fc5731";
   };
 
-  # gcc 4.6 and above causes crashes on Self startup but gcc 4.4 works.
   buildInputs = [ ncurses xorg.libX11 xorg.libXext makeWrapper cmake ];
 
   selfWrapper = ./self;
@@ -36,9 +35,10 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "A prototype-based dynamic object-oriented programming language, environment, and virtual machine";
-    homepage = "http://selflanguage.org/";
+    homepage = http://selflanguage.org/;
     license = stdenv.lib.licenses.bsd3;
     maintainers = [ stdenv.lib.maintainers.doublec ];
     platforms = with stdenv.lib.platforms; linux;
+    broken = true; # segfaults on gcc > 4.4
   };
 }