summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorAlexander Foremny <alexanderforemny@gmail.com>2012-08-26 14:46:43 +0200
committerAlexander Foremny <alexanderforemny@gmail.com>2012-08-26 14:46:43 +0200
commit172e6f5e7747438e05e6746ccf124cd693d1de46 (patch)
tree3f4d25ac017c2a080392940e200dbcb3c4b60593 /pkgs
parentc89a0d6c4f875fe4a3340b017b66057caec1ab6f (diff)
parent84e1da4b09e2332447e5a2d9fc4e45b2499d7cc0 (diff)
downloadnixpkgs-172e6f5e7747438e05e6746ccf124cd693d1de46.tar
nixpkgs-172e6f5e7747438e05e6746ccf124cd693d1de46.tar.gz
nixpkgs-172e6f5e7747438e05e6746ccf124cd693d1de46.tar.bz2
nixpkgs-172e6f5e7747438e05e6746ccf124cd693d1de46.tar.lz
nixpkgs-172e6f5e7747438e05e6746ccf124cd693d1de46.tar.xz
nixpkgs-172e6f5e7747438e05e6746ccf124cd693d1de46.tar.zst
nixpkgs-172e6f5e7747438e05e6746ccf124cd693d1de46.zip
Merge remote-tracking branch 'upstream/master' into plowshare
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/audio/flac/default.nix23
-rw-r--r--pkgs/applications/audio/jack-capture/default.nix28
-rw-r--r--pkgs/applications/display-managers/slim/default.nix32
-rw-r--r--pkgs/applications/display-managers/slim/pam.patch89
-rw-r--r--pkgs/applications/display-managers/slim/pam2.patch20
-rw-r--r--pkgs/applications/editors/emacs-modes/color-theme/default.nix26
-rw-r--r--pkgs/applications/editors/emacs-modes/color-theme/fix-build.patch19
-rw-r--r--pkgs/applications/editors/emacs-modes/color-theme/gnus-bug.diff28
-rw-r--r--pkgs/applications/editors/emacs-modes/jade/default.nix30
-rw-r--r--pkgs/applications/editors/emacs-modes/rect-mark/default.nix32
-rw-r--r--pkgs/applications/editors/emacs-modes/sunrise-commander/default.nix32
-rw-r--r--pkgs/applications/graphics/gimp/default.nix8
-rw-r--r--pkgs/applications/misc/gpsbabel/default.nix26
-rw-r--r--pkgs/applications/misc/gxneur/default.nix24
-rw-r--r--pkgs/applications/misc/xpdf/default.nix4
-rw-r--r--pkgs/applications/networking/browsers/chromium/default.nix4
-rw-r--r--pkgs/applications/networking/browsers/chromium/sources.nix19
-rwxr-xr-xpkgs/applications/networking/browsers/chromium/update.sh103
-rw-r--r--pkgs/applications/networking/browsers/firefox/12.0.nix6
-rw-r--r--pkgs/applications/networking/browsers/firefox/13.0.nix6
-rw-r--r--pkgs/applications/networking/browsers/firefox/3.6.nix6
-rw-r--r--pkgs/applications/networking/cluster/hadoop/default.nix51
-rw-r--r--pkgs/applications/networking/mailreaders/notmuch/default.nix4
-rw-r--r--pkgs/applications/office/openoffice/libreoffice.nix2
-rw-r--r--pkgs/applications/science/logic/coq/8.3.nix69
-rw-r--r--pkgs/applications/science/logic/coq/configure.8.3.patch1112
-rw-r--r--pkgs/applications/science/logic/coq/configure.patch1101
-rw-r--r--pkgs/applications/science/logic/coq/default.nix46
-rw-r--r--pkgs/applications/version-management/git-and-tools/default.nix18
-rw-r--r--pkgs/applications/version-management/git-and-tools/tig/default.nix19
-rw-r--r--pkgs/applications/virtualization/virtualbox/default.nix72
-rw-r--r--pkgs/applications/virtualization/virtualbox/guest-additions/default.nix63
-rw-r--r--pkgs/build-support/fetchurl/default.nix32
-rw-r--r--pkgs/build-support/fetchurl/mirrors.nix6
-rw-r--r--pkgs/build-support/release/ant-build.nix4
-rw-r--r--pkgs/build-support/vm/default.nix1
-rw-r--r--pkgs/data/documentation/man-pages/default.nix4
-rw-r--r--pkgs/data/misc/hicolor-icon-theme/default.nix1
-rw-r--r--pkgs/desktops/xfce-4.8/support/gvfs.nix4
-rw-r--r--pkgs/development/compilers/gcc/4.5/default.nix2
-rw-r--r--pkgs/development/compilers/gcc/4.5/sources.nix14
-rw-r--r--pkgs/development/compilers/gcc/4.7/default.nix2
-rw-r--r--pkgs/development/compilers/ghc/7.6.1.nix46
-rw-r--r--pkgs/development/compilers/jdk/builder.sh34
-rw-r--r--pkgs/development/compilers/jdk/default-1.4.nix9
-rw-r--r--pkgs/development/compilers/jdk/default-5.nix9
-rw-r--r--pkgs/development/compilers/jdk/default.nix2
-rw-r--r--pkgs/development/compilers/jdk/ibm-builder.sh29
-rw-r--r--pkgs/development/compilers/jdk/j2sdk-1.4.x-sun-linux.nix24
-rw-r--r--pkgs/development/compilers/jdk/jdk5-ibm-powerpc-linux.nix17
-rw-r--r--pkgs/development/compilers/jdk/jdk5-oracle-linux.nix36
-rw-r--r--pkgs/development/compilers/jdk/jdk6-cygwin.nix4
-rw-r--r--pkgs/development/compilers/jdk/jdk6-linux.nix4
-rw-r--r--pkgs/development/compilers/julia/default.nix12
-rw-r--r--pkgs/development/compilers/openjdk/bootstrap.nix21
-rw-r--r--pkgs/development/compilers/openjdk/default.nix1
-rw-r--r--pkgs/development/compilers/openjdk/make-bootstrap.nix26
-rw-r--r--pkgs/development/compilers/scala/default.nix6
-rw-r--r--pkgs/development/compilers/urweb/default.nix6
-rw-r--r--pkgs/development/eclipse/ecj/default.nix8
-rw-r--r--pkgs/development/libraries/babl/0_0_22.nix16
-rw-r--r--pkgs/development/libraries/gegl/0_0_22.nix21
-rw-r--r--pkgs/development/libraries/glib/2.30.x.nix8
-rw-r--r--pkgs/development/libraries/gnutls/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/ListLike/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/MonadCatchIO-mtl/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/RepLib/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/accelerate-examples/default.nix2
-rw-r--r--pkgs/development/libraries/haskell/async/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/attoparsec/enumerator.nix4
-rw-r--r--pkgs/development/libraries/haskell/authenticate/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/blaze-builder-enumerator/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/case-insensitive/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/certificate/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/clientsession/default.nix3
-rw-r--r--pkgs/development/libraries/haskell/cmdargs/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/comonad/3.0.0.2.nix (renamed from pkgs/development/libraries/haskell/comonad/3.0.0.1.nix)4
-rw-r--r--pkgs/development/libraries/haskell/criterion/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/cuda/default.nix2
-rw-r--r--pkgs/development/libraries/haskell/fast-logger/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/fclabels/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/filestore/default.nix3
-rw-r--r--pkgs/development/libraries/haskell/glpk-hs/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/hamlet/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/happstack/happstack-hamlet.nix3
-rw-r--r--pkgs/development/libraries/haskell/happstack/happstack-server.nix3
-rw-r--r--pkgs/development/libraries/haskell/hashable/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/highlighting-kate/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/hledger-lib/default.nix3
-rw-r--r--pkgs/development/libraries/haskell/hledger/default.nix3
-rw-r--r--pkgs/development/libraries/haskell/hoogle/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/http-conduit/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/http-types/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/io-choice/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/lifted-base/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/mime-mail/default.nix3
-rw-r--r--pkgs/development/libraries/haskell/mwc-random/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/network/2.3.1.0.nix (renamed from pkgs/development/libraries/haskell/network/2.3.0.14.nix)4
-rw-r--r--pkgs/development/libraries/haskell/pandoc/default.nix3
-rw-r--r--pkgs/development/libraries/haskell/postgresql-libpq/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/postgresql-simple/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/process-extras/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/semigroups/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/shakespeare-css/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/shakespeare-js/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/shakespeare-text/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/shakespeare/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/simple-sendfile/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/skein/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/split/0.1.nix13
-rw-r--r--pkgs/development/libraries/haskell/split/default.nix5
-rw-r--r--pkgs/development/libraries/haskell/tagsoup/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/text/0.11.2.3.nix (renamed from pkgs/development/libraries/haskell/text/0.11.2.2.nix)4
-rw-r--r--pkgs/development/libraries/haskell/threadmanager/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/tls/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/unbound/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/unix-time/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/unordered-containers/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/uu-parsinglib/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/vault/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/vector-algorithms/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/wai-app-static/default.nix5
-rw-r--r--pkgs/development/libraries/haskell/wl-pprint-text/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/yesod-auth/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/yesod-core/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/yesod-form/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/yesod/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/zlib-bindings/default.nix4
-rw-r--r--pkgs/development/libraries/java/rhino/default.nix2
-rw-r--r--pkgs/development/libraries/liblockfile/default.nix30
-rw-r--r--pkgs/development/libraries/nss/default.nix123
-rw-r--r--pkgs/development/libraries/nss/nix_secload_fixup.patch50
-rw-r--r--pkgs/development/libraries/openssl/default.nix5
-rw-r--r--pkgs/development/libraries/openssl/kfreebsd-gnu.patch36
-rw-r--r--pkgs/development/libraries/polkit/default.nix20
-rw-r--r--pkgs/development/perl-modules/Compress-Raw-Zlib/default.nix4
-rw-r--r--pkgs/development/perl-modules/DBD-SQLite/default.nix10
-rw-r--r--pkgs/development/tools/boomerang/default.nix30
-rw-r--r--pkgs/development/tools/boomerang/dlopen_path.patch13
-rw-r--r--pkgs/development/tools/haskell/hlint/default.nix4
-rw-r--r--pkgs/development/tools/misc/autobuild/default.nix2
-rw-r--r--pkgs/development/tools/misc/cscope/default.nix6
-rw-r--r--pkgs/development/tools/misc/gdb/default.nix4
-rw-r--r--pkgs/development/tools/misc/gdb/pstack.nix11
-rw-r--r--pkgs/development/tools/misc/patchelf/unstable.nix16
-rw-r--r--pkgs/development/web/nodejs/build-node-package.nix4
-rw-r--r--pkgs/development/web/nodejs/default.nix16
-rw-r--r--pkgs/lib/attrsets.nix20
-rw-r--r--pkgs/lib/debug.nix2
-rw-r--r--pkgs/lib/lists.nix89
-rw-r--r--pkgs/lib/misc.nix20
-rw-r--r--pkgs/lib/modules.nix14
-rw-r--r--pkgs/lib/options.nix16
-rw-r--r--pkgs/lib/strings.nix6
-rw-r--r--pkgs/lib/tests.nix29
-rw-r--r--pkgs/lib/types.nix2
-rw-r--r--pkgs/misc/maven/3.0.nix15
-rw-r--r--pkgs/misc/maven/default.nix6
-rw-r--r--pkgs/misc/maven/maven-1.0.nix16
-rw-r--r--pkgs/os-specific/linux/atop/default.nix39
-rw-r--r--pkgs/os-specific/linux/busybox/default.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-3.2.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-3.3.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-3.4.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-3.5.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/patches.nix18
-rw-r--r--pkgs/os-specific/linux/lvm2/default.nix25
-rw-r--r--pkgs/os-specific/linux/microcode/converter.nix4
-rw-r--r--pkgs/os-specific/linux/nvidia-x11/default.nix6
-rw-r--r--pkgs/os-specific/linux/sysstat/default.nix4
-rw-r--r--pkgs/os-specific/linux/sysstat/no-install-statedir.patch37
-rw-r--r--pkgs/os-specific/linux/systemd/default.nix12
-rw-r--r--pkgs/os-specific/linux/upower/default.nix24
-rw-r--r--pkgs/servers/samba/default.nix7
-rw-r--r--pkgs/servers/sql/postgresql/8.3.x.nix6
-rw-r--r--pkgs/servers/sql/postgresql/8.4.x.nix6
-rw-r--r--pkgs/servers/sql/postgresql/9.0.x.nix6
-rw-r--r--pkgs/servers/sql/postgresql/9.1.x.nix6
-rw-r--r--pkgs/shells/bash-completion/default.nix11
-rw-r--r--pkgs/stdenv/generic/default.nix41
-rw-r--r--pkgs/tools/archivers/atool/default.nix18
-rw-r--r--pkgs/tools/misc/desktop-file-utils/default.nix1
-rw-r--r--pkgs/tools/misc/lockfile-progs/default.nix29
-rw-r--r--pkgs/tools/misc/ncdu/default.nix19
-rw-r--r--pkgs/tools/misc/pv/default.nix4
-rw-r--r--pkgs/tools/misc/xclip/default.nix8
-rw-r--r--pkgs/tools/package-management/nix/unstable.nix6
-rw-r--r--pkgs/tools/system/gptfdisk/default.nix4
-rw-r--r--pkgs/tools/system/logcheck/default.nix45
-rw-r--r--pkgs/top-level/all-packages.nix123
-rw-r--r--pkgs/top-level/haskell-defaults.nix6
-rw-r--r--pkgs/top-level/haskell-packages.nix18
-rw-r--r--pkgs/top-level/node-packages.nix10
-rw-r--r--pkgs/top-level/perl-packages.nix28
-rw-r--r--pkgs/top-level/release.nix5
195 files changed, 2903 insertions, 2104 deletions
diff --git a/pkgs/applications/audio/flac/default.nix b/pkgs/applications/audio/flac/default.nix
index 4eef90b575c..fa201d20c3f 100644
--- a/pkgs/applications/audio/flac/default.nix
+++ b/pkgs/applications/audio/flac/default.nix
@@ -1,24 +1,25 @@
-{stdenv, fetchurl, libogg}:
+{ stdenv, fetchurl, libogg }:
 
 stdenv.mkDerivation rec {
   name = "flac-1.2.1";
-  
+
   src = fetchurl {
     url = mirror://sourceforge/flac/flac-1.2.1.tar.gz;
     sha256 = "1pry5lgzfg57pga1zbazzdd55fkgk3v5qy4axvrbny5lrr5s8dcn";
   };
 
-  buildInputs = [libogg];
+  buildInputs = [ libogg ];
+
+  patches =
+    [ # Fix for building on GCC 4.3.
+      (fetchurl {
+        url = "http://sources.gentoo.org/viewcvs.py/*checkout*/gentoo-x86/media-libs/flac/files/flac-1.2.1-gcc-4.3-includes.patch?rev=1.1";
+        sha256 = "1m6ql5vyjb2jlp5qiqp6w0drq1m6x6y3i1dnl5ywywl3zd36k0mr";
+      })
+    ];
 
-  patches = [
-    # Fix for building on GCC 4.3.
-    (fetchurl {
-      url = "http://sources.gentoo.org/viewcvs.py/*checkout*/gentoo-x86/media-libs/flac/files/flac-1.2.1-gcc-4.3-includes.patch?rev=1.1";
-      sha256 = "1m6ql5vyjb2jlp5qiqp6w0drq1m6x6y3i1dnl5ywywl3zd36k0mr";
-    })
-  ];
-  
   meta = {
     homepage = http://flac.sourceforge.net;
+    description = "Library and tools for encoding and decoding the FLAC lossless audio file format";
   };
 }
diff --git a/pkgs/applications/audio/jack-capture/default.nix b/pkgs/applications/audio/jack-capture/default.nix
new file mode 100644
index 00000000000..3b8f0f652a8
--- /dev/null
+++ b/pkgs/applications/audio/jack-capture/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl, jackaudio, libsndfile, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "jack_capture-${version}";
+  version = "0.9.69";
+
+  src = fetchurl {
+    url = "http://archive.notam02.no/arkiv/src/${name}.tar.gz";
+    sha256 = "0sk7b92my1v1g7rhkpl1c608rb0rdb28m9zqfll95kflxajd16zv";
+  };
+
+  buildInputs = [ jackaudio libsndfile pkgconfig ];
+
+  buildPhase = "PREFIX=$out make jack_capture";
+
+  installPhase = ''
+    mkdir -p $out/bin
+    cp jack_capture $out/bin/
+  '';
+
+  meta = with stdenv.lib; { 
+    description = "A program for recording soundfiles with jack";
+    homepage = http://archive.notam02.no/arkiv/src;
+    license = licenses.gpl2;
+    maintainers = [ maintainers.goibhniu ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/pkgs/applications/display-managers/slim/default.nix b/pkgs/applications/display-managers/slim/default.nix
index be546d76836..0675b02a314 100644
--- a/pkgs/applications/display-managers/slim/default.nix
+++ b/pkgs/applications/display-managers/slim/default.nix
@@ -1,39 +1,33 @@
-{stdenv, fetchurl, x11, libjpeg, libpng12, libXmu, freetype, pam}:
+{ stdenv, fetchurl, cmake, pkgconfig, x11, libjpeg, libpng12, libXmu
+, fontconfig, freetype, pam, consolekit, dbus_libs }:
 
 stdenv.mkDerivation rec {
-  name = "slim-1.3.2";
+  name = "slim-1.3.4";
 
   src = fetchurl {
     url = "http://download.berlios.de/slim/${name}.tar.gz";
-    sha256 = "1f42skdp5k1zrb364s3i0ps5wmx9szz9h192i2dkn9az00jh2mpi";
+    sha256 = "00fmrg2v41jnqhx0yc1kv97xxh5gai18n0i4as9g1fcq1i32cp0m";
   };
 
   patches = [
     # Allow the paths of the configuration file and theme directory to
     # be set at runtime.
     ./runtime-paths.patch
-
-    # Fix a bug in slim's PAM support: the "resp" argument to the
-    # conversation function is a pointer to a pointer to an array of
-    # pam_response structures, not a pointer to an array of pointers to
-    # pam_response structures.  Of course C can't tell the difference...
-    ./pam.patch
-
-    # Don't set PAM_RHOST to "localhost", it confuses ConsoleKit
-    # (which assumes that a non-empty string means a remote session).
-    ./pam2.patch
   ];
 
-  buildInputs = [x11 libjpeg libpng12 libXmu freetype pam];
+  buildInputs =
+    [ cmake pkgconfig x11 libjpeg libpng12 libXmu fontconfig freetype
+      pam dbus_libs
+    ] ++ stdenv.lib.optional (consolekit != null) consolekit;
+
+  preConfigure = "substituteInPlace CMakeLists.txt --replace /etc $out/etc";
 
-  NIX_CFLAGS_COMPILE = "-I${freetype}/include/freetype2";
+  cmakeFlags = [ "-DUSE_PAM=1" ] ++ stdenv.lib.optional (consolekit != null) "-DUSE_CONSOLEKIT=1";
 
-  preBuild = ''
-    substituteInPlace Makefile --replace /usr /no-such-path
-    makeFlagsArray=(CC=gcc CXX=g++ PREFIX=$out MANDIR=$out/share/man CFGDIR=$out/etc USE_PAM=1)
-  '';
+  NIX_CFLAGS_LINK = "-lXmu";
 
   meta = {
     homepage = http://slim.berlios.de;
+    platforms = stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/applications/display-managers/slim/pam.patch b/pkgs/applications/display-managers/slim/pam.patch
deleted file mode 100644
index 2163d20a5e3..00000000000
--- a/pkgs/applications/display-managers/slim/pam.patch
+++ /dev/null
@@ -1,89 +0,0 @@
-diff -rc slim-1.3.1-orig/app.cpp slim-1.3.1/app.cpp
-*** slim-1.3.1-orig/app.cpp	2008-09-26 02:54:15.000000000 +0200
---- slim-1.3.1/app.cpp	2009-02-17 19:50:06.000000000 +0100
-***************
-*** 41,48 ****
-      Panel* panel = *static_cast<Panel**>(appdata_ptr);
-      int result = PAM_SUCCESS;
-      for (int i=0; i<num_msg; i++){
-!         resp[i]->resp=0;
-!         resp[i]->resp_retcode=0;
-          switch(msg[i]->msg_style){
-              case PAM_PROMPT_ECHO_ON:
-                  // We assume PAM is asking for the username
---- 41,48 ----
-      Panel* panel = *static_cast<Panel**>(appdata_ptr);
-      int result = PAM_SUCCESS;
-      for (int i=0; i<num_msg; i++){
-!         (*resp)[i].resp=0;
-!         (*resp)[i].resp_retcode=0;
-          switch(msg[i]->msg_style){
-              case PAM_PROMPT_ECHO_ON:
-                  // We assume PAM is asking for the username
-***************
-*** 51,63 ****
-                      case Panel::Suspend:
-                      case Panel::Halt:
-                      case Panel::Reboot:
-!                         resp[i]->resp=strdup("root");
-                          break;
-  
-                      case Panel::Console:
-                      case Panel::Exit:
-                      case Panel::Login:
-!                         resp[i]->resp=strdup(panel->GetName().c_str());
-                          break;
-                  }
-                  break;
---- 51,63 ----
-                      case Panel::Suspend:
-                      case Panel::Halt:
-                      case Panel::Reboot:
-!                         (*resp)[i].resp=strdup("root");
-                          break;
-  
-                      case Panel::Console:
-                      case Panel::Exit:
-                      case Panel::Login:
-!                         (*resp)[i].resp=strdup(panel->GetName().c_str());
-                          break;
-                  }
-                  break;
-***************
-*** 73,79 ****
-  
-                      default:
-                          panel->EventHandler(Panel::Get_Passwd);
-!                         resp[i]->resp=strdup(panel->GetPasswd().c_str());
-                          break;
-                  }
-                  break;
---- 73,79 ----
-  
-                      default:
-                          panel->EventHandler(Panel::Get_Passwd);
-!                         (*resp)[i].resp=strdup(panel->GetPasswd().c_str());
-                          break;
-                  }
-                  break;
-***************
-*** 89,97 ****
-      }
-      if (result!=PAM_SUCCESS){
-          for (int i=0; i<num_msg; i++){
-!             if (resp[i]->resp==0) continue;
-!             free(resp[i]->resp);
-!             resp[i]->resp=0;
-          };
-          free(*resp);
-          *resp=0;
---- 89,97 ----
-      }
-      if (result!=PAM_SUCCESS){
-          for (int i=0; i<num_msg; i++){
-!             if ((*resp)[i].resp==0) continue;
-!             free((*resp)[i].resp);
-!             (*resp)[i].resp=0;
-          };
-          free(*resp);
-          *resp=0;
diff --git a/pkgs/applications/display-managers/slim/pam2.patch b/pkgs/applications/display-managers/slim/pam2.patch
deleted file mode 100644
index 48cf661864b..00000000000
--- a/pkgs/applications/display-managers/slim/pam2.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-diff -rc slim-1.3.1-orig/app.cpp slim-1.3.1/app.cpp
-*** slim-1.3.1-orig/app.cpp	2008-09-26 02:54:15.000000000 +0200
---- slim-1.3.1/app.cpp	2009-08-17 02:59:37.000000000 +0200
-***************
-*** 226,232 ****
-          pam.start("slim");
-          pam.set_item(PAM::Authenticator::TTY, DisplayName);
-          pam.set_item(PAM::Authenticator::Requestor, "root");
-!         pam.set_item(PAM::Authenticator::Host, "localhost");
-  
-      }
-      catch(PAM::Exception& e){
---- 226,232 ----
-          pam.start("slim");
-          pam.set_item(PAM::Authenticator::TTY, DisplayName);
-          pam.set_item(PAM::Authenticator::Requestor, "root");
-!         pam.set_item(PAM::Authenticator::Host, "");
-  
-      }
-      catch(PAM::Exception& e){
diff --git a/pkgs/applications/editors/emacs-modes/color-theme/default.nix b/pkgs/applications/editors/emacs-modes/color-theme/default.nix
new file mode 100644
index 00000000000..9cc0e7fd42b
--- /dev/null
+++ b/pkgs/applications/editors/emacs-modes/color-theme/default.nix
@@ -0,0 +1,26 @@
+{stdenv, fetchurl, emacs}:
+
+stdenv.mkDerivation rec {
+  name = "color-theme-6.6.0";
+
+  src = fetchurl {
+    url = "http://download.savannah.gnu.org/releases/color-theme/${name}.tar.gz";
+    sha256 = "0yx1ghcjc66s1rl0v3d4r1k88ifw591hf814ly3d73acvh15zlsn";
+  };
+
+  # patches from http://aur.archlinux.org/packages.php?ID=54883
+  patches = [ ./fix-build.patch ./gnus-bug.diff ];
+
+  buildInputs = [ emacs ];
+
+  installFlags = [ "ELISPDIR=$(out)/share/emacs/site-lisp" ];
+  installTargets = "install-bin";
+
+  meta = {
+    description = "An emacs-lisp mode for skinning your emacs.";
+    homepage = http://www.nongnu.org/color-theme;
+    license = "GPLv2+";
+
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/pkgs/applications/editors/emacs-modes/color-theme/fix-build.patch b/pkgs/applications/editors/emacs-modes/color-theme/fix-build.patch
new file mode 100644
index 00000000000..cfc237c8cdc
--- /dev/null
+++ b/pkgs/applications/editors/emacs-modes/color-theme/fix-build.patch
@@ -0,0 +1,19 @@
+--- a/Makefile	2009-05-15 18:22:49.000000000 +0200
++++ b/Makefile	2009-05-16 08:59:36.000000000 +0200
+@@ -15,6 +15,7 @@
+ TARGET	= $(patsubst %.el,%.elc,$(SPECIAL) $(SOURCE))
+ MANUAL  = color-theme
+ MISC	= AUTHORS COPYING ChangeLog Makefile.defs Makefile $(AUTOLOADFILE).in
++LOADPATH = "$(shell pwd)" "$(shell pwd)/themes"
+ #AUTHORS CREDITS HISTORY NEWS README Makefile ChangeLog \
+ #ChangeLog.2005 ChangeLog.2004 ChangeLog.2003 ChangeLog.2002 \
+ #ChangeLog.2001 servers.pl color-theme-auto.in color-theme.texi
+@@ -47,7 +48,7 @@
+ 
+ %.elc: %.el
+ 	@$(EMACS) $(OPTIONCOMPILE) \
+-	--eval '(setq load-path (cons "." load-path))' \
++	--eval '(setq load-path (append load-path (list $(LOADPATH))))' \
+ 	-f batch-byte-compile $<
+ 
+ %.info: %.texi
diff --git a/pkgs/applications/editors/emacs-modes/color-theme/gnus-bug.diff b/pkgs/applications/editors/emacs-modes/color-theme/gnus-bug.diff
new file mode 100644
index 00000000000..9d227df562e
--- /dev/null
+++ b/pkgs/applications/editors/emacs-modes/color-theme/gnus-bug.diff
@@ -0,0 +1,28 @@
+diff -Naur color-theme-6.6.0.orig/color-theme.el color-theme-6.6.0.new/color-theme.el
+--- color-theme-6.6.0.orig/color-theme.el	2011-11-18 01:17:29.000000000 +0100
++++ color-theme-6.6.0.new/color-theme.el	2011-11-18 01:24:07.000000000 +0100
+@@ -73,9 +73,10 @@
+   "Non-nil if running XEmacs.")
+ 
+ ;; Add this since it appears to miss in emacs-2x
+-(or (fboundp 'replace-in-string)
+-    (defun replace-in-string (target old new)
+-      (replace-regexp-in-string old new  target)))
++(if (fboundp 'replace-in-string)
++    (defalias 'color-theme-replace-in-string 'replace-in-string)
++  (defsubst color-theme-replace-in-string (target old new &optional literal)
++    (replace-regexp-in-string old new target nil literal)))
+ 
+ ;; face-attr-construct has a problem in Emacs 20.7 and older when
+ ;; dealing with inverse-video faces.  Here is a short test to check
+@@ -1626,8 +1627,8 @@
+        (add-to-list 'color-themes
+                     (list ',n
+                           (upcase-initials
+-                           (replace-in-string
+-                            (replace-in-string 
++                           (color-theme-replace-in-string
++                            (color-theme-replace-in-string 
+                              (symbol-name ',n) "^color-theme-" "") "-" " "))
+                           ,author))
+        (defun ,n ()
diff --git a/pkgs/applications/editors/emacs-modes/jade/default.nix b/pkgs/applications/editors/emacs-modes/jade/default.nix
new file mode 100644
index 00000000000..0c99ceaca22
--- /dev/null
+++ b/pkgs/applications/editors/emacs-modes/jade/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchgit, emacs }:
+
+stdenv.mkDerivation {
+  name = "jade-mode-0-20120802";
+
+  src = fetchgit {
+    url = "https://github.com/brianc/jade-mode.git";
+    rev = "275ab149edb0f6bcfae6ac17ba456f3351191604";
+    sha256 = "3cd2bebcd66e59d60b8e5e538e65a8ffdfc9a53b86443090a284e8329d7cb09b";
+  };
+
+  buildInputs = [ emacs ];
+
+  buildPhase = ''
+    emacs --batch -L . -f batch-byte-compile *.el
+  '';
+
+  installPhase = ''
+    mkdir -p $out/share/emacs/site-lisp
+    cp *.el *.elc $out/share/emacs/site-lisp/
+  '';
+
+  meta = {
+    description = "Emacs major mode for jade and stylus.";
+    homepage = https://github.com/brianc/jade-mode;
+    license = "GPLv2+";
+
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/pkgs/applications/editors/emacs-modes/rect-mark/default.nix b/pkgs/applications/editors/emacs-modes/rect-mark/default.nix
new file mode 100644
index 00000000000..ac01e02b433
--- /dev/null
+++ b/pkgs/applications/editors/emacs-modes/rect-mark/default.nix
@@ -0,0 +1,32 @@
+{stdenv, fetchurl, emacs}:
+
+stdenv.mkDerivation rec {
+  name = "rect-mark-1.4";
+
+  src = fetchurl {
+    url = "http://emacswiki.org/emacs/download/rect-mark.el";
+    sha256 = "0pyyg53z9irh5jdfvh2qp4pm8qrml9r7lh42wfmdw6c7f56qryh8";
+  };
+
+  phases = [ "buildPhase" "installPhase"];
+
+  buildInputs = [ emacs ];
+
+  buildPhase = ''
+    cp $src rect-mark.el
+    emacs --batch -f batch-byte-compile rect-mark.el
+  '';
+
+  installPhase = ''
+    install -d $out/share/emacs/site-lisp
+    install rect-mark.el* $out/share/emacs/site-lisp
+  '';
+
+  meta = {
+    description = "Mark a rectangle of text with highlighting.";
+    homepage = http://emacswiki.org/emacs/RectangleMark;
+    license = "GPLv2+";
+
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/pkgs/applications/editors/emacs-modes/sunrise-commander/default.nix b/pkgs/applications/editors/emacs-modes/sunrise-commander/default.nix
new file mode 100644
index 00000000000..c15ff6afcb2
--- /dev/null
+++ b/pkgs/applications/editors/emacs-modes/sunrise-commander/default.nix
@@ -0,0 +1,32 @@
+{stdenv, fetchurl, emacs}:
+
+stdenv.mkDerivation rec {
+  name = "sunrise-commander-6";
+
+  src = fetchurl {
+    url = "http://www.emacswiki.org/emacs/download/sunrise-commander.el";
+    sha256 = "1bbpm00nc7ry0f2k4zaqbvp6w9py31asfcr9hddggc138pnfajvq";
+  };
+
+  phases = [ "buildPhase" "installPhase"];
+
+  buildInputs = [ emacs ];
+
+  buildPhase = ''
+    cp $src sunrise-commander.el
+    emacs --batch -f batch-byte-compile sunrise-commander.el
+  '';
+
+  installPhase = ''
+    install -d $out/share/emacs/site-lisp
+    install sunrise-commander.el* $out/share/emacs/site-lisp
+  '';
+
+  meta = {
+    description = "Two-pane file manager for Emacs based on Dired and inspired by MC.";
+    homepage = http://www.emacswiki.org/emacs/Sunrise_Commander;
+    license = "GPLv3+";
+
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/pkgs/applications/graphics/gimp/default.nix b/pkgs/applications/graphics/gimp/default.nix
index ad35b751231..b59b2bb6750 100644
--- a/pkgs/applications/graphics/gimp/default.nix
+++ b/pkgs/applications/graphics/gimp/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, pkgconfig, gtk, freetype
-, fontconfig, libart_lgpl, libtiff, libjpeg, libpng, libexif, zlib, perl
-, perlXMLParser, python, pygtk, gettext, xlibs, intltool, babl, gegl
+, fontconfig, libart_lgpl, libtiff, libjpeg, libpng12, libexif, zlib, perl
+, perlXMLParser, python, pygtk, gettext, xlibs, intltool, babl_0_0_22, gegl_0_0_22
 }:
 
 stdenv.mkDerivation rec {
@@ -13,8 +13,8 @@ stdenv.mkDerivation rec {
   
   buildInputs = [
     pkgconfig gtk freetype fontconfig
-    libart_lgpl libtiff libjpeg libpng libexif zlib perl
-    perlXMLParser python pygtk gettext intltool babl gegl
+    libart_lgpl libtiff libjpeg libpng12 libexif zlib perl
+    perlXMLParser python pygtk gettext intltool babl_0_0_22 gegl_0_0_22
   ];
 
   passthru = { inherit gtk; }; # probably its a good idea to use the same gtk in plugins ?
diff --git a/pkgs/applications/misc/gpsbabel/default.nix b/pkgs/applications/misc/gpsbabel/default.nix
index a8ccb1c0fef..29d5b1ee7cc 100644
--- a/pkgs/applications/misc/gpsbabel/default.nix
+++ b/pkgs/applications/misc/gpsbabel/default.nix
@@ -1,15 +1,19 @@
-{ fetchurl, stdenv, zlib, expat }:
+{ fetchurl, stdenv, zlib, expat, which }:
 
-stdenv.mkDerivation rec {
-  name = "gpsbabel-1.3.6";
+let version = "1.4.3"; in
+stdenv.mkDerivation {
+  name = "gpsbabel-${version}";
 
   src = fetchurl {
-    url = "http://www.gpsbabel.org/plan9.php?dl=${name}.tar.gz";
-    name = "${name}.tar.gz";
-    sha256 = "1dm9lpcdsj0vz699zz932xc1vphvap627wl0qp61izlkzh25vg88";
+    # gpgbabel.org makes it hard to get the source tarball automatically, so
+    # get it from elsewhere.
+    url = "mirror://debian/pool/main/g/gpsbabel/gpsbabel_${version}.orig.tar.gz";
+    sha256 = "1s31xa36ivf836h89m1f3qiaz3c3znvqjdm0bnh8vr2jjlrz9jdi";
   };
 
-  buildInputs = [ zlib expat ];
+  # FIXME: Would need libxml2 for one of the tests, but that in turns require
+  # network access for the XML schemas.
+  buildInputs = [ zlib expat which ];
 
   /* FIXME: Building the documentation, with "make doc", requires this:
 
@@ -17,7 +21,10 @@ stdenv.mkDerivation rec {
 
     But FOP isn't packaged yet.  */
 
-  configureFlags = "--with-zlib=system";
+  preConfigure = "cd gpsbabel";
+  configureFlags = [ "--with-zlib=system" ];
+
+  doCheck = true;
 
   meta = {
     description = "GPSBabel, a tool to convert, upload and download data from GPS and Map programs";
@@ -44,5 +51,8 @@ stdenv.mkDerivation rec {
     homepage = http://www.gpsbabel.org/;
 
     license = "GPLv2+";
+
+    maintainers = [ stdenv.lib.maintainers.ludo ];
+    platforms = stdenv.lib.platforms.gnu;         # arbitrary choice
   };
 }
diff --git a/pkgs/applications/misc/gxneur/default.nix b/pkgs/applications/misc/gxneur/default.nix
new file mode 100644
index 00000000000..520b8304f63
--- /dev/null
+++ b/pkgs/applications/misc/gxneur/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, pkgconfig, gtk2, xorg, glib, xneur_0_13, libglade, GConf, pcre }:
+
+stdenv.mkDerivation {
+  name = "gxneur-0.13.0";
+  
+  src = fetchurl {
+    url = http://dists.xneur.ru/release-0.13.0/tgz/gxneur-0.13.0.tar.bz2;
+    sha256 = "f093428a479158247a7ff8424f0aec9af9f7b1d05b191cf30b7c534965a6839f";
+  };
+
+  buildInputs = [
+    xorg.libX11 pkgconfig  glib gtk2 xorg.libXpm xorg.libXt xorg.libXext xneur_0_13
+    libglade GConf pcre
+  ];
+
+  preConfigure = ''
+    sed -e 's@-Werror@@' -i configure
+    sed -e 's@"xneur"@"${xneur_0_13}/bin/xneur"@' -i src/misc.c
+  '';
+
+  meta = {
+    description = "GUI for XNEUR keyboard layout switcher";
+  };
+}
diff --git a/pkgs/applications/misc/xpdf/default.nix b/pkgs/applications/misc/xpdf/default.nix
index d653c972850..5218df77595 100644
--- a/pkgs/applications/misc/xpdf/default.nix
+++ b/pkgs/applications/misc/xpdf/default.nix
@@ -1,4 +1,4 @@
-{ enableGUI ? true, enablePDFtoPPM ? true, useT1Lib ? true
+{ enableGUI ? true, enablePDFtoPPM ? true, useT1Lib ? false
 , stdenv, fetchurl, x11 ? null, motif ? null, freetype ? null, t1lib ? null
 , base14Fonts ? null
 }:
@@ -7,6 +7,8 @@ assert enableGUI -> x11 != null && motif != null && freetype != null;
 assert enablePDFtoPPM -> freetype != null;
 assert useT1Lib -> t1lib != null;
 
+assert !useT1Lib; # t1lib has multiple unpatched security vulnerabilities
+
 stdenv.mkDerivation {
   name = "xpdf-3.03";
 
diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix
index fb3d1109e14..84cdf556d02 100644
--- a/pkgs/applications/networking/browsers/chromium/default.nix
+++ b/pkgs/applications/networking/browsers/chromium/default.nix
@@ -32,7 +32,7 @@ let
     channel = "stable";
     selinux = false;
     nacl = false;
-    openssl = true;
+    openssl = false;
     gnome = false;
     gnomeKeyring = false;
     proprietaryCodecs = true;
@@ -59,7 +59,7 @@ let
     use_system_libpng = true;
     use_system_libxml = true;
     use_system_speex = true;
-    use_system_ssl = true;
+    use_system_ssl = config.openssl;
     use_system_stlport = true;
     use_system_xdg_utils = true;
     use_system_yasm = true;
diff --git a/pkgs/applications/networking/browsers/chromium/sources.nix b/pkgs/applications/networking/browsers/chromium/sources.nix
index 740f0c60980..a250cda7610 100644
--- a/pkgs/applications/networking/browsers/chromium/sources.nix
+++ b/pkgs/applications/networking/browsers/chromium/sources.nix
@@ -1,19 +1,18 @@
 # This file is autogenerated from update.sh in the same directory.
-# VHASH: c9500486764a2433d0f059134a981eb9adccd3546a6f779bc0e05cdcb26d2ae6
 {
   dev = {
-    version = "22.0.1221.1";
-    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-22.0.1221.1.tar.bz2";
-    sha256 = "08cx2im0ng1dg83mk8jlx4in7v8f5vsf9y2ild0i22jb20c7h31s";
+    version = "22.0.1229.8";
+    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-22.0.1229.8.tar.bz2";
+    sha256 = "0gaa4mqvd0v4y587y6mri2f3b0rc8npmcbs9bfs4wwb8n1cp8kw0";
   };
   beta = {
-    version = "21.0.1180.57";
-    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-21.0.1180.57.tar.bz2";
-    sha256 = "0idimvkrhs09x93hl8p7rddyb0ymk9f8i5jm6m3lg6ga959aj6ri";
+    version = "21.0.1180.79";
+    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-21.0.1180.79.tar.bz2";
+    sha256 = "1jscpibv02pyqpcj6djcx0d1qwq8hcxampfqbsz8dicgjprp22c8";
   };
   stable = {
-    version = "21.0.1180.57";
-    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-21.0.1180.57.tar.bz2";
-    sha256 = "0idimvkrhs09x93hl8p7rddyb0ymk9f8i5jm6m3lg6ga959aj6ri";
+    version = "21.0.1180.79";
+    url = "http://commondatastorage.googleapis.com/chromium-browser-official/chromium-21.0.1180.79.tar.bz2";
+    sha256 = "1jscpibv02pyqpcj6djcx0d1qwq8hcxampfqbsz8dicgjprp22c8";
   };
 }
diff --git a/pkgs/applications/networking/browsers/chromium/update.sh b/pkgs/applications/networking/browsers/chromium/update.sh
index c9dd69df9a2..4721ded385a 100755
--- a/pkgs/applications/networking/browsers/chromium/update.sh
+++ b/pkgs/applications/networking/browsers/chromium/update.sh
@@ -4,16 +4,92 @@ channels_url="http://omahaproxy.appspot.com/";
 bucket_url="http://commondatastorage.googleapis.com/chromium-browser-official/";
 output_file="$(cd "$(dirname "$0")" && pwd)/sources.nix";
 
-get_channels()
+nix_getattr()
+{
+    input_file="$1";
+    attr="$2";
+
+    var="$(nix-instantiate --eval-only -A "$attr" "$output_file")";
+    echo "$var" | tr -d '\\"';
+}
+
+### poor mans key/value-store :-) ###
+
+ver_sha_table=""; # list of version:sha256
+
+sha_lookup()
+{
+    version="$1";
+
+    for ver_sha in $ver_sha_table;
+    do
+        if [ "x${ver_sha%:*}" = "x$version" ];
+        then
+            echo "${ver_sha##*:}";
+            return 0;
+        fi;
+    done;
+
+    return 1;
+}
+
+sha_insert()
+{
+    version="$1";
+    sha256="$2";
+
+    ver_sha_table="$ver_sha_table $version:$sha256";
+}
+
+if [ -e "$output_file" ];
+then
+    get_sha256()
+    {
+        channel="$1";
+        version="$2";
+        url="$3";
+
+        oldver="$(nix_getattr "$output_file" "$channel.version")";
+
+        echo -n "Checking if $oldver ($channel) is up to date..." >&2;
+
+        if [ "x$version" != "x$oldver" ];
+        then
+            echo " no, getting sha256 for new version $version:" >&2;
+            sha256="$(nix-prefetch-url "$url")";
+        else
+            echo " yes, keeping old sha256." >&2;
+            sha256="$(nix_getattr "$output_file" "$channel.sha256")";
+        fi;
+
+        sha_insert "$version" "$sha256"
+        echo "$sha256";
+    }
+else
+    get_sha256()
+    {
+        nix-prefetch-url "$url";
+    }
+fi;
+
+get_channel_exprs()
 {
     for chline in $(echo "$1" | cut -d, -f-2);
     do
         channel="${chline%%,*}";
         version="${chline##*,}";
-
         url="${bucket_url%/}/chromium-$version.tar.bz2";
 
-        sha256="$(nix-prefetch-url "$url")";
+        echo -n "Checking if sha256 of version $version is cached..." >&2;
+        if sha256="$(sha_lookup "$version")";
+        then
+            echo "yes: $sha256" >&2;
+        else
+            echo "no." >&2;
+            sha256="$(get_sha256 "$channel" "$version" "$url")";
+        fi;
+
+        sha_insert "$version" "$sha256";
 
         echo "  $channel = {";
         echo "    version = \"$version\";";
@@ -25,26 +101,13 @@ get_channels()
 
 cd "$(dirname "$0")";
 
-versions="$(curl -s "$channels_url" | sed -n -e 's/^linux,\(\([^,]\+,\)\{2\}\).*$/\1/p')";
-
-if [ -e "$output_file" ];
-then
-    vhash="$(echo "$versions" | sha256sum | cut -d' ' -f1)";
-    old_vhash="$(sed -n 's/# *VHASH: *//p' "$output_file")";
-
-    if [ "x$vhash" = "x$old_vhash" ];
-    then
-        echo "$output_file is already up to date, bailing out." >&2;
-        exit 1;
-    fi;
-fi;
-
-channels="$(get_channels "$versions")";
+omaha="$(curl -s "$channels_url")";
+versions="$(echo "$omaha" | sed -n -e 's/^linux,\(\([^,]\+,\)\{2\}\).*$/\1/p')";
+channel_exprs="$(get_channel_exprs "$versions")";
 
 cat > "$output_file" <<-EOF
 # This file is autogenerated from update.sh in the same directory.
-# VHASH: $vhash
 {
-$channels
+$channel_exprs
 }
 EOF
diff --git a/pkgs/applications/networking/browsers/firefox/12.0.nix b/pkgs/applications/networking/browsers/firefox/12.0.nix
index 6a22b1d8e5f..97e23d1b8b2 100644
--- a/pkgs/applications/networking/browsers/firefox/12.0.nix
+++ b/pkgs/applications/networking/browsers/firefox/12.0.nix
@@ -33,7 +33,7 @@ rec {
       "--with-system-zlib"
       "--with-system-bz2"
       "--with-system-nspr"
-      # "--with-system-nss"
+      "--with-system-nss"
       # "--with-system-png" # <-- "--with-system-png won't work because the system's libpng doesn't have APNG support"
       # "--enable-system-cairo" # disabled for the moment because our Cairo is too old
       "--enable-system-sqlite"
@@ -54,7 +54,7 @@ rec {
       [ pkgconfig gtk perl zip libIDL libjpeg libpng zlib cairo bzip2
         python dbus dbus_glib pango freetype fontconfig xlibs.libXi
         xlibs.libX11 xlibs.libXrender xlibs.libXft xlibs.libXt file
-        alsaLib nspr /* nss */ libnotify xlibs.pixman yasm mesa
+        alsaLib nspr nss libnotify xlibs.pixman yasm mesa
         xlibs.libXScrnSaver xlibs.scrnsaverproto
         xlibs.libXext xlibs.xextproto sqlite unzip
       ];
@@ -129,7 +129,7 @@ rec {
       
     buildInputs =
       [ pkgconfig gtk perl zip libIDL libjpeg zlib cairo bzip2 python
-        dbus dbus_glib pango freetype fontconfig alsaLib nspr libnotify
+        dbus dbus_glib pango freetype fontconfig alsaLib nspr nss libnotify
         xlibs.pixman yasm mesa sqlite file unzip
       ];
 
diff --git a/pkgs/applications/networking/browsers/firefox/13.0.nix b/pkgs/applications/networking/browsers/firefox/13.0.nix
index 1b021955742..fbbf3275ad1 100644
--- a/pkgs/applications/networking/browsers/firefox/13.0.nix
+++ b/pkgs/applications/networking/browsers/firefox/13.0.nix
@@ -33,7 +33,7 @@ rec {
       "--with-system-zlib"
       "--with-system-bz2"
       "--with-system-nspr"
-      # "--with-system-nss"
+      "--with-system-nss"
       # "--with-system-png" # <-- "--with-system-png won't work because the system's libpng doesn't have APNG support"
       # "--enable-system-cairo" # disabled for the moment because our Cairo is too old
       "--enable-system-sqlite"
@@ -54,7 +54,7 @@ rec {
       [ pkgconfig gtk perl zip libIDL libjpeg libpng zlib cairo bzip2
         python dbus dbus_glib pango freetype fontconfig xlibs.libXi
         xlibs.libX11 xlibs.libXrender xlibs.libXft xlibs.libXt file
-        alsaLib nspr /* nss */ libnotify xlibs.pixman yasm mesa
+        alsaLib nspr nss libnotify xlibs.pixman yasm mesa
         xlibs.libXScrnSaver xlibs.scrnsaverproto
         xlibs.libXext xlibs.xextproto sqlite unzip makeWrapper
       ];
@@ -136,7 +136,7 @@ rec {
       
     buildInputs =
       [ pkgconfig gtk perl zip libIDL libjpeg zlib cairo bzip2 python
-        dbus dbus_glib pango freetype fontconfig alsaLib nspr libnotify
+        dbus dbus_glib pango freetype fontconfig alsaLib nspr nss libnotify
         xlibs.pixman yasm mesa sqlite file unzip
       ];
 
diff --git a/pkgs/applications/networking/browsers/firefox/3.6.nix b/pkgs/applications/networking/browsers/firefox/3.6.nix
index 40b7959139d..c430bb7089a 100644
--- a/pkgs/applications/networking/browsers/firefox/3.6.nix
+++ b/pkgs/applications/networking/browsers/firefox/3.6.nix
@@ -31,7 +31,7 @@ rec {
       "--with-system-zlib"
       "--with-system-bz2"
       "--with-system-nspr"
-      #"--with-system-nss"
+      "--with-system-nss"
       # "--with-system-png" # <-- "--with-system-png won't work because the system's libpng doesn't have APNG support"
       "--enable-system-cairo"
       #"--enable-system-sqlite" # <-- this seems to be discouraged
@@ -59,7 +59,7 @@ rec {
       [ pkgconfig gtk perl zip libIDL libjpeg libpng zlib cairo bzip2
         python dbus dbus_glib pango freetype fontconfig xlibs.libXi
         xlibs.libX11 xlibs.libXrender xlibs.libXft xlibs.libXt file
-        alsaLib nspr /* nss */ libnotify xlibs.pixman
+        alsaLib nspr nss libnotify xlibs.pixman
       ];
 
     preConfigure = if stdenv.isMips then ''
@@ -118,7 +118,7 @@ rec {
 
     buildInputs =
       [ pkgconfig gtk perl zip libIDL libjpeg zlib cairo bzip2 python
-        dbus dbus_glib pango freetype fontconfig alsaLib nspr libnotify
+        dbus dbus_glib pango freetype fontconfig alsaLib nspr nss libnotify
         xlibs.pixman
       ];
 
diff --git a/pkgs/applications/networking/cluster/hadoop/default.nix b/pkgs/applications/networking/cluster/hadoop/default.nix
new file mode 100644
index 00000000000..7d475a67558
--- /dev/null
+++ b/pkgs/applications/networking/cluster/hadoop/default.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchurl, makeWrapper, which, jre, bash }:
+
+stdenv.mkDerivation rec {
+
+  name = "hadoop-2.0.1-alpha";
+
+  src = fetchurl {
+    url = "mirror://apache/hadoop/common/${name}/${name}.tar.gz";
+    sha256 = "4e5f4fa1574ee58fd6d59a220b66578fc2cf62c229120eeed07f2880c86f0e59";
+  };
+
+  buildInputs = [ makeWrapper ];
+
+  buildPhase = ''
+    for n in "bin/"* "sbin/"*; do
+      sed -i $n -e "s|#!/usr/bin/env bash|#! ${bash}/bin/bash|"
+    done
+    patchelf --set-interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" bin/container-executor
+  '';
+
+  installPhase = ''
+    mkdir -p $out
+    mv *.txt share/doc/hadoop/
+    mv * $out
+
+    for n in $out/{bin,sbin}"/"*; do
+      wrapProgram $n --prefix PATH : "${which}/bin:${jre}/bin:${bash}/bin" --set JAVA_HOME "${jre}" --set HADOOP_PREFIX "$out"
+    done
+  '';
+
+  meta = {
+    homepage = "http://hadoop.apache.org/";
+    description = "framework for distributed processing of large data sets across clusters of computers";
+    license = stdenv.lib.licenses.asl20;
+
+    longDescription = ''
+      The Apache Hadoop software library is a framework that allows for
+      the distributed processing of large data sets across clusters of
+      computers using a simple programming model. It is designed to
+      scale up from single servers to thousands of machines, each
+      offering local computation and storage. Rather than rely on
+      hardware to deliver high-avaiability, the library itself is
+      designed to detect and handle failures at the application layer,
+      so delivering a highly-availabile service on top of a cluster of
+      computers, each of which may be prone to failures.
+    '';
+
+    platforms = stdenv.lib.platforms.linux;
+    maintainers = [ stdenv.lib.maintainers.simons ];
+  };
+}
diff --git a/pkgs/applications/networking/mailreaders/notmuch/default.nix b/pkgs/applications/networking/mailreaders/notmuch/default.nix
index 9dd352857fb..266035aa1bd 100644
--- a/pkgs/applications/networking/mailreaders/notmuch/default.nix
+++ b/pkgs/applications/networking/mailreaders/notmuch/default.nix
@@ -3,11 +3,11 @@
 }:
 
 stdenv.mkDerivation rec {
-  name = "notmuch-0.12";
+  name = "notmuch-0.13.2";
 
   src = fetchurl {
     url = "http://notmuchmail.org/releases/${name}.tar.gz";
-    sha256 = "1dbbbbba3567df9c67ecc642d1e63269a527952c557f6b0c8bafcd4e37893992";
+    sha256 = "75ec5f5d04bb7e3a8cc6224859b691f704a2a35f2f6027ffb674e829268f1d68";
   };
 
   buildInputs = [ bash emacs gdb glib gmime gnupg1 pkgconfig talloc xapian ];
diff --git a/pkgs/applications/office/openoffice/libreoffice.nix b/pkgs/applications/office/openoffice/libreoffice.nix
index fb577be0390..da786c23c33 100644
--- a/pkgs/applications/office/openoffice/libreoffice.nix
+++ b/pkgs/applications/office/openoffice/libreoffice.nix
@@ -144,6 +144,8 @@ stdenv.mkDerivation rec {
     "--without-system-nss"
     "--without-system-sampleicc"
     "--without-system-libexttextcat"
+
+    "--with-java-target-version=1.6" # The default 1.7 not supported
   ];
 
   buildInputs = [
diff --git a/pkgs/applications/science/logic/coq/8.3.nix b/pkgs/applications/science/logic/coq/8.3.nix
new file mode 100644
index 00000000000..f23622de8a0
--- /dev/null
+++ b/pkgs/applications/science/logic/coq/8.3.nix
@@ -0,0 +1,69 @@
+# - coqide compilation can be disabled by setting lablgtk to null;
+
+{stdenv, fetchurl, ocaml, findlib, camlp5, ncurses, lablgtk ? null}:
+
+let 
+  version = "8.3pl4";
+  buildIde = lablgtk != null;
+  ideFlags = if buildIde then "-lablgtkdir ${lablgtk}/lib/ocaml/*/site-lib/lablgtk2 -coqide opt" else "";
+  idePatch = if buildIde then ''
+    substituteInPlace scripts/coqmktop.ml --replace \
+    "\"-I\"; \"+lablgtk2\"" \
+    "\"-I\"; \"$(echo "${lablgtk}"/lib/ocaml/*/site-lib/lablgtk2)\"; \"-I\"; \"$(echo "${lablgtk}"/lib/ocaml/*/site-lib/stublibs)\""
+  '' else "";
+in
+
+stdenv.mkDerivation {
+  name = "coq-${version}";
+
+  src = fetchurl {
+    url = "http://coq.inria.fr/V${version}/files/coq-${version}.tar.gz";
+    sha256 = "17d3lmchmqir1rawnr52g78srg4wkd7clzpzfsivxc4y1zp6rwkr";
+  };
+
+  buildInputs = [ ocaml findlib camlp5 ncurses lablgtk ];
+
+  prefixKey = "-prefix ";
+
+  preConfigure = ''
+    configureFlagsArray=(
+      -opt
+      -camldir ${ocaml}/bin
+      -camlp5dir $(ocamlfind query camlp5)
+      ${ideFlags}
+    )
+  '';
+
+  buildFlags = "world"; # Debug with "world VERBOSE=1";
+
+  patches = [ ./configure.8.3.patch ];
+
+  postPatch = ''
+    UNAME=$(type -tp uname)
+    RM=$(type -tp rm)
+    substituteInPlace configure --replace "/bin/uname" "$UNAME"
+    substituteInPlace tools/beautify-archive --replace "/bin/rm" "$RM"
+    ${idePatch}
+  '';
+
+  # This post install step is needed to build ssrcoqide from the ssreflect package
+  # It could be made optional, but I see little harm in including it in the default
+  # distribution -- roconnor
+  # This will likely no longer be necessary for coq >= 8.4. -- roconnor
+  postInstall = if buildIde then ''
+   cp ide/*.cmi ide/ide.*a $out/lib/coq/ide/
+  '' else "";
+
+  meta = {
+    description = "Coq proof assistant";
+    longDescription = ''
+      Coq is a formal proof management system.  It provides a formal language
+      to write mathematical definitions, executable algorithms and theorems
+      together with an environment for semi-interactive development of
+      machine-checked proofs.
+    '';
+    homepage = "http://coq.inria.fr";
+    license = "LGPL";
+    maintainers = [ stdenv.lib.maintainers.roconnor ];
+  };
+}
diff --git a/pkgs/applications/science/logic/coq/configure.8.3.patch b/pkgs/applications/science/logic/coq/configure.8.3.patch
new file mode 100644
index 00000000000..431cccac4b0
--- /dev/null
+++ b/pkgs/applications/science/logic/coq/configure.8.3.patch
@@ -0,0 +1,1112 @@
+diff -Nuar coq-8.3pl3-orig/configure coq-8.3pl3/configure
+--- coq-8.3pl3-orig/configure	2011-12-19 22:57:30.000000000 +0100
++++ coq-8.3pl3/configure	2012-03-17 16:38:16.000000000 +0100
+@@ -395,7 +395,6 @@
+ 	 ocamlyaccexec=$CAMLBIN/ocamlyacc
+ 	 ocamlmktopexec=$CAMLBIN/ocamlmktop
+ 	 ocamlmklibexec=$CAMLBIN/ocamlmklib
+-	 camlp4oexec=$CAMLBIN/camlp4o
+ esac
+ 
+ if test ! -f "$CAMLC" ; then
+@@ -628,7 +627,7 @@
+             no)  LABLGTKLIB=+lablgtk2                   # Pour le message
+                  LABLGTKINCLUDES="-I $LABLGTKLIB";;     # Pour le makefile
+             yes) LABLGTKLIB="$lablgtkdir"               # Pour le message
+-                 LABLGTKINCLUDES="-I \"$LABLGTKLIB\"";; # Pour le makefile
++                 LABLGTKINCLUDES="-I $LABLGTKLIB";;     # Pour le makefile
+         esac;;
+     no) LABLGTKINCLUDES="";;
+ esac
+diff -Nuar coq-8.3pl3-orig/configure~ coq-8.3pl3/configure~
+--- coq-8.3pl3-orig/configure~	1970-01-01 01:00:00.000000000 +0100
++++ coq-8.3pl3/configure~	2011-12-19 22:57:30.000000000 +0100
+@@ -0,0 +1,1088 @@
++#!/bin/sh
++
++##################################
++#
++#  Configuration script for Coq
++# 
++##################################
++
++VERSION=8.3pl3
++VOMAGIC=08300
++STATEMAGIC=58300
++DATE=`LANG=C date +"%B %Y"`
++
++# Create the bin/ directory if non-existent
++test -d bin || mkdir bin
++
++# a local which command for sh
++which () {
++IFS=":" # set words separator in PATH to be ':' (it allows spaces in dirnames)
++for i in $PATH; do
++  if test -z "$i"; then i=.; fi 
++  if [ -f "$i/$1" ] ; then
++	IFS=" "
++        echo "$i/$1"
++	break
++  fi
++done
++}
++
++usage () {
++    printf "Available options for configure are:\n"
++    echo "-help"
++    printf "\tDisplays this help page\n"
++    echo "-prefix <dir>"
++    printf "\tSet installation directory to <dir>\n"
++    echo "-local"
++    printf "\tSet installation directory to the current source tree\n"
++    echo "-coqrunbyteflags"
++    printf "\tSet link flags for VM-dependent bytecode (coqtop)\n"
++    echo "-coqtoolsbyteflags"
++    printf "\tSet link flags for VM-independant bytecode (coqdep, coqdoc, ...)\n"
++    echo "-custom"
++    printf "\tGenerate all bytecode executables with -custom (not recommended)\n"
++    echo "-src"
++    printf "\tSpecifies the source directory\n"
++    echo "-bindir"
++    echo "-libdir"
++    echo "-mandir"
++    echo "-docdir"
++    printf "\tSpecifies where to install bin/lib/man/doc files resp.\n"
++    echo "-emacslib"
++    echo "-emacs"
++    printf "\tSpecifies where emacs files are to be installed\n"
++    echo "-coqdocdir"
++    printf "\tSpecifies where Coqdoc style files are to be installed\n"
++    echo "-camldir"
++    printf "\tSpecifies the path to the OCaml library\n"
++    echo "-lablgtkdir"
++    printf "\tSpecifies the path to the Lablgtk library\n"
++    echo "-camlp5dir"
++    printf "\tSpecifies where to look for the Camlp5 library and tells to use it\n"
++    echo "-arch"
++    printf "\tSpecifies the architecture\n"
++    echo "-opt"
++    printf "\tSpecifies whether or not to use OCaml *.opt optimized compilers\n"
++    echo "-natdynlink (yes|no)"
++    printf "\tSpecifies whether or not to use dynamic loading of native code\n"
++    echo "-coqide (opt|byte|no)"
++    printf "\tSpecifies whether or not to compile Coqide\n"
++    echo "-browser <command>"
++    printf "\tUse <command> to open URL %%s\n"
++    echo "-with-doc (yes|no)"
++    printf "\tSpecifies whether or not to compile the documentation\n"
++    echo "-with-geoproof (yes|no)"
++    printf "\tSpecifies whether or not to use Geoproof binding\n"
++    echo "-with-cc <file>"
++    echo "-with-ar <file>"
++    echo "-with-ranlib <file>"
++    printf "\tTells configure where to find gcc/ar/ranlib executables\n"
++    echo "-byte-only"
++    printf "\tCompiles only bytecode version of Coq\n"
++    echo "-debug"
++    printf "\tAdd debugging information in the Coq executables\n"
++    echo "-profile"
++    printf "\tAdd profiling information in the Coq executables\n"
++    echo "-annotate"
++    printf "\tCompiles Coq with -dtypes option\n"
++}
++
++
++# Default OCaml binaries
++bytecamlc=ocamlc
++nativecamlc=ocamlopt
++ocamlmklibexec=ocamlmklib
++ocamlexec=ocaml
++ocamldepexec=ocamldep
++ocamldocexec=ocamldoc
++ocamllexexec=ocamllex
++ocamlyaccexec=ocamlyacc
++ocamlmktopexec=ocamlmktop
++camlp4oexec=camlp4o
++
++
++coq_debug_flag=
++coq_debug_flag_opt=
++coq_profile_flag=
++coq_annotate_flag=
++best_compiler=opt
++cflags="-fno-defer-pop -Wall -Wno-unused"
++natdynlink=yes
++
++gcc_exec=gcc
++ar_exec=ar
++ranlib_exec=ranlib
++
++local=false
++coqrunbyteflags_spec=no
++coqtoolsbyteflags_spec=no
++custom_spec=no
++src_spec=no
++prefix_spec=no
++bindir_spec=no
++libdir_spec=no
++mandir_spec=no
++docdir_spec=no
++emacslib_spec=no
++emacs_spec=no
++camldir_spec=no
++lablgtkdir_spec=no
++coqdocdir_spec=no
++arch_spec=no
++coqide_spec=no
++browser_spec=no
++wwwcoq_spec=no
++with_geoproof=false
++with_doc=all
++with_doc_spec=no
++force_caml_version=no
++force_caml_version_spec=no
++
++COQSRC=`pwd`
++
++# Parse command-line arguments
++
++while : ; do
++  case "$1" in
++    "") break;;
++    -help|--help) usage
++	          exit;;
++    -prefix|--prefix) prefix_spec=yes
++                      prefix="$2"
++		      shift;;
++    -local|--local) local=true;;
++    -coqrunbyteflags|--coqrunbyteflags) coqrunbyteflags_spec=yes
++                                        coqrunbyteflags="$2"
++                                        shift;;
++    -coqtoolsbyteflags|--coqtoolsbyteflags) coqtoolsbyteflags_spec=yes
++                                            coqtoolsbyteflags="$2"
++                                            shift;;
++    -custom|--custom) custom_spec=yes
++                      shift;;
++    -src|--src) src_spec=yes
++                COQSRC="$2"
++	        shift;;
++    -bindir|--bindir) bindir_spec=yes
++                      bindir="$2"
++		      shift;;
++    -libdir|--libdir) libdir_spec=yes
++                      libdir="$2"
++		      shift;;
++    -mandir|--mandir) mandir_spec=yes
++                      mandir="$2"
++		      shift;;
++    -docdir|--docdir) docdir_spec=yes
++                      docdir="$2"
++		      shift;;
++    -emacslib|--emacslib) emacslib_spec=yes
++                          emacslib="$2"
++			  shift;;
++    -emacs |--emacs) emacs_spec=yes
++		     emacs="$2"
++		     shift;;
++    -coqdocdir|--coqdocdir) coqdocdir_spec=yes
++	              coqdocdir="$2"
++		      shift;;
++    -camldir|--camldir) camldir_spec=yes
++	                camldir="$2"
++			shift;;
++    -lablgtkdir|--lablgtkdir) lablgtkdir_spec=yes
++	                lablgtkdir="$2"
++			shift;;
++    -camlp5dir|--camlp5dir)
++	                camlp5dir="$2"
++			shift;;
++    -arch|--arch) arch_spec=yes
++                  arch=$2
++		  shift;;
++    -opt|--opt) bytecamlc=ocamlc.opt
++                camlp4oexec=camlp4o  # can't add .opt since dyn load'll be required
++                nativecamlc=ocamlopt.opt;;
++    -natdynlink|--natdynlink) case "$2" in
++	                  yes) natdynlink=yes;;
++                          *) natdynlink=no
++                        esac
++                        shift;;
++    -coqide|--coqide) coqide_spec=yes
++		      case "$2" in
++			  byte|opt) COQIDE=$2;;
++			  *) COQIDE=no
++		      esac
++		      shift;;
++    -browser|--browser) browser_spec=yes
++		      BROWSER=$2
++		      shift;;
++    -coqwebsite|--coqwebsite) wwwcoq_spec=yes
++                      WWWCOQ=$2
++                      shift;;
++    -with-doc|--with-doc) with_doc_spec=yes
++		      case "$2" in
++			  yes|all) with_doc=all;;
++			  *) with_doc=no
++		      esac
++		      shift;;
++    -with-geoproof|--with-geoproof) 
++	  case "$2" in
++	      yes) with_geoproof=true;;
++	      no) with_geoproof=false;;
++	  esac
++	  shift;;
++    -with-cc|-with-gcc|--with-cc|--with-gcc) 
++	  gcc_spec=yes
++	  gcc_exec=$2
++	  shift;;
++    -with-ar|--with-ar) 
++	  ar_spec=yes
++	  ar_exec=$2
++	  shift;;
++    -with-ranlib|--with-ranlib) 
++	  ranlib_spec=yes
++	  ranlib_exec=$2
++	  shift;;
++    -byte-only|-byteonly|--byteonly|--byte-only) best_compiler=byte;;
++    -debug|--debug) coq_debug_flag=-g;;
++    -profile|--profile) coq_profile_flag=-p;;
++    -annotate|--annotate) coq_annotate_flag=-dtypes;;
++    -force-caml-version|--force-caml-version|-force-ocaml-version|--force-ocaml-version) 
++          force_caml_version_spec=yes
++	  force_caml_version=yes;;
++    *) echo "Unknown option \"$1\"." 1>&2; usage; exit 2;;
++  esac
++  shift
++done
++
++if [ $prefix_spec = yes -a $local = true ] ; then
++  echo "Options -prefix and -local are incompatible."
++  echo "Configure script failed!"
++  exit 1
++fi
++
++# compile date
++DATEPGM=`which date`
++case $DATEPGM in
++    "") echo "I can't find the program \"date\" in your path."
++        echo "Please give me the current date"
++	read COMPILEDATE;;
++    *)  COMPILEDATE=`date +"%h %d %Y %H:%M:%S"`;;
++esac
++
++# Architecture
++
++case $arch_spec in
++    no) 
++    # First we test if we are running a Cygwin system
++    if [ `uname -s | cut -c -6` = "CYGWIN" ] ; then
++	ARCH="win32"
++    else
++	# If not, we determine the architecture
++	if test -x /bin/arch ; then
++ 	    ARCH=`/bin/arch`
++ 	elif test -x /usr/bin/arch ; then
++ 	    ARCH=`/usr/bin/arch`
++ 	elif test -x /usr/ucb/arch ; then
++ 	    ARCH=`/usr/ucb/arch`
++ 	elif test -x /bin/uname ; then
++ 	    ARCH=`/bin/uname -s`
++ 	elif test -x /usr/bin/uname ; then
++ 	    ARCH=`/usr/bin/uname -s`
++	else
++	    echo "I can not automatically find the name of your architecture."
++	    printf "%s"\
++		"Give me a name, please [win32 for Win95, Win98 or WinNT]: "
++	    read ARCH
++	fi
++    fi;;
++    yes) ARCH=$arch
++esac
++
++# executable extension
++
++case $ARCH in
++    win32) 
++      EXE=".exe"
++      DLLEXT=".dll";;
++    *) EXE=""
++       DLLEXT=".so"
++esac
++
++# Is the source tree checked out from a recognised
++# version control system ?
++if test -e .svn/entries ; then 
++    checkedout=svn
++elif [ -d '{arch}' ]; then
++    checkedout=gnuarch
++elif [ -z "${GIT_DIR}" ] && [ -d .git ] || [ -d "${GIT_DIR}" ]; then
++    checkedout=git
++else
++    checkedout=0
++fi
++
++# make command
++
++MAKE=`which make`
++if [ "$MAKE" != "" ]; then
++  MAKEVERSION=`$MAKE -v | head -1 | cut -d" " -f3`
++  MAKEVERSIONMAJOR=`echo $MAKEVERSION | cut -d. -f1`
++  MAKEVERSIONMINOR=`echo $MAKEVERSION | cut -d. -f2`
++  if [ "$MAKEVERSIONMAJOR" -eq 3 -a "$MAKEVERSIONMINOR" -ge 81 ]; then
++      echo "You have GNU Make $MAKEVERSION. Good!"
++  else
++      OK="no"
++      if [ -x ./make ]; then
++	  MAKEVERSION=`./make -v | head -1`
++	  if [ "$MAKEVERSION" = "GNU Make 3.81" ]; then OK="yes"; fi
++      fi
++      if [ $OK = "no" ]; then
++	  echo "GNU Make >= 3.81 is needed."
++	  echo "Make 3.81 can be downloaded from ftp://ftp.gnu.org/gnu/make/make-3.81.tar.gz"
++	  echo "then locally installed on a Unix-style system by issuing:"
++	  echo "  tar xzvf make-3.81.tar.gz"
++	  echo "  cd make-3.81"
++          echo "  ./configure"
++          echo "  make"
++          echo "  mv make .."
++	  echo "  cd .."
++	  echo "Restart then the configure script and later use ./make instead of make."
++	  exit 1
++      else
++	  echo "You have locally installed GNU Make 3.81. Good!"
++      fi
++  fi
++else
++  echo "Cannot find GNU Make >= 3.81."
++fi
++
++# Browser command
++
++if [ "$browser_spec" = "no" ]; then
++    case $ARCH in
++        win32) BROWSER='C:\PROGRA~1\INTERN~1\IEXPLORE %s' ;;
++        *) BROWSER='firefox -remote "OpenURL(%s,new-tab)" || firefox %s &' ;;
++    esac
++fi
++
++if [ "$wwwcoq_spec" = "no" ]; then
++    WWWCOQ="http://coq.inria.fr/"
++fi
++
++#########################################
++# Objective Caml programs
++
++case $camldir_spec in
++    no) CAMLC=`which $bytecamlc`
++	case "$CAMLC" in
++	    "") echo "$bytecamlc is not present in your path!"
++		echo "Give me manually the path to the $bytecamlc executable [/usr/local/bin by default]: "
++		read CAMLC
++		
++		case "$CAMLC" in
++		    "") CAMLC=/usr/local/bin/$bytecamlc;;
++		    */ocamlc|*/ocamlc.opt) true;;
++		    */) CAMLC="${CAMLC}"$bytecamlc;;
++		    *) CAMLC="${CAMLC}"/$bytecamlc;;
++		esac
++	esac
++	CAMLBIN=`dirname "$CAMLC"`;;
++    yes) CAMLC=$camldir/$bytecamlc
++        
++         CAMLBIN=`dirname "$CAMLC"`
++	 bytecamlc="$CAMLC"
++	 nativecamlc=$CAMLBIN/$nativecamlc
++	 ocamlexec=$CAMLBIN/ocaml
++	 ocamldepexec=$CAMLBIN/ocamldep
++	 ocamldocexec=$CAMLBIN/ocamldoc
++	 ocamllexexec=$CAMLBIN/ocamllex
++	 ocamlyaccexec=$CAMLBIN/ocamlyacc
++	 ocamlmktopexec=$CAMLBIN/ocamlmktop
++	 ocamlmklibexec=$CAMLBIN/ocamlmklib
++	 camlp4oexec=$CAMLBIN/camlp4o
++esac
++
++if test ! -f "$CAMLC" ; then
++    echo "I can not find the executable '$CAMLC'. Have you installed it?"
++    echo "Configuration script failed!"
++    exit 1
++fi
++
++# Under Windows, OCaml only understands Windows filenames (C:\...)
++case $ARCH in
++    win32) CAMLBIN=`cygpath -m ${CAMLBIN}`;;
++esac
++
++CAMLVERSION=`"$bytecamlc" -version`
++
++case $CAMLVERSION in
++    1.*|2.*|3.00|3.01|3.02|3.03|3.03alpha|3.04|3.05beta|3.05|3.06|3.07*|3.08*|3.09*)
++	echo "Your version of Objective-Caml is $CAMLVERSION."
++	if [ "$force_caml_version" = "yes" ]; then
++	    echo "*Warning* You are compiling Coq with an outdated version of Objective-Caml."
++	else
++	    echo "          You need Objective-Caml 3.10.2 or later."
++	    echo "          Configuration script failed!"
++	    exit 1
++	fi;;
++    ?*)
++	CAMLP4COMPAT="-loc loc" 
++	echo "You have Objective-Caml $CAMLVERSION. Good!";;
++    *)
++	echo "I found the Objective-Caml compiler but cannot find its version number!"
++	echo "Is it installed properly?"
++	echo "Configuration script failed!"
++	exit 1;;
++esac
++
++CAMLTAG=OCAML`echo $CAMLVERSION | sed -e "s/\([1-9]\)\.\([0-9]*\).*/\1\2/g"`
++
++# For coqmktop & bytecode compiler
++
++case $ARCH in
++    win32) # Awfull trick to get around a ^M problem at the end of CAMLLIB
++      CAMLLIB=`"$CAMLC" -where | sed -e 's/^\(.*\)$/\1/'` ;;
++    *)
++      CAMLLIB=`"$CAMLC" -where`
++esac
++
++if [ "$coq_debug_flag" = "-g" ]; then
++    case $CAMLTAG in
++        OCAML31*)
++            # Compilation debug flag
++            coq_debug_flag_opt="-g"
++            ;;
++    esac
++fi
++
++# Native dynlink
++if [ "$natdynlink" = "yes" -a -f `"$CAMLC" -where`/dynlink.cmxa ]; then
++    HASNATDYNLINK=true
++else
++    HASNATDYNLINK=false
++fi
++
++case $HASNATDYNLINK,`uname -s`,`uname -r`,$CAMLVERSION in
++    true,Darwin,9.*,3.11.*)  # ocaml 3.11.0 dynlink on MacOS 10.5 is buggy
++        NATDYNLINKFLAG=os5fixme;;
++    #Possibly a problem on 10.6.0/10.6.1/10.6.2
++    #May just be a 32 vs 64 problem for all 10.6.*
++    true,Darwin,10.0.*,3.11.*) # Possibly a problem on 10.6.0
++        NATDYNLINKFLAG=os5fixme;;
++    true,Darwin,10.1.*,3.11.*) # Possibly a problem on 10.6.1
++        NATDYNLINKFLAG=os5fixme;;
++    true,Darwin,10.2.*,3.11.*) # Possibly a problem on 10.6.2
++        NATDYNLINKFLAG=os5fixme;;
++    true,Darwin,10.*,3.11.*)
++        if [ `getconf LONG_BIT` = "32" ]; then
++	    # Still a problem for x86_32
++            NATDYNLINKFLAG=os5fixme
++        else
++	    # Not a problem for x86_64
++            NATDYNLINKFLAG=$HASNATDYNLINK
++        fi;;
++    *)
++        NATDYNLINKFLAG=$HASNATDYNLINK;;
++esac
++
++# Camlp4 / Camlp5 configuration
++
++if [ "$camlp5dir" != "" ]; then
++    CAMLP4=camlp5
++    CAMLP4LIB=$camlp5dir
++    if [ ! -f $camlp5dir/camlp5.cma ]; then
++	echo "Cannot find camlp5 libraries in $camlp5dir (camlp5.cma not found)."
++	echo "Configuration script failed!"
++	exit 1
++    fi
++    camlp4oexec=`echo $camlp4oexec | sed -e 's/4/5/'`
++else
++    case $CAMLTAG in
++        OCAML31*)
++            if [ -x "${CAMLLIB}/camlp5" ]; then
++                CAMLP4LIB=+camlp5
++            elif [ -x "${CAMLLIB}/site-lib/camlp5" ]; then
++                CAMLP4LIB=+site-lib/camlp5
++            else
++	        echo "Objective Caml $CAMLVERSION found but no Camlp5 installed."
++	        echo "Configuration script failed!"
++	        exit 1
++            fi
++            CAMLP4=camlp5
++            camlp4oexec=`echo $camlp4oexec | sed -e 's/4/5/'`
++            ;;
++        *)
++            CAMLP4=camlp4
++            CAMLP4LIB=+camlp4
++            ;;
++    esac
++fi
++
++if [ "$CAMLP4" = "camlp5" ] && `$camlp4oexec -v 2>&1 | grep -q 5.00`; then
++    echo "Camlp5 version 5.00 not supported: versions 4.0x or >= 5.01 are OK"
++    echo "(depending also on your ocaml version)."
++    echo "Configuration script failed!"
++    exit 1
++fi
++
++
++case $CAMLP4LIB in
++    +*) FULLCAMLP4LIB=$CAMLLIB/`echo $CAMLP4LIB | cut -b 2-`;;
++    *)  FULLCAMLP4LIB=$CAMLP4LIB;;
++esac
++
++# Assume that camlp(4|5) binaries are at the same place as ocaml ones
++# (this should become configurable some day) 
++CAMLP4BIN=${CAMLBIN}
++
++# do we have a native compiler: test of ocamlopt and its version
++
++if [ "$best_compiler" = "opt" ] ; then
++  if test -e "$nativecamlc" || test -e "`which $nativecamlc`"; then
++      CAMLOPTVERSION=`"$nativecamlc" -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
++      if [ "`uname -s`" = "Darwin" -a "$ARCH" = "i386" ]; then
++	  case $CAMLOPTVERSION in
++	      3.09.3|3.1?*) ;;
++	      *) echo "Native compilation on MacOS X Pentium requires Objective-Caml >= 3.09.3,"
++		 best_compiler=byte
++		 echo "only the bytecode version of Coq will be available."
++	  esac
++      elif [ ! -f $FULLCAMLP4LIB/gramlib.cmxa ]; then
++	  best_compiler=byte
++	  echo "Cannot find native-code $CAMLP4,"
++	  echo "only the bytecode version of Coq will be available."
++      else
++        if [ "$CAMLOPTVERSION" != "$CAMLVERSION" ] ; then
++	  echo "Native and bytecode compilers do not have the same version!"
++        fi
++        echo "You have native-code compilation. Good!"
++      fi
++  else
++      best_compiler=byte
++      echo "You have only bytecode compilation."
++  fi
++fi
++
++# OS dependent libraries
++
++case $ARCH in
++  sun4*) OS=`uname -r`
++	case $OS in
++	   5*) OS="Sun Solaris $OS"
++	       OSDEPLIBS="-cclib -lunix -cclib -lnsl -cclib -lsocket";;
++	   *) OS="Sun OS $OS"
++	      OSDEPLIBS="-cclib -lunix"
++        esac;;
++  alpha) OSDEPLIBS="-cclib -lunix";;
++  win32) OS="Win32" 
++	 OSDEPLIBS="-cclib -lunix"
++	 cflags="-mno-cygwin $cflags";;
++  *) OSDEPLIBS="-cclib -lunix"
++esac
++
++# lablgtk2 and CoqIDE
++
++# -byte-only should imply -coqide byte, unless the user decides otherwise
++
++if [ "$best_compiler" = "byte" -a "$coqide_spec" = "no" ]; then 
++    coqide_spec=yes
++    COQIDE=byte
++fi
++
++# Which coqide is asked ? which one is possible ?
++
++if [ "$coqide_spec" = "yes" -a "$COQIDE" = "no" ]; then 
++    echo "CoqIde disabled as requested."
++else
++    case $lablgtkdir_spec in
++	no) 
++	    if [ -f "${CAMLLIB}/lablgtk2/glib.mli" ]; then
++		lablgtkdir=${CAMLLIB}/lablgtk2
++	    elif [ -f "${CAMLLIB}/site-lib/lablgtk2/glib.mli" ]; then
++		lablgtkdir=${CAMLLIB}/site-lib/lablgtk2
++	    fi;;
++	yes)
++	    if [ ! -f "$lablgtkdir/glib.mli" ]; then
++		echo "Incorrect LablGtk2 library (glib.mli not found)."
++		echo "Configuration script failed!"
++		exit 1
++	    fi;;
++    esac
++    if [ "$lablgtkdir" = "" ]; then
++	echo "LablGtk2 not found: CoqIde will not be available."
++	COQIDE=no
++    elif [ -z "`grep -w convert_with_fallback "$lablgtkdir/glib.mli"`" ]; then
++	echo "LablGtk2 found but too old: CoqIde will not be available."
++	COQIDE=no;
++    elif [ "$coqide_spec" = "yes" -a "$COQIDE" = "byte" ]; then 
++	echo "LablGtk2 found, bytecode CoqIde will be used as requested."
++	COQIDE=byte
++    elif [ ! -f "${CAMLLIB}/threads/threads.cmxa" ]; then 
++	echo "LablGtk2 found, no native threads: bytecode CoqIde will be available."
++	COQIDE=byte
++    else 
++	echo "LablGtk2 found, native threads: native CoqIde will be available."
++	COQIDE=opt
++    fi
++fi
++
++case $COQIDE in
++    byte|opt)
++        case $lablgtkdir_spec in
++            no)  LABLGTKLIB=+lablgtk2                   # Pour le message
++                 LABLGTKINCLUDES="-I $LABLGTKLIB";;     # Pour le makefile
++            yes) LABLGTKLIB="$lablgtkdir"               # Pour le message
++                 LABLGTKINCLUDES="-I \"$LABLGTKLIB\"";; # Pour le makefile
++        esac;;
++    no) LABLGTKINCLUDES="";;
++esac
++
++# strip command
++
++case $ARCH in
++    win32)
++	# true -> strip : it exists under cygwin !
++	STRIPCOMMAND="strip";; 
++    *)
++    if [ "$coq_profile_flag" = "-p" ] || [ "$coq_debug_flag" = "-g" ] ||
++       [ "`uname -s`" = "Darwin" -a "$HASNATDYNLINK" = "true" ]
++    then
++	STRIPCOMMAND="true"
++    else
++	STRIPCOMMAND="strip"
++    fi
++esac
++
++# mktexlsr
++#MKTEXLSR=`which mktexlsr`
++#case $MKTEXLSR in
++#    "") MKTEXLSR=true;;
++#esac
++
++# "
++### Test if documentation can be compiled (latex, hevea)
++
++if test "$with_doc" = "all" 
++then
++    for cmd in "latex" "hevea" ; do
++	if test ! -x "`which $cmd`"
++	then 
++	    echo "$cmd was not found; documentation will not be available"
++	    with_doc=no
++	    break
++	fi
++    done
++fi
++
++###########################################
++# bindir, libdir, mandir, docdir, etc.
++
++case $src_spec in
++  no) COQTOP=${COQSRC}
++esac
++
++# OCaml only understand Windows filenames (C:\...)
++case $ARCH in
++    win32) COQTOP=`cygpath -m ${COQTOP}`
++esac
++
++case $ARCH in
++  win32)
++	 bindir_def='C:\coq\bin'
++	 libdir_def='C:\coq\lib'
++	 mandir_def='C:\coq\man'
++	 docdir_def='C:\coq\doc'
++	 emacslib_def='C:\coq\emacs'
++         coqdocdir_def='C:\coq\latex';;
++  *)
++	 bindir_def=/usr/local/bin
++	 libdir_def=/usr/local/lib/coq
++	 mandir_def=/usr/local/man
++	 docdir_def=/usr/local/share/doc/coq
++	 emacslib_def=/usr/local/share/emacs/site-lisp
++         coqdocdir_def=/usr/local/share/texmf/tex/latex/misc;;
++esac
++
++emacs_def=emacs
++
++case $bindir_spec/$prefix_spec/$local in
++    yes/*/*) BINDIR=$bindir ;;
++    */yes/*) BINDIR=$prefix/bin ;;
++    */*/true) BINDIR=$COQTOP/bin ;;
++    *) printf "Where should I install the Coq binaries [$bindir_def]? "
++        read BINDIR
++	case $BINDIR in
++	    "") BINDIR=$bindir_def;;
++	    *) true;;
++	esac;;
++esac
++
++case $libdir_spec/$prefix_spec/$local in
++    yes/*/*) LIBDIR=$libdir;;
++    */yes/*)
++        case $ARCH in
++          win32) LIBDIR=$prefix ;;
++          *)  LIBDIR=$prefix/lib/coq ;;
++        esac ;;
++    */*/true) LIBDIR=$COQTOP ;;
++    *)  printf "Where should I install the Coq library [$libdir_def]? "
++        read LIBDIR
++	case $LIBDIR in
++	    "") LIBDIR=$libdir_def;;
++	    *) true;;
++	esac;;
++esac
++
++case $mandir_spec/$prefix_spec/$local in
++    yes/*/*) MANDIR=$mandir;;
++    */yes/*) MANDIR=$prefix/man ;;
++    */*/true) MANDIR=$COQTOP/man ;;
++    *)  printf "Where should I install the Coq man pages [$mandir_def]? "
++        read MANDIR
++	case $MANDIR in
++	    "") MANDIR=$mandir_def;;
++	    *) true;;
++	esac;;
++esac
++
++case $docdir_spec/$prefix_spec/$local in
++    yes/*/*) DOCDIR=$docdir; HTMLREFMANDIR=$DOCDIR/html/refman;;
++    */yes/*) DOCDIR=$prefix/share/doc/coq; HTMLREFMANDIR=$DOCDIR/html/refman;;
++    */*/true) DOCDIR=$COQTOP/doc; HTMLREFMANDIR=$DOCDIR/refman/html;;
++    *)  printf "Where should I install the Coq documentation [$docdir_def]? "
++        read DOCDIR
++	case $DOCDIR in
++	    "") DOCDIR=$docdir_def; HTMLREFMANDIR=$DOCDIR/html/refman;;
++	    *) true;;
++	esac;;
++esac
++
++case $emacslib_spec/$prefix_spec/$local in
++    yes/*/*) EMACSLIB=$emacslib;;
++    */yes/*)
++        case $ARCH in
++          win32) EMACSLIB=$prefix/emacs ;;
++          *)  EMACSLIB=$prefix/share/emacs/site-lisp ;;
++        esac ;;
++    */*/true) EMACSLIB=$COQTOP/tools/emacs ;;
++    *) printf "Where should I install the Coq Emacs mode [$emacslib_def]? "
++        read EMACSLIB
++	case $EMACSLIB in
++	    "") EMACSLIB=$emacslib_def;;
++	    *) true;;
++	esac;;
++esac
++
++case $coqdocdir_spec/$prefix_spec/$local in
++    yes/*/*) COQDOCDIR=$coqdocdir;;
++    */yes/*)
++        case $ARCH in
++          win32) COQDOCDIR=$prefix/latex ;;
++          *)  COQDOCDIR=$prefix/share/emacs/site-lisp ;;
++        esac ;;
++    */*/true) COQDOCDIR=$COQTOP/tools/coqdoc ;;
++    *) printf "Where should I install Coqdoc TeX/LaTeX files [$coqdocdir_def]? "
++        read COQDOCDIR
++	case $COQDOCDIR in
++	    "") COQDOCDIR=$coqdocdir_def;;
++	    *) true;;
++	esac;;
++esac
++
++# Determine if we enable -custom by default (Windows and MacOS)
++CUSTOM_OS=no
++if [ "$ARCH" = "win32" ] || [ "`uname -s`" = "Darwin" ]; then
++    CUSTOM_OS=yes
++fi
++
++BUILDLDPATH="# you might want to set CAML_LD_LIBRARY_PATH by hand!"
++case $coqrunbyteflags_spec/$local/$custom_spec/$CUSTOM_OS in
++    yes/*/*/*) COQRUNBYTEFLAGS="$coqrunbyteflags";;
++    */*/yes/*|*/*/*/yes) COQRUNBYTEFLAGS="-custom";;
++    */true/*/*) COQRUNBYTEFLAGS="-dllib -lcoqrun -dllpath '$COQTOP'/kernel/byterun";;
++    *)
++        COQRUNBYTEFLAGS="-dllib -lcoqrun -dllpath '$LIBDIR'"
++        BUILDLDPATH="export CAML_LD_LIBRARY_PATH='$COQTOP'/kernel/byterun";;
++esac
++case $coqtoolsbyteflags_spec/$custom_spec/$CUSTOM_OS in
++    yes/*/*) COQTOOLSBYTEFLAGS="$coqtoolsbyteflags";;
++    */yes/*|*/*/yes) COQTOOLSBYTEFLAGS="-custom";;
++    *) COQTOOLSBYTEFLAGS="";;
++esac
++
++# case $emacs_spec in
++#     no) printf "Which Emacs command should I use to compile coq.el [$emacs_def]? "
++#         read EMACS
++	
++# 	case $EMACS in
++# 	    "") EMACS=$emacs_def;;
++# 	    *) true;;
++# 	esac;;
++#     yes) EMACS=$emacs;;
++# esac
++
++
++
++###########################################
++# Summary of the configuration
++
++echo ""
++echo "  Coq top directory                 : $COQTOP"
++echo "  Architecture                      : $ARCH"
++if test ! -z "$OS" ; then
++  echo "  Operating system                  : $OS"
++fi
++echo "  Coq VM bytecode link flags        : $COQRUNBYTEFLAGS"
++echo "  Coq tools bytecode link flags     : $COQTOOLSBYTEFLAGS"
++echo "  OS dependent libraries            : $OSDEPLIBS"
++echo "  Objective-Caml/Camlp4 version     : $CAMLVERSION"
++echo "  Objective-Caml/Camlp4 binaries in : $CAMLBIN"
++echo "  Objective-Caml library in         : $CAMLLIB"
++echo "  Camlp4 library in                 : $CAMLP4LIB"
++if test "$best_compiler" = opt ; then
++echo "  Native dynamic link support       : $HASNATDYNLINK"
++fi
++if test "$COQIDE" != "no"; then
++echo "  Lablgtk2 library in               : $LABLGTKLIB"
++fi
++if test "$with_doc" = "all"; then
++echo "  Documentation                     : All"
++else
++echo "  Documentation                     : None"
++fi
++echo "  CoqIde                            : $COQIDE"
++echo "  Web browser                       : $BROWSER"
++echo "  Coq web site                      : $WWWCOQ"
++echo ""
++
++echo "  Paths for true installation:"
++echo "    binaries      will be copied in $BINDIR"
++echo "    library       will be copied in $LIBDIR"
++echo "    man pages     will be copied in $MANDIR"
++echo "    documentation will be copied in $DOCDIR"
++echo "    emacs mode    will be copied in $EMACSLIB"
++echo ""
++
++##################################################
++# Building the $COQTOP/dev/ocamldebug-coq file
++##################################################
++
++OCAMLDEBUGCOQ=$COQSRC/dev/ocamldebug-coq
++
++if test "$coq_debug_flag" = "-g" ; then
++  rm -f $OCAMLDEBUGCOQ
++  sed -e "s|COQTOPDIRECTORY|$COQTOP|" \
++      -e "s|COQLIBDIRECTORY|$LIBDIR|" \
++      -e "s|CAMLBINDIRECTORY|$CAMLBIN|" \
++      -e "s|CAMLP4LIBDIRECTORY|$FULLCAMLP4LIB|"\
++      $OCAMLDEBUGCOQ.template > $OCAMLDEBUGCOQ
++  chmod a-w,a+x $OCAMLDEBUGCOQ
++fi
++
++####################################################
++# Fixing lablgtk types (before/after 2.6.0) 
++####################################################
++
++if [ ! "$COQIDE" = "no" ]; then 
++    if grep "class view " "$lablgtkdir/gText.mli" | grep -q "\[>" ; then
++       if grep -q "?accepts_tab:bool" "$lablgtkdir/gText.mli" ; then
++        cp -f ide/undo_lablgtk_ge212.mli ide/undo.mli
++       else
++	cp -f ide/undo_lablgtk_ge26.mli ide/undo.mli
++       fi
++    else
++	cp -f ide/undo_lablgtk_lt26.mli ide/undo.mli
++    fi
++fi  
++
++##############################################
++# Creation of configuration files
++##############################################
++
++mlconfig_file="$COQSRC/config/coq_config.ml"
++config_file="$COQSRC/config/Makefile"
++config_template="$COQSRC/config/Makefile.template"
++
++
++### Warning !!
++### After this line, be careful when using variables,
++### since some of them (e.g. $COQSRC) will be escaped
++
++
++# An escaped version of a variable
++escape_var () {
++"$ocamlexec" 2>&1 1>/dev/null <<EOF
++  prerr_endline(String.escaped(Sys.getenv"$VAR"));;
++EOF
++}
++
++# Escaped version of browser command
++export BROWSER
++BROWSER=`VAR=BROWSER escape_var`
++
++# damned backslashes under M$Windows
++case $ARCH in
++    win32)
++	COQTOP=`echo $COQTOP |sed -e 's|\\\|\\\\\\\|g'`
++	BINDIR=`echo $BINDIR |sed -e 's|\\\|\\\\\\\|g'`
++	COQSRC=`cygpath -m $COQSRC |sed -e 's|\\\|\\\\\\\|g'`
++	LIBDIR=`echo $LIBDIR |sed -e 's|\\\|\\\\\\\|g'`
++	CAMLBIN=`echo $CAMLBIN |sed -e 's|\\\|\\\\\\\|g'`
++	CAMLLIB=`echo $CAMLLIB |sed -e 's|\\\|\\\\\\\|g'`
++	MANDIR=`echo $MANDIR |sed -e 's|\\\|\\\\\\\|g'`
++	DOCDIR=`echo $DOCDIR |sed -e 's|\\\|\\\\\\\|g'`
++	EMACSLIB=`echo $EMACSLIB |sed -e 's|\\\|\\\\\\\|g'`
++	COQDOCDIR=`echo $COQDOCDIR |sed -e 's|\\\|\\\\\\\|g'`
++	CAMLP4BIN=`echo $CAMLP4BIN |sed -e 's|\\\|\\\\\\\|g'`
++	CAMLP4LIB=`echo $CAMLP4LIB |sed -e 's|\\\|\\\\\\\|g'`
++	LABLGTKINCLUDES=`echo $LABLGTKINCLUDES |sed -e 's|\\\|\\\\\\\|g'`
++	COQRUNBYTEFLAGS=`echo $COQRUNBYTEFLAGS |sed -e 's|\\\|\\\\\\\|g'`
++	COQTOOLSBYTEFLAGS=`echo $COQTOOLSBYTEFLAGS |sed -e 's|\\\|\\\\\\\|g'`
++	BUILDLDPATH=`echo $BUILDLDPATH |sed -e 's|\\\|\\\\\\\|g'`
++	ocamlexec=`echo $ocamlexec |sed -e 's|\\\|\\\\\\\|g'`
++	bytecamlc=`echo $bytecamlc |sed -e 's|\\\|\\\\\\\|g'`
++	nativecamlc=`echo $nativecamlc |sed -e 's|\\\|\\\\\\\|g'`
++	ocamlmklibexec=`echo $ocamlmklibexec |sed -e 's|\\\|\\\\\\\|g'`
++	ocamldepexec=`echo $ocamldepexec |sed -e 's|\\\|\\\\\\\|g'`
++	ocamldocexec=`echo $ocamldocexec |sed -e 's|\\\|\\\\\\\|g'`
++	ocamllexexec=`echo $ocamllexexec |sed -e 's|\\\|\\\\\\\|g'`
++	ocamlyaccexec=`echo $ocamlyaccexec |sed -e 's|\\\|\\\\\\\|g'`
++	camlp4oexec=`echo $camlp4oexec |sed -e 's|\\\|\\\\\\\|g'`
++    ;;
++esac
++
++#####################################################
++# Building the $COQTOP/config/coq_config.ml file
++#####################################################
++
++rm -f "$mlconfig_file"
++cat << END_OF_COQ_CONFIG > $mlconfig_file
++(* DO NOT EDIT THIS FILE: automatically generated by ../configure *)
++
++let local = $local
++let coqrunbyteflags = "$COQRUNBYTEFLAGS"
++let coqlib = "$LIBDIR"
++let coqsrc = "$COQSRC"
++let ocaml = "$ocamlexec"
++let ocamlc = "$bytecamlc"
++let ocamlopt = "$nativecamlc"
++let ocamlmklib = "$ocamlmklibexec"
++let ocamldep = "$ocamldepexec"
++let ocamldoc = "$ocamldocexec"
++let ocamlyacc = "$ocamlyaccexec"
++let ocamllex = "$ocamllexexec"
++let camlbin = "$CAMLBIN"
++let camllib = "$CAMLLIB"
++let camlp4 = "$CAMLP4"
++let camlp4o = "$camlp4oexec"
++let camlp4bin = "$CAMLP4BIN"
++let camlp4lib = "$CAMLP4LIB"
++let camlp4compat = "$CAMLP4COMPAT"
++let coqideincl = "$LABLGTKINCLUDES"
++let cflags = "$cflags"
++let best = "$best_compiler"
++let arch = "$ARCH"
++let has_coqide = "$COQIDE"
++let has_natdynlink = $HASNATDYNLINK
++let natdynlinkflag = "$NATDYNLINKFLAG"
++let osdeplibs = "$OSDEPLIBS"
++let version = "$VERSION"
++let caml_version = "$CAMLVERSION"
++let date = "$DATE"
++let compile_date = "$COMPILEDATE"
++let vo_magic_number = $VOMAGIC
++let state_magic_number = $STATEMAGIC
++let exec_extension = "$EXE"
++let with_geoproof = ref $with_geoproof
++let browser = "$BROWSER"
++let wwwcoq = "$WWWCOQ"
++let wwwrefman = wwwcoq ^ "distrib/" ^ version ^ "/refman/"
++let wwwstdlib = wwwcoq ^ "distrib/" ^ version ^ "/stdlib/"
++let localwwwrefman = "file://$HTMLREFMANDIR/"
++
++END_OF_COQ_CONFIG
++
++# to be sure printf is found on windows when spaces occur in PATH variable
++PRINTF=`which printf`
++
++# Subdirectories of theories/ added in coq_config.ml
++subdirs () {
++    (cd $1; find * \( -name .svn -prune \) -o \( -type d -exec $PRINTF "\"%s\";\n" {} \; \) >> "$mlconfig_file")
++}
++
++echo "let theories_dirs = [" >> "$mlconfig_file"
++subdirs theories
++echo "]" >> "$mlconfig_file"
++
++echo "let plugins_dirs = [" >> "$mlconfig_file"
++subdirs plugins
++echo "]" >> "$mlconfig_file"
++
++chmod a-w "$mlconfig_file"
++
++
++###############################################
++# Building the $COQTOP/config/Makefile file
++###############################################
++
++rm -f "$config_file"
++
++sed -e "s|LOCALINSTALLATION|$local|" \
++    -e "s|XCOQRUNBYTEFLAGS|$COQRUNBYTEFLAGS|" \
++    -e "s|XCOQTOOLSBYTEFLAGS|$COQTOOLSBYTEFLAGS|" \
++    -e "s|COQSRCDIRECTORY|$COQSRC|" \
++    -e "s|COQVERSION|$VERSION|" \
++    -e "s|BINDIRDIRECTORY|$BINDIR|" \
++    -e "s|COQLIBDIRECTORY|$LIBDIR|" \
++    -e "s|BUILDLDPATH=|$BUILDLDPATH|" \
++    -e "s|MANDIRDIRECTORY|$MANDIR|" \
++    -e "s|DOCDIRDIRECTORY|$DOCDIR|" \
++    -e "s|EMACSLIBDIRECTORY|$EMACSLIB|" \
++    -e "s|EMACSCOMMAND|$EMACS|" \
++    -e "s|COQDOCDIRECTORY|$COQDOCDIR|" \
++    -e "s|MKTEXLSRCOMMAND|$MKTEXLSR|" \
++    -e "s|ARCHITECTURE|$ARCH|" \
++    -e "s|OSDEPENDENTLIBS|$OSDEPLIBS|" \
++    -e "s|OSDEPENDENTP4OPTFLAGS|$OSDEPP4OPTFLAGS|" \
++    -e "s|CAMLLIBDIRECTORY|$CAMLLIB|" \
++    -e "s|CAMLTAG|$CAMLTAG|" \
++    -e "s|CAMLP4BINDIRECTORY|$CAMLP4BIN|" \
++    -e "s|CAMLP4LIBDIRECTORY|$CAMLP4LIB|" \
++    -e "s|CAMLP4TOOL|$camlp4oexec|" \
++    -e "s|CAMLP4COMPATFLAGS|$CAMLP4COMPAT|" \
++    -e "s|LABLGTKINCLUDES|$LABLGTKINCLUDES|" \
++    -e "s|COQDEBUGFLAGOPT|$coq_debug_flag_opt|" \
++    -e "s|COQDEBUGFLAG|$coq_debug_flag|" \
++    -e "s|COQPROFILEFLAG|$coq_profile_flag|" \
++    -e "s|CAMLANNOTATEFLAG|$coq_annotate_flag|" \
++    -e "s|CCOMPILEFLAGS|$cflags|" \
++    -e "s|BESTCOMPILER|$best_compiler|" \
++    -e "s|DLLEXTENSION|$DLLEXT|" \
++    -e "s|EXECUTEEXTENSION|$EXE|" \
++    -e "s|BYTECAMLC|$bytecamlc|" \
++    -e "s|OCAMLMKLIBEXEC|$ocamlmklibexec|" \
++    -e "s|NATIVECAMLC|$nativecamlc|" \
++    -e "s|OCAMLEXEC|$ocamlexec|" \
++    -e "s|OCAMLDEPEXEC|$ocamldepexec|" \
++    -e "s|OCAMLDOCEXEC|$ocamldocexec|" \
++    -e "s|OCAMLLEXEXEC|$ocamllexexec|" \
++    -e "s|OCAMLYACCEXEC|$ocamlyaccexec|" \
++    -e "s|CAMLMKTOPEXEC|$ocamlmktopexec|" \
++    -e "s|CCEXEC|$gcc_exec|" \
++    -e "s|AREXEC|$ar_exec|" \
++    -e "s|RANLIBEXEC|$ranlib_exec|" \
++    -e "s|STRIPCOMMAND|$STRIPCOMMAND|" \
++    -e "s|COQIDEOPT|$COQIDE|" \
++    -e "s|CHECKEDOUTSOURCETREE|$checkedout|" \
++    -e "s|WITHDOCOPT|$with_doc|" \
++    -e "s|HASNATIVEDYNLINK|$NATDYNLINKFLAG|" \
++      "$config_template" > "$config_file"
++
++chmod a-w "$config_file"
++
++##################################################
++# The end
++####################################################
++
++echo "If anything in the above is wrong, please restart './configure'."
++echo
++echo "*Warning* To compile the system for a new architecture"
++echo "          don't forget to do a 'make archclean' before './configure'."
++
++# $Id: configure 14833 2011-12-19 21:57:30Z notin $
diff --git a/pkgs/applications/science/logic/coq/configure.patch b/pkgs/applications/science/logic/coq/configure.patch
index 431cccac4b0..aa38ce06e92 100644
--- a/pkgs/applications/science/logic/coq/configure.patch
+++ b/pkgs/applications/science/logic/coq/configure.patch
@@ -9,1104 +9,3 @@ diff -Nuar coq-8.3pl3-orig/configure coq-8.3pl3/configure
  esac
  
  if test ! -f "$CAMLC" ; then
-@@ -628,7 +627,7 @@
-             no)  LABLGTKLIB=+lablgtk2                   # Pour le message
-                  LABLGTKINCLUDES="-I $LABLGTKLIB";;     # Pour le makefile
-             yes) LABLGTKLIB="$lablgtkdir"               # Pour le message
--                 LABLGTKINCLUDES="-I \"$LABLGTKLIB\"";; # Pour le makefile
-+                 LABLGTKINCLUDES="-I $LABLGTKLIB";;     # Pour le makefile
-         esac;;
-     no) LABLGTKINCLUDES="";;
- esac
-diff -Nuar coq-8.3pl3-orig/configure~ coq-8.3pl3/configure~
---- coq-8.3pl3-orig/configure~	1970-01-01 01:00:00.000000000 +0100
-+++ coq-8.3pl3/configure~	2011-12-19 22:57:30.000000000 +0100
-@@ -0,0 +1,1088 @@
-+#!/bin/sh
-+
-+##################################
-+#
-+#  Configuration script for Coq
-+# 
-+##################################
-+
-+VERSION=8.3pl3
-+VOMAGIC=08300
-+STATEMAGIC=58300
-+DATE=`LANG=C date +"%B %Y"`
-+
-+# Create the bin/ directory if non-existent
-+test -d bin || mkdir bin
-+
-+# a local which command for sh
-+which () {
-+IFS=":" # set words separator in PATH to be ':' (it allows spaces in dirnames)
-+for i in $PATH; do
-+  if test -z "$i"; then i=.; fi 
-+  if [ -f "$i/$1" ] ; then
-+	IFS=" "
-+        echo "$i/$1"
-+	break
-+  fi
-+done
-+}
-+
-+usage () {
-+    printf "Available options for configure are:\n"
-+    echo "-help"
-+    printf "\tDisplays this help page\n"
-+    echo "-prefix <dir>"
-+    printf "\tSet installation directory to <dir>\n"
-+    echo "-local"
-+    printf "\tSet installation directory to the current source tree\n"
-+    echo "-coqrunbyteflags"
-+    printf "\tSet link flags for VM-dependent bytecode (coqtop)\n"
-+    echo "-coqtoolsbyteflags"
-+    printf "\tSet link flags for VM-independant bytecode (coqdep, coqdoc, ...)\n"
-+    echo "-custom"
-+    printf "\tGenerate all bytecode executables with -custom (not recommended)\n"
-+    echo "-src"
-+    printf "\tSpecifies the source directory\n"
-+    echo "-bindir"
-+    echo "-libdir"
-+    echo "-mandir"
-+    echo "-docdir"
-+    printf "\tSpecifies where to install bin/lib/man/doc files resp.\n"
-+    echo "-emacslib"
-+    echo "-emacs"
-+    printf "\tSpecifies where emacs files are to be installed\n"
-+    echo "-coqdocdir"
-+    printf "\tSpecifies where Coqdoc style files are to be installed\n"
-+    echo "-camldir"
-+    printf "\tSpecifies the path to the OCaml library\n"
-+    echo "-lablgtkdir"
-+    printf "\tSpecifies the path to the Lablgtk library\n"
-+    echo "-camlp5dir"
-+    printf "\tSpecifies where to look for the Camlp5 library and tells to use it\n"
-+    echo "-arch"
-+    printf "\tSpecifies the architecture\n"
-+    echo "-opt"
-+    printf "\tSpecifies whether or not to use OCaml *.opt optimized compilers\n"
-+    echo "-natdynlink (yes|no)"
-+    printf "\tSpecifies whether or not to use dynamic loading of native code\n"
-+    echo "-coqide (opt|byte|no)"
-+    printf "\tSpecifies whether or not to compile Coqide\n"
-+    echo "-browser <command>"
-+    printf "\tUse <command> to open URL %%s\n"
-+    echo "-with-doc (yes|no)"
-+    printf "\tSpecifies whether or not to compile the documentation\n"
-+    echo "-with-geoproof (yes|no)"
-+    printf "\tSpecifies whether or not to use Geoproof binding\n"
-+    echo "-with-cc <file>"
-+    echo "-with-ar <file>"
-+    echo "-with-ranlib <file>"
-+    printf "\tTells configure where to find gcc/ar/ranlib executables\n"
-+    echo "-byte-only"
-+    printf "\tCompiles only bytecode version of Coq\n"
-+    echo "-debug"
-+    printf "\tAdd debugging information in the Coq executables\n"
-+    echo "-profile"
-+    printf "\tAdd profiling information in the Coq executables\n"
-+    echo "-annotate"
-+    printf "\tCompiles Coq with -dtypes option\n"
-+}
-+
-+
-+# Default OCaml binaries
-+bytecamlc=ocamlc
-+nativecamlc=ocamlopt
-+ocamlmklibexec=ocamlmklib
-+ocamlexec=ocaml
-+ocamldepexec=ocamldep
-+ocamldocexec=ocamldoc
-+ocamllexexec=ocamllex
-+ocamlyaccexec=ocamlyacc
-+ocamlmktopexec=ocamlmktop
-+camlp4oexec=camlp4o
-+
-+
-+coq_debug_flag=
-+coq_debug_flag_opt=
-+coq_profile_flag=
-+coq_annotate_flag=
-+best_compiler=opt
-+cflags="-fno-defer-pop -Wall -Wno-unused"
-+natdynlink=yes
-+
-+gcc_exec=gcc
-+ar_exec=ar
-+ranlib_exec=ranlib
-+
-+local=false
-+coqrunbyteflags_spec=no
-+coqtoolsbyteflags_spec=no
-+custom_spec=no
-+src_spec=no
-+prefix_spec=no
-+bindir_spec=no
-+libdir_spec=no
-+mandir_spec=no
-+docdir_spec=no
-+emacslib_spec=no
-+emacs_spec=no
-+camldir_spec=no
-+lablgtkdir_spec=no
-+coqdocdir_spec=no
-+arch_spec=no
-+coqide_spec=no
-+browser_spec=no
-+wwwcoq_spec=no
-+with_geoproof=false
-+with_doc=all
-+with_doc_spec=no
-+force_caml_version=no
-+force_caml_version_spec=no
-+
-+COQSRC=`pwd`
-+
-+# Parse command-line arguments
-+
-+while : ; do
-+  case "$1" in
-+    "") break;;
-+    -help|--help) usage
-+	          exit;;
-+    -prefix|--prefix) prefix_spec=yes
-+                      prefix="$2"
-+		      shift;;
-+    -local|--local) local=true;;
-+    -coqrunbyteflags|--coqrunbyteflags) coqrunbyteflags_spec=yes
-+                                        coqrunbyteflags="$2"
-+                                        shift;;
-+    -coqtoolsbyteflags|--coqtoolsbyteflags) coqtoolsbyteflags_spec=yes
-+                                            coqtoolsbyteflags="$2"
-+                                            shift;;
-+    -custom|--custom) custom_spec=yes
-+                      shift;;
-+    -src|--src) src_spec=yes
-+                COQSRC="$2"
-+	        shift;;
-+    -bindir|--bindir) bindir_spec=yes
-+                      bindir="$2"
-+		      shift;;
-+    -libdir|--libdir) libdir_spec=yes
-+                      libdir="$2"
-+		      shift;;
-+    -mandir|--mandir) mandir_spec=yes
-+                      mandir="$2"
-+		      shift;;
-+    -docdir|--docdir) docdir_spec=yes
-+                      docdir="$2"
-+		      shift;;
-+    -emacslib|--emacslib) emacslib_spec=yes
-+                          emacslib="$2"
-+			  shift;;
-+    -emacs |--emacs) emacs_spec=yes
-+		     emacs="$2"
-+		     shift;;
-+    -coqdocdir|--coqdocdir) coqdocdir_spec=yes
-+	              coqdocdir="$2"
-+		      shift;;
-+    -camldir|--camldir) camldir_spec=yes
-+	                camldir="$2"
-+			shift;;
-+    -lablgtkdir|--lablgtkdir) lablgtkdir_spec=yes
-+	                lablgtkdir="$2"
-+			shift;;
-+    -camlp5dir|--camlp5dir)
-+	                camlp5dir="$2"
-+			shift;;
-+    -arch|--arch) arch_spec=yes
-+                  arch=$2
-+		  shift;;
-+    -opt|--opt) bytecamlc=ocamlc.opt
-+                camlp4oexec=camlp4o  # can't add .opt since dyn load'll be required
-+                nativecamlc=ocamlopt.opt;;
-+    -natdynlink|--natdynlink) case "$2" in
-+	                  yes) natdynlink=yes;;
-+                          *) natdynlink=no
-+                        esac
-+                        shift;;
-+    -coqide|--coqide) coqide_spec=yes
-+		      case "$2" in
-+			  byte|opt) COQIDE=$2;;
-+			  *) COQIDE=no
-+		      esac
-+		      shift;;
-+    -browser|--browser) browser_spec=yes
-+		      BROWSER=$2
-+		      shift;;
-+    -coqwebsite|--coqwebsite) wwwcoq_spec=yes
-+                      WWWCOQ=$2
-+                      shift;;
-+    -with-doc|--with-doc) with_doc_spec=yes
-+		      case "$2" in
-+			  yes|all) with_doc=all;;
-+			  *) with_doc=no
-+		      esac
-+		      shift;;
-+    -with-geoproof|--with-geoproof) 
-+	  case "$2" in
-+	      yes) with_geoproof=true;;
-+	      no) with_geoproof=false;;
-+	  esac
-+	  shift;;
-+    -with-cc|-with-gcc|--with-cc|--with-gcc) 
-+	  gcc_spec=yes
-+	  gcc_exec=$2
-+	  shift;;
-+    -with-ar|--with-ar) 
-+	  ar_spec=yes
-+	  ar_exec=$2
-+	  shift;;
-+    -with-ranlib|--with-ranlib) 
-+	  ranlib_spec=yes
-+	  ranlib_exec=$2
-+	  shift;;
-+    -byte-only|-byteonly|--byteonly|--byte-only) best_compiler=byte;;
-+    -debug|--debug) coq_debug_flag=-g;;
-+    -profile|--profile) coq_profile_flag=-p;;
-+    -annotate|--annotate) coq_annotate_flag=-dtypes;;
-+    -force-caml-version|--force-caml-version|-force-ocaml-version|--force-ocaml-version) 
-+          force_caml_version_spec=yes
-+	  force_caml_version=yes;;
-+    *) echo "Unknown option \"$1\"." 1>&2; usage; exit 2;;
-+  esac
-+  shift
-+done
-+
-+if [ $prefix_spec = yes -a $local = true ] ; then
-+  echo "Options -prefix and -local are incompatible."
-+  echo "Configure script failed!"
-+  exit 1
-+fi
-+
-+# compile date
-+DATEPGM=`which date`
-+case $DATEPGM in
-+    "") echo "I can't find the program \"date\" in your path."
-+        echo "Please give me the current date"
-+	read COMPILEDATE;;
-+    *)  COMPILEDATE=`date +"%h %d %Y %H:%M:%S"`;;
-+esac
-+
-+# Architecture
-+
-+case $arch_spec in
-+    no) 
-+    # First we test if we are running a Cygwin system
-+    if [ `uname -s | cut -c -6` = "CYGWIN" ] ; then
-+	ARCH="win32"
-+    else
-+	# If not, we determine the architecture
-+	if test -x /bin/arch ; then
-+ 	    ARCH=`/bin/arch`
-+ 	elif test -x /usr/bin/arch ; then
-+ 	    ARCH=`/usr/bin/arch`
-+ 	elif test -x /usr/ucb/arch ; then
-+ 	    ARCH=`/usr/ucb/arch`
-+ 	elif test -x /bin/uname ; then
-+ 	    ARCH=`/bin/uname -s`
-+ 	elif test -x /usr/bin/uname ; then
-+ 	    ARCH=`/usr/bin/uname -s`
-+	else
-+	    echo "I can not automatically find the name of your architecture."
-+	    printf "%s"\
-+		"Give me a name, please [win32 for Win95, Win98 or WinNT]: "
-+	    read ARCH
-+	fi
-+    fi;;
-+    yes) ARCH=$arch
-+esac
-+
-+# executable extension
-+
-+case $ARCH in
-+    win32) 
-+      EXE=".exe"
-+      DLLEXT=".dll";;
-+    *) EXE=""
-+       DLLEXT=".so"
-+esac
-+
-+# Is the source tree checked out from a recognised
-+# version control system ?
-+if test -e .svn/entries ; then 
-+    checkedout=svn
-+elif [ -d '{arch}' ]; then
-+    checkedout=gnuarch
-+elif [ -z "${GIT_DIR}" ] && [ -d .git ] || [ -d "${GIT_DIR}" ]; then
-+    checkedout=git
-+else
-+    checkedout=0
-+fi
-+
-+# make command
-+
-+MAKE=`which make`
-+if [ "$MAKE" != "" ]; then
-+  MAKEVERSION=`$MAKE -v | head -1 | cut -d" " -f3`
-+  MAKEVERSIONMAJOR=`echo $MAKEVERSION | cut -d. -f1`
-+  MAKEVERSIONMINOR=`echo $MAKEVERSION | cut -d. -f2`
-+  if [ "$MAKEVERSIONMAJOR" -eq 3 -a "$MAKEVERSIONMINOR" -ge 81 ]; then
-+      echo "You have GNU Make $MAKEVERSION. Good!"
-+  else
-+      OK="no"
-+      if [ -x ./make ]; then
-+	  MAKEVERSION=`./make -v | head -1`
-+	  if [ "$MAKEVERSION" = "GNU Make 3.81" ]; then OK="yes"; fi
-+      fi
-+      if [ $OK = "no" ]; then
-+	  echo "GNU Make >= 3.81 is needed."
-+	  echo "Make 3.81 can be downloaded from ftp://ftp.gnu.org/gnu/make/make-3.81.tar.gz"
-+	  echo "then locally installed on a Unix-style system by issuing:"
-+	  echo "  tar xzvf make-3.81.tar.gz"
-+	  echo "  cd make-3.81"
-+          echo "  ./configure"
-+          echo "  make"
-+          echo "  mv make .."
-+	  echo "  cd .."
-+	  echo "Restart then the configure script and later use ./make instead of make."
-+	  exit 1
-+      else
-+	  echo "You have locally installed GNU Make 3.81. Good!"
-+      fi
-+  fi
-+else
-+  echo "Cannot find GNU Make >= 3.81."
-+fi
-+
-+# Browser command
-+
-+if [ "$browser_spec" = "no" ]; then
-+    case $ARCH in
-+        win32) BROWSER='C:\PROGRA~1\INTERN~1\IEXPLORE %s' ;;
-+        *) BROWSER='firefox -remote "OpenURL(%s,new-tab)" || firefox %s &' ;;
-+    esac
-+fi
-+
-+if [ "$wwwcoq_spec" = "no" ]; then
-+    WWWCOQ="http://coq.inria.fr/"
-+fi
-+
-+#########################################
-+# Objective Caml programs
-+
-+case $camldir_spec in
-+    no) CAMLC=`which $bytecamlc`
-+	case "$CAMLC" in
-+	    "") echo "$bytecamlc is not present in your path!"
-+		echo "Give me manually the path to the $bytecamlc executable [/usr/local/bin by default]: "
-+		read CAMLC
-+		
-+		case "$CAMLC" in
-+		    "") CAMLC=/usr/local/bin/$bytecamlc;;
-+		    */ocamlc|*/ocamlc.opt) true;;
-+		    */) CAMLC="${CAMLC}"$bytecamlc;;
-+		    *) CAMLC="${CAMLC}"/$bytecamlc;;
-+		esac
-+	esac
-+	CAMLBIN=`dirname "$CAMLC"`;;
-+    yes) CAMLC=$camldir/$bytecamlc
-+        
-+         CAMLBIN=`dirname "$CAMLC"`
-+	 bytecamlc="$CAMLC"
-+	 nativecamlc=$CAMLBIN/$nativecamlc
-+	 ocamlexec=$CAMLBIN/ocaml
-+	 ocamldepexec=$CAMLBIN/ocamldep
-+	 ocamldocexec=$CAMLBIN/ocamldoc
-+	 ocamllexexec=$CAMLBIN/ocamllex
-+	 ocamlyaccexec=$CAMLBIN/ocamlyacc
-+	 ocamlmktopexec=$CAMLBIN/ocamlmktop
-+	 ocamlmklibexec=$CAMLBIN/ocamlmklib
-+	 camlp4oexec=$CAMLBIN/camlp4o
-+esac
-+
-+if test ! -f "$CAMLC" ; then
-+    echo "I can not find the executable '$CAMLC'. Have you installed it?"
-+    echo "Configuration script failed!"
-+    exit 1
-+fi
-+
-+# Under Windows, OCaml only understands Windows filenames (C:\...)
-+case $ARCH in
-+    win32) CAMLBIN=`cygpath -m ${CAMLBIN}`;;
-+esac
-+
-+CAMLVERSION=`"$bytecamlc" -version`
-+
-+case $CAMLVERSION in
-+    1.*|2.*|3.00|3.01|3.02|3.03|3.03alpha|3.04|3.05beta|3.05|3.06|3.07*|3.08*|3.09*)
-+	echo "Your version of Objective-Caml is $CAMLVERSION."
-+	if [ "$force_caml_version" = "yes" ]; then
-+	    echo "*Warning* You are compiling Coq with an outdated version of Objective-Caml."
-+	else
-+	    echo "          You need Objective-Caml 3.10.2 or later."
-+	    echo "          Configuration script failed!"
-+	    exit 1
-+	fi;;
-+    ?*)
-+	CAMLP4COMPAT="-loc loc" 
-+	echo "You have Objective-Caml $CAMLVERSION. Good!";;
-+    *)
-+	echo "I found the Objective-Caml compiler but cannot find its version number!"
-+	echo "Is it installed properly?"
-+	echo "Configuration script failed!"
-+	exit 1;;
-+esac
-+
-+CAMLTAG=OCAML`echo $CAMLVERSION | sed -e "s/\([1-9]\)\.\([0-9]*\).*/\1\2/g"`
-+
-+# For coqmktop & bytecode compiler
-+
-+case $ARCH in
-+    win32) # Awfull trick to get around a ^M problem at the end of CAMLLIB
-+      CAMLLIB=`"$CAMLC" -where | sed -e 's/^\(.*\)$/\1/'` ;;
-+    *)
-+      CAMLLIB=`"$CAMLC" -where`
-+esac
-+
-+if [ "$coq_debug_flag" = "-g" ]; then
-+    case $CAMLTAG in
-+        OCAML31*)
-+            # Compilation debug flag
-+            coq_debug_flag_opt="-g"
-+            ;;
-+    esac
-+fi
-+
-+# Native dynlink
-+if [ "$natdynlink" = "yes" -a -f `"$CAMLC" -where`/dynlink.cmxa ]; then
-+    HASNATDYNLINK=true
-+else
-+    HASNATDYNLINK=false
-+fi
-+
-+case $HASNATDYNLINK,`uname -s`,`uname -r`,$CAMLVERSION in
-+    true,Darwin,9.*,3.11.*)  # ocaml 3.11.0 dynlink on MacOS 10.5 is buggy
-+        NATDYNLINKFLAG=os5fixme;;
-+    #Possibly a problem on 10.6.0/10.6.1/10.6.2
-+    #May just be a 32 vs 64 problem for all 10.6.*
-+    true,Darwin,10.0.*,3.11.*) # Possibly a problem on 10.6.0
-+        NATDYNLINKFLAG=os5fixme;;
-+    true,Darwin,10.1.*,3.11.*) # Possibly a problem on 10.6.1
-+        NATDYNLINKFLAG=os5fixme;;
-+    true,Darwin,10.2.*,3.11.*) # Possibly a problem on 10.6.2
-+        NATDYNLINKFLAG=os5fixme;;
-+    true,Darwin,10.*,3.11.*)
-+        if [ `getconf LONG_BIT` = "32" ]; then
-+	    # Still a problem for x86_32
-+            NATDYNLINKFLAG=os5fixme
-+        else
-+	    # Not a problem for x86_64
-+            NATDYNLINKFLAG=$HASNATDYNLINK
-+        fi;;
-+    *)
-+        NATDYNLINKFLAG=$HASNATDYNLINK;;
-+esac
-+
-+# Camlp4 / Camlp5 configuration
-+
-+if [ "$camlp5dir" != "" ]; then
-+    CAMLP4=camlp5
-+    CAMLP4LIB=$camlp5dir
-+    if [ ! -f $camlp5dir/camlp5.cma ]; then
-+	echo "Cannot find camlp5 libraries in $camlp5dir (camlp5.cma not found)."
-+	echo "Configuration script failed!"
-+	exit 1
-+    fi
-+    camlp4oexec=`echo $camlp4oexec | sed -e 's/4/5/'`
-+else
-+    case $CAMLTAG in
-+        OCAML31*)
-+            if [ -x "${CAMLLIB}/camlp5" ]; then
-+                CAMLP4LIB=+camlp5
-+            elif [ -x "${CAMLLIB}/site-lib/camlp5" ]; then
-+                CAMLP4LIB=+site-lib/camlp5
-+            else
-+	        echo "Objective Caml $CAMLVERSION found but no Camlp5 installed."
-+	        echo "Configuration script failed!"
-+	        exit 1
-+            fi
-+            CAMLP4=camlp5
-+            camlp4oexec=`echo $camlp4oexec | sed -e 's/4/5/'`
-+            ;;
-+        *)
-+            CAMLP4=camlp4
-+            CAMLP4LIB=+camlp4
-+            ;;
-+    esac
-+fi
-+
-+if [ "$CAMLP4" = "camlp5" ] && `$camlp4oexec -v 2>&1 | grep -q 5.00`; then
-+    echo "Camlp5 version 5.00 not supported: versions 4.0x or >= 5.01 are OK"
-+    echo "(depending also on your ocaml version)."
-+    echo "Configuration script failed!"
-+    exit 1
-+fi
-+
-+
-+case $CAMLP4LIB in
-+    +*) FULLCAMLP4LIB=$CAMLLIB/`echo $CAMLP4LIB | cut -b 2-`;;
-+    *)  FULLCAMLP4LIB=$CAMLP4LIB;;
-+esac
-+
-+# Assume that camlp(4|5) binaries are at the same place as ocaml ones
-+# (this should become configurable some day) 
-+CAMLP4BIN=${CAMLBIN}
-+
-+# do we have a native compiler: test of ocamlopt and its version
-+
-+if [ "$best_compiler" = "opt" ] ; then
-+  if test -e "$nativecamlc" || test -e "`which $nativecamlc`"; then
-+      CAMLOPTVERSION=`"$nativecamlc" -v | sed -n -e 's|.*version* *\(.*\)$|\1|p' `
-+      if [ "`uname -s`" = "Darwin" -a "$ARCH" = "i386" ]; then
-+	  case $CAMLOPTVERSION in
-+	      3.09.3|3.1?*) ;;
-+	      *) echo "Native compilation on MacOS X Pentium requires Objective-Caml >= 3.09.3,"
-+		 best_compiler=byte
-+		 echo "only the bytecode version of Coq will be available."
-+	  esac
-+      elif [ ! -f $FULLCAMLP4LIB/gramlib.cmxa ]; then
-+	  best_compiler=byte
-+	  echo "Cannot find native-code $CAMLP4,"
-+	  echo "only the bytecode version of Coq will be available."
-+      else
-+        if [ "$CAMLOPTVERSION" != "$CAMLVERSION" ] ; then
-+	  echo "Native and bytecode compilers do not have the same version!"
-+        fi
-+        echo "You have native-code compilation. Good!"
-+      fi
-+  else
-+      best_compiler=byte
-+      echo "You have only bytecode compilation."
-+  fi
-+fi
-+
-+# OS dependent libraries
-+
-+case $ARCH in
-+  sun4*) OS=`uname -r`
-+	case $OS in
-+	   5*) OS="Sun Solaris $OS"
-+	       OSDEPLIBS="-cclib -lunix -cclib -lnsl -cclib -lsocket";;
-+	   *) OS="Sun OS $OS"
-+	      OSDEPLIBS="-cclib -lunix"
-+        esac;;
-+  alpha) OSDEPLIBS="-cclib -lunix";;
-+  win32) OS="Win32" 
-+	 OSDEPLIBS="-cclib -lunix"
-+	 cflags="-mno-cygwin $cflags";;
-+  *) OSDEPLIBS="-cclib -lunix"
-+esac
-+
-+# lablgtk2 and CoqIDE
-+
-+# -byte-only should imply -coqide byte, unless the user decides otherwise
-+
-+if [ "$best_compiler" = "byte" -a "$coqide_spec" = "no" ]; then 
-+    coqide_spec=yes
-+    COQIDE=byte
-+fi
-+
-+# Which coqide is asked ? which one is possible ?
-+
-+if [ "$coqide_spec" = "yes" -a "$COQIDE" = "no" ]; then 
-+    echo "CoqIde disabled as requested."
-+else
-+    case $lablgtkdir_spec in
-+	no) 
-+	    if [ -f "${CAMLLIB}/lablgtk2/glib.mli" ]; then
-+		lablgtkdir=${CAMLLIB}/lablgtk2
-+	    elif [ -f "${CAMLLIB}/site-lib/lablgtk2/glib.mli" ]; then
-+		lablgtkdir=${CAMLLIB}/site-lib/lablgtk2
-+	    fi;;
-+	yes)
-+	    if [ ! -f "$lablgtkdir/glib.mli" ]; then
-+		echo "Incorrect LablGtk2 library (glib.mli not found)."
-+		echo "Configuration script failed!"
-+		exit 1
-+	    fi;;
-+    esac
-+    if [ "$lablgtkdir" = "" ]; then
-+	echo "LablGtk2 not found: CoqIde will not be available."
-+	COQIDE=no
-+    elif [ -z "`grep -w convert_with_fallback "$lablgtkdir/glib.mli"`" ]; then
-+	echo "LablGtk2 found but too old: CoqIde will not be available."
-+	COQIDE=no;
-+    elif [ "$coqide_spec" = "yes" -a "$COQIDE" = "byte" ]; then 
-+	echo "LablGtk2 found, bytecode CoqIde will be used as requested."
-+	COQIDE=byte
-+    elif [ ! -f "${CAMLLIB}/threads/threads.cmxa" ]; then 
-+	echo "LablGtk2 found, no native threads: bytecode CoqIde will be available."
-+	COQIDE=byte
-+    else 
-+	echo "LablGtk2 found, native threads: native CoqIde will be available."
-+	COQIDE=opt
-+    fi
-+fi
-+
-+case $COQIDE in
-+    byte|opt)
-+        case $lablgtkdir_spec in
-+            no)  LABLGTKLIB=+lablgtk2                   # Pour le message
-+                 LABLGTKINCLUDES="-I $LABLGTKLIB";;     # Pour le makefile
-+            yes) LABLGTKLIB="$lablgtkdir"               # Pour le message
-+                 LABLGTKINCLUDES="-I \"$LABLGTKLIB\"";; # Pour le makefile
-+        esac;;
-+    no) LABLGTKINCLUDES="";;
-+esac
-+
-+# strip command
-+
-+case $ARCH in
-+    win32)
-+	# true -> strip : it exists under cygwin !
-+	STRIPCOMMAND="strip";; 
-+    *)
-+    if [ "$coq_profile_flag" = "-p" ] || [ "$coq_debug_flag" = "-g" ] ||
-+       [ "`uname -s`" = "Darwin" -a "$HASNATDYNLINK" = "true" ]
-+    then
-+	STRIPCOMMAND="true"
-+    else
-+	STRIPCOMMAND="strip"
-+    fi
-+esac
-+
-+# mktexlsr
-+#MKTEXLSR=`which mktexlsr`
-+#case $MKTEXLSR in
-+#    "") MKTEXLSR=true;;
-+#esac
-+
-+# "
-+### Test if documentation can be compiled (latex, hevea)
-+
-+if test "$with_doc" = "all" 
-+then
-+    for cmd in "latex" "hevea" ; do
-+	if test ! -x "`which $cmd`"
-+	then 
-+	    echo "$cmd was not found; documentation will not be available"
-+	    with_doc=no
-+	    break
-+	fi
-+    done
-+fi
-+
-+###########################################
-+# bindir, libdir, mandir, docdir, etc.
-+
-+case $src_spec in
-+  no) COQTOP=${COQSRC}
-+esac
-+
-+# OCaml only understand Windows filenames (C:\...)
-+case $ARCH in
-+    win32) COQTOP=`cygpath -m ${COQTOP}`
-+esac
-+
-+case $ARCH in
-+  win32)
-+	 bindir_def='C:\coq\bin'
-+	 libdir_def='C:\coq\lib'
-+	 mandir_def='C:\coq\man'
-+	 docdir_def='C:\coq\doc'
-+	 emacslib_def='C:\coq\emacs'
-+         coqdocdir_def='C:\coq\latex';;
-+  *)
-+	 bindir_def=/usr/local/bin
-+	 libdir_def=/usr/local/lib/coq
-+	 mandir_def=/usr/local/man
-+	 docdir_def=/usr/local/share/doc/coq
-+	 emacslib_def=/usr/local/share/emacs/site-lisp
-+         coqdocdir_def=/usr/local/share/texmf/tex/latex/misc;;
-+esac
-+
-+emacs_def=emacs
-+
-+case $bindir_spec/$prefix_spec/$local in
-+    yes/*/*) BINDIR=$bindir ;;
-+    */yes/*) BINDIR=$prefix/bin ;;
-+    */*/true) BINDIR=$COQTOP/bin ;;
-+    *) printf "Where should I install the Coq binaries [$bindir_def]? "
-+        read BINDIR
-+	case $BINDIR in
-+	    "") BINDIR=$bindir_def;;
-+	    *) true;;
-+	esac;;
-+esac
-+
-+case $libdir_spec/$prefix_spec/$local in
-+    yes/*/*) LIBDIR=$libdir;;
-+    */yes/*)
-+        case $ARCH in
-+          win32) LIBDIR=$prefix ;;
-+          *)  LIBDIR=$prefix/lib/coq ;;
-+        esac ;;
-+    */*/true) LIBDIR=$COQTOP ;;
-+    *)  printf "Where should I install the Coq library [$libdir_def]? "
-+        read LIBDIR
-+	case $LIBDIR in
-+	    "") LIBDIR=$libdir_def;;
-+	    *) true;;
-+	esac;;
-+esac
-+
-+case $mandir_spec/$prefix_spec/$local in
-+    yes/*/*) MANDIR=$mandir;;
-+    */yes/*) MANDIR=$prefix/man ;;
-+    */*/true) MANDIR=$COQTOP/man ;;
-+    *)  printf "Where should I install the Coq man pages [$mandir_def]? "
-+        read MANDIR
-+	case $MANDIR in
-+	    "") MANDIR=$mandir_def;;
-+	    *) true;;
-+	esac;;
-+esac
-+
-+case $docdir_spec/$prefix_spec/$local in
-+    yes/*/*) DOCDIR=$docdir; HTMLREFMANDIR=$DOCDIR/html/refman;;
-+    */yes/*) DOCDIR=$prefix/share/doc/coq; HTMLREFMANDIR=$DOCDIR/html/refman;;
-+    */*/true) DOCDIR=$COQTOP/doc; HTMLREFMANDIR=$DOCDIR/refman/html;;
-+    *)  printf "Where should I install the Coq documentation [$docdir_def]? "
-+        read DOCDIR
-+	case $DOCDIR in
-+	    "") DOCDIR=$docdir_def; HTMLREFMANDIR=$DOCDIR/html/refman;;
-+	    *) true;;
-+	esac;;
-+esac
-+
-+case $emacslib_spec/$prefix_spec/$local in
-+    yes/*/*) EMACSLIB=$emacslib;;
-+    */yes/*)
-+        case $ARCH in
-+          win32) EMACSLIB=$prefix/emacs ;;
-+          *)  EMACSLIB=$prefix/share/emacs/site-lisp ;;
-+        esac ;;
-+    */*/true) EMACSLIB=$COQTOP/tools/emacs ;;
-+    *) printf "Where should I install the Coq Emacs mode [$emacslib_def]? "
-+        read EMACSLIB
-+	case $EMACSLIB in
-+	    "") EMACSLIB=$emacslib_def;;
-+	    *) true;;
-+	esac;;
-+esac
-+
-+case $coqdocdir_spec/$prefix_spec/$local in
-+    yes/*/*) COQDOCDIR=$coqdocdir;;
-+    */yes/*)
-+        case $ARCH in
-+          win32) COQDOCDIR=$prefix/latex ;;
-+          *)  COQDOCDIR=$prefix/share/emacs/site-lisp ;;
-+        esac ;;
-+    */*/true) COQDOCDIR=$COQTOP/tools/coqdoc ;;
-+    *) printf "Where should I install Coqdoc TeX/LaTeX files [$coqdocdir_def]? "
-+        read COQDOCDIR
-+	case $COQDOCDIR in
-+	    "") COQDOCDIR=$coqdocdir_def;;
-+	    *) true;;
-+	esac;;
-+esac
-+
-+# Determine if we enable -custom by default (Windows and MacOS)
-+CUSTOM_OS=no
-+if [ "$ARCH" = "win32" ] || [ "`uname -s`" = "Darwin" ]; then
-+    CUSTOM_OS=yes
-+fi
-+
-+BUILDLDPATH="# you might want to set CAML_LD_LIBRARY_PATH by hand!"
-+case $coqrunbyteflags_spec/$local/$custom_spec/$CUSTOM_OS in
-+    yes/*/*/*) COQRUNBYTEFLAGS="$coqrunbyteflags";;
-+    */*/yes/*|*/*/*/yes) COQRUNBYTEFLAGS="-custom";;
-+    */true/*/*) COQRUNBYTEFLAGS="-dllib -lcoqrun -dllpath '$COQTOP'/kernel/byterun";;
-+    *)
-+        COQRUNBYTEFLAGS="-dllib -lcoqrun -dllpath '$LIBDIR'"
-+        BUILDLDPATH="export CAML_LD_LIBRARY_PATH='$COQTOP'/kernel/byterun";;
-+esac
-+case $coqtoolsbyteflags_spec/$custom_spec/$CUSTOM_OS in
-+    yes/*/*) COQTOOLSBYTEFLAGS="$coqtoolsbyteflags";;
-+    */yes/*|*/*/yes) COQTOOLSBYTEFLAGS="-custom";;
-+    *) COQTOOLSBYTEFLAGS="";;
-+esac
-+
-+# case $emacs_spec in
-+#     no) printf "Which Emacs command should I use to compile coq.el [$emacs_def]? "
-+#         read EMACS
-+	
-+# 	case $EMACS in
-+# 	    "") EMACS=$emacs_def;;
-+# 	    *) true;;
-+# 	esac;;
-+#     yes) EMACS=$emacs;;
-+# esac
-+
-+
-+
-+###########################################
-+# Summary of the configuration
-+
-+echo ""
-+echo "  Coq top directory                 : $COQTOP"
-+echo "  Architecture                      : $ARCH"
-+if test ! -z "$OS" ; then
-+  echo "  Operating system                  : $OS"
-+fi
-+echo "  Coq VM bytecode link flags        : $COQRUNBYTEFLAGS"
-+echo "  Coq tools bytecode link flags     : $COQTOOLSBYTEFLAGS"
-+echo "  OS dependent libraries            : $OSDEPLIBS"
-+echo "  Objective-Caml/Camlp4 version     : $CAMLVERSION"
-+echo "  Objective-Caml/Camlp4 binaries in : $CAMLBIN"
-+echo "  Objective-Caml library in         : $CAMLLIB"
-+echo "  Camlp4 library in                 : $CAMLP4LIB"
-+if test "$best_compiler" = opt ; then
-+echo "  Native dynamic link support       : $HASNATDYNLINK"
-+fi
-+if test "$COQIDE" != "no"; then
-+echo "  Lablgtk2 library in               : $LABLGTKLIB"
-+fi
-+if test "$with_doc" = "all"; then
-+echo "  Documentation                     : All"
-+else
-+echo "  Documentation                     : None"
-+fi
-+echo "  CoqIde                            : $COQIDE"
-+echo "  Web browser                       : $BROWSER"
-+echo "  Coq web site                      : $WWWCOQ"
-+echo ""
-+
-+echo "  Paths for true installation:"
-+echo "    binaries      will be copied in $BINDIR"
-+echo "    library       will be copied in $LIBDIR"
-+echo "    man pages     will be copied in $MANDIR"
-+echo "    documentation will be copied in $DOCDIR"
-+echo "    emacs mode    will be copied in $EMACSLIB"
-+echo ""
-+
-+##################################################
-+# Building the $COQTOP/dev/ocamldebug-coq file
-+##################################################
-+
-+OCAMLDEBUGCOQ=$COQSRC/dev/ocamldebug-coq
-+
-+if test "$coq_debug_flag" = "-g" ; then
-+  rm -f $OCAMLDEBUGCOQ
-+  sed -e "s|COQTOPDIRECTORY|$COQTOP|" \
-+      -e "s|COQLIBDIRECTORY|$LIBDIR|" \
-+      -e "s|CAMLBINDIRECTORY|$CAMLBIN|" \
-+      -e "s|CAMLP4LIBDIRECTORY|$FULLCAMLP4LIB|"\
-+      $OCAMLDEBUGCOQ.template > $OCAMLDEBUGCOQ
-+  chmod a-w,a+x $OCAMLDEBUGCOQ
-+fi
-+
-+####################################################
-+# Fixing lablgtk types (before/after 2.6.0) 
-+####################################################
-+
-+if [ ! "$COQIDE" = "no" ]; then 
-+    if grep "class view " "$lablgtkdir/gText.mli" | grep -q "\[>" ; then
-+       if grep -q "?accepts_tab:bool" "$lablgtkdir/gText.mli" ; then
-+        cp -f ide/undo_lablgtk_ge212.mli ide/undo.mli
-+       else
-+	cp -f ide/undo_lablgtk_ge26.mli ide/undo.mli
-+       fi
-+    else
-+	cp -f ide/undo_lablgtk_lt26.mli ide/undo.mli
-+    fi
-+fi  
-+
-+##############################################
-+# Creation of configuration files
-+##############################################
-+
-+mlconfig_file="$COQSRC/config/coq_config.ml"
-+config_file="$COQSRC/config/Makefile"
-+config_template="$COQSRC/config/Makefile.template"
-+
-+
-+### Warning !!
-+### After this line, be careful when using variables,
-+### since some of them (e.g. $COQSRC) will be escaped
-+
-+
-+# An escaped version of a variable
-+escape_var () {
-+"$ocamlexec" 2>&1 1>/dev/null <<EOF
-+  prerr_endline(String.escaped(Sys.getenv"$VAR"));;
-+EOF
-+}
-+
-+# Escaped version of browser command
-+export BROWSER
-+BROWSER=`VAR=BROWSER escape_var`
-+
-+# damned backslashes under M$Windows
-+case $ARCH in
-+    win32)
-+	COQTOP=`echo $COQTOP |sed -e 's|\\\|\\\\\\\|g'`
-+	BINDIR=`echo $BINDIR |sed -e 's|\\\|\\\\\\\|g'`
-+	COQSRC=`cygpath -m $COQSRC |sed -e 's|\\\|\\\\\\\|g'`
-+	LIBDIR=`echo $LIBDIR |sed -e 's|\\\|\\\\\\\|g'`
-+	CAMLBIN=`echo $CAMLBIN |sed -e 's|\\\|\\\\\\\|g'`
-+	CAMLLIB=`echo $CAMLLIB |sed -e 's|\\\|\\\\\\\|g'`
-+	MANDIR=`echo $MANDIR |sed -e 's|\\\|\\\\\\\|g'`
-+	DOCDIR=`echo $DOCDIR |sed -e 's|\\\|\\\\\\\|g'`
-+	EMACSLIB=`echo $EMACSLIB |sed -e 's|\\\|\\\\\\\|g'`
-+	COQDOCDIR=`echo $COQDOCDIR |sed -e 's|\\\|\\\\\\\|g'`
-+	CAMLP4BIN=`echo $CAMLP4BIN |sed -e 's|\\\|\\\\\\\|g'`
-+	CAMLP4LIB=`echo $CAMLP4LIB |sed -e 's|\\\|\\\\\\\|g'`
-+	LABLGTKINCLUDES=`echo $LABLGTKINCLUDES |sed -e 's|\\\|\\\\\\\|g'`
-+	COQRUNBYTEFLAGS=`echo $COQRUNBYTEFLAGS |sed -e 's|\\\|\\\\\\\|g'`
-+	COQTOOLSBYTEFLAGS=`echo $COQTOOLSBYTEFLAGS |sed -e 's|\\\|\\\\\\\|g'`
-+	BUILDLDPATH=`echo $BUILDLDPATH |sed -e 's|\\\|\\\\\\\|g'`
-+	ocamlexec=`echo $ocamlexec |sed -e 's|\\\|\\\\\\\|g'`
-+	bytecamlc=`echo $bytecamlc |sed -e 's|\\\|\\\\\\\|g'`
-+	nativecamlc=`echo $nativecamlc |sed -e 's|\\\|\\\\\\\|g'`
-+	ocamlmklibexec=`echo $ocamlmklibexec |sed -e 's|\\\|\\\\\\\|g'`
-+	ocamldepexec=`echo $ocamldepexec |sed -e 's|\\\|\\\\\\\|g'`
-+	ocamldocexec=`echo $ocamldocexec |sed -e 's|\\\|\\\\\\\|g'`
-+	ocamllexexec=`echo $ocamllexexec |sed -e 's|\\\|\\\\\\\|g'`
-+	ocamlyaccexec=`echo $ocamlyaccexec |sed -e 's|\\\|\\\\\\\|g'`
-+	camlp4oexec=`echo $camlp4oexec |sed -e 's|\\\|\\\\\\\|g'`
-+    ;;
-+esac
-+
-+#####################################################
-+# Building the $COQTOP/config/coq_config.ml file
-+#####################################################
-+
-+rm -f "$mlconfig_file"
-+cat << END_OF_COQ_CONFIG > $mlconfig_file
-+(* DO NOT EDIT THIS FILE: automatically generated by ../configure *)
-+
-+let local = $local
-+let coqrunbyteflags = "$COQRUNBYTEFLAGS"
-+let coqlib = "$LIBDIR"
-+let coqsrc = "$COQSRC"
-+let ocaml = "$ocamlexec"
-+let ocamlc = "$bytecamlc"
-+let ocamlopt = "$nativecamlc"
-+let ocamlmklib = "$ocamlmklibexec"
-+let ocamldep = "$ocamldepexec"
-+let ocamldoc = "$ocamldocexec"
-+let ocamlyacc = "$ocamlyaccexec"
-+let ocamllex = "$ocamllexexec"
-+let camlbin = "$CAMLBIN"
-+let camllib = "$CAMLLIB"
-+let camlp4 = "$CAMLP4"
-+let camlp4o = "$camlp4oexec"
-+let camlp4bin = "$CAMLP4BIN"
-+let camlp4lib = "$CAMLP4LIB"
-+let camlp4compat = "$CAMLP4COMPAT"
-+let coqideincl = "$LABLGTKINCLUDES"
-+let cflags = "$cflags"
-+let best = "$best_compiler"
-+let arch = "$ARCH"
-+let has_coqide = "$COQIDE"
-+let has_natdynlink = $HASNATDYNLINK
-+let natdynlinkflag = "$NATDYNLINKFLAG"
-+let osdeplibs = "$OSDEPLIBS"
-+let version = "$VERSION"
-+let caml_version = "$CAMLVERSION"
-+let date = "$DATE"
-+let compile_date = "$COMPILEDATE"
-+let vo_magic_number = $VOMAGIC
-+let state_magic_number = $STATEMAGIC
-+let exec_extension = "$EXE"
-+let with_geoproof = ref $with_geoproof
-+let browser = "$BROWSER"
-+let wwwcoq = "$WWWCOQ"
-+let wwwrefman = wwwcoq ^ "distrib/" ^ version ^ "/refman/"
-+let wwwstdlib = wwwcoq ^ "distrib/" ^ version ^ "/stdlib/"
-+let localwwwrefman = "file://$HTMLREFMANDIR/"
-+
-+END_OF_COQ_CONFIG
-+
-+# to be sure printf is found on windows when spaces occur in PATH variable
-+PRINTF=`which printf`
-+
-+# Subdirectories of theories/ added in coq_config.ml
-+subdirs () {
-+    (cd $1; find * \( -name .svn -prune \) -o \( -type d -exec $PRINTF "\"%s\";\n" {} \; \) >> "$mlconfig_file")
-+}
-+
-+echo "let theories_dirs = [" >> "$mlconfig_file"
-+subdirs theories
-+echo "]" >> "$mlconfig_file"
-+
-+echo "let plugins_dirs = [" >> "$mlconfig_file"
-+subdirs plugins
-+echo "]" >> "$mlconfig_file"
-+
-+chmod a-w "$mlconfig_file"
-+
-+
-+###############################################
-+# Building the $COQTOP/config/Makefile file
-+###############################################
-+
-+rm -f "$config_file"
-+
-+sed -e "s|LOCALINSTALLATION|$local|" \
-+    -e "s|XCOQRUNBYTEFLAGS|$COQRUNBYTEFLAGS|" \
-+    -e "s|XCOQTOOLSBYTEFLAGS|$COQTOOLSBYTEFLAGS|" \
-+    -e "s|COQSRCDIRECTORY|$COQSRC|" \
-+    -e "s|COQVERSION|$VERSION|" \
-+    -e "s|BINDIRDIRECTORY|$BINDIR|" \
-+    -e "s|COQLIBDIRECTORY|$LIBDIR|" \
-+    -e "s|BUILDLDPATH=|$BUILDLDPATH|" \
-+    -e "s|MANDIRDIRECTORY|$MANDIR|" \
-+    -e "s|DOCDIRDIRECTORY|$DOCDIR|" \
-+    -e "s|EMACSLIBDIRECTORY|$EMACSLIB|" \
-+    -e "s|EMACSCOMMAND|$EMACS|" \
-+    -e "s|COQDOCDIRECTORY|$COQDOCDIR|" \
-+    -e "s|MKTEXLSRCOMMAND|$MKTEXLSR|" \
-+    -e "s|ARCHITECTURE|$ARCH|" \
-+    -e "s|OSDEPENDENTLIBS|$OSDEPLIBS|" \
-+    -e "s|OSDEPENDENTP4OPTFLAGS|$OSDEPP4OPTFLAGS|" \
-+    -e "s|CAMLLIBDIRECTORY|$CAMLLIB|" \
-+    -e "s|CAMLTAG|$CAMLTAG|" \
-+    -e "s|CAMLP4BINDIRECTORY|$CAMLP4BIN|" \
-+    -e "s|CAMLP4LIBDIRECTORY|$CAMLP4LIB|" \
-+    -e "s|CAMLP4TOOL|$camlp4oexec|" \
-+    -e "s|CAMLP4COMPATFLAGS|$CAMLP4COMPAT|" \
-+    -e "s|LABLGTKINCLUDES|$LABLGTKINCLUDES|" \
-+    -e "s|COQDEBUGFLAGOPT|$coq_debug_flag_opt|" \
-+    -e "s|COQDEBUGFLAG|$coq_debug_flag|" \
-+    -e "s|COQPROFILEFLAG|$coq_profile_flag|" \
-+    -e "s|CAMLANNOTATEFLAG|$coq_annotate_flag|" \
-+    -e "s|CCOMPILEFLAGS|$cflags|" \
-+    -e "s|BESTCOMPILER|$best_compiler|" \
-+    -e "s|DLLEXTENSION|$DLLEXT|" \
-+    -e "s|EXECUTEEXTENSION|$EXE|" \
-+    -e "s|BYTECAMLC|$bytecamlc|" \
-+    -e "s|OCAMLMKLIBEXEC|$ocamlmklibexec|" \
-+    -e "s|NATIVECAMLC|$nativecamlc|" \
-+    -e "s|OCAMLEXEC|$ocamlexec|" \
-+    -e "s|OCAMLDEPEXEC|$ocamldepexec|" \
-+    -e "s|OCAMLDOCEXEC|$ocamldocexec|" \
-+    -e "s|OCAMLLEXEXEC|$ocamllexexec|" \
-+    -e "s|OCAMLYACCEXEC|$ocamlyaccexec|" \
-+    -e "s|CAMLMKTOPEXEC|$ocamlmktopexec|" \
-+    -e "s|CCEXEC|$gcc_exec|" \
-+    -e "s|AREXEC|$ar_exec|" \
-+    -e "s|RANLIBEXEC|$ranlib_exec|" \
-+    -e "s|STRIPCOMMAND|$STRIPCOMMAND|" \
-+    -e "s|COQIDEOPT|$COQIDE|" \
-+    -e "s|CHECKEDOUTSOURCETREE|$checkedout|" \
-+    -e "s|WITHDOCOPT|$with_doc|" \
-+    -e "s|HASNATIVEDYNLINK|$NATDYNLINKFLAG|" \
-+      "$config_template" > "$config_file"
-+
-+chmod a-w "$config_file"
-+
-+##################################################
-+# The end
-+####################################################
-+
-+echo "If anything in the above is wrong, please restart './configure'."
-+echo
-+echo "*Warning* To compile the system for a new architecture"
-+echo "          don't forget to do a 'make archclean' before './configure'."
-+
-+# $Id: configure 14833 2011-12-19 21:57:30Z notin $
diff --git a/pkgs/applications/science/logic/coq/default.nix b/pkgs/applications/science/logic/coq/default.nix
index bf759a4a326..9596c30ee6a 100644
--- a/pkgs/applications/science/logic/coq/default.nix
+++ b/pkgs/applications/science/logic/coq/default.nix
@@ -1,15 +1,13 @@
 # - coqide compilation can be disabled by setting lablgtk to null;
 
-{stdenv, fetchurl, ocaml, findlib, camlp5, ncurses, lablgtk ? null}:
+{stdenv, fetchurl, pkgconfig, ocaml, findlib, camlp5, ncurses, lablgtk ? null}:
 
 let 
-  version = "8.3pl4";
+  version = "8.4";
   buildIde = lablgtk != null;
   ideFlags = if buildIde then "-lablgtkdir ${lablgtk}/lib/ocaml/*/site-lib/lablgtk2 -coqide opt" else "";
-  idePatch = if buildIde then ''
-    substituteInPlace scripts/coqmktop.ml --replace \
-    "\"-I\"; \"+lablgtk2\"" \
-    "\"-I\"; \"$(echo "${lablgtk}"/lib/ocaml/*/site-lib/lablgtk2)\"; \"-I\"; \"$(echo "${lablgtk}"/lib/ocaml/*/site-lib/stublibs)\""
+  idePath = if buildIde then ''
+    CAML_LD_LIBRARY_PATH=${lablgtk}/lib/ocaml/3.12.1/site-lib/stublibs
   '' else "";
 in
 
@@ -17,15 +15,23 @@ stdenv.mkDerivation {
   name = "coq-${version}";
 
   src = fetchurl {
-    url = "http://coq.inria.fr/V${version}/files/coq-${version}.tar.gz";
-    sha256 = "17d3lmchmqir1rawnr52g78srg4wkd7clzpzfsivxc4y1zp6rwkr";
+    url = "http://pauillac.inria.fr/~herbelin/coq/distrib/V${version}/files/coq-${version}.tar.gz";
+    sha256 = "0ka2lak9il4hlblk461awf0hbi3mxqhc1wz6kllxradyy2vfaspl";
   };
 
-  buildInputs = [ ocaml findlib camlp5 ncurses lablgtk ];
+  buildInputs = [ pkgconfig ocaml findlib camlp5 ncurses lablgtk ];
 
-  prefixKey = "-prefix ";
+  patches = [ ./configure.patch ];
+
+  postPatch = ''
+    UNAME=$(type -tp uname)
+    RM=$(type -tp rm)
+    substituteInPlace configure --replace "/bin/uname" "$UNAME"
+    substituteInPlace tools/beautify-archive --replace "/bin/rm" "$RM"
+  '';
 
   preConfigure = ''
+    buildFlagsArray=(${idePath})
     configureFlagsArray=(
       -opt
       -camldir ${ocaml}/bin
@@ -34,25 +40,9 @@ stdenv.mkDerivation {
     )
   '';
 
-  buildFlags = "world"; # Debug with "world VERBOSE=1";
-
-  patches = [ ./configure.patch ];
-
-  postPatch = ''
-    UNAME=$(type -tp uname)
-    RM=$(type -tp rm)
-    substituteInPlace configure --replace "/bin/uname" "$UNAME"
-    substituteInPlace tools/beautify-archive --replace "/bin/rm" "$RM"
-    ${idePatch}
-  '';
+  prefixKey = "-prefix ";
 
-  # This post install step is needed to build ssrcoqide from the ssreflect package
-  # It could be made optional, but I see little harm in including it in the default
-  # distribution -- roconnor
-  # This will likely no longer be necessary for coq >= 8.4. -- roconnor
-  postInstall = if buildIde then ''
-   cp ide/*.cmi ide/ide.*a $out/lib/coq/ide/
-  '' else "";
+  buildFlags = "revision coq coqide";
 
   meta = {
     description = "Coq proof assistant";
diff --git a/pkgs/applications/version-management/git-and-tools/default.nix b/pkgs/applications/version-management/git-and-tools/default.nix
index 53e214e8f37..efe4fcb2d7c 100644
--- a/pkgs/applications/version-management/git-and-tools/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/default.nix
@@ -69,22 +69,8 @@ rec {
     inherit stdenv fetchurl unzip;
   };
 
-  tig = stdenv.mkDerivation {
-    name = "tig-0.16";
-    src = fetchurl {
-      url = "http://jonas.nitro.dk/tig/releases/tig-0.16.tar.gz";
-      sha256 = "167kak44n66wqjj6jrv8q4ijjac07cw22rlpqjqz3brlhx4cb3ix";
-    };
-    buildInputs = [ncurses asciidoc xmlto docbook_xsl];
-    installPhase = ''
-      make install
-      make install-doc
-    '';
-    meta = {
-      description = "console git repository browser that additionally can act as a pager for output from various git commands";
-      homepage = http://jonas.nitro.dk/tig/;
-      license = "GPLv2";
-    };
+  tig = import ./tig {
+    inherit stdenv fetchurl ncurses asciidoc xmlto docbook_xsl;
   };
 
   gitFastExport = import ./fast-export {
diff --git a/pkgs/applications/version-management/git-and-tools/tig/default.nix b/pkgs/applications/version-management/git-and-tools/tig/default.nix
new file mode 100644
index 00000000000..d567e20d732
--- /dev/null
+++ b/pkgs/applications/version-management/git-and-tools/tig/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, ncurses, asciidoc, xmlto, docbook_xsl }:
+
+stdenv.mkDerivation {
+  name = "tig-1.0";
+  src = fetchurl {
+    url = "http://jonas.nitro.dk/tig/releases/tig-1.0.tar.gz";
+    md5 = "a2d414d1cebbc9cd4f3d545bc6f225c6";
+  };
+  buildInputs = [ncurses asciidoc xmlto docbook_xsl];
+  installPhase = ''
+    make install
+    make install-doc
+  '';
+  meta = {
+    description = "Tig is a git repository browser that additionally can act as a pager for output from various git commands";
+    homepage = "http://jonas.nitro.dk/tig/";
+    license = "GPLv2";
+  };
+}
diff --git a/pkgs/applications/virtualization/virtualbox/default.nix b/pkgs/applications/virtualization/virtualbox/default.nix
index 2736c603a48..1067300a2ef 100644
--- a/pkgs/applications/virtualization/virtualbox/default.nix
+++ b/pkgs/applications/virtualization/virtualbox/default.nix
@@ -8,21 +8,38 @@
 
 with stdenv.lib;
 
-let version = "4.1.18"; in
+let
 
-stdenv.mkDerivation {
-  name = "virtualbox-${version}-${kernel.version}";
+  version = "4.1.20";
+
+  forEachModule = action: ''
+    for mod in \
+      $sourcedir/out/linux.*/release/bin/src/vboxdrv \
+      $sourcedir/out/linux.*/release/bin/src/vboxpci \
+      $sourcedir/out/linux.*/release/bin/src/vboxnetadp \
+      $sourcedir/out/linux.*/release/bin/src/vboxnetflt
+    do
+      if [ "x$(basename "$mod")" != xvboxdrv -a ! -e "$mod/Module.symvers" ]
+      then
+        cp -v $sourcedir/out/linux.*/release/bin/src/vboxdrv/Module.symvers \
+              "$mod/Module.symvers"
+      fi
+      INSTALL_MOD_PATH="$out" INSTALL_MOD_DIR=misc \
+      make -C "$MODULES_BUILD_DIR" "M=$mod" DEPMOD=/do_not_use_depmod ${action}
+    done
+  '';
 
-  NIX_CFLAGS_COMPILE="-I${kernel}/lib/modules/${kernel.modDirVersion}/build/include/generated";
+in stdenv.mkDerivation {
+  name = "virtualbox-${version}-${kernel.version}";
 
   src = fetchurl {
     url = "http://download.virtualbox.org/virtualbox/${version}/VirtualBox-${version}.tar.bz2";
-    sha256 = "e650e4fdc23581b9edc0e5d5705cc596c76796851ebf65ccda0edb8e413fa3b7";
+    sha256 = "b132dbc5c6e9ed77aba737ec35b488ac152aa362c3ad49d466897bc410324aeb";
   };
 
   buildInputs =
     [ iasl dev86 libxslt libxml2 xproto libX11 libXext libXcursor qt4 libIDL SDL
-      libcap glib kernel python alsaLib curl pam xorriso makeself perl jdk
+      libcap glib kernel python alsaLib curl pam xorriso makeself perl
       pkgconfig which libXmu ]
     ++ optional javaBindings jdk
     ++ optional pythonBindings python;
@@ -34,18 +51,19 @@ stdenv.mkDerivation {
         -e 's@MKISOFS --version@MKISOFS -version@' \
         -e 's@PYTHONDIR=.*@PYTHONDIR=${if pythonBindings then python else ""}@' \
         -i configure
-    ls kBuild/bin/linux.x86/k* tools/linux.x86/bin/* | xargs -n 1 patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux.so.2 
-    ls kBuild/bin/linux.amd64/k* tools/linux.amd64/bin/* | xargs -n 1 patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 
+    ls kBuild/bin/linux.x86/k* tools/linux.x86/bin/* | xargs -n 1 patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux.so.2
+    ls kBuild/bin/linux.amd64/k* tools/linux.amd64/bin/* | xargs -n 1 patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2
     find . -type f | xargs sed 's/depmod -a/true/' -i
     export USER=nix
     set +x
   '';
 
   configurePhase = ''
+    sourcedir="$(pwd)"
     ./configure --with-qt4-dir=${qt4} \
       ${optionalString (!javaBindings) "--disable-java"} \
       ${optionalString (!pythonBindings) "--disable-python"} \
-      --disable-pulse --disable-hardening \
+      --disable-pulse --disable-hardening --disable-kmods \
       --with-mkisofs=${xorriso}/bin/xorrisofs
     sed -e 's@PKG_CONFIG_PATH=.*@PKG_CONFIG_PATH=${libIDL}/lib/pkgconfig:${glib}/lib/pkgconfig ${libIDL}/bin/libIDL-config-2@' \
         -i AutoConfig.kmk
@@ -55,7 +73,9 @@ stdenv.mkDerivation {
     cat >> AutoConfig.kmk << END_PATHS
     VBOX_PATH_APP_PRIVATE := $out
     VBOX_PATH_APP_DOCS := $out/doc
-    VBOX_JAVA_HOME := ${jdk}
+    ${optionalString javaBindings ''
+      VBOX_JAVA_HOME := ${jdk}
+    ''}
     END_PATHS
     echo "VBOX_WITH_DOCS :=" >> LocalConfig.kmk
     echo "VBOX_WITH_WARNINGS_AS_ERRORS :=" >> LocalConfig.kmk
@@ -63,51 +83,35 @@ stdenv.mkDerivation {
 
   enableParallelBuilding = true;
 
-  preBuild = ''
+  buildPhase = ''
     source env.sh
     kmk
-    cd out/linux.*/release/bin/src
-    export KERN_DIR=${kernel}/lib/modules/*/build
+    ${forEachModule "modules"}
   '';
 
-  postBuild = ''
-    cd ../../../../..
-  '';
-    
   installPhase = ''
     libexec=$out/libexec/virtualbox
-  
+
     # Install VirtualBox files
     cd out/linux.*/release/bin
     mkdir -p $libexec
     cp -av * $libexec
-    
-    # Install kernel module
-    cd src
-    kernelVersion=$(cd ${kernel}/lib/modules; ls)
-    export MODULE_DIR=$out/lib/modules/$kernelVersion/misc
-    
-    # Remove root ownership stuff, since this does not work in a chroot environment
-    for i in `find . -name Makefile`; do
-	sed -i -e "s|-o root||g" \
-               -e "s|-g root||g" $i
-    done
-    
+
     # Install kernel modules
-    make install
-    
+    ${forEachModule "modules_install"}
+
     # Create wrapper script
     mkdir -p $out/bin
     for file in VirtualBox VBoxManage VBoxSDL VBoxBalloonCtrl VBoxBFE VBoxHeadless; do
         ln -s "$libexec/$file" $out/bin/$file
     done
-    
+
     # Create and fix desktop item
     mkdir -p $out/share/applications
     sed -i -e "s|Icon=VBox|Icon=$libexec/VBox.png|" $libexec/virtualbox.desktop
     ln -sfv $libexec/virtualbox.desktop $out/share/applications
   '';
-  
+
   meta = {
     description = "PC emulator";
     homepage = http://www.virtualbox.org/;
diff --git a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
index ec77ca91910..5b207e2e799 100644
--- a/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
+++ b/pkgs/applications/virtualization/virtualbox/guest-additions/default.nix
@@ -17,16 +17,16 @@ stdenv.mkDerivation {
     cp -r install/* $out
 
   '';
-  
+
   buildCommand = ''
     ${if stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux" then ''
         isoinfo -J -i $src -x /VBoxLinuxAdditions.run > ./VBoxLinuxAdditions.run
         chmod 755 ./VBoxLinuxAdditions.run
-	./VBoxLinuxAdditions.run --noexec --keep
+        ./VBoxLinuxAdditions.run --noexec --keep
       ''
       else throw ("Architecture: "+stdenv.system+" not supported for VirtualBox guest additions")
     }
-    
+
     # Unpack files
     cd install
     ${if stdenv.system == "i686-linux" then ''
@@ -38,31 +38,31 @@ stdenv.mkDerivation {
       else throw ("Architecture: "+stdenv.system+" not supported for VirtualBox guest additions")
     }
 
-    
-    # Build kernel modules    
-    cd src        
+
+    # Build kernel modules
+    cd src
 
     for i in *
     do
-	cd $i
-	find . -type f | xargs sed 's/depmod -a/true/' -i
-	make
-	cd ..
+        cd $i
+        find . -type f | xargs sed 's/depmod -a/true/' -i
+        make
+        cd ..
     done
 
     cd ..
-    
+
     # Change the interpreter for various binaries
     for i in sbin/VBoxService bin/{VBoxClient,VBoxControl}
     do
         ${if stdenv.system == "i686-linux" then ''
           patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux.so.2 $i
-	''
-	else if stdenv.system == "x86_64-linux" then ''
-	  patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $i
-	''
-	else throw ("Architecture: "+stdenv.system+" not supported for VirtualBox guest additions")
-	}
+        ''
+        else if stdenv.system == "x86_64-linux" then ''
+          patchelf --set-interpreter ${stdenv.glibc}/lib/ld-linux-x86-64.so.2 $i
+        ''
+        else throw ("Architecture: "+stdenv.system+" not supported for VirtualBox guest additions")
+        }
     done
 
     # Change rpath for various binaries and libraries
@@ -72,11 +72,11 @@ stdenv.mkDerivation {
     do
         patchelf --set-rpath $out/lib $i
     done
-    
+
     # Remove references to /usr from various scripts and files
     sed -i -e "s|/usr/bin|$out/bin|" share/VBoxGuestAdditions/vboxclient.desktop
     sed -i -e "s|/usr/bin|$out/bin|" bin/VBoxClient-all
-    
+
     # Install binaries
     mkdir -p $out/sbin
     install -m 755 sbin/VBoxService $out/sbin
@@ -94,7 +94,7 @@ stdenv.mkDerivation {
     cp -v lib/VBoxOGL*.so $out/lib
     mkdir -p $out/lib/dri
     ln -s $out/lib/VBoxOGL.so $out/lib/dri/vboxvideo_dri.so
-    
+
     # Install desktop file
     mkdir -p $out/share/autostart
     cp -v share/VBoxGuestAdditions/vboxclient.desktop $out/share/autostart
@@ -103,23 +103,23 @@ stdenv.mkDerivation {
     mkdir -p $out/lib/xorg/modules/{drivers,input}
     install -m 644 lib/VBoxGuestAdditions/vboxvideo_drv_19.so $out/lib/xorg/modules/drivers/vboxvideo_drv.so
     # There doesn't appear to be a vboxmouse driver for Xorg 1.9. Was there ever?
-#    install -m 644 lib/VBoxGuestAdditions/vboxmouse_drv_19.so $out/lib/xorg/modules/input/vboxmouse_drv.so
+    #install -m 644 lib/VBoxGuestAdditions/vboxmouse_drv_19.so $out/lib/xorg/modules/input/vboxmouse_drv.so
 
     # Install kernel modules
     cd src
-    
+
     for i in *
     do
         cd $i
-	kernelVersion=$(cd ${kernel}/lib/modules; ls)
-	export MODULE_DIR=$out/lib/modules/$kernelVersion/misc
-	find . -type f | xargs sed -i -e "s|-o root||g" \
-	                              -e "s|-g root||g"
-	make install
-	cd ..
-    done    
-  '';
-  
+        kernelVersion=$(cd ${kernel}/lib/modules; ls)
+        export MODULE_DIR=$out/lib/modules/$kernelVersion/misc
+        find . -type f | xargs sed -i -e "s|-o root||g" \
+                                      -e "s|-g root||g"
+        make install
+        cd ..
+    done
+  ''; # */
+
   meta = {
     description = "Guest additions for VirtualBox";
     longDescriptions = ''
@@ -129,5 +129,6 @@ stdenv.mkDerivation {
     '';
     license = "GPL";
     maintainers = [ lib.maintainers.sander ];
+    platforms = lib.platforms.linux;
   };
 }
diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix
index ec3d45e652e..cc59dd7fab1 100644
--- a/pkgs/build-support/fetchurl/default.nix
+++ b/pkgs/build-support/fetchurl/default.nix
@@ -22,6 +22,21 @@ let
     then builtins.attrNames mirrors
     else [] /* backwards compatibility */;
 
+  impureEnvVars = [
+    # We borrow these environment variables from the caller to allow
+    # easy proxy configuration.  This is impure, but a fixed-output
+    # derivation like fetchurl is allowed to do so since its result is
+    # by definition pure.
+    "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
+
+    # This variable allows the user to pass additional options to curl
+    "NIX_CURL_FLAGS"
+
+    # This variable allows the user to override hashedMirrors from the
+    # command-line.
+    "NIX_HASHED_MIRRORS"
+  ] ++ (map (site: "NIX_MIRRORS_${site}") sites);
+
 in
       
 { # URL to fetch.
@@ -83,23 +98,8 @@ stdenv.mkDerivation {
       if sha256 != "" then "sha256" else if sha1 != "" then "sha1" else "md5";
   outputHash = if outputHash != "" then outputHash else
       if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
-  
-  impureEnvVars = [
-    # We borrow these environment variables from the caller to allow
-    # easy proxy configuration.  This is impure, but a fixed-output
-    # derivation like fetchurl is allowed to do so since its result is
-    # by definition pure.
-    "http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
-
-    # This variable allows the user to pass additional options to curl
-    "NIX_CURL_FLAGS"
-
-    # This variable allows the user to override hashedMirrors from the
-    # command-line.
-    "NIX_HASHED_MIRRORS"
-  ] ++ (map (site: "NIX_MIRRORS_${site}") sites);
 
-  inherit showURLs mirrorsFile;
+  inherit showURLs mirrorsFile impureEnvVars;
 
   # Doing the download on a remote machine just duplicates network
   # traffic, so don't do that.
diff --git a/pkgs/build-support/fetchurl/mirrors.nix b/pkgs/build-support/fetchurl/mirrors.nix
index 0491e4994b6..dd81692b5f2 100644
--- a/pkgs/build-support/fetchurl/mirrors.nix
+++ b/pkgs/build-support/fetchurl/mirrors.nix
@@ -24,9 +24,6 @@ rec {
 
   # GNU (http://www.gnu.org/prep/ftp.html).
   gnu = [
-    # This one is the master repository, and thus it's always up-to-date.
-    http://ftp.gnu.org/pub/gnu/
-
     # This one redirects to a (supposedly) nearby and (supposedly) up-to-date
     # mirror.
     http://ftpmirror.gnu.org/
@@ -37,6 +34,9 @@ rec {
     ftp://ftp.cs.tu-berlin.de/pub/gnu/
     ftp://ftp.chg.ru/pub/gnu/
     ftp://ftp.funet.fi/pub/mirrors/ftp.gnu.org/gnu/
+
+    # This one is the master repository, and thus it's always up-to-date.
+    http://ftp.gnu.org/pub/gnu/
   ];
 
   # GCC.
diff --git a/pkgs/build-support/release/ant-build.nix b/pkgs/build-support/release/ant-build.nix
index 696f179a2ed..0cabdf2f7e7 100644
--- a/pkgs/build-support/release/ant-build.nix
+++ b/pkgs/build-support/release/ant-build.nix
@@ -8,8 +8,8 @@
 , antProperties ? []
 , antBuildInputs ? []
 , buildfile ? "build.xml"
-, ant ? pkgs.ant
-, jre ? pkgs.jre
+, ant ? pkgs.apacheAntOpenJDK
+, jre ? pkgs.openjdk
 , hydraAntLogger ? pkgs.hydraAntLogger
 , ... } @ args:
 
diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix
index 6af4a5c0574..777cc72aa0b 100644
--- a/pkgs/build-support/vm/default.nix
+++ b/pkgs/build-support/vm/default.nix
@@ -250,6 +250,7 @@ rec {
         path = $TMPDIR/xchg
         read only = no
         guest ok = yes
+      $EXTRA_SAMBA_CONF
       SMB
 
       rm -f ./samba
diff --git a/pkgs/data/documentation/man-pages/default.nix b/pkgs/data/documentation/man-pages/default.nix
index 0aca88a46c0..f9e4f1b4371 100644
--- a/pkgs/data/documentation/man-pages/default.nix
+++ b/pkgs/data/documentation/man-pages/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "man-pages-3.41";
+  name = "man-pages-3.42";
   
   src = fetchurl {
     url = "mirror://kernel/linux/docs/man-pages/Archive/${name}.tar.xz";
-    sha256 = "1fldlsw51al9cvmz8dixrfv2j80bamjd5bzxsa66cvhc48n8p2nf";
+    sha256 = "11kh0ifzqbxk797lq037ixqhpf6h90w9xxygzh796mddg4rr4s9j";
   };
 
   preBuild =
diff --git a/pkgs/data/misc/hicolor-icon-theme/default.nix b/pkgs/data/misc/hicolor-icon-theme/default.nix
index e249dac1dc9..553665396ec 100644
--- a/pkgs/data/misc/hicolor-icon-theme/default.nix
+++ b/pkgs/data/misc/hicolor-icon-theme/default.nix
@@ -11,5 +11,6 @@ stdenv.mkDerivation rec {
   meta = {
     description = "Default fallback theme used by implementations of the icon theme specification";
     homepage = http://icon-theme.freedesktop.org/releases/;
+    platforms = stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/desktops/xfce-4.8/support/gvfs.nix b/pkgs/desktops/xfce-4.8/support/gvfs.nix
index 6e50e6825dd..33f7315a9d9 100644
--- a/pkgs/desktops/xfce-4.8/support/gvfs.nix
+++ b/pkgs/desktops/xfce-4.8/support/gvfs.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, glib, dbus, intltool, udev, libgdu }:
+{ stdenv, fetchurl, pkgconfig, glib, dbus, intltool, udev, libgdu, fuse }:
 
 stdenv.mkDerivation rec {
   name = "gvfs-1.8.2";
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "0895ac8f6d416e1b15433b6b6b68eb119c6e8b04fdb66db665d684355ef89345";
   };
 
-  buildInputs = [ pkgconfig glib dbus.libs intltool udev libgdu ];
+  buildInputs = [ pkgconfig glib dbus.libs intltool udev libgdu fuse ];
 
   meta = {
     description = "Virtual Filesystem support library (for Xfce)";
diff --git a/pkgs/development/compilers/gcc/4.5/default.nix b/pkgs/development/compilers/gcc/4.5/default.nix
index b3c639c6f0a..9cf38718a47 100644
--- a/pkgs/development/compilers/gcc/4.5/default.nix
+++ b/pkgs/development/compilers/gcc/4.5/default.nix
@@ -40,7 +40,7 @@ assert libelf != null -> zlib != null;
 with stdenv.lib;
 with builtins;
 
-let version = "4.5.3";
+let version = "4.5.4";
     javaEcj = fetchurl {
       # The `$(top_srcdir)/ecj.jar' file is automatically picked up at
       # `configure' time.
diff --git a/pkgs/development/compilers/gcc/4.5/sources.nix b/pkgs/development/compilers/gcc/4.5/sources.nix
index acf1ec2971c..71e1e483cac 100644
--- a/pkgs/development/compilers/gcc/4.5/sources.nix
+++ b/pkgs/development/compilers/gcc/4.5/sources.nix
@@ -1,26 +1,26 @@
 /* Automatically generated by `update-gcc.sh', do not edit.
-   For GCC 4.5.3.  */
+   For GCC 4.5.4.  */
 { fetchurl, optional, version, langC, langCC, langFortran, langJava, langAda }:
 
-assert version == "4.5.3";
+assert version == "4.5.4";
 optional /* langC */ true (fetchurl {
   url = "mirror://gcc/releases/gcc-${version}/gcc-core-${version}.tar.bz2";
-  sha256 = "fef7ef1396d41f4af2dacbea8826a895060a8a72d9f05546c091085b036f1f87";
+  sha256 = "894d90f72cbfc8707e330fa2b1847c443fa97cf9b7f26e86be554709510e624a";
 }) ++
 optional langCC (fetchurl {
   url = "mirror://gcc/releases/gcc-${version}/gcc-g++-${version}.tar.bz2";
-  sha256 = "e088b9fe0016070da921f353ef8c0c2f81fd11d21e3aeb09210ab7bad080804b";
+  sha256 = "f7e3bab5e22713fbce46c2acb35fb727748473a34a942ce00393d75e1b09b6b9";
 }) ++
 optional langFortran (fetchurl {
   url = "mirror://gcc/releases/gcc-${version}/gcc-fortran-${version}.tar.bz2";
-  sha256 = "618e8a2334eb3e2baf00891e9b2da47f32e797520e230acddb5f02fada0006cd";
+  sha256 = "cf0803b4f5334a526dd8da1b2171d6724f50c17346b2d5c509b6abc973d2ef34";
 }) ++
 optional langJava (fetchurl {
   url = "mirror://gcc/releases/gcc-${version}/gcc-java-${version}.tar.bz2";
-  sha256 = "c687198d4882c9d505eeb406595dad041602a5b6c67da5cf15d4941b34d20144";
+  sha256 = "c98398da6f8c4c7d1758e291089d99853fdd27112cd3f146b7a8c26e6d762a23";
 }) ++
 optional langAda (fetchurl {
   url = "mirror://gcc/releases/gcc-${version}/gcc-ada-${version}.tar.bz2";
-  sha256 = "686a6d2453bc325f32ddc90edf86502dc68320c7cd6948d60d93d0b0f5965b8f";
+  sha256 = "8abddae15be65572b4d639bd9818057019bb4a45da4decfc6451511c8d580c5e";
 }) ++
 []
diff --git a/pkgs/development/compilers/gcc/4.7/default.nix b/pkgs/development/compilers/gcc/4.7/default.nix
index 084e56173a2..02733d04203 100644
--- a/pkgs/development/compilers/gcc/4.7/default.nix
+++ b/pkgs/development/compilers/gcc/4.7/default.nix
@@ -163,7 +163,7 @@ stdenv.mkDerivation ({
   builder = ./builder.sh;
 
   src = fetchurl {
-    url = "http://ftp.gnu.org/gnu/gcc/gcc-4.7.1/gcc-4.7.1.tar.bz2";
+    url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
     sha256 = "0vs0v89zzgkngkw2p8kdynyk7j8ky4wf6zyrg3rsschpl1pky28n";
   };
 
diff --git a/pkgs/development/compilers/ghc/7.6.1.nix b/pkgs/development/compilers/ghc/7.6.1.nix
new file mode 100644
index 00000000000..203a354c13c
--- /dev/null
+++ b/pkgs/development/compilers/ghc/7.6.1.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, ghc, perl, gmp, ncurses }:
+
+stdenv.mkDerivation rec {
+  version = "7.6.0.20120810";
+
+  name = "ghc-${version}";
+
+  src = fetchurl {
+    url = "http://haskell.org/ghc/dist/7.6.1-rc1/${name}-src.tar.bz2";
+    sha256 = "04m8ms3a58590s4p8x6qma25rdanz0iai8rcla78ka798612pvjd";
+  };
+
+  buildInputs = [ ghc perl gmp ncurses ];
+
+  enableParallelBuilding = true;
+
+  buildMK = ''
+    libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp}/lib"
+    libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp}/include"
+  '';
+
+  preConfigure = ''
+    echo "${buildMK}" > mk/build.mk
+    sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
+  '';
+
+  configureFlags=[
+    "--with-gcc=${stdenv.gcc}/bin/gcc"
+  ];
+
+  # required, because otherwise all symbols from HSffi.o are stripped, and
+  # that in turn causes GHCi to abort
+  stripDebugFlags=["-S" "--keep-file-symbols"];
+
+  meta = {
+    homepage = "http://haskell.org/ghc";
+    description = "The Glasgow Haskell Compiler";
+    maintainers = [
+      stdenv.lib.maintainers.marcweber
+      stdenv.lib.maintainers.andres
+      stdenv.lib.maintainers.simons
+    ];
+    platforms = ghc.meta.platforms;
+  };
+
+}
diff --git a/pkgs/development/compilers/jdk/builder.sh b/pkgs/development/compilers/jdk/builder.sh
deleted file mode 100644
index ccfe2838d1b..00000000000
--- a/pkgs/development/compilers/jdk/builder.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-buildInputs="$unzip"
-source $stdenv/setup
-
-unzip $src || true
-
-mkdir -p $out
-mv $dirname/* $out/
-
-# Remove crap in the root directory.
-for file in $out/*
-do
-  if test -f $file ; then
-    rm $file
-  fi
-done
-
-# Set the dynamic linker.
-rpath=
-for i in $libraries; do
-    rpath=$rpath${rpath:+:}$i/lib
-done
-find $out -type f -perm +100 \
-    -exec patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
-    --set-rpath "$rpath" {} \;
-
-# Unpack .pack files.
-for i in $(find $out -name "*.pack"); do
-    echo "unpacking $i..."
-    $out/bin/unpack200 "$i" "$(dirname $i)/$(basename $i .pack).jar"
-    rm "$i"
-done
-
-# Put the *_md.h files in the right place.
-cd $out/include && ln -s */*_md.h .
diff --git a/pkgs/development/compilers/jdk/default-1.4.nix b/pkgs/development/compilers/jdk/default-1.4.nix
deleted file mode 100644
index 48eb5e6e7b7..00000000000
--- a/pkgs/development/compilers/jdk/default-1.4.nix
+++ /dev/null
@@ -1,9 +0,0 @@
-{stdenv, fetchurl}: 
-
-if stdenv.system == "i686-linux"
-  then
-    (import ./j2sdk-1.4.x-sun-linux.nix) {
-      inherit stdenv fetchurl;
-    }
-  else
-    abort "the Java 2 SDK is not supported on this platform"
diff --git a/pkgs/development/compilers/jdk/default-5.nix b/pkgs/development/compilers/jdk/default-5.nix
deleted file mode 100644
index dfd4e31f4b3..00000000000
--- a/pkgs/development/compilers/jdk/default-5.nix
+++ /dev/null
@@ -1,9 +0,0 @@
-{stdenv, fetchurl, unzip, requireFile}: 
-
-if stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux"
-  then
-    (import ./jdk5-oracle-linux.nix) {
-      inherit stdenv fetchurl unzip requireFile;
-    }
-  else
-    abort "the Java 5 SDK is not supported on this platform"
diff --git a/pkgs/development/compilers/jdk/default.nix b/pkgs/development/compilers/jdk/default.nix
index 547833c15cd..8940be7f34d 100644
--- a/pkgs/development/compilers/jdk/default.nix
+++ b/pkgs/development/compilers/jdk/default.nix
@@ -2,8 +2,6 @@ args:
 
 if args.stdenv.system == "i686-linux" || args.stdenv.system == "x86_64-linux" then
   (import ./jdk6-linux.nix) ( removeAttrs args ["cabextract"] )
-else if args.stdenv.system == "powerpc-linux" then
-  (import ./jdk5-ibm-powerpc-linux.nix) (removeAttrs args ["pluginSupport" "xlibs" "installjdk" "cabextract"])
 else if args.stdenv.system == "i686-cygwin" then
   (import ./jdk6-cygwin.nix) (removeAttrs args ["pluginSupport" "xlibs" "installjdk" "xlibs"])
 else
diff --git a/pkgs/development/compilers/jdk/ibm-builder.sh b/pkgs/development/compilers/jdk/ibm-builder.sh
deleted file mode 100644
index 2ff3a71322a..00000000000
--- a/pkgs/development/compilers/jdk/ibm-builder.sh
+++ /dev/null
@@ -1,29 +0,0 @@
-source $stdenv/setup
-
-if ! test -e "$pathname"; then
-    echo ""
-    echo "SORRY!"
-    echo "You should download \`$(basename $pathname)' from IBM and place it in $(dirname $pathname)."
-    echo "Blame IBM, not us."
-    echo ""
-    exit 1
-fi
-
-actual=$(md5sum -b $pathname | cut -c1-32)
-if test "$actual" != "$md5"; then
-    echo "hash is $actual, expected $md5"
-    exit 1
-fi
-
-tar zxf $pathname || true
-
-mkdir -p $out
-mv $dirname/* $out/
-
-# Remove crap in the root directory.
-for file in $out/*
-do
-  if test -f $file ; then
-    rm $file
-  fi
-done
diff --git a/pkgs/development/compilers/jdk/j2sdk-1.4.x-sun-linux.nix b/pkgs/development/compilers/jdk/j2sdk-1.4.x-sun-linux.nix
deleted file mode 100644
index 846055ce523..00000000000
--- a/pkgs/development/compilers/jdk/j2sdk-1.4.x-sun-linux.nix
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * This Nix expression requires the user to download the j2sdk
- * distribution to /tmp. Please obtain j2sdk-1_4_2_03-linux-i586.bin
- * from java.sun.com by hand and place it in /tmp. Blame Sun, not me.
- *
- * Note that this is not necessary if someone has already pushed a
- * binary.
- *
- * @author Martin Bravenboer <martin@cs.uu.nl>
- */
-{stdenv, fetchurl}: 
-
-assert stdenv.system == "i686-linux";
-
-derivation {
-  name = "j2sdk-1.4.2";
-  filename = "j2sdk-1.4.2_05";
-  dirname = "j2sdk1.4.2_05";
-  system = stdenv.system;
-  builder = ./builder.sh;
-  pathname = "/tmp/j2sdk-1_4_2_05-linux-i586.bin";
-  md5 = "825ff134f3e370f6e677638d32962082";
-  stdenv = stdenv;
-}
diff --git a/pkgs/development/compilers/jdk/jdk5-ibm-powerpc-linux.nix b/pkgs/development/compilers/jdk/jdk5-ibm-powerpc-linux.nix
deleted file mode 100644
index a4c2bd589af..00000000000
--- a/pkgs/development/compilers/jdk/jdk5-ibm-powerpc-linux.nix
+++ /dev/null
@@ -1,17 +0,0 @@
-{ swingSupport ? true
-, stdenv, fetchurl, unzip, makeWrapper, libX11 ? null, libXext ? null
-}:
-
-assert stdenv.system == "powerpc-linux";
-
-assert swingSupport -> libX11 != null && libXext != null;
-
-(stdenv.mkDerivation {
-  name = "jdk-1.5.0";
-  builder = ./ibm-builder.sh;
-  dirname = "ibm-java2-ppc-50";
-  pathname = "/tmp/ibm-java2-sdk-50-linux-ppc.tgz";
-  md5 = "6bed4ae0b24d3eea2914f2f6dcc0ceb4";
-  libraries =
-    (if swingSupport then [libX11 libXext] else []);
-} // {inherit swingSupport;})
diff --git a/pkgs/development/compilers/jdk/jdk5-oracle-linux.nix b/pkgs/development/compilers/jdk/jdk5-oracle-linux.nix
deleted file mode 100644
index 8884585d154..00000000000
--- a/pkgs/development/compilers/jdk/jdk5-oracle-linux.nix
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * This Nix expression requires the user to download the Java 5.0 JDK
- * distribution to /tmp. Please obtain jdk-1_5_0_22-linux-i586.bin for
- * 32-bit systems or jdk-1_5_0_22-linux-amd64.bin for 64-bit systems
- * from java.sun.com (look for archived software downloads) 
- * by hand and place it in /tmp. Blame Oracle, not me.
- *
- * Note that this is not necessary if someone has already pushed a
- * binary.
- */
-{stdenv, fetchurl, unzip, requireFile}: 
-
-assert stdenv.system == "i686-linux" || stdenv.system == "x86_64-linux";
-
-stdenv.mkDerivation rec {
-  name =  "jdk-1_5_0_22";
-  dirname = "jdk1.5.0_22";
-  builder = ./builder.sh;
-  src = requireFile {
-    message = ''
-      SORRY!
-      We may not download the needed binary distribution automatically.
-      You should download ${distfilename} from Sun and add it to store.
-      For example, "nix-prefetch-url file:///\$PWD/${distfilename}" in the 
-      directory where you saved it is OK.
-      Blame Sun, not us.
-    '';
-    name = distfilename;
-    sha256 = if stdenv.system == "x86_64-linux" then 
-      "1h63gigvg8id95igcj8xw7qvxs4p2y9hvx4xbvkwg8bji3ifb0sk" 
-    else "0655n2q1y023zzwbk6gs9vwsnb29jc0m3bg3x3xdw623qgb4k6px";
-  };
-  distfilename = if stdenv.system == "x86_64-linux" then "${name}-linux-amd64.bin" else "${name}-linux-i586.bin";
-  
-  inherit unzip stdenv;
-}
diff --git a/pkgs/development/compilers/jdk/jdk6-cygwin.nix b/pkgs/development/compilers/jdk/jdk6-cygwin.nix
index 766151dfe6b..31c9c614031 100644
--- a/pkgs/development/compilers/jdk/jdk6-cygwin.nix
+++ b/pkgs/development/compilers/jdk/jdk6-cygwin.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   name = "jdk-1.6.0_20";
 
   src = fetchurl {
-    url = file:///tmp/jdk-6u20-windows-i586.exe ;
+    url = file:///tmp/jdk-6u20-windows-i586.exe;
     sha256 = "0w4afz8a9gi1iyhh47gvhiy59dfrzx0fnmywdff3v5cx696w25fh";
   };
 
@@ -43,4 +43,6 @@ stdenv.mkDerivation rec {
        ./jre/lib/ext/localedata.pack \
        ./lib/tools.pack
   '';
+
+  meta.license = "unfree";
 }
diff --git a/pkgs/development/compilers/jdk/jdk6-linux.nix b/pkgs/development/compilers/jdk/jdk6-linux.nix
index 224f77a1357..b564d311014 100644
--- a/pkgs/development/compilers/jdk/jdk6-linux.nix
+++ b/pkgs/development/compilers/jdk/jdk6-linux.nix
@@ -55,7 +55,7 @@ stdenv.mkDerivation {
   inherit installjdk;
 
   buildInputs = [unzip makeWrapper];
-  
+
   /**
    * libXt is only needed on amd64
    */
@@ -67,4 +67,6 @@ stdenv.mkDerivation {
   inherit (xlibs) libX11;
 
   mozillaPlugin = if installjdk then "/jre/lib/${architecture}/plugins" else "/lib/${architecture}/plugins";
+
+  meta.license = "unfree";
 }
diff --git a/pkgs/development/compilers/julia/default.nix b/pkgs/development/compilers/julia/default.nix
index d0231adb73d..2484be9ae1f 100644
--- a/pkgs/development/compilers/julia/default.nix
+++ b/pkgs/development/compilers/julia/default.nix
@@ -7,14 +7,14 @@ let
 in
 stdenv.mkDerivation rec {
   pname = "julia";
-  date = "20120801";
+  date = "20120818";
   name = "${pname}-git-${date}";
 
   grisu_ver = "1.1.1";
   dsfmt_ver = "2.1";
   openblas_ver = "v0.2.2";
   lapack_ver = "3.4.1";
-  arpack_ver = "3.1.1";
+  arpack_ver = "3.1.2";
   clp_ver = "1.14.5";
   lighttpd_ver = "1.4.29";
 
@@ -33,9 +33,9 @@ stdenv.mkDerivation rec {
     sha256 = "19ffec70f9678f5c159feadc036ca47720681b782910fbaa95aa3867e7e86d8e";
   };
   arpack_src = fetchurl {
-    url = "http://forge.scilab.org/index.php/p/arpack-ng/downloads/417/get/";
+    url = "http://forge.scilab.org/index.php/p/arpack-ng/downloads/497/get/";
     name = "arpack-ng_${arpack_ver}.tar.gz";
-    sha256 = "be250947a7d6eac7dff8c058102fce9922c524aa06be2a090b6e0bb2d1e228cd";
+    sha256 = "1wk06bdjgap4hshx0lswzi7vxy2lrdx353y1k7yvm97mpsjvsf4k";
   };
   lapack_src = fetchurl {
     url = "http://www.netlib.org/lapack/lapack-${lapack_ver}.tgz";
@@ -54,8 +54,8 @@ stdenv.mkDerivation rec {
 
   src = fetchgit {
     url = "git://github.com/JuliaLang/julia.git";
-    rev = "3b413ec24957e400c984002f7cdf6232f5391a7e";
-    sha256 = "c019b724df9203899a1da5815f85d79291778191bbffc1361d2213ff7d2bbc1d";
+    rev = "4f692899688f500c77d768f67748f4b7335c90eb";
+    sha256 = "a60e684a5283e80619f28ec8ff16fdc76c549e8463059507b0819db09dae6688";
   };
 
   buildInputs = [ gfortran perl m4 gmp pcre llvm readline 
diff --git a/pkgs/development/compilers/openjdk/bootstrap.nix b/pkgs/development/compilers/openjdk/bootstrap.nix
new file mode 100644
index 00000000000..2ac2eed117c
--- /dev/null
+++ b/pkgs/development/compilers/openjdk/bootstrap.nix
@@ -0,0 +1,21 @@
+{ runCommand, glibc, fetchurl }:
+
+let
+  # !!! These should be on nixos.org
+  src = if glibc.system == "x86_64-linux" then
+    fetchurl {
+      url = http://nixos.org/tarballs/openjdk-bootstrap-x86_64-linux-2012-08-24.tar.xz;
+      sha256 = "0gla9dxrfq2w1hvgsnn8jg8a60k27im6z43a6iidi0qmwa0wah32";
+    }
+  else if glibc.system == "i686-linux" then
+    fetchurl {
+      url = http://nixos.org/tarballs/openjdk-bootstrap-i686-linux-2012-08-24.tar.xz;
+      sha256 = "184wq212bycwbbq4ix8cc6jwjxkrqw9b01zb86q95kqpa8zy5206";
+    }
+  else throw "No bootstrap for system";
+in
+
+runCommand "openjdk-bootstrap" {} ''
+  xz -dc ${src} | sed "s/e*-glibc-[^/]*/$(basename ${glibc})/g" | tar xv
+  mv openjdk-bootstrap $out
+''
diff --git a/pkgs/development/compilers/openjdk/default.nix b/pkgs/development/compilers/openjdk/default.nix
index cf85c1706a8..5f5148911ec 100644
--- a/pkgs/development/compilers/openjdk/default.nix
+++ b/pkgs/development/compilers/openjdk/default.nix
@@ -107,6 +107,7 @@ stdenv.mkDerivation rec {
     "UNIXCOMMAND_PATH="
     "BOOTDIR=${jdk}"
     "DROPS_DIR=$(DROPS_PATH)"
+    "SKIP_BOOT_CYCLE=false"
   ];
 
   configurePhase = ''
diff --git a/pkgs/development/compilers/openjdk/make-bootstrap.nix b/pkgs/development/compilers/openjdk/make-bootstrap.nix
new file mode 100644
index 00000000000..aa5b8ad39f5
--- /dev/null
+++ b/pkgs/development/compilers/openjdk/make-bootstrap.nix
@@ -0,0 +1,26 @@
+{ runCommand, openjdk, nukeReferences }:
+
+let arch = if openjdk.system == "x86_64-linux" then "amd64" else "i386"; in
+
+runCommand "${openjdk.name}-bootstrap.tar.xz" {} ''
+  mkdir -p openjdk-bootstrap/bin
+  mkdir -p openjdk-bootstrap/lib
+  mkdir -p openjdk-bootstrap/jre/lib/{security,ext,${arch}/{jli,server,client,headless}}
+  cp ${openjdk}/bin/{idlj,ja{va{,c,p,h},r},rmic} openjdk-bootstrap/bin
+  cp ${openjdk}/lib/tools.jar openjdk-bootstrap/lib
+  cp ${openjdk}/jre/lib/{meta-index,{charsets,jce,jsse,rt,resources}.jar,currency.data} openjdk-bootstrap/jre/lib
+  cp ${openjdk}/jre/lib/security/java.security openjdk-bootstrap/jre/lib/security
+  cp ${openjdk}/jre/lib/ext/{meta-index,sunjce_provider.jar} openjdk-bootstrap/jre/lib/ext
+  cp ${openjdk}/jre/lib/${arch}/{jvm.cfg,lib{awt,java,verify,zip,nio,net}.so} openjdk-bootstrap/jre/lib/${arch}
+  cp ${openjdk}/jre/lib/${arch}/jli/libjli.so openjdk-bootstrap/jre/lib/${arch}/jli
+  cp ${openjdk}/jre/lib/${arch}/server/libjvm.so openjdk-bootstrap/jre/lib/${arch}/server
+  cp ${openjdk}/jre/lib/${arch}/client/libjvm.so openjdk-bootstrap/jre/lib/${arch}/client ||
+    rmdir openjdk-bootstrap/jre/lib/${arch}/client
+  cp ${openjdk}/jre/lib/${arch}/headless/libmawt.so openjdk-bootstrap/jre/lib/${arch}/headless
+  cp -a ${openjdk}/include openjdk-bootstrap
+
+  chmod -R +w openjdk-bootstrap
+  find openjdk-bootstrap -print0 | xargs -0 ${nukeReferences}/bin/nuke-refs
+
+  tar cv openjdk-bootstrap | xz > $out
+''
diff --git a/pkgs/development/compilers/scala/default.nix b/pkgs/development/compilers/scala/default.nix
index 340076cc137..a78ee06f652 100644
--- a/pkgs/development/compilers/scala/default.nix
+++ b/pkgs/development/compilers/scala/default.nix
@@ -12,12 +12,10 @@ stdenv.mkDerivation rec {
 
   installPhase = ''
     mkdir -p $out
-    rm bin/*.bat
+    rm "bin/"*.bat
     mv * $out
   '';
 
-  phases = "unpackPhase installPhase";
-
   meta = {
     description = "Scala is a general purpose programming language";
     longDescription = ''
@@ -25,7 +23,7 @@ stdenv.mkDerivation rec {
       common programming patterns in a concise, elegant, and type-safe way.
       It smoothly integrates features of object-oriented and functional
       languages, enabling Java and other programmers to be more productive.
-      Code sizes are typically reduced by a factor of two to three when 
+      Code sizes are typically reduced by a factor of two to three when
       compared to an equivalent Java application.
     '';
     homepage = http://www.scala-lang.org/;
diff --git a/pkgs/development/compilers/urweb/default.nix b/pkgs/development/compilers/urweb/default.nix
index 7dbbe375283..7c0ddde6612 100644
--- a/pkgs/development/compilers/urweb/default.nix
+++ b/pkgs/development/compilers/urweb/default.nix
@@ -2,12 +2,12 @@
 
 stdenv.mkDerivation rec {
   pname = "urweb";
-  version = "20120110";
+  version = "20120807";
   name = "${pname}-${version}";
 
   src = fetchurl {
     url = "http://www.impredicative.com/ur/${name}.tgz";
-    sha256 = "1f67nj2akji9dh3n2hwmcrrwd61zlrnb0xh841fpb3n20ycjzg6j";
+    sha256 = "15g1cz108dkzlp433cg56x76f20y6zcs9sbgxgdniyfakmn4ld6l";
   };
 
   buildInputs = [ stdenv.gcc file openssl mlton mysql postgresql sqlite ];
@@ -71,7 +71,7 @@ stdenv.mkDerivation rec {
     '';
 
     homepage = http://www.impredicative.com/ur/;
-    license = "bsd";
+    license = stdenv.lib.licenses.bsd3;
     platforms = [ "i686-linux" "x86_64-linux" ];
   };
 }
diff --git a/pkgs/development/eclipse/ecj/default.nix b/pkgs/development/eclipse/ecj/default.nix
index 53343f00ca5..8d083126e4c 100644
--- a/pkgs/development/eclipse/ecj/default.nix
+++ b/pkgs/development/eclipse/ecj/default.nix
@@ -1,8 +1,8 @@
 { stdenv, fetchurl, unzip, ant, gcj }:
 
 let
-  version = "3.6.1";
-  date    = "201009090800";
+  version = "3.7.2";
+  date    = "201202080800";
   isGCJ   = stdenv.lib.strings.substring 0 3 gcj.name == "gcj";
   javaExec  = if isGCJ then "gij" else "java";
   javaFlags = if isGCJ then "--cp" else "-cp";
@@ -11,8 +11,8 @@ in
     name = "ecj-${version}";
 
     src = fetchurl {
-      url = "http://eclipse.ialto.org/eclipse/downloads/drops/R-${version}-${date}/ecjsrc-${version}.zip";
-      sha256 = "0xfsig2pzd9wy524wp11s7pc7cj81s28g1485995b44d9qbi17h8";
+      url = "http://eclipse.ialto.org/eclipse/downloads/drops/R-${version}-${date}/ecjsrc-${version}.jar";
+      sha256 = "0swyysbyfmv068x8q1c5jqpwk5zb4xahg17aypx5rwb660f8fpbm";
     };
 
     buildInputs = [ unzip ant gcj ];
diff --git a/pkgs/development/libraries/babl/0_0_22.nix b/pkgs/development/libraries/babl/0_0_22.nix
new file mode 100644
index 00000000000..2464a09f51a
--- /dev/null
+++ b/pkgs/development/libraries/babl/0_0_22.nix
@@ -0,0 +1,16 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation {
+  name = "babl-0.0.22";
+
+  src = fetchurl {
+    url = ftp://ftp.gtk.org/pub/babl/0.0/babl-0.0.22.tar.bz2;
+    sha256 = "0v8gbf9si4sd06199f8lfmrsbvi6i0hxphd34kyvsj6g2kkkg10s";
+  };
+
+  meta = { 
+    description = "Image pixel format conversion library";
+    homepage = http://gegl.org/babl/;
+    license = "GPL3";
+  };
+}
diff --git a/pkgs/development/libraries/gegl/0_0_22.nix b/pkgs/development/libraries/gegl/0_0_22.nix
new file mode 100644
index 00000000000..150ba1ac961
--- /dev/null
+++ b/pkgs/development/libraries/gegl/0_0_22.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, pkgconfig, glib, babl_0_0_22, libpng12, cairo, libjpeg
+, librsvg, pango, gtk }:
+        
+stdenv.mkDerivation {
+  name = "gegl-0.0.22";
+
+  src = fetchurl {
+    url = ftp://ftp.gimp.org/pub/gegl/0.0/gegl-0.0.22.tar.bz2;
+    sha256 = "0nx6r9amzhw5d2ghlw3z8qnry18rwz1ymvl2cm31b8p49z436wl5";
+  };
+
+  configureFlags = "--disable-docs"; # needs fonts otherwise  don't know how to pass them
+
+  buildInputs = [ pkgconfig glib babl_0_0_22 libpng12 cairo libjpeg librsvg pango gtk ];
+
+  meta = { 
+    description = "Graph-based image processing framework";
+    homepage = http://www.gegl.org;
+    license = "GPL3";
+  };
+}
diff --git a/pkgs/development/libraries/glib/2.30.x.nix b/pkgs/development/libraries/glib/2.30.x.nix
index 092fa7f27e0..72baf0154d9 100644
--- a/pkgs/development/libraries/glib/2.30.x.nix
+++ b/pkgs/development/libraries/glib/2.30.x.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig, gettext, perl, libiconv, zlib, libffi
+{ stdenv, fetchurl, pkgconfig, gettext, perl, libiconvOrNull, zlib, libffi
 , python, pcre }:
 
 # TODO:
@@ -20,7 +20,11 @@ stdenv.mkDerivation rec {
   };
 
   # configure script looks for d-bus but it is only needed for tests
-  buildInputs = [ pcre ] ++ stdenv.lib.optional (!stdenv.isLinux) libiconv;
+  buildInputs = [ pcre ]
+    ++ (if libiconvOrNull != null
+        then [ libiconvOrNull ]
+        else []);
+
   buildNativeInputs = [ perl pkgconfig gettext python ];
 
   propagatedBuildInputs = [ zlib libffi ];
diff --git a/pkgs/development/libraries/gnutls/default.nix b/pkgs/development/libraries/gnutls/default.nix
index 401433343da..b8f88c6f5b8 100644
--- a/pkgs/development/libraries/gnutls/default.nix
+++ b/pkgs/development/libraries/gnutls/default.nix
@@ -29,7 +29,9 @@ stdenv.mkDerivation (rec {
 
   propagatedBuildInputs = [ nettle libtasn1 ];
 
-  doCheck = true;
+  # XXX: Gnulib's `test-select' fails on FreeBSD:
+  # http://hydra.nixos.org/build/2962084/nixlog/1/raw .
+  doCheck = (!stdenv.isFreeBSD);
 
   meta = {
     description = "The GNU Transport Layer Security Library";
diff --git a/pkgs/development/libraries/haskell/ListLike/default.nix b/pkgs/development/libraries/haskell/ListLike/default.nix
index f0b1ccd8bc0..58595edf744 100644
--- a/pkgs/development/libraries/haskell/ListLike/default.nix
+++ b/pkgs/development/libraries/haskell/ListLike/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "ListLike";
-  version = "3.1.5";
-  sha256 = "0hxpjmj5qdyb55wda2bgd3crkg9q6dklhj2kff7qz6wkx5fdbvjs";
+  version = "3.1.6";
+  sha256 = "0ij6yb80dv841zn23lp6251avzmljzmy4j25r7w6h55y32y7gq46";
   isLibrary = true;
   isExecutable = true;
   meta = {
diff --git a/pkgs/development/libraries/haskell/MonadCatchIO-mtl/default.nix b/pkgs/development/libraries/haskell/MonadCatchIO-mtl/default.nix
index 10b28522a50..9b044f6dbab 100644
--- a/pkgs/development/libraries/haskell/MonadCatchIO-mtl/default.nix
+++ b/pkgs/development/libraries/haskell/MonadCatchIO-mtl/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "MonadCatchIO-mtl";
-  version = "0.3.0.4";
-  sha256 = "0wzdrfplwa4v9miv88rg3jvf7l6gphc29lpdp5qjm5873y57jxm7";
+  version = "0.3.0.5";
+  sha256 = "01c2xif4aly2lmg2qkri791ignq3r2qg4xbc8m06cdm6gh5a2dqp";
   buildDepends = [ extensibleExceptions mtl ];
   meta = {
     homepage = "http://darcsden.com/jcpetruzza/MonadCatchIO-mtl";
diff --git a/pkgs/development/libraries/haskell/RepLib/default.nix b/pkgs/development/libraries/haskell/RepLib/default.nix
index 1bc52184474..15cba0c0b28 100644
--- a/pkgs/development/libraries/haskell/RepLib/default.nix
+++ b/pkgs/development/libraries/haskell/RepLib/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "RepLib";
-  version = "0.5.3";
-  sha256 = "1kpd4qli6fclrr3i21kmdwbpa0la7ssi9pgagzclr3yj2ca2hsgw";
+  version = "0.5.3.1";
+  sha256 = "0lc1ma6h5wdfl4crnvg1vyvlx4xvps4l2nwb9dl6nyspmpjad807";
   buildDepends = [ mtl typeEquality ];
   meta = {
     homepage = "http://code.google.com/p/replib/";
diff --git a/pkgs/development/libraries/haskell/accelerate-examples/default.nix b/pkgs/development/libraries/haskell/accelerate-examples/default.nix
index f1f7aefb736..f88824c21fe 100644
--- a/pkgs/development/libraries/haskell/accelerate-examples/default.nix
+++ b/pkgs/development/libraries/haskell/accelerate-examples/default.nix
@@ -22,7 +22,7 @@ cabal.mkDerivation (self: {
     homepage = "http://www.cse.unsw.edu.au/~chak/project/accelerate/";
     description = "Examples using the Accelerate library";
     license = self.stdenv.lib.licenses.bsd3;
-    platforms = self.ghc.meta.platforms;
+    platforms = self.stdenv.lib.platforms.none;
     maintainers = [ self.stdenv.lib.maintainers.andres ];
   };
 })
diff --git a/pkgs/development/libraries/haskell/async/default.nix b/pkgs/development/libraries/haskell/async/default.nix
index ca759009817..499dc394ece 100644
--- a/pkgs/development/libraries/haskell/async/default.nix
+++ b/pkgs/development/libraries/haskell/async/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "async";
-  version = "2.0.1.1";
-  sha256 = "132xr0sb3j02s134my4p7khj95d3v3jlpxqjrgn6h8brw0gp6wcq";
+  version = "2.0.1.2";
+  sha256 = "03mmrs1xrw91pv9xpas8acxvrh4j6bq5l24bqk4vmaq2pdy9snn3";
   buildDepends = [ stm ];
   meta = {
     homepage = "https://github.com/simonmar/async";
diff --git a/pkgs/development/libraries/haskell/attoparsec/enumerator.nix b/pkgs/development/libraries/haskell/attoparsec/enumerator.nix
index ee4b42a49bd..d52687d8080 100644
--- a/pkgs/development/libraries/haskell/attoparsec/enumerator.nix
+++ b/pkgs/development/libraries/haskell/attoparsec/enumerator.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "attoparsec-enumerator";
-  version = "0.3";
-  sha256 = "1sfqcr1mvny9gf0zzggwvs2b20knxrbb208rzaa86ay0b5b5jw5v";
+  version = "0.3.1";
+  sha256 = "10h6i23vhcishp599s4lbp0c46wcba99w6iv4ickdr1avrm9z2m7";
   buildDepends = [ attoparsec enumerator text ];
   meta = {
     homepage = "https://john-millikin.com/software/attoparsec-enumerator/";
diff --git a/pkgs/development/libraries/haskell/authenticate/default.nix b/pkgs/development/libraries/haskell/authenticate/default.nix
index 9620fb9ecc5..dc0ce313eff 100644
--- a/pkgs/development/libraries/haskell/authenticate/default.nix
+++ b/pkgs/development/libraries/haskell/authenticate/default.nix
@@ -6,8 +6,8 @@
 
 cabal.mkDerivation (self: {
   pname = "authenticate";
-  version = "1.3.0.1";
-  sha256 = "12s1ri2k0hmaws1rnr4s8ck1wa14lhcih0pzi89hjh7jh8si3dl3";
+  version = "1.3.1";
+  sha256 = "1ad3vzfa7nvp8h8wk5370d2qyri0nywq1wjdvqas2mg4iv7v7271";
   buildDepends = [
     aeson attoparsec blazeBuilder blazeBuilderConduit caseInsensitive
     conduit httpConduit httpTypes monadControl network resourcet
diff --git a/pkgs/development/libraries/haskell/blaze-builder-enumerator/default.nix b/pkgs/development/libraries/haskell/blaze-builder-enumerator/default.nix
index a953d9f4525..00176d215ba 100644
--- a/pkgs/development/libraries/haskell/blaze-builder-enumerator/default.nix
+++ b/pkgs/development/libraries/haskell/blaze-builder-enumerator/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "blaze-builder-enumerator";
-  version = "0.2.0.4";
-  sha256 = "1zwp9hcjsmy5p5i436ajvl86zl1z4pzcfp6c57sj8vfr08rrrkq9";
+  version = "0.2.0.5";
+  sha256 = "0bbbv9wwzw9ss3d02mszdzxzhg6pcrnpwir9bvby7xkmfqpyffaa";
   buildDepends = [ blazeBuilder enumerator transformers ];
   meta = {
     homepage = "https://github.com/meiersi/blaze-builder-enumerator";
diff --git a/pkgs/development/libraries/haskell/case-insensitive/default.nix b/pkgs/development/libraries/haskell/case-insensitive/default.nix
index 4187716f026..7f53773f1ab 100644
--- a/pkgs/development/libraries/haskell/case-insensitive/default.nix
+++ b/pkgs/development/libraries/haskell/case-insensitive/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "case-insensitive";
-  version = "0.4.0.1";
-  sha256 = "15wcpzmj1ppl27p8hph9y8nxkjkd4yrvamxi3gk0ahfnb47chaq7";
+  version = "0.4.0.3";
+  sha256 = "1lpfxfwfxiimvh5nxqrnjqj2687dp7rmv9wkrpmw2zm5wkxwcmzf";
   buildDepends = [ hashable text ];
   meta = {
     homepage = "https://github.com/basvandijk/case-insensitive";
diff --git a/pkgs/development/libraries/haskell/certificate/default.nix b/pkgs/development/libraries/haskell/certificate/default.nix
index 1f2cdd40238..6581ddf0e1a 100644
--- a/pkgs/development/libraries/haskell/certificate/default.nix
+++ b/pkgs/development/libraries/haskell/certificate/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "certificate";
-  version = "1.2.4";
-  sha256 = "079364567cshfj2bc0lbj933jcgdqisvv8m0czlyscb4hd10vfg7";
+  version = "1.2.5";
+  sha256 = "1zxi1hflq973m7a1c9wvxdx8aqapx1kqy8j7nn7k67l9gpjb1jbc";
   isLibrary = true;
   isExecutable = true;
   buildDepends = [ asn1Data cryptoPubkeyTypes mtl pem time ];
diff --git a/pkgs/development/libraries/haskell/clientsession/default.nix b/pkgs/development/libraries/haskell/clientsession/default.nix
index da933207e23..417e568092d 100644
--- a/pkgs/development/libraries/haskell/clientsession/default.nix
+++ b/pkgs/development/libraries/haskell/clientsession/default.nix
@@ -10,6 +10,9 @@ cabal.mkDerivation (self: {
     base64Bytestring cereal cprngAes cryptoApi cryptocipher entropy
     skein tagged
   ];
+  patchPhase = ''
+    sed -i -e 's|, base64-bytestring.*|, base64-bytestring|' clientsession.cabal
+  '';
   meta = {
     homepage = "http://github.com/yesodweb/clientsession/tree/master";
     description = "Securely store session data in a client-side cookie";
diff --git a/pkgs/development/libraries/haskell/cmdargs/default.nix b/pkgs/development/libraries/haskell/cmdargs/default.nix
index 87d09a6d5fc..38b0bf24bcb 100644
--- a/pkgs/development/libraries/haskell/cmdargs/default.nix
+++ b/pkgs/development/libraries/haskell/cmdargs/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "cmdargs";
-  version = "0.9.6";
-  sha256 = "0xmzx7iglygks11qmnwz9jjj0jim2sjq7x3xf39symzs986pswlk";
+  version = "0.9.7";
+  sha256 = "0w3y94hjq5w1i2vcj45jfdbi1iadib2nsv0pa3w9dmqvn9wxlvz4";
   isLibrary = true;
   isExecutable = true;
   buildDepends = [ filepath transformers ];
diff --git a/pkgs/development/libraries/haskell/comonad/3.0.0.1.nix b/pkgs/development/libraries/haskell/comonad/3.0.0.2.nix
index b73e29fc1e0..3394de01206 100644
--- a/pkgs/development/libraries/haskell/comonad/3.0.0.1.nix
+++ b/pkgs/development/libraries/haskell/comonad/3.0.0.2.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "comonad";
-  version = "3.0.0.1";
-  sha256 = "03xslpfil96v1qgk2g29vi46mb7l0fafy446ng1p4xgq9ddb2yaz";
+  version = "3.0.0.2";
+  sha256 = "01q71b446mdbdj81qjrxjl5bshbg4bjih5zpw9fd4y5431bclfhi";
   buildDepends = [ semigroups transformers ];
   meta = {
     homepage = "http://github.com/ekmett/comonad/";
diff --git a/pkgs/development/libraries/haskell/criterion/default.nix b/pkgs/development/libraries/haskell/criterion/default.nix
index a687a592baa..54b6b20dc83 100644
--- a/pkgs/development/libraries/haskell/criterion/default.nix
+++ b/pkgs/development/libraries/haskell/criterion/default.nix
@@ -4,8 +4,8 @@
 
 cabal.mkDerivation (self: {
   pname = "criterion";
-  version = "0.6.0.1";
-  sha256 = "0k6ip41w5h1z8gl67a8vsb6c3md5nc4yh1vd6dysp9fqgn0vky0a";
+  version = "0.6.1.1";
+  sha256 = "1w5yqcgnx2ij3hmvmz5g4ynj6n8wa3yyk1kfbbwxyh9j5kc2xwiw";
   buildDepends = [
     aeson deepseq filepath hastache mtl mwcRandom parsec statistics
     time transformers vector vectorAlgorithms
diff --git a/pkgs/development/libraries/haskell/cuda/default.nix b/pkgs/development/libraries/haskell/cuda/default.nix
index 5c0614bc0b4..296d639918e 100644
--- a/pkgs/development/libraries/haskell/cuda/default.nix
+++ b/pkgs/development/libraries/haskell/cuda/default.nix
@@ -37,7 +37,7 @@ cabal.mkDerivation (self: {
   meta = {
     description = "FFI binding to the CUDA interface for programming NVIDIA GPUs";
     license = self.stdenv.lib.licenses.bsd3;
-    platforms = self.ghc.meta.platforms;
+    platforms = self.stdenv.lib.platforms.none;
     maintainers = [ self.stdenv.lib.maintainers.andres ];
   };
 })
diff --git a/pkgs/development/libraries/haskell/fast-logger/default.nix b/pkgs/development/libraries/haskell/fast-logger/default.nix
index 6491515624a..74f78e72af2 100644
--- a/pkgs/development/libraries/haskell/fast-logger/default.nix
+++ b/pkgs/development/libraries/haskell/fast-logger/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "fast-logger";
-  version = "0.2.1";
-  sha256 = "12avan85dkwipp8hqsya8yslirykz2yvqmns3wjhwl9j30idj7r3";
+  version = "0.2.2";
+  sha256 = "1r1fk0lqmh49v24wnx236x9cz122c8806y9mrxnaihxggw4anj0x";
   buildDepends = [ blazeBuilder filepath text unixTime ];
   meta = {
     description = "A fast logging system";
diff --git a/pkgs/development/libraries/haskell/fclabels/default.nix b/pkgs/development/libraries/haskell/fclabels/default.nix
index 25ec69c8459..82a96856ab8 100644
--- a/pkgs/development/libraries/haskell/fclabels/default.nix
+++ b/pkgs/development/libraries/haskell/fclabels/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "fclabels";
-  version = "1.1.4";
-  sha256 = "0b15nvnsxckw75q7dgrfxnnjc93ah140gi3s5wpb41q0fnvl9npz";
+  version = "1.1.4.1";
+  sha256 = "09k601kijdflazmrxygwwd8lmxr9vx2bzc25qiwcc9id2rp43asm";
   buildDepends = [ mtl transformers ];
   meta = {
     description = "First class accessor labels";
diff --git a/pkgs/development/libraries/haskell/filestore/default.nix b/pkgs/development/libraries/haskell/filestore/default.nix
index 355c6ef876c..b0cc40d3914 100644
--- a/pkgs/development/libraries/haskell/filestore/default.nix
+++ b/pkgs/development/libraries/haskell/filestore/default.nix
@@ -11,6 +11,9 @@ cabal.mkDerivation (self: {
   buildDepends = [
     Diff filepath HUnit mtl parsec split time utf8String xml
   ];
+  patchPhase = ''
+    sed -i -e 's|split.*,|split,|' filestore.cabal
+  '';
   noHaddock = true;
   meta = {
     description = "Interface for versioning file stores";
diff --git a/pkgs/development/libraries/haskell/glpk-hs/default.nix b/pkgs/development/libraries/haskell/glpk-hs/default.nix
index 621a7e9c4c5..006f227a8c2 100644
--- a/pkgs/development/libraries/haskell/glpk-hs/default.nix
+++ b/pkgs/development/libraries/haskell/glpk-hs/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "glpk-hs";
-  version = "0.3.2";
-  sha256 = "0y7imgzcnh6x36m5f6mns5ay1xhxy5p6i5nh16p2ywzjj0padcg8";
+  version = "0.3.3";
+  sha256 = "1pnq0v5va7f40ky9xb8c4z9wcmmnny2vk4afasz5pwivbxh42mfl";
   buildDepends = [ deepseq mtl ];
   extraLibraries = [ glpk ];
   meta = {
diff --git a/pkgs/development/libraries/haskell/hamlet/default.nix b/pkgs/development/libraries/haskell/hamlet/default.nix
index 98123e6d551..31d1ad66d2e 100644
--- a/pkgs/development/libraries/haskell/hamlet/default.nix
+++ b/pkgs/development/libraries/haskell/hamlet/default.nix
@@ -4,8 +4,8 @@
 
 cabal.mkDerivation (self: {
   pname = "hamlet";
-  version = "1.1.0.1";
-  sha256 = "14qlpdfnj90ilgcgll96rrpc4cjc218q7p7kc6y391rkf393453p";
+  version = "1.1.0.2";
+  sha256 = "0knkc43ldz3jhn3pmsysqbzlsp8akh9kiyy2jncra9y0xhminpqy";
   buildDepends = [
     blazeBuilder blazeHtml blazeMarkup failure parsec shakespeare text
   ];
diff --git a/pkgs/development/libraries/haskell/happstack/happstack-hamlet.nix b/pkgs/development/libraries/haskell/happstack/happstack-hamlet.nix
index 6c105b1e476..7b2c937bd06 100644
--- a/pkgs/development/libraries/haskell/happstack/happstack-hamlet.nix
+++ b/pkgs/development/libraries/haskell/happstack/happstack-hamlet.nix
@@ -5,6 +5,9 @@ cabal.mkDerivation (self: {
   version = "7.0.1";
   sha256 = "13ayypl2x402h6a7yq7fvgd2mn21gl5gcw2hk7f5vr2bdlvwv53n";
   buildDepends = [ hamlet happstackServer text ];
+  patchPhase = ''
+    sed -i -e 's|hamlet .*,|hamlet,|' happstack-hamlet.cabal
+  '';
   meta = {
     homepage = "http://www.happstack.com/";
     description = "Support for Hamlet HTML templates in Happstack";
diff --git a/pkgs/development/libraries/haskell/happstack/happstack-server.nix b/pkgs/development/libraries/haskell/happstack/happstack-server.nix
index d171795d266..410eb7e1d05 100644
--- a/pkgs/development/libraries/haskell/happstack/happstack-server.nix
+++ b/pkgs/development/libraries/haskell/happstack/happstack-server.nix
@@ -13,6 +13,9 @@ cabal.mkDerivation (self: {
     html monadControl mtl network parsec sendfile syb systemFilepath
     text time transformers transformersBase utf8String xhtml zlib
   ];
+  patchPhase = ''
+    sed -i -e 's|base64-bytestring.*,|base64-bytestring,|' happstack-server.cabal
+  '';
   meta = {
     homepage = "http://happstack.com";
     description = "Web related tools and services";
diff --git a/pkgs/development/libraries/haskell/hashable/default.nix b/pkgs/development/libraries/haskell/hashable/default.nix
index c706b020fef..96fe7ae0eb1 100644
--- a/pkgs/development/libraries/haskell/hashable/default.nix
+++ b/pkgs/development/libraries/haskell/hashable/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "hashable";
-  version = "1.1.2.3";
-  sha256 = "19v94b34c2j6f9d9xii2hg0mjxdkq51aifkcqw6hbicn97kfcxls";
+  version = "1.1.2.5";
+  sha256 = "0gbiaj5ck2bvvinndp2pg7qsm2h2izbnz9wi97dbm7i8r4qd9d9z";
   buildDepends = [ text ];
   meta = {
     homepage = "http://github.com/tibbe/hashable";
diff --git a/pkgs/development/libraries/haskell/highlighting-kate/default.nix b/pkgs/development/libraries/haskell/highlighting-kate/default.nix
index d92d15d2a16..55051901206 100644
--- a/pkgs/development/libraries/haskell/highlighting-kate/default.nix
+++ b/pkgs/development/libraries/haskell/highlighting-kate/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "highlighting-kate";
-  version = "0.5.1";
-  sha256 = "0l0g71rg7cs9rm4i04h88fm20868s0kf2da89297xlrm58zfv0jj";
+  version = "0.5.2";
+  sha256 = "1a3aifknbxm3v0lvqisdc6zqgki9x9z12jdrmijxmxq1riwwalr2";
   isLibrary = true;
   isExecutable = true;
   buildDepends = [ blazeHtml filepath mtl parsec regexPcreBuiltin ];
diff --git a/pkgs/development/libraries/haskell/hledger-lib/default.nix b/pkgs/development/libraries/haskell/hledger-lib/default.nix
index ef244bcb768..644406ae1ec 100644
--- a/pkgs/development/libraries/haskell/hledger-lib/default.nix
+++ b/pkgs/development/libraries/haskell/hledger-lib/default.nix
@@ -10,6 +10,9 @@ cabal.mkDerivation (self: {
     cmdargs csv filepath HUnit mtl parsec regexpr safe shakespeareText
     split time transformers utf8String
   ];
+  patchPhase = ''
+    sed -i -e 's|,split.*|,split|' hledger-lib.cabal
+  '';
   meta = {
     homepage = "http://hledger.org";
     description = "Core data types, parsers and utilities for the hledger accounting tool";
diff --git a/pkgs/development/libraries/haskell/hledger/default.nix b/pkgs/development/libraries/haskell/hledger/default.nix
index 815ca1b87fd..efc2936f406 100644
--- a/pkgs/development/libraries/haskell/hledger/default.nix
+++ b/pkgs/development/libraries/haskell/hledger/default.nix
@@ -13,6 +13,9 @@ cabal.mkDerivation (self: {
     cabalFileTh cmdargs filepath haskeline hledgerLib HUnit mtl parsec
     regexpr safe shakespeareText split text time utf8String
   ];
+  patchPhase = ''
+    sed -i -e 's|,split.*|,split|' hledger.cabal
+  '';
   meta = {
     homepage = "http://hledger.org";
     description = "The main command-line interface for the hledger accounting tool";
diff --git a/pkgs/development/libraries/haskell/hoogle/default.nix b/pkgs/development/libraries/haskell/hoogle/default.nix
index db5dc38e38f..e13ab47beaa 100644
--- a/pkgs/development/libraries/haskell/hoogle/default.nix
+++ b/pkgs/development/libraries/haskell/hoogle/default.nix
@@ -5,8 +5,8 @@
 
 cabal.mkDerivation (self: {
   pname = "hoogle";
-  version = "4.2.12";
-  sha256 = "1j726bm8sx4qamaib6l14s4a4jz4z6szhj1vk8n5b6f3g38s7hwy";
+  version = "4.2.13";
+  sha256 = "0asw9lr22d8jxr58b7w2j5hgllxhw2w8kllh5aq5jjs272hjiy9i";
   isLibrary = true;
   isExecutable = true;
   buildDepends = [
diff --git a/pkgs/development/libraries/haskell/http-conduit/default.nix b/pkgs/development/libraries/haskell/http-conduit/default.nix
index 6d1c7a28a22..9c0efe3f05c 100644
--- a/pkgs/development/libraries/haskell/http-conduit/default.nix
+++ b/pkgs/development/libraries/haskell/http-conduit/default.nix
@@ -8,8 +8,8 @@
 
 cabal.mkDerivation (self: {
   pname = "http-conduit";
-  version = "1.5.0.3";
-  sha256 = "1l00wyisb5jkq1c2ikzq0iwhjx6s66bz5s8gricfbrr15bdx1iay";
+  version = "1.6.0";
+  sha256 = "1vr4kglmlqn6s31ks231qx4b8034p6yi0501h3zswpqyf5cimhl7";
   buildDepends = [
     asn1Data attoparsec attoparsecConduit base64Bytestring blazeBuilder
     blazeBuilderConduit caseInsensitive certificate conduit cookie
diff --git a/pkgs/development/libraries/haskell/http-types/default.nix b/pkgs/development/libraries/haskell/http-types/default.nix
index 2dcd97e0aef..14d347f39f5 100644
--- a/pkgs/development/libraries/haskell/http-types/default.nix
+++ b/pkgs/development/libraries/haskell/http-types/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "http-types";
-  version = "0.7.1";
-  sha256 = "1vfaffraiqdsjbw4b0xwk8h8d4pl94mbxlwyqk8ry786v9aafyqx";
+  version = "0.7.3";
+  sha256 = "1s2y2fl9l75xd6fls9ajasn37i7cqxfw772rkw50d3vxvk2fdxjh";
   buildDepends = [ blazeBuilder caseInsensitive text ];
   meta = {
     homepage = "https://github.com/aristidb/http-types";
diff --git a/pkgs/development/libraries/haskell/io-choice/default.nix b/pkgs/development/libraries/haskell/io-choice/default.nix
index 85e49f5a67f..f8b1f1d51a4 100644
--- a/pkgs/development/libraries/haskell/io-choice/default.nix
+++ b/pkgs/development/libraries/haskell/io-choice/default.nix
@@ -3,8 +3,8 @@
 
 cabal.mkDerivation (self: {
   pname = "io-choice";
-  version = "0.0.1";
-  sha256 = "0jwxqs65g88q9l0w4xzllj7svz3qr2zgiaq2fyq5jmh33lz74r63";
+  version = "0.0.2";
+  sha256 = "0kxn357cc31gvaajg41h6xwpivq049dl1zd551xfvrvzndvy061f";
   buildDepends = [
     liftedBase monadControl transformers transformersBase
   ];
diff --git a/pkgs/development/libraries/haskell/lifted-base/default.nix b/pkgs/development/libraries/haskell/lifted-base/default.nix
index ba5e580ada0..09264ab57f4 100644
--- a/pkgs/development/libraries/haskell/lifted-base/default.nix
+++ b/pkgs/development/libraries/haskell/lifted-base/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "lifted-base";
-  version = "0.1.1.1";
-  sha256 = "1cfk3n12qhyrrfvw410gfydbgmb7r9y65fsjp2r3c4ilcyd5li70";
+  version = "0.1.2";
+  sha256 = "0js94dlfy2wjl026jcj2l399ly4zgw0cgxkmil6lsm34gcy9vrvq";
   buildDepends = [
     baseUnicodeSymbols monadControl transformersBase
   ];
diff --git a/pkgs/development/libraries/haskell/mime-mail/default.nix b/pkgs/development/libraries/haskell/mime-mail/default.nix
index 37e76284919..9abc588a0e7 100644
--- a/pkgs/development/libraries/haskell/mime-mail/default.nix
+++ b/pkgs/development/libraries/haskell/mime-mail/default.nix
@@ -7,6 +7,9 @@ cabal.mkDerivation (self: {
   buildDepends = [
     base64Bytestring blazeBuilder filepath random text
   ];
+  patchPhase = ''
+    sed -i -e 's|, base64-bytestring.*|, base64-bytestring|' mime-mail.cabal
+  '';
   meta = {
     homepage = "http://github.com/snoyberg/mime-mail";
     description = "Compose MIME email messages";
diff --git a/pkgs/development/libraries/haskell/mwc-random/default.nix b/pkgs/development/libraries/haskell/mwc-random/default.nix
index 27dabe57f32..1e2d56147c3 100644
--- a/pkgs/development/libraries/haskell/mwc-random/default.nix
+++ b/pkgs/development/libraries/haskell/mwc-random/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "mwc-random";
-  version = "0.12.0.0";
-  sha256 = "0c1gzf5nkcbfi2zlhh7ly8b4g2gcr0c1b76awk38g9as9qibgivr";
+  version = "0.12.0.1";
+  sha256 = "1sq4yxi231ka8rzwsihqziibs7amvl27ycr018wymm3yz36vsy7c";
   buildDepends = [ primitive time vector ];
   meta = {
     homepage = "https://github.com/bos/mwc-random";
diff --git a/pkgs/development/libraries/haskell/network/2.3.0.14.nix b/pkgs/development/libraries/haskell/network/2.3.1.0.nix
index bbc43abc42b..28fa50d8342 100644
--- a/pkgs/development/libraries/haskell/network/2.3.0.14.nix
+++ b/pkgs/development/libraries/haskell/network/2.3.1.0.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "network";
-  version = "2.3.0.14";
-  sha256 = "0naqg7ai50m3p093mi342w2z0flaagarf9n9smkn1dqvq8jg75x5";
+  version = "2.3.1.0";
+  sha256 = "1fp25wkl5cc4kx0jv5w02b7pzgqadjg1yrknzzwsqxc5s3cpyz6l";
   buildDepends = [ parsec ];
   meta = {
     homepage = "http://github.com/haskell/network";
diff --git a/pkgs/development/libraries/haskell/pandoc/default.nix b/pkgs/development/libraries/haskell/pandoc/default.nix
index c1aabed388b..8f34d2d88a0 100644
--- a/pkgs/development/libraries/haskell/pandoc/default.nix
+++ b/pkgs/development/libraries/haskell/pandoc/default.nix
@@ -15,6 +15,9 @@ cabal.mkDerivation (self: {
     highlightingKate HTTP json mtl network pandocTypes parsec random
     syb tagsoup temporary texmath time utf8String xml zipArchive zlib
   ];
+  patchPhase = ''
+    sed -i -e 's|base64-bytestring.*,|base64-bytestring,|' pandoc.cabal
+  '';
   meta = {
     homepage = "http://johnmacfarlane.net/pandoc";
     description = "Conversion between markup formats";
diff --git a/pkgs/development/libraries/haskell/postgresql-libpq/default.nix b/pkgs/development/libraries/haskell/postgresql-libpq/default.nix
index 19f729a5641..040c931d1f6 100644
--- a/pkgs/development/libraries/haskell/postgresql-libpq/default.nix
+++ b/pkgs/development/libraries/haskell/postgresql-libpq/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "postgresql-libpq";
-  version = "0.8.2";
-  sha256 = "10i3yc5fxlmnrb8j9p2a9w7h49p3ain36qpshlb34chdk9xh3l7g";
+  version = "0.8.2.1";
+  sha256 = "0fjy451gc9lg3kcglq4s5s3hja8ni3adh4jmxd01kfyvyhwggv4d";
   extraLibraries = [ postgresql ];
   meta = {
     homepage = "http://github.com/lpsmith/postgresql-libpq";
diff --git a/pkgs/development/libraries/haskell/postgresql-simple/default.nix b/pkgs/development/libraries/haskell/postgresql-simple/default.nix
index da78cafde6c..28b5c0dec85 100644
--- a/pkgs/development/libraries/haskell/postgresql-simple/default.nix
+++ b/pkgs/development/libraries/haskell/postgresql-simple/default.nix
@@ -4,8 +4,8 @@
 
 cabal.mkDerivation (self: {
   pname = "postgresql-simple";
-  version = "0.2.3.0";
-  sha256 = "0lbvd7mq7xqz1cala4vvw5zj96sbqi0qqnmfj5h0844ci2f25i97";
+  version = "0.2.4.0";
+  sha256 = "1n1s650j4z82cz34rq9qgj805yc9x852snnqjaa1iwrg9i3r150f";
   buildDepends = [
     attoparsec blazeBuilder blazeTextual postgresqlLibpq text time
     transformers vector
diff --git a/pkgs/development/libraries/haskell/process-extras/default.nix b/pkgs/development/libraries/haskell/process-extras/default.nix
index 437347749ba..ac2950d4927 100644
--- a/pkgs/development/libraries/haskell/process-extras/default.nix
+++ b/pkgs/development/libraries/haskell/process-extras/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "process-extras";
-  version = "0.1.1";
-  sha256 = "0qnkclmjd5y0jpdxp4y2ynqlcdlsvck65269k0j4hy5zkyydbpv6";
+  version = "0.1.3";
+  sha256 = "16hm1w34qnrpb6x8gaqv1bs1cd4p98kayf23275s6vd48kw9v0b0";
   buildDepends = [ text ];
   meta = {
     homepage = "https://github.com/davidlazar/process-extras";
diff --git a/pkgs/development/libraries/haskell/semigroups/default.nix b/pkgs/development/libraries/haskell/semigroups/default.nix
index 8ca726c7eff..795c690d7a2 100644
--- a/pkgs/development/libraries/haskell/semigroups/default.nix
+++ b/pkgs/development/libraries/haskell/semigroups/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "semigroups";
-  version = "0.8.3.2";
-  sha256 = "0g433l4rinc6r2yr91jnl6wh5b2kn5vsrp08cmznkgaz45lb7n7c";
+  version = "0.8.4";
+  sha256 = "0xphwxxzddgcw2hr4h60l3y27f1x032w049wkjs71f5hdypwapv4";
   meta = {
     homepage = "http://github.com/ekmett/semigroups/";
     description = "Haskell 98 semigroups";
diff --git a/pkgs/development/libraries/haskell/shakespeare-css/default.nix b/pkgs/development/libraries/haskell/shakespeare-css/default.nix
index 3c48a51ea9b..a64e9acc7d7 100644
--- a/pkgs/development/libraries/haskell/shakespeare-css/default.nix
+++ b/pkgs/development/libraries/haskell/shakespeare-css/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "shakespeare-css";
-  version = "1.0.1.3";
-  sha256 = "1jj609fcp14b7nzjzsiiy0apbdmap2wi7vlyzdhadirjskxvsvc1";
+  version = "1.0.1.4";
+  sha256 = "0avixf7z3hcvgcijgrm7hisr8i8waa8nb435gv8lv5vvz8yq3k0n";
   buildDepends = [ parsec shakespeare text ];
   meta = {
     homepage = "http://www.yesodweb.com/book/shakespearean-templates";
diff --git a/pkgs/development/libraries/haskell/shakespeare-js/default.nix b/pkgs/development/libraries/haskell/shakespeare-js/default.nix
index fee4d901350..ff2f0c09e0c 100644
--- a/pkgs/development/libraries/haskell/shakespeare-js/default.nix
+++ b/pkgs/development/libraries/haskell/shakespeare-js/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "shakespeare-js";
-  version = "1.0.0.4";
-  sha256 = "19v5jas2lcbya1x3mm3fhvhwk643vyy8vpfx0zk3gsw91h34pkyf";
+  version = "1.0.0.5";
+  sha256 = "1d4na2q1q798ki5f84gpf89ri26qmrxqrwbw7mmlrfwkj1qw69rs";
   buildDepends = [ shakespeare text ];
   meta = {
     homepage = "http://www.yesodweb.com/book/shakespearean-templates";
diff --git a/pkgs/development/libraries/haskell/shakespeare-text/default.nix b/pkgs/development/libraries/haskell/shakespeare-text/default.nix
index 9f4548d39bf..fbc31e3eda1 100644
--- a/pkgs/development/libraries/haskell/shakespeare-text/default.nix
+++ b/pkgs/development/libraries/haskell/shakespeare-text/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "shakespeare-text";
-  version = "1.0.0.3";
-  sha256 = "0rwdlx7926gjkjymn3h6fdw1ic6s44nn5h8r8791gxknz668ydd7";
+  version = "1.0.0.4";
+  sha256 = "14kas2m7kbv1f49qpx6z097r707l3gqp9lwvh0q42cc6rlwab5l7";
   buildDepends = [ shakespeare text ];
   meta = {
     homepage = "http://www.yesodweb.com/book/shakespearean-templates";
diff --git a/pkgs/development/libraries/haskell/shakespeare/default.nix b/pkgs/development/libraries/haskell/shakespeare/default.nix
index 0e569d835fb..1619cc6760c 100644
--- a/pkgs/development/libraries/haskell/shakespeare/default.nix
+++ b/pkgs/development/libraries/haskell/shakespeare/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "shakespeare";
-  version = "1.0.1";
-  sha256 = "1qs2n16ncrw4c98lqzgxhxa5mi7aiq1q0gwq7m9mr32jv7qzwgcv";
+  version = "1.0.1.1";
+  sha256 = "0w5dcli9gbmbpfg8rd8bia7wfll4iisi2cbdwdhbnn159mw8s25x";
   buildDepends = [ parsec text ];
   meta = {
     homepage = "http://www.yesodweb.com/book/shakespearean-templates";
diff --git a/pkgs/development/libraries/haskell/simple-sendfile/default.nix b/pkgs/development/libraries/haskell/simple-sendfile/default.nix
index 766e1ef9617..20bdca91bb3 100644
--- a/pkgs/development/libraries/haskell/simple-sendfile/default.nix
+++ b/pkgs/development/libraries/haskell/simple-sendfile/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "simple-sendfile";
-  version = "0.2.5";
-  sha256 = "1g9plryh86lc03rf1s8m36wyc2yqp4y6f02viq9c4g1k85rkbs53";
+  version = "0.2.6";
+  sha256 = "1bv8lmpp1h89kx614ijyi5kyqsf4nj75zdarjwxm7is6ixp3rnha";
   buildDepends = [ network ];
   meta = {
     description = "Cross platform library for the sendfile system call";
diff --git a/pkgs/development/libraries/haskell/skein/default.nix b/pkgs/development/libraries/haskell/skein/default.nix
index 143bf530d09..5a4afd9309b 100644
--- a/pkgs/development/libraries/haskell/skein/default.nix
+++ b/pkgs/development/libraries/haskell/skein/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "skein";
-  version = "0.1.0.7";
-  sha256 = "13yhbp17iq30cjh9fid3l0wkyvpj0f1b1bak9s7gfj96basg9ig2";
+  version = "0.1.0.8";
+  sha256 = "0d0xrrcagf663rn37gpr13jyvfm7rnil18mz4miavb4hwzni46rm";
   buildDepends = [ cereal cryptoApi tagged ];
   meta = {
     homepage = "https://github.com/meteficha/skein";
diff --git a/pkgs/development/libraries/haskell/split/0.1.nix b/pkgs/development/libraries/haskell/split/0.1.nix
new file mode 100644
index 00000000000..ad0df5c2cb0
--- /dev/null
+++ b/pkgs/development/libraries/haskell/split/0.1.nix
@@ -0,0 +1,13 @@
+{ cabal }:
+
+cabal.mkDerivation (self: {
+  pname = "split";
+  version = "0.1.4.3";
+  sha256 = "1i9vmb0zvmhqj6qcbnsapsk9lhsyzznz336c8s7v4sz20s99hsby";
+  meta = {
+    homepage = "http://code.haskell.org/~byorgey/code/split";
+    description = "Combinator library for splitting lists";
+    license = self.stdenv.lib.licenses.bsd3;
+    platforms = self.ghc.meta.platforms;
+  };
+})
diff --git a/pkgs/development/libraries/haskell/split/default.nix b/pkgs/development/libraries/haskell/split/default.nix
index 33f927e3d57..42d33d10a06 100644
--- a/pkgs/development/libraries/haskell/split/default.nix
+++ b/pkgs/development/libraries/haskell/split/default.nix
@@ -2,10 +2,9 @@
 
 cabal.mkDerivation (self: {
   pname = "split";
-  version = "0.1.4.3";
-  sha256 = "1i9vmb0zvmhqj6qcbnsapsk9lhsyzznz336c8s7v4sz20s99hsby";
+  version = "0.2.0.0";
+  sha256 = "1gk0nx6bw5j9gxaa6ki70wqszbllz7c1ccfnwg49fl3qfabg1i7c";
   meta = {
-    homepage = "http://code.haskell.org/~byorgey/code/split";
     description = "Combinator library for splitting lists";
     license = self.stdenv.lib.licenses.bsd3;
     platforms = self.ghc.meta.platforms;
diff --git a/pkgs/development/libraries/haskell/tagsoup/default.nix b/pkgs/development/libraries/haskell/tagsoup/default.nix
index f6d2dd29dbf..78f52a3ad32 100644
--- a/pkgs/development/libraries/haskell/tagsoup/default.nix
+++ b/pkgs/development/libraries/haskell/tagsoup/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "tagsoup";
-  version = "0.12.6";
-  sha256 = "1q1dzsaj131fcvibka72i7si1i0gxkz5d9zl0akd8mbapy5mmlv5";
+  version = "0.12.7";
+  sha256 = "0f4f0552n9qkycvh01jyk52190nk4frlp9za8vyczayrm3vmw268";
   isLibrary = true;
   isExecutable = true;
   buildDepends = [ text ];
diff --git a/pkgs/development/libraries/haskell/text/0.11.2.2.nix b/pkgs/development/libraries/haskell/text/0.11.2.3.nix
index a4dc9f88277..e1f0c6ea72d 100644
--- a/pkgs/development/libraries/haskell/text/0.11.2.2.nix
+++ b/pkgs/development/libraries/haskell/text/0.11.2.3.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "text";
-  version = "0.11.2.2";
-  sha256 = "0ch0fiwjwkpiwamfxxbcka2gp6lbwpqcv7pmik6qm850163f4i33";
+  version = "0.11.2.3";
+  sha256 = "0jrl3qbi91gkcnws9crsa59jsmmbjy91fwvl07qka9m48nq3f9rm";
   buildDepends = [ deepseq ];
   meta = {
     homepage = "https://github.com/bos/text";
diff --git a/pkgs/development/libraries/haskell/threadmanager/default.nix b/pkgs/development/libraries/haskell/threadmanager/default.nix
index 776a2422265..dc058844247 100644
--- a/pkgs/development/libraries/haskell/threadmanager/default.nix
+++ b/pkgs/development/libraries/haskell/threadmanager/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "threadmanager";
-  version = "0.1.4";
-  sha256 = "0p35ihdc9k9svzbwiszll5i53km09rvw5mqshph273fby7nvni9i";
+  version = "0.1.5";
+  sha256 = "0jdr0rrpx7frnh0a2vibg0170w48wvn6gv8imkiqiz6y6481ny5p";
   meta = {
     homepage = "http://github.com/bsl/threadmanager";
     description = "Simple thread management";
diff --git a/pkgs/development/libraries/haskell/tls/default.nix b/pkgs/development/libraries/haskell/tls/default.nix
index 3a225361fb3..d440d942277 100644
--- a/pkgs/development/libraries/haskell/tls/default.nix
+++ b/pkgs/development/libraries/haskell/tls/default.nix
@@ -4,8 +4,8 @@
 
 cabal.mkDerivation (self: {
   pname = "tls";
-  version = "0.9.8";
-  sha256 = "022hak5wy47j4zpf2f89zvz4j2586s3d0a5jkxvz54dkqimy63r6";
+  version = "0.9.9";
+  sha256 = "0l29ja7mcyykj4dh7awjbrb9aswgarxls71vk68pdfaz047jsvx6";
   isLibrary = true;
   isExecutable = true;
   buildDepends = [
diff --git a/pkgs/development/libraries/haskell/unbound/default.nix b/pkgs/development/libraries/haskell/unbound/default.nix
index 466285d3e55..a90381202e1 100644
--- a/pkgs/development/libraries/haskell/unbound/default.nix
+++ b/pkgs/development/libraries/haskell/unbound/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "unbound";
-  version = "0.4.1";
-  sha256 = "1fryjs5byyqha945qy8vyfpq4fzjmnh0jc01wzvk6ri292qipsyn";
+  version = "0.4.1.1";
+  sha256 = "0niv8mm4zjkndj0g32dgr32177dfp647hi32hqzwiis77vcfvdzb";
   buildDepends = [ mtl RepLib transformers ];
   meta = {
     homepage = "http://code.google.com/p/replib/";
diff --git a/pkgs/development/libraries/haskell/unix-time/default.nix b/pkgs/development/libraries/haskell/unix-time/default.nix
index 308e59ba254..61d8f86189d 100644
--- a/pkgs/development/libraries/haskell/unix-time/default.nix
+++ b/pkgs/development/libraries/haskell/unix-time/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "unix-time";
-  version = "0.1.1";
-  sha256 = "1b7njfs33vqmprpmbpi8hvy1lc5ryvdiy5526q8s7vkzsi2iky1p";
+  version = "0.1.2";
+  sha256 = "146m4b93bla0pbf76bmff6f3aq9zx60cwy58mkqa0a4dyndd3pid";
   meta = {
     description = "Unix time parser/formatter and utilities";
     license = self.stdenv.lib.licenses.bsd3;
diff --git a/pkgs/development/libraries/haskell/unordered-containers/default.nix b/pkgs/development/libraries/haskell/unordered-containers/default.nix
index 21ec0c92b06..e6ff0dd64b9 100644
--- a/pkgs/development/libraries/haskell/unordered-containers/default.nix
+++ b/pkgs/development/libraries/haskell/unordered-containers/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "unordered-containers";
-  version = "0.2.1.0";
-  sha256 = "0zk2ip32h6faqa1pfmiw242fdarr63lds4j828ix7qhrjifwiw4p";
+  version = "0.2.2.0";
+  sha256 = "1418vr7swk2p1xjxyj86arln6niwgpfjfqdknnkh31m4h83f0q5r";
   buildDepends = [ deepseq hashable ];
   meta = {
     description = "Efficient hashing-based container types";
diff --git a/pkgs/development/libraries/haskell/uu-parsinglib/default.nix b/pkgs/development/libraries/haskell/uu-parsinglib/default.nix
index 8e2ad732aa2..1bb3cb76dac 100644
--- a/pkgs/development/libraries/haskell/uu-parsinglib/default.nix
+++ b/pkgs/development/libraries/haskell/uu-parsinglib/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "uu-parsinglib";
-  version = "2.7.3.2";
-  sha256 = "0z53s9wvk57g3d9x3iswjydwm7nw5vfrj7k08v75fw6rwldkal60";
+  version = "2.7.3.4";
+  sha256 = "1f582cr17qxwrhxx6pdv503ldm4ccbnbv9pcksibgparfyc25bnv";
   buildDepends = [ ListLike time ];
   meta = {
     homepage = "http://www.cs.uu.nl/wiki/bin/view/HUT/ParserCombinators";
diff --git a/pkgs/development/libraries/haskell/vault/default.nix b/pkgs/development/libraries/haskell/vault/default.nix
index 84fd27a3642..4d74884a1a7 100644
--- a/pkgs/development/libraries/haskell/vault/default.nix
+++ b/pkgs/development/libraries/haskell/vault/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "vault";
-  version = "0.2.0.0";
-  sha256 = "1hv87kvi2bwf9ff8mhjzdf8rvqhk1xpschzs1x3swadj1kc9f1sv";
+  version = "0.2.0.1";
+  sha256 = "027wgbnmdnp98f0wvc9xsfh175n7rq8m2j9i7j1c5vxwgi61dqxq";
   buildDepends = [ hashable unorderedContainers ];
   meta = {
     homepage = "https://github.com/HeinrichApfelmus/vault";
diff --git a/pkgs/development/libraries/haskell/vector-algorithms/default.nix b/pkgs/development/libraries/haskell/vector-algorithms/default.nix
index f98cc09918a..2704942b360 100644
--- a/pkgs/development/libraries/haskell/vector-algorithms/default.nix
+++ b/pkgs/development/libraries/haskell/vector-algorithms/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "vector-algorithms";
-  version = "0.5.4";
-  sha256 = "0j16jmnmgksbzsq2vvxjmciywi91clak77i6zjjghvn9dpmnsmv2";
+  version = "0.5.4.1";
+  sha256 = "00dikjmy1pyyn3mmq7sjnmd91xcg7q3n3yiil3dqi1fgr0787xng";
   buildDepends = [ primitive vector ];
   meta = {
     homepage = "http://code.haskell.org/~dolio/";
diff --git a/pkgs/development/libraries/haskell/wai-app-static/default.nix b/pkgs/development/libraries/haskell/wai-app-static/default.nix
index ea4ddd7ae82..e1f2cb9116d 100644
--- a/pkgs/development/libraries/haskell/wai-app-static/default.nix
+++ b/pkgs/development/libraries/haskell/wai-app-static/default.nix
@@ -13,7 +13,10 @@ cabal.mkDerivation (self: {
     cryptoConduit cryptohash fileEmbed httpDate httpTypes mimeTypes
     systemFileio systemFilepath text time transformers unixCompat wai
   ];
-  meta = {
+  patchPhase = ''
+    sed -i -e 's|, base64-bytestring.*|, base64-bytestring|' wai-app-static.cabal
+  '';
+    meta = {
     homepage = "http://www.yesodweb.com/book/wai";
     description = "WAI application for static serving";
     license = self.stdenv.lib.licenses.mit;
diff --git a/pkgs/development/libraries/haskell/wl-pprint-text/default.nix b/pkgs/development/libraries/haskell/wl-pprint-text/default.nix
index 0db3ef08060..083f269255a 100644
--- a/pkgs/development/libraries/haskell/wl-pprint-text/default.nix
+++ b/pkgs/development/libraries/haskell/wl-pprint-text/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "wl-pprint-text";
-  version = "1.0.0.0";
-  sha256 = "1zvjsbn98g0lja2jj00d7mvqjq4rik7v7wsy5655wibmy0hbll90";
+  version = "1.1.0.0";
+  sha256 = "18xgsrxg20sk18m9dwds6161vl4hgdp052qbb0cg9jqy50vhddis";
   buildDepends = [ text ];
   meta = {
     description = "A Wadler/Leijen Pretty Printer for Text values";
diff --git a/pkgs/development/libraries/haskell/yesod-auth/default.nix b/pkgs/development/libraries/haskell/yesod-auth/default.nix
index a540c56e54c..fdb6b0e3f60 100644
--- a/pkgs/development/libraries/haskell/yesod-auth/default.nix
+++ b/pkgs/development/libraries/haskell/yesod-auth/default.nix
@@ -7,8 +7,8 @@
 
 cabal.mkDerivation (self: {
   pname = "yesod-auth";
-  version = "1.1.0";
-  sha256 = "1bvvd1fl2id7zw51g5mrm047zm2jy5hr5l1xxas6zin2dv0ix5p1";
+  version = "1.1.1";
+  sha256 = "03zywcdv8kb0h8hpdg1zb3c10s6y6j3gg64n8w970f0izi93haxv";
   buildDepends = [
     aeson authenticate blazeHtml blazeMarkup hamlet httpConduit
     liftedBase mimeMail persistent persistentTemplate pureMD5
diff --git a/pkgs/development/libraries/haskell/yesod-core/default.nix b/pkgs/development/libraries/haskell/yesod-core/default.nix
index 558c7fe6ea5..219a83e1e96 100644
--- a/pkgs/development/libraries/haskell/yesod-core/default.nix
+++ b/pkgs/development/libraries/haskell/yesod-core/default.nix
@@ -9,8 +9,8 @@
 
 cabal.mkDerivation (self: {
   pname = "yesod-core";
-  version = "1.1.0";
-  sha256 = "01jxb6skpwckvkgar847limqrcl91l50pr7iza2sfp0a6j5a2hmk";
+  version = "1.1.1";
+  sha256 = "1rq0zdn9d6f34s7wnnr32hnbz23z8bvz3j2ylv8sz5h3nwmbfz99";
   buildDepends = [
     aeson blazeBuilder blazeHtml blazeMarkup caseInsensitive cereal
     clientsession conduit cookie failure fastLogger hamlet httpTypes
diff --git a/pkgs/development/libraries/haskell/yesod-form/default.nix b/pkgs/development/libraries/haskell/yesod-form/default.nix
index 172a83d8a95..35a0adc2592 100644
--- a/pkgs/development/libraries/haskell/yesod-form/default.nix
+++ b/pkgs/development/libraries/haskell/yesod-form/default.nix
@@ -6,8 +6,8 @@
 
 cabal.mkDerivation (self: {
   pname = "yesod-form";
-  version = "1.1.0";
-  sha256 = "1xig1va8qya78g6rlymz2w2ncyp8fj76sinyhjpr1ikw8my5hgw0";
+  version = "1.1.1";
+  sha256 = "04wlfhaqx7qg904n6f1yz00m3c2sa5ywbhz6m0pmzfm9a7byggcc";
   buildDepends = [
     attoparsec blazeBuilder blazeHtml blazeMarkup cryptoApi dataDefault
     emailValidate hamlet network persistent shakespeareCss
diff --git a/pkgs/development/libraries/haskell/yesod/default.nix b/pkgs/development/libraries/haskell/yesod/default.nix
index 9a9e9d9c9e8..eeb2e376680 100644
--- a/pkgs/development/libraries/haskell/yesod/default.nix
+++ b/pkgs/development/libraries/haskell/yesod/default.nix
@@ -8,8 +8,8 @@
 
 cabal.mkDerivation (self: {
   pname = "yesod";
-  version = "1.1.0";
-  sha256 = "01jwp9i77rmk4iwjqri9jafm809nzlb5bvgyz5my8dnpcfvnf2sz";
+  version = "1.1.0.2";
+  sha256 = "0r89sg0nnv3x46l9z39gn109a38jzr46lgx33v18268maqlc7brb";
   isLibrary = true;
   isExecutable = true;
   buildDepends = [
diff --git a/pkgs/development/libraries/haskell/zlib-bindings/default.nix b/pkgs/development/libraries/haskell/zlib-bindings/default.nix
index d5557eae390..3bb9d314957 100644
--- a/pkgs/development/libraries/haskell/zlib-bindings/default.nix
+++ b/pkgs/development/libraries/haskell/zlib-bindings/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "zlib-bindings";
-  version = "0.1.0.1";
-  sha256 = "0r1hjmmxb9kz5fvfrjvzjd0pnhb87vyldqvb73yjq35s16bj4vlc";
+  version = "0.1.1";
+  sha256 = "0hgqr7sh3pri482191gd9qrz2nbgxw1aqdx1x6lc9s0bbw68isai";
   buildDepends = [ zlib ];
   meta = {
     homepage = "http://github.com/snoyberg/zlib-bindings";
diff --git a/pkgs/development/libraries/java/rhino/default.nix b/pkgs/development/libraries/java/rhino/default.nix
index 800ae7ba718..3e666c9fa23 100644
--- a/pkgs/development/libraries/java/rhino/default.nix
+++ b/pkgs/development/libraries/java/rhino/default.nix
@@ -5,7 +5,7 @@ let
   options = "-Dbuild.compiler=gcj";   # FIXME: We assume GCJ here.
 
   xbeans  = fetchurl {
-    url = "http://www.apache.org/dist/xmlbeans/binaries/xmlbeans-2.2.0.zip";
+    url = "http://archive.apache.org/dist/xmlbeans/binaries/xmlbeans-2.2.0.zip";
     sha256 = "1pb08d9j81d0wz5wj31idz198iwhqb7mch872n08jh1354rjlqwk";
   };
 in
diff --git a/pkgs/development/libraries/liblockfile/default.nix b/pkgs/development/libraries/liblockfile/default.nix
new file mode 100644
index 00000000000..2db90845f69
--- /dev/null
+++ b/pkgs/development/libraries/liblockfile/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  _name   = "liblockfile";
+  version = "1.09";
+  name    = "${_name}-${version}";
+
+  src = fetchurl {
+    url = "mirror://debian/pool/main/libl/${_name}/${_name}_${version}.orig.tar.gz";
+    sha256 = "0zqvbxls1632wqfhv4v3q2djzlz9391h0wdgsvhnaqrr0nx9x5qn";
+  };
+
+  preConfigure = ''
+    sed -i -e 's/install -g [^ ]* /install /' Makefile.in
+  '';
+
+  preInstall = ''
+    mkdir -p $out/{bin,lib,include,man} $out/man/man{1,3}
+  '';
+
+
+  meta = {
+    description = "Liblockfile is a shared library with NFS-safe locking functions.";
+    homepage = http://packages.debian.org/unstable/libs/liblockfile1;
+    license = "GPLv2+";
+
+    maintainers = [ stdenv.lib.maintainers.bluescreen303 ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/pkgs/development/libraries/nss/default.nix b/pkgs/development/libraries/nss/default.nix
index 3b4d10eaa08..38e9d80d5b7 100644
--- a/pkgs/development/libraries/nss/default.nix
+++ b/pkgs/development/libraries/nss/default.nix
@@ -1,82 +1,81 @@
-{ stdenv, fetchurl, nspr, perl, zlib, includeTools ? false}:
+{ stdenv, fetchurl, fetchgit, nspr, perl, zlib, sqlite
+, includeTools ? false
+}:
 
 let
 
-  nssConfig = fetchurl {
-    url = "http://sources.gentoo.org/viewcvs.py/*checkout*/gentoo-x86/dev-libs/nss/files/3.12-nss-config.in?rev=1.2";
-    sha256 = "1ck9q68fxkjq16nflixbqi4xc6bmylmj994h3f1j42g8mp0xf0vd";
+  nssPEM = fetchgit {
+    url = "git://git.fedorahosted.org/git/nss-pem.git";
+    rev = "07a683505d4a0a1113c4085c1ce117425d0afd80";
+    sha256 = "e4a9396d90e50e8b3cceff45f312eda9aaf356423f4eddd354a0e1afbbfd4cf8";
   };
 
-in
+  secLoadPatch = fetchurl {
+    url = "http://patch-tracker.debian.org/patch/series/dl/nss/2:3.13.5-1/85_security_load.patch";
+    sha256 = "8a8d0ae4ebbd7c389973fa5d26d8bc5f473046c6cb1d8283cb9a3c1f4c565c47";
+  };
 
-stdenv.mkDerivation {
-  name = "nss-3.13.3";
+in stdenv.mkDerivation rec {
+  name = "nss-${version}";
+  version = "3.13.6";
 
-  src = fetchurl {
-    url = http://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_13_3_RTM/src/nss-3.13.3.tar.gz;
-    sha256 = "efa10f2c70da4bddabf1a6081964969bb23359b93d6eadbf4739274a77bc3587";
+  src = let
+    uscoreVersion = stdenv.lib.replaceChars ["."] ["_"] version;
+    releasePath = "releases/NSS_${uscoreVersion}_RTM/src/nss-${version}.tar.gz";
+  in fetchurl {
+    url = "http://ftp.mozilla.org/pub/mozilla.org/security/nss/${releasePath}";
+    sha256 = "f7e90727e0ecc1c29de10da39a79bc9c53b814ccfbf40720e053b29c683d43a0";
   };
 
-  buildInputs = [nspr perl zlib];
+  buildInputs = [ nspr perl zlib sqlite ];
 
-  patches = [ ./nss-3.12.5-gentoo-fixups.diff ];
+  postUnpack = ''
+    cp -rdv "${nssPEM}/mozilla/security/nss/lib/ckfw/pem" \
+            "$sourceRoot/mozilla/security/nss/lib/ckfw/"
+    chmod -R u+w "$sourceRoot/mozilla/security/nss/lib/ckfw/pem"
+  '';
 
-  # Based on the build instructions at
-  # http://www.mozilla.org/projects/security/pki/nss/nss-3.11.4/nss-3.11.4-build.html
+  patches = [
+    ./nss-3.12.5-gentoo-fixups.diff
+    secLoadPatch
+    ./nix_secload_fixup.patch
+  ];
 
   postPatch = ''
+    sed -i -e 's/^DIRS.*$/& pem/' mozilla/security/nss/lib/ckfw/manifest.mn
     sed -i -e "/^PREFIX =/s:= /usr:= $out:" mozilla/security/nss/config/Makefile
   '';
 
   preConfigure = "cd mozilla/security/nss";
 
-  BUILD_OPT = "1";
-
-  makeFlags =
-    [ "NSPR_CONFIG_STATUS=" "NSDISTMODE=copy" "BUILD_OPT=1" "SOURCE_PREFIX=\$(out)"
-      "NSS_ENABLE_ECC=1"
-    ]
-    ++ stdenv.lib.optional stdenv.is64bit "USE_64=1";
-
-  buildFlags = "nss_build_all";
-
-  NIX_CFLAGS_COMPILE = "-I${nspr}/include/nspr";
-
-  preBuild =
-    ''
-      # Fool it into thinking NSPR has already been built.
-      touch build_nspr
-
-      # Hack to make -lz dependencies work.
-      touch cmd/signtool/-lz cmd/modutil/-lz
-    '';
-
-  postInstall =
-    ''
-      #find $out -name "*.a" | xargs rm
-      rm -rf $out/private
-      mv $out/public $out/include
-      mv $out/*.OBJ/* $out/
-      rmdir $out/*.OBJ
-      ${if includeTools then "" else "rm -rf $out/bin"}
-
-      # Borrowed from Gentoo.  Firefox expects an nss-config script,
-      # but NSS doesn't provide it.
-
-      NSS_VMAJOR=`cat lib/nss/nss.h | grep "#define.*NSS_VMAJOR" | awk '{print $3}'`
-      NSS_VMINOR=`cat lib/nss/nss.h | grep "#define.*NSS_VMINOR" | awk '{print $3}'`
-      NSS_VPATCH=`cat lib/nss/nss.h | grep "#define.*NSS_VPATCH" | awk '{print $3}'`
+  makeFlags = [
+    "NSPR_INCLUDE_DIR=${nspr}/include/nspr"
+    "NSPR_LIB_DIR=${nspr}/lib"
+    "NSDISTMODE=copy"
+    "BUILD_OPT=1"
+    "SOURCE_PREFIX=\$(out)"
+    "NSS_ENABLE_ECC=1"
+    "NSS_USE_SYSTEM_SQLITE=1"
+  ] ++ stdenv.lib.optional stdenv.is64bit "USE_64=1";
+
+  buildFlags = [ "build_coreconf" "build_dbm" "all" ];
+
+  postInstall = ''
+    rm -rf $out/private
+    mv $out/public $out/include
+    mv $out/*.OBJ/* $out/
+    rmdir $out/*.OBJ
+
+    cp -av config/nss-config $out/bin/nss-config
+  '';
 
-      ${if includeTools then "" else "mkdir $out/bin"}
-      cp ${nssConfig} $out/bin/nss-config
-      chmod u+x $out/bin/nss-config
-      substituteInPlace $out/bin/nss-config \
-        --subst-var-by MOD_MAJOR_VERSION $NSS_VMAJOR \
-        --subst-var-by MOD_MINOR_VERSION $NSS_VMINOR \
-        --subst-var-by MOD_PATCH_VERSION $NSS_VPATCH \
-        --subst-var-by prefix $out \
-        --subst-var-by exec_prefix $out \
-        --subst-var-by includedir $out/include/nss \
-        --subst-var-by libdir $out/lib
-    ''; # */
+  postFixup = ''
+    for libname in freebl3 nssdbm3 softokn3
+    do
+      libfile="$out/lib/lib$libname.so"
+      LD_LIBRARY_PATH=$out/lib $out/bin/shlibsign -v -i "$libfile"
+    done
+  '' + stdenv.lib.optionalString (!includeTools) ''
+    find $out/bin -type f \( -name nss-config -o -delete \)
+  '';
 }
diff --git a/pkgs/development/libraries/nss/nix_secload_fixup.patch b/pkgs/development/libraries/nss/nix_secload_fixup.patch
new file mode 100644
index 00000000000..960fe0ef7a7
--- /dev/null
+++ b/pkgs/development/libraries/nss/nix_secload_fixup.patch
@@ -0,0 +1,50 @@
+diff --git a/mozilla/security/coreconf/config.mk b/mozilla/security/coreconf/config.mk
+index 72557c6..bdcbf88 100644
+--- a/mozilla/security/coreconf/config.mk
++++ b/mozilla/security/coreconf/config.mk
+@@ -207,3 +207,5 @@ endif
+ DEFINES += -DUSE_UTIL_DIRECTLY
+ USE_UTIL_DIRECTLY = 1
+ 
++# nix specific stuff:
++DEFINES += -DNIX_NSS_LIBDIR=\"$(out)/lib/\"
+diff --git a/mozilla/security/nss/cmd/shlibsign/shlibsign.c b/mozilla/security/nss/cmd/shlibsign/shlibsign.c
+index 5ce626e..e1e8039 100644
+--- a/mozilla/security/nss/cmd/shlibsign/shlibsign.c
++++ b/mozilla/security/nss/cmd/shlibsign/shlibsign.c
+@@ -770,7 +770,7 @@ int main(int argc, char **argv)
+     assert(libname != NULL);
+     lib = PR_LoadLibrary(libname);
+     if (!lib)
+-        lib = PR_LoadLibrary("/usr/lib/nss/libsoftokn3.so");
++        lib = PR_LoadLibrary(NIX_NSS_LIBDIR"libsoftokn3.so");
+     assert(lib != NULL);
+     PR_FreeLibraryName(libname);
+ 
+diff --git a/mozilla/security/nss/lib/util/secload.c b/mozilla/security/nss/lib/util/secload.c
+index 7d6fc22..0b7759b 100644
+--- a/mozilla/security/nss/lib/util/secload.c
++++ b/mozilla/security/nss/lib/util/secload.c
+@@ -105,9 +105,9 @@ loader_LoadLibInReferenceDir(const char *referencePath, const char *name)
+     /* Remove the trailing filename from referencePath and add the new one */
+     c = strrchr(referencePath, PR_GetDirectorySeparator());
+     if (!c) { /* referencePath doesn't contain a / means that dladdr gave us argv[0]
+-               * and program was called from $PATH. Hack to get libs from /usr/lib */
+-        referencePath = "/usr/lib/";
+-        c = &referencePath[8]; /* last / */
++               * and program was called from $PATH. Hack to get libs from NIX_NSS_LIBDIR */
++        referencePath = NIX_NSS_LIBDIR;
++        c = &referencePath[sizeof(NIX_NSS_LIBDIR) - 1]; /* last / */
+     }
+     if (c) {
+         size_t referencePathSize = 1 + c - referencePath;
+@@ -125,8 +125,7 @@ loader_LoadLibInReferenceDir(const char *referencePath, const char *name)
+                 (strncmp(fullName + referencePathSize - 4, "bin", 3) == 0)) {
+                 memcpy(fullName + referencePathSize -4, "lib", 3);
+             }
+-            strcpy(fullName + referencePathSize, "nss/");
+-            strcpy(fullName + referencePathSize + 4, name);
++            strcpy(fullName + referencePathSize, name);
+             dlh = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW | PR_LD_LOCAL
+ #ifdef PR_LD_ALT_SEARCH_PATH
+             /* allow library's dependencies to be found in the same directory
diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index cd164b13f8e..575b57eb872 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -23,6 +23,11 @@ let
            ./gnu.patch                # submitted upstream
          ]
 
+    ++ stdenv.lib.optionals (stdenv.system == "x86_64-kfreebsd-gnu")
+        [ ./gnu.patch
+          ./kfreebsd-gnu.patch
+        ]
+
     ++ stdenv.lib.optional stdenv.isDarwin ./darwin-arch.patch;
   
 in
diff --git a/pkgs/development/libraries/openssl/kfreebsd-gnu.patch b/pkgs/development/libraries/openssl/kfreebsd-gnu.patch
new file mode 100644
index 00000000000..66cedf746ba
--- /dev/null
+++ b/pkgs/development/libraries/openssl/kfreebsd-gnu.patch
@@ -0,0 +1,36 @@
+Allow compilation on GNU/kFreeBSD.  Ideally, there'd be a single way to process
+all glibc-based system, but the build system is soooo broken.
+
+--- openssl-1.0.0i/config
++++ openssl-1.0.0i/config
+@@ -170,6 +170,10 @@ case "${SYSTEM}:${RELEASE}:${VERSION}:${
+ 	echo "${MACHINE}-whatever-linux1"; exit 0
+ 	;;
+ 
++    GNU/kFreeBSD*)
++    	echo "kfreebsd-gnu"; exit 0;
++    	;;
++
+     GNU*)
+ 	echo "hurd-x86"; exit 0;
+ 	;;
+@@ -810,6 +814,7 @@ case "$GUESSOS" in
+   beos-*) OUT="$GUESSOS" ;;
+   x86pc-*-qnx6) OUT="QNX6-i386" ;;
+   *-*-qnx6) OUT="QNX6" ;;
++  kfreebsd-gnu) OUT="kfreebsd-gnu";;
+   *) OUT=`echo $GUESSOS | awk -F- '{print $3}'`;;
+ esac
+ 
+
+--- openssl-1.0.0i/Configure
++++ openssl-1.0.0i/Configure
+@@ -565,6 +565,9 @@ my %table=(
+ ##### GNU Hurd
+ "hurd-x86",  "gcc:-DL_ENDIAN -DTERMIOS -O3 -fomit-frame-pointer -march=i486 -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${x86_elf_asm}:dlfcn:linux-shared:-fPIC",
+ 
++##### GNU/kFreeBSD on x86_64, copied from "linux-x86_64"
++"kfreebsd-gnu",	"gcc:-m64 -DL_ENDIAN -DTERMIOS -O3 -Wall -DMD32_REG_T=int::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:elf:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
++
+ ##### OS/2 EMX
+ "OS2-EMX", "gcc::::::::",
diff --git a/pkgs/development/libraries/polkit/default.nix b/pkgs/development/libraries/polkit/default.nix
index dd83d7dfd8f..88daab5ff92 100644
--- a/pkgs/development/libraries/polkit/default.nix
+++ b/pkgs/development/libraries/polkit/default.nix
@@ -1,29 +1,31 @@
 { stdenv, fetchurl, pkgconfig, glib, expat, pam, intltool, gettext
-, gobjectIntrospection }:
+, gobjectIntrospection
+, useSystemd ? false, systemd ? null }:
 
 let
 
   system = "/var/run/current-system/sw";
-  
+
   foolVars = {
     LOCALSTATE = "/var";
     SYSCONF = "/etc";
     LIB = "${system}/lib";
     DATA = "${system}/share";
   };
-  
+
 in
 
 stdenv.mkDerivation rec {
-  name = "polkit-0.104";
+  name = "polkit-0.105";
 
   src = fetchurl {
-    url = "http://hal.freedesktop.org/releases/${name}.tar.gz";
-    sha256 = "1yf7307svs8qk76qdlgww1bhgdcia5cm92n16xz7njhy73c162kb";
+    url = "http://www.freedesktop.org/software/polkit/releases/${name}.tar.gz";
+    sha256 = "1pz1hn4z0f1wk4f7w8q1g6ygwan1b6kxmfad3b7gql27pb47rp4g";
   };
 
   buildInputs =
-    [ pkgconfig glib expat pam intltool gobjectIntrospection ];
+    [ pkgconfig glib expat pam intltool gobjectIntrospection ]
+    ++ stdenv.lib.optional useSystemd systemd;
 
   configureFlags = "--libexecdir=$(out)/libexec/polkit-1";
 
@@ -47,7 +49,7 @@ stdenv.mkDerivation rec {
       INTROSPECTION_GIRDIR=$(out)/share/gir-1.0
       INTROSPECTION_TYPELIBDIR=$(out)lib/girepository-1.0
     '';
-        
+
   postInstall =
     ''
       # Allow some files with paranoid permissions to be stripped in
@@ -56,7 +58,7 @@ stdenv.mkDerivation rec {
     '';
 
   meta = with stdenv.lib; {
-    homepage = http://www.freedesktop.org/wiki/Software/PolicyKit;
+    homepage = http://www.freedesktop.org/wiki/Software/polkit;
     description = "A toolkit for defining and handling the policy that allows unprivileged processes to speak to privileged processes";
     platforms = platforms.linux;
     maintainers = [ maintainers.urkud ];
diff --git a/pkgs/development/perl-modules/Compress-Raw-Zlib/default.nix b/pkgs/development/perl-modules/Compress-Raw-Zlib/default.nix
index 4aa8b4ad812..c2c7b5f8363 100644
--- a/pkgs/development/perl-modules/Compress-Raw-Zlib/default.nix
+++ b/pkgs/development/perl-modules/Compress-Raw-Zlib/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, buildPerlPackage, zlib }:
+{ fetchurl, buildPerlPackage, zlib, stdenv }:
 
 buildPerlPackage rec {
   name = "Compress-Raw-Zlib-2.051";
@@ -17,4 +17,6 @@ buildPerlPackage rec {
       GZIP_OS_CODE = AUTO_DETECT
     EOF
   '';
+
+  doCheck = !stdenv.isDarwin;
 }
diff --git a/pkgs/development/perl-modules/DBD-SQLite/default.nix b/pkgs/development/perl-modules/DBD-SQLite/default.nix
index 4cc2eb6a01c..bbe50182b90 100644
--- a/pkgs/development/perl-modules/DBD-SQLite/default.nix
+++ b/pkgs/development/perl-modules/DBD-SQLite/default.nix
@@ -17,8 +17,14 @@ buildPerlPackage rec {
     ./external-sqlite.patch
   ];
 
-  # Prevent warnings from `strip'.
-  postInstall = "chmod -R u+w $out";
+  postInstall =
+    ''
+      # Prevent warnings from `strip'.
+      chmod -R u+w $out
+
+      # Get rid of a pointless copy of the SQLite sources.
+      rm -rf $out/lib/perl5/site_perl/*/*/auto/share
+    '';
 
   # Disabled because the tests can randomly fail due to timeouts
   # (e.g. "database is locked(5) at dbdimp.c line 402 at t/07busy.t").
diff --git a/pkgs/development/tools/boomerang/default.nix b/pkgs/development/tools/boomerang/default.nix
new file mode 100644
index 00000000000..eadeb51d1b3
--- /dev/null
+++ b/pkgs/development/tools/boomerang/default.nix
@@ -0,0 +1,30 @@
+{ stdenv, fetchgit, cmake, boehmgc, expat, cppunit }:
+
+stdenv.mkDerivation {
+  name = "boomerang-1.0pre";
+
+  buildInputs = [ cmake boehmgc expat cppunit ];
+
+  installPhase = ''
+    for loaderfile in loader/*.so
+    do
+      install -vD "$loaderfile" "$out/lib/$(basename "$loaderfile")"
+    done
+
+    install -vD boomerang "$out/bin/boomerang"
+  '';
+
+  patches = [ ./dlopen_path.patch ];
+
+  src = fetchgit {
+    url = "git://github.com/aszlig/boomerang.git";
+    rev = "d0b147a5dfc915a5fa8fe6c517e66a049a37bf22";
+    sha256 = "6cfd95a3539ff45c18b17de76407568b0d0c17fde4e45dda54486c7eac113969";
+  };
+
+  meta = {
+    homepage = http://boomerang.sourceforge.net/;
+    license = stdenv.lib.licenses.bsd3;
+    description = "A general, open source, retargetable decompiler";
+  };
+}
diff --git a/pkgs/development/tools/boomerang/dlopen_path.patch b/pkgs/development/tools/boomerang/dlopen_path.patch
new file mode 100644
index 00000000000..1e4bf3c75a3
--- /dev/null
+++ b/pkgs/development/tools/boomerang/dlopen_path.patch
@@ -0,0 +1,13 @@
+diff --git a/loader/BinaryFileFactory.cpp b/loader/BinaryFileFactory.cpp
+index 889a4ed..ca86765 100644
+--- a/loader/BinaryFileFactory.cpp
++++ b/loader/BinaryFileFactory.cpp
+@@ -109,7 +109,7 @@ BinaryFile* BinaryFileFactory::getInstanceFor( const char *sName ) {
+ 	
+ // Load the specific loader library
+ #ifndef _WIN32		// Cygwin, Unix/Linux
+-	libName = std::string("lib/lib") + libName;
++	libName = std::string("lib") + libName;
+ #ifdef	__CYGWIN__
+ 	libName += ".dll";		// Cygwin wants .dll, but is otherwise like Unix
+ #else
diff --git a/pkgs/development/tools/haskell/hlint/default.nix b/pkgs/development/tools/haskell/hlint/default.nix
index 471b22a5825..bb61bbaa7dc 100644
--- a/pkgs/development/tools/haskell/hlint/default.nix
+++ b/pkgs/development/tools/haskell/hlint/default.nix
@@ -4,8 +4,8 @@
 
 cabal.mkDerivation (self: {
   pname = "hlint";
-  version = "1.8.30";
-  sha256 = "1c52h7pi759dnqzfq46nyckp75aswpqkf2n7aag2np955ky7rd05";
+  version = "1.8.31";
+  sha256 = "0d7m7viqf1cawbafiy4nj67hkavlxkv537qypy2vlhr502fispa4";
   isLibrary = true;
   isExecutable = true;
   buildDepends = [
diff --git a/pkgs/development/tools/misc/autobuild/default.nix b/pkgs/development/tools/misc/autobuild/default.nix
index 872dcb6c84c..f8497b5dece 100644
--- a/pkgs/development/tools/misc/autobuild/default.nix
+++ b/pkgs/development/tools/misc/autobuild/default.nix
@@ -4,7 +4,7 @@ stdenv.mkDerivation rec {
   name = "autobuild-3.5";
 
   src = fetchurl {
-    url = "http://josefsson.org/autobuild/releases/${name}.tar.gz";
+    url = "http://savannah.spinellicreations.com/autobuild/${name}.tar.gz";
     sha256 = "0ik13913x1yj8lsaf65chpiw13brl3q6kx7s1fa41a7s2krl1xvi";
   };
 
diff --git a/pkgs/development/tools/misc/cscope/default.nix b/pkgs/development/tools/misc/cscope/default.nix
index 3cba5cd2e76..b9d2c10f537 100644
--- a/pkgs/development/tools/misc/cscope/default.nix
+++ b/pkgs/development/tools/misc/cscope/default.nix
@@ -1,11 +1,11 @@
 { fetchurl, stdenv, ncurses, pkgconfig, emacs}:
 
 stdenv.mkDerivation rec {
-  name = "cscope-15.7a";
+  name = "cscope-15.8a";
 
   src = fetchurl {
-    url = "mirror://sourceforge/cscope/${name}.tar.bz2";
-    sha256 = "0dv0r66x31y2xxvad54x0wal8yb1krwbx3gjc82qpg4hlz5qnqq2";
+    url = "mirror://sourceforge/cscope/${name}.tar.gz";
+    sha256 = "07jdhxvp3dv7acvp0pwsdab1g2ncxjlcf838lj7vxgjs1p26lwzb";
   };
 
   preConfigure = ''
diff --git a/pkgs/development/tools/misc/gdb/default.nix b/pkgs/development/tools/misc/gdb/default.nix
index 1bc908185be..08fde14eb53 100644
--- a/pkgs/development/tools/misc/gdb/default.nix
+++ b/pkgs/development/tools/misc/gdb/default.nix
@@ -8,7 +8,7 @@
 
 let
 
-  basename = "gdb-7.4.1";
+  basename = "gdb-7.5";
 
   # Whether (cross-)building for GNU/Hurd.  This is an approximation since
   # having `stdenv ? cross' doesn't tell us if we're building `hostDrv' and
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "mirror://gnu/gdb/${basename}.tar.bz2";
-    md5 = "8854d34691087ec127d934692639855f";
+    md5 = "24a6779a9fe0260667710de1b082ef61";
   };
 
   # I think python is not a native input, but I leave it
diff --git a/pkgs/development/tools/misc/gdb/pstack.nix b/pkgs/development/tools/misc/gdb/pstack.nix
new file mode 100644
index 00000000000..12cdc654260
--- /dev/null
+++ b/pkgs/development/tools/misc/gdb/pstack.nix
@@ -0,0 +1,11 @@
+{ stdenv, gdb }:
+stdenv.mkDerivation {
+  name = "pstack-20120823";
+  buildCommand = ''
+    mkdir -p $out/bin
+    cat > $out/bin/pstack <<EOF
+    ${gdb}/bin/gdb -ex "set pagination 0" -ex "thread apply all bt" --batch -p \$1
+    EOF
+    chmod a+x $out/bin/pstack
+  '';
+}
diff --git a/pkgs/development/tools/misc/patchelf/unstable.nix b/pkgs/development/tools/misc/patchelf/unstable.nix
new file mode 100644
index 00000000000..aa8418496ea
--- /dev/null
+++ b/pkgs/development/tools/misc/patchelf/unstable.nix
@@ -0,0 +1,16 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "patchelf-0.7pre160_1c057cd";
+
+  src = fetchurl {
+    url = http://hydra.nixos.org/build/2961500/download/2/patchelf-0.7pre160_1c057cd.tar.bz2;
+    sha256 = "bbc46169f6b6803410e0072cf57e631481e3d5f1dde234f4eacbccb6562c5f4f";
+  };
+
+  meta = {
+    homepage = http://nixos.org/patchelf.html;
+    license = "GPL";
+    description = "A small utility to modify the dynamic linker and RPATH of ELF executables";
+  };
+}
diff --git a/pkgs/development/web/nodejs/build-node-package.nix b/pkgs/development/web/nodejs/build-node-package.nix
index 56941ddf27e..98136709170 100644
--- a/pkgs/development/web/nodejs/build-node-package.nix
+++ b/pkgs/development/web/nodejs/build-node-package.nix
@@ -32,4 +32,8 @@ stdenv.mkDerivation ({
     fi
     runHook postInstall
   '';
+
+  preFixup = ''
+    find $out -type f -print0 | xargs -0 sed -i 's|${src}|${src.name}|g'
+  '';
 } // args)
diff --git a/pkgs/development/web/nodejs/default.nix b/pkgs/development/web/nodejs/default.nix
index 98042359857..75e0df0e89e 100644
--- a/pkgs/development/web/nodejs/default.nix
+++ b/pkgs/development/web/nodejs/default.nix
@@ -1,12 +1,21 @@
 { stdenv, fetchurl, openssl, python, zlib, v8, linkV8Headers ? false, utillinux }:
 
+let
+
+  espipe_patch = fetchurl {
+    url = https://github.com/joyent/libuv/commit/0ac2fdc55455794e057e4999a2e785ca8fbfb1b2.patch;
+    sha256 = "0mqgbsz23b3zp19dwk12ys14b031hssmlp40dylb7psj937qcpzi";
+  };
+
+in
+
 stdenv.mkDerivation rec {
-  version = "0.8.3";
+  version = "0.8.8";
   name = "nodejs-${version}";
 
   src = fetchurl {
     url = "http://nodejs.org/dist/v${version}/node-v${version}.tar.gz";
-    sha256 = "0dgcw6qpgvsxcvcbkmvpjz2i9f2r286zcrcg0jnxnds9fj41s2k0";
+    sha256 = "0cri5r191l5pw8a8pf3gs7hfjm3rrz6kdnm3l8wghmp9p12p0aq9";
   };
 
   configureFlags = [
@@ -21,6 +30,9 @@ stdenv.mkDerivation rec {
 
   prePatch = ''
     sed -e 's|^#!/usr/bin/env python$|#!${python}/bin/python|g' -i tools/{*.py,waf-light,node-waf} configure
+    pushd deps/uv
+    patch -p 1 < ${espipe_patch}
+    popd
   '';
 
   postInstall = ''
diff --git a/pkgs/lib/attrsets.nix b/pkgs/lib/attrsets.nix
index 5e4e9df3711..de6eccbec1f 100644
--- a/pkgs/lib/attrsets.nix
+++ b/pkgs/lib/attrsets.nix
@@ -5,12 +5,11 @@ with {
   inherit (import ./trivial.nix) or;
   inherit (import ./default.nix) fold;
   inherit (import ./strings.nix) concatStringsSep;
-  inherit (import ./lists.nix) concatMap;
-  inherit (import ./misc.nix) eqStrict;
+  inherit (import ./lists.nix) concatMap concatLists;
 };
 
 rec {
-  inherit (builtins) attrNames listToAttrs hasAttr isAttrs;
+  inherit (builtins) attrNames listToAttrs hasAttr isAttrs getAttr;
 
 
   /* Return an attribute from nested attribute sets.  For instance
@@ -33,15 +32,6 @@ rec {
       nameValuePair (head attrPath) (setAttrByPath (tail attrPath) value)
     )];
 
-      
-  /* Backwards compatibility hack: lib.attrByPath used to be called
-     lib.getAttr, which was confusing given that there was also a
-     builtins.getAttr.  Eventually we'll drop this hack and
-     lib.getAttr will just be an alias for builtins.getAttr. */
-  getAttr = a: b: if isString a
-    then builtins.getAttr a b
-    else c: builtins.trace "Deprecated use of lib.getAttr!" (attrByPath a b c);
-
 
   getAttrFromPath = attrPath: set:
     let errorMsg = "cannot find attribute `" + concatStringsSep "." attrPath + "'";
@@ -75,7 +65,7 @@ rec {
        catAttrs "a" [{a = 1;} {b = 0;} {a = 2;}]
        => [1 2]
   */
-  catAttrs = attr: l: fold (s: l: if hasAttr attr s then [(getAttr attr s)] ++ l else l) [] l;
+  catAttrs = attr: l: concatLists (map (s: if hasAttr attr s then [(getAttr attr s)] else []) l);
 
 
   /* Filter an attribute set by removing all attributes for which the
@@ -301,9 +291,9 @@ rec {
   matchAttrs = pattern: attrs:
     fold or false (attrValues (zipAttrsWithNames (attrNames pattern) (n: values:
       let pat = head values; val = head (tail values); in
-      if tail values == [] then false
+      if length values == 1 then false
       else if isAttrs pat then isAttrs val && matchAttrs head values
-      else eqStrict pat val
+      else pat == val
     ) [pattern attrs]));
 
   # override only the attributes that are already present in the old set
diff --git a/pkgs/lib/debug.nix b/pkgs/lib/debug.nix
index e452151add6..b78f946c5d4 100644
--- a/pkgs/lib/debug.nix
+++ b/pkgs/lib/debug.nix
@@ -66,7 +66,7 @@ rec {
     let testsToRun = if tests ? tests then tests.tests else [];
     in if (substring 0 4 name == "test" ||  elem name testsToRun)
        && ((testsToRun == []) || elem name tests.tests)
-       && (!lib.eqStrict test.expr test.expected)
+       && (test.expr != test.expected)
 
       then [ { inherit name; expected = test.expected; result = test.expr; } ]
       else [] ) tests));
diff --git a/pkgs/lib/lists.nix b/pkgs/lib/lists.nix
index 67b0add50dc..b9eba9ab478 100644
--- a/pkgs/lib/lists.nix
+++ b/pkgs/lib/lists.nix
@@ -1,33 +1,59 @@
 # General list operations.
 
 rec {
-  inherit (builtins) head tail length isList;
+  inherit (builtins) head tail length isList add sub lessThan;
 
 
   # Create a list consisting of a single element.  `singleton x' is
   # sometimes more convenient with respect to indentation than `[x]'
   # when x spans multiple lines.
   singleton = x: [x];
-  
+
 
   # "Fold" a binary function `op' between successive elements of
   # `list' with `nul' as the starting value, i.e., `fold op nul [x_1
   # x_2 ... x_n] == op x_1 (op x_2 ... (op x_n nul))'.  (This is
   # Haskell's foldr).
-  fold = op: nul: list:
-    if list == []
-    then nul
-    else op (head list) (fold op nul (tail list));
+  fold =
+    if builtins ? elemAt
+    then op: nul: list:
+      let
+        len = length list;
+        fold' = n:
+          if n == len
+          then nul
+          else op (builtins.elemAt list n) (fold' (add n 1));
+      in fold' 0
+    else op: nul:
+      let fold' = list:
+        if list == []
+        then nul
+        else op (head list) (fold' (tail list));
+      in fold';
 
     
   # Left fold: `fold op nul [x_1 x_2 ... x_n] == op (... (op (op nul
   # x_1) x_2) ... x_n)'.
-  foldl = op: nul: list:
-    if list == []
-    then nul
-    else foldl op (op nul (head list)) (tail list);
+  foldl =
+    if builtins ? elemAt
+    then op: nul: list:
+      let
+        len = length list;
+        foldl' = n:
+          if n == minus1
+          then nul
+          else op (foldl' (sub n 1)) (builtins.elemAt list n);
+      in foldl' (sub (length list) 1)
+    else op:
+      let foldl' = nul: list:
+        if list == []
+        then nul
+        else foldl' (op nul (head list)) (tail list);
+      in foldl';
+
+  minus1 = sub 0 1;
+
 
-    
   # map with index: `imap (i: v: "${v}-${toString i}") ["a" "b"] ==
   # ["a-1" "b-2"]'
   imap = f: list:
@@ -35,7 +61,7 @@ rec {
 
     
   # Concatenate a list of lists.
-  concatLists = fold (x: y: x ++ y) [];
+  concatLists = builtins.concatLists or (fold (x: y: x ++ y) []);
 
 
   # Map and concatenate the result.
@@ -53,20 +79,24 @@ rec {
     
   # Filter a list using a predicate; that is, return a list containing
   # every element from `list' for which `pred' returns true.
-  filter = pred: list:
-    fold (x: y: if pred x then [x] ++ y else y) [] list;
+  filter =
+    builtins.filter or
+    (pred: list:
+      fold (x: y: if pred x then [x] ++ y else y) [] list);
 
     
-  # Remove elements 'e' from a list. Useful for buildInputs
+  # Remove elements equal to 'e' from a list.  Useful for buildInputs.
   remove = e: filter (x: x != e);
 
   
   # Given two lists, removes all elements of the first list from the second list
   removeList = l: filter (x: elem x l);
 
-  
-  # Return true if `list' has an element `x':
-  elem = x: list: fold (a: bs: x == a || bs) false list;
+
+  # Return true if `list' has an element `x'.
+  elem =
+    builtins.elem or
+    (x: list: fold (a: bs: x == a || bs) false list);
 
 
   # Find the sole element in the list matching the specified
@@ -88,27 +118,14 @@ rec {
 
   # Return true iff function `pred' returns true for at least element
   # of `list'.
-  any = pred: list:
-    if list == [] then false
-    else if pred (head list) then true
-    else any pred (tail list);
+  any = pred: fold (x: y: if pred x then true else y) false;
 
 
   # Return true iff function `pred' returns true for all elements of
   # `list'.
-  all = pred: list:
-    if list == [] then true
-    else if pred (head list) then all pred (tail list)
-    else false;
-
+  all = pred: fold (x: y: if pred x then y else false) true;
 
-  # Return true if each element of a list is equal, false otherwise.
-  eqLists = xs: ys:
-    if xs == [] && ys == [] then true
-    else if xs == [] || ys == [] then false
-    else head xs == head ys && eqLists (tail xs) (tail ys);
 
-    
   # Return a singleton list or an empty list, depending on a boolean
   # value.  Useful when building lists with optional elements
   # (e.g. `++ optional (system == "i686-linux") flashplayer').
@@ -165,11 +182,11 @@ rec {
   # order.  The implementation does a quick-sort.
   sort = strictLess: list:
     let
-      # This implementation only have one element lists on the left hand
+      # This implementation only has one element list on the left hand
       # side of the concatenation operator.
       qs = l: concat:
         if l == [] then concat
-        else if tail l == [] then l ++ concat
+        else if length l == 1 then l ++ concat
         else let
           part = partition (strictLess (head l)) (tail l);
         in
@@ -195,7 +212,7 @@ rec {
     let loop = l: if tail l == [] then head l else loop (tail l); in
     loop list;
 
-    
+
   # Zip two lists together.
   zipTwoLists = xs: ys:
     if xs != [] && ys != [] then
diff --git a/pkgs/lib/misc.nix b/pkgs/lib/misc.nix
index dbf3381f0f4..39a3ad258b0 100644
--- a/pkgs/lib/misc.nix
+++ b/pkgs/lib/misc.nix
@@ -322,10 +322,6 @@ rec {
     // listToAttrs (map (n : nameValuePair n (a: b: "${a}\n${b}") ) [ "preConfigure" "postInstall" ])
   ;
 
-  # returns atribute values as a list 
-  flattenAttrs = set : map ( attr : builtins.getAttr attr set) (attrNames set);
-  mapIf = cond : f :  fold ( x : l : if (cond x) then [(f x)] ++ l else l) [];
-
   # prepareDerivationArgs tries to make writing configurable derivations easier
   # example:
   #  prepareDerivationArgs {
@@ -365,7 +361,7 @@ rec {
         flagName = name : "${name}Support";
         cfgWithDefaults = (listToAttrs (map (n : nameValuePair (flagName n) false) (attrNames args2.flags)))
                           // args2.cfg;
-        opts = flattenAttrs (mapAttrs (a : v :
+        opts = attrValues (mapAttrs (a : v :
                 let v2 = if (v ? set || v ? unset) then v else { set = v; };
                     n = if (getAttr (flagName a) cfgWithDefaults) then "set" else "unset";
                     attr = maybeAttr n {} v2; in
@@ -390,18 +386,4 @@ rec {
       else if isInt x then "int"
       else "string";
 
-  # deep, strict equality testing. This should be implemented as primop
-  eqStrict = a : b :
-    let eqListStrict = a : b :
-      if (a == []) != (b == []) then false
-      else if a == [] then true
-      else eqStrict (head a) (head b) && eqListStrict (tail a) (tail b);
-    in
-    if nixType a != nixType b then false
-      else if isList a then eqListStrict a b
-        else if isAttrs a then
-          (eqListStrict (attrNames a) (attrNames b))
-          && (eqListStrict (lib.attrValues a) (lib.attrValues b))
-        else a == b; # FIXME !
-
 }
diff --git a/pkgs/lib/modules.nix b/pkgs/lib/modules.nix
index eb528f141fe..25cb956a0ea 100644
--- a/pkgs/lib/modules.nix
+++ b/pkgs/lib/modules.nix
@@ -2,7 +2,7 @@
 
 let lib = import ./default.nix; in
 
-with { inherit (builtins) head tail; };
+with { inherit (builtins) head; };
 with import ./trivial.nix;
 with import ./lists.nix;
 with import ./misc.nix;
@@ -44,9 +44,9 @@ rec {
       delayedModule = delayProperties m;
       getImports =
         if m ? config || m ? options then
-          attrByPath ["imports"] [] m
+          m.imports or []
         else
-          toList (rmProperties (attrByPath ["require"] [] delayedModule));
+          toList (rmProperties (delayedModule.require or []));
 
       getImportedPaths = filter isPath getImports;
       getImportedSets = filter (x: !isPath x) getImports;
@@ -64,7 +64,7 @@ rec {
           config = getConfig;
         } // (
           if getImportedSets != [] then
-            assert tail getImportedSets == [];
+            assert length getImportedSets == 1;
             { options = head getImportedSets; }
           else
             {}
@@ -92,7 +92,7 @@ rec {
             else newModuleName origin index;
         };
 
-      getImports = m: attrByPath ["imports"] [] m;
+      getImports = m: m.imports or [];
 
       newModuleName = origin: index:
         "${origin.key}:<import-${toString index}>";
@@ -110,8 +110,8 @@ rec {
   selectDeclsAndDefs = modules:
     lib.concatMap (m:
       if m ? config || m ? options then
-         [ (attrByPath ["options"] {} m) ]
-      ++ [ (attrByPath ["config"] {} m) ]
+         [ (m.options or {}) ]
+      ++ [ (m.config or {}) ]
       else
         [ m ]
     ) modules;
diff --git a/pkgs/lib/options.nix b/pkgs/lib/options.nix
index cd60b8f3b88..59bda41a623 100644
--- a/pkgs/lib/options.nix
+++ b/pkgs/lib/options.nix
@@ -2,7 +2,7 @@
 
 let lib = import ./default.nix; in
 
-with { inherit (builtins) head tail; };
+with { inherit (builtins) head length; };
 with import ./trivial.nix;
 with import ./lists.nix;
 with import ./misc.nix;
@@ -133,7 +133,7 @@ rec {
   # separate the merge & apply fields from the interface.
   mergeOptionDecls = opts:
     if opts == [] then {}
-    else if tail opts == [] then
+    else if length opts == 1 then
       let opt = head opts; in
       if opt ? options then
         opt // { options = toList opt.options; }
@@ -152,13 +152,11 @@ rec {
         opt1 // opt2
         // optionalAttrs (opt1 ? options || opt2 ? options) {
             options =
-               (toList (attrByPath ["options"] [] opt1))
-            ++ (toList (attrByPath ["options"] [] opt2));
+               (toList (opt1.options or []))
+            ++ (toList (opt2.options or []));
           }
         // optionalAttrs (opt1 ? extraConfigs || opt2 ? extraConfigs) {
-            extraConfigs =
-               (attrByPath ["extraConfigs"] [] opt1)
-            ++ (attrByPath ["extraConfigs"] [] opt2);
+            extraConfigs = opt1.extraConfigs or [] ++ opt2.extraConfigs or [];
           }
       )) {} opts;
 
@@ -189,7 +187,7 @@ rec {
     ) (attrNames defs));
 
   mergeDefaultOption = list:
-    if list != [] && tail list == [] then head list
+    if length list == 1 then head list
     else if all builtins.isFunction list then x: mergeDefaultOption (map (f: f x) list)
     else if all isList list then concatLists list
     else if all isAttrs list then fold lib.mergeAttrs {} list
@@ -214,7 +212,7 @@ rec {
 
   mergeOneOption = list:
     if list == [] then abort "This case should never happen."
-    else if tail list != [] then throw "Multiple definitions. Only one is allowed for this option."
+    else if length list != 1 then throw "Multiple definitions. Only one is allowed for this option."
     else head list;
 
 
diff --git a/pkgs/lib/strings.nix b/pkgs/lib/strings.nix
index 071bb2c995b..fb2752d97c1 100644
--- a/pkgs/lib/strings.nix
+++ b/pkgs/lib/strings.nix
@@ -2,12 +2,12 @@
 
 let lib = import ./default.nix;
 
-inherit (builtins) add sub lessThan;
+inherit (builtins) add sub lessThan length;
 
 in
 
 rec {
-  inherit (builtins) stringLength substring head tail lessThan sub;
+  inherit (builtins) stringLength substring head tail;
 
 
   # Concatenate a list of strings.
@@ -22,7 +22,7 @@ rec {
   # Place an element between each element of a list, e.g.,
   # `intersperse "," ["a" "b" "c"]' returns ["a" "," "b" "," "c"].
   intersperse = separator: list:
-    if list == [] || tail list == []
+    if list == [] || length list == 1
     then list
     else [(head list) separator]
          ++ (intersperse separator (tail list));
diff --git a/pkgs/lib/tests.nix b/pkgs/lib/tests.nix
index 646de7c0e49..835298ddb9e 100644
--- a/pkgs/lib/tests.nix
+++ b/pkgs/lib/tests.nix
@@ -50,19 +50,6 @@ runTests {
     expected = 5050;
   };
 
-  testEqStrict = {
-    expr = all id [
-      (eqStrict 2 2)
-      (!eqStrict 3 2)
-      (eqStrict [2 1] [2 1])
-      (!eqStrict [1 3] [1 2])
-      (eqStrict {a = 7; b = 20;} {b= 20; a = 7;})
-      (eqStrict [{a = 7; b = 20;}] [{b= 20; a = 7;}])
-      (eqStrict {a = [7 8]; b = 20;} {b= 20; a = [7 8];})
-    ];
-    expected = true;
-  };
-
   testTake = testAllTrue [
     ([] == (take 0 [  1 2 3 ]))
     ([1] == (take 1 [  1 2 3 ]))
@@ -99,14 +86,14 @@ runTests {
                 in (y.merge) { b = 10; };
           strip = attrs : removeAttrs attrs ["merge" "replace"];
       in all id
-        [ (eqStrict (strip res1) { })
-          (eqStrict (strip res2) { a = 7; })
-          (eqStrict (strip res3) { a = 7; b = 10; })
-          (eqStrict (strip res4) { a = 7; b = 10; })
-          (eqStrict (strip res5) { a = 10; })
-          (eqStrict (strip res6) { a = 17; })
-          (eqStrict (strip resRem7) {})
-          (eqStrict (strip resFixed1) { a = 7; b = 10; c =10; name = "name-10"; })
+        [ ((strip res1) == { })
+          ((strip res2) == { a = 7; })
+          ((strip res3) == { a = 7; b = 10; })
+          ((strip res4) == { a = 7; b = 10; })
+          ((strip res5) == { a = 10; })
+          ((strip res6) == { a = 17; })
+          ((strip resRem7) == {})
+          ((strip resFixed1) == { a = 7; b = 10; c =10; name = "name-10"; })
         ];
     expected = true;
   };
diff --git a/pkgs/lib/types.nix b/pkgs/lib/types.nix
index 956368138aa..38ae7b43630 100644
--- a/pkgs/lib/types.nix
+++ b/pkgs/lib/types.nix
@@ -157,7 +157,7 @@ rec {
     uniq = elemType: mkOptionType {
       inherit (elemType) name check iter fold docPath hasOptions;
       merge = list:
-        if tail list == [] then
+        if length list == 1 then
           head list
         else
           throw "Multiple definitions. Only one is allowed for this option.";
diff --git a/pkgs/misc/maven/3.0.nix b/pkgs/misc/maven/3.0.nix
deleted file mode 100644
index 3d14a064a94..00000000000
--- a/pkgs/misc/maven/3.0.nix
+++ /dev/null
@@ -1,15 +0,0 @@
-{stdenv, fetchurl, jdk, makeWrapper}:
-
-assert jdk != null;
-
-stdenv.mkDerivation {
-	name = "apache-maven-3.0.3";
-	builder = ./builder.sh;
-	src = fetchurl {
-		url = mirror://apache/maven/binaries/apache-maven-3.0.3-bin.tar.gz;
-		sha256 = "b845479bd5d6d821210d3530c65da628a118abedd176492741e1d9bc5e400e2a";
-	};
-	
-        buildInputs = [makeWrapper]; 
-	inherit jdk;
-}
diff --git a/pkgs/misc/maven/default.nix b/pkgs/misc/maven/default.nix
index 85794901650..ec2b57e222a 100644
--- a/pkgs/misc/maven/default.nix
+++ b/pkgs/misc/maven/default.nix
@@ -3,11 +3,11 @@
 assert jdk != null;
 
 stdenv.mkDerivation {
-	name = "apache-maven-2.2.1";
+	name = "apache-maven-3.0.4";
 	builder = ./builder.sh;
 	src = fetchurl {
-		url = mirror://apache/maven/binaries/apache-maven-2.2.1-bin.tar.gz;
-		sha256 = "0xnk08ndf1jx458sr5dfr8rh7wi92kyn887vqyzjm1ka91cnb8xr";
+		url = mirror://apache/maven/binaries/apache-maven-3.0.4-bin.tar.gz;
+		sha256 = "0bxa7x8ifm8590nxifhsh3sxzm6aicbczyx21vibg3606ih8fnnk";
 	};
 	
         buildInputs = [makeWrapper]; 
diff --git a/pkgs/misc/maven/maven-1.0.nix b/pkgs/misc/maven/maven-1.0.nix
deleted file mode 100644
index 2c84b6f006c..00000000000
--- a/pkgs/misc/maven/maven-1.0.nix
+++ /dev/null
@@ -1,16 +0,0 @@
-{stdenv, fetchurl, jdk}:
-
-assert jdk != null;
-
-stdenv.mkDerivation {
-	name = "maven-1.0.2";
-        mavenBinary = "maven";
-	builder = ./builder.sh;
-	src = fetchurl {
-		url = http://apache.cs.uu.nl/dist/maven/binaries/maven-1.0.2.tar.bz2;
-		md5 = "81a6b4393e550635efe19e95cea38718";
-	};
-	makeWrapper = ../../build-support/make-wrapper/make-wrapper.sh;
-	
-	inherit jdk;
-}
diff --git a/pkgs/os-specific/linux/atop/default.nix b/pkgs/os-specific/linux/atop/default.nix
new file mode 100644
index 00000000000..0e2df1e25fb
--- /dev/null
+++ b/pkgs/os-specific/linux/atop/default.nix
@@ -0,0 +1,39 @@
+{stdenv, fetchurl, zlib, ncurses}:
+
+stdenv.mkDerivation rec {
+  version = "1.27-3";
+  name = "atop-${version}";
+
+  src = fetchurl {
+    url = "http://www.atoptool.nl/download/atop-${version}.tar.gz";
+    sha256 = "bce36e0b50f0e03995d86d25dbc9ab4a289f6755ce3558844f96d41b0bba563f";
+  };
+
+  buildInputs = [zlib ncurses];
+
+  makeFlags = [
+    ''SCRPATH=$out/etc/atop''
+    ''LOGPATH=/var/log/atop''
+    ''INIPATH=$out/etc/rc.d/init.d''
+    ''CRNPATH=$out/etc/cron.d''
+    ''ROTPATH=$out/etc/logrotate.d''
+  ];
+
+  preConfigure = ''
+    sed -e "s@/usr/@$out/@g" -i $(find . -type f )
+    sed -e "/mkdir.*LOGPATH/s@mkdir@echo missing dir @" -i Makefile
+    sed -e "/touch.*LOGPATH/s@touch@echo should have created @" -i Makefile
+    sed -e 's/chown/true/g' -i Makefile
+    sed -e '/chkconfig/d' -i Makefile
+  '';
+
+  meta = {
+    platforms = stdenv.lib.platforms.linux;
+    maintainers = with stdenv.lib.maintainers; [raskin];
+    description = ''Console system performance monitor'';
+
+    longDescription = ''
+      Atop is an ASCII full-screen performance monitor that is capable of reporting the activity of all processes (even if processes have finished during the interval), daily logging of system and process activity for long-term analysis, highlighting overloaded system resources by using colors, etc. At regular intervals, it shows system-level activity related to the CPU, memory, swap, disks and network layers, and for every active process it shows the CPU utilization, memory growth, disk utilization, priority, username, state, and exit code.
+    '';
+  };
+}
diff --git a/pkgs/os-specific/linux/busybox/default.nix b/pkgs/os-specific/linux/busybox/default.nix
index ab0873e7ddc..0848cb33253 100644
--- a/pkgs/os-specific/linux/busybox/default.nix
+++ b/pkgs/os-specific/linux/busybox/default.nix
@@ -37,11 +37,11 @@ let
 in
 
 stdenv.mkDerivation rec {
-  name = "busybox-1.20.1";
+  name = "busybox-1.20.2";
 
   src = fetchurl {
     url = "http://busybox.net/downloads/${name}.tar.bz2";
-    sha256 = "1jb8xh9a0mc73nmnjz7g5k7ym39vrg7grp7zmgmq71gxps55sl9y";
+    sha256 = "10k8kgrprll9hxfm9gc3jl7kkq79g6l2pygn5snqwqg5v80zy4zb";
   };
 
   configurePhase = ''
diff --git a/pkgs/os-specific/linux/kernel/linux-3.2.nix b/pkgs/os-specific/linux/kernel/linux-3.2.nix
index df457bcb7e2..bea68decf64 100644
--- a/pkgs/os-specific/linux/kernel/linux-3.2.nix
+++ b/pkgs/os-specific/linux/kernel/linux-3.2.nix
@@ -237,7 +237,7 @@ in
 import ./generic.nix (
 
   rec {
-    version = "3.2.27";
+    version = "3.2.28";
     testing = false;
 
     modDirVersion = version;
@@ -248,7 +248,7 @@ import ./generic.nix (
 
     src = fetchurl {
       url = "mirror://kernel/linux/kernel/v3.0/${if testing then "testing/" else ""}linux-${version}.tar.xz";
-      sha256 = "1lchjh6s6mld83yq8gmcla6pydyap412bkyg3qb591ylnhdmg51k";
+      sha256 = "0v4mbqf0mgnshhkq3symlliaz1jwa7vx7195r3qls390plc9g0nl";
     };
 
     config = configWithPlatform stdenv.platform;
diff --git a/pkgs/os-specific/linux/kernel/linux-3.3.nix b/pkgs/os-specific/linux/kernel/linux-3.3.nix
index 956e55014e5..c56df955b79 100644
--- a/pkgs/os-specific/linux/kernel/linux-3.3.nix
+++ b/pkgs/os-specific/linux/kernel/linux-3.3.nix
@@ -236,7 +236,7 @@ in
 import ./generic.nix (
 
   rec {
-    version = "3.3.6";
+    version = "3.3.8";
     testing = false;
 
     preConfigure = ''
@@ -245,7 +245,7 @@ import ./generic.nix (
 
     src = fetchurl {
       url = "mirror://kernel/linux/kernel/v3.x/${if testing then "testing/" else ""}linux-${version}.tar.xz";
-      sha256 = "04hplilmy9ks6nxi4292mcqwil6b5vinx90w23m41bll1x32gbq8";
+      sha256 = "0bgppngf711mlxp0jcsnv5xc0xxc8vs5rzc1czkv2igrfb1kvrnz";
     };
 
     config = configWithPlatform stdenv.platform;
diff --git a/pkgs/os-specific/linux/kernel/linux-3.4.nix b/pkgs/os-specific/linux/kernel/linux-3.4.nix
index ae5f5dcaa3f..7d421af4917 100644
--- a/pkgs/os-specific/linux/kernel/linux-3.4.nix
+++ b/pkgs/os-specific/linux/kernel/linux-3.4.nix
@@ -239,7 +239,7 @@ in
 import ./generic.nix (
 
   rec {
-    version = "3.4.7";
+    version = "3.4.9";
     testing = false;
 
     preConfigure = ''
@@ -248,7 +248,7 @@ import ./generic.nix (
 
     src = fetchurl {
       url = "mirror://kernel/linux/kernel/v3.x/${if testing then "testing/" else ""}linux-${version}.tar.xz";
-      sha256 = "0y93f6vjax4bwl6w73yqxn7dnv43ywd5vf5f5q27fm7y49m9ch95";
+      sha256 = "02rnzpnfs7hfsglrgwr1450ssj47da1w079rmvzh1k0apy7qdpzm";
     };
 
     config = configWithPlatform stdenv.platform;
diff --git a/pkgs/os-specific/linux/kernel/linux-3.5.nix b/pkgs/os-specific/linux/kernel/linux-3.5.nix
index a34badc8a04..8e347595f22 100644
--- a/pkgs/os-specific/linux/kernel/linux-3.5.nix
+++ b/pkgs/os-specific/linux/kernel/linux-3.5.nix
@@ -240,7 +240,7 @@ in
 import ./generic.nix (
 
   rec {
-    version = "3.5.1";
+    version = "3.5.2";
     testing = false;
 
     preConfigure = ''
@@ -249,7 +249,7 @@ import ./generic.nix (
 
     src = fetchurl {
       url = "mirror://kernel/linux/kernel/v3.x/${if testing then "testing/" else ""}linux-${version}.tar.xz";
-      sha256 = "08rmhcgcxhwxv3cnnbhc86mvjmxkdk3aay4db6jbn90jlzf7kclz";
+      sha256 = "13dzx7gqm0n7s73bq87ibhmydrfsngyps9sczkcy1sh56rrkv0x6";
     };
 
     config = configWithPlatform stdenv.platform;
diff --git a/pkgs/os-specific/linux/kernel/patches.nix b/pkgs/os-specific/linux/kernel/patches.nix
index e9cd15bb31c..7aa365a67de 100644
--- a/pkgs/os-specific/linux/kernel/patches.nix
+++ b/pkgs/os-specific/linux/kernel/patches.nix
@@ -149,13 +149,13 @@ rec {
 
   aufs3_3 = rec {
     name = "aufs3.3";
-    version = "3.3";
+    version = "3.3.20120730";
     utilRev = "91af15f977d12e02165759620005f6ce1a4d7602";
     utilHash = "dda4df89828dcf0e4012d88b4aa3eda8c30af69d6530ff5fedc2411de872c996";
     patch = makeAufs3StandalonePatch {
       inherit version;
-      rev = "91c3d8c80172db05575ee82c931f3541947a6aff";
-      sha256 = "8fe54993b6a7a290649c193aab5a4f7f2dcecaedb5422d951f898d03753b83fb";
+      rev = "ff0c9f1c002ef564d7bd52dd56a9b72f4ee7ce0c";
+      sha256 = "cfa1a06669c984e1b8755da649aac40152e8018ee87939c5f0825100e45e196e";
     };
     features.aufsBase = true;
     features.aufs3 = true;
@@ -163,13 +163,13 @@ rec {
 
   aufs3_4 = rec {
     name = "aufs3.4";
-    version = "3.4";
+    version = "3.4.20120730";
     utilRev = "91af15f977d12e02165759620005f6ce1a4d7602";
     utilHash = "dda4df89828dcf0e4012d88b4aa3eda8c30af69d6530ff5fedc2411de872c996";
     patch = makeAufs3StandalonePatch {
       inherit version;
-      rev = "a5f7df8e59d57d6d9d749d49adc7e5a37ce2e342";
-      sha256 = "20a8f113bb654f92231726de8177eb51d7be1b900fd42c2b5f48726a7d5d3ce6";
+      rev = "8d7338df43d5e5372424813679c7531cf96ec260";
+      sha256 = "37880124df88791d51089277230df0816fc5545c9752be3fa5173385489362c6";
     };
     features.aufsBase = true;
     features.aufs3 = true;
@@ -177,13 +177,13 @@ rec {
 
   aufs3_5 = rec {
     name = "aufs3.5";
-    version = "3.5";
+    version = "3.5.20120813";
     utilRev = "91af15f977d12e02165759620005f6ce1a4d7602";
     utilHash = "dda4df89828dcf0e4012d88b4aa3eda8c30af69d6530ff5fedc2411de872c996";
     patch = makeAufs3StandalonePatch {
       inherit version;
-      rev = "4a5e660ed7f5c1d0467c81c535d0fedcfe62d15f";
-      sha256 = "c474573fc03725053e68db481478be74de98abe2c23be60fe08e2f5f2ab3b188";
+      rev = "85b5f7059bc8a1759989408a13fc56f92e0d6d31";
+      sha256 = "2be13407a2291c7e69658f10a6fb7672751c906a27ac700a2e5e05dbada97cc5";
     };
     features.aufsBase = true;
     features.aufs3 = true;
diff --git a/pkgs/os-specific/linux/lvm2/default.nix b/pkgs/os-specific/linux/lvm2/default.nix
index 3411bc83d8a..1ebebfd634b 100644
--- a/pkgs/os-specific/linux/lvm2/default.nix
+++ b/pkgs/os-specific/linux/lvm2/default.nix
@@ -1,7 +1,7 @@
-{ stdenv, fetchurl, pkgconfig, udev }:
+{ stdenv, fetchurl, pkgconfig, udev, utillinux, coreutils }:
 
 let
-  v = "2.02.95";
+  v = "2.02.97";
 in
 
 stdenv.mkDerivation {
@@ -9,7 +9,7 @@ stdenv.mkDerivation {
 
   src = fetchurl {
     url = "ftp://sources.redhat.com/pub/lvm2/old/LVM2.${v}.tgz";
-    sha256 = "09cixpdrbzjybf8k8f0rsgkriyvbaj2acmfsg1bzxnjil4vayd83";
+    sha256 = "0azwa555dgvixbdw055yj8cj1q6kd0a36nms005iz7la5q0q5npd";
   };
 
   configureFlags =
@@ -17,11 +17,28 @@ stdenv.mkDerivation {
 
   buildInputs = [ pkgconfig udev ];
 
-  patches = [ ./purity.patch ];
+  preConfigure =
+    ''
+      substituteInPlace scripts/lvmdump.sh \
+        --replace /usr/bin/tr ${coreutils}/bin/tr
+      substituteInPlace scripts/lvm2_activation_generator_systemd_red_hat.c \
+        --replace /usr/sbin/lvm $out/sbin/lvm
+    '';
+
+  #patches = [ ./purity.patch ];
 
   # To prevent make install from failing.
   preInstall = "installFlags=\"OWNER= GROUP= confdir=$out/etc\"";
 
+  # Install systemd stuff.
+  #installTargets = "install install_systemd_generators install_systemd_units install_tmpfiles_configuration";
+
+  postInstall =
+    ''
+      substituteInPlace $out/lib/udev/rules.d/13-dm-disk.rules \
+        --replace $out/sbin/blkid ${utillinux}/sbin/blkid
+    '';
+
   meta = {
     homepage = http://sourceware.org/lvm2/;
     descriptions = "Tools to support Logical Volume Management (LVM) on Linux";
diff --git a/pkgs/os-specific/linux/microcode/converter.nix b/pkgs/os-specific/linux/microcode/converter.nix
index ea00c7a6ae4..7b1ff08be0c 100644
--- a/pkgs/os-specific/linux/microcode/converter.nix
+++ b/pkgs/os-specific/linux/microcode/converter.nix
@@ -3,7 +3,7 @@
 stdenv.mkDerivation {
   name = "microcode2ucode-20120205";
   src = fetchurl {
-    url = "http://gentoo-overlays.zugaina.org/gentoo/portage/sys-apps/microcode-data/files/intel-microcode2ucode.c";
+    url = "sources.gentoo.org/sys-apps/microcode-data/files/intel-microcode2ucode.c";
     sha256 = "c51b1b1d8b4b28e7d5d007917c1e444af1a2ff04a9408aa9067c0e57d70164de";
   };
 
@@ -26,4 +26,4 @@ stdenv.mkDerivation {
     homepage = http://www.intel.com;
     description = "Microcode converter for Intel .dat files";
   };
-}
\ No newline at end of file
+}
diff --git a/pkgs/os-specific/linux/nvidia-x11/default.nix b/pkgs/os-specific/linux/nvidia-x11/default.nix
index b9cb0de57da..8714c342f1a 100644
--- a/pkgs/os-specific/linux/nvidia-x11/default.nix
+++ b/pkgs/os-specific/linux/nvidia-x11/default.nix
@@ -8,7 +8,7 @@
 
 with stdenv.lib;
 
-let versionNumber = "304.22"; in
+let versionNumber = "304.37"; in
 
 stdenv.mkDerivation {
   name = "nvidia-x11-${versionNumber}${optionalString (!libsOnly) "-${kernel.version}"}";
@@ -19,12 +19,12 @@ stdenv.mkDerivation {
     if stdenv.system == "i686-linux" then
       fetchurl {
         url = "http://us.download.nvidia.com/XFree86/Linux-x86/${versionNumber}/NVIDIA-Linux-x86-${versionNumber}.run";
-        sha256 = "1nyyirimpmifr7ka83q5i4wld9zpb5a7ib6vssnlq8rz825fcjqp";
+        sha256 = "0dxka66vp15xgm7z9v6x01gdvyvj3l9c33sa7zyahdxbr6h78cdb";
       }
     else if stdenv.system == "x86_64-linux" then
       fetchurl {
         url = "http://us.download.nvidia.com/XFree86/Linux-x86_64/${versionNumber}/NVIDIA-Linux-x86_64-${versionNumber}-no-compat32.run";
-        sha256 = "1jhrb9b2x8l3fy25miyyp5h11ajnj4nf45889dkxj3acrdz3z4zs";
+        sha256 = "1xjg91sh7zyn6djdm78wdfas8j7cqn96nyy5zavsnd9jh7v1i0gp";
       }
     else throw "nvidia-x11 does not support platform ${stdenv.system}";
 
diff --git a/pkgs/os-specific/linux/sysstat/default.nix b/pkgs/os-specific/linux/sysstat/default.nix
index 13655b4c91f..2b4888f89cd 100644
--- a/pkgs/os-specific/linux/sysstat/default.nix
+++ b/pkgs/os-specific/linux/sysstat/default.nix
@@ -13,9 +13,11 @@ stdenv.mkDerivation rec {
   preConfigure = ''
     export PATH_CP=$(type -tp cp)
     export PATH_CHKCONFIG=/no-such-program
-    makeFlagsArray=(SA_DIR=$out/var/log/sa SYSCONFIG_DIR=$out/etc CHOWN=true IGNORE_MAN_GROUP=y)
+    makeFlagsArray=(SA_DIR=/var/log/sa SYSCONFIG_DIR=$out/etc CHOWN=true IGNORE_MAN_GROUP=y)
   '';
 
+  patches = [ ./no-install-statedir.patch ];
+
   meta = {
     homepage = http://sebastien.godard.pagesperso-orange.fr/;
     description = "A collection of performance monitoring tools for Linux (such as sar, iostat and pidstat)";
diff --git a/pkgs/os-specific/linux/sysstat/no-install-statedir.patch b/pkgs/os-specific/linux/sysstat/no-install-statedir.patch
new file mode 100644
index 00000000000..ef81f97217f
--- /dev/null
+++ b/pkgs/os-specific/linux/sysstat/no-install-statedir.patch
@@ -0,0 +1,37 @@
+diff -rc sysstat-10.1.1/Makefile.in sysstat-10.1.1-new/Makefile.in
+*** sysstat-10.1.1/Makefile.in	2012-01-02 14:36:00.000000000 +0100
+--- sysstat-10.1.1-new/Makefile.in	2012-08-14 14:11:17.676124739 +0200
+***************
+*** 309,315 ****
+  install_base: all sa1 sa2 sysstat.sysconfig install_man install_nls \
+  	contrib/isag/isag
+  	mkdir -p $(DESTDIR)$(SA_LIB_DIR)
+! 	mkdir -p $(DESTDIR)$(SA_DIR)
+  ifeq ($(CLEAN_SA_DIR),y)
+  	find $(DESTDIR)$(SA_DIR) \( -name 'sar??' -o -name 'sa??' -o -name 'sar??.gz' -o -name 'sa??.gz' \) \
+  		-exec rm -f {} \;
+--- 309,315 ----
+  install_base: all sa1 sa2 sysstat.sysconfig install_man install_nls \
+  	contrib/isag/isag
+  	mkdir -p $(DESTDIR)$(SA_LIB_DIR)
+! 	#mkdir -p $(DESTDIR)$(SA_DIR)
+  ifeq ($(CLEAN_SA_DIR),y)
+  	find $(DESTDIR)$(SA_DIR) \( -name 'sar??' -o -name 'sa??' -o -name 'sar??.gz' -o -name 'sa??.gz' \) \
+  		-exec rm -f {} \;
+***************
+*** 344,350 ****
+  
+  install_all: install_base cron/crontab sysstat \
+  	cron/sysstat.crond cron/sysstat.cron.daily cron/sysstat.cron.hourly
+! 	$(CHOWN) $(CRON_OWNER) $(DESTDIR)$(SA_DIR)
+  	if [ -d $(DESTDIR)/etc/cron.d ]; then \
+  	   $(INSTALL_DATA) cron/sysstat.crond $(DESTDIR)/etc/cron.d/sysstat; \
+  	elif [ -d $(DESTDIR)/etc/cron.hourly -a -d $(DESTDIR)/etc/cron.daily ]; then \
+--- 344,350 ----
+  
+  install_all: install_base cron/crontab sysstat \
+  	cron/sysstat.crond cron/sysstat.cron.daily cron/sysstat.cron.hourly
+! 	#$(CHOWN) $(CRON_OWNER) $(DESTDIR)$(SA_DIR)
+  	if [ -d $(DESTDIR)/etc/cron.d ]; then \
+  	   $(INSTALL_DATA) cron/sysstat.crond $(DESTDIR)/etc/cron.d/sysstat; \
+  	elif [ -d $(DESTDIR)/etc/cron.hourly -a -d $(DESTDIR)/etc/cron.daily ]; then \
diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix
index b6497e0b0b3..e6e5822c9ea 100644
--- a/pkgs/os-specific/linux/systemd/default.nix
+++ b/pkgs/os-specific/linux/systemd/default.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
 
   buildInputs =
     [ pkgconfig intltool gperf libcap dbus kmod xz pam acl
-      cryptsetup libuuid m4 usbutils pciutils glib
+      /* cryptsetup */ libuuid m4 usbutils pciutils glib
     ];
 
   configureFlags =
@@ -49,8 +49,14 @@ stdenv.mkDerivation rec {
       done
     '';
 
-  # ‘-fstack-protector’ is necessary to build the PAM module correctly.
-  NIX_CFLAGS_COMPILE = "-DKBD_LOADKEYS=\"${kbd}/bin/loadkeys\" -DKBD_SETFONT=\"${kbd}/bin/setfont\" -fstack-protector";
+  NIX_CFLAGS_COMPILE =
+    [ "-DKBD_LOADKEYS=\"${kbd}/bin/loadkeys\""
+      "-DKBD_SETFONT=\"${kbd}/bin/setfont\""
+      # Can't say ${polkit}/bin/pkttyagent here because that would
+      # lead to a cyclic dependency.
+      "-DPOLKIT_AGENT_BINARY_PATH=\"/run/current-system/sw/bin/pkttyagent\""
+      "-fno-stack-protector"
+    ];
 
   makeFlags = "CPPFLAGS=-I${stdenv.gcc.libc}/include";
 
diff --git a/pkgs/os-specific/linux/upower/default.nix b/pkgs/os-specific/linux/upower/default.nix
index 71a05486b48..2f870e5d999 100644
--- a/pkgs/os-specific/linux/upower/default.nix
+++ b/pkgs/os-specific/linux/upower/default.nix
@@ -1,27 +1,39 @@
-{ stdenv, fetchurl, pkgconfig, glib, dbus, dbus_glib, polkit
-, intltool, libxslt, docbook_xsl, udev, libusb1, pmutils }:
+{ stdenv, fetchurl, pkgconfig, glib, dbus, dbus_glib, dbus_tools, polkit
+, intltool, libxslt, docbook_xsl, udev, libusb1, pmutils
+, useSystemd ? false, systemd ? null
+}:
 
 assert stdenv.isLinux;
 
 stdenv.mkDerivation rec {
-  name = "upower-0.9.17";
+  name = "upower-0.9.18";
 
   src = fetchurl {
     url = "http://upower.freedesktop.org/releases/${name}.tar.xz";
-    sha256 = "0a1j2pg44r6ljj9jgzlw8i5fzabpm2b2jk058kxsr77ciz96i7yg";
+    sha256 = "13q6cw2d45qp077g3bjng4yhrvm6g1y9347dkf53kscm5xfm18d1";
   };
 
-  buildInputs = [ dbus_glib polkit intltool libxslt docbook_xsl udev libusb1 ];
+  buildInputs =
+    [ dbus_glib polkit intltool libxslt docbook_xsl udev libusb1 ]
+    ++ stdenv.lib.optional useSystemd systemd;
 
   buildNativeInputs = [ pkgconfig ];
 
-  configureFlags = "--with-backend=linux --localstatedir=/var";
+  configureFlags =
+    [ "--with-backend=linux" "--localstatedir=/var" ]
+    ++ stdenv.lib.optional useSystemd
+    [ "--enable-systemd"
+      "--with-systemdsystemunitdir=$(out)/etc/systemd/system"
+      "--with-systemdutildir=$(out)/lib/systemd/system-sleep"
+    ];
 
   preConfigure =
     ''
       substituteInPlace src/linux/up-backend.c \
         --replace /usr/bin/pm- ${pmutils}/bin/pm- \
         --replace /usr/sbin/pm- ${pmutils}/sbin/pm-
+      substituteInPlace src/notify-upower.sh \
+        --replace /usr/bin/dbus-send ${dbus_tools}/bin/dbus-send
     '';
 
   installFlags = "historydir=$(TMPDIR)/foo";
diff --git a/pkgs/servers/samba/default.nix b/pkgs/servers/samba/default.nix
index 3a3051e29bf..7a73a041798 100644
--- a/pkgs/servers/samba/default.nix
+++ b/pkgs/servers/samba/default.nix
@@ -18,16 +18,15 @@
 assert useKerberos -> kerberos != null;
 
 stdenv.mkDerivation rec {
-  name = "samba-3.6.5";
+  name = "samba-3.6.7";
 
   src = fetchurl {
     url = "http://us3.samba.org/samba/ftp/stable/${name}.tar.gz";
-    sha256 = "1i40mf5rvz055zp7fy5rqp1lwlsm65g8k6n8jxw5w5f1p3rmzxla";
+    sha256 = "1jnl9v6axz30ymh6in1fwan7zjy9n5n7x70vi1afazxs27qa0n5q";
   };
 
   patches =
-    [
-      # Allow cross-builds for GNU/Hurd.
+    [ # Allow cross-builds for GNU/Hurd.
       ./libnss-wins-pthread.patch
     ];
 
diff --git a/pkgs/servers/sql/postgresql/8.3.x.nix b/pkgs/servers/sql/postgresql/8.3.x.nix
index fb4c8302d81..d4ddb36d4fe 100644
--- a/pkgs/servers/sql/postgresql/8.3.x.nix
+++ b/pkgs/servers/sql/postgresql/8.3.x.nix
@@ -1,13 +1,13 @@
 { stdenv, fetchurl, zlib, ncurses, readline }:
 
-let version = "8.3.19"; in
+let version = "8.3.20"; in
 
 stdenv.mkDerivation rec {
   name = "postgresql-${version}";
-  
+
   src = fetchurl {
     url = "mirror://postgresql/source/v${version}/${name}.tar.bz2";
-    sha256 = "1maq1gjnd111jn45d7k58av1dm273vypvwhhsbhknqywgr5hsvwq";
+    sha256 = "0qqic4wx59lgbyfmdfcgip9nrcpk10zdb91bw9b96wr1vijn2awj";
   };
 
   buildInputs = [ zlib ncurses readline ];
diff --git a/pkgs/servers/sql/postgresql/8.4.x.nix b/pkgs/servers/sql/postgresql/8.4.x.nix
index 14e948d3d4e..e1150543f36 100644
--- a/pkgs/servers/sql/postgresql/8.4.x.nix
+++ b/pkgs/servers/sql/postgresql/8.4.x.nix
@@ -1,13 +1,13 @@
 { stdenv, fetchurl, zlib, ncurses, readline }:
 
-let version = "8.4.12"; in
+let version = "8.4.13"; in
 
 stdenv.mkDerivation rec {
   name = "postgresql-${version}";
-  
+
   src = fetchurl {
     url = "mirror://postgresql/source/v${version}/${name}.tar.bz2";
-    sha256 = "0xqgzi6qrx4g7g8f38hp02qj8grrfnvc33kyijc2hf0qxhqb7dwr";
+    sha256 = "1fccqkni64vg1pi4zzcl67bm9g2brrlzjn1vh6qlyfpsld139p90";
   };
 
   buildInputs = [ zlib ncurses readline ];
diff --git a/pkgs/servers/sql/postgresql/9.0.x.nix b/pkgs/servers/sql/postgresql/9.0.x.nix
index a4896d02a3a..a28e5c33779 100644
--- a/pkgs/servers/sql/postgresql/9.0.x.nix
+++ b/pkgs/servers/sql/postgresql/9.0.x.nix
@@ -1,13 +1,13 @@
 { stdenv, fetchurl, zlib, readline }:
 
-let version = "9.0.8"; in
+let version = "9.0.9"; in
 
 stdenv.mkDerivation rec {
   name = "postgresql-${version}";
-  
+
   src = fetchurl {
     url = "mirror://postgresql/source/v${version}/${name}.tar.bz2";
-    sha256 = "1hhb9kaayrs3bqm1afg8g4p9mr3mc8hskrgy24hnwfablsl1p652";
+    sha256 = "12nslml1mg3lyvrhmdvv5g15n7vj5fk1blx1dfllylqg38c7shc7";
   };
 
   buildInputs = [ zlib readline ];
diff --git a/pkgs/servers/sql/postgresql/9.1.x.nix b/pkgs/servers/sql/postgresql/9.1.x.nix
index 8dbaf93df8f..14488d4649e 100644
--- a/pkgs/servers/sql/postgresql/9.1.x.nix
+++ b/pkgs/servers/sql/postgresql/9.1.x.nix
@@ -1,13 +1,13 @@
 { stdenv, fetchurl, zlib, readline }:
 
-let version = "9.1.4"; in
+let version = "9.1.5"; in
 
 stdenv.mkDerivation rec {
   name = "postgresql-${version}";
-  
+
   src = fetchurl {
     url = "mirror://postgresql/source/v${version}/${name}.tar.bz2";
-    sha256 = "04lp7hfh8z2n8gzib6b9j1fq70h1s91z2fxn2hlilbdfnf75lyd0";
+    sha256 = "0i6fssldjp65xfxz9dcmkhz6bk4rpw9g26zbqbc6iz164h9rr20b";
   };
 
   buildInputs = [ zlib readline ];
diff --git a/pkgs/shells/bash-completion/default.nix b/pkgs/shells/bash-completion/default.nix
index 916c7600dfd..d79c9774569 100644
--- a/pkgs/shells/bash-completion/default.nix
+++ b/pkgs/shells/bash-completion/default.nix
@@ -1,22 +1,23 @@
 { stdenv, fetchurl }:
 
 let
-  version = "1.3";
+  version = "2.0";
 in
 stdenv.mkDerivation {
   name = "bash-completion-${version}";
 
   src = fetchurl {
     url = "http://bash-completion.alioth.debian.org/files/bash-completion-${version}.tar.bz2";
-    sha256 = "8ebe30579f0f3e1a521013bcdd183193605dab353d7a244ff2582fb3a36f7bec";
+    sha256 = "e5a490a4301dfb228361bdca2ffca597958e47dd6056005ef9393a5852af5804";
   };
 
   postInstall = ''
-    rm $out/etc/profile.d/bash_completion.sh
-    rmdir $out/etc/profile.d
-    sed -i -e "s|/etc/bash_completion|$out/etc/bash_completion|g" $out/etc/bash_completion
+    sed -i "$out/share/bash-completion/bash_completion" \
+        -e 's|: .{BASH_COMPLETION_COMPAT_DIR:=.*}|BASH_COMPLETION_COMPAT_DIR="$HOME/.nix-profile/etc/bash_completion.d"|'
   '';
 
+  doCheck = true;
+
   meta = {
     homepage = "http://bash-completion.alioth.debian.org/";
     description = "Programmable completion for the bash shell";
diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix
index 749de01deff..9197ff8314b 100644
--- a/pkgs/stdenv/generic/default.nix
+++ b/pkgs/stdenv/generic/default.nix
@@ -10,6 +10,8 @@ let
 
   lib = import ../../lib;
 
+  disallowUnfree = builtins.getEnv "HYDRA_DISALLOW_UNFREE" == "1";
+
   stdenvGenerator = setupScript: rec {
 
     # The stdenv that we are producing.
@@ -30,7 +32,7 @@ let
           lib.filter lib.isDerivation initialPath;
       }
 
-      // {
+      // rec {
 
         meta = {
           description = "The default build environment for Unix packages in Nixpkgs";
@@ -39,33 +41,29 @@ let
         # Add a utility function to produce derivations that use this
         # stdenv and its shell.
         mkDerivation = attrs:
+          if disallowUnfree && attrs.meta.license or "" == "unfree" then
+            throw "package ‘${attrs.name}’ has an unfree license, refusing to evaluate"
+          else
           (derivation (
             (removeAttrs attrs ["meta" "passthru" "crossAttrs"])
             // (let
-                buildInputs = if attrs ? buildInputs then attrs.buildInputs
-                    else [];
-                buildNativeInputs = if attrs ? buildNativeInputs then
-                    attrs.buildNativeInputs else [];
-                propagatedBuildInputs = if attrs ? propagatedBuildInputs then
-                    attrs.propagatedBuildInputs else [];
-                propagatedBuildNativeInputs = if attrs ?
-                    propagatedBuildNativeInputs then
-                    attrs.propagatedBuildNativeInputs else [];
-                crossConfig = if (attrs ? crossConfig) then attrs.crossConfig else
-                   null;
+              buildInputs = attrs.buildInputs or [];
+              buildNativeInputs = attrs.buildNativeInputs or [];
+              propagatedBuildInputs = attrs.propagatedBuildInputs or [];
+              propagatedBuildNativeInputs = attrs.propagatedBuildNativeInputs or [];
+              crossConfig = attrs.crossConfig or null;
             in
             {
-              builder = if attrs ? realBuilder then attrs.realBuilder else shell;
-              args = if attrs ? args then attrs.args else
-                ["-e" (if attrs ? builder then attrs.builder else ./default-builder.sh)];
+              builder = attrs.realBuilder or shell;
+              args = attrs.args or ["-e" (attrs.builder or ./default-builder.sh)];
               stdenv = result;
               system = result.system;
 
-              # That build by the cross compiler
+              # Inputs built by the cross compiler.
               buildInputs = lib.optionals (crossConfig != null) buildInputs;
               propagatedBuildInputs = lib.optionals (crossConfig != null)
                   propagatedBuildInputs;
-              # That build by the usual native compiler
+              # Inputs built by the usual native compiler.
               buildNativeInputs = buildNativeInputs ++ lib.optionals
                 (crossConfig == null) buildInputs;
               propagatedBuildNativeInputs = propagatedBuildNativeInputs ++
@@ -77,13 +75,11 @@ let
           # passed to the builder and is not a dependency.  But since we
           # include it in the result, it *is* available to nix-env for
           # queries.
-          //
-          { meta = if attrs ? meta then attrs.meta else {}; }
+          // { meta = attrs.meta or {}; }
           # Pass through extra attributes that are not inputs, but
           # should be made available to Nix expressions using the
           # derivation (e.g., in assertions).
-          //
-          (if attrs ? passthru then attrs.passthru else {});
+          // (attrs.passthru or {});
 
         # Utility flags to test the type of platform.
         isDarwin = result.system == "i686-darwin"
@@ -96,6 +92,9 @@ let
                || result.system == "armv7l-linux"
                || result.system == "mips64el-linux";
         isGNU = result.system == "i686-gnu";      # GNU/Hurd
+        isGlibc = isGNU                           # useful for `stdenvNative'
+               || isLinux
+               || result.system == "x86_64-kfreebsd-gnu";
         isSunOS = result.system == "i686-solaris"
                || result.system == "x86_64-solaris";
         isCygwin = result.system == "i686-cygwin";
diff --git a/pkgs/tools/archivers/atool/default.nix b/pkgs/tools/archivers/atool/default.nix
new file mode 100644
index 00000000000..d376f75a552
--- /dev/null
+++ b/pkgs/tools/archivers/atool/default.nix
@@ -0,0 +1,18 @@
+{stdenv, fetchurl, perl}:
+
+stdenv.mkDerivation rec {
+  name = "atool-0.39";
+  src = fetchurl {
+    url = http://savannah.nongnu.org/download/atool/atool-0.39.0.tar.gz;
+    sha256 = "aaf60095884abb872e25f8e919a8a63d0dabaeca46faeba87d12812d6efc703b";
+  };
+
+  buildInputs = [ perl ];
+
+  meta = {
+    homepage = http://www.nongnu.org/atool;
+    description = "Archive command line helper";
+    platforms = stdenv.lib.platforms.all;
+  };
+}
+
diff --git a/pkgs/tools/misc/desktop-file-utils/default.nix b/pkgs/tools/misc/desktop-file-utils/default.nix
index 4266f4ab768..285160e50d6 100644
--- a/pkgs/tools/misc/desktop-file-utils/default.nix
+++ b/pkgs/tools/misc/desktop-file-utils/default.nix
@@ -13,5 +13,6 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = http://www.freedesktop.org/wiki/Software/desktop-file-utils;
     description = "Command line utilities for working with .desktop files";
+    platforms = stdenv.lib.platforms.linux;
   };
 }
diff --git a/pkgs/tools/misc/lockfile-progs/default.nix b/pkgs/tools/misc/lockfile-progs/default.nix
new file mode 100644
index 00000000000..41fca212158
--- /dev/null
+++ b/pkgs/tools/misc/lockfile-progs/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, fetchurl, liblockfile }:
+
+stdenv.mkDerivation rec {
+  _name   = "lockfile-progs";
+  version = "0.1.16";
+  name    = "${_name}-${version}";
+
+  src = fetchurl {
+    url = "mirror://debian/pool/main/l/${_name}/${_name}_${version}.tar.gz";
+    sha256 = "0sca19mg0lk68ms6idy4vfp8dyjpcbq9f143v9qzjyk86bb34lgr";
+  };
+
+  buildInputs = [ liblockfile ];
+
+  installPhase = ''
+    mkdir -p $out/bin $out/man/man1
+    install -s bin/* $out/bin
+    install man/*.1 $out/man/man1
+  '';
+
+  meta = {
+    description = "Programs for locking and unlocking files and mailboxes";
+    homepage = http://packages.debian.org/sid/lockfile-progs;
+    license = "GPLv2";
+
+    maintainers = [ stdenv.lib.maintainers.bluescreen303 ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/pkgs/tools/misc/ncdu/default.nix b/pkgs/tools/misc/ncdu/default.nix
new file mode 100644
index 00000000000..944b6ea77e1
--- /dev/null
+++ b/pkgs/tools/misc/ncdu/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, ncurses }:
+
+stdenv.mkDerivation rec {
+  name = "ncdu-${version}";
+  version = "1.8";
+
+  src = fetchurl {
+    url = "http://dev.yorhel.nl/download/${name}.tar.gz";
+    sha256 = "42aaf0418c05e725b39b220166a9c604a9c54c0fbf7692c9c119b36d0ed5d099";
+  };
+
+  buildInputs = [ ncurses ];
+
+  meta = {
+    description = "An ncurses disk usage analyzer.";
+    homepage = http://dev.yorhel.nl/ncdu;
+    license = stdenv.lib.licenses.mit;
+  };
+}
diff --git a/pkgs/tools/misc/pv/default.nix b/pkgs/tools/misc/pv/default.nix
index 8150e7118dc..444408fec41 100644
--- a/pkgs/tools/misc/pv/default.nix
+++ b/pkgs/tools/misc/pv/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl } :
 
 stdenv.mkDerivation rec {
-  name = "pv-1.3.1";
+  name = "pv-1.3.4";
 
   src = fetchurl {
     url = "http://www.ivarch.com/programs/sources/${name}.tar.bz2";
-    sha256 = "1fwvdj663g3jf3rcxi788pv1l7s86sxna78xi2nl5qimng05y8jl";
+    sha256 = "114b730pghgg4gv9d798817n3am88p2b0xgdavch1vhklzh33c16";
   };
 
   meta = {
diff --git a/pkgs/tools/misc/xclip/default.nix b/pkgs/tools/misc/xclip/default.nix
index ae9fed67117..1014f11453b 100644
--- a/pkgs/tools/misc/xclip/default.nix
+++ b/pkgs/tools/misc/xclip/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, x11, libXmu }:
 
-stdenv.mkDerivation {
-  name = "xclip-0.11";
+stdenv.mkDerivation rec {
+  name = "xclip-0.12";
 
   src = fetchurl {
-    url = "mirror://sourceforge/xclip/xclip-0.11.tar.gz";
-    sha256 = "0ipwxkfqz66fz6jlln1v46sd2kr6bkqzq6j5hkzn6pb3grmzsacg";
+    url = "mirror://sourceforge/xclip/${name}.tar.gz";
+    sha256 = "0ibcf46rldnv0r424qcnai1fa5iq3lm5q5rdd7snsi5sb78gmixp";
   };
 
   buildInputs = [ x11 libXmu ];
diff --git a/pkgs/tools/package-management/nix/unstable.nix b/pkgs/tools/package-management/nix/unstable.nix
index 1ed19bb9b25..103d92a0ee9 100644
--- a/pkgs/tools/package-management/nix/unstable.nix
+++ b/pkgs/tools/package-management/nix/unstable.nix
@@ -5,11 +5,11 @@
 }:
 
 stdenv.mkDerivation rec {
-  name = "nix-1.1pre2749_ccc52ad";
+  name = "nix-1.2pre2793_d950cfe";
 
   src = fetchurl {
-    url = "http://hydra.nixos.org/build/2841643/download/4/${name}.tar.bz2";
-    sha256 = "eae2135dd70d2734080ee644a597e131f60e71991dbabdabf67ab0818ff1f6fc";
+    url = "http://hydra.nixos.org/build/2955697/download/4/${name}.tar.bz2";
+    sha256 = "f91367d8e7ed795b2bc9a47fb3ecff00d005633f248ecaafa25e8e101a5dc682";
   };
 
   buildNativeInputs = [ perl pkgconfig ];
diff --git a/pkgs/tools/system/gptfdisk/default.nix b/pkgs/tools/system/gptfdisk/default.nix
index f82c94c0a72..9db39411854 100644
--- a/pkgs/tools/system/gptfdisk/default.nix
+++ b/pkgs/tools/system/gptfdisk/default.nix
@@ -1,11 +1,11 @@
 { fetchurl, stdenv, libuuid, popt, icu, ncurses }:
 
 stdenv.mkDerivation rec {
-  name = "gptfdisk-0.8.0";
+  name = "gptfdisk-0.8.5";
 
   src = fetchurl {
     url = "mirror://sourceforge/gptfdisk/${name}.tar.gz";
-    sha256 = "096qmlqcsvjklihggwphdmd0y78jz4ghf7gf4fvjnskp7mg4ng31";
+    sha256 = "1yaax2mga7n847x1ihbgvv4drzvndgnn4mii0mz1ab1150gnkk0m";
   };
 
   buildInputs = [ libuuid popt icu ncurses ];
diff --git a/pkgs/tools/system/logcheck/default.nix b/pkgs/tools/system/logcheck/default.nix
new file mode 100644
index 00000000000..1c57711940b
--- /dev/null
+++ b/pkgs/tools/system/logcheck/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchurl, lockfileProgs, perl, mimeConstruct }:
+
+stdenv.mkDerivation rec {
+  _name   = "logcheck";
+  version = "1.3.15";
+  name    = "${_name}-${version}";
+
+  src = fetchurl {
+    url = "mirror://debian/pool/main/l/${_name}/${_name}_${version}.tar.gz";
+    sha256 = "1rdrs12hkm5i5yyz89a6cwhf4fzjkbcd4q4zy6sk148aji9lg6xj";
+  };
+
+  preConfigure = ''
+    substituteInPlace src/logtail --replace "/usr/bin/perl" "${perl}/bin/perl"
+    substituteInPlace src/logtail2 --replace "/usr/bin/perl" "${perl}/bin/perl"
+
+    sed -i -e 's|! -f /usr/bin/lockfile|! -f ${lockfileProgs}/bin/lockfile|' \
+           -e 's|^\([ \t]*\)lockfile-|\1${lockfileProgs}/bin/lockfile-|' \
+           -e "s|/usr/sbin/logtail2|$out/sbin/logtail2|" \
+           -e 's|mime-construct|${mimeConstruct}/bin/mime-construct|' \
+           -e 's|\$(run-parts --list "\$dir")|"$dir"/*|' src/logcheck
+  '';
+
+  makeFlags = [
+    "DESTDIR=$(out)"
+    "SBINDIR=sbin"
+    "BINDIR=bin"
+    "SHAREDIR=share/logtail/detectrotate"
+ ];
+
+  meta = {
+    description = "Mails anomalies in the system logfiles to the administrator.";
+    longDescription = ''
+      Mails anomalies in the system logfiles to the administrator.
+
+      Logcheck helps spot problems and security violations in your logfiles automatically and will send the results to you by e-mail.
+      Logcheck was part of the Abacus Project of security tools, but this version has been rewritten.
+    '';
+    homepage = http://logcheck.org;
+    license = "GPLv2";
+
+    maintainers = [ stdenv.lib.maintainers.bluescreen303 ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 30d8410cad9..a9b9587c5ea 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -437,6 +437,8 @@ let
 
   bfr = callPackage ../tools/misc/bfr { };
 
+  boomerang = callPackage ../development/tools/boomerang { };
+
   bootchart = callPackage ../tools/system/bootchart { };
 
   bsod = callPackage ../misc/emulators/bsod { };
@@ -492,6 +494,8 @@ let
     inherit (haskellPackages) pandoc;
   };
 
+  atool = callPackage ../tools/archivers/atool { };
+
   bzip2 = callPackage ../tools/compression/bzip2 { };
 
   cabextract = callPackage ../tools/archivers/cabextract { };
@@ -962,6 +966,8 @@ let
 
   less = callPackage ../tools/misc/less { };
 
+  lockfileProgs = callPackage ../tools/misc/lockfile-progs { };
+
   logstash = callPackage ../tools/misc/logstash { };
 
   klavaro = callPackage ../games/klavaro {};
@@ -994,6 +1000,10 @@ let
 
   libtorrent = callPackage ../tools/networking/p2p/libtorrent { };
 
+  logcheck = callPackage ../tools/system/logcheck {
+    inherit (perlPackages) mimeConstruct;
+  };
+
   logrotate = callPackage ../tools/system/logrotate { };
 
   logstalgica = callPackage ../tools/graphics/logstalgica {};
@@ -2048,6 +2058,15 @@ let
       else null;
   }));
 
+  gcc47_debug = lowPrio (wrapGCC (callPackage ../development/compilers/gcc/4.7 {
+    stripped = false;
+
+    inherit noSysDirs;
+    cross = null;
+    libcCross = null;
+    binutilsCross = null;
+  }));
+
   gccApple =
     wrapGCC (makeOverridable
       (if stdenv.system == "i686-darwin"
@@ -2297,6 +2316,8 @@ let
   haskellPackages_ghc741              = recurseIntoAttrs (haskell.packages_ghc741.highPrio);
   # Stable branch snapshot.
   haskellPackages_ghc742              = recurseIntoAttrs (haskell.packages_ghc742);
+  # Release candidate.
+  haskellPackages_ghc761              =                   haskell.packages_ghc761;
   # Reasonably current HEAD snapshot.
   haskellPackages_ghcHEAD             =                   haskell.packages_ghcHEAD;
 
@@ -2329,37 +2350,30 @@ let
 
   path64 = callPackage ../development/compilers/path64 { };
 
+  openjdkBootstrap = callPackage ../development/compilers/openjdk/bootstrap.nix {};
+
   openjdk =
     if stdenv.isDarwin then
       callPackage ../development/compilers/openjdk-darwin { }
     else
-      callPackage ../development/compilers/openjdk { };
+      callPackage ../development/compilers/openjdk {
+        jdk = pkgs.openjdkBootstrap;
+        ant = pkgs.ant.override { jdk = pkgs.openjdkBootstrap; };
+      };
 
   openjre = callPackage ../development/compilers/openjdk {
     jreOnly = true;
   };
 
-  j2sdk14x = (
-    assert system == "i686-linux";
-    import ../development/compilers/jdk/default-1.4.nix {
-      inherit fetchurl stdenv;
-    });
-
-  jdk5 = (
-    assert system == "i686-linux" || system == "x86_64-linux";
-    callPackage ../development/compilers/jdk/default-5.nix { });
-
-  jdk       = if stdenv.isDarwin then openjdk else jdkdistro true false;
-  jre       = jdkdistro false false;
+  jdk = if stdenv.isDarwin then openjdk else jdkdistro true false;
+  jre = jdkdistro false false;
 
-  jdkPlugin = lowPrio (jdkdistro true true);
   jrePlugin = lowPrio (jdkdistro false true);
 
   supportsJDK =
     system == "i686-linux" ||
     system == "x86_64-linux" ||
-    system == "i686-cygwin" ||
-    system == "powerpc-linux";
+    system == "i686-cygwin";
 
   jdkdistro = installjdk: pluginSupport:
        (assert supportsJDK;
@@ -2671,6 +2685,8 @@ let
 
   guile = guile_2_0;
 
+  hadoop = callPackage ../applications/networking/cluster/hadoop { };
+
   io = callPackage ../development/interpreters/io { };
 
   j = callPackage ../development/interpreters/j {};
@@ -2868,8 +2884,6 @@ let
 
   apacheAntOpenJDK = apacheAnt.override { jdk = openjdk; };
 
-  apacheAnt14 = apacheAnt.override { jdk = j2sdk14x; };
-
   apacheAntGcj = callPackage ../development/tools/build-managers/apache-ant/from-source.nix {
     # must be either pre-built or built with GCJ *alone*
     gcj = gcj.gcc; # use the raw GCJ, which has ${gcj}/lib/jvm
@@ -2888,7 +2902,7 @@ let
   automake110x = callPackage ../development/tools/misc/automake/automake-1.10.x.nix { };
 
   automake111x = callPackage ../development/tools/misc/automake/automake-1.11.x.nix {
-    doCheck = !stdenv.isArm && !stdenv.isCygwin
+    doCheck = !stdenv.isArm && !stdenv.isCygwin && !stdenv.isMips
       # Some of the parallel tests seem to hang on `i386-pc-solaris2.11'.
       && stdenv.system != "i686-solaris"
 
@@ -2897,7 +2911,7 @@ let
   };
 
   automake112x = callPackage ../development/tools/misc/automake/automake-1.12.x.nix {
-    doCheck = !stdenv.isArm && !stdenv.isCygwin
+    doCheck = !stdenv.isArm && !stdenv.isCygwin && !stdenv.isMips
       # Some of the parallel tests seem to hang on `i386-pc-solaris2.11'.
       && stdenv.system != "i686-solaris";
   };
@@ -3124,6 +3138,8 @@ let
 
   patchelf = callPackage ../development/tools/misc/patchelf { };
 
+  patchelfUnstable = callPackage ../development/tools/misc/patchelf/unstable.nix { };
+
   peg = callPackage ../development/tools/parsing/peg { };
 
   pmccabe = callPackage ../development/tools/misc/pmccabe { };
@@ -3139,6 +3155,8 @@ let
 
   premake = callPackage ../development/tools/misc/premake { };
 
+  pstack = callPackage ../development/tools/misc/gdb/pstack.nix { };
+
   radare = callPackage ../development/tools/analysis/radare {
     inherit (gnome) vte;
     lua = lua5;
@@ -3270,6 +3288,8 @@ let
 
   axis = callPackage ../development/libraries/axis { };
 
+  babl_0_0_22 = callPackage ../development/libraries/babl/0_0_22.nix { };
+
   babl = callPackage ../development/libraries/babl { };
 
   beecrypt = callPackage ../development/libraries/beecrypt { };
@@ -3523,6 +3543,9 @@ let
     #  avocodec avformat librsvg
   };
 
+  gegl_0_0_22 = callPackage ../development/libraries/gegl/0_0_22.nix {
+    #  avocodec avformat librsvg
+  };
   geoclue = callPackage ../development/libraries/geoclue {};
 
   geoip = builderDefsPackage ../development/libraries/geoip {
@@ -4107,6 +4130,8 @@ let
 
   liblqr1 = callPackage ../development/libraries/liblqr-1 { };
 
+  liblockfile = callPackage ../development/libraries/liblockfile { };
+
   libmhash = callPackage ../development/libraries/libmhash {};
 
   libmtp = callPackage ../development/libraries/libmtp { };
@@ -4131,9 +4156,12 @@ let
 
   libiconv = callPackage ../development/libraries/libiconv { };
 
-  libiconvOrEmpty = if (libiconvOrNull == null) then [] else libiconv;
+  libiconvOrEmpty = if (libiconvOrNull == null) then [] else [libiconv];
 
-  libiconvOrNull = if gcc ? libc then null else libiconv;
+  libiconvOrNull =
+    if ((gcc ? libc && (gcc.libc != null)) || stdenv.isGlibc)
+    then null
+    else libiconv;
 
   libiconvOrLibc = if (libiconvOrNull == null) then gcc.libc else libiconv;
 
@@ -5013,9 +5041,7 @@ let
 
   javasvn = callPackage ../development/libraries/java/javasvn { };
 
-  jclasslib = callPackage ../development/tools/java/jclasslib {
-    ant = apacheAnt14;
-  };
+  jclasslib = callPackage ../development/tools/java/jclasslib { };
 
   jdom = callPackage ../development/libraries/java/jdom { };
 
@@ -5284,7 +5310,7 @@ let
 
   rpcbind = callPackage ../servers/rpcbind { };
 
-  monetdb = callPackage ../servers/sql/monetdb { };
+  #monetdb = callPackage ../servers/sql/monetdb { };
 
   mongodb = callPackage ../servers/nosql/mongodb {
     boost = boost149;
@@ -5451,6 +5477,8 @@ let
     inherit (perlPackages) LocaleGettext TermReadKey RpcXML;
   };
 
+  atop = callPackage ../os-specific/linux/atop { };
+
   b43Firmware_5_1_138 = callPackage ../os-specific/linux/firmware/b43-firmware/5.1.138.nix { };
 
   b43FirmwareCutter = callPackage ../os-specific/linux/firmware/b43-firmware-cutter { };
@@ -6109,7 +6137,7 @@ let
 
   uclibc = callPackage ../os-specific/linux/uclibc { };
 
-  uclibcCross = import ../os-specific/linux/uclibc {
+  uclibcCross = callPackage ../os-specific/linux/uclibc {
     inherit fetchurl stdenv libiconv;
     linuxHeaders = linuxHeadersCross;
     gccCross = gccCrossStageStatic;
@@ -6670,6 +6698,8 @@ let
 
     coffee = callPackage ../applications/editors/emacs-modes/coffee { };
 
+    colorTheme = callPackage ../applications/editors/emacs-modes/color-theme { };
+
     cua = callPackage ../applications/editors/emacs-modes/cua { };
 
     ecb = callPackage ../applications/editors/emacs-modes/ecb { };
@@ -6688,6 +6718,8 @@ let
 
     gist = callPackage ../applications/editors/emacs-modes/gist { };
 
+    jade = callPackage ../applications/editors/emacs-modes/jade { };
+
     jdee = callPackage ../applications/editors/emacs-modes/jdee {
       # Requires Emacs 23, for `avl-tree'.
     };
@@ -6734,11 +6766,15 @@ let
 
     quack = callPackage ../applications/editors/emacs-modes/quack { };
 
+    rectMark = callPackage ../applications/editors/emacs-modes/rect-mark { };
+
     remember = callPackage ../applications/editors/emacs-modes/remember { };
 
     rudel = callPackage ../applications/editors/emacs-modes/rudel { };
 
     scalaMode = callPackage ../applications/editors/emacs-modes/scala-mode { };
+
+    sunriseCommander = callPackage ../applications/editors/emacs-modes/sunrise-commander { };
   };
 
   emacs22Packages = emacsPackages emacs22 pkgs.emacs22Packages;
@@ -6879,7 +6915,7 @@ let
 
   get_iplayer = callPackage ../applications/misc/get_iplayer {};
 
-  gimp = callPackage ../applications/graphics/gimp {
+  gimp_2_6 = callPackage ../applications/graphics/gimp {
     inherit (gnome) libart_lgpl;
   };
 
@@ -6887,6 +6923,8 @@ let
     inherit (gnome) libart_lgpl;
   };
 
+  gimp = gimp_2_6;
+
   gimpPlugins = recurseIntoAttrs (import ../applications/graphics/gimp/plugins {
     inherit pkgs gimp;
   });
@@ -6897,6 +6935,7 @@ let
   git = gitAndTools.git;
   gitFull = gitAndTools.gitFull;
   gitSVN = gitAndTools.gitSVN;
+  tig = gitAndTools.tig;
 
   giv = callPackage ../applications/graphics/giv {
     pcre = pcre.override { unicodeSupport = true; };
@@ -7095,6 +7134,8 @@ let
 
   bip = callPackage ../applications/networking/irc/bip { };
 
+  jack_capture = callPackage ../applications/audio/jack-capture { };
+
   jackmeter = callPackage ../applications/audio/jackmeter { };
 
   jedit = callPackage ../applications/editors/jedit { };
@@ -7148,6 +7189,7 @@ let
     inherit (gnome) GConf ORBit2 gnome_vfs;
     zip = zip.override { enableNLS = false; };
     boost = boost149;
+    jdk = openjdk;
     fontsConf = makeFontsConf {
       fontDirectories = [
         freefont_ttf xorg.fontmiscmisc xorg.fontbhttf
@@ -7317,6 +7359,8 @@ let
 
   navit = callPackage ../applications/misc/navit { };
 
+  ncdu = callPackage ../tools/misc/ncdu { };
+
   nedit = callPackage ../applications/editors/nedit {
       motif = lesstif;
   };
@@ -7815,10 +7859,16 @@ let
 
   xineUI = callPackage ../applications/video/xine-ui { };
 
-  xneur = callPackage ../applications/misc/xneur { };
+  xneur_0_13 = callPackage ../applications/misc/xneur { };
 
   xneur_0_8 = callPackage ../applications/misc/xneur/0.8.nix { };
 
+  xneur = xneur_0_13;
+
+  gxneur = callPackage ../applications/misc/gxneur  {
+    inherit (gnome) libglade GConf;
+  };
+
   xournal = callPackage ../applications/graphics/xournal {
     inherit (gnome) libgnomeprint libgnomeprintui libgnomecanvas;
   };
@@ -8411,6 +8461,11 @@ let
     camlp5 = ocamlPackages.camlp5_transitional;
   };
 
+  coq_8_3 = callPackage ../applications/science/logic/coq/8.3.nix {
+    inherit (ocamlPackages) findlib lablgtk;
+    camlp5 = ocamlPackages.camlp5_transitional;
+  };
+
   cvc3 = callPackage ../applications/science/logic/cvc3 {};
 
   eprover = callPackage ../applications/science/logic/eProver {
@@ -8464,6 +8519,7 @@ let
   spass = callPackage ../applications/science/logic/spass {};
 
   ssreflect = callPackage ../applications/science/logic/ssreflect {
+    coq = coq_8_3;
     camlp5 = ocamlPackages.camlp5_transitional;
   };
 
@@ -8608,9 +8664,8 @@ let
 
   martyr = callPackage ../development/libraries/martyr { };
 
-  maven = callPackage ../misc/maven/maven-1.0.nix { };
-  maven2 = callPackage ../misc/maven { };
-  maven3 = callPackage ../misc/maven/3.0.nix { };
+  maven = maven3;
+  maven3 = callPackage ../misc/maven { jdk = openjdk; };
 
   mess = callPackage ../misc/emulators/mess {
     inherit (pkgs.gnome) GConf;
@@ -8625,14 +8680,10 @@ let
     stateDir = getConfig [ "nix" "stateDir" ] "/nix/var";
   };
 
-  nixUnstable = nix;
-
-  /*
   nixUnstable = callPackage ../tools/package-management/nix/unstable.nix {
     storeDir = getConfig [ "nix" "storeDir" ] "/nix/store";
     stateDir = getConfig [ "nix" "stateDir" ] "/nix/var";
   };
-  */
 
   nixCustomFun = src: preConfigure: enableScripts: configureFlags:
     import ../tools/package-management/nix/custom.nix {
diff --git a/pkgs/top-level/haskell-defaults.nix b/pkgs/top-level/haskell-defaults.nix
index 579b20fcc23..e076a92350d 100644
--- a/pkgs/top-level/haskell-defaults.nix
+++ b/pkgs/top-level/haskell-defaults.nix
@@ -256,6 +256,12 @@
                prefFun = ghc741Prefs;
              };
 
+  packages_ghc761 =
+    packages { ghcPath = ../development/compilers/ghc/7.6.1.nix;
+               ghcBinary = ghc704Binary;
+               prefFun = ghcHEADPrefs;
+             };
+
   # Reasonably current HEAD snapshot. Should *always* be lowPrio.
   packages_ghcHEAD =
     packages { ghcPath = ../development/compilers/ghc/head.nix;
diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix
index 7a40423c998..f2d6e28de4b 100644
--- a/pkgs/top-level/haskell-packages.nix
+++ b/pkgs/top-level/haskell-packages.nix
@@ -128,7 +128,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y);
     HTTP         = self.HTTP_4000_2_3;          # 7.5 ok
     HUnit        = self.HUnit_1_2_5_1;          # 7.5 ok
     mtl          = self.mtl_2_1_2;              # 7.5 ok
-    network      = self.network_2_3_0_14;       # 7.5 ok
+    network      = self.network_2_3_1_0;        # 7.5 ok
     OpenGL       = self.OpenGL_2_2_3_1;         # 7.5 fail
     parallel     = self.parallel_3_2_0_2;       # 7.5 fail
     parsec       = self.parsec_3_1_3;           # 7.5 ok
@@ -139,7 +139,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y);
     regexPosix   = self.regexPosix_0_95_1;      # 7.5 fail
     stm          = self.stm_2_4;                # 7.5 ok
     syb          = self.syb_0_3_7;              # 7.5 ok
-    text         = self.text_0_11_2_2;          # 7.5 ok
+    text         = self.text_0_11_2_3;          # 7.5 ok
     transformers = self.transformers_0_3_0_0;   # 7.5 ok
     xhtml        = self.xhtml_3000_2_1;         # 7.5 ok
     zlib         = self.zlib_0_5_3_3;           # 7.5 fail
@@ -533,8 +533,8 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y);
   colour = callPackage ../development/libraries/haskell/colour {};
 
   comonad_1_1_1_6 = callPackage ../development/libraries/haskell/comonad/1.1.1.6.nix {};
-  comonad_3_0_0_1 = callPackage ../development/libraries/haskell/comonad/3.0.0.1.nix {};
-  comonad = self.comonad_3_0_0_1;
+  comonad_3_0_0_2 = callPackage ../development/libraries/haskell/comonad/3.0.0.2.nix {};
+  comonad = self.comonad_3_0_0_2;
 
   comonadTransformers_2_1_2 = callPackage ../development/libraries/haskell/comonad-transformers/2.1.2.nix {
     comonad = self.comonad_1_1_1_6;
@@ -1110,8 +1110,8 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y);
   network_2_3_0_2 = callPackage ../development/libraries/haskell/network/2.3.0.2.nix {};
   network_2_3_0_5 = callPackage ../development/libraries/haskell/network/2.3.0.5.nix {};
   network_2_3_0_13 = callPackage ../development/libraries/haskell/network/2.3.0.13.nix {};
-  network_2_3_0_14 = callPackage ../development/libraries/haskell/network/2.3.0.14.nix {};
-  network = self.network_2_3_0_14;
+  network_2_3_1_0 = callPackage ../development/libraries/haskell/network/2.3.1.0.nix {};
+  network = self.network_2_3_1_0;
 
   networkConduit = callPackage ../development/libraries/haskell/network-conduit {};
 
@@ -1410,6 +1410,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y);
 
   SMTPClient = callPackage ../development/libraries/haskell/SMTPClient {};
 
+  split_0_1 = callPackage ../development/libraries/haskell/split/0.1.nix {};
   split = callPackage ../development/libraries/haskell/split {};
 
   stbImage = callPackage ../development/libraries/haskell/stb-image {};
@@ -1478,8 +1479,8 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y);
   text_0_11_1_5 = callPackage ../development/libraries/haskell/text/0.11.1.5.nix {};
   text_0_11_1_13 = callPackage ../development/libraries/haskell/text/0.11.1.13.nix {};
   text_0_11_2_0 = callPackage ../development/libraries/haskell/text/0.11.2.0.nix {};
-  text_0_11_2_2 = callPackage ../development/libraries/haskell/text/0.11.2.2.nix {};
-  text = self.text_0_11_2_2;
+  text_0_11_2_3 = callPackage ../development/libraries/haskell/text/0.11.2.3.nix {};
+  text = self.text_0_11_2_3;
 
   thespian = callPackage ../development/libraries/haskell/thespian {};
 
@@ -1781,6 +1782,7 @@ let result = let callPackage = x : y : modifyPrio (newScope result.final x y);
 
   xmonadExtras = callPackage ../applications/window-managers/xmonad/xmonad-extras.nix {
     X11 = self.X11_1_5_0_1;
+    split = self.split_0_1;
   };
 
   # Tools.
diff --git a/pkgs/top-level/node-packages.nix b/pkgs/top-level/node-packages.nix
index d263e68981a..c16c53d4a05 100644
--- a/pkgs/top-level/node-packages.nix
+++ b/pkgs/top-level/node-packages.nix
@@ -1,13 +1,13 @@
 { pkgs, stdenv, nodejs, fetchurl }:
 
-let buildNodePackage = import ../development/web/nodejs/build-node-package.nix {
-  inherit stdenv nodejs;
-}; in
-
 let self = {
+  buildNodePackage = import ../development/web/nodejs/build-node-package.nix {
+    inherit stdenv nodejs;
+  };
+
   "coffee-script" = self."coffee-script-1.3.3";
 
-  "coffee-script-1.3.3" = buildNodePackage rec {
+  "coffee-script-1.3.3" = self.buildNodePackage rec {
     name = "coffee-script-1.3.3";
     src = fetchurl {
       url = "http://registry.npmjs.org/coffee-script/-/${name}.tgz";
diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix
index d33f5a78b8f..eeba996990d 100644
--- a/pkgs/top-level/perl-packages.nix
+++ b/pkgs/top-level/perl-packages.nix
@@ -827,7 +827,7 @@ rec {
   };
 
   CompressRawZlib = import ../development/perl-modules/Compress-Raw-Zlib {
-    inherit fetchurl buildPerlPackage;
+    inherit fetchurl buildPerlPackage stdenv;
     inherit (pkgs) zlib;
   };
 
@@ -2219,6 +2219,14 @@ rec {
     };
   };
 
+  IPCSignal = buildPerlPackage rec {
+    name = "IPC-Signal-1.00";
+    src = fetchurl {
+      url = "mirror://cpan/authors/id/R/RO/ROSCH/${name}.tar.gz";
+      sha256 = "1l3g0zrcwf2whwjhbpwdcridb7c77mydwxvfykqg1h6hqb4gj8bw";
+    };
+  };
+
   JSON = buildPerlPackage rec {
     name = "JSON-2.53";
     src = fetchurl {
@@ -2464,6 +2472,15 @@ rec {
     };
   };
 
+  mimeConstruct = buildPerlPackage rec {
+    name = "mime-construct-1.11";
+    src = fetchurl {
+      url = "mirror://cpan/authors/id/R/RO/ROSCH/${name}.tar.gz";
+      sha256 = "00wk9950i9q6qwp1vdq9xdddgk54lqd0bhcq2hnijh8xnmhvpmsc";
+    };
+    buildInputs = [ ProcWaitStat ];
+  };
+
   MIMETypes = buildPerlPackage rec {
     name = "MIME-Types-1.27";
     src = fetchurl {
@@ -3129,6 +3146,15 @@ rec {
     doCheck = false;
   };
 
+  ProcWaitStat = buildPerlPackage rec {
+    name = "Proc-WaitStat-1.00";
+    src = fetchurl {
+      url = "mirror://cpan//authors/id/R/RO/ROSCH/${name}.tar.gz";
+      sha256 = "1g3l8jzx06x4l4p0x7fyn4wvg6plfzl420irwwb9v447wzsn6xfh";
+    };
+    propagatedBuildInputs = [ IPCSignal ];
+  };
+
   PSGI = buildPerlPackage rec {
     name = "PSGI-1.03";
     src = fetchurl {
diff --git a/pkgs/top-level/release.nix b/pkgs/top-level/release.nix
index 5391b3a51c5..d8e192a6e55 100644
--- a/pkgs/top-level/release.nix
+++ b/pkgs/top-level/release.nix
@@ -104,7 +104,7 @@ with (import ./release-lib.nix);
   ghdl = linux;
   ghostscript = linux;
   ghostscriptX = linux;
-  gimp = linux;
+  gimp_2_8 = linux;
   git = linux;
   gitFull = linux;
   glibc = linux;
@@ -448,7 +448,7 @@ with (import ./release-lib.nix);
     xlsclients = linux;
     xmessage = linux;
     xorgserver = linux;
-    xprop = linux;    
+    xprop = linux;
     xrandr = linux;
     xrdb = linux;
     xset = linux;
@@ -474,4 +474,3 @@ with (import ./release-lib.nix);
   };
 
 } ))
-