diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix
index cb965b594a4f..6d5afdce496b 100644
--- a/pkgs/development/interpreters/ruby/default.nix
+++ b/pkgs/development/interpreters/ruby/default.nix
@@ -27,4 +27,9 @@ makeOverridable (stdenv.mkDerivation) rec {
     homepage = "http://www.ruby-lang.org/en/";
     description = "The Ruby language";
   };
+
+  passthru = {
+    # install ruby libs into "$out/${ruby.libPath}"
+    libPath = "lib/ruby-1.8";
+  };
 }
diff --git a/pkgs/development/interpreters/ruby/ruby-19.nix b/pkgs/development/interpreters/ruby/ruby-19.nix
index a05fef02170d..82393fe95c76 100644
--- a/pkgs/development/interpreters/ruby/ruby-19.nix
+++ b/pkgs/development/interpreters/ruby/ruby-19.nix
@@ -7,4 +7,8 @@ ruby18.override rec {
     url = "ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-${version}.tar.gz";
     sha256 = "1r4bls76dg97lqgwkxi6kbxzirkvjm21d4i2qyz469lnncvqwn9i";
   };
+
+  passthru = {
+    libPath = "lib/ruby-1.9";
+  };
 }
diff --git a/pkgs/development/libraries/xapian/1.0.14.nix b/pkgs/development/libraries/xapian/1.0.14.nix
new file mode 100644
index 000000000000..b4ce74640ea0
--- /dev/null
+++ b/pkgs/development/libraries/xapian/1.0.14.nix
@@ -0,0 +1,17 @@
+args: with args;
+stdenv.mkDerivation {
+  name = "xapian-${version}";
+
+  src = fetchurl {
+    url = http://oligarchy.co.uk/xapian/1.0.14/xapian-core-1.0.14.tar.gz;
+    sha256 = "0d51p6210059dbf0vn6zh2iyg4i5pynmhyh0gphnph2b317a1dcx";
+  };
+
+  buildInputs = [zlib];
+
+  meta = { 
+      description = "Xapian Probabilistic Information Retrieval library";
+      homepage = "http://xapian.org";
+      license = "GPLv2";
+  };
+}
diff --git a/pkgs/development/libraries/xapian/bindings/1.0.14.nix b/pkgs/development/libraries/xapian/bindings/1.0.14.nix
new file mode 100644
index 000000000000..9761c6834474
--- /dev/null
+++ b/pkgs/development/libraries/xapian/bindings/1.0.14.nix
@@ -0,0 +1,72 @@
+args: with args;
+
+let inherit (args.composableDerivation) composableDerivation wwf; in
+composableDerivation {} {
+
+    name = "xapian-bindings-${version}";
+
+    src = fetchurl {
+      url = http://oligarchy.co.uk/xapian/1.0.14/xapian-bindings-1.0.14.tar.gz;
+      sha256 = "060jjwddv6ws8iy3jkpl4zcrzzinkjvdblkl0gcja90qzl2j81q5";
+    };
+
+    buildInputs = [xapian pkgconfig];
+
+    # most interpreters aren't tested yet.. (see python for example how to do it)
+    flags =
+         wwf {
+           name = "python";
+           enable = {
+            buildInputs = [ python ];
+            # export same env vars as in pythonNew
+            preConfigure = ''
+              export PYTHON_LIB=$out/lib/${python.libPrefix}/site-packages
+              ensureDir $out/nix-support
+              echo "export NIX_PYTHON_SITES=\"$out:\$NIX_PYTHON_SITES\"" >> $out/nix-support/setup-hook 
+              echo "export PYTHONPATH=\"$PYTHON_LIB:\$PYTHONPATH\"" >> $out/nix-support/setup-hook 
+            '';
+           };
+         }
+      // wwf {
+           name = "php";
+           enable = {
+             buildInputs = [ php ];
+             preConfigure = ''
+               export PHP_EXTENSION_DIR=$out/lib/php # TODO use a sane directory. Its not used anywhere by now
+             '';
+           };
+         }
+      // wwf {
+           name = "ruby";
+           enable = {
+             buildInputs = [ ruby ];
+             # export same env vars as in rubyLibs 
+             preConfigure = ''
+               export RUBY_LIB=$out/${ruby.libPath}
+               export RUBY_LIB_ARCH=$RUBY_LIB
+               ensureDir $out/nix-support
+               echo "export RUBYLIB=\"$RUBY_LIB:\$RUBYLIB\"" >> $out/nix-support/setup-hook 
+               echo "export GEM_PATH=\"$out:\$GEM_PATH\"" >> $out/nix-support/setup-hook 
+             '';
+           };
+         }
+
+      # note: see configure --help to get see which env vars can be used
+      # // wwf { name = "tcl";     enable = { buildInputs = [ tcl ];};}
+      # // wwf { name = "csharp"; }
+      # // wwf { name = "java"; }
+      ;
+
+  cfg = {
+    pythonSupport = true;
+    phpSupport = true;
+    rubySupport = true;
+  };
+
+  meta = { 
+      description = "bindings for the xapian library";
+      homepage = xapian.meta.homepage;
+      license = "GPLv2";
+  };
+
+}
diff --git a/pkgs/lib/misc.nix b/pkgs/lib/misc.nix
index dc73a2f68863..60aecd5aa630 100644
--- a/pkgs/lib/misc.nix
+++ b/pkgs/lib/misc.nix
@@ -325,7 +325,9 @@ rec {
   # sane defaults (same name as attr name so that inherit can be used)
   mergeAttrBy = # { buildInputs = concatList; [...]; passthru = mergeAttr; [..]; }
     listToAttrs (map (n : nameValuePair n lib.concat) [ "buildInputs" "propagatedBuildInputs" "configureFlags" "prePhases" "postAll" ])
-    // listToAttrs (map (n : nameValuePair n lib.mergeAttrs) [ "passthru" "meta" "cfg" "flags" ]);
+    // listToAttrs (map (n : nameValuePair n lib.mergeAttrs) [ "passthru" "meta" "cfg" "flags" ])
+    // listToAttrs (map (n : nameValuePair n (a: b: "${a}\n${b}") ) [ "preConfigure" ])
+  ;
 
   # returns atribute values as a list 
   flattenAttrs = set : map ( attr : builtins.getAttr attr set) (attrNames set);
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index a2d78024e98c..3b6642e70d0e 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -4160,6 +4160,16 @@ let
     inherit fetchurl stdenv;
   };
 
+
+  xapian = makeOverridable (selectVersion ../development/libraries/xapian "1.0.14") {
+    inherit fetchurl stdenv zlib;
+  };
+
+  xapianBindings = (selectVersion ../development/libraries/xapian/bindings "1.0.14") {
+    inherit fetchurl stdenv xapian composableDerivation pkgconfig;
+    inherit ruby perl php tcl python; # TODO perl php Java, tcl, C#, python
+  };
+
   Xaw3d = import ../development/libraries/Xaw3d {
     inherit fetchurl stdenv x11 bison;
     flex = flex2533;