/* libraries and applications from rubyforge

  run
    $gem nix $EXSTING_TARGETS new-target-package

  EXSTING_TARGETS can be looked up below after "has been generated by "

  Don't forget add
  export GEM_PATH=~/.nix/profile
  export RUBYLIB=~/.nix-profile/gems/rubygems-update-1.3.4/lib/
  export RUBYOPT=rubygems
  to your .bashrc
*/

{pkgs, stdenv}:
let libs =
  let 
    inherit (pkgs) fetchurl sourceFromHead writeScript makeWrapper;
    ruby = pkgs.ruby; # select ruby version here
    rubygems = pkgs.rubygemsFun ruby; # for bootstrapping
    inherit (pkgs.lib) mergeAttrsByFuncDefaults optional;
    inherit (builtins) hasAttr getAttr;

    patchUsrBinEnv = writeScript "path-usr-bin-env" ''
      #!/bin/sh
      set -x
      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"
    '';

    # these settings are merged into the automatically generated settings
    # either the nameNoVersion or name must match
    patches = {
      sup = {
        buildInputs = [ pkgs.ncurses pkgs.xapianBindings libs.ncursesw ];
      };
      ncurses = { buildInputs = [ pkgs.ncurses ]; };
      ncursesw = { buildInputs = [ pkgs.ncurses ]; };
      nokogiri = {
        buildFlags=["--with-xml2-dir=${pkgs.libxml2} --with-xml2-include=${pkgs.libxml2}/include/libxml2"
                    "--with-xslt-dir=${pkgs.libxslt}" ];
      };

      gemcutter = {
        propagatedBuildInputs = [ libs.rubygems_update ];
      };

      ffi = {
        postUnpack = "onetuh";
        propagatedBuildInputs = [ libs.rake  libs.rubygems_update ];
        buildFlags=["--with-ffi-dir=${pkgs.libffi}"];
        NIX_POST_EXTRACT_FILES_HOOK = patchUsrBinEnv;
      };

      rake = {
        propagatedBuildInputs = [ libs.rubygems_update ];
      };
 
      rubygems_update = {
        # gems is using --env-shebang by default
        # replace env lines by $out/../bin/env
        postInstall = ''
          cd $out/gems/*;
          patch -p 1 < ${./gem_nix_command.patch}; echo
          find $out -type f -name "*.rb" | xargs sed -i "s@/usr/bin/env@$(type -p env)@g"
        '';
      };

      xrefresh_server =
      let patch = fetchurl {
          url = "http://mawercer.de/~nix/xrefresh.diff.gz";
          sha256 = "1f7bnmn1pgkmkml0ms15m5lx880hq2sxy7vsddb3sbzm7n1yyicq";
        };
      in {
        propagatedBuildInputs = [ libs.rb_inotify libs.rubygems_update ];

        # monitor implementation for Linux
        postInstall = ''
          cd $out/gems/*;
          cat ${patch} | gunzip | patch -p 1;
        '';
      };

      xapian_full = {
        buildInputs = [ libs.rake pkgs.zlib pkgs.libuuid ];
      };
    };

    rubyDerivation = args :
      let completeArgs = (mergeAttrsByFuncDefaults 
          ([{
            buildInputs = [rubygems ruby pkgs.makeWrapper];
            unpackPhase = ":";
            configurePhase=":";
            bulidPhase=":";

            # TODO add some abstraction for this kind of env path concatenation. It's used multiple times
            installPhase = ''
              ensureDir "$out/nix-support"
              export HOME=$TMP/home; mkdir "$HOME"

              gem install --ignore-dependencies --env-shebang -E -i "$out" "$src" -- $buildFlags
              rm -fr $out/cache # don't keep the .gem file here

              THIS_RUBY_LIB=$(echo $out/gems/*/lib)
              THIS_GEM_PATH=$out

              cat >> $out/nix-support/setup-hook << EOF 
                declare -A RUBYLIB_HASH # using bash4 hashs
                declare -A GEM_PATH_HASH # using bash4 hashs

                RUBYLIB_HASH["$THIS_RUBY_LIB"]=
                for path in \''${!RUBYLIB_HASH[@]}; do
                  export RUBYLIB=\''${RUBYLIB}\''${RUBYLIB:+:}\$path
                done
                GEM_PATH_HASH["$THIS_GEM_PATH"]=
                for path in \''${!GEM_PATH_HASH[@]}; do
                  export GEM_PATH=\''${GEM_PATH}\''${GEM_PATH:+:}\$path
                done
              EOF
              . $out/nix-support/setup-hook

              for prog in $out/bin/*; do
                wrapProgram "$prog" \
                  --prefix RUBYLIB : "$RUBYLIB":${rubygems}/lib \
                  --prefix GEM_PATH : "$GEM_PATH" \
                  --set RUBYOPT 'rubygems'
              done

              for prog in $out/gems/*/bin/*; do
                [ -e "$out/bin/$(basename $prog)" ] && continue || true
                sed -i '1s@.*@#!  ${ruby}/bin/ruby@' "$prog"
                t="$out/bin/$(basename "$prog")"
                cat >> "$t" << EOF
              #!/bin/sh
              export GEM_PATH=$GEM_PATH:\$GEM_PATH
              #export RUBYLIB=$RUBYLIB:\$RUBYLIB
              exec $(type -p ruby) $prog "\$@"
              EOF
                chmod +x "$t"
              done


              runHook postInstall
            '';


          } args ]
            ++ optional (hasAttr args.name patches) (getAttr args.name patches)
            ++ optional (hasAttr args.nameNoVersion patches) (getAttr args.nameNoVersion patches)
          )); in stdenv.mkDerivation (removeAttrs completeArgs ["mergeAttrBy"]);
  in
  rec {

  # ================ START automatically generated code ================
         # WARNING: automatically generated CODE
         # This section has been generated by gem nix sup chronic rubygems-update xrefresh-server rb-inotify jeweler ncursesw
         # the gem nix command has been added by a nix patch to ruby gems
      
  json_pure_1_2_4 = rubyDerivation {
     name = "ruby-json_pure-1.2.4"; # full_name
     nameNoVersion = "json_pure";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/json_pure-1.2.4.gem";
       sha256 = "1j3lwa20659qb5rvsnzxd6qlr0m56fyppgdhxc7v4phdsw3im4bp";
     };
     meta = {
       homepage = "http://flori.github.com/json";
       license = []; # one of ?
       description = "This is a JSON implementation in pure Ruby[...]";
       longDescription = "This is a JSON implementation in pure Ruby.";
     };
  };

  rake_0_8_7 = rubyDerivation {
     name = "ruby-rake-0.8.7"; # full_name
     nameNoVersion = "rake";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/rake-0.8.7.gem";
       sha256 = "03z1zm7xwl2r9v945ambwbd9sn2smbi34xldmac7qjcmsvd7pcqh";
     };
     meta = {
       homepage = "http://rake.rubyforge.org";
       license = []; # one of ?
       description = "Rake is a Make-like program implemented in Ruby[...]";
       longDescription = "Rake is a Make-like program implemented in Ruby. Tasks and dependencies are specified in standard Ruby syntax.";
     };
  };

  git_1_2_5 = rubyDerivation {
     name = "ruby-git-1.2.5"; # full_name
     nameNoVersion = "git";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/git-1.2.5.gem";
       sha256 = "19dy8sakv4x7pnvjddqjyd4j74cji14wikhz95iaqqrc9n4z43hk";
     };
     meta = {
       homepage = "http://github.com/schacon/ruby-git";
       license = []; # one of ?
       description = "[...]";
       longDescription = "";
     };
  };

  json_1_2_4 = rubyDerivation {
     name = "ruby-json-1.2.4"; # full_name
     nameNoVersion = "json";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/json-1.2.4.gem";
       sha256 = "1wdj91bl7xabgkwpz285b8086v5898x72h4lxl11n750652mrrax";
     };
     meta = {
       homepage = "http://flori.github.com/json";
       license = []; # one of ?
       description = "This is a JSON implementation as a Ruby extension in C[...]";
       longDescription = "This is a JSON implementation as a Ruby extension in C.";
     };
  };

  rubygems_update_1_3_6 = rubyDerivation {
     name = "ruby-rubygems-update-1.3.6"; # full_name
     nameNoVersion = "rubygems_update";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/rubygems-update-1.3.6.gem";
       sha256 = "1fqbm9hmy3skj9s98v8k0qghdmli7kv84wlm0m4grsrdn26xw14l";
     };
     meta = {
       homepage = "http://rubygems.org/";
       license = []; # one of ?
       description = "RubyGems is a package management framework for Ruby  This gem is an update for the RubyGems software. You must have an in"; # cut to 120 chars
       longDescription = "RubyGems is a package management framework for Ruby.

This gem is an update for the RubyGems software. You must have an
installation of RubyGems before this update can be applied.

See Gem for information on RubyGems (or `ri Gem`)

To upgrade to the latest RubyGems, run:

  $ gem update --system  # you might need to be an administrator or root

NOTE:  RubyGems 1.1 and 1.2 have problems upgrading when there is no
rubygems-update installed.  You will need to use the following instructions
if you see \"Nothing to update\".

If you have an older version of RubyGems installed, then you can still
do it in two steps:

  $ gem install rubygems-update  # again, might need to be admin/root
  $ update_rubygems              # ... here too

If you don't have any RubyGems install, there is still the pre-gem approach to
getting software, doing it manually:

1. Download from: http://rubyforge.org/frs/?group_id=126
2. Unpack into a directory and cd there
3. Install with: ruby setup.rb  # you may need admin/root privilege

For more details and other options, see:

  ruby setup.rb --help";
     };
  };

  chronic_0_2_3 = rubyDerivation {
     name = "ruby-chronic-0.2.3"; # full_name
     nameNoVersion = "chronic";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/chronic-0.2.3.gem";
       sha256 = "0gm4i9iwpvsk07nzvy8fmyad4y7i284vvdrxrlbgb23lr17qpl17";
     };
     meta = {
       homepage = "	http://chronic.rubyforge.org/";
       license = []; # one of ?
       description = "Chronic is a natural language date/time parser written in pure Ruby[...]";
       longDescription = "Chronic is a natural language date/time parser written in pure Ruby. See below for the wide variety of formats Chronic will parse.";
     };
  };

  ncurses_0_9_1 = rubyDerivation {
     name = "ruby-ncurses-0.9.1"; # full_name
     nameNoVersion = "ncurses";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/ncurses-0.9.1.gem";
       sha256 = "0j9k3rfxglkivwnpdkbfk4acfnivfisyj8f0msf3zkid4hnj4r2h";
     };
     meta = {
       homepage = "http://ncurses-ruby.berlios.de/";
       license = []; # one of ?
       description = "[...]";
       longDescription = "";
     };
  };

  xapian_full_1_1_3_4 = rubyDerivation {
     name = "ruby-xapian-full-1.1.3.4"; # full_name
     nameNoVersion = "xapian_full";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/xapian-full-1.1.3.4.gem";
       sha256 = "0yc08y7v5yh0lfidc0rkr072q88jvp5prv7pllv4qn4wryna8mwl";
     };
     meta = {
       homepage = "";
       license = []; # one of ?
       description = "Xapian bindings for Ruby without dependency on system Xapian library[...]";
       longDescription = "Xapian bindings for Ruby without dependency on system Xapian library";
     };
  };

  ffi_0_6_3 = rubyDerivation {
     name = "ruby-ffi-0.6.3"; # full_name
     nameNoVersion = "ffi";
     propagatedBuildInputs = [ rake_0_8_7 ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/ffi-0.6.3.gem";
       sha256 = "08qnxqcnjq4i2vv1jfwdxdlsphqjrrh7r0cw8x2q0x9vjd27ncbb";
     };
     meta = {
       homepage = "http://wiki.github.com/ffi/ffi";
       license = []; # one of ?
       description = "Ruby-FFI is a ruby extension for programmatically loading dynamic libraries, binding functions within them, and calling t"; # cut to 120 chars
       longDescription = "Ruby-FFI is a ruby extension for programmatically loading dynamic
libraries, binding functions within them, and calling those functions
from Ruby code. Moreover, a Ruby-FFI extension works without changes
on Ruby and JRuby. Discover why should you write your next extension
using Ruby-FFI here[http://wiki.github.com/ffi/ffi/why-use-ffi].";
     };
  };

  term_ansicolor_1_0_5 = rubyDerivation {
     name = "ruby-term-ansicolor-1.0.5"; # full_name
     nameNoVersion = "term_ansicolor";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/term-ansicolor-1.0.5.gem";
       sha256 = "1xhcc4dkfylj14w413pmd8jhc04wj3nlw0xa6qy9h0fnbbyh6bc1";
     };
     meta = {
       homepage = "http://flori.github.com/term-ansicolor";
       license = []; # one of ?
       description = "[...]";
       longDescription = "";
     };
  };

  trollop_1_16_2 = rubyDerivation {
     name = "ruby-trollop-1.16.2"; # full_name
     nameNoVersion = "trollop";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/trollop-1.16.2.gem";
       sha256 = "0frrp90dw266h3kf9g925dppir9l7p8jxknw6dn5nz6fa6c4g5lg";
     };
     meta = {
       homepage = "http://trollop.rubyforge.org";
       license = []; # one of ?
       description = "Trollop is a commandline option parser for Ruby that just gets out of your way For that, you get a nice automatically-gen"; # cut to 120 chars
       longDescription = "Trollop is a commandline option parser for Ruby that just
gets out of your way. One line of code per option is all you need to write.
For that, you get a nice automatically-generated help page, robust option
parsing, command subcompletion, and sensible defaults for everything you don't
specify.";
     };
  };

  gettext_2_1_0 = rubyDerivation {
     name = "ruby-gettext-2.1.0"; # full_name
     nameNoVersion = "gettext";
     propagatedBuildInputs = [ locale_2_0_5 ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/gettext-2.1.0.gem";
       sha256 = "17g048gp7gh3c311l5jw2sbanma2havj4yqhaaa50b3rx72y4xwz";
     };
     meta = {
       homepage = "http://gettext.rubyforge.org/";
       license = []; # one of ?
       description = "        Ruby-GetText-Package is a GNU GetText-like program for Ruby         The catalog file(po-file) is same format with"; # cut to 120 chars
       longDescription = "        Ruby-GetText-Package is a GNU GetText-like program for Ruby.
        The catalog file(po-file) is same format with GNU GetText.
        So you can use GNU GetText tools for maintaining.
";
     };
  };

  lockfile_1_4_3 = rubyDerivation {
     name = "ruby-lockfile-1.4.3"; # full_name
     nameNoVersion = "lockfile";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/lockfile-1.4.3.gem";
       sha256 = "0cxbyvxr3s5xsx85yghcs69d4lwwj0pg5la5cz2fp12hkk2szab3";
     };
     meta = {
       homepage = "http://codeforpeople.com/lib/ruby/lockfile/";
       license = []; # one of ?
       description = "[...]";
       longDescription = "";
     };
  };

  xrefresh_server_0_3_0 = rubyDerivation {
     name = "ruby-xrefresh-server-0.3.0"; # full_name
     nameNoVersion = "xrefresh_server";
     propagatedBuildInputs = [ json_1_2_4 term_ansicolor_1_0_5 ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/xrefresh-server-0.3.0.gem";
       sha256 = "1k80hadnmaxi8q8fw879xaj0ragy4bmqjqm7zjkv9bq8njb3i0c5";
     };
     meta = {
       homepage = "http://github.com/darwin/xrefresh-server";
       license = []; # one of ?
       description = "XRefresh is browser refresh automation for web developers[...]";
       longDescription = "XRefresh is browser refresh automation for web developers";
     };
  };

  net_ssh_2_0_21 = rubyDerivation {
     name = "ruby-net-ssh-2.0.21"; # full_name
     nameNoVersion = "net_ssh";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/net-ssh-2.0.21.gem";
       sha256 = "0wjfv68gn297vhb0r9qhlij9p7qnkn4afav0nylr6avrsd8mgdc4";
     };
     meta = {
       homepage = "http://github.com/net-ssh/net-ssh";
       license = []; # one of ?
       description = "Net::SSH: a pure-Ruby implementation of the SSH2 client protocol[...]";
       longDescription = "Net::SSH: a pure-Ruby implementation of the SSH2 client protocol.";
     };
  };

  gemcutter_0_5_0 = rubyDerivation {
     name = "ruby-gemcutter-0.5.0"; # full_name
     nameNoVersion = "gemcutter";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/gemcutter-0.5.0.gem";
       sha256 = "16pf64d0mj320llars6x1zl0vhv2x8vh7pwgqj0k48pyh5426iim";
     };
     meta = {
       homepage = "http://rubygems.org";
       license = []; # one of ?
       description = "Adds several commands to RubyGems for managing gems and more on RubyGems[...]";
       longDescription = "Adds several commands to RubyGems for managing gems and more on RubyGems.org.";
     };
  };

  rubyforge_2_0_4 = rubyDerivation {
     name = "ruby-rubyforge-2.0.4"; # full_name
     nameNoVersion = "rubyforge";
     propagatedBuildInputs = [ json_pure_1_2_4 ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/rubyforge-2.0.4.gem";
       sha256 = "1wdaa4nzy39yzy848fa1rybi72qlyf9vhi1ra9wpx9rpi810fwh1";
     };
     meta = {
       homepage = "http://codeforpeople.rubyforge.org/rubyforge/";
       license = []; # one of ?
       description = "A script which automates a limited set of rubyforge operations  * Run 'rubyforge help' for complete usage. * Setup: For f"; # cut to 120 chars
       longDescription = "A script which automates a limited set of rubyforge operations.

* Run 'rubyforge help' for complete usage.
* Setup: For first time users AND upgrades to 0.4.0:
  * rubyforge setup (deletes your username and password, so run sparingly!)
  * edit ~/.rubyforge/user-config.yml
  * rubyforge config
* For all rubyforge upgrades, run 'rubyforge config' to ensure you have latest.";
     };
  };

  rb_inotify_0_7_1 = rubyDerivation {
     name = "ruby-rb-inotify-0.7.1"; # full_name
     nameNoVersion = "rb_inotify";
     propagatedBuildInputs = [ ffi_0_6_3 ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/rb-inotify-0.7.1.gem";
       sha256 = "00q2zl9361ji5z7blgipphsjvnysyw016vbb0vh6f5i5v6fz5bzh";
     };
     meta = {
       homepage = "http://github.com/nex3/rb-notify";
       license = []; # one of ?
       description = "A Ruby wrapper for Linux's inotify, using FFI[...]";
       longDescription = "A Ruby wrapper for Linux's inotify, using FFI";
     };
  };

  locale_2_0_5 = rubyDerivation {
     name = "ruby-locale-2.0.5"; # full_name
     nameNoVersion = "locale";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/locale-2.0.5.gem";
       sha256 = "007yx9rx52as4ykkcm1aw29vgm6rk5xz8012814ynhlp1i0z1fi8";
     };
     meta = {
       homepage = "http://locale.rubyforge.org/";
       license = []; # one of ?
       description = "    Ruby-Locale is the pure ruby library which provides basic APIs for localization [...]";
       longDescription = "    Ruby-Locale is the pure ruby library which provides basic APIs for localization.
";
     };
  };

  mime_types_1_16 = rubyDerivation {
     name = "ruby-mime-types-1.16"; # full_name
     nameNoVersion = "mime_types";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/mime-types-1.16.gem";
       sha256 = "1slp7g2xv9ygcapqv13qgh3g6ipx5k5c3imb5sdyh0b9ip5s34y3";
     };
     meta = {
       homepage = "http://mime-types.rubyforge.org/";
       license = []; # one of ?
       description = "MIME::Types for Ruby originally based on and synchronized with MIME::Types for Perl by Mark Overmeer, copyright 2001 - 20"; # cut to 120 chars
       longDescription = "MIME::Types for Ruby originally based on and synchronized with MIME::Types for Perl by Mark Overmeer, copyright 2001 - 2009. As of version 1.15, the data format for the MIME::Type list has changed and the synchronization will no longer happen.";
     };
  };

  highline_1_5_2 = rubyDerivation {
     name = "ruby-highline-1.5.2"; # full_name
     nameNoVersion = "highline";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/highline-1.5.2.gem";
       sha256 = "0l25zris20drrwkhxx9hplq7g353xh960y5i19fdb7g84jl4bp19";
     };
     meta = {
       homepage = "http://highline.rubyforge.org";
       license = []; # one of ?
       description = "A high-level IO library that provides validation, type conversion, and more for command-line interfaces crank out anythin"; # cut to 120 chars
       longDescription = "A high-level IO library that provides validation, type conversion, and more for
command-line interfaces. HighLine also includes a complete menu system that can
crank out anything from simple list selection to complete shells with just
minutes of work.
";
     };
  };

  jeweler_1_4_0 = rubyDerivation {
     name = "ruby-jeweler-1.4.0"; # full_name
     nameNoVersion = "jeweler";
     propagatedBuildInputs = [ git_1_2_5 rubyforge_2_0_4 gemcutter_0_5_0 ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/jeweler-1.4.0.gem";
       sha256 = "0hsz38wc37k1zzmy1jjvsqj6am14n410bbxk1dhq55cgapnwm3kb";
     };
     meta = {
       homepage = "http://github.com/technicalpickles/jeweler";
       license = []; # one of ?
       description = "Simple and opinionated helper for creating Rubygem projects on GitHub[...]";
       longDescription = "Simple and opinionated helper for creating Rubygem projects on GitHub";
     };
  };

  sup_0_11 = rubyDerivation {
     name = "ruby-sup-0.11"; # full_name
     nameNoVersion = "sup";
     propagatedBuildInputs = [ xapian_full_1_1_3_4 ncurses_0_9_1 rmail_1_0_0 highline_1_5_2 net_ssh_2_0_21 trollop_1_16_2 lockfile_1_4_3 mime_types_1_16 gettext_2_1_0 ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/sup-0.11.gem";
       sha256 = "0dijz1vl1kk4axfnry71bnl2585y1hw0n6sizg9aag7r9m13194q";
     };
     meta = {
       homepage = "http://sup.rubyforge.org/";
       license = []; # one of ?
       description = "Sup is a console-based email client for people with a lot of email[...]";
       longDescription = "Sup is a console-based email client for people with a lot of email. It supports tagging, very fast full-text search, automatic contact-list management, and more. If you're the type of person who treats email as an extension of your long-term memory, Sup is for you.  Sup makes it easy to: - Handle massive amounts of email.  - Mix email from different sources: mbox files (even across different machines), Maildir directories, IMAP folders, POP accounts, and GMail accounts.  - Instantaneously search over your entire email collection. Search over body text, or use a query language to combine search predicates in any way.  - Handle multiple accounts. Replying to email sent to a particular account will use the correct SMTP server, signature, and from address.  - Add custom code to handle certain types of messages or to handle certain types of text within messages.  - Organize email with user-defined labels, automatically track recent contacts, and much more!  The goal of Sup is to become the email client of choice for nerds everywhere.";
     };
  };

  rmail_1_0_0 = rubyDerivation {
     name = "ruby-rmail-1.0.0"; # full_name
     nameNoVersion = "rmail";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/rmail-1.0.0.gem";
       sha256 = "0nsg7yda1gdwa96j4hlrp2s0m06vrhcc4zy5mbq7gxmlmwf9yixp";
     };
     meta = {
       homepage = "http://www.rfc20.org/rubymail";
       license = []; # one of ?
       description = "RMail is a lightweight mail library containing various utility classes and modules that allow ruby scripts to parse, modi"; # cut to 120 chars
       longDescription = "RMail is a lightweight mail library containing various utility classes and modules that allow ruby scripts to parse, modify, and generate MIME mail messages.";
     };
  };

  ncursesw_1_2_4_1 = rubyDerivation {
     name = "ruby-ncursesw-1.2.4.1"; # full_name
     nameNoVersion = "ncursesw";
     propagatedBuildInputs = [  ];
     src = fetchurl {
       url = "http://gems.rubyforge.org/gems/ncursesw-1.2.4.1.gem";
       sha256 = "0cn13h14pk8yds8aklpdcpzl0z6rqifpmaz4lw29g10lgwvfv409";
     };
     meta = {
       homepage = "http://ncurses-ruby.berlios.de/";
       license = []; # one of ?
       description = "Hacked up version of ncurses gem that supports wide characters and ruby1[...]";
       longDescription = "Hacked up version of ncurses gem that supports wide characters and ruby1.9.1. Original ncurses gem by t-peters@users.berlios.de.";
     };
  };

# aliases
rmail=rmail_1_0_0;
term_ansicolor=term_ansicolor_1_0_5;
rb_inotify=rb_inotify_0_7_1;
highline=highline_1_5_2;
rubygems_update=rubygems_update_1_3_6;
rake=rake_0_8_7;
sup=sup_0_11;
mime_types=mime_types_1_16;
rubyforge=rubyforge_2_0_4;
gemcutter=gemcutter_0_5_0;
net_ssh=net_ssh_2_0_21;
xrefresh_server=xrefresh_server_0_3_0;
xapian_full=xapian_full_1_1_3_4;
ncurses=ncurses_0_9_1;
json=json_1_2_4;
jeweler=jeweler_1_4_0;
gettext=gettext_2_1_0;
trollop=trollop_1_16_2;
git=git_1_2_5;
locale=locale_2_0_5;
chronic=chronic_0_2_3;
json_pure=json_pure_1_2_4;
lockfile=lockfile_1_4_3;
ffi=ffi_0_6_3;
ncursesw=ncursesw_1_2_4_1;
  # ================ END automatically generated code ================
  }; in libs
