summary refs log tree commit diff
path: root/pkgs/development/libraries
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-06-25 18:42:56 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-06-25 18:42:56 +0200
commit552fd3d599851336aa21ef073d1f7836566e454f (patch)
treeb2ebdeaa32426d12e21020410a0eb1a12881f8f6 /pkgs/development/libraries
parentcc61d31902d67b94333f53a5ab5772330bbc21cc (diff)
parent9dc35999602bc3bf2d7358a9ff79b9530e8d1975 (diff)
downloadnixpkgs-552fd3d599851336aa21ef073d1f7836566e454f.tar
nixpkgs-552fd3d599851336aa21ef073d1f7836566e454f.tar.gz
nixpkgs-552fd3d599851336aa21ef073d1f7836566e454f.tar.bz2
nixpkgs-552fd3d599851336aa21ef073d1f7836566e454f.tar.lz
nixpkgs-552fd3d599851336aa21ef073d1f7836566e454f.tar.xz
nixpkgs-552fd3d599851336aa21ef073d1f7836566e454f.tar.zst
nixpkgs-552fd3d599851336aa21ef073d1f7836566e454f.zip
Merge remote-tracking branch 'origin/master' into multiple-outputs
Conflicts:
	pkgs/development/libraries/atk/default.nix
	pkgs/development/libraries/cairo/default.nix
	pkgs/development/libraries/freetype/default.nix
	pkgs/development/libraries/glib/default.nix
	pkgs/development/libraries/gmime/default.nix
	pkgs/development/libraries/pango/default.nix
	pkgs/servers/x11/xorg/default.nix
	pkgs/top-level/all-packages.nix
Diffstat (limited to 'pkgs/development/libraries')
-rw-r--r--pkgs/development/libraries/GConf/3.x.nix23
-rw-r--r--pkgs/development/libraries/SDL/default.nix13
-rw-r--r--pkgs/development/libraries/aspell/dictionaries.nix20
-rw-r--r--pkgs/development/libraries/atk/default.nix (renamed from pkgs/development/libraries/atk/2.6.x.nix)10
-rw-r--r--pkgs/development/libraries/cairo/1.12.2.nix4
-rw-r--r--pkgs/development/libraries/cairo/default.nix73
-rw-r--r--pkgs/development/libraries/db4/db4-4.4.nix2
-rw-r--r--pkgs/development/libraries/dbus-cplusplus/default.nix4
-rw-r--r--pkgs/development/libraries/dbus-glib/default.nix8
-rw-r--r--pkgs/development/libraries/dbus/default.nix126
-rw-r--r--pkgs/development/libraries/dbus/implement-getgrouplist.patch108
-rw-r--r--pkgs/development/libraries/dbus/no-create-dirs.patch26
-rw-r--r--pkgs/development/libraries/dbus/systemd.patch14
-rw-r--r--pkgs/development/libraries/dbus/ucred-dirty-hack.patch18
-rw-r--r--pkgs/development/libraries/expat/default.nix1
-rw-r--r--pkgs/development/libraries/fontconfig/default.nix25
-rw-r--r--pkgs/development/libraries/freeglut/default.nix8
-rw-r--r--pkgs/development/libraries/freetype/default.nix48
-rw-r--r--pkgs/development/libraries/freetype/enable-validation.patch22
-rw-r--r--pkgs/development/libraries/gdk-pixbuf/default.nix (renamed from pkgs/development/libraries/gdk-pixbuf/2.26.x.nix)11
-rw-r--r--pkgs/development/libraries/glew/default.nix4
-rw-r--r--pkgs/development/libraries/glib/default.nix (renamed from pkgs/development/libraries/glib/2.34.x.nix)48
-rw-r--r--pkgs/development/libraries/glibc/2.17/common.nix8
-rw-r--r--pkgs/development/libraries/glibc/2.17/cve-2013-0242.patch87
-rw-r--r--pkgs/development/libraries/glibc/2.17/cve-2013-1914.patch52
-rw-r--r--pkgs/development/libraries/gmime/default.nix15
-rw-r--r--pkgs/development/libraries/gobject-introspection/default.nix8
-rw-r--r--pkgs/development/libraries/gpgme/default.nix6
-rw-r--r--pkgs/development/libraries/gstreamer/gstreamer/default.nix4
-rw-r--r--pkgs/development/libraries/gtk+/2.x.nix (renamed from pkgs/development/libraries/gtk+/2.24.x.nix)30
-rw-r--r--pkgs/development/libraries/gtk+/3.x.nix (renamed from pkgs/development/libraries/gtk+/3.2.x.nix)29
-rw-r--r--pkgs/development/libraries/gtk-sharp-1/default.nix2
-rw-r--r--pkgs/development/libraries/gtkmm/3.x.nix8
-rw-r--r--pkgs/development/libraries/gtkmozembed-sharp/default.nix2
-rw-r--r--pkgs/development/libraries/gtksourceview-sharp/default.nix2
-rw-r--r--pkgs/development/libraries/harfbuzz/default.nix8
-rw-r--r--pkgs/development/libraries/haskell/Agda/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/Chart-gtk/default.nix18
-rw-r--r--pkgs/development/libraries/haskell/Chart/default.nix6
-rw-r--r--pkgs/development/libraries/haskell/JuicyPixels/default.nix12
-rw-r--r--pkgs/development/libraries/haskell/ListLike/default.nix10
-rw-r--r--pkgs/development/libraries/haskell/accelerate-cuda/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/accelerate-io/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/accelerate/default.nix5
-rw-r--r--pkgs/development/libraries/haskell/acid-state/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/binary/0.6.0.0.nix13
-rw-r--r--pkgs/development/libraries/haskell/binary/0.7.1.0.nix (renamed from pkgs/development/libraries/haskell/binary/default.nix)0
-rw-r--r--pkgs/development/libraries/haskell/bytedump/default.nix15
-rw-r--r--pkgs/development/libraries/haskell/classy-prelude/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/concurrent-extra/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/contravariant/default.nix6
-rw-r--r--pkgs/development/libraries/haskell/entropy/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/fingertree/default.nix12
-rw-r--r--pkgs/development/libraries/haskell/ghc-heap-view/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/ghc-vis/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/hakyll/default.nix36
-rw-r--r--pkgs/development/libraries/haskell/hashable/1.2.0.10.nix (renamed from pkgs/development/libraries/haskell/hashable/1.2.0.7.nix)4
-rw-r--r--pkgs/development/libraries/haskell/hflags/default.nix14
-rw-r--r--pkgs/development/libraries/haskell/hit/default.nix27
-rw-r--r--pkgs/development/libraries/haskell/hsdns/default.nix5
-rw-r--r--pkgs/development/libraries/haskell/hsshellscript/default.nix15
-rw-r--r--pkgs/development/libraries/haskell/iteratee/default.nix1
-rw-r--r--pkgs/development/libraries/haskell/monadcryptorandom/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/mongoDB/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/persistent-template/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/persistent/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/pipes-concurrency/default.nix8
-rw-r--r--pkgs/development/libraries/haskell/postgresql-simple/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/regex-tdfa-text/default.nix13
-rw-r--r--pkgs/development/libraries/haskell/shake/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/snap/core.nix16
-rw-r--r--pkgs/development/libraries/haskell/template-default/default.nix14
-rw-r--r--pkgs/development/libraries/haskell/vector-th-unbox/default.nix13
-rw-r--r--pkgs/development/libraries/haskell/vector/0.10.nix15
-rw-r--r--pkgs/development/libraries/haskell/vector/0.9.1.nix15
-rw-r--r--pkgs/development/libraries/haskell/xtest/default.nix14
-rw-r--r--pkgs/development/libraries/haskell/yesod-bin/default.nix31
-rw-r--r--pkgs/development/libraries/haskell/yesod-core/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/yesod-persistent/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/yesod-platform/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/yesod-routes/default.nix4
-rw-r--r--pkgs/development/libraries/haskell/yesod/default.nix4
-rw-r--r--pkgs/development/libraries/iksemel/default.nix24
-rw-r--r--pkgs/development/libraries/imlib/default.nix2
-rw-r--r--pkgs/development/libraries/java/jakarta-bcel/default.nix2
-rw-r--r--pkgs/development/libraries/java/jakarta-regexp/default.nix2
-rw-r--r--pkgs/development/libraries/javascript/jquery-ui/default.nix14
-rw-r--r--pkgs/development/libraries/libcanberra/default.nix16
-rw-r--r--pkgs/development/libraries/libcroco/default.nix11
-rw-r--r--pkgs/development/libraries/libdrm/default.nix13
-rw-r--r--pkgs/development/libraries/libgcrypt/default.nix10
-rw-r--r--pkgs/development/libraries/libgnome-keyring/3.x.nix18
-rw-r--r--pkgs/development/libraries/libgpg-error/default.nix2
-rw-r--r--pkgs/development/libraries/libgphoto2/default.nix3
-rw-r--r--pkgs/development/libraries/libgphoto2/default.upstream9
-rw-r--r--pkgs/development/libraries/libgsf/default.nix23
-rw-r--r--pkgs/development/libraries/libgweather/default.nix13
-rw-r--r--pkgs/development/libraries/libjpeg-turbo/default.nix7
-rw-r--r--pkgs/development/libraries/libmtp/default.nix12
-rw-r--r--pkgs/development/libraries/libpaper/default.nix17
-rw-r--r--pkgs/development/libraries/libpng/15.nix24
-rw-r--r--pkgs/development/libraries/libpng/default.nix7
-rw-r--r--pkgs/development/libraries/libpng/libpng-apng.nix18
-rw-r--r--pkgs/development/libraries/librsvg/default.nix22
-rw-r--r--pkgs/development/libraries/libsecret/default.nix22
-rw-r--r--pkgs/development/libraries/libtiff/default.nix6
-rw-r--r--pkgs/development/libraries/libusb1/default.nix4
-rw-r--r--pkgs/development/libraries/libva/default.nix4
-rw-r--r--pkgs/development/libraries/libvdpau/default.nix12
-rw-r--r--pkgs/development/libraries/libvpx/default.nix18
-rw-r--r--pkgs/development/libraries/libxkbcommon/default.nix21
-rw-r--r--pkgs/development/libraries/libxtc_dxtn/default.nix5
-rw-r--r--pkgs/development/libraries/mesa-glu/default.nix19
-rw-r--r--pkgs/development/libraries/mesa/default.nix138
-rw-r--r--pkgs/development/libraries/mesa/dricore-gallium.patch216
-rw-r--r--pkgs/development/libraries/mesa/fix-rounding.patch357
-rw-r--r--pkgs/development/libraries/mesa/mips_wmb.patch16
-rw-r--r--pkgs/development/libraries/mesa/static-gallium.patch71
-rw-r--r--pkgs/development/libraries/mpfr/3.1.2.nix51
-rw-r--r--pkgs/development/libraries/nlopt/default.nix15
-rw-r--r--pkgs/development/libraries/openjpeg/default.nix10
-rw-r--r--pkgs/development/libraries/pango/default.nix (renamed from pkgs/development/libraries/pango/1.30.x.nix)13
-rw-r--r--pkgs/development/libraries/pangox-compat/default.nix19
-rw-r--r--pkgs/development/libraries/pdf2xml/default.nix2
-rw-r--r--pkgs/development/libraries/pixman/default.nix22
-rw-r--r--pkgs/development/libraries/poppler/0.18.nix53
-rw-r--r--pkgs/development/libraries/poppler/default.nix90
-rw-r--r--pkgs/development/libraries/qt-4.x/4.8/CVE-2013-0254.patch66
-rw-r--r--pkgs/development/libraries/qt-4.x/4.8/default.nix28
-rw-r--r--pkgs/development/libraries/ruby_gpgme/default.nix64
-rw-r--r--pkgs/development/libraries/ruby_ncursesw_sup/default.nix47
-rw-r--r--pkgs/development/libraries/smpeg/default.nix2
-rw-r--r--pkgs/development/libraries/suitesparse/default.nix4
-rw-r--r--pkgs/development/libraries/vaapi-intel/default.nix9
-rw-r--r--pkgs/development/libraries/vaapi-vdpau/default.nix2
-rw-r--r--pkgs/development/libraries/vaapi-vdpau/glext85.patch20
-rw-r--r--pkgs/development/libraries/wayland/default.nix14
-rw-r--r--pkgs/development/libraries/wxGTK-2.8/default.nix16
-rw-r--r--pkgs/development/libraries/x264/default.nix2
139 files changed, 2418 insertions, 604 deletions
diff --git a/pkgs/development/libraries/GConf/3.x.nix b/pkgs/development/libraries/GConf/3.x.nix
deleted file mode 100644
index 82c0c1f2c43..00000000000
--- a/pkgs/development/libraries/GConf/3.x.nix
+++ /dev/null
@@ -1,23 +0,0 @@
-{ stdenv, fetchurl, glib, dbus_glib, pkgconfig, libxml2, gtk3, intltool, polkit }:
-
-stdenv.mkDerivation {
-  name = "GConf-3.2.3";
-
-  src = fetchurl {
-    url = mirror://gnome/sources/GConf/3.2/GConf-3.2.3.tar.xz;
-    sha256 = "0jd1z9gb1b7mv4g07qm554va6idasf3swgrfqflypdh9s38mvdcy";
-  };
-
-  propagatedBuildInputs = [ glib dbus_glib ];
-  buildInputs = [ polkit gtk3 libxml2 ];
-  nativeBuildInputs = [ pkgconfig intltool ];
-
-  configureFlags = "--disable-orbit";
-
-  meta = {
-    homepage = http://projects.gnome.org/gconf/;
-    description = "A system for storing application preferences";
-    maintainers = [ stdenv.lib.maintainers.urkud ];
-    inherit (gtk3.meta) platforms;
-  };
-}
diff --git a/pkgs/development/libraries/SDL/default.nix b/pkgs/development/libraries/SDL/default.nix
index 8ff643ce5b1..899c3bb5c8d 100644
--- a/pkgs/development/libraries/SDL/default.nix
+++ b/pkgs/development/libraries/SDL/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pkgconfig
+{ stdenv, fetchurl, pkgconfig, audiofile
 , openglSupport ? false, mesa ? null
 , alsaSupport ? true, alsaLib ? null
 , x11Support ? true, x11 ? null, libXrandr ? null
@@ -16,25 +16,26 @@ assert pulseaudioSupport -> pulseaudio != null;
 
 let
   configureFlagsFun = attrs: ''
-        --disable-oss
+        --disable-oss --disable-video-x11-xme
         --disable-x11-shared --disable-alsa-shared --enable-rpath --disable-pulseaudio-shared
+        --disable-osmesa-shared
         ${if alsaSupport then "--with-alsa-prefix=${attrs.alsaLib}/lib" else ""}
       '';
 in
 stdenv.mkDerivation rec {
-  name = "SDL-1.2.14";
+  name = "SDL-1.2.15";
 
   src = fetchurl {
     url = "http://www.libsdl.org/release/${name}.tar.gz";
-    sha256 = "1dnrxr18cyar0xd13dca7h8wp1fin4n3iyncxfq6pjrlf0l7x4jx";
+    sha256 = "005d993xcac8236fpvd1iawkz4wqjybkpn8dbwaliqz5jfkidlyn";
   };
 
   # Since `libpulse*.la' contain `-lgdbm', PulseAudio must be propagated.
   propagatedBuildInputs = stdenv.lib.optionals x11Support [ x11 libXrandr ] ++
     stdenv.lib.optional pulseaudioSupport pulseaudio;
 
-  buildInputs = [ pkgconfig ] ++
-    stdenv.lib.optional openglSupport mesa ++
+  buildInputs = [ pkgconfig audiofile ] ++
+    stdenv.lib.optional openglSupport [ mesa ] ++
     stdenv.lib.optional alsaSupport alsaLib;
 
   # XXX: By default, SDL wants to dlopen() PulseAudio, in which case
diff --git a/pkgs/development/libraries/aspell/dictionaries.nix b/pkgs/development/libraries/aspell/dictionaries.nix
index 90a9469ee54..c2aefd64c79 100644
--- a/pkgs/development/libraries/aspell/dictionaries.nix
+++ b/pkgs/development/libraries/aspell/dictionaries.nix
@@ -29,7 +29,7 @@ let
 in {
 
   de = buildDict {
-    shortName = "de-20030222-1";
+    shortName = "de-20030222_1";
     fullName = "German";
     src = fetchurl {
       url = mirror://gnu/aspell/dict/de/aspell6-de-20030222-1.tar.bz2;
@@ -38,7 +38,7 @@ in {
   };
     
   en = buildDict {
-    shortName = "en-6.0-0";
+    shortName = "en-6.0_0";
     fullName = "English";
     src = fetchurl {
       url = mirror://gnu/aspell/dict/en/aspell6-en-6.0-0.tar.bz2;
@@ -47,7 +47,7 @@ in {
   };
     
   es = buildDict {
-    shortName = "es-0.50-2";
+    shortName = "es-0.50_2";
     fullName = "Spanish";
     src = fetchurl {
       url = mirror://gnu/aspell/dict/es/aspell-es-0.50-2.tar.bz2;
@@ -56,7 +56,7 @@ in {
   };
     
   eo = buildDict {
-    shortName = "eo-0.50-2";
+    shortName = "eo-0.50_2";
     fullName = "Esperanto";
     src = fetchurl {
       url = mirror://gnu/aspell/dict/eo/aspell-eo-0.50-2.tar.bz2;
@@ -65,7 +65,7 @@ in {
   };
 
   fr = buildDict {
-    shortName = "fr-0.50-3";
+    shortName = "fr-0.50_3";
     fullName = "French";
     src = fetchurl {
       url = mirror://gnu/aspell/dict/fr/aspell-fr-0.50-3.tar.bz2;
@@ -74,7 +74,7 @@ in {
   };
     
   it = buildDict {
-    shortName = "it-0.53-0";
+    shortName = "it-0.53_0";
     fullName = "Italian";
     src = fetchurl {
       url = mirror://gnu/aspell/dict/it/aspell-it-0.53-0.tar.bz2;
@@ -83,7 +83,7 @@ in {
   };
     
   la = buildDict {
-    shortName = "la-20020503-0";
+    shortName = "la-20020503_0";
     fullName = "Latin";
     src = fetchurl {
       url = mirror://gnu/aspell/dict/la/aspell6-la-20020503-0.tar.bz2;
@@ -92,7 +92,7 @@ in {
   };
     
   nl = buildDict {
-    shortName = "nl-0.50-2";
+    shortName = "nl-0.50_2";
     fullName = "Dutch";
     src = fetchurl {
       url = mirror://gnu/aspell/dict/nl/aspell-nl-0.50-2.tar.bz2;
@@ -105,7 +105,7 @@ in {
   };
     
   pl = buildDict {
-    shortName = "pl-6.0_20061121";
+    shortName = "pl-6.0_20061121_0";
     fullName = "Polish";
     src = fetchurl {
       url = mirror://gnu/aspell/dict/pl/aspell6-pl-6.0_20061121-0.tar.bz2;
@@ -114,7 +114,7 @@ in {
   };
      
   ru = buildDict {
-    shortName = "ru-0.99f7-1";
+    shortName = "ru-0.99f7_1";
     fullName = "Russian";
     src = fetchurl {
       url = mirror://gnu/aspell/dict/ru/aspell6-ru-0.99f7-1.tar.bz2;
diff --git a/pkgs/development/libraries/atk/2.6.x.nix b/pkgs/development/libraries/atk/default.nix
index 82b366b4013..180392cc5e0 100644
--- a/pkgs/development/libraries/atk/2.6.x.nix
+++ b/pkgs/development/libraries/atk/default.nix
@@ -1,17 +1,19 @@
-{ stdenv, fetchurl, pkgconfig, perl, glib }:
+{ stdenv, fetchurl, pkgconfig, perl, glib, libintlOrEmpty }:
 
 stdenv.mkDerivation rec {
-  name = "atk-2.6.0";
+  name = "atk-2.8.0";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/atk/2.6/${name}.tar.xz";
-    sha256 = "eff663f90847620bb68c9c2cbaaf7f45e2ff44163b9ab3f10d15be763680491f";
+    url = "mirror://gnome/sources/atk/2.8/${name}.tar.xz";
+    sha256 = "1x3dd3hg9l1j9dq70xwph13vxdp6a9wbfcnryryf1wr6c8bij9dj";
   };
 
   enableParallelBuilding = true;
 
   outputs = [ "dev" "out" "doc" ];
 
+  buildInputs = libintlOrEmpty;
+
   nativeBuildInputs = [ pkgconfig perl ];
 
   propagatedBuildInputs = [ glib ];
diff --git a/pkgs/development/libraries/cairo/1.12.2.nix b/pkgs/development/libraries/cairo/1.12.2.nix
index 18195017c0f..e60af3a23a8 100644
--- a/pkgs/development/libraries/cairo/1.12.2.nix
+++ b/pkgs/development/libraries/cairo/1.12.2.nix
@@ -32,6 +32,10 @@ stdenv.mkDerivation rec {
     stdenv.lib.optional postscriptSupport zlib ++
     stdenv.lib.optional pngSupport libpng;
 
+  NIX_CFLAGS_COMPILE = ( if stdenv.isDarwin
+                         then "-I${pixman}/include/pixman-1"
+                         else "" );
+
   configureFlags =
     [ "--enable-tee" ]
     ++ stdenv.lib.optional xcbSupport "--enable-xcb"
diff --git a/pkgs/development/libraries/cairo/default.nix b/pkgs/development/libraries/cairo/default.nix
index 1ac455efbd2..f971a290358 100644
--- a/pkgs/development/libraries/cairo/default.nix
+++ b/pkgs/development/libraries/cairo/default.nix
@@ -1,60 +1,59 @@
-{ postscriptSupport ? true
-, pdfSupport ? true
-, pngSupport ? true
-, xcbSupport ? false
+{ stdenv, fetchurl, pkgconfig, libiconvOrEmpty, libintlOrEmpty
+, expat, zlib, libpng, pixman, fontconfig, freetype, xlibs
 , gobjectSupport ? true, glib
-, stdenv, fetchurl, pkgconfig, x11, fontconfig, freetype, xlibs
-, zlib, libpng, pixman, libxcb ? null, xcbutil ? null
-, libiconvOrEmpty, libintlOrEmpty
+, xcbSupport ? true # no longer experimental since 1.12
+, glSupport ? true, mesa_noglu ? null # mesa is no longer a big dependency
+, pdfSupport ? true
 }:
 
-assert postscriptSupport -> zlib != null;
-assert pngSupport -> libpng != null;
-assert xcbSupport -> libxcb != null && xcbutil != null;
+assert glSupport -> mesa_noglu != null;
+
+with { inherit (stdenv.lib) optional optionals; };
 
 stdenv.mkDerivation rec {
-  name = "cairo-1.12.4";
+  name = "cairo-1.12.14";
 
   src = fetchurl {
     url = "http://cairographics.org/releases/${name}.tar.xz";
-    sha1 = "f4158981ed01e73c94fb8072074b17feee61a68b";
+    sha256 = "04xcykglff58ygs0dkrmmnqljmpjwp2qgwcz8sijqkdpz7ix3l4n";
   };
 
   outputs = [ "dev" "out" "bin" "doc" ];
 
-  buildInputs =
-    [ pkgconfig x11 fontconfig ]
-    ++ stdenv.lib.optional (!stdenv.isDarwin) xlibs.libXrender
-    ++ stdenv.lib.optionals xcbSupport [ libxcb xcbutil ]
-    ++ libintlOrEmpty
-    ++ libiconvOrEmpty;
+  nativeBuildInputs = [ pkgconfig ] ++ libintlOrEmpty ++ libiconvOrEmpty;
 
   propagatedBuildInputs =
-    [ freetype pixman ] ++
-    stdenv.lib.optional gobjectSupport glib ++
-    stdenv.lib.optional postscriptSupport zlib ++
-    stdenv.lib.optional pngSupport libpng;
-
-  configureFlags =
-    [ "--enable-tee" ]
-    ++ stdenv.lib.optional xcbSupport "--enable-xcb"
-    ++ stdenv.lib.optional pdfSupport "--enable-pdf";
-
-  preConfigure = ''
-    # Work around broken `Requires.private' that prevents Freetype
-    # `-I' flags to be propagated.
-    sed -i "src/cairo.pc.in" \
-        -es'|^Cflags:\(.*\)$|Cflags: \1 -I${freetype}/include/freetype2 -I${freetype}/include|g'
-  ''
-
+    with xlibs; [ xlibs.xlibs fontconfig expat freetype pixman zlib libpng ]
+    ++ optional (!stdenv.isDarwin) libXrender
+    ++ optionals xcbSupport [ libxcb xcbutil ]
+    ++ optional gobjectSupport glib
+    ++ optionals glSupport [ mesa_noglu ]
+    ;
+
+  configureFlags = [ "--enable-tee" ]
+    ++ optional xcbSupport "--enable-xcb"
+    ++ optional glSupport "--enable-gl"
+    ++ optional pdfSupport "--enable-pdf"
+    ;
+
+  NIX_CFLAGS_COMPILE = "-I${pixman}/include/pixman-1";
+
+  preConfigure =
   # On FreeBSD, `-ldl' doesn't exist.
-  + (stdenv.lib.optionalString stdenv.isFreeBSD
+    (stdenv.lib.optionalString stdenv.isFreeBSD
        '' for i in "util/"*"/Makefile.in" boilerplate/Makefile.in
           do
             cat "$i" | sed -es/-ldl//g > t
             mv t "$i"
           done
-       '');
+       '') 
+       +
+    ''
+    # Work around broken `Requires.private' that prevents Freetype
+    # `-I' flags to be propagated.
+    sed -i "src/cairo.pc.in" \
+        -es'|^Cflags:\(.*\)$|Cflags: \1 -I${freetype}/include/freetype2 -I${freetype}/include|g'
+    '';
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/db4/db4-4.4.nix b/pkgs/development/libraries/db4/db4-4.4.nix
index 7444439fc73..ab3ffa85cf2 100644
--- a/pkgs/development/libraries/db4/db4-4.4.nix
+++ b/pkgs/development/libraries/db4/db4-4.4.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation {
   src = fetchurl {
     urls = [
       http://download.oracle.com/berkeley-db/db-4.4.20.NC.tar.gz
-      http://nixos.org/tarballs/db-4.4.20.NC.tar.gz
+      http://tarballs.nixos.org/db-4.4.20.NC.tar.gz
     ];
     md5 = "afd9243ea353bbaa04421488d3b37900";
   };
diff --git a/pkgs/development/libraries/dbus-cplusplus/default.nix b/pkgs/development/libraries/dbus-cplusplus/default.nix
index 2704b9586b1..0a4b80d3f3e 100644
--- a/pkgs/development/libraries/dbus-cplusplus/default.nix
+++ b/pkgs/development/libraries/dbus-cplusplus/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, dbus, glib, gtkmm, pkgconfig }:
+{ stdenv, fetchurl, dbus, glib, gtkmm, pkgconfig, expat }:
 
 stdenv.mkDerivation rec {
   name = "dbus-cplusplus-${version}";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
     sha256 = "0qafmy2i6dzx4n1dqp6pygyy6gjljnb7hwjcj2z11c1wgclsq4dw";
   };
 
-  buildInputs = [ dbus glib gtkmm pkgconfig ];
+  buildInputs = [ dbus glib gtkmm pkgconfig expat ];
 
   configureFlags = "--disable-ecore";
 
diff --git a/pkgs/development/libraries/dbus-glib/default.nix b/pkgs/development/libraries/dbus-glib/default.nix
index 47e83e7780c..be6cf442a49 100644
--- a/pkgs/development/libraries/dbus-glib/default.nix
+++ b/pkgs/development/libraries/dbus-glib/default.nix
@@ -1,18 +1,20 @@
 { stdenv, fetchurl, pkgconfig, expat, gettext, libiconv, dbus, glib }:
 
 stdenv.mkDerivation rec {
-  name = "dbus-glib-0.98";
+  name = "dbus-glib-0.100.2";
 
   src = fetchurl {
     url = "${meta.homepage}/releases/dbus-glib/${name}.tar.gz";
-    sha256 = "04fiwld5yaxyggxlvdmbaqkngh4fn8gfkkqckcp3274bpgb82z19";
+    sha256 = "1ibav91yg70f2l3l18cr0hf4mna1h9d4mrg0c60w4l8zjbd45fx5";
   };
 
   nativeBuildInputs = [ pkgconfig gettext ];
 
   buildInputs = [ expat ] ++ stdenv.lib.optional (!stdenv.isLinux) libiconv;
 
-  propagatedBuildInputs = [ dbus glib ];
+  propagatedBuildInputs = [ dbus.libs glib ];
+
+  doCheck = true;
 
   passthru = { inherit dbus glib; };
 
diff --git a/pkgs/development/libraries/dbus/default.nix b/pkgs/development/libraries/dbus/default.nix
index 5716ac6648a..d50a0076e62 100644
--- a/pkgs/development/libraries/dbus/default.nix
+++ b/pkgs/development/libraries/dbus/default.nix
@@ -1,71 +1,107 @@
-{ stdenv, fetchurl, pkgconfig, expat, libX11, libICE, libSM, useX11 ? true }:
+{ stdenv, fetchurl, pkgconfig, autoconf, automake, libtool
+, expat, systemd, glib, dbus_glib, python
+, libX11, libICE, libSM, useX11 ? stdenv.isLinux }:
 
 let
-  version = "1.6.4";
+  version = "1.6.12"; # 1.7.* isn't recommended, even for gnome 3.8
+  sha256 = "14pfh2ksn4srfry752kf1jy3c61hklcs9fx2xglw2ifhsszplypn";
 
-  src = fetchurl {
-    url = "http://dbus.freedesktop.org/releases/dbus/dbus-${version}.tar.gz";
-    sha256 = "1wacqyfkcpayg7f8rvx9awqg275n5pksxq5q7y21lxjx85x6pfjz";
-  };
+  inherit (stdenv) lib;
 
-  patches = [ ./ignore-missing-includedirs.patch ];
+  buildInputsX = lib.optionals useX11 [ libX11 libICE libSM ];
 
-  configureFlags = "--localstatedir=/var --sysconfdir=/etc --with-session-socket-dir=/tmp";
+  # also other parts than "libs" need this statically linked lib
+  makeInternalLib = "(cd dbus && make libdbus-internal.la)";
 
-in rec {
+  systemdOrEmpty = lib.optional stdenv.isLinux systemd;
 
-  libs = stdenv.mkDerivation {
-    name = "dbus-library-" + version;
+  # A generic builder for individual parts (subdirs) of D-Bus
+  dbus_drv = name: subdirs: merge: stdenv.mkDerivation (lib.mergeAttrsByFuncDefaultsClean [{
 
-    nativeBuildInputs = [ pkgconfig ];
+    name = "dbus-${name}-${version}";
 
-    buildInputs = [ expat ];
+    src = fetchurl {
+      url = "http://dbus.freedesktop.org/releases/dbus/dbus-${version}.tar.gz";
+      inherit sha256;
+    };
 
-    # FIXME: dbus has optional systemd integration when checking
-    # at_console policies.  How to enable this without introducing a
-    # circular dependency between dbus and systemd?
+    configureFlags = [
+      "--localstatedir=/var"
+      "--sysconfdir=/etc"
+      "--with-session-socket-dir=/tmp"
+      "--with-systemdsystemunitdir=$(out)/lib/systemd"
+    ];
 
-    inherit src patches configureFlags;
+    preConfigure = ''
+      patchShebangs .
+      substituteInPlace tools/Makefile.am --replace 'install-localstatelibDATA:' 'disabled:'
+      autoreconf -fi
+    '';
 
-    preConfigure =
-      ''
-        sed -i '/mkinstalldirs.*localstatedir/d' bus/Makefile.in
-        sed -i '/SUBDIRS/s/ tools//' Makefile.in
-      '';
+    installFlags = "sysconfdir=$(out)/etc";
 
-    # Enable X11 autolaunch support in libdbus.  This doesn't actually
-    # depend on X11 (it just execs dbus-launch in dbus.tools),
-    # contrary to what the configure script demands.
-    NIX_CFLAGS_COMPILE = "-DDBUS_ENABLE_X11_AUTOLAUNCH=1";
+    doCheck = true;
 
-    installFlags = "sysconfdir=$(out)/etc";
-  };
+    patches = [ ./ignore-missing-includedirs.patch ]
+      ++ lib.optional (stdenv.isSunOS || stdenv.isLinux/*avoid rebuilds*/) ./implement-getgrouplist.patch
+      ++ [ ./ucred-dirty-hack.patch ./no-create-dirs.patch ];
 
-  tools = stdenv.mkDerivation {
-    name = "dbus-tools-" + version;
+    nativeBuildInputs = [ pkgconfig ];
+    propagatedBuildInputs = [ expat ];
+    buildInputs = [ autoconf automake libtool ]; # ToDo: optional selinux?
+
+    # build only the specified subdirs
+    postPatch = "sed '/SUBDIRS/s/=.*/=" + subdirs + "/' -i Makefile.am\n"
+      # use already packaged libdbus instead of trying to build it again
+      + lib.optionalString (name != "libs") ''
+          for mfile in */Makefile.am; do
+            sed 's,\$(top_builddir)/dbus/\(libdbus-[0-9]\),${libs}/lib/\1,g' -i "$mfile"
+          done
+        '';
+
+  } merge ]);
+
+  libs = dbus_drv "libs" "dbus" ({
+    # Enable X11 autolaunch support in libdbus. This doesn't actually depend on X11
+    # (it just execs dbus-launch in dbus.tools), contrary to what the configure script demands.
+    NIX_CFLAGS_COMPILE = "-DDBUS_ENABLE_X11_AUTOLAUNCH=1";
+  } // stdenv.lib.optionalAttrs (systemdOrEmpty != []) {
+    buildInputs = [ systemd.headers ];
+    patches = [ ./systemd.patch ]; # bypass systemd detection
+  });
 
-    inherit src patches;
 
-    configureFlags = "${configureFlags} --with-dbus-daemondir=${daemon}/bin";
+in rec {
 
-    nativeBuildInputs = [ pkgconfig ];
+  # This package has been split because most applications only need dbus.lib
+  # which serves as an interface to a *system-wide* daemon,
+  # see e.g. http://en.wikipedia.org/wiki/D-Bus#Architecture .
+  # Also some circular dependencies get split by this (like with systemd).
 
-    buildInputs = [ expat libs ]
-      ++ stdenv.lib.optionals useX11 [ libX11 libICE libSM ];
+  inherit libs;
 
-    NIX_LDFLAGS = "-ldbus-1";
+  tools = dbus_drv "tools" "tools" {
+    configureFlags = [ "--with-dbus-daemondir=${daemon}/bin" ];
+    buildInputs = buildInputsX ++ systemdOrEmpty ++ [ libs daemon dbus_glib ];
+    NIX_CFLAGS_LINK = "-Wl,--as-needed -ldbus-1";
 
-    preConfigure =
-      ''
-        sed -i 's@$(top_builddir)/dbus/libdbus-1.la@@' tools/Makefile.in
-        substituteInPlace tools/Makefile.in --replace 'install-localstatelibDATA:' 'disabled:'
-      '';
+    meta.platforms = stdenv.lib.platforms.all;
+  };
 
-    postConfigure = "cd tools";
+  daemon = dbus_drv "daemon" "bus" {
+    preBuild = makeInternalLib;
+    buildInputs = systemdOrEmpty;
+  };
 
-    installFlags = "localstatedir=$TMPDIR/var";
+  # Some of the tests don't work yet; in fact, @vcunat tried several packages
+  # containing dbus testing, and all of them have some test failure.
+  tests = dbus_drv "tests" "test" {
+    preBuild = makeInternalLib;
+    buildInputs = buildInputsX ++ systemdOrEmpty ++ [ libs tools daemon dbus_glib python ];
+    NIX_CFLAGS_LINK = "-Wl,--as-needed -ldbus-1";
   };
 
-  # I'm too lazy to separate daemon and libs now.
-  daemon = libs;
+  docs = dbus_drv "docs" "doc" {
+    postInstall = ''rm -r "$out/lib"'';
+  };
 }
diff --git a/pkgs/development/libraries/dbus/implement-getgrouplist.patch b/pkgs/development/libraries/dbus/implement-getgrouplist.patch
new file mode 100644
index 00000000000..e3a4a25cb72
--- /dev/null
+++ b/pkgs/development/libraries/dbus/implement-getgrouplist.patch
@@ -0,0 +1,108 @@
+Compatibility patch for Illumos/Solaris and possibly other platforms.
+Implements getgrouplist when not provided by OS.
+Without it, only the user's primary group is used in authentication!
+--- 	1970-01-01 00:00:00.000000000 +0000
++++ dbus-1.6.8/dbus/getgrouplist.c	2013-02-28 13:10:51.081792722 +0000
+@@ -0,0 +1,89 @@
++/*	$OpenBSD: getgrouplist.c,v 1.12 2005/08/08 08:05:34 espie Exp $ */
++/*
++ * Copyright (c) 1991, 1993
++ *	The Regents of the University of California.  All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ *    notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ *    notice, this list of conditions and the following disclaimer in the
++ *    documentation and/or other materials provided with the distribution.
++ * 3. Neither the name of the University nor the names of its contributors
++ *    may be used to endorse or promote products derived from this software
++ *    without specific prior written permission.
++ *
++ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
++ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
++ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
++ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
++ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
++ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
++ * SUCH DAMAGE.
++ */
++
++/* OPENBSD ORIGINAL: lib/libc/gen/getgrouplist.c */
++
++/*
++ * get credential
++ */
++#include <sys/types.h>
++#include <string.h>
++#include <unistd.h>
++#include <grp.h>
++
++int
++getgrouplist(const char *uname, gid_t agroup, gid_t *groups, int *grpcnt)
++{
++	struct group *grp;
++	int i, ngroups;
++	int ret, maxgroups;
++	int bail;
++
++	ret = 0;
++	ngroups = 0;
++	maxgroups = *grpcnt;
++
++	/*
++	 * install primary group
++	 */
++	if (ngroups >= maxgroups) {
++		*grpcnt = ngroups;
++		return (-1);
++	}
++	groups[ngroups++] = agroup;
++
++	/*
++	 * Scan the group file to find additional groups.
++	 */
++	setgrent();
++	while ((grp = getgrent())) {
++		if (grp->gr_gid == agroup)
++			continue;
++		for (bail = 0, i = 0; bail == 0 && i < ngroups; i++)
++			if (groups[i] == grp->gr_gid)
++				bail = 1;
++		if (bail)
++			continue;
++		for (i = 0; grp->gr_mem[i]; i++) {
++			if (!strcmp(grp->gr_mem[i], uname)) {
++				if (ngroups >= maxgroups) {
++					ret = -1;
++					goto out;
++				}
++				groups[ngroups++] = grp->gr_gid;
++				break;
++			}
++		}
++	}
++out:
++	endgrent();
++	*grpcnt = ngroups;
++	return (ret);
++}
+--- dbus-1.6.8/dbus/dbus-sysdeps-unix.c.orig	2013-02-28 13:08:52.171215237 +0000
++++ dbus-1.6.8/dbus/dbus-sysdeps-unix.c	2013-02-28 13:13:52.224615146 +0000
+@@ -21,6 +21,10 @@
+  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+  *
+  */
++#ifndef HAVE_GETGROUPLIST
++#include "getgrouplist.c"
++#define HAVE_GETGROUPLIST
++#endif
+ 
+ #include <config.h>
+ 
diff --git a/pkgs/development/libraries/dbus/no-create-dirs.patch b/pkgs/development/libraries/dbus/no-create-dirs.patch
new file mode 100644
index 00000000000..cf10d977599
--- /dev/null
+++ b/pkgs/development/libraries/dbus/no-create-dirs.patch
@@ -0,0 +1,26 @@
+diff --git a/bus/Makefile.am b/bus/Makefile.am
+index 6cbc09a..be60bb8 100644
+--- a/bus/Makefile.am
++++ b/bus/Makefile.am
+@@ -212,7 +212,6 @@ clean-local:
+ 	/bin/rm *.bb *.bbg *.da *.gcov || true
+ 
+ install-data-hook:
+-	$(mkinstalldirs) $(DESTDIR)$(localstatedir)/run/dbus
+ 	$(mkinstalldirs) $(DESTDIR)$(configdir)/system.d
+ 	$(mkinstalldirs) $(DESTDIR)$(configdir)/session.d
+ 	$(mkinstalldirs) $(DESTDIR)$(datadir)/dbus-1/services
+diff --git a/tools/Makefile.am b/tools/Makefile.am
+index cfd54b8..b6e28f9 100644
+--- a/tools/Makefile.am
++++ b/tools/Makefile.am
+@@ -74,7 +74,7 @@ CLEANFILES = 				\
+ 
+ # create the /var/lib/dbus directory for dbus-uuidgen
+ install-data-local:
+-	$(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/dbus
++	:
+ 
+ installcheck-local:
+-	test -d $(DESTDIR)$(localstatedir)/lib/dbus
++	:
diff --git a/pkgs/development/libraries/dbus/systemd.patch b/pkgs/development/libraries/dbus/systemd.patch
new file mode 100644
index 00000000000..7e6cb1f87d0
--- /dev/null
+++ b/pkgs/development/libraries/dbus/systemd.patch
@@ -0,0 +1,14 @@
+diff --git a/configure.ac b/configure.ac
+index 24fcc9e..98e0459 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -1167,7 +1167,8 @@ else
+     PKG_CHECK_MODULES(SYSTEMD,
+         [libsystemd-login >= 32, libsystemd-daemon >= 32],
+         have_systemd=yes,
+-        have_systemd=no)
++        have_systemd=yes)
++    AC_MSG_NOTICE([NixOS: do not care whether we found systemd or not])
+ fi
+ 
+ if test x$have_systemd = xyes; then
diff --git a/pkgs/development/libraries/dbus/ucred-dirty-hack.patch b/pkgs/development/libraries/dbus/ucred-dirty-hack.patch
new file mode 100644
index 00000000000..a07abcc15fb
--- /dev/null
+++ b/pkgs/development/libraries/dbus/ucred-dirty-hack.patch
@@ -0,0 +1,18 @@
+diff --git a/dbus/dbus-sysdeps-unix.c b/dbus/dbus-sysdeps-unix.c
+index b4ecc96..267984a 100644
+--- a/dbus/dbus-sysdeps-unix.c
++++ b/dbus/dbus-sysdeps-unix.c
+@@ -1635,6 +1635,13 @@ write_credentials_byte (int             server_fd,
+     }
+ }
+ 
++struct ucred
++{
++  pid_t pid;			/* PID of sending process.  */
++  uid_t uid;			/* UID of sending process.  */
++  gid_t gid;			/* GID of sending process.  */
++};
++
+ /**
+  * Reads a single byte which must be nul (an error occurs otherwise),
+  * and reads unix credentials if available. Clears the credentials
diff --git a/pkgs/development/libraries/expat/default.nix b/pkgs/development/libraries/expat/default.nix
index 6b675230119..d7915a93962 100644
--- a/pkgs/development/libraries/expat/default.nix
+++ b/pkgs/development/libraries/expat/default.nix
@@ -11,5 +11,6 @@ stdenv.mkDerivation rec {
   meta = {
     homepage = http://www.libexpat.org/;
     description = "A stream-oriented XML parser library written in C";
+    platforms = stdenv.lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/fontconfig/default.nix b/pkgs/development/libraries/fontconfig/default.nix
index 116fe3c0c20..e3b0a54ee82 100644
--- a/pkgs/development/libraries/fontconfig/default.nix
+++ b/pkgs/development/libraries/fontconfig/default.nix
@@ -1,18 +1,24 @@
 { stdenv, fetchurl, pkgconfig, freetype, expat }:
 
 stdenv.mkDerivation rec {
-  name = "fontconfig-2.10.1";
+  name = "fontconfig-2.10.2";
 
   src = fetchurl {
-    url = "http://fontconfig.org/release/${name}.tar.gz";
-    sha256 = "08h252crb3aqciwdk81jypmz2i7618dzqn3zlr87w1f017wjp4f3";
+    url = "http://fontconfig.org/release/${name}.tar.bz2";
+    sha256 = "0llraqw86jmw4vzv7inskp3xxm2gc64my08iwq5mzncgfdbfza4f";
   };
 
-  buildInputs = [ pkgconfig freetype ];
+  infinality_patch = with freetype.infinality; if useInfinality
+    then let subvers = "1";
+      in fetchurl {
+        url = "${base_URL}/fontconfig-infinality-1-${vers}_${subvers}.tar.bz2";
+        sha256 = "1fm5xx0mx2243jrq5rxk4v0ajw2nawpj23399h710bx6hd1rviq7";
+      }
+    else null;
 
-  propagatedBuildInputs = [ expat ]; # !!! shouldn't be necessary, but otherwise pango breaks
+  buildInputs = [ pkgconfig freetype expat ];
 
-  configureFlags = "--with-confdir=/etc/fonts --with-cache-dir=/var/cache/fontconfig --disable-docs --with-default-fonts=";
+  configureFlags = "--sysconfdir=/etc --with-cache-dir=/var/cache/fontconfig --disable-docs --with-default-fonts=";
 
   # We should find a better way to access the arch reliably.
   crossArch = stdenv.cross.arch or null;
@@ -26,11 +32,16 @@ stdenv.mkDerivation rec {
   enableParallelBuilding = true;
 
   # Don't try to write to /etc/fonts or /var/cache/fontconfig at install time.
-  installFlags = "CONFDIR=$(out)/etc/fonts RUN_FC_CACHE_TEST=false fc_cachedir=$(TMPDIR)/dummy";
+  installFlags = "sysconfdir=$(out)/etc RUN_FC_CACHE_TEST=false fc_cachedir=$(TMPDIR)/dummy";
+
+  postInstall = stdenv.lib.optionalString freetype.infinality.useInfinality ''
+    cd "$out/etc/fonts" && tar xvf ${infinality_patch}
+  '';
 
   meta = {
     description = "A library for font customization and configuration";
     homepage = http://fontconfig.org/;
     license = "bsd";
+    platforms = stdenv.lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/freeglut/default.nix b/pkgs/development/libraries/freeglut/default.nix
index 9d599560fc8..6e556a144ce 100644
--- a/pkgs/development/libraries/freeglut/default.nix
+++ b/pkgs/development/libraries/freeglut/default.nix
@@ -1,15 +1,15 @@
 { stdenv, fetchurl, libXi, libXrandr, libXxf86vm, mesa, x11 }:
 
 stdenv.mkDerivation {
-  name = "freeglut-2.8.0";
+  name = "freeglut-2.8.1";
 
   src = fetchurl {
-    url = mirror://sourceforge/freeglut/freeglut-2.8.0.tar.gz;
-    sha256 = "197293ff886abe613bc9eb4a762d9161b0c9e64b3e8e613ed7c5e353974fba05";
+    url = mirror://sourceforge/freeglut/freeglut-2.8.1.tar.gz;
+    sha256 = "16lrxxxd9ps9l69y3zsw6iy0drwjsp6m26d1937xj71alqk6dr6x";
   };
 
   configureFlags = "--" + (if stdenv.isDarwin then "disable" else "enable") + "-warnings";
 
   buildInputs = [ libXi libXrandr libXxf86vm mesa x11 ];
-  patches = [ ./0001-remove-typedefs-now-living-in-mesa.patch ];
+  # patches = [ ./0001-remove-typedefs-now-living-in-mesa.patch ];
 }
diff --git a/pkgs/development/libraries/freetype/default.nix b/pkgs/development/libraries/freetype/default.nix
index 4c695ab3345..b2e39e41a0b 100644
--- a/pkgs/development/libraries/freetype/default.nix
+++ b/pkgs/development/libraries/freetype/default.nix
@@ -1,24 +1,52 @@
 { stdenv, fetchurl, gnumake
-, # FreeType supports sub-pixel rendering.  This is patented by
+  # FreeType supports sub-pixel rendering.  This is patented by
   # Microsoft, so it is disabled by default.  This option allows it to
   # be enabled.  See http://www.freetype.org/patents.html.
-  useEncumberedCode ? false
+, useEncumberedCode ? false
+, useInfinality ? true
 }:
 
+assert !(useEncumberedCode && useInfinality); # probably wouldn't make sense
+
+let
+
+  version = "2.4.11";
+
+  infinality = rec {
+    inherit useInfinality;
+    vers = "20130104";
+    subvers = "04";
+    sha256 = "0dqglig34lfcw0w6sm6vmich0pcvq303vyh8jzqapvxgvrpr2156";
+
+    base_URL = "http://www.infinality.net/fedora/linux/zips";
+    url = "${base_URL}/freetype-infinality-${version}-${vers}_${subvers}-x86_64.tar.bz2";
+  };
+
+in
+
 stdenv.mkDerivation rec {
-  name = "freetype-2.4.10";
+  name = "freetype-${version}";
 
   src = fetchurl {
     url = "mirror://sourceforge/freetype/${name}.tar.bz2";
-    sha256 = "0bwrkqpygayfc1rf6rr1nb8l3svgn1fmjz8davg2hnf46cn293hc";
+    sha256 = "0gxyzxqpyf8g85y6g1zc1wqrh71prbbk8xfw4m8rwzb4ck5hp7gg";
   };
 
   outputs = [ "dev" "out" ];
 
   configureFlags = "--disable-static --bindir=$(dev)/bin";
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optionalString useEncumberedCode
-    "-DFT_CONFIG_OPTION_SUBPIXEL_RENDERING=1";
+  infinality_patch = if useInfinality
+    then fetchurl { inherit (infinality) url sha256; }
+    else null;
+
+  NIX_CFLAGS_COMPILE = with stdenv.lib;
+    " -fno-strict-aliasing" # from Gentoo, see https://bugzilla.redhat.com/show_bug.cgi?id=506840
+    + optionalString useEncumberedCode " -DFT_CONFIG_OPTION_SUBPIXEL_RENDERING=1"
+    + optionalString useInfinality " -DTT_CONFIG_OPTION_SUBPIXEL_HINTING=1";
+
+  patches = [ ./enable-validation.patch ] # from Gentoo
+    ++ stdenv.lib.optional useInfinality [ infinality_patch ];
 
   # The asm for armel is written with the 'asm' keyword.
   CFLAGS = stdenv.lib.optionalString stdenv.isArm "-std=gnu99";
@@ -28,6 +56,8 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  doCheck = true;
+
   postInstall =
     ''
       mkdir $dev/lib
@@ -42,9 +72,13 @@ stdenv.mkDerivation rec {
     configureFlags = "--disable-static CC_BUILD=gcc";
   };
 
+  passthru = { inherit infinality; }; # for fontconfig
+
   meta = {
     description = "A font rendering engine";
     homepage = http://www.freetype.org/;
-    license = "GPLv2+"; # or the FreeType License (BSD + advertising clause)
+    license = if useEncumberedCode then "unfree"
+      else "GPLv2+"; # or the FreeType License (BSD + advertising clause)
+    platforms = stdenv.lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/freetype/enable-validation.patch b/pkgs/development/libraries/freetype/enable-validation.patch
new file mode 100644
index 00000000000..44f3bf6e1c9
--- /dev/null
+++ b/pkgs/development/libraries/freetype/enable-validation.patch
@@ -0,0 +1,22 @@
+Enables gxvalid and otvalid modules for use with ftvalid.
+
+--- freetype-2.2.1/modules.cfg.orig	2006-07-07 21:01:09.000000000 -0400
++++ freetype-2.2.1/modules.cfg	2006-07-07 21:01:54.000000000 -0400
+@@ -110,7 +110,7 @@
+ AUX_MODULES += cache
+ 
+ # TrueType GX/AAT table validation.  Needs ftgxval.c below.
+-# AUX_MODULES += gxvalid
++AUX_MODULES += gxvalid
+ 
+ # Support for streams compressed with gzip (files with suffix .gz).
+ #
+@@ -124,7 +124,7 @@
+ 
+ # OpenType table validation.  Needs ftotval.c below.
+ #
+-# AUX_MODULES += otvalid
++AUX_MODULES += otvalid
+ 
+ # Auxiliary PostScript driver component to share common code.
+ #
diff --git a/pkgs/development/libraries/gdk-pixbuf/2.26.x.nix b/pkgs/development/libraries/gdk-pixbuf/default.nix
index b3bd378e0e9..8306f3831b1 100644
--- a/pkgs/development/libraries/gdk-pixbuf/2.26.x.nix
+++ b/pkgs/development/libraries/gdk-pixbuf/default.nix
@@ -1,11 +1,12 @@
-{ stdenv, fetchurl, pkgconfig, glib, libtiff, libjpeg, libpng, libX11, xz, jasper }:
+{ stdenv, fetchurl, pkgconfig, glib, libtiff, libjpeg, libpng, libX11, xz
+, jasper, libintlOrEmpty }:
 
 stdenv.mkDerivation rec {
-  name = "gdk-pixbuf-2.26.1";
+  name = "gdk-pixbuf-2.28.1";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/gdk-pixbuf/2.26/${name}.tar.xz";
-    sha256 = "a60af12b58d9cc15ba4c680c6730ce5d38e8d664af1d575a379385b94b4ec7ba";
+    url = "mirror://gnome/sources/gdk-pixbuf/2.28/${name}.tar.xz";
+    sha256 = "1fy2a05xhfg7gy4l4aajsbmgj62zxhikdxqh6bicihxmzm1vg85y";
   };
 
   outputs = [ "dev" "out" "bin" "doc" ];
@@ -13,7 +14,7 @@ stdenv.mkDerivation rec {
   enableParallelBuilding = true;
 
   # !!! We might want to factor out the gdk-pixbuf-xlib subpackage.
-  buildInputs = [ libX11 ];
+  buildInputs = [ libX11 libintlOrEmpty ];
 
   nativeBuildInputs = [ pkgconfig ];
 
diff --git a/pkgs/development/libraries/glew/default.nix b/pkgs/development/libraries/glew/default.nix
index 77686c9a7de..ebd60f61057 100644
--- a/pkgs/development/libraries/glew/default.nix
+++ b/pkgs/development/libraries/glew/default.nix
@@ -10,6 +10,10 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ mesa x11 libXmu libXi ];
 
+  patchPhase = ''
+    sed -i 's|lib64|lib|' config/Makefile.linux
+  '';
+
   installPhase = ''
     GLEW_DEST=$out make install
     mkdir -pv $out/share/doc/glew
diff --git a/pkgs/development/libraries/glib/2.34.x.nix b/pkgs/development/libraries/glib/default.nix
index abc36908105..f9229793165 100644
--- a/pkgs/development/libraries/glib/2.34.x.nix
+++ b/pkgs/development/libraries/glib/default.nix
@@ -1,5 +1,5 @@
-{ stdenv, fetchurl, pkgconfig, gettext, perl, libiconvOrNull, zlib, libffi
-, python, pcre }:
+{ stdenv, fetchurl, pkgconfig, gettext, perl, libiconvOrEmpty, zlib, libffi
+, python, pcre, libelf }:
 
 # TODO:
 # * Add gio-module-fam
@@ -11,31 +11,56 @@
 #     Reminder: add 'sed -e 's@python2\.[0-9]@python@' -i
 #       $out/bin/gtester-report' to postInstall if this is solved
 
+let
+  # some packages don't get "Cflags" from pkgconfig correctly
+  # and then fail to build when directly including like <glib/...>
+  flattenInclude = ''
+    for dir in $out/include/*; do
+      cp -r $dir/* "$out/include/"
+      rm -r "$dir"
+      ln -s . "$dir"
+    done
+    ln -sr -t "$out/include/" $out/lib/*/include/* 2>/dev/null || true
+  '';
+in
+
 stdenv.mkDerivation (rec {
-  name = "glib-2.34.0";
+  name = "glib-2.36.1";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/glib/2.34/${name}.tar.xz";
-    sha256 = "f69b112f8848be35139d9099b62bc81649241f78f6a775516f0d4c9b47f65144";
+    url = "mirror://gnome/sources/glib/2.36/${name}.tar.xz";
+    sha256 = "090bw5par3dfy5m6dhq393pmy92zpw3d7rgbzqjc14jfg637bqvx";
   };
 
   outputs = [ "dev" "out" "bin" "doc" ];
 
   # configure script looks for d-bus but it is only needed for tests
-  buildInputs = [ libiconvOrNull ];
+  buildInputs = [ libelf ];
 
   nativeBuildInputs = [ perl pkgconfig gettext python ];
 
-  propagatedBuildInputs = [ pcre zlib libffi ];
+  propagatedBuildInputs = [ pcre zlib libffi ] ++ libiconvOrEmpty;
 
   configureFlags = "--with-pcre=system --disable-fam";
 
+  postConfigure = "sed '/SANE_MALLOC_PROTOS/s,^,//,' -i config.h" # https://bugzilla.gnome.org/show_bug.cgi?id=698716 :-)
+    + stdenv.lib.optionalString stdenv.isDarwin ''
+      sed '24 i #include <Foundation/Foundation.h>'
+    '';
+
   enableParallelBuilding = true;
 
-  passthru.gioModuleDir = "lib/gio/modules";
+  passthru = {
+     gioModuleDir = "lib/gio/modules";
+     inherit flattenInclude;
+  };
 
   meta = {
     description = "GLib, a C library of programming buildings blocks";
+    homepage    = http://www.gtk.org/;
+    license     = "LGPLv2+";
+    maintainers = with stdenv.lib.maintainers; [ raskin urkud lovek323 ];
+    platforms   = stdenv.lib.platforms.unix;
 
     longDescription = ''
       GLib provides the core application building blocks for libraries
@@ -43,13 +68,6 @@ stdenv.mkDerivation (rec {
       system used in GNOME, the main loop implementation, and a large
       set of utility functions for strings and common data structures.
     '';
-
-    homepage = http://www.gtk.org/;
-
-    license = "LGPLv2+";
-
-    maintainers = with stdenv.lib.maintainers; [raskin urkud];
-    platforms = stdenv.lib.platforms.linux;
   };
 }
 
diff --git a/pkgs/development/libraries/glibc/2.17/common.nix b/pkgs/development/libraries/glibc/2.17/common.nix
index 413a0d7aae8..e0588a6275d 100644
--- a/pkgs/development/libraries/glibc/2.17/common.nix
+++ b/pkgs/development/libraries/glibc/2.17/common.nix
@@ -55,6 +55,12 @@ stdenv.mkDerivation ({
          rfc3484_sort: Assertion `src->results[i].native == -1 ||
          src->results[i].native == a2_native' failed." crashes. */
       ./glibc-rh739743.patch
+
+      /* Fix buffer overrun in regexp matcher. */
+      ./cve-2013-0242.patch
+
+      /* Fix stack overflow in getaddrinfo with many results. */
+      ./cve-2013-1914.patch
     ];
 
   postPatch = ''
@@ -81,7 +87,7 @@ stdenv.mkDerivation ({
        then "--enable-profile"
        else "--disable-profile")
     ] ++ stdenv.lib.optionals (cross == null && kernelHeaders != null) [
-      "--enable-kernel=2.6.35"
+      "--enable-kernel=2.6.32"
     ] ++ stdenv.lib.optionals (cross != null) [
       (if cross.withTLS then "--with-tls" else "--without-tls")
       (if cross.float == "soft" then "--without-fp" else "--with-fp")
diff --git a/pkgs/development/libraries/glibc/2.17/cve-2013-0242.patch b/pkgs/development/libraries/glibc/2.17/cve-2013-0242.patch
new file mode 100644
index 00000000000..1d6557071e1
--- /dev/null
+++ b/pkgs/development/libraries/glibc/2.17/cve-2013-0242.patch
@@ -0,0 +1,87 @@
+When extending regex buffers, make sure we allocate enough room for the
+state log.  Merely doubling the space may not be enough if the current
+node has accepted a long run of characters.  This part of the code only
+triggers with multibyte characters.
+
+Andreas.
+
+	[BZ #15078]
+	* posix/regexec.c (extend_buffers): Add parameter min_len.
+	(check_matching): Pass minimum needed length.
+	(clean_state_log_if_needed): Likewise.
+	(get_subexp): Likewise.
+	* posix/Makefile (tests): Add bug-regex34.
+	(bug-regex34-ENV): Define.
+	* posix/bug-regex34.c: New file.
+
+diff --git a/posix/regexec.c b/posix/regexec.c
+index 7f2de85..5ca2bf6 100644
+--- a/posix/regexec.c
++++ b/posix/regexec.c
+@@ -197,7 +197,7 @@ static int group_nodes_into_DFAstates (const re_dfa_t *dfa,
+ static int check_node_accept (const re_match_context_t *mctx,
+ 			      const re_token_t *node, int idx)
+      internal_function;
+-static reg_errcode_t extend_buffers (re_match_context_t *mctx)
++static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len)
+      internal_function;
+ 
+ /* Entry point for POSIX code.  */
+@@ -1160,7 +1160,7 @@ check_matching (re_match_context_t *mctx, int fl_longest_match,
+ 	  || (BE (next_char_idx >= mctx->input.valid_len, 0)
+ 	      && mctx->input.valid_len < mctx->input.len))
+ 	{
+-	  err = extend_buffers (mctx);
++	  err = extend_buffers (mctx, next_char_idx + 1);
+ 	  if (BE (err != REG_NOERROR, 0))
+ 	    {
+ 	      assert (err == REG_ESPACE);
+@@ -1738,7 +1738,7 @@ clean_state_log_if_needed (re_match_context_t *mctx, int next_state_log_idx)
+ 	  && mctx->input.valid_len < mctx->input.len))
+     {
+       reg_errcode_t err;
+-      err = extend_buffers (mctx);
++      err = extend_buffers (mctx, next_state_log_idx + 1);
+       if (BE (err != REG_NOERROR, 0))
+ 	return err;
+     }
+@@ -2792,7 +2792,7 @@ get_subexp (re_match_context_t *mctx, int bkref_node, int bkref_str_idx)
+ 		  if (bkref_str_off >= mctx->input.len)
+ 		    break;
+ 
+-		  err = extend_buffers (mctx);
++		  err = extend_buffers (mctx, bkref_str_off + 1);
+ 		  if (BE (err != REG_NOERROR, 0))
+ 		    return err;
+ 
+@@ -4102,7 +4102,7 @@ check_node_accept (const re_match_context_t *mctx, const re_token_t *node,
+ 
+ static reg_errcode_t
+ internal_function __attribute_warn_unused_result__
+-extend_buffers (re_match_context_t *mctx)
++extend_buffers (re_match_context_t *mctx, int min_len)
+ {
+   reg_errcode_t ret;
+   re_string_t *pstr = &mctx->input;
+@@ -4111,8 +4111,10 @@ extend_buffers (re_match_context_t *mctx)
+   if (BE (INT_MAX / 2 / sizeof (re_dfastate_t *) <= pstr->bufs_len, 0))
+     return REG_ESPACE;
+ 
+-  /* Double the lengthes of the buffers.  */
+-  ret = re_string_realloc_buffers (pstr, MIN (pstr->len, pstr->bufs_len * 2));
++  /* Double the lengthes of the buffers, but allocate at least MIN_LEN.  */
++  ret = re_string_realloc_buffers (pstr,
++				   MAX (min_len,
++					MIN (pstr->len, pstr->bufs_len * 2)));
+   if (BE (ret != REG_NOERROR, 0))
+     return ret;
+ 
+-- 
+1.8.1.2
+
+
+-- 
+Andreas Schwab, SUSE Labs, schwab@suse.de
+GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
+"And now for something completely different."
+
diff --git a/pkgs/development/libraries/glibc/2.17/cve-2013-1914.patch b/pkgs/development/libraries/glibc/2.17/cve-2013-1914.patch
new file mode 100644
index 00000000000..c2963249f5e
--- /dev/null
+++ b/pkgs/development/libraries/glibc/2.17/cve-2013-1914.patch
@@ -0,0 +1,52 @@
+From: Andreas Schwab <schwab@suse.de>
+Date: Thu, 21 Mar 2013 14:50:27 +0000 (+0100)
+Subject: Fix stack overflow in getaddrinfo with many results
+X-Git-Url: http://sourceware.org/git/?p=glibc.git;a=commitdiff_plain;h=1cef1b19089528db11f221e938f60b9b048945d7
+
+Fix stack overflow in getaddrinfo with many results
+---
+
+diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
+index d95c2d1..2309281 100644
+--- a/sysdeps/posix/getaddrinfo.c
++++ b/sysdeps/posix/getaddrinfo.c
+@@ -2489,11 +2489,27 @@ getaddrinfo (const char *name, const char *service,
+       __typeof (once) old_once = once;
+       __libc_once (once, gaiconf_init);
+       /* Sort results according to RFC 3484.  */
+-      struct sort_result results[nresults];
+-      size_t order[nresults];
++      struct sort_result *results;
++      size_t *order;
+       struct addrinfo *q;
+       struct addrinfo *last = NULL;
+       char *canonname = NULL;
++      bool malloc_results;
++
++      malloc_results
++	= !__libc_use_alloca (nresults * (sizeof (*results) + sizeof (size_t)));
++      if (malloc_results)
++	{
++	  results = malloc (nresults * (sizeof (*results) + sizeof (size_t)));
++	  if (results == NULL)
++	    {
++	      __free_in6ai (in6ai);
++	      return EAI_MEMORY;
++	    }
++	}
++      else
++	results = alloca (nresults * (sizeof (*results) + sizeof (size_t)));
++      order = (size_t *) (results + nresults);
+ 
+       /* Now we definitely need the interface information.  */
+       if (! check_pf_called)
+@@ -2664,6 +2680,9 @@ getaddrinfo (const char *name, const char *service,
+ 
+       /* Fill in the canonical name into the new first entry.  */
+       p->ai_canonname = canonname;
++
++      if (malloc_results)
++	free (results);
+     }
+ 
+   __free_in6ai (in6ai);
diff --git a/pkgs/development/libraries/gmime/default.nix b/pkgs/development/libraries/gmime/default.nix
index 693a8b88340..8394f5c4e62 100644
--- a/pkgs/development/libraries/gmime/default.nix
+++ b/pkgs/development/libraries/gmime/default.nix
@@ -1,16 +1,19 @@
-{ stdenv, fetchurl, pkgconfig, glib, zlib }:
+{ stdenv, fetchurl, pkgconfig, glib, zlib, libgpgerror }:
 
 stdenv.mkDerivation rec {
-  name = "gmime-2.4.24";
+  name = "gmime-2.6.15";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/gmime/2.4/${name}.tar.gz";
-    sha256 = "2f538d68e215f075d16575a6da9acb87983db9e2df0d7d403858048881a0dd15";
+    url = "mirror://gnome/sources/gmime/2.6/${name}.tar.xz";
+    sha256 = "16n9gmlwn6rphi59hrwy6dpn785s3r13h2kmrn3k61l2kfws1hml";
   };
 
-  outputs = [ "dev" "out" "bin" "doc" ];
+  outputs = [ "dev" "out" "doc" ];
 
-  buildInputs = [ pkgconfig glib zlib ];
+  nativeBuildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ glib zlib libgpgerror ];
+
+  enableParallelBuilding = true;
 
   meta = {
     homepage = http://spruce.sourceforge.net/gmime/;
diff --git a/pkgs/development/libraries/gobject-introspection/default.nix b/pkgs/development/libraries/gobject-introspection/default.nix
index fe1d519f562..b96d5b25bb1 100644
--- a/pkgs/development/libraries/gobject-introspection/default.nix
+++ b/pkgs/development/libraries/gobject-introspection/default.nix
@@ -1,9 +1,9 @@
-{ stdenv, fetchurl, glib, flex, bison, pkgconfig, libffi, python }:
+{ stdenv, fetchurl, glib, flex, bison, pkgconfig, libffi, python, gdk_pixbuf }:
 
 stdenv.mkDerivation rec {
-  name = "gobject-introspection-1.34.0";
+  name = "gobject-introspection-1.34.2";
 
-  buildInputs = [ flex bison glib pkgconfig python ];
+  buildInputs = [ flex bison glib pkgconfig python gdk_pixbuf ];
   propagatedBuildInputs = [ libffi ];
 
   # Tests depend on cairo, which is undesirable (it pulls in lots of
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "mirror://gnome/sources/gobject-introspection/1.34/${name}.tar.xz";
-    sha256 = "80e211ea95404fc7c5fa3b04ba69ee0b29af70847af315155ab06b8cff832c85";
+    sha256 = "0a9lq0y67sr3g37l1hy0biqn046jr9wnd05hvwi8j8g2bjilhydw";
   };
 
   postInstall = "rm -rf $out/share/gtk-doc";
diff --git a/pkgs/development/libraries/gpgme/default.nix b/pkgs/development/libraries/gpgme/default.nix
index 4ba4cbb3347..9b56344743d 100644
--- a/pkgs/development/libraries/gpgme/default.nix
+++ b/pkgs/development/libraries/gpgme/default.nix
@@ -11,16 +11,16 @@ let
     "${gnupg}/bin/gpg2";
 in
 stdenv.mkDerivation rec {
-  name = "gpgme-1.3.1";
+  name = "gpgme-1.4.1";
   
   src = fetchurl {
     url = "ftp://ftp.gnupg.org/gcrypt/gpgme/${name}.tar.bz2";
-    sha256 = "1m7l7nicn6gd952cgspv9xr8whqivbg33nbg8kbpj3dffnl2gvqm";
+    sha1 = "d6110763e7459214fd72705e87ebc682e3b5815e";
   };
   
   propagatedBuildInputs = [ libgpgerror glib libassuan pth ];
 
-  nativeBuildInputs = [ pkgconfig ];
+  nativeBuildInputs = [ pkgconfig gnupg ];
 
   configureFlags = "--with-gpg=${gpgPath}";
 }
diff --git a/pkgs/development/libraries/gstreamer/gstreamer/default.nix b/pkgs/development/libraries/gstreamer/gstreamer/default.nix
index 5d33e7bff03..392e8e31f43 100644
--- a/pkgs/development/libraries/gstreamer/gstreamer/default.nix
+++ b/pkgs/development/libraries/gstreamer/gstreamer/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, perl, bison, flex, pkgconfig, glib, libxml2 }:
+{ fetchurl, stdenv, perl, bison, flex, pkgconfig, glib, libxml2, libintlOrEmpty }:
 
 stdenv.mkDerivation rec {
   name = "gstreamer-0.10.36";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ perl bison flex pkgconfig ];
-  propagatedBuildInputs = [ glib libxml2 ];
+  propagatedBuildInputs = [ glib libxml2 ] ++ libintlOrEmpty;
 
   patchPhase = ''
     sed -i -e 's/^   /\t/' docs/gst/Makefile.in docs/libs/Makefile.in docs/plugins/Makefile.in
diff --git a/pkgs/development/libraries/gtk+/2.24.x.nix b/pkgs/development/libraries/gtk+/2.x.nix
index ed5694d1396..e5aadea9507 100644
--- a/pkgs/development/libraries/gtk+/2.24.x.nix
+++ b/pkgs/development/libraries/gtk+/2.x.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, pkgconfig, glib, atk, pango, cairo, perl, xlibs
-, gdk_pixbuf, xz
-, xineramaSupport ? true
+{ stdenv, fetchurl, pkgconfig, gettext, glib, atk, pango, cairo, perl, xlibs
+, gdk_pixbuf, libintlOrEmpty, x11
+, xineramaSupport ? stdenv.isLinux
 , cupsSupport ? true, cups ? null
 }:
 
@@ -8,25 +8,29 @@ assert xineramaSupport -> xlibs.libXinerama != null;
 assert cupsSupport -> cups != null;
 
 stdenv.mkDerivation rec {
-  name = "gtk+-2.24.14";
+  name = "gtk+-2.24.18";
 
   src = fetchurl {
     url = "mirror://gnome/sources/gtk+/2.24/${name}.tar.xz";
-    sha256 = "8bd1b8b511a3004e8972badf467ce829e6855cdff15540b9344dc934c68008ac";
+    sha256 = "1193frzg0qrwa885w77kd055zfpbdjwby88xn2skpx9g4w0k35kc";
   };
 
   outputs = [ "dev" "out" "bin" "doc" ];
 
   enableParallelBuilding = true;
 
-  nativeBuildInputs = [ perl pkgconfig ];
+  NIX_CFLAGS_COMPILE = "-I${cairo}/include/cairo";
 
-  propagatedBuildInputs =
-    [ xlibs.xlibs glib atk pango gdk_pixbuf cairo
-      xlibs.libXrandr xlibs.libXrender xlibs.libXcomposite xlibs.libXi
-    ]
-    ++ stdenv.lib.optional xineramaSupport xlibs.libXinerama
-    ++ stdenv.lib.optionals cupsSupport [ cups ];
+  nativeBuildInputs = [ perl pkgconfig gettext ];
+
+  propagatedBuildInputs = with xlibs; with stdenv.lib;
+    [ glib cairo pango gdk_pixbuf atk ]
+    ++ optionals stdenv.isLinux
+      [ libXrandr libXrender libXcomposite libXi libXcursor ]
+    ++ optional stdenv.isDarwin x11
+    ++ libintlOrEmpty
+    ++ optional xineramaSupport libXinerama
+    ++ optionals cupsSupport [ cups ];
 
   configureFlags = "--with-xinput=yes";
 
@@ -49,6 +53,6 @@ stdenv.mkDerivation rec {
     license = "LGPLv2+";
 
     maintainers = [stdenv.lib.maintainers.raskin];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = stdenv.lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/gtk+/3.2.x.nix b/pkgs/development/libraries/gtk+/3.x.nix
index cace1b626f4..f89b521758c 100644
--- a/pkgs/development/libraries/gtk+/3.2.x.nix
+++ b/pkgs/development/libraries/gtk+/3.x.nix
@@ -1,29 +1,28 @@
-{ stdenv, fetchurl, pkgconfig, glib, atk, pango, cairo, perl, xlibs
-, gdk_pixbuf, xz
-, xineramaSupport ? true
-, cupsSupport ? true, cups ? null
+{ stdenv, fetchurl, pkgconfig, gettext
+, expat, glib, cairo, pango, gdk_pixbuf, atk, at_spi2_atk, xlibs, x11
+, xineramaSupport ? stdenv.isLinux
+, cupsSupport ? stdenv.isLinux, cups ? null
 }:
 
 assert xineramaSupport -> xlibs.libXinerama != null;
 assert cupsSupport -> cups != null;
 
 stdenv.mkDerivation rec {
-  name = "gtk+-3.2.4";
+  name = "gtk+-3.8.2";
 
   src = fetchurl {
-    url = "mirror://gnome/sources/gtk+/3.2/${name}.tar.xz";
-    sha256 = "f981bf514858c00d7084bd6f6c34b3c60b8aebdb959e7aca6faa59ed67c136bd";
+    url = "mirror://gnome/sources/gtk+/3.8/${name}.tar.xz";
+    sha256 = "15zjmyky4yw70ipi12dllira4av8wjpw5f7g9kbrbpx12nf0ra0w";
   };
 
   enableParallelBuilding = true;
 
-  nativeBuildInputs = [ perl pkgconfig ];
-
-  propagatedBuildInputs =
-    [ xlibs.xlibs glib atk pango gdk_pixbuf cairo
-      xlibs.libXrandr xlibs.libXrender xlibs.libXcomposite xlibs.libXi
-    ]
-    ++ stdenv.lib.optional xineramaSupport xlibs.libXinerama
+  nativeBuildInputs = [ pkgconfig gettext ];
+  propagatedBuildInputs = with xlibs; with stdenv.lib;
+    [ expat glib cairo pango gdk_pixbuf atk at_spi2_atk ]
+    ++ optionals stdenv.isLinux [ libXrandr libXrender libXcomposite libXi libXcursor ]
+    ++ optional stdenv.isDarwin x11
+    ++ stdenv.lib.optional xineramaSupport libXinerama
     ++ stdenv.lib.optionals cupsSupport [ cups ];
 
   postInstall = "rm -rf $out/share/gtk-doc";
@@ -47,6 +46,6 @@ stdenv.mkDerivation rec {
     license = "LGPLv2+";
 
     maintainers = with stdenv.lib.maintainers; [urkud raskin];
-    platforms = stdenv.lib.platforms.linux;
+    platforms = stdenv.lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/gtk-sharp-1/default.nix b/pkgs/development/libraries/gtk-sharp-1/default.nix
index 2110884a022..aad440bf672 100644
--- a/pkgs/development/libraries/gtk-sharp-1/default.nix
+++ b/pkgs/development/libraries/gtk-sharp-1/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
 
   builder = ./builder.sh;
   src = fetchurl {
-    url = http://nixos.org/tarballs/gtk-sharp-1.0.6.tar.gz;
+    url = http://tarballs.nixos.org/gtk-sharp-1.0.6.tar.gz;
     md5 = "2651d14fe77174ab20b8af53d150ee11";
   };
 
diff --git a/pkgs/development/libraries/gtkmm/3.x.nix b/pkgs/development/libraries/gtkmm/3.x.nix
index d3681b4b386..5c4a13fe507 100644
--- a/pkgs/development/libraries/gtkmm/3.x.nix
+++ b/pkgs/development/libraries/gtkmm/3.x.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, pkgconfig, gtk3, glibmm, cairomm, pangomm, atkmm }:
 
-stdenv.mkDerivation {
-  name = "gtkmm-3.2.0";
+stdenv.mkDerivation rec {
+  name = "gtkmm-3.7.12"; # gnome 3.8 release; stable 3.6 has problems with our new glibc
 
   src = fetchurl {
-    url = mirror://gnome/sources/gtkmm/3.2/gtkmm-3.2.0.tar.xz;
-    sha256 = "1wkljr2vjvjg5mggi4rvk9k4j2kzh8lc106k2yp8gqjlhk2xm5b1";
+    url = "mirror://gnome/sources/gtkmm/3.7/${name}.tar.xz";
+    sha256 = "05nrilm34gid7kqlq09hcdd7942prn2vbr1qgqvdhgy4x8pvz9p9";
   };
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/development/libraries/gtkmozembed-sharp/default.nix b/pkgs/development/libraries/gtkmozembed-sharp/default.nix
index 43476d6e78a..b54f3cc2f61 100644
--- a/pkgs/development/libraries/gtkmozembed-sharp/default.nix
+++ b/pkgs/development/libraries/gtkmozembed-sharp/default.nix
@@ -5,7 +5,7 @@ stdenv.mkDerivation {
 
   builder = ./builder.sh;
   src = fetchurl {
-    url = http://nixos.org/tarballs/gtkmozembed-sharp-0.7-pre41601.tar.bz2;
+    url = http://tarballs.nixos.org/gtkmozembed-sharp-0.7-pre41601.tar.bz2;
     md5 = "34aac139377296791acf3af9b5dc27ed";
   };
 
diff --git a/pkgs/development/libraries/gtksourceview-sharp/default.nix b/pkgs/development/libraries/gtksourceview-sharp/default.nix
index abd97ca777b..56c6e1b1ee5 100644
--- a/pkgs/development/libraries/gtksourceview-sharp/default.nix
+++ b/pkgs/development/libraries/gtksourceview-sharp/default.nix
@@ -5,7 +5,7 @@ stdenv.mkDerivation {
 
   builder = ./builder.sh;
   src = fetchurl {
-    url = http://nixos.org/tarballs/gtksourceview-sharp-0.6-pre40261.tar.bz2;
+    url = http://tarballs.nixos.org/gtksourceview-sharp-0.6-pre40261.tar.bz2;
     md5 = "8bc26c182bd897f50988e110a9a11f34";
   };
 
diff --git a/pkgs/development/libraries/harfbuzz/default.nix b/pkgs/development/libraries/harfbuzz/default.nix
index 5755e747a6b..4fb024db0e1 100644
--- a/pkgs/development/libraries/harfbuzz/default.nix
+++ b/pkgs/development/libraries/harfbuzz/default.nix
@@ -1,14 +1,14 @@
-{ stdenv, fetchurl, pkgconfig, glib, freetype }:
+{ stdenv, fetchurl, pkgconfig, glib, freetype, libintlOrEmpty }:
 
 stdenv.mkDerivation rec {
-  name = "harfbuzz-0.9.4";
+  name = "harfbuzz-0.9.12";
 
   src = fetchurl {
     url = "http://www.freedesktop.org/software/harfbuzz/release/${name}.tar.bz2";
-    sha256 = "2572f9a810d17a735ef565115463827d075af2371ee5b68e6d77231381f4bddc";
+    sha256 = "19cx5y2m20rp7z5j7mwqfb4ph2g8lrri69zim44x362y4w5gfly6";
   };
 
-  buildInputs = [ pkgconfig glib freetype ];
+  buildInputs = [ pkgconfig glib freetype ] ++ libintlOrEmpty;
 
   meta = {
     description = "An OpenType text shaping engine";
diff --git a/pkgs/development/libraries/haskell/Agda/default.nix b/pkgs/development/libraries/haskell/Agda/default.nix
index f6589dc53be..64c9d9d51e5 100644
--- a/pkgs/development/libraries/haskell/Agda/default.nix
+++ b/pkgs/development/libraries/haskell/Agda/default.nix
@@ -5,8 +5,8 @@
 
 cabal.mkDerivation (self: {
   pname = "Agda";
-  version = "2.3.2";
-  sha256 = "1xp0qvag6wx6zjwhmb7nm13hp63vlh8h4a2rkc85rsh610m0nynl";
+  version = "2.3.2.1";
+  sha256 = "1dlf0cs913ma8wjvra8x6p0lwi1pk7ynbdq4lxgbdfgqkbnh43kr";
   isLibrary = true;
   isExecutable = true;
   buildDepends = [
diff --git a/pkgs/development/libraries/haskell/Chart-gtk/default.nix b/pkgs/development/libraries/haskell/Chart-gtk/default.nix
new file mode 100644
index 00000000000..dd6c54cf6b8
--- /dev/null
+++ b/pkgs/development/libraries/haskell/Chart-gtk/default.nix
@@ -0,0 +1,18 @@
+{ cabal, cairo, Chart, colour, dataAccessor, dataAccessorTemplate
+, gtk, mtl, time
+}:
+
+cabal.mkDerivation (self: {
+  pname = "Chart-gtk";
+  version = "0.17";
+  sha256 = "1i411kdpz75azyhfaryazr0bpij5xcl0y82m9a7k23w8mhybqwc7";
+  buildDepends = [
+    cairo Chart colour dataAccessor dataAccessorTemplate gtk mtl time
+  ];
+  meta = {
+    homepage = "https://github.com/timbod7/haskell-chart/wiki";
+    description = "Utility functions for using the chart library with GTK";
+    license = self.stdenv.lib.licenses.bsd3;
+    platforms = self.ghc.meta.platforms;
+  };
+})
diff --git a/pkgs/development/libraries/haskell/Chart/default.nix b/pkgs/development/libraries/haskell/Chart/default.nix
index a59e4ca7f42..dafa834e4d4 100644
--- a/pkgs/development/libraries/haskell/Chart/default.nix
+++ b/pkgs/development/libraries/haskell/Chart/default.nix
@@ -4,13 +4,13 @@
 
 cabal.mkDerivation (self: {
   pname = "Chart";
-  version = "0.16";
-  sha256 = "1mb8hgxj0i5s7l061pfn49m5f6qdwvmgy6ni7jmg85vpy6b7jra3";
+  version = "0.17";
+  sha256 = "1ip1a61ryypwfzj6dc6n6pl92rflf7lqf1760ppjyg05q5pn6qxg";
   buildDepends = [
     cairo colour dataAccessor dataAccessorTemplate mtl time
   ];
   meta = {
-    homepage = "http://www.dockerz.net/software/chart.html";
+    homepage = "https://github.com/timbod7/haskell-chart/wiki";
     description = "A library for generating 2D Charts and Plots";
     license = self.stdenv.lib.licenses.bsd3;
     platforms = self.ghc.meta.platforms;
diff --git a/pkgs/development/libraries/haskell/JuicyPixels/default.nix b/pkgs/development/libraries/haskell/JuicyPixels/default.nix
index c289c009256..2a7bc888c48 100644
--- a/pkgs/development/libraries/haskell/JuicyPixels/default.nix
+++ b/pkgs/development/libraries/haskell/JuicyPixels/default.nix
@@ -1,17 +1,17 @@
-{ cabal, binary, deepseq, mtl, primitive, transformers, vector
-, zlib
+{ cabal, binary, deepseq, mmap, mtl, primitive, transformers
+, vector, zlib
 }:
 
 cabal.mkDerivation (self: {
   pname = "JuicyPixels";
-  version = "3.0";
-  sha256 = "1qhhhnfs12r67nf07bx58n8a2v6wikan8cqs1wnjnaad8yk2spsg";
+  version = "3.1";
+  sha256 = "1z3adva85qgdyx85hldqi99lnb3pg7a42q44zxil4gxwi62pw4xr";
   buildDepends = [
-    binary deepseq mtl primitive transformers vector zlib
+    binary deepseq mmap mtl primitive transformers vector zlib
   ];
   meta = {
     homepage = "https://github.com/Twinside/Juicy.Pixels";
-    description = "Picture loading/serialization (in png, jpeg, bitmap, radiance and gif)";
+    description = "Picture loading/serialization (in png, jpeg, bitmap, gif, tiff and radiance)";
     license = self.stdenv.lib.licenses.bsd3;
     platforms = self.ghc.meta.platforms;
     maintainers = [ self.stdenv.lib.maintainers.andres ];
diff --git a/pkgs/development/libraries/haskell/ListLike/default.nix b/pkgs/development/libraries/haskell/ListLike/default.nix
index 2fa427b1f57..b24e81300b6 100644
--- a/pkgs/development/libraries/haskell/ListLike/default.nix
+++ b/pkgs/development/libraries/haskell/ListLike/default.nix
@@ -1,11 +1,11 @@
-{ cabal }:
+{ cabal, HUnit, QuickCheck, random, text, vector }:
 
 cabal.mkDerivation (self: {
   pname = "ListLike";
-  version = "3.1.7.1";
-  sha256 = "1g3i8iz71x3j41ji9xsbh84v5hj3mxls0zqnx27sb31mx6bic4w1";
-  isLibrary = true;
-  isExecutable = true;
+  version = "4.0.0";
+  sha256 = "13dw8pkj8dwxb81gbcm7gn221zyr3ck9s9s1iv7v1b69chv0zyxk";
+  buildDepends = [ text vector ];
+  testDepends = [ HUnit QuickCheck random text vector ];
   meta = {
     homepage = "http://software.complete.org/listlike";
     description = "Generic support for list-like structures";
diff --git a/pkgs/development/libraries/haskell/accelerate-cuda/default.nix b/pkgs/development/libraries/haskell/accelerate-cuda/default.nix
index aee3b666890..53f1514bcb6 100644
--- a/pkgs/development/libraries/haskell/accelerate-cuda/default.nix
+++ b/pkgs/development/libraries/haskell/accelerate-cuda/default.nix
@@ -5,8 +5,8 @@
 
 cabal.mkDerivation (self: {
   pname = "accelerate-cuda";
-  version = "0.13.0.1";
-  sha256 = "0nswa73ajvmh1s6n2nks4zm3ybfm8v46wd789cs09f5s90ingpsj";
+  version = "0.13.0.3";
+  sha256 = "1y0v7w08pywb8qlw0b5aw4f8pkx4bjlfwxpqq2zfqmjsclnlifkb";
   buildDepends = [
     accelerate binary cryptohash cuda fclabels filepath hashable
     hashtables languageCQuote mainlandPretty mtl SafeSemaphore srcloc
diff --git a/pkgs/development/libraries/haskell/accelerate-io/default.nix b/pkgs/development/libraries/haskell/accelerate-io/default.nix
index 3daa16d87c9..48c2ea71e17 100644
--- a/pkgs/development/libraries/haskell/accelerate-io/default.nix
+++ b/pkgs/development/libraries/haskell/accelerate-io/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "accelerate-io";
-  version = "0.13.0.1";
-  sha256 = "0wjprbhcddnjqbhmpxiwq73hazdnhafhjj7mpvpxhs9pz1dbv89h";
+  version = "0.13.0.2";
+  sha256 = "0lm1kkjs5gbd70k554vi9977v4bxxcxaw39r9wmwxf8nx2qxvshh";
   buildDepends = [ accelerate bmp repa vector ];
   meta = {
     homepage = "https://github.com/AccelerateHS/accelerate-io";
diff --git a/pkgs/development/libraries/haskell/accelerate/default.nix b/pkgs/development/libraries/haskell/accelerate/default.nix
index b91de6de44e..c2484116f46 100644
--- a/pkgs/development/libraries/haskell/accelerate/default.nix
+++ b/pkgs/development/libraries/haskell/accelerate/default.nix
@@ -2,10 +2,9 @@
 
 cabal.mkDerivation (self: {
   pname = "accelerate";
-  version = "0.13.0.1";
-  sha256 = "01vkvvvzlj023cwxz90clrcgz4xyz0nb8idm1zad21gzrij14915";
+  version = "0.13.0.5";
+  sha256 = "1vqkv3k0w1zy0111a786npf3hypbcg675lbdkv2cf3zx5hqcnn6j";
   buildDepends = [ fclabels hashable hashtables ];
-  noHaddock = true;
   meta = {
     homepage = "https://github.com/AccelerateHS/accelerate/";
     description = "An embedded language for accelerated array processing";
diff --git a/pkgs/development/libraries/haskell/acid-state/default.nix b/pkgs/development/libraries/haskell/acid-state/default.nix
index 10f222cfe10..dcd6698a5a2 100644
--- a/pkgs/development/libraries/haskell/acid-state/default.nix
+++ b/pkgs/development/libraries/haskell/acid-state/default.nix
@@ -4,8 +4,8 @@
 
 cabal.mkDerivation (self: {
   pname = "acid-state";
-  version = "0.8.3";
-  sha256 = "1n7vafw3jz7kmlp5jqn1wv0ip2rcbyfx0cdi2m1a2lvpi6dh97gc";
+  version = "0.10.0";
+  sha256 = "0jjjh8l6ka8kawgp1gm75is4ajavl7nd6b2l717wjs8sy93qnzsc";
   buildDepends = [
     cereal extensibleExceptions filepath mtl network safecopy stm
   ];
diff --git a/pkgs/development/libraries/haskell/binary/0.6.0.0.nix b/pkgs/development/libraries/haskell/binary/0.6.0.0.nix
new file mode 100644
index 00000000000..01e909212e8
--- /dev/null
+++ b/pkgs/development/libraries/haskell/binary/0.6.0.0.nix
@@ -0,0 +1,13 @@
+{ cabal }:
+
+cabal.mkDerivation (self: {
+  pname = "binary";
+  version = "0.6.0.0";
+  sha256 = "0p72w7f9nn19g2wggsh8x4z7y9s174f3drz9a5ln4x7h554swcxv";
+  meta = {
+    homepage = "https://github.com/kolmodin/binary";
+    description = "Binary serialisation for Haskell values using lazy ByteStrings";
+    license = self.stdenv.lib.licenses.bsd3;
+    platforms = self.ghc.meta.platforms;
+  };
+})
diff --git a/pkgs/development/libraries/haskell/binary/default.nix b/pkgs/development/libraries/haskell/binary/0.7.1.0.nix
index 245c80ef1cc..245c80ef1cc 100644
--- a/pkgs/development/libraries/haskell/binary/default.nix
+++ b/pkgs/development/libraries/haskell/binary/0.7.1.0.nix
diff --git a/pkgs/development/libraries/haskell/bytedump/default.nix b/pkgs/development/libraries/haskell/bytedump/default.nix
new file mode 100644
index 00000000000..8290717fa4b
--- /dev/null
+++ b/pkgs/development/libraries/haskell/bytedump/default.nix
@@ -0,0 +1,15 @@
+{ cabal }:
+
+cabal.mkDerivation (self: {
+  pname = "bytedump";
+  version = "1.0";
+  sha256 = "1pf01mna3isx3i7m50yz3pw5ygz5sg8i8pshjb3yw8q41w2ba5xf";
+  isLibrary = true;
+  isExecutable = true;
+  meta = {
+    homepage = "http://github.com/vincenthz/hs-bytedump";
+    description = "Flexible byte dump helpers for human readers";
+    license = self.stdenv.lib.licenses.bsd3;
+    platforms = self.ghc.meta.platforms;
+  };
+})
diff --git a/pkgs/development/libraries/haskell/classy-prelude/default.nix b/pkgs/development/libraries/haskell/classy-prelude/default.nix
index 51a2d6c55ba..14695fd08f5 100644
--- a/pkgs/development/libraries/haskell/classy-prelude/default.nix
+++ b/pkgs/development/libraries/haskell/classy-prelude/default.nix
@@ -5,8 +5,8 @@
 
 cabal.mkDerivation (self: {
   pname = "classy-prelude";
-  version = "0.5.7";
-  sha256 = "1wq8la7nq3dh21yqwcjhwgy5s5mpqlvmrfma48v8ch6w4wwb0sqz";
+  version = "0.5.8";
+  sha256 = "1yq2x3mfkasprmsx1gracjhih9l9x0dsq6pdf90khlcl11qh57ir";
   buildDepends = [
     basicPrelude hashable liftedBase monadControl systemFilepath text
     transformers unorderedContainers vector
diff --git a/pkgs/development/libraries/haskell/concurrent-extra/default.nix b/pkgs/development/libraries/haskell/concurrent-extra/default.nix
index db380f03b5b..9f97f730472 100644
--- a/pkgs/development/libraries/haskell/concurrent-extra/default.nix
+++ b/pkgs/development/libraries/haskell/concurrent-extra/default.nix
@@ -4,8 +4,8 @@
 
 cabal.mkDerivation (self: {
   pname = "concurrent-extra";
-  version = "0.7.0.5";
-  sha256 = "0g1ckrwgdyrlp1m352ivplajqzqhw5ymlkb4miiv7c5i9xyyyqnc";
+  version = "0.7.0.6";
+  sha256 = "12wq86hkgy22qydkj4fw6vb7crzv3010c2mkhsph4rdynr0v588i";
   buildDepends = [ baseUnicodeSymbols stm unboundedDelays ];
   testDepends = [
     baseUnicodeSymbols HUnit stm testFramework testFrameworkHunit
diff --git a/pkgs/development/libraries/haskell/contravariant/default.nix b/pkgs/development/libraries/haskell/contravariant/default.nix
index 2c967d26085..e1f5e2ae567 100644
--- a/pkgs/development/libraries/haskell/contravariant/default.nix
+++ b/pkgs/development/libraries/haskell/contravariant/default.nix
@@ -2,12 +2,12 @@
 
 cabal.mkDerivation (self: {
   pname = "contravariant";
-  version = "0.4";
-  sha256 = "1nqslc9vcx6v6c33fn7mvb1xhr33yl3ja92p788zx8z1drx9cqc3";
+  version = "0.4.1";
+  sha256 = "0alzl47lqzw9fqjqxdfy40f1aynd8mc00b2h7fj2ch0zq82hm85q";
   buildDepends = [ tagged transformers transformersCompat ];
   meta = {
     homepage = "http://github.com/ekmett/contravariant/";
-    description = "Haskell 98 contravariant functors";
+    description = "Contravariant functors";
     license = self.stdenv.lib.licenses.bsd3;
     platforms = self.ghc.meta.platforms;
   };
diff --git a/pkgs/development/libraries/haskell/entropy/default.nix b/pkgs/development/libraries/haskell/entropy/default.nix
index f98903d3dc1..797ce1711b2 100644
--- a/pkgs/development/libraries/haskell/entropy/default.nix
+++ b/pkgs/development/libraries/haskell/entropy/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "entropy";
-  version = "0.2.2";
-  sha256 = "1zri5qs19cbz9ydbh076q6834pspf2gqn06ssz4hsq6j65cnd9x2";
+  version = "0.2.2.1";
+  sha256 = "1yl1gmkmbalm27pjlpm9nhsbxpvxl8w7p8psq5apyrbdqnv9yhbg";
   meta = {
     homepage = "https://github.com/TomMD/entropy";
     description = "A platform independent entropy source";
diff --git a/pkgs/development/libraries/haskell/fingertree/default.nix b/pkgs/development/libraries/haskell/fingertree/default.nix
index 299b2e926db..f48e1c4002e 100644
--- a/pkgs/development/libraries/haskell/fingertree/default.nix
+++ b/pkgs/development/libraries/haskell/fingertree/default.nix
@@ -1,9 +1,15 @@
-{ cabal }:
+{ cabal, HUnit, QuickCheck, testFramework, testFrameworkHunit
+, testFrameworkQuickcheck2
+}:
 
 cabal.mkDerivation (self: {
   pname = "fingertree";
-  version = "0.0.1.1";
-  sha256 = "00llr24b2r539250fangl0jj39gf26gjwvhjpy5qg8l920hrjn78";
+  version = "0.1.0.0";
+  sha256 = "0c35sryzsijwavvw9x1pk5p99rhmp4g8pjh2ds419mlfgxc039ms";
+  testDepends = [
+    HUnit QuickCheck testFramework testFrameworkHunit
+    testFrameworkQuickcheck2
+  ];
   meta = {
     description = "Generic finger-tree structure, with example instances";
     license = self.stdenv.lib.licenses.bsd3;
diff --git a/pkgs/development/libraries/haskell/ghc-heap-view/default.nix b/pkgs/development/libraries/haskell/ghc-heap-view/default.nix
index 342e2a7cd31..62b07030a46 100644
--- a/pkgs/development/libraries/haskell/ghc-heap-view/default.nix
+++ b/pkgs/development/libraries/haskell/ghc-heap-view/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "ghc-heap-view";
-  version = "0.5.0.1";
-  sha256 = "1zqzv6r4nkzam51bb6pp2i1kkzhx5mnaqcn8wzr0hxbi5lc1088h";
+  version = "0.5.1";
+  sha256 = "1qi7f3phj2j63x1wd2cvk36945cxd84s12zs03hlrn49wzx2pf1n";
   buildDepends = [ binary transformers ];
   meta = {
     description = "Extract the heap representation of Haskell values and thunks";
diff --git a/pkgs/development/libraries/haskell/ghc-vis/default.nix b/pkgs/development/libraries/haskell/ghc-vis/default.nix
index 12508a09c63..856ec810463 100644
--- a/pkgs/development/libraries/haskell/ghc-vis/default.nix
+++ b/pkgs/development/libraries/haskell/ghc-vis/default.nix
@@ -4,8 +4,8 @@
 
 cabal.mkDerivation (self: {
   pname = "ghc-vis";
-  version = "0.7.0.1";
-  sha256 = "0k6pm1lqmcmgdqzcdbygdyg6bgx4k0gi77k1mxwprgr9vv3ly26w";
+  version = "0.7.1";
+  sha256 = "05j3yw1276wvy4va7r7pbnvhjg1k1mxzp4baxcb9jlb5dxfh0daa";
   buildDepends = [
     cairo deepseq fgl ghcHeapView graphviz gtk mtl svgcairo text
     transformers xdot
diff --git a/pkgs/development/libraries/haskell/hakyll/default.nix b/pkgs/development/libraries/haskell/hakyll/default.nix
index 4f50ab44950..766f56ee8e3 100644
--- a/pkgs/development/libraries/haskell/hakyll/default.nix
+++ b/pkgs/development/libraries/haskell/hakyll/default.nix
@@ -1,42 +1,36 @@
 { cabal, binary, blazeHtml, blazeMarkup, citeprocHs, cmdargs
-, cryptohash, dataDefault, deepseq, filepath, httpConduit
-, httpTypes, HUnit, lrucache, mtl, pandoc, parsec, QuickCheck
-, random, regexBase, regexTdfa, snapCore, snapServer, tagsoup
-, testFramework, testFrameworkHunit, testFrameworkQuickcheck2, text
-, time
+, cryptohash, dataDefault, deepseq, filepath, fsnotify, httpConduit
+, httpTypes, HUnit, lrucache, mtl, network, pandoc, parsec
+, QuickCheck, random, regexBase, regexTdfa, snapCore, snapServer
+, systemFilepath, tagsoup, testFramework, testFrameworkHunit
+, testFrameworkQuickcheck2, text, time
 }:
 
 cabal.mkDerivation (self: {
   pname = "hakyll";
-  version = "4.2.2.0";
-  sha256 = "0kz8v2ip0hmvqnrxgv44g2863z1dql88razl7aa3fw01q56ihz0y";
+  version = "4.3.1.0";
+  sha256 = "1cx5pf0wf49cylbcgy1di218qk0fw8rgzqri9lx1v8jfl31zvsg5";
   isLibrary = true;
   isExecutable = true;
   buildDepends = [
     binary blazeHtml blazeMarkup citeprocHs cmdargs cryptohash
-    dataDefault deepseq filepath httpConduit httpTypes lrucache mtl
-    pandoc parsec random regexBase regexTdfa snapCore snapServer
-    tagsoup text time
+    dataDefault deepseq filepath fsnotify httpConduit httpTypes
+    lrucache mtl network pandoc parsec random regexBase regexTdfa
+    snapCore snapServer systemFilepath tagsoup text time
   ];
   testDepends = [
     binary blazeHtml blazeMarkup citeprocHs cmdargs cryptohash
-    dataDefault deepseq filepath httpConduit httpTypes HUnit lrucache
-    mtl pandoc parsec QuickCheck random regexBase regexTdfa snapCore
-    snapServer tagsoup testFramework testFrameworkHunit
-    testFrameworkQuickcheck2 text time
+    dataDefault deepseq filepath fsnotify httpConduit httpTypes HUnit
+    lrucache mtl network pandoc parsec QuickCheck random regexBase
+    regexTdfa snapCore snapServer systemFilepath tagsoup testFramework
+    testFrameworkHunit testFrameworkQuickcheck2 text time
   ];
   doCheck = false;
-  patchPhase = ''
-    sed -i -e 's|cryptohash .*,|cryptohash,|' hakyll.cabal
-  '';
   meta = {
     homepage = "http://jaspervdj.be/hakyll";
     description = "A static website compiler library";
     license = self.stdenv.lib.licenses.bsd3;
     platforms = self.ghc.meta.platforms;
-    maintainers = [
-      self.stdenv.lib.maintainers.andres
-      self.stdenv.lib.maintainers.simons
-    ];
+    maintainers = [ self.stdenv.lib.maintainers.andres ];
   };
 })
diff --git a/pkgs/development/libraries/haskell/hashable/1.2.0.7.nix b/pkgs/development/libraries/haskell/hashable/1.2.0.10.nix
index e92f0c2c9d1..2bafe55f420 100644
--- a/pkgs/development/libraries/haskell/hashable/1.2.0.7.nix
+++ b/pkgs/development/libraries/haskell/hashable/1.2.0.10.nix
@@ -4,8 +4,8 @@
 
 cabal.mkDerivation (self: {
   pname = "hashable";
-  version = "1.2.0.7";
-  sha256 = "1v70b85g9kx0ikgxpiqpl8dp3w9hdxm75h73g69giyiy7swn9630";
+  version = "1.2.0.10";
+  sha256 = "155r7zqc0kisjdslr8d1c04yqwvzwqx4d99c0zla113dvsdjhp37";
   buildDepends = [ text ];
   testDepends = [
     HUnit QuickCheck random testFramework testFrameworkHunit
diff --git a/pkgs/development/libraries/haskell/hflags/default.nix b/pkgs/development/libraries/haskell/hflags/default.nix
new file mode 100644
index 00000000000..17c01f9a659
--- /dev/null
+++ b/pkgs/development/libraries/haskell/hflags/default.nix
@@ -0,0 +1,14 @@
+{ cabal, text }:
+
+cabal.mkDerivation (self: {
+  pname = "hflags";
+  version = "0.1.3";
+  sha256 = "0nn08xqn0hvdlblnaad3nsdfkc0ssab6kvhi4qbrcq9jmjmspld3";
+  buildDepends = [ text ];
+  meta = {
+    homepage = "http://github.com/errge/hflags";
+    description = "Command line flag parser, very similar to Google's gflags";
+    license = "Apache-2.0";
+    platforms = self.ghc.meta.platforms;
+  };
+})
diff --git a/pkgs/development/libraries/haskell/hit/default.nix b/pkgs/development/libraries/haskell/hit/default.nix
new file mode 100644
index 00000000000..9791478d3e8
--- /dev/null
+++ b/pkgs/development/libraries/haskell/hit/default.nix
@@ -0,0 +1,27 @@
+{ cabal, attoparsec, blazeBuilder, bytedump, cryptohash, HUnit, mtl
+, parsec, QuickCheck, random, systemFileio, systemFilepath
+, testFramework, testFrameworkQuickcheck2, time, vector, zlib
+, zlibBindings
+}:
+
+cabal.mkDerivation (self: {
+  pname = "hit";
+  version = "0.5.0";
+  sha256 = "05v49l3k8gwn922d5b5xrzdrakh6bw02bp8hd8yc8163jyazk2vx";
+  isLibrary = true;
+  isExecutable = true;
+  buildDepends = [
+    attoparsec blazeBuilder cryptohash mtl parsec random systemFileio
+    systemFilepath time vector zlib zlibBindings
+  ];
+  testDepends = [
+    bytedump HUnit QuickCheck testFramework testFrameworkQuickcheck2
+    time
+  ];
+  meta = {
+    homepage = "http://github.com/vincenthz/hit";
+    description = "Git operations in haskell";
+    license = self.stdenv.lib.licenses.bsd3;
+    platforms = self.ghc.meta.platforms;
+  };
+})
diff --git a/pkgs/development/libraries/haskell/hsdns/default.nix b/pkgs/development/libraries/haskell/hsdns/default.nix
index b72f4d947c4..464047d0c61 100644
--- a/pkgs/development/libraries/haskell/hsdns/default.nix
+++ b/pkgs/development/libraries/haskell/hsdns/default.nix
@@ -2,11 +2,10 @@
 
 cabal.mkDerivation (self: {
   pname = "hsdns";
-  version = "1.6";
-  sha256 = "1vf3crkhs7z572bqdf7p2hfcqkjxvnyg0w0cf8b7kyfxzn8bj3fa";
+  version = "1.6.1";
+  sha256 = "0s63acjy1n75k7gjm4kam7v5d4a5kn0aw178mygkqwr5frflghb4";
   buildDepends = [ network ];
   extraLibraries = [ adns ];
-  noHaddock = true;
   meta = {
     homepage = "http://github.com/peti/hsdns";
     description = "Asynchronous DNS Resolver";
diff --git a/pkgs/development/libraries/haskell/hsshellscript/default.nix b/pkgs/development/libraries/haskell/hsshellscript/default.nix
new file mode 100644
index 00000000000..126a0d316bf
--- /dev/null
+++ b/pkgs/development/libraries/haskell/hsshellscript/default.nix
@@ -0,0 +1,15 @@
+{ cabal, c2hs, parsec, random }:
+
+cabal.mkDerivation (self: {
+  pname = "hsshellscript";
+  version = "3.3.1";
+  sha256 = "0z3afp3r1j1in03fv2yb5sfbzgcrhdig6gay683bzgh85glwxhlp";
+  buildDepends = [ parsec random ];
+  buildTools = [ c2hs ];
+  meta = {
+    homepage = "http://www.volker-wysk.de/hsshellscript/";
+    description = "Haskell for Unix shell scripting tasks";
+    license = "LGPL";
+    platforms = self.ghc.meta.platforms;
+  };
+})
diff --git a/pkgs/development/libraries/haskell/iteratee/default.nix b/pkgs/development/libraries/haskell/iteratee/default.nix
index ee9026bae49..c4438d97364 100644
--- a/pkgs/development/libraries/haskell/iteratee/default.nix
+++ b/pkgs/development/libraries/haskell/iteratee/default.nix
@@ -10,6 +10,7 @@ cabal.mkDerivation (self: {
     ListLike MonadCatchIOTransformers monadControl parallel
     transformers transformersBase
   ];
+  jailbreak = true;
   meta = {
     homepage = "http://www.tiresiaspress.us/haskell/iteratee";
     description = "Iteratee-based I/O";
diff --git a/pkgs/development/libraries/haskell/monadcryptorandom/default.nix b/pkgs/development/libraries/haskell/monadcryptorandom/default.nix
index df63e3ec659..e955bb14a72 100644
--- a/pkgs/development/libraries/haskell/monadcryptorandom/default.nix
+++ b/pkgs/development/libraries/haskell/monadcryptorandom/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "monadcryptorandom";
-  version = "0.5.1";
-  sha256 = "10waxc0i7hcqlgb9iwcdz0xqkym4ihavgwq466xlaqzzhcpp38d6";
+  version = "0.5.2";
+  sha256 = "0a0qx331c1kvhmwwam7pbbrnq8ky3spfnw6zsz6rz7g1lk1hfawn";
   buildDepends = [ cryptoApi mtl tagged transformers ];
   meta = {
     homepage = "https://github.com/TomMD/monadcryptorandom";
diff --git a/pkgs/development/libraries/haskell/mongoDB/default.nix b/pkgs/development/libraries/haskell/mongoDB/default.nix
index e730125544e..12c65deb445 100644
--- a/pkgs/development/libraries/haskell/mongoDB/default.nix
+++ b/pkgs/development/libraries/haskell/mongoDB/default.nix
@@ -4,8 +4,8 @@
 
 cabal.mkDerivation (self: {
   pname = "mongoDB";
-  version = "1.4.0";
-  sha256 = "1cj73k6lfpxmfaigqwwglnncfl1ikz6yjgs0d9f6k42kwysbddwz";
+  version = "1.4.1";
+  sha256 = "1r1ywqy3igcmmwxjy4fjqdnf8m4zqbc8l0nj43h2xwrl86lhfym9";
   buildDepends = [
     binary bson cryptohash liftedBase monadControl mtl network parsec
     random randomShuffle text transformersBase
diff --git a/pkgs/development/libraries/haskell/persistent-template/default.nix b/pkgs/development/libraries/haskell/persistent-template/default.nix
index f3ab1800dae..2afc416cb52 100644
--- a/pkgs/development/libraries/haskell/persistent-template/default.nix
+++ b/pkgs/development/libraries/haskell/persistent-template/default.nix
@@ -4,8 +4,8 @@
 
 cabal.mkDerivation (self: {
   pname = "persistent-template";
-  version = "1.2.0.1";
-  sha256 = "1l8ws4mijl0cwcl14ms8hibfgcn3y6b1679xc0cdyz1ifiymkdns";
+  version = "1.2.0.2";
+  sha256 = "0zj35mg7fzyk4b98s3s8m5i064s0wznz9aixgxa4kzm4xps7hj4z";
   buildDepends = [
     aeson monadControl monadLogger persistent text transformers
   ];
diff --git a/pkgs/development/libraries/haskell/persistent/default.nix b/pkgs/development/libraries/haskell/persistent/default.nix
index 79fd1f6f781..57bb615800b 100644
--- a/pkgs/development/libraries/haskell/persistent/default.nix
+++ b/pkgs/development/libraries/haskell/persistent/default.nix
@@ -7,8 +7,8 @@
 
 cabal.mkDerivation (self: {
   pname = "persistent";
-  version = "1.2.0.1";
-  sha256 = "1bs74g1fkwq4wvz18lp0ial6z58vpslgv0rqdn91ka6gw8k4fvlb";
+  version = "1.2.0.2";
+  sha256 = "026zdfccy57dbsacg8227jzcdyq50nb1bkcr56ryxi91ymlyf50k";
   buildDepends = [
     aeson attoparsec base64Bytestring blazeHtml blazeMarkup conduit
     liftedBase monadControl monadLogger pathPieces poolConduit
diff --git a/pkgs/development/libraries/haskell/pipes-concurrency/default.nix b/pkgs/development/libraries/haskell/pipes-concurrency/default.nix
index 702853766a7..d931845f16e 100644
--- a/pkgs/development/libraries/haskell/pipes-concurrency/default.nix
+++ b/pkgs/development/libraries/haskell/pipes-concurrency/default.nix
@@ -1,10 +1,10 @@
-{ cabal, pipes, stm, transformers }:
+{ cabal, pipes, stm }:
 
 cabal.mkDerivation (self: {
   pname = "pipes-concurrency";
-  version = "1.1.0";
-  sha256 = "05xpwxhf08yf88ya89f8gcy4vphi6qxyccf2yiyi5zrf6c2pkr00";
-  buildDepends = [ pipes stm transformers ];
+  version = "1.2.0";
+  sha256 = "058v9d3wf9n1d25rhdq5vj60p8mll5yv2zn2k1092bg7qisip1fq";
+  buildDepends = [ pipes stm ];
   meta = {
     description = "Concurrency for the pipes ecosystem";
     license = self.stdenv.lib.licenses.bsd3;
diff --git a/pkgs/development/libraries/haskell/postgresql-simple/default.nix b/pkgs/development/libraries/haskell/postgresql-simple/default.nix
index 0a40cdf7a96..888f992b159 100644
--- a/pkgs/development/libraries/haskell/postgresql-simple/default.nix
+++ b/pkgs/development/libraries/haskell/postgresql-simple/default.nix
@@ -5,8 +5,8 @@
 
 cabal.mkDerivation (self: {
   pname = "postgresql-simple";
-  version = "0.3.3.0";
-  sha256 = "0srkalfg41gdnzwwa2bmwwrcdqnw13f7b94wv4d5a6sg6yf1ry1l";
+  version = "0.3.3.2";
+  sha256 = "1gh2ih1n6g17jry12g7nv344sfzrhfc1assslx0cjlsryhbz25lp";
   buildDepends = [
     attoparsec blazeBuilder blazeTextual postgresqlLibpq text time
     transformers vector
diff --git a/pkgs/development/libraries/haskell/regex-tdfa-text/default.nix b/pkgs/development/libraries/haskell/regex-tdfa-text/default.nix
new file mode 100644
index 00000000000..1a329c25b2d
--- /dev/null
+++ b/pkgs/development/libraries/haskell/regex-tdfa-text/default.nix
@@ -0,0 +1,13 @@
+{ cabal, regexBase, regexTdfa, text }:
+
+cabal.mkDerivation (self: {
+  pname = "regex-tdfa-text";
+  version = "1.0.0.2";
+  sha256 = "1p17xv3j2xd74iilyqwlqhkmyp26asq4k1pb0h2f0wdqqfr87bfd";
+  buildDepends = [ regexBase regexTdfa text ];
+  meta = {
+    description = "Text interface for regex-tdfa";
+    license = self.stdenv.lib.licenses.bsd3;
+    platforms = self.ghc.meta.platforms;
+  };
+})
diff --git a/pkgs/development/libraries/haskell/shake/default.nix b/pkgs/development/libraries/haskell/shake/default.nix
index c5cc24cc8da..b7f605c2b7e 100644
--- a/pkgs/development/libraries/haskell/shake/default.nix
+++ b/pkgs/development/libraries/haskell/shake/default.nix
@@ -4,8 +4,8 @@
 
 cabal.mkDerivation (self: {
   pname = "shake";
-  version = "0.10.3";
-  sha256 = "0dvpjswiiw2s4zh5sjx7qs4xp41bw2wqny0k61pkg5wvgw3b7jmh";
+  version = "0.10.5";
+  sha256 = "1abbls2rmpyxpj41c0afvfjh1bw6j6rz1n0w4jhqrmq0d32kpg7a";
   isLibrary = true;
   isExecutable = true;
   buildDepends = [
diff --git a/pkgs/development/libraries/haskell/snap/core.nix b/pkgs/development/libraries/haskell/snap/core.nix
index a20ec8e7ca5..f2440ef250f 100644
--- a/pkgs/development/libraries/haskell/snap/core.nix
+++ b/pkgs/development/libraries/haskell/snap/core.nix
@@ -1,19 +1,19 @@
 { cabal, attoparsec, attoparsecEnumerator, blazeBuilder
 , blazeBuilderEnumerator, bytestringMmap, caseInsensitive, deepseq
-, enumerator, filepath, HUnit, MonadCatchIOTransformers, mtl
-, random, regexPosix, text, time, unixCompat, unorderedContainers
-, vector, zlibEnum
+, enumerator, filepath, hashable, HUnit, MonadCatchIOTransformers
+, mtl, random, regexPosix, text, time, unixCompat
+, unorderedContainers, vector, zlibEnum
 }:
 
 cabal.mkDerivation (self: {
   pname = "snap-core";
-  version = "0.9.3.1";
-  sha256 = "1q2lk70l0hk4l6ksjnal1bfkby0i08gdzvj9cscvxs4njxmgdapq";
+  version = "0.9.4.0";
+  sha256 = "08afaj4ln4nl7ymdixijzjx8hc7nnr70gz7avpzaanq5nrw0k054";
   buildDepends = [
     attoparsec attoparsecEnumerator blazeBuilder blazeBuilderEnumerator
-    bytestringMmap caseInsensitive deepseq enumerator filepath HUnit
-    MonadCatchIOTransformers mtl random regexPosix text time unixCompat
-    unorderedContainers vector zlibEnum
+    bytestringMmap caseInsensitive deepseq enumerator filepath hashable
+    HUnit MonadCatchIOTransformers mtl random regexPosix text time
+    unixCompat unorderedContainers vector zlibEnum
   ];
   meta = {
     homepage = "http://snapframework.com/";
diff --git a/pkgs/development/libraries/haskell/template-default/default.nix b/pkgs/development/libraries/haskell/template-default/default.nix
new file mode 100644
index 00000000000..a450b09b551
--- /dev/null
+++ b/pkgs/development/libraries/haskell/template-default/default.nix
@@ -0,0 +1,14 @@
+{ cabal, dataDefault }:
+
+cabal.mkDerivation (self: {
+  pname = "template-default";
+  version = "0.1.1";
+  sha256 = "07b8j11v0247fwaf3mv72m7aaq3crbsyrxmxa352vn9h2g6l1jsd";
+  buildDepends = [ dataDefault ];
+  meta = {
+    homepage = "https://github.com/haskell-pkg-janitors/template-default";
+    description = "declaring Default instances just got even easier";
+    license = self.stdenv.lib.licenses.bsd3;
+    platforms = self.ghc.meta.platforms;
+  };
+})
diff --git a/pkgs/development/libraries/haskell/vector-th-unbox/default.nix b/pkgs/development/libraries/haskell/vector-th-unbox/default.nix
new file mode 100644
index 00000000000..8f5ec4b52bf
--- /dev/null
+++ b/pkgs/development/libraries/haskell/vector-th-unbox/default.nix
@@ -0,0 +1,13 @@
+{ cabal, vector }:
+
+cabal.mkDerivation (self: {
+  pname = "vector-th-unbox";
+  version = "0.2.0.1";
+  sha256 = "1q01yk6cyjxbdnmq31d5mfac09hbql43d7xiw1snc96nmkklfpjv";
+  buildDepends = [ vector ];
+  meta = {
+    description = "Deriver for Data.Vector.Unboxed using Template Haskell";
+    license = self.stdenv.lib.licenses.bsd3;
+    platforms = self.ghc.meta.platforms;
+  };
+})
diff --git a/pkgs/development/libraries/haskell/vector/0.10.nix b/pkgs/development/libraries/haskell/vector/0.10.nix
deleted file mode 100644
index 8fac71eed4b..00000000000
--- a/pkgs/development/libraries/haskell/vector/0.10.nix
+++ /dev/null
@@ -1,15 +0,0 @@
-{ cabal, deepseq, primitive }:
-
-cabal.mkDerivation (self: {
-  pname = "vector";
-  version = "0.10";
-  sha256 = "0lwhsdg7wv6gwjswakf2d1h9w7lp4pznab0mz6xg5q48pgknrcig";
-  buildDepends = [ deepseq primitive ];
-  meta = {
-    homepage = "http://code.haskell.org/vector";
-    description = "Efficient Arrays";
-    license = self.stdenv.lib.licenses.bsd3;
-    platforms = self.ghc.meta.platforms;
-    maintainers = [ self.stdenv.lib.maintainers.andres ];
-  };
-})
diff --git a/pkgs/development/libraries/haskell/vector/0.9.1.nix b/pkgs/development/libraries/haskell/vector/0.9.1.nix
deleted file mode 100644
index 63add64226d..00000000000
--- a/pkgs/development/libraries/haskell/vector/0.9.1.nix
+++ /dev/null
@@ -1,15 +0,0 @@
-{ cabal, primitive }:
-
-cabal.mkDerivation (self: {
-  pname = "vector";
-  version = "0.9.1";
-  sha256 = "1m6p9dy48fwh2y21y7r6svhzs86a1yijkjil7ch1mdn86gv0f9as";
-  buildDepends = [ primitive ];
-  meta = {
-    homepage = "http://code.haskell.org/vector";
-    description = "Efficient Arrays";
-    license = self.stdenv.lib.licenses.bsd3;
-    platforms = self.ghc.meta.platforms;
-    maintainers = [ self.stdenv.lib.maintainers.andres ];
-  };
-})
diff --git a/pkgs/development/libraries/haskell/xtest/default.nix b/pkgs/development/libraries/haskell/xtest/default.nix
new file mode 100644
index 00000000000..d9ce47647ca
--- /dev/null
+++ b/pkgs/development/libraries/haskell/xtest/default.nix
@@ -0,0 +1,14 @@
+{ cabal, libXtst, X11 }:
+
+cabal.mkDerivation (self: {
+  pname = "xtest";
+  version = "0.2";
+  sha256 = "118xxx7sydpsvdqz0x107ngb85fggn630ysw6d2ckky75fmhmxk7";
+  buildDepends = [ X11 ];
+  extraLibraries = [ libXtst ];
+  meta = {
+    description = "Thin FFI bindings to X11 XTest library";
+    license = self.stdenv.lib.licenses.bsd3;
+    platforms = self.ghc.meta.platforms;
+  };
+})
diff --git a/pkgs/development/libraries/haskell/yesod-bin/default.nix b/pkgs/development/libraries/haskell/yesod-bin/default.nix
new file mode 100644
index 00000000000..717ca54d808
--- /dev/null
+++ b/pkgs/development/libraries/haskell/yesod-bin/default.nix
@@ -0,0 +1,31 @@
+{ cabal, attoparsec, base64Bytestring, blazeBuilder, Cabal, conduit
+, fileEmbed, filepath, fsnotify, ghcPaths, httpConduit
+, httpReverseProxy, httpTypes, liftedBase, network, networkConduit
+, optparseApplicative, parsec, projectTemplate, resourcet
+, shakespeare, shakespeareCss, shakespeareJs, shakespeareText
+, split, systemFileio, systemFilepath, tar, text, time
+, transformers, unixCompat, unorderedContainers, wai, warp, yaml
+, zlib
+}:
+
+cabal.mkDerivation (self: {
+  pname = "yesod-bin";
+  version = "1.2.0.1";
+  sha256 = "0dikjxs1wdqv87ng6iqnnc3pwi3hzgqfwnnj3bb1fpz4plv4bnbc";
+  isLibrary = false;
+  isExecutable = true;
+  buildDepends = [
+    attoparsec base64Bytestring blazeBuilder Cabal conduit fileEmbed
+    filepath fsnotify ghcPaths httpConduit httpReverseProxy httpTypes
+    liftedBase network networkConduit optparseApplicative parsec
+    projectTemplate resourcet shakespeare shakespeareCss shakespeareJs
+    shakespeareText split systemFileio systemFilepath tar text time
+    transformers unixCompat unorderedContainers wai warp yaml zlib
+  ];
+  meta = {
+    homepage = "http://www.yesodweb.com/";
+    description = "The yesod helper executable";
+    license = self.stdenv.lib.licenses.mit;
+    platforms = self.ghc.meta.platforms;
+  };
+})
diff --git a/pkgs/development/libraries/haskell/yesod-core/default.nix b/pkgs/development/libraries/haskell/yesod-core/default.nix
index 7518e6ff82a..d2188c68951 100644
--- a/pkgs/development/libraries/haskell/yesod-core/default.nix
+++ b/pkgs/development/libraries/haskell/yesod-core/default.nix
@@ -10,8 +10,8 @@
 
 cabal.mkDerivation (self: {
   pname = "yesod-core";
-  version = "1.2.1";
-  sha256 = "1p9xaw0d9dx68q7i99kjcqy1lhmd164drbcw3489560wa71mwamk";
+  version = "1.2.2";
+  sha256 = "1fapqx1lrhhqjc9k9yc964sxnawj7ga62w83csbkkhwq3g5425yp";
   buildDepends = [
     aeson attoparsecConduit blazeBuilder blazeHtml blazeMarkup
     caseInsensitive cereal clientsession conduit cookie dataDefault
diff --git a/pkgs/development/libraries/haskell/yesod-persistent/default.nix b/pkgs/development/libraries/haskell/yesod-persistent/default.nix
index 1f0b330ff2c..2c6b6f96fbc 100644
--- a/pkgs/development/libraries/haskell/yesod-persistent/default.nix
+++ b/pkgs/development/libraries/haskell/yesod-persistent/default.nix
@@ -5,8 +5,8 @@
 
 cabal.mkDerivation (self: {
   pname = "yesod-persistent";
-  version = "1.2.0";
-  sha256 = "1gzzs62mnx2q15sm3hvlk18qjgk3bi828klgl2ckc0462f7z8d0k";
+  version = "1.2.1";
+  sha256 = "06kzxdbg3xw128zlacsf51qi7qnccw0gjnwscxshljgipiicfhfc";
   buildDepends = [
     blazeBuilder conduit liftedBase persistent persistentTemplate
     poolConduit resourcet transformers yesodCore
diff --git a/pkgs/development/libraries/haskell/yesod-platform/default.nix b/pkgs/development/libraries/haskell/yesod-platform/default.nix
index 09514ea9316..fbec41ce124 100644
--- a/pkgs/development/libraries/haskell/yesod-platform/default.nix
+++ b/pkgs/development/libraries/haskell/yesod-platform/default.nix
@@ -28,8 +28,8 @@
 
 cabal.mkDerivation (self: {
   pname = "yesod-platform";
-  version = "1.2.0.1";
-  sha256 = "0hff8kx5d1z8xmy7fnzzhvy9774r26i4bczkb4cz30v3v5pf2g15";
+  version = "1.2.1";
+  sha256 = "1wa1g37ipigscv8xwb5zyfawjw0fxqmwr2l6wdf507r0kvclk2ap";
   buildDepends = [
     aeson ansiTerminal asn1Data asn1Types attoparsec attoparsecConduit
     authenticate base64Bytestring baseUnicodeSymbols blazeBuilder
diff --git a/pkgs/development/libraries/haskell/yesod-routes/default.nix b/pkgs/development/libraries/haskell/yesod-routes/default.nix
index 44d728ffcfd..4cbb865c906 100644
--- a/pkgs/development/libraries/haskell/yesod-routes/default.nix
+++ b/pkgs/development/libraries/haskell/yesod-routes/default.nix
@@ -2,8 +2,8 @@
 
 cabal.mkDerivation (self: {
   pname = "yesod-routes";
-  version = "1.2.0";
-  sha256 = "1d7z0v6jrl08w7qz3apwdjss3vq151y28l7231cpqiia46damib2";
+  version = "1.2.0.1";
+  sha256 = "0pp7g3ccd0swh1j62am1vg9r2gh65jcci5w2n4r42sqzfnql0i8z";
   buildDepends = [ pathPieces text vector ];
   testDepends = [ hspec HUnit pathPieces text ];
   meta = {
diff --git a/pkgs/development/libraries/haskell/yesod/default.nix b/pkgs/development/libraries/haskell/yesod/default.nix
index 53dc5cab87c..d2d0417da27 100644
--- a/pkgs/development/libraries/haskell/yesod/default.nix
+++ b/pkgs/development/libraries/haskell/yesod/default.nix
@@ -6,8 +6,8 @@
 
 cabal.mkDerivation (self: {
   pname = "yesod";
-  version = "1.2.0.1";
-  sha256 = "1whkw0lmkyja2j6vbfcf5rjmmhmc85r4arjwjrvdmz6jkjyqham3";
+  version = "1.2.1";
+  sha256 = "19gwhav6sr6gd2kh92ga8a09hq9grllmnacdqkgasxwjsfxqa6zg";
   buildDepends = [
     aeson blazeHtml blazeMarkup dataDefault hamlet monadControl
     networkConduit safe shakespeareCss shakespeareJs text transformers
diff --git a/pkgs/development/libraries/iksemel/default.nix b/pkgs/development/libraries/iksemel/default.nix
new file mode 100644
index 00000000000..7e8061ee8bb
--- /dev/null
+++ b/pkgs/development/libraries/iksemel/default.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, pkgconfig, gnutls, zlib }:
+
+stdenv.mkDerivation rec {
+  name = "iksemel-${version}";
+  version = "1.4";
+
+  src = fetchurl {
+    url = "https://iksemel.googlecode.com/files/${name}.tar.gz";
+    sha1 = "722910b99ce794fd3f6f0e5f33fa804732cf46db";
+  };
+
+  preConfigure = ''
+    sed -i -e '/if.*gnutls_check_version/,/return 1;/c return 0;' configure
+    export LIBGNUTLS_CONFIG="${pkgconfig}/bin/pkg-config gnutls"
+  '';
+
+  buildInputs = [ pkgconfig gnutls zlib ];
+
+  meta = {
+    homepage = "https://code.google.com/p/iksemel/";
+    license = stdenv.lib.licenses.lgpl21Plus;
+    description = "Fast and portable XML parser and Jabber protocol library";
+  };
+}
diff --git a/pkgs/development/libraries/imlib/default.nix b/pkgs/development/libraries/imlib/default.nix
index 24e7d2afab5..27aaad7598a 100644
--- a/pkgs/development/libraries/imlib/default.nix
+++ b/pkgs/development/libraries/imlib/default.nix
@@ -3,7 +3,7 @@
 stdenv.mkDerivation {
   name = "imlib-1.9.15";
   src = fetchurl {
-    url = http://nixos.org/tarballs/imlib-1.9.15.tar.gz;
+    url = http://tarballs.nixos.org/imlib-1.9.15.tar.gz;
     md5 = "2a5561457e7f8b2e04d88f73508fd13a";
   };
 
diff --git a/pkgs/development/libraries/java/jakarta-bcel/default.nix b/pkgs/development/libraries/java/jakarta-bcel/default.nix
index 3bea2a0d8f4..1ff88a36247 100644
--- a/pkgs/development/libraries/java/jakarta-bcel/default.nix
+++ b/pkgs/development/libraries/java/jakarta-bcel/default.nix
@@ -5,7 +5,7 @@ stdenv.mkDerivation {
   builder = ./builder.sh;
 
   src = fetchurl {
-    url = http://nixos.org/tarballs/bcel-5.1.tar.gz;
+    url = http://tarballs.nixos.org/bcel-5.1.tar.gz;
     md5 = "318f22e4f5f59b68cd004db83a7d65dc";
   };
 
diff --git a/pkgs/development/libraries/java/jakarta-regexp/default.nix b/pkgs/development/libraries/java/jakarta-regexp/default.nix
index d6c093423d8..55c3beff70a 100644
--- a/pkgs/development/libraries/java/jakarta-regexp/default.nix
+++ b/pkgs/development/libraries/java/jakarta-regexp/default.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation {
   builder = ./java-bin-builder.sh;
 
   src = fetchurl {
-    url = http://nixos.org/tarballs/jakarta-regexp-1.4.tar.gz;
+    url = http://tarballs.nixos.org/jakarta-regexp-1.4.tar.gz;
     md5 = "d903d84c949df848009f3bf205b32c97";
   };
 
diff --git a/pkgs/development/libraries/javascript/jquery-ui/default.nix b/pkgs/development/libraries/javascript/jquery-ui/default.nix
index e2d48f25bb5..24217657b10 100644
--- a/pkgs/development/libraries/javascript/jquery-ui/default.nix
+++ b/pkgs/development/libraries/javascript/jquery-ui/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, unzip }:
 
 stdenv.mkDerivation rec {
-  name = "jquery-ui-1.10.2";
+  name = "jquery-ui-1.10.3";
 
   src = fetchurl {
     url = "http://jqueryui.com/resources/download/${name}.custom.zip";
-    sha256 = "0r1fmqpym7bjqhjay9br4h3izky781bsda7v7552yjwkgiv391hl";
+    sha256 = "1nqh3fmjgy73cbwb5sj775242i6jhz3f5b9fxgrkq00dfvkls779";
   };
 
   buildInputs = [ unzip ];
@@ -17,9 +17,13 @@ stdenv.mkDerivation rec {
 
       # For convenience, provide symlinks "jquery.min.js" etc. (i.e.,
       # without the version number).
-      ln -s $out/js/jquery-ui-*.custom.min.js $out/js/jquery-ui.min.js
-      ln -s $out/js/jquery-1.*.min.js $out/js/jquery.min.js
-      ln -s $out/css/smoothness/jquery-ui-*.custom.css $out/css/smoothness/jquery-ui.css
+      pushd $out/js
+      ln -s jquery-ui-*.custom.js jquery-ui.js
+      ln -s jquery-ui-*.custom.min.js jquery-ui.min.js
+      ln -s jquery-1.*.js jquery.js
+      popd
+      pushd $out/css/smoothness
+      ln -s jquery-ui-*.custom.css jquery-ui.css
     '';
 
   meta = {
diff --git a/pkgs/development/libraries/libcanberra/default.nix b/pkgs/development/libraries/libcanberra/default.nix
index 6d56cd44633..710f6bd8700 100644
--- a/pkgs/development/libraries/libcanberra/default.nix
+++ b/pkgs/development/libraries/libcanberra/default.nix
@@ -1,25 +1,25 @@
 { stdenv, fetchurl, pkgconfig, libtool, gtk ? null
-, alsaLib, pulseaudio, gstreamer ? null, libvorbis, libcap }:
+, alsaLib, pulseaudio, gstreamer, gst_plugins_base, libvorbis }:
 
 stdenv.mkDerivation rec {
-  name = "libcanberra-0.28";
+  name = "libcanberra-0.30";
 
   src = fetchurl {
-    url = "http://0pointer.de/lennart/projects/libcanberra/${name}.tar.gz";
-    sha256 = "1346d2y24wiyanyr5bvdnjjgq7iysy8nlq2dwjv0fzxdmcn8n7zb";
+    url = "http://0pointer.de/lennart/projects/libcanberra/${name}.tar.xz";
+    sha256 = "0wps39h8rx2b00vyvkia5j40fkak3dpipp1kzilqla0cgvk73dn2";
   };
 
-  buildInputs =
-    [ pkgconfig libtool alsaLib pulseaudio gstreamer libvorbis libcap gtk ];
+  buildInputs = # ToDo: gstreamer not found (why?), add (g)udev?
+    [ pkgconfig libtool alsaLib pulseaudio /*gstreamer gst_plugins_base*/ libvorbis gtk ];
 
-  configureFlags = "--disable-oss --disable-schemas-install";
+  configureFlags = "--disable-oss";
 
   passthru = {
     gtkModule = "/lib/gtk-2.0/";
   };
 
   meta = {
-    description = "libcanberra, an implementation of the XDG Sound Theme and Name Specifications";
+    description = "An implementation of the XDG Sound Theme and Name Specifications";
 
     longDescription = ''
       libcanberra is an implementation of the XDG Sound Theme and Name
diff --git a/pkgs/development/libraries/libcroco/default.nix b/pkgs/development/libraries/libcroco/default.nix
deleted file mode 100644
index 99604475e62..00000000000
--- a/pkgs/development/libraries/libcroco/default.nix
+++ /dev/null
@@ -1,11 +0,0 @@
-{stdenv, fetchurl, pkgconfig, libxml2, glib}:
-
-stdenv.mkDerivation {
-  name = "libcroco-0.6.4";
-
-  src = fetchurl {
-    url = mirror://gnome/sources/libcroco/0.6/libcroco-0.6.4.tar.xz;
-    sha256 = "1sij88na1skd4d5dx75l803fww3v9872q8m2hj6sjlkc839vl5n8";
-  };
-  buildInputs = [ pkgconfig libxml2 glib ];
-}
diff --git a/pkgs/development/libraries/libdrm/default.nix b/pkgs/development/libraries/libdrm/default.nix
index a2546bf2d69..e411e599dc5 100644
--- a/pkgs/development/libraries/libdrm/default.nix
+++ b/pkgs/development/libraries/libdrm/default.nix
@@ -1,24 +1,23 @@
 { stdenv, fetchurl, pkgconfig, libpthreadstubs, libpciaccess, udev }:
 
 stdenv.mkDerivation rec {
-  name = "libdrm-2.4.33";
-  
+  name = "libdrm-2.4.42";
+
   src = fetchurl {
     url = "http://dri.freedesktop.org/libdrm/${name}.tar.bz2";
-    sha256 = "1slgi61n4dlsfli47ql354fd1ppj7n40jd94wvnsdqx0mna9syrd";
+    sha256 = "1qbnpi64hyqzd650hj6jki1d50pzypdhj3rw9m3whwbqly110rz0";
   };
 
   nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ libpthreadstubs libpciaccess udev ];
+  buildInputs = [ libpthreadstubs libpciaccess ]
+    ++ stdenv.lib.optional stdenv.isLinux udev;
 
   patches = stdenv.lib.optional stdenv.isDarwin ./libdrm-apple.patch;
 
   preConfigure = stdenv.lib.optionalString stdenv.isDarwin
     "echo : \\\${ac_cv_func_clock_gettime=\'yes\'} > config.cache";
 
-  configureFlags = [ "--enable-nouveau-experimental-api"
-                     "--enable-radeon-experimental-api"
-                     "--enable-udev" ]
+  configureFlags = stdenv.lib.optional stdenv.isLinux "--enable-udev"
     ++ stdenv.lib.optional stdenv.isDarwin "-C";
 
   crossAttrs.configureFlags = configureFlags ++ [ "--disable-intel" ];
diff --git a/pkgs/development/libraries/libgcrypt/default.nix b/pkgs/development/libraries/libgcrypt/default.nix
index 0438816b1b4..cb60355ef55 100644
--- a/pkgs/development/libraries/libgcrypt/default.nix
+++ b/pkgs/development/libraries/libgcrypt/default.nix
@@ -1,11 +1,11 @@
 { fetchurl, stdenv, libgpgerror }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (rec {
   name = "libgcrypt-1.5.2";
 
   src = fetchurl {
     url = "mirror://gnupg/libgcrypt/${name}.tar.bz2";
-    sha1 = "c9998383532ba3e8bcaf690f2f0d65e814b48d2f";
+    sha256 = "0gwnzqd64cpwdmk93nll54nidsr74jpimxzj4p4z7502ylwl66p4";
   };
 
   propagatedBuildInputs = [ libgpgerror ];
@@ -34,4 +34,8 @@ stdenv.mkDerivation rec {
     homepage = http://gnupg.org/;
     platforms = stdenv.lib.platforms.all;
   };
-}
+} # old "as" problem, see #616 and http://gnupg.10057.n7.nabble.com/Fail-to-build-on-freebsd-7-3-td30245.html
+  // stdenv.lib.optionalAttrs (stdenv.isFreeBSD && stdenv.isi686)
+    { configureFlags = [ "--disable-aesni-support" ]; }
+)
+
diff --git a/pkgs/development/libraries/libgnome-keyring/3.x.nix b/pkgs/development/libraries/libgnome-keyring/3.x.nix
deleted file mode 100644
index 54a023a16f8..00000000000
--- a/pkgs/development/libraries/libgnome-keyring/3.x.nix
+++ /dev/null
@@ -1,18 +0,0 @@
-{ stdenv, fetchurl, glib, dbus_libs, libgcrypt, pkgconfig,
-intltool }:
-
-stdenv.mkDerivation {
-  name = "libgnome-keyring-3.2.2";
-
-  src = fetchurl {
-    url = mirror://gnome/sources/libgnome-keyring/3.2/libgnome-keyring-3.2.2.tar.xz;
-    sha256 = "1cxd2vb1lzm8smq1q45dsn13s6kdqdb60lashdk7hwv035xy9jrb";
-  };
-
-  propagatedBuildInputs = [ glib dbus_libs libgcrypt ];
-  nativeBuildInputs = [ pkgconfig intltool ];
-
-  meta = {
-    inherit (glib.meta) platforms maintainers;
-  };
-}
diff --git a/pkgs/development/libraries/libgpg-error/default.nix b/pkgs/development/libraries/libgpg-error/default.nix
index eafa857598c..eb0de7aa2be 100644
--- a/pkgs/development/libraries/libgpg-error/default.nix
+++ b/pkgs/development/libraries/libgpg-error/default.nix
@@ -5,7 +5,7 @@ stdenv.mkDerivation (rec {
 
   src = fetchurl {
     url = "mirror://gnupg/libgpg-error/${name}.tar.bz2";
-    sha1 = "be209b013652add5c7e2c473ea114f58203cc6cd";
+    sha256 = "1h0ql8j65ns2rmhj9wnc9035026crzkg226xg8614fq71947ccxf";
   };
 
   doCheck = true;
diff --git a/pkgs/development/libraries/libgphoto2/default.nix b/pkgs/development/libraries/libgphoto2/default.nix
index 0c0dc5b764f..af985ac91fc 100644
--- a/pkgs/development/libraries/libgphoto2/default.nix
+++ b/pkgs/development/libraries/libgphoto2/default.nix
@@ -1,7 +1,7 @@
 {stdenv, fetchurl, pkgconfig, libusb, libtool, libexif, libjpeg, gettext}:
 
 stdenv.mkDerivation rec {
-  name = "libgphoto2-2.5.2";
+  name = "libgphoto2-${meta.version}";
 
   src = fetchurl {
     url = "mirror://sourceforge/gphoto/${name}.tar.bz2";
@@ -22,6 +22,7 @@ stdenv.mkDerivation rec {
       MTP, and other vendor specific protocols for controlling and transferring data
       from digital cameras. 
     '';
+    version = "2.5.2";
     # XXX: the homepage claims LGPL, but several src files are lgpl21Plus
     license = stdenv.lib.licenses.lgpl21Plus; 
     platforms = with stdenv.lib.platforms; unix;
diff --git a/pkgs/development/libraries/libgphoto2/default.upstream b/pkgs/development/libraries/libgphoto2/default.upstream
new file mode 100644
index 00000000000..0029e695930
--- /dev/null
+++ b/pkgs/development/libraries/libgphoto2/default.upstream
@@ -0,0 +1,9 @@
+url http://sourceforge.net/projects/gphoto/files/libgphoto/
+SF_version_dir
+version_link '[.]tar[.]bz2/download$'
+SF_redirect
+do_overwrite () {
+  ensure_hash
+  set_var_value version "$CURRENT_VERSION"
+  set_var_value sha256 "$CURRENT_HASH"
+}
diff --git a/pkgs/development/libraries/libgsf/default.nix b/pkgs/development/libraries/libgsf/default.nix
index 56f6242c09e..7f44e6b1706 100644
--- a/pkgs/development/libraries/libgsf/default.nix
+++ b/pkgs/development/libraries/libgsf/default.nix
@@ -1,26 +1,21 @@
-{ fetchurl, stdenv, perl, perlXMLParser, pkgconfig, libxml2
-, gettext, intltool, bzip2, glib, python
-, gnomeSupport ? true,  gdk_pixbuf ? null
-, gnome_vfs ? null, libbonobo ? null }:
+{ fetchurl, stdenv, pkgconfig, intltool, gettext, glib, libxml2, zlib, bzip2
+, python, gdk_pixbuf, libiconvOrEmpty
+}:
 
-assert gnomeSupport -> gdk_pixbuf != null && gnome_vfs != null && libbonobo != null
-  && glib != null;
+with { inherit (stdenv.lib) optionals; };
 
 stdenv.mkDerivation rec {
-  name = "libgsf-1.14.25";
+  name = "libgsf-1.14.26";
 
   src = fetchurl {
     url = "mirror://gnome/sources/libgsf/1.14/${name}.tar.xz";
-    sha256 = "127548f07e07951984fb139c3f89d65b9e471aefe6555387de03e1113944d1a2";
+    sha256 = "1md67l60li7rkma9m6mwchqz6b6q4xsfr38c6n056y6xm8jyf6c9";
   };
 
-  nativeBuildInputs = [ intltool pkgconfig ];
-  buildInputs =
-    [ perl perlXMLParser gettext bzip2 python ]
-    ++ stdenv.lib.optionals gnomeSupport [ gnome_vfs gdk_pixbuf ];
+  nativeBuildInputs = [ pkgconfig intltool ];
+  buildInputs = [ gettext bzip2 zlib python ];
 
-  propagatedBuildInputs = [ libxml2 glib ]
-    ++ stdenv.lib.optionals gnomeSupport [ libbonobo ];
+  propagatedBuildInputs = [ libxml2 glib gdk_pixbuf ] ++ libiconvOrEmpty;
 
   doCheck = true;
 
diff --git a/pkgs/development/libraries/libgweather/default.nix b/pkgs/development/libraries/libgweather/default.nix
deleted file mode 100644
index 5e7a4cff741..00000000000
--- a/pkgs/development/libraries/libgweather/default.nix
+++ /dev/null
@@ -1,13 +0,0 @@
-{ stdenv, fetchurl, pkgconfig, libxml2, gtk3, intltool, libsoup, GConf3 }:
-
-stdenv.mkDerivation {
-  name = "libgweather-3.4.1";
-
-  src = fetchurl {
-    url = mirror://gnome/sources/libgweather/3.4/libgweather-3.4.1.tar.xz;
-    sha256 = "0q0vkggrbvy2ihwcsfynlv5qk9l3wjinls8yvmkb1qisyc4lv77f";
-  };
-  configureFlags = if stdenv ? glibc then "--with-zoneinfo-dir=${stdenv.glibc}/share/zoneinfo" else "";
-  propagatedBuildInputs = [ libxml2 gtk3 libsoup GConf3 ];
-  nativeBuildInputs = [ pkgconfig intltool ];
-}
diff --git a/pkgs/development/libraries/libjpeg-turbo/default.nix b/pkgs/development/libraries/libjpeg-turbo/default.nix
index eb86a1d3ff2..a4aa1cf44b4 100644
--- a/pkgs/development/libraries/libjpeg-turbo/default.nix
+++ b/pkgs/development/libraries/libjpeg-turbo/default.nix
@@ -1,15 +1,18 @@
 { stdenv, fetchurl, nasm }:
 
 stdenv.mkDerivation rec {
-  name = "libjpeg-turbo-1.2.1";
+  name = "libjpeg-turbo-1.3.0";
 
   src = fetchurl {
     url = "mirror://sourceforge/libjpeg-turbo/${name}.tar.gz";
-    sha256 = "0w1pj3j7hkx6irkrxlcmz53l94s6im0wml1v36nysb50akq26cyb";
+    sha256 = "0d0jwdmj3h89bxdxlwrys2mw18mqcj4rzgb5l2ndpah8zj600mr6";
   };
 
   buildInputs = [ nasm ];
 
+  doCheck = true;
+  checkTarget = "test";
+
   meta = {
     homepage = http://libjpeg-turbo.virtualgl.org/;
     description = "A faster (using SIMD) libjpeg implementation";
diff --git a/pkgs/development/libraries/libmtp/default.nix b/pkgs/development/libraries/libmtp/default.nix
index ced11c0ef4d..95d060df7f7 100644
--- a/pkgs/development/libraries/libmtp/default.nix
+++ b/pkgs/development/libraries/libmtp/default.nix
@@ -1,13 +1,17 @@
-{ stdenv, fetchurl, libusb }:
+{ stdenv, fetchurl, pkgconfig, libusb1 }:
 
 stdenv.mkDerivation rec {
-  name = "libmtp-1.0.1";
+  name = "libmtp-1.1.5";
 
-  propagatedBuildInputs = [ libusb ];
+  propagatedBuildInputs = [ libusb1 ];
+  buildInputs = [ pkgconfig ];
+
+  # tried to install files to /lib/udev, hopefully OK
+  configureFlags = [ "--with-udev=$$out/lib/udev" ];
 
   src = fetchurl {
     url = "mirror://sourceforge/libmtp/${name}.tar.gz";
-    sha256 = "19iha1yi07cdqzlba4ng1mn7h701binalwwkb71q0ld9b88mad6s";
+    sha256 = "0fn6y7kirgln6sfizmwvjsy7qkdb0p3rccf0zkr3r2xg3cbpjxkq";
   };
 
   meta = {
diff --git a/pkgs/development/libraries/libpaper/default.nix b/pkgs/development/libraries/libpaper/default.nix
new file mode 100644
index 00000000000..9505a6cf052
--- /dev/null
+++ b/pkgs/development/libraries/libpaper/default.nix
@@ -0,0 +1,17 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  version = "1.1.24";
+  name = "libpaper-${version}";
+
+  src = fetchurl {
+    url = "mirror://debian/pool/main/libp/libpaper/libpaper_${version}.tar.gz";
+    sha256 = "0zhcx67afb6b5r936w5jmaydj3ks8zh83n9rm5sv3m3k8q8jib1q";
+  };
+
+  meta = {
+    description = "Library for handling paper characteristics";
+    homepage = "http://packages.debian.org/unstable/source/libpaper";
+    license = "GPLv2";
+  };
+}
diff --git a/pkgs/development/libraries/libpng/15.nix b/pkgs/development/libraries/libpng/15.nix
new file mode 100644
index 00000000000..8f62ef1e8dc
--- /dev/null
+++ b/pkgs/development/libraries/libpng/15.nix
@@ -0,0 +1,24 @@
+{ stdenv, fetchurl, zlib }:
+
+assert zlib != null;
+
+stdenv.mkDerivation rec {
+  name = "libpng-1.5.15";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/libpng/${name}.tar.xz";
+    sha256 = "1iaplghmv5qhd4dgwfymhp42sh27vz6s2107jk698xm57z2v9hwm";
+  };
+
+  propagatedBuildInputs = [ zlib ];
+
+  doCheck = true;
+
+  passthru = { inherit zlib; };
+
+  meta = {
+    description = "The official reference implementation for the PNG file format";
+    homepage = http://www.libpng.org/pub/png/libpng.html;
+    license = "free-non-copyleft"; # http://www.libpng.org/pub/png/src/libpng-LICENSE.txt
+  };
+}
diff --git a/pkgs/development/libraries/libpng/default.nix b/pkgs/development/libraries/libpng/default.nix
index ce23cf48587..0a150610781 100644
--- a/pkgs/development/libraries/libpng/default.nix
+++ b/pkgs/development/libraries/libpng/default.nix
@@ -3,20 +3,23 @@
 assert zlib != null;
 
 stdenv.mkDerivation rec {
-  name = "libpng-1.5.13";
+  name = "libpng-1.6.2";
 
   src = fetchurl {
     url = "mirror://sourceforge/libpng/${name}.tar.xz";
-    sha256 = "1vks4mqv4140b10kp53qrywsx9m4xan5ibwsrlmf42ni075zjhxq";
+    sha256 = "1pljkqjqgyz8c32w8fipd9f0v2gcyhah2ypp0h7ya1r1q85sk5qw";
   };
 
   propagatedBuildInputs = [ zlib ];
 
+  doCheck = true;
+
   passthru = { inherit zlib; };
 
   meta = {
     description = "The official reference implementation for the PNG file format";
     homepage = http://www.libpng.org/pub/png/libpng.html;
     license = "free-non-copyleft"; # http://www.libpng.org/pub/png/src/libpng-LICENSE.txt
+    platforms = stdenv.lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/libpng/libpng-apng.nix b/pkgs/development/libraries/libpng/libpng-apng.nix
index 534b0ae5a45..bc6a773dba3 100644
--- a/pkgs/development/libraries/libpng/libpng-apng.nix
+++ b/pkgs/development/libraries/libpng/libpng-apng.nix
@@ -1,29 +1,27 @@
 { stdenv, fetchurl, zlib }:
 
-assert zlib != null;
-
 stdenv.mkDerivation rec {
-  version = "1.4.4";
+  version = "1.5.14";
   name = "libpng-apng-${version}";
-  
+
   patch_src = fetchurl {
-    url = "mirror://sourceforge/project/libpng-apng/libpng-master/${version}/libpng-${version}-apng.patch.gz";
-    sha256 = "d729a2feacfd80547e06c30343d598302f4417cf2e6f649e4ee617690987bd24";
+    url = "mirror://sourceforge/libpng-apng/libpng15/${version}/libpng-${version}-apng.patch.gz";
+    sha256 = "1vcqbkdssy4srm8jqyzaipdc70xzanilqssypmwqyngp8ph0m45p";
   };
 
   src = fetchurl {
-    url = "mirror://sourceforge/libpng/libpng-${version}.tar.gz";
-    sha256 = "d07616ba1e9c161017384feb3b576d70c160b970abfd9549ad39a622284b574a";
+    url = "mirror://sourceforge/libpng/libpng-${version}.tar.xz";
+    sha256 = "0m3vz3gig7s63zanq5b1dgb5ph12qm0cylw4g4fbxlsq3f74hn8l";
   };
 
   preConfigure = ''
     gunzip < ${patch_src} | patch -Np1
   '';
-  
+
   propagatedBuildInputs = [ zlib ];
 
   passthru = { inherit zlib; };
-  
+
   meta = {
     description = "The official reference implementation for the PNG file format with animation patch";
     homepage = http://www.libpng.org/pub/png/libpng.html;
diff --git a/pkgs/development/libraries/librsvg/default.nix b/pkgs/development/libraries/librsvg/default.nix
index 0da30203876..13385dfb65c 100644
--- a/pkgs/development/libraries/librsvg/default.nix
+++ b/pkgs/development/libraries/librsvg/default.nix
@@ -1,16 +1,24 @@
-{stdenv, fetchurl, pkgconfig, libxml2, libgsf, bzip2, glib, gtk, libcroco}:
+{ stdenv, fetchurl, pkgconfig, glib, gdk_pixbuf, pango, cairo
+, libxml2, libgsf, bzip2, libcroco
+, gtk2 ? null, gtk3 ? null
+, gobjectIntrospection ? null, enableIntrospection ? false }:
 
-stdenv.mkDerivation {
-  name = "librsvg-2.34.2";
+# no introspection by default, it's too big
+
+stdenv.mkDerivation rec {
+  name = "librsvg-2.36.4";
 
   src = fetchurl {
-    url = mirror://gnome/sources/librsvg/2.34/librsvg-2.34.2.tar.xz;
-    sha256 = "0r24xr10chmz4l3ka2zy9c2245s7svzljbw9nrda3h44bcr03rsx";
+    url = "mirror://gnome/sources/librsvg/2.36/${name}.tar.xz";
+    sha256 = "1hp6325gdkzx8yqn2d2r915ak3k6hfshjjh0sc54z3vr0i99688h";
   };
-  buildInputs = [ libxml2 libgsf bzip2 libcroco ];
-  propagatedBuildInputs = [ glib gtk ];
+  buildInputs = [ libxml2 libgsf bzip2 libcroco pango cairo ]
+    ++ stdenv.lib.optional enableIntrospection [ gobjectIntrospection ];
+  propagatedBuildInputs = [ glib gdk_pixbuf gtk2 gtk3 ];
   nativeBuildInputs = [ pkgconfig ];
 
+  configureFlags = ["--enable-introspection=auto"];
+
   # It wants to add loaders and update the loaders.cache in gdk-pixbuf
   # Patching the Makefiles to it creates rsvg specific loaders and the
   # relevant loader.cache here.
diff --git a/pkgs/development/libraries/libsecret/default.nix b/pkgs/development/libraries/libsecret/default.nix
new file mode 100644
index 00000000000..70c20caa88a
--- /dev/null
+++ b/pkgs/development/libraries/libsecret/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, glib, dbus_libs, unzip, automake, libtool, autoconf, m4, docbook_xsl,
+  intltool, gtk_doc, gobjectIntrospection, pkgconfig, libxslt, libgcrypt }:
+
+stdenv.mkDerivation rec {
+  version = "0.15";
+  name = "libsecret-${version}";
+
+  src = fetchurl {
+    url = "https://git.gnome.org/browse/libsecret/snapshot/libsecret-${version}.zip";
+    sha256 = "088v1z7zbdi8b0779jads7q20x1gx6c4zmrj3q0vysc7a0k16i6k";
+  };
+
+  propagatedBuildInputs = [ glib dbus_libs ];
+  nativeBuildInputs = [ unzip ];
+  buildInputs = [ gtk_doc automake libtool autoconf intltool gobjectIntrospection pkgconfig libxslt libgcrypt m4 docbook_xsl ];
+
+  configureScript = "./autogen.sh";
+
+  meta = {
+    inherit (glib.meta) platforms maintainers;
+  };
+}
diff --git a/pkgs/development/libraries/libtiff/default.nix b/pkgs/development/libraries/libtiff/default.nix
index 44b28645927..5101429a403 100644
--- a/pkgs/development/libraries/libtiff/default.nix
+++ b/pkgs/development/libraries/libtiff/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, zlib, libjpeg }:
 
-let version = "3.9.7"; in
+let version = "4.0.3"; in
 
 stdenv.mkDerivation rec {
   name = "libtiff-${version}";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
       [ "ftp://ftp.remotesensing.org/pub/libtiff/tiff-${version}.tar.gz"
         "http://download.osgeo.org/libtiff/tiff-${version}.tar.gz"
       ];
-    sha256 = "0spg1hr5rsrmg88sfzb05qnf0haspq7r5hvdkxg5zib1rva4vmpm";
+    sha256 = "0wj8d1iwk9vnpax2h29xqc2hwknxg3s0ay2d5pxkg59ihbifn6pa";
   };
 
   outputs = [ "dev" "out" "bin" "doc" ];
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
 
   meta = {
     description = "Library and utilities for working with the TIFF image file format";
-    homepage = http://www.libtiff.org/;
+    homepage = http://www.remotesensing.org/libtiff/;
     license = "bsd";
   };
 }
diff --git a/pkgs/development/libraries/libusb1/default.nix b/pkgs/development/libraries/libusb1/default.nix
index 8a1580d4fbe..811909c659d 100644
--- a/pkgs/development/libraries/libusb1/default.nix
+++ b/pkgs/development/libraries/libusb1/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, pkgconfig }:
 
 stdenv.mkDerivation rec {
   name = "libusb-1.0.9";
@@ -8,6 +8,8 @@ stdenv.mkDerivation rec {
     sha256 = "16sz34ix6hw2wwl3kqx6rf26fg210iryr68wc439dc065pffw879";
   };
 
+  buildInputs = [ pkgconfig ];
+
   meta = {
     homepage = http://www.libusb.org;
     description = "User-space USB library";
diff --git a/pkgs/development/libraries/libva/default.nix b/pkgs/development/libraries/libva/default.nix
index 5caea5ba610..5b35d2b24ad 100644
--- a/pkgs/development/libraries/libva/default.nix
+++ b/pkgs/development/libraries/libva/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, libX11, pkgconfig, libXext, mesa, libdrm, libXfixes }:
 
 stdenv.mkDerivation rec {
-  name = "libva-1.1.0";
+  name = "libva-1.1.1";
   
   src = fetchurl {
     url = "http://www.freedesktop.org/software/vaapi/releases/libva/${name}.tar.bz2";
-    sha256 = "1a7g7i96ww8hmim2pq2a3xc89073lzacxn1xh9526bzhlqjdqsnv";
+    sha256 = "0kfdcrzcr82g15l0vvmm6rqr0f0604d4dgrza78gn6bfx7rppby0";
   };
 
   buildInputs = [ libX11 libXext pkgconfig mesa libdrm libXfixes ];
diff --git a/pkgs/development/libraries/libvdpau/default.nix b/pkgs/development/libraries/libvdpau/default.nix
index 92ab8d67c91..15810624705 100644
--- a/pkgs/development/libraries/libvdpau/default.nix
+++ b/pkgs/development/libraries/libvdpau/default.nix
@@ -1,16 +1,16 @@
-{ stdenv, fetchurl, pkgconfig, libX11 }:
+{ stdenv, fetchurl, pkgconfig, xlibs }:
 
 stdenv.mkDerivation rec {
-  name = "libvdpau-0.5";
-  
+  name = "libvdpau-0.6";
+
   src = fetchurl {
     url = "http://people.freedesktop.org/~aplattner/vdpau/${name}.tar.gz";
-    sha256 = "0k2ydz4yp7zynlkpd1llfwax30xndwbca36z83ah1i4ldjw2gfhx";
+    sha256 = "0x9dwxzw0ilsy88kqlih3170z1zfrrsx1dr9jbwbn0cbkpnbwmcv";
   };
 
-  buildInputs = [ pkgconfig libX11 ];
+  buildInputs = with xlibs; [ pkgconfig dri2proto libXext ];
 
-  propagatedBuildInputs = [ libX11 ];
+  propagatedBuildInputs = [ xlibs.libX11 ];
 
   meta = {
     homepage = http://people.freedesktop.org/~aplattner/vdpau/;
diff --git a/pkgs/development/libraries/libvpx/default.nix b/pkgs/development/libraries/libvpx/default.nix
index 1c225aa7853..494a5c36a3c 100644
--- a/pkgs/development/libraries/libvpx/default.nix
+++ b/pkgs/development/libraries/libvpx/default.nix
@@ -1,11 +1,13 @@
 {stdenv, fetchurl, bash, yasm, which, perl}:
 
+let version = "1.2.0";
+in
 stdenv.mkDerivation rec {
-  name = "libvpx-1.1.0";
-  
-  src = fetchurl {
-    url = http://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2;
-    sha256 = "1ibjxcdsazqfbbjhb8w56vy3n9qwny2m9q4kzx4rmk9v9g7p9q4w";
+  name = "libvpx-" + version;
+
+  src = fetchurl { # sadly, there's no official tarball for this release
+    url = "ftp://ftp.archlinux.org/other/libvpx/libvpx-${version}.tar.xz";
+    sha256 = "02k9ylswgr2hvjqmg422fa9ggym0g94gzwb14nnckly698rvjc50";
   };
 
   patchPhase = ''
@@ -14,15 +16,17 @@ stdenv.mkDerivation rec {
     sed -e '/enable linux/d' -i configure
   '';
 
-  configureScript = "../configure";
+  buildInputs = [ yasm which perl ];
 
   preConfigure = ''
     mkdir -p build
     cd build
   '';
 
+  configureScript = "../configure";
   configureFlags = [
     "--disable-install-srcs"
+    "--disable-install-docs"
     "--disable-examples"
     "--enable-vp8"
     "--enable-runtime-cpu-detect"
@@ -34,8 +38,6 @@ stdenv.mkDerivation rec {
     make quiet=false DIST_DIR=$out install
   '';
 
-  buildInputs = [ yasm which perl ];
-
   meta = {
     description = "VP8 video encoder";
     homepage = http://code.google.com/p/webm;
diff --git a/pkgs/development/libraries/libxkbcommon/default.nix b/pkgs/development/libraries/libxkbcommon/default.nix
new file mode 100644
index 00000000000..4a1327778d4
--- /dev/null
+++ b/pkgs/development/libraries/libxkbcommon/default.nix
@@ -0,0 +1,21 @@
+{ stdenv, fetchurl, yacc, flex, xkeyboard_config }:
+
+stdenv.mkDerivation rec {
+  name = "libxkbcommon-0.2.0";
+
+  src = fetchurl {
+    url = "http://xkbcommon.org/download/${name}.tar.bz2";
+    sha256 = "0hpvfa8p4bhvhc1gcb578m354p5idd192xb8zlaq16d33h90msvl";
+  };
+
+  buildInputs = [ yacc flex xkeyboard_config ];
+
+  configureFlags = ''
+    --with-xkb-config-root=${xkeyboard_config}/etc/X11/xkb
+  '';
+
+  meta = {
+    description = "A library to handle keyboard descriptions";
+    homepage = http://xkbcommon.org;
+  };
+}
diff --git a/pkgs/development/libraries/libxtc_dxtn/default.nix b/pkgs/development/libraries/libxtc_dxtn/default.nix
index 0e7442633d7..a23d74a2be8 100644
--- a/pkgs/development/libraries/libxtc_dxtn/default.nix
+++ b/pkgs/development/libraries/libxtc_dxtn/default.nix
@@ -8,8 +8,5 @@ stdenv.mkDerivation rec {
     sha256 = "0q5fjaknl7s0z206dd8nzk9bdh8g4p23bz7784zrllnarl90saa5";
   };
 
-  postUnpack = ''
-    tar xf ${mesa.src} --wildcards '*/include/'
-    export NIX_CFLAGS_COMPILE="-I $NIX_BUILD_TOP/[mM]esa*/include"
-  '';
+  NIX_CFLAGS_COMPILE = "-I ${mesa}/include";
 }
diff --git a/pkgs/development/libraries/mesa-glu/default.nix b/pkgs/development/libraries/mesa-glu/default.nix
new file mode 100644
index 00000000000..502329226ff
--- /dev/null
+++ b/pkgs/development/libraries/mesa-glu/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, pkgconfig, mesa_noglu }:
+
+stdenv.mkDerivation rec {
+  name = "glu-9.0.0";
+
+  src = fetchurl {
+    url = "ftp://ftp.freedesktop.org/pub/mesa/glu/${name}.tar.bz2";
+    sha256 = "04nzlil3a6fifcmb95iix3yl8mbxdl66b99s62yzq8m7g79x0yhz";
+  };
+
+  buildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ mesa_noglu ];
+
+  meta = {
+    description = "OpenGL utility library";
+    homepage = http://cgit.freedesktop.org/mesa/glu/;
+    license = "bsd"; # SGI-B-2.0, which seems BSD-like
+  };
+}
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index d3f7afbd308..de130d465c2 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -1,41 +1,143 @@
-{ stdenv, fetchurl, flex, bison, pkgconfig, libdrm, file, expat, makedepend
-, libXxf86vm, libXfixes, libXdamage, glproto, dri2proto, libX11, libxcb, libXext
-, libXt, udev, enableTextureFloats ? false
-, python, libxml2Python }:
+{ stdenv, fetchurl, pkgconfig, intltool, flex, bison, autoconf, automake, libtool
+, python, libxml2Python, file, expat, makedepend
+, libdrm, xorg, wayland, udev, llvm, libffi
+, libvdpau
+, enableTextureFloats ? false # Texture floats are patented, see docs/patents.txt
+, enableR600LlvmCompiler ? false # we would need currently unreleased LLVM or patches
+, enableExtraFeatures ? false # add ~15 MB to mesa_drivers
+}:
 
 if ! stdenv.lib.lists.elem stdenv.system stdenv.lib.platforms.mesaPlatforms then
   throw "unsupported platform for Mesa"
 else
 
-let version = "8.0.4"; in
+/** Packaging design:
+  - The basic mesa ($out) contains headers and libraries (GLU is in mesa_glu now).
+    This or the mesa attribute (which also contains GLU) are small (~ 2.2 MB, mostly headers)
+    and are designed to be the buildInput of other packages.
+  - DRI and EGL drivers are compiled into $drivers output,
+    which is bigger (~13 MB) and depends on LLVM (~40 MB).
+    These should be searched at runtime in /run/current-system/sw/lib/*
+    and so are kind-of impure (given by NixOS).
+    (I suppose on non-NixOS one would create the appropriate symlinks from there.)
+*/
 
+let
+  version = "9.1.3";
+  driverLink = "/run/opengl-driver" + stdenv.lib.optionalString stdenv.isi686 "-32";
+in
 stdenv.mkDerivation {
-  name = "mesa-${version}";
+  name = "mesa-noglu-${version}";
 
   src = fetchurl {
     url = "ftp://ftp.freedesktop.org/pub/mesa/${version}/MesaLib-${version}.tar.bz2";
-    md5 = "d546f988adfdf986cff45b1efa2d8a46";
+    sha256="0rnpaambxv5cd6kbfyvv4b8x2rw1xj13a67xbkzmndfh08iaqpcd";
   };
 
-  patches =
-    stdenv.lib.optional (stdenv.system == "mips64el-linux") ./mips_wmb.patch;
-
   prePatch = "patchShebangs .";
 
-  configureFlags =
-      " --enable-gles1 --enable-gles2 --enable-gallium-egl"
-    + " --with-gallium-drivers=i915,nouveau,r600,svga,swrast"
-    # Texture floats are patented, see docs/patents.txt
-    + stdenv.lib.optionalString enableTextureFloats " --enable-texture-float";
+  patches = [
+    ./static-gallium.patch
+    ./dricore-gallium.patch
+    ./fix-rounding.patch
+  ];
+
+  # Change the search path for EGL drivers from $drivers/* to driverLink
+  postPatch = ''
+    sed '/D_EGL_DRIVER_SEARCH_DIR=/s,EGL_DRIVER_INSTALL_DIR,${driverLink}/lib/egl,' \
+      -i src/egl/main/Makefile.am
+  '';
+
+  outputs = ["out" "drivers"];
+
+  preConfigure = "./autogen.sh";
+
+  configureFlags = with stdenv.lib; [
+    "--with-dri-driverdir=$(drivers)/lib/dri"
+    "--with-egl-driver-dir=$(drivers)/lib/egl"
+    "--with-dri-searchpath=${driverLink}/lib/dri"
+
+    "--enable-dri"
+    "--enable-glx-tls"
+    "--enable-shared-glapi" "--enable-shared-gallium"
+    "--enable-driglx-direct" # seems enabled anyway
+    "--enable-gallium-llvm" "--with-llvm-shared-libs"
+    "--enable-xa" # used in vmware driver
 
-  buildInputs = [ expat libdrm libXxf86vm libXfixes libXdamage glproto dri2proto
-    libxml2Python libX11 libXext libxcb libXt udev ];
+    "--with-dri-drivers=i965,r200,radeon"
+    "--with-gallium-drivers=i915,nouveau,r300,r600,svga,swrast" # radeonsi complains about R600 missing in LLVM
+    "--with-egl-platforms=x11,wayland,drm" "--enable-gbm" "--enable-shared-glapi"
+  ]
+    ++ optional enableR600LlvmCompiler "--enable-r600-llvm-compiler" # complains about R600 missing in LLVM
+    ++ optional enableTextureFloats "--enable-texture-float"
+    ++ optionals enableExtraFeatures [
+      "--enable-gles1" "--enable-gles2"
+      "--enable-osmesa"
+      "--enable-openvg" "--enable-gallium-egl" # not needed for EGL in Gallium, but OpenVG might be useful
+      #"--enable-xvmc" # tests segfault with 9.1.{1,2,3}
+      "--enable-vdpau"
+      #"--enable-opencl" # ToDo: opencl seems to need libclc for clover
+    ];
 
   nativeBuildInputs = [ pkgconfig python makedepend file flex bison ];
 
+  propagatedBuildInputs = with xorg; [ libXdamage libXxf86vm ]
+  ++
+  stdenv.lib.optionals stdenv.isLinux [libdrm]
+  ;
+  buildInputs = with xorg; [
+    autoconf automake libtool intltool expat libxml2Python llvm
+    libXfixes glproto dri2proto libX11 libXext libxcb libXt
+    libffi wayland
+  ] ++ stdenv.lib.optionals enableExtraFeatures [ /*libXvMC*/ libvdpau ]
+  ++ stdenv.lib.optional stdenv.isLinux [udev]
+  ;
+
   enableParallelBuilding = true;
+  doCheck = true;
+
+  # move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
+  # ToDo: probably not all .la files are completely fixed, but it shouldn't matter
+  postInstall = with stdenv.lib; ''
+    mv -t "$drivers/lib/" \
+  '' + optionalString enableExtraFeatures ''
+      `#$out/lib/libXvMC*` \
+      $out/lib/vdpau \
+      $out/lib/libOSMesa* \
+      $out/lib/gbm $out/lib/libgbm* \
+      $out/lib/gallium-pipe \
+  '' + ''
+      $out/lib/libdricore* \
+      $out/lib/libgallium* \
+      $out/lib/libxatracker*
+
+  '' + /* now fix references in .la files */ ''
+    sed "/^libdir=/s,$out,$drivers," -i \
+  '' + optionalString enableExtraFeatures ''
+      `#$drivers/lib/libXvMC*.la` \
+      $drivers/lib/vdpau/*.la \
+      $drivers/lib/libOSMesa*.la \
+      $drivers/lib/gallium-pipe/*.la \
+  '' + ''
+      $drivers/lib/libgallium.la \
+      $drivers/lib/libdricore*.la
+
+    sed "s,$out\(/lib/\(libdricore[0-9\.]*\|libgallium\).la\),$drivers\1,g" \
+      -i $drivers/lib/*.la $drivers/lib/*/*.la
+
+  '' + /* work around bug #529, but maybe $drivers should also be patchelf-ed */ ''
+    find $drivers/ -type f -executable -print0 | xargs -0 strip -S || true
+
+  '' + /* add RPATH so the drivers can find the moved libgallium and libdricore9 */ ''
+    for lib in $drivers/lib/*.so* $drivers/lib/*/*.so*; do
+      if [[ ! -L "$lib" ]]; then
+        patchelf --set-rpath "$(patchelf --print-rpath $lib):$drivers/lib" "$lib"
+      fi
+    done
+  '';
+  #ToDo: @vcunat isn't sure if drirc will be found when in $out/etc/, but it doesn't seem important ATM
 
-  passthru = { inherit libdrm; };
+  passthru = { inherit libdrm; inherit version; };
 
   meta = {
     description = "An open source implementation of OpenGL";
diff --git a/pkgs/development/libraries/mesa/dricore-gallium.patch b/pkgs/development/libraries/mesa/dricore-gallium.patch
new file mode 100644
index 00000000000..9a8b6768277
--- /dev/null
+++ b/pkgs/development/libraries/mesa/dricore-gallium.patch
@@ -0,0 +1,216 @@
+commit 5208f187c7dade2c33385a56c1a5f1c3cedc8377 (HEAD, nix-patches)
+Author: Vladimír Čunát <vcunat@gmail.com>
+Date:   Mon May 13 11:34:59 2013 +0200
+
+    118-dricore-gallium.patch
+
+diff --git a/configure.ac b/configure.ac
+index be89843..08f6761 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -928,6 +928,8 @@ AC_SUBST([GLESv2_LIB_DEPS])
+ AC_SUBST([GLESv2_PC_LIB_PRIV])
+ 
+ DRI_LIB_DEPS="\$(top_builddir)/src/mesa/libdricore/libdricore${VERSION}.la"
++MESAGALLIUM_LIBS="${DRI_LIB_DEPS}"
++AC_SUBST([MESAGALLIUM_LIBS], ${MESAGALLIUM_LIBS})
+ 
+ AC_SUBST([HAVE_XF86VIDMODE])
+ 
+diff --git a/src/gallium/auxiliary/Makefile.am b/src/gallium/auxiliary/Makefile.am
+index 3cdec83..53ff69b 100644
+--- a/src/gallium/auxiliary/Makefile.am
++++ b/src/gallium/auxiliary/Makefile.am
+@@ -34,14 +34,14 @@ if LLVM_NEEDS_FNORTTI
+ 
+ AM_CXXFLAGS += -fno-rtti
+ 
+-libgallium_la_LIBADD = $(LLVM_LIBS)
+-
+ endif
+ 
+ libgallium_la_SOURCES += \
+ 	$(GALLIVM_SOURCES) \
+ 	$(GALLIVM_CPP_SOURCES)
+ 
++libgallium_la_LIBADD = ../../mesa/libdricore/libmesagallium.la $(LLVM_LIBS) $(GALLIUM_DRI_LIB_DEPS)
++
+ endif
+ 
+ indices/u_indices_gen.c: $(srcdir)/indices/u_indices_gen.py
+diff --git a/src/gallium/targets/dri-i915/Makefile.am b/src/gallium/targets/dri-i915/Makefile.am
+index f4f9030..e9b9462 100644
+--- a/src/gallium/targets/dri-i915/Makefile.am
++++ b/src/gallium/targets/dri-i915/Makefile.am
+@@ -49,7 +49,7 @@ i915_dri_la_SOURCES = \
+ i915_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
+ 
+ i915_dri_la_LIBADD = \
+-	$(top_builddir)/src/mesa/libmesagallium.la \
++	@MESAGALLIUM_LIBS@ \
+ 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+ 	$(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \
+ 	$(top_builddir)/src/gallium/winsys/i915/drm/libi915drm.la \
+diff --git a/src/gallium/targets/dri-nouveau/Makefile.am b/src/gallium/targets/dri-nouveau/Makefile.am
+index 69ccf32..fef4c63 100644
+--- a/src/gallium/targets/dri-nouveau/Makefile.am
++++ b/src/gallium/targets/dri-nouveau/Makefile.am
+@@ -48,7 +48,7 @@ nouveau_dri_la_SOURCES = \
+ nouveau_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
+ 
+ nouveau_dri_la_LIBADD = \
+-	$(top_builddir)/src/mesa/libmesagallium.la \
++	@MESAGALLIUM_LIBS@ \
+ 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+ 	$(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \
+ 	$(top_builddir)/src/gallium/winsys/nouveau/drm/libnouveaudrm.la \
+diff --git a/src/gallium/targets/dri-r300/Makefile.am b/src/gallium/targets/dri-r300/Makefile.am
+index 8c0215d..6beb536 100644
+--- a/src/gallium/targets/dri-r300/Makefile.am
++++ b/src/gallium/targets/dri-r300/Makefile.am
+@@ -49,7 +49,7 @@ r300_dri_la_SOURCES = \
+ r300_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
+ 
+ r300_dri_la_LIBADD = \
+-	$(top_builddir)/src/mesa/libmesagallium.la \
++	@MESAGALLIUM_LIBS@ \
+ 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+ 	$(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \
+ 	$(top_builddir)/src/gallium/winsys/radeon/drm/libradeonwinsys.la \
+diff --git a/src/gallium/targets/dri-r600/Makefile.am b/src/gallium/targets/dri-r600/Makefile.am
+index 2b3524b..d40fb89 100644
+--- a/src/gallium/targets/dri-r600/Makefile.am
++++ b/src/gallium/targets/dri-r600/Makefile.am
+@@ -48,7 +48,7 @@ r600_dri_la_SOURCES = \
+ r600_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
+ 
+ r600_dri_la_LIBADD = \
+-	$(top_builddir)/src/mesa/libmesagallium.la \
++	@MESAGALLIUM_LIBS@ \
+ 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+ 	$(top_builddir)/src/gallium/drivers/r600/libr600.la \
+ 	$(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \
+diff --git a/src/gallium/targets/dri-radeonsi/Makefile.am b/src/gallium/targets/dri-radeonsi/Makefile.am
+index f7d87a6..87ab2aa 100644
+--- a/src/gallium/targets/dri-radeonsi/Makefile.am
++++ b/src/gallium/targets/dri-radeonsi/Makefile.am
+@@ -49,7 +49,7 @@ radeonsi_dri_la_SOURCES = \
+ radeonsi_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
+ 
+ radeonsi_dri_la_LIBADD = \
+-	$(top_builddir)/src/mesa/libmesagallium.la \
++	@MESAGALLIUM_LIBS@ \
+ 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+ 	$(top_builddir)/src/gallium/drivers/radeonsi/libradeonsi.la \
+ 	$(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \
+diff --git a/src/gallium/targets/dri-swrast/Makefile.am b/src/gallium/targets/dri-swrast/Makefile.am
+index 1104379..72d2401 100644
+--- a/src/gallium/targets/dri-swrast/Makefile.am
++++ b/src/gallium/targets/dri-swrast/Makefile.am
+@@ -49,7 +49,7 @@ swrast_dri_la_SOURCES = \
+ swrast_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
+ 
+ swrast_dri_la_LIBADD = \
+-	$(top_builddir)/src/mesa/libmesagallium.la \
++	@MESAGALLIUM_LIBS@ \
+ 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+ 	$(top_builddir)/src/gallium/state_trackers/dri/sw/libdrisw.la \
+ 	$(top_builddir)/src/gallium/winsys/sw/dri/libswdri.la \
+diff --git a/src/gallium/targets/dri-vmwgfx/Makefile.am b/src/gallium/targets/dri-vmwgfx/Makefile.am
+index ca7df65..4384976 100644
+--- a/src/gallium/targets/dri-vmwgfx/Makefile.am
++++ b/src/gallium/targets/dri-vmwgfx/Makefile.am
+@@ -48,7 +48,7 @@ vmwgfx_dri_la_SOURCES = \
+ vmwgfx_dri_la_LDFLAGS = -module -avoid-version -shared -no-undefined
+ 
+ vmwgfx_dri_la_LIBADD = \
+-	$(top_builddir)/src/mesa/libmesagallium.la \
++	@MESAGALLIUM_LIBS@ \
+ 	$(top_builddir)/src/gallium/auxiliary/libgallium.la \
+ 	$(top_builddir)/src/gallium/state_trackers/dri/drm/libdridrm.la \
+ 	$(top_builddir)/src/gallium/winsys/svga/drm/libsvgadrm.la \
+diff --git a/src/gallium/targets/egl-static/Makefile.am b/src/gallium/targets/egl-static/Makefile.am
+index 5c40ae8..6922ab2 100644
+--- a/src/gallium/targets/egl-static/Makefile.am
++++ b/src/gallium/targets/egl-static/Makefile.am
+@@ -104,7 +104,7 @@ AM_CPPFLAGS += \
+ 	$(API_DEFINES)
+ 
+ egl_gallium_la_LIBADD += \
+-	$(top_builddir)/src/mesa/libmesagallium.la
++	@MESAGALLIUM_LIBS@
+ # make st/mesa built-in when there is a single glapi provider
+ if HAVE_SHARED_GLAPI
+ egl_gallium_la_LIBADD += \
+diff --git a/src/mesa/Makefile.am b/src/mesa/Makefile.am
+index 41483dd..0045a673 100644
+--- a/src/mesa/Makefile.am
++++ b/src/mesa/Makefile.am
+@@ -75,9 +75,6 @@ noinst_LTLIBRARIES += libmesa.la
+ else
+ check_LTLIBRARIES = libmesa.la
+ endif
+-if HAVE_GALLIUM
+-noinst_LTLIBRARIES += libmesagallium.la
+-endif
+ 
+ SRCDIR = $(top_srcdir)/src/mesa/
+ BUILDDIR = $(top_builddir)/src/mesa/
+@@ -119,15 +116,6 @@ libmesa_la_LIBADD = \
+         $()
+ libmesa_la_LDFLAGS =
+ 
+-libmesagallium_la_SOURCES = \
+-	$(MESA_GALLIUM_FILES) \
+-        $(MESA_ASM_FILES_FOR_ARCH)
+-
+-libmesagallium_la_LIBADD = \
+-        $(top_builddir)/src/glsl/libglsl.la \
+-        $(top_builddir)/src/mesa/program/libprogram.la \
+-        $()
+-
+ pkgconfigdir = $(libdir)/pkgconfig
+ pkgconfig_DATA = gl.pc
+ 
+diff --git a/src/mesa/libdricore/Makefile.am b/src/mesa/libdricore/Makefile.am
+index 753548e..8761418 100644
+--- a/src/mesa/libdricore/Makefile.am
++++ b/src/mesa/libdricore/Makefile.am
+@@ -42,6 +42,7 @@ libdricore@VERSION@_la_SOURCES = \
+ libdricore@VERSION@_la_LDFLAGS = -version-number 1:0
+ libdricore@VERSION@_la_LIBADD = \
+         ../program/libdricore_program.la \
++        $(top_builddir)/src/mapi/shared-glapi/libglapi.la
+         $()
+ 
+ if HAVE_X86_ASM
+@@ -65,8 +66,10 @@ AM_CPPFLAGS += \
+         -I$(top_srcdir)/src/mesa/sparc
+ endif
+ 
++lib_LTLIBRARIES =
++
+ if HAVE_DRI
+-lib_LTLIBRARIES = libdricore@VERSION@.la
++lib_LTLIBRARIES += libdricore@VERSION@.la
+ 
+ # Provide compatibility with scripts for the old Mesa build system for
+ # a while by putting a link to the driver into /lib of the build tree.
+@@ -76,6 +79,17 @@ all-local: libdricore@VERSION@.la
+ 	ln -sf libdricore@VERSION@.so.1 $(top_builddir)/$(LIB_DIR)/libdricore@VERSION@.so
+ endif
+ 
++libmesagallium_la_SOURCES = \
++	$(STATETRACKER_FILES)
++libmesagallium_la_CFLAGS = @LLVM_CFLAGS@
++libmesagallium_la_CXXFLAGS = @LLVM_CXXFLAGS@
++libmesagallium_la_LIBADD = libdricore@VERSION@.la $(LLVM_LIBS)
++
++if HAVE_GALLIUM
++noinst_LTLIBRARIES = libmesagallium.la
++endif
++
++
+ CLEANFILES = \
+ 	$(top_builddir)/$(LIB_DIR)/libdricore@VERSION@.so.1 \
+ 	$(top_builddir)/$(LIB_DIR)/libdricore@VERSION@.so
diff --git a/pkgs/development/libraries/mesa/fix-rounding.patch b/pkgs/development/libraries/mesa/fix-rounding.patch
new file mode 100644
index 00000000000..f81760a6708
--- /dev/null
+++ b/pkgs/development/libraries/mesa/fix-rounding.patch
@@ -0,0 +1,357 @@
+From c25ae5d27b114e23d5734f846002df1a05759658 Mon Sep 17 00:00:00 2001
+From: Roland Scheidegger <sroland@vmware.com>
+Date: Thu, 31 Jan 2013 19:27:49 +0000
+Subject: gallivm: fix issues with trunc/round/floor/ceil with no arch rounding
+
+The emulation of these if there's no rounding instruction available
+is a bit more complicated than what the code did.
+In particular, doing fp-to-int/int-to-fp will not work if the exponent
+is large enough (and with NaNs, Infs). Hence such values need to be filtered
+out and the original value returned in this case (which fortunately should
+always be exact). This comes at the expense of performance (if your cpu
+doesn't support rounding instructions).
+Furthermore, floor/ifloor/ceil/iceil were affected by precision issues for
+values near negative (for floor) or positive (for ceil) zero, fix that as well
+(fixing this issue might not actually be slower except for ceil/iceil if the
+type is not signed which is probably rare - note iceil has no callers left
+in any case).
+
+Also add some new rounding test values in lp_test_arit to actually test
+for that stuff (which previously would have failed without sse41).
+
+This fixes https://bugs.freedesktop.org/show_bug.cgi?id=59701.
+---
+diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+index b4e9f23..ec05026 100644
+--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
++++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+@@ -1590,12 +1590,37 @@ lp_build_trunc(struct lp_build_context *bld,
+       return lp_build_round_arch(bld, a, LP_BUILD_ROUND_TRUNCATE);
+    }
+    else {
+-      LLVMTypeRef vec_type = lp_build_vec_type(bld->gallivm, type);
+-      LLVMTypeRef int_vec_type = lp_build_int_vec_type(bld->gallivm, type);
+-      LLVMValueRef res;
+-      res = LLVMBuildFPToSI(builder, a, int_vec_type, "");
+-      res = LLVMBuildSIToFP(builder, res, vec_type, "");
+-      return res;
++      const struct lp_type type = bld->type;
++      struct lp_type inttype;
++      struct lp_build_context intbld;
++      LLVMValueRef cmpval = lp_build_const_vec(bld->gallivm, type, 2^24);
++      LLVMValueRef trunc, res, anosign, mask;
++      LLVMTypeRef int_vec_type = bld->int_vec_type;
++      LLVMTypeRef vec_type = bld->vec_type;
++
++      assert(type.width == 32); /* might want to handle doubles at some point */
++
++      inttype = type;
++      inttype.floating = 0;
++      lp_build_context_init(&intbld, bld->gallivm, inttype);
++
++      /* round by truncation */
++      trunc = LLVMBuildFPToSI(builder, a, int_vec_type, "");
++      res = LLVMBuildSIToFP(builder, trunc, vec_type, "floor.trunc");
++
++      /* mask out sign bit */
++      anosign = lp_build_abs(bld, a);
++      /*
++       * mask out all values if anosign > 2^24
++       * This should work both for large ints (all rounding is no-op for them
++       * because such floats are always exact) as well as special cases like
++       * NaNs, Infs (taking advantage of the fact they use max exponent).
++       * (2^24 is arbitrary anything between 2^24 and 2^31 should work.)
++       */
++      anosign = LLVMBuildBitCast(builder, anosign, int_vec_type, "");
++      cmpval = LLVMBuildBitCast(builder, cmpval, int_vec_type, "");
++      mask = lp_build_cmp(&intbld, PIPE_FUNC_GREATER, anosign, cmpval);
++      return lp_build_select(bld, mask, a, res);
+    }
+ }
+ 
+@@ -1620,11 +1645,36 @@ lp_build_round(struct lp_build_context *bld,
+       return lp_build_round_arch(bld, a, LP_BUILD_ROUND_NEAREST);
+    }
+    else {
+-      LLVMTypeRef vec_type = lp_build_vec_type(bld->gallivm, type);
+-      LLVMValueRef res;
++      const struct lp_type type = bld->type;
++      struct lp_type inttype;
++      struct lp_build_context intbld;
++      LLVMValueRef cmpval = lp_build_const_vec(bld->gallivm, type, 2^24);
++      LLVMValueRef res, anosign, mask;
++      LLVMTypeRef int_vec_type = bld->int_vec_type;
++      LLVMTypeRef vec_type = bld->vec_type;
++
++      assert(type.width == 32); /* might want to handle doubles at some point */
++
++      inttype = type;
++      inttype.floating = 0;
++      lp_build_context_init(&intbld, bld->gallivm, inttype);
++
+       res = lp_build_iround(bld, a);
+       res = LLVMBuildSIToFP(builder, res, vec_type, "");
+-      return res;
++
++      /* mask out sign bit */
++      anosign = lp_build_abs(bld, a);
++      /*
++       * mask out all values if anosign > 2^24
++       * This should work both for large ints (all rounding is no-op for them
++       * because such floats are always exact) as well as special cases like
++       * NaNs, Infs (taking advantage of the fact they use max exponent).
++       * (2^24 is arbitrary anything between 2^24 and 2^31 should work.)
++       */
++      anosign = LLVMBuildBitCast(builder, anosign, int_vec_type, "");
++      cmpval = LLVMBuildBitCast(builder, cmpval, int_vec_type, "");
++      mask = lp_build_cmp(&intbld, PIPE_FUNC_GREATER, anosign, cmpval);
++      return lp_build_select(bld, mask, a, res);
+    }
+ }
+ 
+@@ -1648,11 +1698,52 @@ lp_build_floor(struct lp_build_context *bld,
+       return lp_build_round_arch(bld, a, LP_BUILD_ROUND_FLOOR);
+    }
+    else {
+-      LLVMTypeRef vec_type = lp_build_vec_type(bld->gallivm, type);
+-      LLVMValueRef res;
+-      res = lp_build_ifloor(bld, a);
+-      res = LLVMBuildSIToFP(builder, res, vec_type, "");
+-      return res;
++      const struct lp_type type = bld->type;
++      struct lp_type inttype;
++      struct lp_build_context intbld;
++      LLVMValueRef cmpval = lp_build_const_vec(bld->gallivm, type, 2^24);
++      LLVMValueRef trunc, res, anosign, mask;
++      LLVMTypeRef int_vec_type = bld->int_vec_type;
++      LLVMTypeRef vec_type = bld->vec_type;
++
++      assert(type.width == 32); /* might want to handle doubles at some point */
++
++      inttype = type;
++      inttype.floating = 0;
++      lp_build_context_init(&intbld, bld->gallivm, inttype);
++
++      /* round by truncation */
++      trunc = LLVMBuildFPToSI(builder, a, int_vec_type, "");
++      res = LLVMBuildSIToFP(builder, trunc, vec_type, "floor.trunc");
++
++      if (type.sign) {
++         LLVMValueRef tmp;
++
++         /*
++          * fix values if rounding is wrong (for non-special cases)
++          * - this is the case if trunc > a
++          */
++         mask = lp_build_cmp(bld, PIPE_FUNC_GREATER, res, a);
++         /* tmp = trunc > a ? 1.0 : 0.0 */
++         tmp = LLVMBuildBitCast(builder, bld->one, int_vec_type, "");
++         tmp = lp_build_and(&intbld, mask, tmp);
++         tmp = LLVMBuildBitCast(builder, tmp, vec_type, "");
++         res = lp_build_sub(bld, res, tmp);
++      }
++
++      /* mask out sign bit */
++      anosign = lp_build_abs(bld, a);
++      /*
++       * mask out all values if anosign > 2^24
++       * This should work both for large ints (all rounding is no-op for them
++       * because such floats are always exact) as well as special cases like
++       * NaNs, Infs (taking advantage of the fact they use max exponent).
++       * (2^24 is arbitrary anything between 2^24 and 2^31 should work.)
++       */
++      anosign = LLVMBuildBitCast(builder, anosign, int_vec_type, "");
++      cmpval = LLVMBuildBitCast(builder, cmpval, int_vec_type, "");
++      mask = lp_build_cmp(&intbld, PIPE_FUNC_GREATER, anosign, cmpval);
++      return lp_build_select(bld, mask, a, res);
+    }
+ }
+ 
+@@ -1676,11 +1767,48 @@ lp_build_ceil(struct lp_build_context *bld,
+       return lp_build_round_arch(bld, a, LP_BUILD_ROUND_CEIL);
+    }
+    else {
+-      LLVMTypeRef vec_type = lp_build_vec_type(bld->gallivm, type);
+-      LLVMValueRef res;
+-      res = lp_build_iceil(bld, a);
+-      res = LLVMBuildSIToFP(builder, res, vec_type, "");
+-      return res;
++      const struct lp_type type = bld->type;
++      struct lp_type inttype;
++      struct lp_build_context intbld;
++      LLVMValueRef cmpval = lp_build_const_vec(bld->gallivm, type, 2^24);
++      LLVMValueRef trunc, res, anosign, mask, tmp;
++      LLVMTypeRef int_vec_type = bld->int_vec_type;
++      LLVMTypeRef vec_type = bld->vec_type;
++
++      assert(type.width == 32); /* might want to handle doubles at some point */
++
++      inttype = type;
++      inttype.floating = 0;
++      lp_build_context_init(&intbld, bld->gallivm, inttype);
++
++      /* round by truncation */
++      trunc = LLVMBuildFPToSI(builder, a, int_vec_type, "");
++      trunc = LLVMBuildSIToFP(builder, trunc, vec_type, "ceil.trunc");
++
++      /*
++       * fix values if rounding is wrong (for non-special cases)
++       * - this is the case if trunc < a
++       */
++      mask = lp_build_cmp(bld, PIPE_FUNC_LESS, trunc, a);
++      /* tmp = trunc < a ? 1.0 : 0.0 */
++      tmp = LLVMBuildBitCast(builder, bld->one, int_vec_type, "");
++      tmp = lp_build_and(&intbld, mask, tmp);
++      tmp = LLVMBuildBitCast(builder, tmp, vec_type, "");
++      res = lp_build_add(bld, trunc, tmp);
++
++      /* mask out sign bit */
++      anosign = lp_build_abs(bld, a);
++      /*
++       * mask out all values if anosign > 2^24
++       * This should work both for large ints (all rounding is no-op for them
++       * because such floats are always exact) as well as special cases like
++       * NaNs, Infs (taking advantage of the fact they use max exponent).
++       * (2^24 is arbitrary anything between 2^24 and 2^31 should work.)
++       */
++      anosign = LLVMBuildBitCast(builder, anosign, int_vec_type, "");
++      cmpval = LLVMBuildBitCast(builder, cmpval, int_vec_type, "");
++      mask = lp_build_cmp(&intbld, PIPE_FUNC_GREATER, anosign, cmpval);
++      return lp_build_select(bld, mask, a, res);
+    }
+ }
+ 
+@@ -1826,32 +1954,30 @@ lp_build_ifloor(struct lp_build_context *bld,
+          res = lp_build_round_arch(bld, a, LP_BUILD_ROUND_FLOOR);
+       }
+       else {
+-         /* Take the sign bit and add it to 1 constant */
+-         LLVMTypeRef vec_type = bld->vec_type;
+-         unsigned mantissa = lp_mantissa(type);
+-         LLVMValueRef mask = lp_build_const_int_vec(bld->gallivm, type,
+-                                  (unsigned long long)1 << (type.width - 1));
+-         LLVMValueRef sign;
+-         LLVMValueRef offset;
++         struct lp_type inttype;
++         struct lp_build_context intbld;
++         LLVMValueRef trunc, itrunc, mask;
+ 
+-         /* sign = a < 0 ? ~0 : 0 */
+-         sign = LLVMBuildBitCast(builder, a, int_vec_type, "");
+-         sign = LLVMBuildAnd(builder, sign, mask, "");
+-         sign = LLVMBuildAShr(builder, sign,
+-                              lp_build_const_int_vec(bld->gallivm, type,
+-                                                     type.width - 1),
+-                              "ifloor.sign");
++         assert(type.floating);
++         assert(lp_check_value(type, a));
+ 
+-         /* offset = -0.99999(9)f */
+-         offset = lp_build_const_vec(bld->gallivm, type,
+-                                     -(double)(((unsigned long long)1 << mantissa) - 10)/((unsigned long long)1 << mantissa));
+-         offset = LLVMConstBitCast(offset, int_vec_type);
++         inttype = type;
++         inttype.floating = 0;
++         lp_build_context_init(&intbld, bld->gallivm, inttype);
+ 
+-         /* offset = a < 0 ? offset : 0.0f */
+-         offset = LLVMBuildAnd(builder, offset, sign, "");
+-         offset = LLVMBuildBitCast(builder, offset, vec_type, "ifloor.offset");
++         /* round by truncation */
++         itrunc = LLVMBuildFPToSI(builder, a, int_vec_type, "");
++         trunc = LLVMBuildSIToFP(builder, itrunc, bld->vec_type, "ifloor.trunc");
+ 
+-         res = LLVMBuildFAdd(builder, res, offset, "ifloor.res");
++         /*
++          * fix values if rounding is wrong (for non-special cases)
++          * - this is the case if trunc > a
++          * The results of doing this with NaNs, very large values etc.
++          * are undefined but this seems to be the case anyway.
++          */
++         mask = lp_build_cmp(bld, PIPE_FUNC_GREATER, trunc, a);
++         /* cheapie minus one with mask since the mask is minus one / zero */
++         return lp_build_add(&intbld, itrunc, mask);
+       }
+    }
+ 
+@@ -1883,35 +2009,30 @@ lp_build_iceil(struct lp_build_context *bld,
+       res = lp_build_round_arch(bld, a, LP_BUILD_ROUND_CEIL);
+    }
+    else {
+-      LLVMTypeRef vec_type = bld->vec_type;
+-      unsigned mantissa = lp_mantissa(type);
+-      LLVMValueRef offset;
++      struct lp_type inttype;
++      struct lp_build_context intbld;
++      LLVMValueRef trunc, itrunc, mask;
+ 
+-      /* offset = 0.99999(9)f */
+-      offset = lp_build_const_vec(bld->gallivm, type,
+-                                  (double)(((unsigned long long)1 << mantissa) - 10)/((unsigned long long)1 << mantissa));
++      assert(type.floating);
++      assert(lp_check_value(type, a));
+ 
+-      if (type.sign) {
+-         LLVMValueRef mask = lp_build_const_int_vec(bld->gallivm, type,
+-                                (unsigned long long)1 << (type.width - 1));
+-         LLVMValueRef sign;
++      inttype = type;
++      inttype.floating = 0;
++      lp_build_context_init(&intbld, bld->gallivm, inttype);
+ 
+-         /* sign = a < 0 ? 0 : ~0 */
+-         sign = LLVMBuildBitCast(builder, a, int_vec_type, "");
+-         sign = LLVMBuildAnd(builder, sign, mask, "");
+-         sign = LLVMBuildAShr(builder, sign,
+-                              lp_build_const_int_vec(bld->gallivm, type,
+-                                                     type.width - 1),
+-                              "iceil.sign");
+-         sign = LLVMBuildNot(builder, sign, "iceil.not");
+-
+-         /* offset = a < 0 ? 0.0 : offset */
+-         offset = LLVMConstBitCast(offset, int_vec_type);
+-         offset = LLVMBuildAnd(builder, offset, sign, "");
+-         offset = LLVMBuildBitCast(builder, offset, vec_type, "iceil.offset");
+-      }
++      /* round by truncation */
++      itrunc = LLVMBuildFPToSI(builder, a, int_vec_type, "");
++      trunc = LLVMBuildSIToFP(builder, itrunc, bld->vec_type, "iceil.trunc");
+ 
+-      res = LLVMBuildFAdd(builder, a, offset, "iceil.res");
++      /*
++       * fix values if rounding is wrong (for non-special cases)
++       * - this is the case if trunc < a
++       * The results of doing this with NaNs, very large values etc.
++       * are undefined but this seems to be the case anyway.
++       */
++      mask = lp_build_cmp(bld, PIPE_FUNC_LESS, trunc, a);
++      /* cheapie plus one with mask since the mask is minus one / zero */
++      return lp_build_sub(&intbld, itrunc, mask);
+    }
+ 
+    /* round to nearest (toward zero) */
+diff --git a/src/gallium/drivers/llvmpipe/lp_test_arit.c b/src/gallium/drivers/llvmpipe/lp_test_arit.c
+index 99928b8..f14e4b3 100644
+--- a/src/gallium/drivers/llvmpipe/lp_test_arit.c
++++ b/src/gallium/drivers/llvmpipe/lp_test_arit.c
+@@ -207,6 +207,18 @@ const float round_values[] = {
+       -10.0, -1, 0.0, 12.0,
+       -1.49, -0.25, 1.25, 2.51,
+       -0.99, -0.01, 0.01, 0.99,
++      1.401298464324817e-45f, // smallest denormal
++      -1.401298464324817e-45f,
++      1.62981451e-08f,
++      -1.62981451e-08f,
++      1.62981451e15f, // large number not representable as 32bit int
++      -1.62981451e15f,
++      FLT_EPSILON,
++      -FLT_EPSILON,
++      1.0f - 0.5f*FLT_EPSILON,
++      -1.0f + FLT_EPSILON,
++      FLT_MAX,
++      -FLT_MAX
+ };
+ 
+ static float fractf(float x)
+--
+cgit v0.9.0.2-2-gbebe
diff --git a/pkgs/development/libraries/mesa/mips_wmb.patch b/pkgs/development/libraries/mesa/mips_wmb.patch
deleted file mode 100644
index 1ffa1bdd8df..00000000000
--- a/pkgs/development/libraries/mesa/mips_wmb.patch
+++ /dev/null
@@ -1,16 +0,0 @@
-rixed told me (viric) it's the patch to apply for mesa.
-I adapted his patch for mesa 7.5 to this 7.10
-
-diff --git a/src/mesa/drivers/dri/sis/sis_context.h b/src/mesa/drivers/dri/sis/sis_context.h
-index a82a659..d8d8d9a 100644
---- a/src/mesa/drivers/dri/sis/sis_context.h
-+++ b/src/mesa/drivers/dri/sis/sis_context.h
-@@ -404,6 +404,8 @@ struct sis_context
- #define MMIO_WMB()	__asm __volatile("" : : : "memory")
- #elif defined(__ia64__)
- #define MMIO_WMB()	__asm __volatile("mf" : : : "memory")
-+#elif defined(__mips__)
-+#define MMIO_WMB()     __asm __volatile("" : : : "memory")
- #else
- #error platform needs WMB
- #endif
diff --git a/pkgs/development/libraries/mesa/static-gallium.patch b/pkgs/development/libraries/mesa/static-gallium.patch
new file mode 100644
index 00000000000..755682d9f1e
--- /dev/null
+++ b/pkgs/development/libraries/mesa/static-gallium.patch
@@ -0,0 +1,71 @@
+commit 2c910b6f186616cac8134e2a2cbe239c8351ed99
+Author: Vladimír Čunát <vcunat@gmail.com>
+Date:   Mon May 13 11:34:34 2013 +0200
+
+    117-static-gallium.patch
+    
+    Conflicts (moving of VISIBILITY_ confused the merge):
+    	src/gallium/auxiliary/Makefile.am
+
+diff --git a/configure.ac b/configure.ac
+index b9fcb0b..be89843 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -747,6 +747,19 @@ if test "x$enable_shared_glapi" = xyes; then
+ fi
+ AM_CONDITIONAL(HAVE_SHARED_GLAPI, test "x$enable_shared_glapi" = xyes)
+ 
++AC_ARG_ENABLE([shared-gallium],
++    [AS_HELP_STRING([--enable-shared-gallium],
++        [Enable shared gallium core @<:@default=yes@:>@])],
++    [enable_shared_gallium="$enableval"],
++    [enable_shared_gallium=yes])
++
++SHARED_GALLIUM="0"
++if test "x$enable_shared_gallium" = xyes; then
++    SHARED_GALLIUM="1"
++fi
++AC_SUBST([SHARED_GALLIUM])
++AM_CONDITIONAL(HAVE_SHARED_GALLIUM, test $SHARED_GALLIUM = 1)
++
+ dnl
+ dnl Driver specific build directories
+ dnl
+diff --git a/src/gallium/auxiliary/Makefile.am b/src/gallium/auxiliary/Makefile.am
+index f14279b..3cdec83 100644
+--- a/src/gallium/auxiliary/Makefile.am
++++ b/src/gallium/auxiliary/Makefile.am
+@@ -3,14 +3,19 @@ AUTOMAKE_OPTIONS = subdir-objects
+ include Makefile.sources
+ include $(top_srcdir)/src/gallium/Automake.inc
+ 
+-noinst_LTLIBRARIES = libgallium.la
+-
+ AM_CFLAGS = \
+ 	-I$(top_srcdir)/src/gallium/auxiliary/util \
+-	$(GALLIUM_CFLAGS) \
+-	$(VISIBILITY_CFLAGS)
++	$(GALLIUM_CFLAGS)
+ 
+-AM_CXXFLAGS = $(VISIBILITY_CXXFLAGS)
++AM_CXXFLAGS =
++
++if HAVE_SHARED_GALLIUM
++lib_LTLIBRARIES = libgallium.la
++else
++noinst_LTLIBRARIES = libgallium.la
++AM_CFLAGS += $(VISIBILITY_CFLAGS)
++AM_CXXFLAGS += $(VISIBILITY_CXXFLAGS)
++endif
+ 
+ libgallium_la_SOURCES = \
+ 	$(C_SOURCES) \
+@@ -29,6 +34,8 @@ if LLVM_NEEDS_FNORTTI
+ 
+ AM_CXXFLAGS += -fno-rtti
+ 
++libgallium_la_LIBADD = $(LLVM_LIBS)
++
+ endif
+ 
+ libgallium_la_SOURCES += \
diff --git a/pkgs/development/libraries/mpfr/3.1.2.nix b/pkgs/development/libraries/mpfr/3.1.2.nix
new file mode 100644
index 00000000000..fd164cf9105
--- /dev/null
+++ b/pkgs/development/libraries/mpfr/3.1.2.nix
@@ -0,0 +1,51 @@
+
+{stdenv, fetchurl, gmp}:
+
+stdenv.mkDerivation (rec {
+  name = "mpfr-3.1.2";
+
+  src = fetchurl {
+    url = "mirror://gnu/mpfr/${name}.tar.bz2";
+    sha256 = "0sqvpfkzamxdr87anzakf9dhkfh15lfmm5bsqajk02h1mxh3zivr";
+  };
+
+  buildInputs = [ gmp ];
+
+  doCheck = true;
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = http://www.mpfr.org/;
+    description = "GNU MPFR, a library for multiple-precision floating-point arithmetic";
+
+    longDescription = ''
+      The GNU MPFR library is a C library for multiple-precision
+      floating-point computations with correct rounding.  MPFR is
+      based on the GMP multiple-precision library.
+
+      The main goal of MPFR is to provide a library for
+      multiple-precision floating-point computation which is both
+      efficient and has a well-defined semantics.  It copies the good
+      ideas from the ANSI/IEEE-754 standard for double-precision
+      floating-point arithmetic (53-bit mantissa).
+    '';
+
+    license = "LGPLv2+";
+
+    maintainers = [ stdenv.lib.maintainers.ludo ];
+    platforms = stdenv.lib.platforms.all;
+  };
+}
+
+//
+
+(stdenv.lib.optionalAttrs stdenv.isFreeBSD {
+   /* Work around a FreeBSD bug that otherwise leads to segfaults in
+      the test suite:
+        http://hydra.bordeaux.inria.fr/build/34862
+        http://websympa.loria.fr/wwsympa/arc/mpfr/2011-10/msg00015.html
+        http://www.freebsd.org/cgi/query-pr.cgi?pr=161344
+    */
+   configureFlags = [ "--disable-thread-safe" ];
+ }))
diff --git a/pkgs/development/libraries/nlopt/default.nix b/pkgs/development/libraries/nlopt/default.nix
index 0936332cd48..cc216a59d75 100644
--- a/pkgs/development/libraries/nlopt/default.nix
+++ b/pkgs/development/libraries/nlopt/default.nix
@@ -1,12 +1,19 @@
-{ fetchurl, stdenv }:
+{ fetchurl, stdenv
+, withOctave ? true, octave ? null}:
 
 stdenv.mkDerivation rec {
-  name = "nlopt-2.2.1";
+  name = "nlopt-2.3";
 
   src = fetchurl {
     url = "http://ab-initio.mit.edu/nlopt/${name}.tar.gz";
-    sha256 = "0p7ri7dcp6vga7jwng7wj9bf2ixk6p5ldxp76r93xkrdixqfngaq";
+    sha256 = "1iw2cjgypyqz779f47fz0nmifbrvk4zs4rxi1ibk36f4ly3wg6p6";
   };
 
-  configureFlags = "--with-cxx --with-pic --without-guile --without-python --without-octave --without-matlab";
+  buildInputs = stdenv.lib.optional withOctave octave;
+
+  configureFlags = "--with-cxx --enable-shared --with-pic --without-guile --without-python
+  --without-matlab " +
+    stdenv.lib.optionalString withOctave ("--with-octave " +
+        "M_INSTALL_DIR=$(out)/${octave.sitePath}/m " +
+        "OCT_INSTALL_DIR=$(out)/${octave.sitePath}/oct ");
 }
diff --git a/pkgs/development/libraries/openjpeg/default.nix b/pkgs/development/libraries/openjpeg/default.nix
index 6024456652c..7fd18af450c 100644
--- a/pkgs/development/libraries/openjpeg/default.nix
+++ b/pkgs/development/libraries/openjpeg/default.nix
@@ -1,13 +1,21 @@
-{ stdenv, fetchurl }:
+{ stdenv, fetchurl, pkgconfig, libpng, libtiff, lcms2, glib/*passthru only*/ }:
 
 stdenv.mkDerivation rec {
   name = "openjpeg-1.5.1";
+  passthru = {
+    incDir = "openjpeg-1.5";
+  };
 
   src = fetchurl {
     url = "http://openjpeg.googlecode.com/files/${name}.tar.gz";
     sha256 = "13dbyf3jwr4h2dn1k11zph3jgx17z7d66xmi640mbsf8l6bk1yvc";
   };
 
+  nativebuildInputs = [ pkgconfig ];
+  propagatedBuildInputs = [ libpng libtiff lcms2 ]; # in closure anyway
+
+  postInstall = glib.flattenInclude;
+
   meta = {
     homepage = http://www.openjpeg.org/;
     description = "Open-source JPEG 2000 codec written in C language";
diff --git a/pkgs/development/libraries/pango/1.30.x.nix b/pkgs/development/libraries/pango/default.nix
index fa6d50d6c87..2de9d98e579 100644
--- a/pkgs/development/libraries/pango/1.30.x.nix
+++ b/pkgs/development/libraries/pango/default.nix
@@ -1,20 +1,23 @@
-{ stdenv, fetchurl, pkgconfig, gettext, x11, glib, cairo, libpng, fontconfig }:
+{ stdenv, fetchurl, pkgconfig, gettext, x11, glib, cairo, libpng, harfbuzz, fontconfig
+, libintlOrEmpty }:
 
 stdenv.mkDerivation rec {
-  name = "pango-1.30.1";
+  name = "pango-1.32.5"; #.6 needs a not-yet-stable fontconfig
 
   src = fetchurl {
-    url = "mirror://gnome/sources/pango/1.30/${name}.tar.xz";
-    sha256 = "3a8c061e143c272ddcd5467b3567e970cfbb64d1d1600a8f8e62435556220cbe";
+    url = "mirror://gnome/sources/pango/1.32/${name}.tar.xz";
+    sha256 = "08aqis6j8nd1lb4f2h4h9d9kjvp54iwf8zvqzss0qn4v7nfcjyvx";
   };
 
   outputs = [ "dev" "out" "bin" "doc" ];
 
+  NIX_CFLAGS_COMPILE = "-I${cairo}/include/cairo";
+
   buildInputs = stdenv.lib.optionals stdenv.isDarwin [ gettext fontconfig ];
 
   nativeBuildInputs = [ pkgconfig ];
 
-  propagatedBuildInputs = [ x11 glib cairo libpng ];
+  propagatedBuildInputs = [ x11 glib cairo libpng harfbuzz ] ++ libintlOrEmpty;
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/pangox-compat/default.nix b/pkgs/development/libraries/pangox-compat/default.nix
new file mode 100644
index 00000000000..8518083b4d3
--- /dev/null
+++ b/pkgs/development/libraries/pangox-compat/default.nix
@@ -0,0 +1,19 @@
+{ stdenv, fetchurl, pkgconfig, glib, pango, libX11 }:
+
+stdenv.mkDerivation rec {
+  name = "pangox-compat-0.0.2";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/pangox-compat/0.0/${name}.tar.xz";
+    sha256 = "0ip0ziys6mrqqmz4n71ays0kf5cs1xflj1gfpvs4fgy2nsrr482m";
+  };
+
+  buildInputs = [ pkgconfig glib pango libX11 ];
+
+  meta = {
+    description = "A compatibility library for pango>1.30.*";
+
+    homepage = http://www.pango.org/;
+    license = "LGPLv2+";
+  };
+}
diff --git a/pkgs/development/libraries/pdf2xml/default.nix b/pkgs/development/libraries/pdf2xml/default.nix
index 0f9a3dc2b2d..4f3cd931fce 100644
--- a/pkgs/development/libraries/pdf2xml/default.nix
+++ b/pkgs/development/libraries/pdf2xml/default.nix
@@ -4,7 +4,7 @@ stdenv.mkDerivation {
   name = "pdf2xml";
   
   src = fetchurl {
-      url = http://nixos.org/tarballs/pdf2xml.tar.gz;
+      url = http://tarballs.nixos.org/pdf2xml.tar.gz;
       sha256 = "04rl7ppxqgnvxvvws669cxp478lnrdmiqj0g3m4p69bawfjc4z3w";
   };
   sourceRoot = "pdf2xml/pdf2xml";
diff --git a/pkgs/development/libraries/pixman/default.nix b/pkgs/development/libraries/pixman/default.nix
new file mode 100644
index 00000000000..7fbcedda395
--- /dev/null
+++ b/pkgs/development/libraries/pixman/default.nix
@@ -0,0 +1,22 @@
+{ fetchurl, stdenv, pkgconfig, perl, withPNG ? true, libpng, glib /*just passthru*/ }:
+
+stdenv.mkDerivation rec {
+  name = "pixman-0.28.2";
+
+  src = fetchurl {
+    url = "http://cairographics.org/releases/${name}.tar.gz";
+    sha256 = "0mcvxd5gx3w1wzgph91l2vaiic91jmx7s01hi2igphyvd80ckyia";
+  };
+
+  nativeBuildInputs = [ pkgconfig perl ];
+
+  buildInputs = stdenv.lib.optional withPNG [ libpng ]; # NOT in closure anyway
+
+  postInstall = glib.flattenInclude;
+
+  meta = {
+    homepage = http://pixman.org;
+    description = "A low-level library for pixel manipulation";
+    license = "MIT";
+  };
+}
diff --git a/pkgs/development/libraries/poppler/0.18.nix b/pkgs/development/libraries/poppler/0.18.nix
new file mode 100644
index 00000000000..29e99b67549
--- /dev/null
+++ b/pkgs/development/libraries/poppler/0.18.nix
@@ -0,0 +1,53 @@
+{ fetchurl, stdenv, cairo, freetype, fontconfig, zlib
+, libjpeg, curl, libpthreadstubs, xorg, openjpeg
+, libxml2, pkgconfig, cmake, lcms2, libiconvOrEmpty
+, glibSupport ? false, glib, gtk3Support ? false, gtk3 # gtk2 no longer accepted
+, qt4Support ? false, qt4 ? null
+}:
+
+stdenv.mkDerivation rec {
+  name = "poppler-0.18.4";
+
+  src = fetchurl {
+    url = "${meta.homepage}${name}.tar.gz";
+    sha256 = "0bnl05al7mjndp2h0355946j59nfw76f5v0x57d47q68rm412hik";
+  };
+
+  propagatedBuildInputs = with xorg;
+    [ zlib cairo freetype fontconfig libjpeg lcms2 curl
+      libpthreadstubs libxml2 stdenv.gcc.libc
+      libXau libXdmcp libxcb libXrender libXext
+      openjpeg
+    ]
+    ++ stdenv.lib.optional glibSupport glib
+    ++ stdenv.lib.optional gtk3Support gtk3
+    ++ stdenv.lib.optional qt4Support qt4;
+
+  nativeBuildInputs = [ pkgconfig cmake ] ++ libiconvOrEmpty;
+
+  cmakeFlags = "-DENABLE_XPDF_HEADERS=ON -DENABLE_LIBCURL=ON -DENABLE_ZLIB=ON";
+
+  patches = [ ./datadir_env.patch ];
+
+  # XXX: The Poppler/Qt4 test suite refers to non-existent PDF files
+  # such as `../../../test/unittestcases/UseNone.pdf'.
+  #doCheck = !qt4Support;
+  checkTarget = "test";
+
+  enableParallelBuilding = true;
+
+  meta = {
+    homepage = http://poppler.freedesktop.org/;
+    description = "Poppler, a PDF rendering library";
+
+    longDescription = ''
+      Poppler is a PDF rendering library based on the xpdf-3.0 code base.
+    '';
+
+    platforms = if qt4Support
+      then qt4.meta.platforms
+      else stdenv.lib.platforms.all;
+
+    license = "GPLv2";
+  };
+}
diff --git a/pkgs/development/libraries/poppler/default.nix b/pkgs/development/libraries/poppler/default.nix
index 1d796789210..7c392832406 100644
--- a/pkgs/development/libraries/poppler/default.nix
+++ b/pkgs/development/libraries/poppler/default.nix
@@ -1,50 +1,72 @@
-{ fetchurl, stdenv, cairo, freetype, fontconfig, zlib
-, libjpeg, pixman, curl, libpthreadstubs, libXau, libXdmcp, openjpeg
-, libxml2, pkgconfig, cmake, lcms
-, gtkSupport ? false, glib ? null, gtk ? null
+{ stdenv, fetchurl, fetchgit, pkgconfig, cmake, libiconvOrEmpty, libintlOrEmpty
+, zlib, curl, cairo, freetype, fontconfig, lcms2, libjpeg, openjpeg
 , qt4Support ? false, qt4 ? null
 }:
 
-stdenv.mkDerivation rec {
-  name = "poppler-0.22.4";
+let
+  version = "0.22.4"; # even major numbers are stable
+  sha256 = "0fz1vk0rbxvnv7ssj8l910k1rx0gjhzl5wr7hkdf4r9jwqs8yhsg";
 
-  src = fetchurl {
-    url = "${meta.homepage}${name}.tar.gz";
-    sha256 = "0fz1vk0rbxvnv7ssj8l910k1rx0gjhzl5wr7hkdf4r9jwqs8yhsg";
-  };
+  qtcairo_patches =
+    let qtcairo = fetchgit { # the version for poppler-0.22
+      url = "git://github.com/giddie/poppler-qt4-cairo-backend.git";
+      rev = "7a12c58e5cefc2b7a5179c53b387fca8963195c0";
+      sha256 = "1jg2d5y62d0bv206nijb63x426zfb2awy70505nx22d0fx1v1p9k";
+    }; in
+      [ "${qtcairo}/0001-Cairo-backend-added-to-Qt4-wrapper.patch"
+        "${qtcairo}/0002-Setting-default-Qt4-backend-to-Cairo.patch"
+        "${qtcairo}/0003-Forcing-subpixel-rendering-in-Cairo-backend.patch" ];
+
+  poppler_drv = nameSuff: merge: stdenv.mkDerivation (stdenv.lib.mergeAttrsByFuncDefaultsClean [
+  rec {
+    name = "poppler-${nameSuff}-${version}";
+
+    src = fetchurl {
+      url = "${meta.homepage}/poppler-${version}.tar.gz";
+      inherit sha256;
+    };
+
+    propagatedBuildInputs = [ zlib cairo freetype fontconfig libjpeg lcms2 curl openjpeg ];
+
+    nativeBuildInputs = [ pkgconfig cmake ] ++ libiconvOrEmpty ++ libintlOrEmpty;
 
-  propagatedBuildInputs =
-    [ zlib cairo freetype fontconfig libjpeg lcms pixman curl
-      libpthreadstubs libXau libXdmcp openjpeg libxml2 stdenv.gcc.libc
-    ]
-    ++ stdenv.lib.optionals gtkSupport [ glib gtk ]
-    ++ stdenv.lib.optional qt4Support qt4;
+    cmakeFlags = "-DENABLE_XPDF_HEADERS=ON -DENABLE_LIBCURL=ON -DENABLE_ZLIB=ON";
 
-  nativeBuildInputs = [ pkgconfig cmake ];
+    patches = [ ./datadir_env.patch ];
 
-  cmakeFlags = "-DENABLE_XPDF_HEADERS=ON -DENABLE_LIBCURL=ON -DENABLE_ZLIB=ON";
+    # XXX: The Poppler/Qt4 test suite refers to non-existent PDF files
+    # such as `../../../test/unittestcases/UseNone.pdf'.
+    #doCheck = !qt4Support;
+    checkTarget = "test";
 
-  patches = [ ./datadir_env.patch ];
+    enableParallelBuilding = true;
 
-  # XXX: The Poppler/Qt4 test suite refers to non-existent PDF files
-  # such as `../../../test/unittestcases/UseNone.pdf'.
-  #doCheck = !qt4Support;
-  checkTarget = "test";
+    meta = {
+      homepage = http://poppler.freedesktop.org/;
+      description = "A PDF rendering library";
 
-  enableParallelBuilding = true;
+      longDescription = ''
+        Poppler is a PDF rendering library based on the xpdf-3.0 code base.
+      '';
 
-  meta = {
-    homepage = http://poppler.freedesktop.org/;
-    description = "Poppler, a PDF rendering library";
+      license = "GPLv2";
+      platforms = stdenv.lib.platforms.all;
+    };
+  } merge ]); # poppler_drv
 
-    longDescription = ''
-      Poppler is a PDF rendering library based on the xpdf-3.0 code base.
-    '';
+in rec {
+  /* We always use cairo in poppler, so we always depend on glib,
+     so we always build the glib wrapper (~350kB).
+     We also always build the cpp wrapper (<100kB).
+     ToDo: around half the size could be saved by splitting out headers and tools (1.5 + 0.5 MB).
+  */
 
-    platforms = if qt4Support
-      then qt4.meta.platforms
-      else stdenv.lib.platforms.all;
+  poppler_glib = poppler_drv "glib" { };
 
-    license = "GPLv2";
+  poppler_qt4 = poppler_drv "qt4" {
+    propagatedBuildInputs = [ qt4 poppler_glib ];
+    patches = qtcairo_patches;
+    NIX_LDFLAGS = "-lpoppler";
+    postConfigure = "cd qt4";
   };
 }
diff --git a/pkgs/development/libraries/qt-4.x/4.8/CVE-2013-0254.patch b/pkgs/development/libraries/qt-4.x/4.8/CVE-2013-0254.patch
new file mode 100644
index 00000000000..48cc05f1800
--- /dev/null
+++ b/pkgs/development/libraries/qt-4.x/4.8/CVE-2013-0254.patch
@@ -0,0 +1,66 @@
+From 20b26bdb3dd5e46b01b9a7e1ce8342074df3c89c Mon Sep 17 00:00:00 2001
+From: Thiago Macieira <thiago.macieira@intel.com>
+Date: Sat, 22 Dec 2012 08:32:12 -0800
+Subject: [PATCH] Change all shmget calls to user-only memory
+
+Drop the read and write permissions for group and other users in the
+system.
+
+Change-Id: I8fc753f09126651af3fb82df3049050f0b14e876
+(cherry-picked from Qt 5 commit 856f209fb63ae336bfb389a12d2a75fa886dc1c5)
+Reviewed-by: Richard J. Moore <rich@kde.org>
+---
+ src/corelib/kernel/qsharedmemory_unix.cpp          |    6 +++---
+ src/corelib/kernel/qsystemsemaphore_unix.cpp       |    4 ++--
+
+diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp
+index 20d76e3..4cf3acf 100644
+--- a/src/corelib/kernel/qsharedmemory_unix.cpp
++++ b/src/corelib/kernel/qsharedmemory_unix.cpp
+@@ -238,7 +238,7 @@ bool QSharedMemoryPrivate::create(int size)
+     }
+ 
+     // create
+-    if (-1 == shmget(unix_key, size, 0666 | IPC_CREAT | IPC_EXCL)) {
++    if (-1 == shmget(unix_key, size, 0600 | IPC_CREAT | IPC_EXCL)) {
+         QString function = QLatin1String("QSharedMemory::create");
+         switch (errno) {
+         case EINVAL:
+@@ -293,7 +293,7 @@ bool QSharedMemoryPrivate::attach(QSharedMemory::AccessMode mode)
+ {
+ #ifndef QT_POSIX_IPC
+     // grab the shared memory segment id
+-    int id = shmget(unix_key, 0, (mode == QSharedMemory::ReadOnly ? 0444 : 0660));
++    int id = shmget(unix_key, 0, (mode == QSharedMemory::ReadOnly ? 0400 : 0600));
+     if (-1 == id) {
+         setErrorString(QLatin1String("QSharedMemory::attach (shmget)"));
+         return false;
+@@ -381,7 +381,7 @@ bool QSharedMemoryPrivate::detach()
+     size = 0;
+ 
+     // Get the number of current attachments
+-    int id = shmget(unix_key, 0, 0444);
++    int id = shmget(unix_key, 0, 0400);
+     cleanHandle();
+ 
+     struct shmid_ds shmid_ds;
+diff --git a/src/corelib/kernel/qsystemsemaphore_unix.cpp b/src/corelib/kernel/qsystemsemaphore_unix.cpp
+index fad9acc..e77456b 100644
+--- a/src/corelib/kernel/qsystemsemaphore_unix.cpp
++++ b/src/corelib/kernel/qsystemsemaphore_unix.cpp
+@@ -153,10 +153,10 @@ key_t QSystemSemaphorePrivate::handle(QSystemSemaphore::AccessMode mode)
+     }
+ 
+     // Get semaphore
+-    semaphore = semget(unix_key, 1, 0666 | IPC_CREAT | IPC_EXCL);
++    semaphore = semget(unix_key, 1, 0600 | IPC_CREAT | IPC_EXCL);
+     if (-1 == semaphore) {
+         if (errno == EEXIST)
+-            semaphore = semget(unix_key, 1, 0666 | IPC_CREAT);
++            semaphore = semget(unix_key, 1, 0600 | IPC_CREAT);
+         if (-1 == semaphore) {
+             setErrorString(QLatin1String("QSystemSemaphore::handle"));
+             cleanHandle();
+-- 
+1.7.1
+
diff --git a/pkgs/development/libraries/qt-4.x/4.8/default.nix b/pkgs/development/libraries/qt-4.x/4.8/default.nix
index ade9a67cbcc..b797f631b8e 100644
--- a/pkgs/development/libraries/qt-4.x/4.8/default.nix
+++ b/pkgs/development/libraries/qt-4.x/4.8/default.nix
@@ -5,8 +5,8 @@
 , libtiff, glib, icu
 , mysql, postgresql, sqlite
 , perl, coreutils, libXi
-, buildMultimedia ? true, alsaLib, gstreamer, gst_plugins_base
-, buildWebkit ? true
+, buildMultimedia ? stdenv.isLinux, alsaLib, gstreamer, gst_plugins_base
+, buildWebkit ? stdenv.isLinux
 , flashplayerFix ? false, gdk_pixbuf
 , gtkStyle ? false, libgnomeui, gtk, GConf, gnome_vfs
 , developerBuild ? false
@@ -31,8 +31,15 @@ stdenv.mkDerivation rec {
     sha256 = "0w1j16q6glniv4hppdgcvw52w72gb2jab35ylkw0qjn5lj5y7c1k";
   };
 
+  prePatch = ''
+    substituteInPlace configure --replace /bin/pwd pwd
+    substituteInPlace src/corelib/global/global.pri --replace /bin/ls ${coreutils}/bin/ls
+    sed -e 's@/\(usr\|opt\)/@/var/empty/@g' -i config.tests/*/*.test -i mkspecs/*/*.conf
+  '';
+
   patches =
     [ ./glib-2.32.patch
+      ./CVE-2013-0254.patch
       (substituteAll {
         src = ./dlopen-absolute-paths.diff;
         inherit cups icu libXfixes;
@@ -63,6 +70,7 @@ stdenv.mkDerivation rec {
       "
     '';
 
+  prefixKey = "-prefix ";
   configureFlags =
     ''
       -v -no-separate-debug-info -release -no-fast -confirm-license -opensource
@@ -88,7 +96,7 @@ stdenv.mkDerivation rec {
       libXv libXi libSM
     ]
     ++ optional (stdenv.lib.lists.elem stdenv.system stdenv.lib.platforms.mesaPlatforms) mesa
-    ++ optional (buildWebkit || buildMultimedia) alsaLib
+    ++ optional ((buildWebkit || buildMultimedia) && stdenv.isLinux ) alsaLib
     ++ [ zlib libpng openssl dbus.libs freetype fontconfig glib ]
     ++ optionals (buildWebkit || buildMultimedia) [ gstreamer gst_plugins_base ];
 
@@ -100,15 +108,9 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ perl pkgconfig which ];
 
-  prefixKey = "-prefix ";
-
-  prePatch = ''
-    substituteInPlace configure --replace /bin/pwd pwd
-    substituteInPlace src/corelib/global/global.pri --replace /bin/ls ${coreutils}/bin/ls
-    sed -e 's@/\(usr\|opt\)/@/var/empty/@g' -i config.tests/*/*.test -i mkspecs/*/*.conf
-  '';
-
-  enableParallelBuilding = true;
+  # occasional build problems if one has too many cores (like on Hydra)
+  # @vcunat has been unable to find a *reliable* fix
+  enableParallelBuilding = false;
 
   crossAttrs = let
     isMingw = stdenv.cross.config == "i686-pc-mingw32" ||
@@ -149,6 +151,6 @@ stdenv.mkDerivation rec {
     description = "A cross-platform application framework for C++";
     license = "GPL/LGPL";
     maintainers = with maintainers; [ urkud sander phreedom ];
-    platforms = platforms.linux;
+    platforms = platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/ruby_gpgme/default.nix b/pkgs/development/libraries/ruby_gpgme/default.nix
new file mode 100644
index 00000000000..c5f2366bfa1
--- /dev/null
+++ b/pkgs/development/libraries/ruby_gpgme/default.nix
@@ -0,0 +1,64 @@
+{ stdenv, fetchurl, gpgme, ruby, rubygems, hoe }:
+
+stdenv.mkDerivation {
+  name = "ruby-gpgme-1.0.8";
+
+  src = fetchurl {
+    url = "https://github.com/ueno/ruby-gpgme/archive/1.0.8.tar.gz";
+    sha256 = "1j7jkl9s8iqcmxf3x6c9kljm19hw1jg6yvwbndmkw43qacdr9nxb";
+  };
+
+  meta = {
+    description = ''
+      Ruby-GPGME is a Ruby language binding of GPGME (GnuPG Made
+      Easy)
+    '';
+    homepage = "http://rubyforge.org/projects/ruby-gpgme/";
+    longDescription = ''
+      Ruby-GPGME is a Ruby language binding of GPGME (GnuPG Made Easy).
+
+      GnuPG Made Easy (GPGME) is a library designed to make access to GnuPG
+      easier for applications. It provides a High-Level Crypto API for
+      encryption, decryption, signing, signature verification and key
+      management.
+    '';
+  };
+
+  buildInputs = [ gpgme rubygems hoe ruby ];
+
+  buildPhase = ''
+    ${ruby}/bin/ruby extconf.rb
+    rake gem
+  '';
+
+  installPhase = ''
+    export HOME=$TMP/home; mkdir -pv "$HOME"
+
+    # For some reason, the installation phase doesn't work with the default
+    # make install command run by gem (we'll fix it and do it ourselves later)
+    gem install --no-verbose --install-dir "$out/${ruby.gemPath}" \
+        --bindir "$out/bin" --no-rdoc --no-ri pkg/gpgme-1.0.8.gem || true
+
+    # Create a bare-bones gemspec file so that ruby will recognise the gem
+    cat <<EOF >"$out/${ruby.gemPath}/specifications/gpgme.gemspec"
+    Gem::Specification.new do |s|
+      s.name              = 'gpgme'
+      s.version           = '1.0.8'
+      s.files             = Dir['{lib,examples}/**/*']
+      s.rubyforge_project = 'ruby-gpgme'
+      s.require_paths     = ['lib']
+    end
+    EOF
+
+    cd "$out/${ruby.gemPath}/gems/gpgme-1.0.8"
+    mkdir src
+    mv lib src
+    sed -i "s/srcdir = ./srcdir = src/" Makefile
+    make install
+
+    mv lib lib.bak
+    mv src/lib lib
+    rmdir src
+  '';
+}
+
diff --git a/pkgs/development/libraries/ruby_ncursesw_sup/default.nix b/pkgs/development/libraries/ruby_ncursesw_sup/default.nix
new file mode 100644
index 00000000000..67041ad0607
--- /dev/null
+++ b/pkgs/development/libraries/ruby_ncursesw_sup/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchurl, ncurses, ruby, rubygems }:
+
+stdenv.mkDerivation rec {
+  name = ''ncursesw-sup-afd962b9c06108ff0643e98593c5605314d76917'';
+
+  src = fetchurl {
+    url = "https://github.com/sup-heliotrope/ncursesw-ruby/archive/afd962b9c06108ff0643e98593c5605314d76917.tar.gz";
+    sha256 = "13i286p4bm8zqg9xh96a1dg7wkywj9m6975gbh3w43d3rmfc1h6a";
+  };
+
+  meta = {
+    description = ''
+      Hacked up version of ncurses gem that supports wide characters for
+      supmua.org
+    '';
+    homepage = ''http://github.com/sup-heliotrope/ncursesw-ruby'';
+    longDescription = ''
+      This wrapper provides access to the functions, macros, global variables
+      and constants of the ncurses library.  These are mapped to a Ruby Module
+      named "Ncurses":  Functions and external variables are implemented as
+      singleton functions of the Module Ncurses.
+    '';
+  };
+
+  buildInputs = [ ncurses rubygems ];
+
+  buildPhase = "gem build ncursesw.gemspec";
+
+  installPhase = ''
+    export HOME=$TMP/home; mkdir -pv "$HOME"
+
+    # For some reason, the installation phase doesn't work with the default
+    # make install command run by gem (we'll fix it and do it ourselves later)
+    gem install --no-verbose --install-dir "$out/${ruby.gemPath}" \
+        --bindir "$out/bin" --no-rdoc --no-ri ncursesw-sup-1.3.1.2.gem || true
+
+    # Needed for ruby to recognise the gem
+    cp ncursesw.gemspec "$out/${ruby.gemPath}/specifications"
+
+    cd "$out/${ruby.gemPath}/gems/ncursesw-sup-1.3.1.2"
+    mkdir src
+    mv lib src
+    sed -i "s/srcdir = ./srcdir = src/" Makefile
+    make install
+  '';
+}
+
diff --git a/pkgs/development/libraries/smpeg/default.nix b/pkgs/development/libraries/smpeg/default.nix
index e259e22ff01..41a6b8501ec 100644
--- a/pkgs/development/libraries/smpeg/default.nix
+++ b/pkgs/development/libraries/smpeg/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchsvn, SDL, autoconf, automake, libtool, gtk, m4, pkgconfig, mesa }:
 
 stdenv.mkDerivation rec {
-  name = "smpeg-svn-${version}";
+  name = "smpeg-svn${version}";
   version = "390";
 
   src = fetchsvn {
diff --git a/pkgs/development/libraries/suitesparse/default.nix b/pkgs/development/libraries/suitesparse/default.nix
index e3a7fbb5a08..01762083934 100644
--- a/pkgs/development/libraries/suitesparse/default.nix
+++ b/pkgs/development/libraries/suitesparse/default.nix
@@ -1,10 +1,10 @@
 { stdenv, fetchurl, blas, liblapack, gfortran } :
 stdenv.mkDerivation rec {
-  version = "4.0.0";
+  version = "4.2.0";
   name = "suitesparse-${version}";
   src = fetchurl {
     url = "http://www.cise.ufl.edu/research/sparse/SuiteSparse/SuiteSparse-${version}.tar.gz" ;
-    sha256 = "1nvbdw10wa6654k8sa2vhr607q6fflcywyji5xd767cqpwag4v5j";  			
+    sha256 = "0i0ivsc5sr3jdz6nqq4wz5lwxc8rpnkqgddyhqqgfhwzgrcqh9v6";  			
   };
   buildInputs = [blas liblapack gfortran] ;
   patches = [./disable-metis.patch];
diff --git a/pkgs/development/libraries/vaapi-intel/default.nix b/pkgs/development/libraries/vaapi-intel/default.nix
index 548aeb8a2de..f05c01bf58d 100644
--- a/pkgs/development/libraries/vaapi-intel/default.nix
+++ b/pkgs/development/libraries/vaapi-intel/default.nix
@@ -2,17 +2,16 @@
 , intelgen4asm }:
 
 stdenv.mkDerivation rec {
-  name = "libva-intel-driver-1.0.19";
-  
+  name = "libva-intel-driver-1.0.20";
+
   src = fetchurl {
     url = "http://www.freedesktop.org/software/vaapi/releases/libva-intel-driver/${name}.tar.bz2";
-    sha256 = "14m7krah3ajkwj190q431lqqa84hdljcdmrcrqkbgaffyjlqvdid";
+    sha256 = "1jfl8909j3a3in6m8b5bx3dn7pzr8a1sw3sk4vzm7h3j2dkgpzhj";
   };
 
-  buildInputs = [ autoconf automake libtool mesa libva pkgconfig libdrm libX11 intelgen4asm ];
+  buildInputs = [ pkgconfig libdrm libva libX11 ];
 
   preConfigure = ''
-    sh autogen.sh
     sed -i -e "s,LIBVA_DRIVERS_PATH=.*,LIBVA_DRIVERS_PATH=$out/lib/dri," configure
   '';
 
diff --git a/pkgs/development/libraries/vaapi-vdpau/default.nix b/pkgs/development/libraries/vaapi-vdpau/default.nix
index a3d51217ead..fb24ba98b45 100644
--- a/pkgs/development/libraries/vaapi-vdpau/default.nix
+++ b/pkgs/development/libraries/vaapi-vdpau/default.nix
@@ -14,6 +14,8 @@ stdenv.mkDerivation rec {
     sed -i -e "s,LIBVA_DRIVERS_PATH=.*,LIBVA_DRIVERS_PATH=$out/lib/dri," configure
   '';
 
+  patches = [ ./glext85.patch ];
+
   meta = {
     homepage = http://cgit.freedesktop.org/vaapi/vdpau-driver/;
     license = "GPLv2+";
diff --git a/pkgs/development/libraries/vaapi-vdpau/glext85.patch b/pkgs/development/libraries/vaapi-vdpau/glext85.patch
new file mode 100644
index 00000000000..073b8cf1190
--- /dev/null
+++ b/pkgs/development/libraries/vaapi-vdpau/glext85.patch
@@ -0,0 +1,20 @@
+http://www.mail-archive.com/libva@lists.freedesktop.org/msg01457.html
+
+diff --git a/src/utils_glx.h b/src/utils_glx.h
+index 19d03e4..f270fba 100644
+--- a/src/utils_glx.h
++++ b/src/utils_glx.h
+@@ -42,6 +42,13 @@ typedef void (*PFNGLVDPAUMAPSURFACESNVPROC)(GLsizei numSurfaces, const GLvdpauSu
+ typedef void (*PFNGLVDPAUUNMAPSURFACESNVPROC)(GLsizei numSurface, const GLvdpauSurfaceNV *surfaces);
+ #endif
+ 
++#if GL_GLEXT_VERSION >= 85
++/* XXX: PFNGLMULTITEXCOORD2FPROC got out of the GL_VERSION_1_3_DEPRECATED
++   block and is not defined if GL_VERSION_1_3 is defined in <GL/gl.h>
++   Redefine the type here as an interim solution */
++typedef void (*PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);
++#endif
++
+ /* GLX_EXT_texture_from_pixmap */
+ #if GLX_GLXEXT_VERSION < 18
+ typedef void (*PFNGLXBINDTEXIMAGEEXTPROC)(Display *, GLXDrawable, int, const int *);
diff --git a/pkgs/development/libraries/wayland/default.nix b/pkgs/development/libraries/wayland/default.nix
index 9e00b0d8bcf..8854a41210b 100644
--- a/pkgs/development/libraries/wayland/default.nix
+++ b/pkgs/development/libraries/wayland/default.nix
@@ -1,23 +1,21 @@
 { stdenv, fetchurl, libffi, expat, pkgconfig, libxslt, docbook_xsl, doxygen }:
 
+let version = "1.0.5"; in
+
 stdenv.mkDerivation rec {
-  name = "wayland-1.0.5";
+  name = "wayland-${version}";
 
   src = fetchurl {
     url = "http://wayland.freedesktop.org/releases/${name}.tar.xz";
-
     sha256 = "130n7v5i7rfsrli2n8vdzfychlgd8v7by7sfgp8vfqdlss5km34w";
   };
 
   buildInputs = [ pkgconfig libffi expat libxslt docbook_xsl doxygen ];
 
   meta = {
-    description = "The reference implementation of the Wayland protocol";
-
-    homepage = http://wayland.freedesktop.org;
-
-    license = stdenv.lib.licenses.bsd3;
-
+    description = "Reference implementation of the wayland protocol";
+    homepage = http://wayland.freedesktop.org/;
+    license = stdenv.lib.licenses.mit;
     platforms = stdenv.lib.platforms.all;
   };
 }
diff --git a/pkgs/development/libraries/wxGTK-2.8/default.nix b/pkgs/development/libraries/wxGTK-2.8/default.nix
index 10907726954..e11de87415d 100644
--- a/pkgs/development/libraries/wxGTK-2.8/default.nix
+++ b/pkgs/development/libraries/wxGTK-2.8/default.nix
@@ -7,12 +7,13 @@ assert withMesa -> mesa != null;
 
 with stdenv.lib;
 
-stdenv.mkDerivation {
-  name = "wxGTK-2.8.12";
+stdenv.mkDerivation rec {
+  version = "2.8.12.1";
+  name = "wxGTK-${version}";
 
   src = fetchurl {
-    url = mirror://sourceforge/wxwindows/wxGTK-2.8.12.tar.gz;
-    sha256 = "1gjs9vfga60mk4j4ngiwsk9h6c7j22pw26m3asxr1jwvqbr8kkqk";
+    url = "mirror://sourceforge/wxpython/wxPython-src-${version}.tar.bz2";
+    sha256 = "1l1w4i113csv3bd5r8ybyj0qpxdq83lj6jrc5p7cc10mkwyiagqz";
   };
 
   buildInputs = [ gtk libXinerama libSM libXxf86vm xf86vidmodeproto gstreamer gst_plugins_base GConf ]
@@ -29,11 +30,12 @@ stdenv.mkDerivation {
     "--enable-mediactrl"
   ] ++ optional withMesa "--with-opengl";
 
-  # This variable is used by configure to find some dependencies.
+  # These variables are used by configure to find some dependencies.
   SEARCH_INCLUDE =
     "${libXinerama}/include ${libSM}/include ${libXxf86vm}/include";
-
-  SEARCH_LIB = optionalString withMesa "${mesa}/lib";
+  SEARCH_LIB =
+    "${libXinerama}/lib ${libSM}/lib ${libXxf86vm}/lib "
+    + optionalString withMesa "${mesa}/lib ";
 
   # Work around a bug in configure.
   NIX_CFLAGS_COMPILE = "-DHAVE_X11_XLIB_H=1";
diff --git a/pkgs/development/libraries/x264/default.nix b/pkgs/development/libraries/x264/default.nix
index 9f53d36bb63..51666e3ba6d 100644
--- a/pkgs/development/libraries/x264/default.nix
+++ b/pkgs/development/libraries/x264/default.nix
@@ -2,7 +2,7 @@
 
 stdenv.mkDerivation rec {
   version = "snapshot-20130424-2245-stable";
-  name = "x264-${version}";
+  name = "x264-20130424_2245";
 
   src = fetchurl {
     url = "ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-${version}.tar.bz2";