diff --git a/pkgs/applications/networking/mailreaders/sup/default.nix b/pkgs/applications/networking/mailreaders/sup/default.nix
index b1ef5dddda3a..05313a348344 100644
--- a/pkgs/applications/networking/mailreaders/sup/default.nix
+++ b/pkgs/applications/networking/mailreaders/sup/default.nix
@@ -1,4 +1,5 @@
-{ stdenv, fetchurl, ncurses, ruby, rake, rubygems, makeWrapper, gpgme }:
+{ stdenv, fetchurl, ruby, rake, rubygems, makeWrapper, ncursesw_sup
+, xapian_full_alaveteli, gpgme, libiconv }:
 
 stdenv.mkDerivation {
   name = "sup-d21f027afcd6a4031de9619acd8dacbd2f2f4fd4";
@@ -18,20 +19,44 @@ stdenv.mkDerivation {
     sha256 = "0syifva6pqrg3nyy7xx7nan9zswb4ls6bkk96vi9ki2ly1ymwcdp";
   };
 
-  configurePhase = "";
-
-  buildInputs = [ ncurses ruby rake rubygems makeWrapper gpgme ];
+  buildInputs =
+    [ ruby rake rubygems makeWrapper gpgme ncursesw_sup xapian_full_alaveteli
+      libiconv ];
 
   buildPhase = "rake gem";
 
+  # TODO: Move gem dependencies out
+
   installPhase = ''
     export HOME=$TMP/home; mkdir -pv "$HOME"
-    gem install --no-verbose --install-dir "$out/${ruby.gemPath}" \
-        --bindir "$out/bin" --no-rdoc --no-ri pkg/sup-999.gem
-    gem install --no-verbose --install-dir "$out/${ruby.gemPath}" \
-        --bindir "$out/bin" --no-rdoc --no-ri gpgme --version 1.0.8
 
-    addToSearchPath GEM_PATH $out/${ruby.gemPath}
+    GEM_PATH="$GEM_PATH:$out/${ruby.gemPath}"
+    GEM_PATH="$GEM_PATH:${ncursesw_sup}/${ruby.gemPath}"
+    GEM_PATH="$GEM_PATH:${xapian_full_alaveteli}/${ruby.gemPath}"
+    GEM_PATH="$GEM_PATH:${gpgme}/${ruby.gemPath}"
+
+    # Don't install some dependencies -- we have already installed
+    # ncursesw-sup, xapian-full-alaveteli and gpgme, but gem doesn't acknowledge
+    # this
+    gem install --no-verbose --install-dir "$out/${ruby.gemPath}" \
+        --bindir "$out/bin" --no-rdoc --no-ri pkg/sup-999.gem \
+        --ignore-dependencies
+
+    # Now install the dependencies that will work out of the box
+    gem install --no-verbose --install-dir "$out/${ruby.gemPath}" \
+        --bindir "$out/bin" --no-rdoc --no-ri rmail
+    gem install --no-verbose --install-dir "$out/${ruby.gemPath}" \
+        --bindir "$out/bin" --no-rdoc --no-ri trollop
+    gem install --no-verbose --install-dir "$out/${ruby.gemPath}" \
+        --bindir "$out/bin" --no-rdoc --no-ri lockfile
+    gem install --no-verbose --install-dir "$out/${ruby.gemPath}" \
+        --bindir "$out/bin" --no-rdoc --no-ri mime-types
+    gem install --no-verbose --install-dir "$out/${ruby.gemPath}" \
+        --bindir "$out/bin" --no-rdoc --no-ri gettext
+    gem install --no-verbose --install-dir "$out/${ruby.gemPath}" \
+        --bindir "$out/bin" --no-rdoc --no-ri chronic
+    gem install --no-verbose --install-dir "$out/${ruby.gemPath}" \
+        --bindir "$out/bin" --no-rdoc --no-ri iconv
 
     for prog in $out/bin/*; do
       wrapProgram "$prog" --prefix GEM_PATH : "$GEM_PATH"
diff --git a/pkgs/development/interpreters/ruby/generated.nix b/pkgs/development/interpreters/ruby/generated.nix
index d4bb7fa4f2d1..3e9a3f198e83 100644
--- a/pkgs/development/interpreters/ruby/generated.nix
+++ b/pkgs/development/interpreters/ruby/generated.nix
@@ -97,6 +97,7 @@ g: # Get dependencies from patched gems
     uuid = g.uuid_2_3_7;
     uuidtools = g.uuidtools_2_1_3;
     websocket = g.websocket_1_0_7;
+    xapian_full_alaveteli = g.xapian_full_alaveteli_1_2_9_5;
     xml_simple = g.xml_simple_1_1_1;
     yajl_ruby = g.yajl_ruby_1_1_0;
   };
@@ -1467,6 +1468,16 @@ interpreters.'';
       requiredGems = [  ];
       sha256 = ''1jrfz4295qbnjaxv37fw9jzxyxz61izp7c0683mnscacpx262zw0'';
     };
+    xapian_full_alaveteli_1_2_9_5 = {
+      basename = ''xapian_full_alaveteli'';
+      meta = {
+        description = ''xapian-core + Ruby xapian-bindings'';
+        longDescription = ''Xapian bindings for Ruby without dependency on system Xapian library'';
+      };
+      name = ''xapian-full-alaveteli-1.2.9.5'';
+      requiredGems = [  ];
+      sha256 = ''0qg1jkx5lr4a5v7l3f9gq7f07al6qaxxzma230zrzs48bz3qnhxm'';
+    };
     xml_simple_1_1_1 = {
       basename = ''xml_simple'';
       meta = {
diff --git a/pkgs/development/interpreters/ruby/patches.nix b/pkgs/development/interpreters/ruby/patches.nix
index c4da956b57c8..47b8864a635e 100644
--- a/pkgs/development/interpreters/ruby/patches.nix
+++ b/pkgs/development/interpreters/ruby/patches.nix
@@ -91,6 +91,10 @@ in
     gemFlags = "--no-rdoc --no-ri";
   };
 
+  xapian_full_alaveteli = {
+    buildInputs = [ zlib libuuid ];
+  };
+
   rjb = {
     buildInputs = [ jdk ];
     JAVA_HOME = jdk;
diff --git a/pkgs/development/libraries/ruby_gpgme/default.nix b/pkgs/development/libraries/ruby_gpgme/default.nix
new file mode 100644
index 000000000000..bbec073b5d26
--- /dev/null
+++ b/pkgs/development/libraries/ruby_gpgme/default.nix
@@ -0,0 +1,64 @@
+{ stdenv, fetchurl, gpgme, ruby, rubygems, hoe }:
+
+stdenv.mkDerivation rec {
+  name = "gpgme-1.0.8";
+
+  src = fetchurl {
+    url = "https://github.com/ueno/ruby-gpgme/archive/1.0.8.tar.gz";
+    sha256 = "1j7jkl9s8iqcmxf3x6c9kljm19hw1jg6yvwbndmkw43qacdr9nxb";
+  };
+
+  meta = {
+    description = ''
+      Ruby-GPGME is a Ruby language binding of GPGME (GnuPG Made
+      Easy)
+    '';
+    homepage = "http://rubyforge.org/projects/ruby-gpgme/";
+    longDescription = ''
+      Ruby-GPGME is a Ruby language binding of GPGME (GnuPG Made Easy).
+
+      GnuPG Made Easy (GPGME) is a library designed to make access to GnuPG
+      easier for applications. It provides a High-Level Crypto API for
+      encryption, decryption, signing, signature verification and key
+      management.
+    '';
+  };
+
+  buildInputs = [ gpgme rubygems hoe ruby ];
+
+  buildPhase = ''
+    ${ruby}/bin/ruby extconf.rb
+    rake gem
+  '';
+
+  installPhase = ''
+    export HOME=$TMP/home; mkdir -pv "$HOME"
+
+    # For some reason, the installation phase doesn't work with the default
+    # make install command run by gem (we'll fix it and do it ourselves later)
+    gem install --no-verbose --install-dir "$out/${ruby.gemPath}" \
+        --bindir "$out/bin" --no-rdoc --no-ri pkg/gpgme-1.0.8.gem || true
+
+    # Create a bare-bones gemspec file so that ruby will recognise the gem
+    cat <<EOF >"$out/${ruby.gemPath}/specifications/gpgme.gemspec"
+    Gem::Specification.new do |s|
+      s.name              = 'gpgme'
+      s.version           = '1.0.8'
+      s.files             = Dir['{lib,examples}/**/*']
+      s.rubyforge_project = 'ruby-gpgme'
+      s.require_paths     = ['lib']
+    end
+    EOF
+
+    cd "$out/${ruby.gemPath}/gems/${name}"
+    mkdir src
+    mv lib src
+    sed -i "s/srcdir = ./srcdir = src/" Makefile
+    make install
+
+    mv lib lib.bak
+    mv src/lib lib
+    rmdir src
+  '';
+}
+
diff --git a/pkgs/development/libraries/ruby_ncursesw_sup/default.nix b/pkgs/development/libraries/ruby_ncursesw_sup/default.nix
new file mode 100644
index 000000000000..67041ad06078
--- /dev/null
+++ b/pkgs/development/libraries/ruby_ncursesw_sup/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, ncurses, ruby, rubygems }:
+
+stdenv.mkDerivation rec {
+  name = ''ncursesw-sup-afd962b9c06108ff0643e98593c5605314d76917'';
+
+  src = fetchurl {
+    url = "https://github.com/sup-heliotrope/ncursesw-ruby/archive/afd962b9c06108ff0643e98593c5605314d76917.tar.gz";
+    sha256 = "13i286p4bm8zqg9xh96a1dg7wkywj9m6975gbh3w43d3rmfc1h6a";
+  };
+
+  meta = {
+    description = ''
+      Hacked up version of ncurses gem that supports wide characters for
+      supmua.org
+    '';
+    homepage = ''http://github.com/sup-heliotrope/ncursesw-ruby'';
+    longDescription = ''
+      This wrapper provides access to the functions, macros, global variables
+      and constants of the ncurses library.  These are mapped to a Ruby Module
+      named "Ncurses":  Functions and external variables are implemented as
+      singleton functions of the Module Ncurses.
+    '';
+  };
+
+  buildInputs = [ ncurses rubygems ];
+
+  buildPhase = "gem build ncursesw.gemspec";
+
+  installPhase = ''
+    export HOME=$TMP/home; mkdir -pv "$HOME"
+
+    # For some reason, the installation phase doesn't work with the default
+    # make install command run by gem (we'll fix it and do it ourselves later)
+    gem install --no-verbose --install-dir "$out/${ruby.gemPath}" \
+        --bindir "$out/bin" --no-rdoc --no-ri ncursesw-sup-1.3.1.2.gem || true
+
+    # Needed for ruby to recognise the gem
+    cp ncursesw.gemspec "$out/${ruby.gemPath}/specifications"
+
+    cd "$out/${ruby.gemPath}/gems/ncursesw-sup-1.3.1.2"
+    mkdir src
+    mv lib src
+    sed -i "s/srcdir = ./srcdir = src/" Makefile
+    make install
+  '';
+}
+
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index aa0aa0049306..2db217ea5e3c 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -7776,9 +7776,19 @@ let
 
   mutt = callPackage ../applications/networking/mailreaders/mutt { };
 
+  ruby_gpgme = callPackage ../development/libraries/ruby_gpgme {
+    ruby = ruby19;
+    hoe = rubyLibs.hoe;
+  };
+
+  ruby_ncursesw_sup = callPackage ../development/libraries/ruby_ncursesw_sup { };
+
   sup = callPackage ../applications/networking/mailreaders/sup {
     rake = rubyLibs.rake_10_0_4;
     ruby = ruby19;
+    xapian_full_alaveteli = rubyLibs.xapian_full_alaveteli_1_2_9_5;
+    gpgme = ruby_gpgme;
+    ncursesw_sup = ruby_ncursesw_sup;
   };
 
   msmtp = callPackage ../applications/networking/msmtp { };