about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/applications/audio/bristol/default.nix4
-rw-r--r--pkgs/applications/gis/grass/default.nix6
-rw-r--r--pkgs/applications/gis/qgis/default.nix4
-rw-r--r--pkgs/applications/graphics/digikam/5.1.nix120
-rw-r--r--pkgs/applications/misc/electrum/default.nix6
-rw-r--r--pkgs/applications/version-management/meld/default.nix4
-rw-r--r--pkgs/applications/virtualization/virtinst/default.nix10
-rw-r--r--pkgs/applications/virtualization/virtualbox/default.nix9
-rw-r--r--pkgs/applications/window-managers/compiz/default.nix5
-rw-r--r--pkgs/desktops/gnome-3/3.20/default.nix2
-rw-r--r--pkgs/development/libraries/db/clang-4.8.patch138
-rw-r--r--pkgs/development/libraries/db/clang-5.3.patch4
-rw-r--r--pkgs/development/libraries/db/clang-6.0.patch136
-rw-r--r--pkgs/development/libraries/db/cygwin-4.4.patch21
-rw-r--r--pkgs/development/libraries/db/cygwin-4.5.patch22
-rw-r--r--pkgs/development/libraries/db/db-4.8.nix7
-rw-r--r--pkgs/development/libraries/db/db-5.3.nix5
-rw-r--r--pkgs/development/libraries/db/db-6.0.nix2
-rw-r--r--pkgs/development/libraries/db/generic.nix10
-rw-r--r--pkgs/development/libraries/db/register-race-fix.patch47
-rw-r--r--pkgs/development/libraries/jemalloc/default.nix9
-rw-r--r--pkgs/development/libraries/libdrm/default.nix9
-rw-r--r--pkgs/development/libraries/libinput/default.nix4
-rw-r--r--pkgs/development/libraries/libpng/default.nix6
-rw-r--r--pkgs/development/libraries/libxml2/default.nix16
-rw-r--r--pkgs/development/libraries/libxslt/default.nix22
-rw-r--r--pkgs/development/libraries/mesa/default.nix14
-rw-r--r--pkgs/development/libraries/mesa/dlopen-absolute-paths.diff22
-rw-r--r--pkgs/development/libraries/zeitgeist/default.nix4
-rw-r--r--pkgs/development/python-modules/bootstrapped-pip/default.nix10
-rw-r--r--pkgs/development/python-modules/poezio/make_default_config_writable.patch25
-rw-r--r--pkgs/development/python-modules/setuptools/default.nix9
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix18
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_symbols1
-rw-r--r--pkgs/os-specific/linux/alsa-lib/default.nix4
-rw-r--r--pkgs/os-specific/linux/alsa-plugins/default.nix4
-rw-r--r--pkgs/os-specific/linux/alsa-utils/default.nix4
-rw-r--r--pkgs/servers/http/apache-modules/mod_wsgi/default.nix4
-rw-r--r--pkgs/servers/x11/xorg/default.nix6
-rw-r--r--pkgs/servers/x11/xorg/tarballs-7.7.list2
-rw-r--r--pkgs/shells/rush/gets.patch13
-rw-r--r--pkgs/tools/X11/xpra/default.nix6
-rw-r--r--pkgs/tools/admin/certbot/default.nix10
-rw-r--r--pkgs/tools/archivers/gnutar/default.nix2
-rw-r--r--pkgs/tools/backup/bup/default.nix6
-rw-r--r--pkgs/top-level/all-packages.nix12
-rw-r--r--pkgs/top-level/emscripten-packages.nix2
-rw-r--r--pkgs/top-level/python-packages.nix15
48 files changed, 582 insertions, 239 deletions
diff --git a/pkgs/applications/audio/bristol/default.nix b/pkgs/applications/audio/bristol/default.nix
index e19acab36b5a1..3b94235889cf5 100644
--- a/pkgs/applications/audio/bristol/default.nix
+++ b/pkgs/applications/audio/bristol/default.nix
@@ -14,6 +14,10 @@ stdenv.mkDerivation  rec {
     xorg.xproto
   ];
 
+  patchPhase = "sed -i '41,43d' libbristolaudio/audioEngineJack.c"; # disable alsa/iatomic
+
+  configurePhase = "./configure --prefix=$out --enable-jack-default-audio --enable-jack-default-midi";
+
   preInstall = ''
     sed -e "s@\`which bristol\`@$out/bin/bristol@g" -i bin/startBristol
     sed -e "s@\`which brighton\`@$out/bin/brighton@g" -i bin/startBristol
diff --git a/pkgs/applications/gis/grass/default.nix b/pkgs/applications/gis/grass/default.nix
index fb6c76be07940..44e07cc22c0b9 100644
--- a/pkgs/applications/gis/grass/default.nix
+++ b/pkgs/applications/gis/grass/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, flex, bison, pkgconfig, zlib, libtiff, libpng, fftw
 , cairo, readline, ffmpeg, makeWrapper, wxGTK30, netcdf, blas
-, proj, gdal, geos, sqlite, postgresql, mysql, pythonPackages
+, proj, gdal, geos, sqlite, postgresql, mysql, python2Packages
 }:
 
 stdenv.mkDerivation {
@@ -12,7 +12,7 @@ stdenv.mkDerivation {
 
   buildInputs = [ flex bison zlib proj gdal libtiff libpng fftw sqlite pkgconfig cairo
   readline ffmpeg makeWrapper wxGTK30 netcdf geos postgresql mysql.client blas ]
-    ++ (with pythonPackages; [ python dateutil wxPython30 numpy ]);
+    ++ (with python2Packages; [ python dateutil wxPython30 numpy ]);
 
   configureFlags = [
     "--with-proj-share=${proj}/share/proj"
@@ -59,7 +59,7 @@ stdenv.mkDerivation {
   postInstall = ''
     wrapProgram $out/bin/grass70 \
     --set PYTHONPATH $PYTHONPATH \
-    --set GRASS_PYTHON ${pythonPackages.python}/bin/${pythonPackages.python.executable}
+    --set GRASS_PYTHON ${python2Packages.python}/bin/${python2Packages.python.executable}
     ln -s $out/grass-*/lib $out/lib
   '';
 
diff --git a/pkgs/applications/gis/qgis/default.nix b/pkgs/applications/gis/qgis/default.nix
index cce683067e703..680cf921ce26b 100644
--- a/pkgs/applications/gis/qgis/default.nix
+++ b/pkgs/applications/gis/qgis/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, gdal, cmake, qt4, flex, bison, proj, geos, xlibsWrapper, sqlite, gsl
-, qwt, fcgi, pythonPackages, libspatialindex, libspatialite, qscintilla, postgresql, makeWrapper
+, qwt, fcgi, python2Packages, libspatialindex, libspatialite, qscintilla, postgresql, makeWrapper
 , qjson, qca2, txt2tags, openssl
 , withGrass ? false, grass
 }:
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ gdal qt4 flex openssl bison proj geos xlibsWrapper sqlite gsl qwt qscintilla
     fcgi libspatialindex libspatialite postgresql qjson qca2 txt2tags ] ++
     (stdenv.lib.optional withGrass grass) ++
-    (with pythonPackages; [ numpy psycopg2 requests2 pythonPackages.qscintilla sip ]);
+    (with python2Packages; [ numpy psycopg2 requests2 python2Packages.qscintilla sip ]);
 
   nativeBuildInputs = [ cmake makeWrapper ];
 
diff --git a/pkgs/applications/graphics/digikam/5.1.nix b/pkgs/applications/graphics/digikam/5.1.nix
new file mode 100644
index 0000000000000..6bd572e99bba1
--- /dev/null
+++ b/pkgs/applications/graphics/digikam/5.1.nix
@@ -0,0 +1,120 @@
+{ stdenv, fetchurl, cmake, ecm, makeQtWrapper
+
+# For `digitaglinktree`
+, perl, sqlite
+
+, qtbase
+, qtxmlpatterns
+, qtsvg
+, qtwebkit
+
+, kconfigwidgets
+, kcoreaddons
+, kdoctools
+, kfilemetadata
+, knotifications
+, knotifyconfig
+, ktextwidgets
+, kwidgetsaddons
+, kxmlgui
+
+, bison
+, boost
+, eigen
+, exiv2
+, flex
+, jasper
+, lcms2
+, lensfun
+, libgphoto2
+, libkipi
+, liblqr1
+, libusb1
+, marble
+, mysql
+, opencv
+, threadweaver
+
+# For panorama and focus stacking
+, enblend-enfuse
+, hugin
+, gnumake
+
+, oxygen
+}:
+
+stdenv.mkDerivation rec {
+  name    = "digikam-${version}";
+  version = "5.1.0";
+
+  src = fetchurl {
+    url = "http://download.kde.org/stable/digikam/${name}.tar.xz";
+    sha256 = "1w97a5cmg39dgmjgmjwa936gcrmxjms3h2ww61qi1lny84p5x4a7";
+  };
+
+  nativeBuildInputs = [ cmake ecm makeQtWrapper ];
+
+  buildInputs = [
+    qtbase
+    qtxmlpatterns
+    qtsvg
+    qtwebkit
+
+    kconfigwidgets
+    kcoreaddons
+    kdoctools
+    kfilemetadata
+    knotifications
+    knotifyconfig
+    ktextwidgets
+    kwidgetsaddons
+    kxmlgui
+
+    bison
+    boost
+    eigen
+    exiv2
+    flex
+    jasper
+    lcms2
+    lensfun
+    libgphoto2
+    libkipi
+    liblqr1
+    libusb1
+    marble.unwrapped
+    mysql
+    opencv
+    threadweaver
+
+    oxygen
+  ];
+
+  enableParallelBuilding = true;
+
+  cmakeFlags = [
+    "-DLIBUSB_LIBRARIES=${libusb1.out}/lib"
+    "-DLIBUSB_INCLUDE_DIR=${libusb1.dev}/include/libusb-1.0"
+    "-DENABLE_MYSQLSUPPORT=1"
+    "-DENABLE_INTERNALMYSQL=1"
+  ];
+
+  fixupPhase = ''
+    substituteInPlace $out/bin/digitaglinktree \
+      --replace "/usr/bin/perl" "${perl}/bin/perl" \
+      --replace "/usr/bin/sqlite3" "${sqlite}/bin/sqlite3"
+
+    wrapQtProgram $out/bin/digikam \
+      --prefix PATH : "${gnumake}/bin:${hugin}/bin:${enblend-enfuse}/bin"
+
+    wrapQtProgram $out/bin/showfoto
+  '';
+
+  meta = {
+    description = "Photo Management Program";
+    license = stdenv.lib.licenses.gpl2;
+    homepage = http://www.digikam.org;
+    maintainers = with stdenv.lib.maintainers; [ the-kenny ];
+    platforms = stdenv.lib.platforms.linux;
+  };
+}
diff --git a/pkgs/applications/misc/electrum/default.nix b/pkgs/applications/misc/electrum/default.nix
index bc562b7d57785..458aed051a28f 100644
--- a/pkgs/applications/misc/electrum/default.nix
+++ b/pkgs/applications/misc/electrum/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchurl, pythonPackages }:
+{ stdenv, fetchurl, python2Packages }:
 
-pythonPackages.buildPythonApplication rec {
+python2Packages.buildPythonApplication rec {
   name = "electrum-${version}";
   version = "2.7.11";
 
@@ -9,7 +9,7 @@ pythonPackages.buildPythonApplication rec {
     sha256 = "0qy2ynyw57jgi7fw3xzsyy608yk4bhsda7qfw0j26zqinv52mrsb";
   };
 
-  propagatedBuildInputs = with pythonPackages; [
+  propagatedBuildInputs = with python2Packages; [
     dns
     ecdsa
     jsonrpclib
diff --git a/pkgs/applications/version-management/meld/default.nix b/pkgs/applications/version-management/meld/default.nix
index 503ae4e90b9cd..d13457ef927ac 100644
--- a/pkgs/applications/version-management/meld/default.nix
+++ b/pkgs/applications/version-management/meld/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, itstool, pythonPackages, intltool, wrapGAppsHook
+{ stdenv, fetchurl, itstool, python2Packages, intltool, wrapGAppsHook
 , libxml2, gobjectIntrospection, gtk3, gnome3, cairo, file
 }:
 
@@ -6,7 +6,7 @@
 let
   minor = "3.16";
   version = "${minor}.2";
-  inherit (pythonPackages) python buildPythonApplication pycairo pygobject3;
+  inherit (python2Packages) python buildPythonApplication pycairo pygobject3;
 in buildPythonApplication rec {
   name = "meld-${version}";
 
diff --git a/pkgs/applications/virtualization/virtinst/default.nix b/pkgs/applications/virtualization/virtinst/default.nix
index 04223d9a9e9d6..75f90c234e83e 100644
--- a/pkgs/applications/virtualization/virtinst/default.nix
+++ b/pkgs/applications/virtualization/virtinst/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, pythonPackages, intltool, libxml2Python, curl }:
+{ stdenv, fetchurl, python2Packages, intltool, libxml2Python, curl }:
 
 with stdenv.lib;
 
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
     sha256 = "175laiy49dni8hzi0cn14bbsdsigvgr9h6d9z2bcvbpa29spldvf";
   };
 
-  pythonPath = with pythonPackages;
+  pythonPath = with python2Packages;
     [ setuptools eventlet greenlet gflags netaddr carrot routes
       PasteDeploy m2crypto ipy twisted
       distutils_extra simplejson glanceclient cheetah lockfile httplib2
@@ -22,9 +22,9 @@ stdenv.mkDerivation rec {
     ];
 
   buildInputs =
-    [ pythonPackages.python
-      pythonPackages.wrapPython
-      pythonPackages.mox
+    [ python2Packages.python
+      python2Packages.wrapPython
+      python2Packages.mox
       intltool
     ] ++ pythonPath;
 
diff --git a/pkgs/applications/virtualization/virtualbox/default.nix b/pkgs/applications/virtualization/virtualbox/default.nix
index 64275448651cd..14a87151e97eb 100644
--- a/pkgs/applications/virtualization/virtualbox/default.nix
+++ b/pkgs/applications/virtualization/virtualbox/default.nix
@@ -4,7 +4,7 @@
 , which, alsaLib, curl, libvpx, gawk, nettools, dbus
 , xorriso, makeself, perl, pkgconfig
 , javaBindings ? false, jdk ? null
-, pythonBindings ? false, python ? null
+, pythonBindings ? false, python2 ? null
 , enableExtensionPack ? false, requireFile ? null, patchelf ? null, fakeroot ? null
 , pulseSupport ? false, libpulseaudio ? null
 , enableHardening ? false
@@ -15,6 +15,7 @@
 with stdenv.lib;
 
 let
+  python = python2;
   buildType = "release";
 
   inherit (importJSON ./upstream-info.json) version extpackRev extpack main;
@@ -48,10 +49,10 @@ in stdenv.mkDerivation {
 
   buildInputs =
     [ iasl dev86 libxslt libxml2 xproto libX11 libXext libXcursor libIDL
-      libcap glib lvm2 python alsaLib curl libvpx pam xorriso makeself perl
-      pkgconfig which libXmu libpng patchelfUnstable ]
+      libcap glib lvm2 alsaLib curl libvpx pam xorriso makeself perl
+      pkgconfig which libXmu libpng patchelfUnstable python ]
     ++ optional javaBindings jdk
-    ++ optional pythonBindings python
+    ++ optional pythonBindings python # Python is needed even when not building bindings
     ++ optional pulseSupport libpulseaudio
     ++ optionals (headless) [ libXrandr ]
     ++ optionals (!headless) [ qt5.qtbase qt5.qtx11extras libXinerama SDL ];
diff --git a/pkgs/applications/window-managers/compiz/default.nix b/pkgs/applications/window-managers/compiz/default.nix
index b641a571b249a..e9f5d9bdbf26c 100644
--- a/pkgs/applications/window-managers/compiz/default.nix
+++ b/pkgs/applications/window-managers/compiz/default.nix
@@ -5,14 +5,15 @@
 , libstartup_notification, libpthreadstubs, libxcb, intltool
 , ORBit2, libXau, libICE, libSM
 , dbus, dbus_glib, librsvg, mesa
-, libXdmcp, libnotify, pythonPackages
+, libXdmcp, libnotify, python2Packages
 , hicolor_icon_theme, libjpeg_turbo, libsigcxx, protobuf
 , xdg_utils
 , gettext, boost, pyrex
 , makeWrapper
 }:
 let
-  inherit (pythonPackages) python dbus-python pygtk;
+  # FIXME: Use python.withPackages so we can get rid of PYTHONPATH wrapper
+  inherit (python2Packages) python dbus-python pygtk;
 
   s = # Generated upstream information
   rec {
diff --git a/pkgs/desktops/gnome-3/3.20/default.nix b/pkgs/desktops/gnome-3/3.20/default.nix
index e935552b9f5fb..4facdbfd3e3c7 100644
--- a/pkgs/desktops/gnome-3/3.20/default.nix
+++ b/pkgs/desktops/gnome-3/3.20/default.nix
@@ -307,7 +307,7 @@ let
 
 #### Dev http://ftp.gnome.org/pub/GNOME/devtools/
 
-  anjuta = callPackage ./devtools/anjuta { };
+  anjuta = callPackage ./devtools/anjuta { python=pkgs.python2; };
 
   devhelp = callPackage ./devtools/devhelp { };
 
diff --git a/pkgs/development/libraries/db/clang-4.8.patch b/pkgs/development/libraries/db/clang-4.8.patch
index c53160a829703..bbb7789149777 100644
--- a/pkgs/development/libraries/db/clang-4.8.patch
+++ b/pkgs/development/libraries/db/clang-4.8.patch
@@ -1,13 +1,22 @@
 diff --git a/dbinc/atomic.h b/dbinc/atomic.h
-index 0034dcc..fa7ba93 100644
+index 0034dcc..160c8ea 100644
 --- a/dbinc/atomic.h
 +++ b/dbinc/atomic.h
+@@ -70,7 +70,7 @@ typedef struct {
+  * These have no memory barriers; the caller must include them when necessary.
+  */
+ #define	atomic_read(p)		((p)->value)
+-#define	atomic_init(p, val)	((p)->value = (val))
++#define	atomic_init_db(p, val)	((p)->value = (val))
+ 
+ #ifdef HAVE_ATOMIC_SUPPORT
+ 
 @@ -144,7 +144,7 @@ typedef LONG volatile *interlocked_val;
  #define	atomic_inc(env, p)	__atomic_inc(p)
  #define	atomic_dec(env, p)	__atomic_dec(p)
  #define	atomic_compare_exchange(env, p, o, n)	\
 -	__atomic_compare_exchange((p), (o), (n))
-+	__db_atomic_compare_exchange((p), (o), (n))
++	__atomic_compare_exchange_int((p), (o), (n))
  static inline int __atomic_inc(db_atomic_t *p)
  {
  	int	temp;
@@ -16,7 +25,130 @@ index 0034dcc..fa7ba93 100644
   * which configure could be changed to use.
   */
 -static inline int __atomic_compare_exchange(
-+static inline int __db_atomic_compare_exchange(
++static inline int __atomic_compare_exchange_int(
  	db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
  {
  	atomic_value_t was;
+@@ -206,7 +206,7 @@ static inline int __atomic_compare_exchange(
+ #define	atomic_dec(env, p)	(--(p)->value)
+ #define	atomic_compare_exchange(env, p, oldval, newval)		\
+ 	(DB_ASSERT(env, atomic_read(p) == (oldval)),		\
+-	atomic_init(p, (newval)), 1)
++	atomic_init_db(p, (newval)), 1)
+ #else
+ #define atomic_inc(env, p)	__atomic_inc(env, p)
+ #define atomic_dec(env, p)	__atomic_dec(env, p)
+diff --git a/dbinc/db.in b/dbinc/db.in
+index 9fc6712..7428e0a 100644
+--- a/dbinc/db.in
++++ b/dbinc/db.in
+@@ -2413,7 +2413,7 @@ typedef struct {
+ #define	fetch(a)	__db_dbm_fetch@DB_VERSION_UNIQUE_NAME@(a)
+ #define	firstkey	__db_dbm_firstkey@DB_VERSION_UNIQUE_NAME@
+ #define	nextkey(a)	__db_dbm_nextkey@DB_VERSION_UNIQUE_NAME@(a)
+-#define	store(a, b)	__db_dbm_store@DB_VERSION_UNIQUE_NAME@(a, b)
++#define	store_db(a, b)	__db_dbm_store@DB_VERSION_UNIQUE_NAME@(a, b)
+ 
+ /*******************************************************
+  * Hsearch historic interface.
+diff --git a/mp/mp_fget.c b/mp/mp_fget.c
+index 5fdee5a..0b75f57 100644
+--- a/mp/mp_fget.c
++++ b/mp/mp_fget.c
+@@ -617,7 +617,7 @@ alloc:		/* Allocate a new buffer header and data space. */
+ 
+ 		/* Initialize enough so we can call __memp_bhfree. */
+ 		alloc_bhp->flags = 0;
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ #ifdef DIAGNOSTIC
+ 		if ((uintptr_t)alloc_bhp->buf & (sizeof(size_t) - 1)) {
+ 			__db_errx(env,
+@@ -911,7 +911,7 @@ alloc:		/* Allocate a new buffer header and data space. */
+ 			MVCC_MPROTECT(bhp->buf, mfp->stat.st_pagesize,
+ 			    PROT_READ);
+ 
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ 		MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+ 		alloc_bhp->priority = bhp->priority;
+ 		alloc_bhp->pgno = bhp->pgno;
+diff --git a/mp/mp_mvcc.c b/mp/mp_mvcc.c
+index 34467d2..f05aa0c 100644
+--- a/mp/mp_mvcc.c
++++ b/mp/mp_mvcc.c
+@@ -276,7 +276,7 @@ __memp_bh_freeze(dbmp, infop, hp, bhp, need_frozenp)
+ #else
+ 	memcpy(frozen_bhp, bhp, SSZA(BH, buf));
+ #endif
+-	atomic_init(&frozen_bhp->ref, 0);
++	atomic_init_db(&frozen_bhp->ref, 0);
+ 	if (mutex != MUTEX_INVALID)
+ 		frozen_bhp->mtx_buf = mutex;
+ 	else if ((ret = __mutex_alloc(env, MTX_MPOOL_BH,
+@@ -428,7 +428,7 @@ __memp_bh_thaw(dbmp, infop, hp, frozen_bhp, alloc_bhp)
+ #endif
+ 		alloc_bhp->mtx_buf = mutex;
+ 		MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ 		F_CLR(alloc_bhp, BH_FROZEN);
+ 	}
+ 
+diff --git a/mp/mp_region.c b/mp/mp_region.c
+index e6cece9..ddbe906 100644
+--- a/mp/mp_region.c
++++ b/mp/mp_region.c
+@@ -224,7 +224,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
+ 			     MTX_MPOOL_FILE_BUCKET, 0, &htab[i].mtx_hash)) != 0)
+ 				return (ret);
+ 			SH_TAILQ_INIT(&htab[i].hash_bucket);
+-			atomic_init(&htab[i].hash_page_dirty, 0);
++			atomic_init_db(&htab[i].hash_page_dirty, 0);
+ 		}
+ 
+ 		/*
+@@ -269,7 +269,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
+ 		hp->mtx_hash = (mtx_base == MUTEX_INVALID) ? MUTEX_INVALID :
+ 		    mtx_base + i;
+ 		SH_TAILQ_INIT(&hp->hash_bucket);
+-		atomic_init(&hp->hash_page_dirty, 0);
++		atomic_init_db(&hp->hash_page_dirty, 0);
+ #ifdef HAVE_STATISTICS
+ 		hp->hash_io_wait = 0;
+ 		hp->hash_frozen = hp->hash_thawed = hp->hash_frozen_freed = 0;
+diff --git a/mutex/mut_method.c b/mutex/mut_method.c
+index 2588763..5c6d516 100644
+--- a/mutex/mut_method.c
++++ b/mutex/mut_method.c
+@@ -426,7 +426,7 @@ atomic_compare_exchange(env, v, oldval, newval)
+ 	MUTEX_LOCK(env, mtx);
+ 	ret = atomic_read(v) == oldval;
+ 	if (ret)
+-		atomic_init(v, newval);
++		atomic_init_db(v, newval);
+ 	MUTEX_UNLOCK(env, mtx);
+ 
+ 	return (ret);
+diff --git a/mutex/mut_tas.c b/mutex/mut_tas.c
+index f3922e0..e40fcdf 100644
+--- a/mutex/mut_tas.c
++++ b/mutex/mut_tas.c
+@@ -46,7 +46,7 @@ __db_tas_mutex_init(env, mutex, flags)
+ 
+ #ifdef HAVE_SHARED_LATCHES
+ 	if (F_ISSET(mutexp, DB_MUTEX_SHARED))
+-		atomic_init(&mutexp->sharecount, 0);
++		atomic_init_db(&mutexp->sharecount, 0);
+ 	else
+ #endif
+ 	if (MUTEX_INIT(&mutexp->tas)) {
+@@ -486,7 +486,7 @@ __db_tas_mutex_unlock(env, mutex)
+ 			F_CLR(mutexp, DB_MUTEX_LOCKED);
+ 			/* Flush flag update before zeroing count */
+ 			MEMBAR_EXIT();
+-			atomic_init(&mutexp->sharecount, 0);
++			atomic_init_db(&mutexp->sharecount, 0);
+ 		} else {
+ 			DB_ASSERT(env, sharecount > 0);
+ 			MEMBAR_EXIT();
diff --git a/pkgs/development/libraries/db/clang-5.3.patch b/pkgs/development/libraries/db/clang-5.3.patch
index 0a0993da13e19..1cfb13ca8e689 100644
--- a/pkgs/development/libraries/db/clang-5.3.patch
+++ b/pkgs/development/libraries/db/clang-5.3.patch
@@ -16,7 +16,7 @@ index 6a858f7..9f338dc 100644
  #define	atomic_dec(env, p)	__atomic_dec(p)
  #define	atomic_compare_exchange(env, p, o, n)	\
 -	__atomic_compare_exchange((p), (o), (n))
-+	__atomic_compare_exchange_db((p), (o), (n))
++	__atomic_compare_exchange_int((p), (o), (n))
  static inline int __atomic_inc(db_atomic_t *p)
  {
  	int	temp;
@@ -25,7 +25,7 @@ index 6a858f7..9f338dc 100644
   * which configure could be changed to use.
   */
 -static inline int __atomic_compare_exchange(
-+static inline int __atomic_compare_exchange_db(
++static inline int __atomic_compare_exchange_int(
  	db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
  {
  	atomic_value_t was;
diff --git a/pkgs/development/libraries/db/clang-6.0.patch b/pkgs/development/libraries/db/clang-6.0.patch
new file mode 100644
index 0000000000000..5c1e8f506c4e5
--- /dev/null
+++ b/pkgs/development/libraries/db/clang-6.0.patch
@@ -0,0 +1,136 @@
+diff --git a/src/dbinc/atomic.h b/src/dbinc/atomic.h
+index e4420aa..4799b5f 100644
+--- a/src/dbinc/atomic.h
++++ b/src/dbinc/atomic.h
+@@ -70,7 +70,7 @@ typedef struct {
+  * These have no memory barriers; the caller must include them when necessary.
+  */
+ #define	atomic_read(p)		((p)->value)
+-#define	atomic_init(p, val)	((p)->value = (val))
++#define	atomic_init_db(p, val)	((p)->value = (val))
+ 
+ #ifdef HAVE_ATOMIC_SUPPORT
+ 
+@@ -225,7 +225,7 @@ static inline int __atomic_compare_exchange_int(
+ #define	atomic_dec(env, p)	(--(p)->value)
+ #define	atomic_compare_exchange(env, p, oldval, newval)		\
+ 	(DB_ASSERT(env, atomic_read(p) == (oldval)),		\
+-	atomic_init(p, (newval)), 1)
++	atomic_init_db(p, (newval)), 1)
+ #else
+ #define	atomic_inc(env, p)	__atomic_inc_int(env, p)
+ #define	atomic_dec(env, p)	__atomic_dec_int(env, p)
+diff --git a/src/dbinc/db.in b/src/dbinc/db.in
+index 3c2ad9b..3e46f02 100644
+--- a/src/dbinc/db.in
++++ b/src/dbinc/db.in
+@@ -2999,7 +2999,7 @@ typedef struct {
+ #define	fetch(a)	__db_dbm_fetch@DB_VERSION_UNIQUE_NAME@(a)
+ #define	firstkey	__db_dbm_firstkey@DB_VERSION_UNIQUE_NAME@
+ #define	nextkey(a)	__db_dbm_nextkey@DB_VERSION_UNIQUE_NAME@(a)
+-#define	store(a, b)	__db_dbm_store@DB_VERSION_UNIQUE_NAME@(a, b)
++#define	store_db(a, b)	__db_dbm_store@DB_VERSION_UNIQUE_NAME@(a, b)
+ 
+ /*******************************************************
+  * Hsearch historic interface.
+diff --git a/src/mp/mp_fget.c b/src/mp/mp_fget.c
+index 59fe9fe..fa4ced7 100644
+--- a/src/mp/mp_fget.c
++++ b/src/mp/mp_fget.c
+@@ -654,7 +654,7 @@ alloc:		/* Allocate a new buffer header and data space. */
+ 
+ 		/* Initialize enough so we can call __memp_bhfree. */
+ 		alloc_bhp->flags = 0;
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ #ifdef DIAGNOSTIC
+ 		if ((uintptr_t)alloc_bhp->buf & (sizeof(size_t) - 1)) {
+ 			__db_errx(env, DB_STR("3025",
+@@ -969,7 +969,7 @@ alloc:		/* Allocate a new buffer header and data space. */
+ 			MVCC_MPROTECT(bhp->buf, mfp->pagesize,
+ 			    PROT_READ);
+ 
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ 		MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+ 		alloc_bhp->priority = bhp->priority;
+ 		alloc_bhp->pgno = bhp->pgno;
+diff --git a/src/mp/mp_mvcc.c b/src/mp/mp_mvcc.c
+index 83c4d72..0a47202 100644
+--- a/src/mp/mp_mvcc.c
++++ b/src/mp/mp_mvcc.c
+@@ -281,7 +281,7 @@ __memp_bh_freeze(dbmp, infop, hp, bhp, need_frozenp)
+ #else
+ 	memcpy(frozen_bhp, bhp, SSZA(BH, buf));
+ #endif
+-	atomic_init(&frozen_bhp->ref, 0);
++	atomic_init_db(&frozen_bhp->ref, 0);
+ 	if (mutex != MUTEX_INVALID)
+ 		frozen_bhp->mtx_buf = mutex;
+ 	else if ((ret = __mutex_alloc(env, MTX_MPOOL_BH,
+@@ -440,7 +440,7 @@ __memp_bh_thaw(dbmp, infop, hp, frozen_bhp, alloc_bhp)
+ #endif
+ 		alloc_bhp->mtx_buf = mutex;
+ 		MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+-		atomic_init(&alloc_bhp->ref, 1);
++		atomic_init_db(&alloc_bhp->ref, 1);
+ 		F_CLR(alloc_bhp, BH_FROZEN);
+ 	}
+ 
+diff --git a/src/mp/mp_region.c b/src/mp/mp_region.c
+index 4d95e4f..e97459c 100644
+--- a/src/mp/mp_region.c
++++ b/src/mp/mp_region.c
+@@ -278,7 +278,7 @@ __memp_init(env, dbmp, reginfo_off, htab_buckets, max_nreg)
+ 			     MTX_MPOOL_FILE_BUCKET, 0, &htab[i].mtx_hash)) != 0)
+ 				return (ret);
+ 			SH_TAILQ_INIT(&htab[i].hash_bucket);
+-			atomic_init(&htab[i].hash_page_dirty, 0);
++			atomic_init_db(&htab[i].hash_page_dirty, 0);
+ 		}
+ 
+ 		mtx_base = mtx_prev = MUTEX_INVALID;
+@@ -332,7 +332,7 @@ no_prealloc:
+ 		    DB_MUTEX_SHARED, &hp->mtx_hash)) != 0)
+ 			return (ret);
+ 		SH_TAILQ_INIT(&hp->hash_bucket);
+-		atomic_init(&hp->hash_page_dirty, 0);
++		atomic_init_db(&hp->hash_page_dirty, 0);
+ #ifdef HAVE_STATISTICS
+ 		hp->hash_io_wait = 0;
+ 		hp->hash_frozen = hp->hash_thawed = hp->hash_frozen_freed = 0;
+diff --git a/src/mutex/mut_method.c b/src/mutex/mut_method.c
+index 72b34de..a9f9868 100644
+--- a/src/mutex/mut_method.c
++++ b/src/mutex/mut_method.c
+@@ -501,7 +501,7 @@ __atomic_compare_exchange_int(env, v, oldval, newval)
+ 	MUTEX_LOCK(env, mtx);
+ 	ret = atomic_read(v) == oldval;
+ 	if (ret)
+-		atomic_init(v, newval);
++		atomic_init_db(v, newval);
+ 	MUTEX_UNLOCK(env, mtx);
+ 
+ 	return (ret);
+diff --git a/src/mutex/mut_tas.c b/src/mutex/mut_tas.c
+index 7899c4b..d9420fa 100644
+--- a/src/mutex/mut_tas.c
++++ b/src/mutex/mut_tas.c
+@@ -47,7 +47,7 @@ __db_tas_mutex_init(env, mutex, flags)
+ 
+ #ifdef HAVE_SHARED_LATCHES
+ 	if (F_ISSET(mutexp, DB_MUTEX_SHARED))
+-		atomic_init(&mutexp->sharecount, 0);
++		atomic_init_db(&mutexp->sharecount, 0);
+ 	else
+ #endif
+ 	if (MUTEX_INIT(&mutexp->tas)) {
+@@ -643,7 +643,7 @@ was_not_locked:
+ 			F_CLR(mutexp, DB_MUTEX_LOCKED);
+ 			/* Flush flag update before zeroing count */
+ 			MEMBAR_EXIT();
+-			atomic_init(&mutexp->sharecount, 0);
++			atomic_init_db(&mutexp->sharecount, 0);
+ 		} else {
+ 			DB_ASSERT(env, sharecount > 0);
+ 			MEMBAR_EXIT();
diff --git a/pkgs/development/libraries/db/cygwin-4.4.patch b/pkgs/development/libraries/db/cygwin-4.4.patch
deleted file mode 100644
index 3f9d658b5dac7..0000000000000
--- a/pkgs/development/libraries/db/cygwin-4.4.patch
+++ /dev/null
@@ -1,21 +0,0 @@
-diff -rc db-4.4.20.NC-old/os/os_flock.c db-4.4.20.NC/os/os_flock.c
-*** db-4.4.20.NC-old/os/os_flock.c	Mon Jun 20 16:59:01 2005
---- db-4.4.20.NC/os/os_flock.c	Wed Jun  7 17:01:49 2006
-***************
-*** 36,41 ****
---- 36,50 ----
-  
-  	DB_ASSERT(F_ISSET(fhp, DB_FH_OPENED) && fhp->fd != -1);
-  
-+ #ifdef __CYGWIN__
-+ 	/*
-+ 	 * Windows file locking interferes with read/write operations, so we
-+ 	 * map the ranges to an area past the end of the file.
-+ 	 */
-+ 	DB_ASSERT(offset < (off_t) 1 << 62);
-+ 	offset += (off_t) 1 << 62;
-+ #endif
-+ 
-  #ifdef HAVE_FCNTL
-  	fl.l_start = offset;
-  	fl.l_len = 1;
diff --git a/pkgs/development/libraries/db/cygwin-4.5.patch b/pkgs/development/libraries/db/cygwin-4.5.patch
deleted file mode 100644
index 3f0ee78a70855..0000000000000
--- a/pkgs/development/libraries/db/cygwin-4.5.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-diff -rc db-4.5.20-orig/os/os_flock.c db-4.5.20/os/os_flock.c
-*** db-4.5.20-orig/os/os_flock.c	2006-10-13 12:36:12.000000000 +0200
---- db-4.5.20/os/os_flock.c	2006-10-13 12:40:11.000000000 +0200
-***************
-*** 30,35 ****
---- 30,44 ----
-  
-  	DB_ASSERT(dbenv, F_ISSET(fhp, DB_FH_OPENED) && fhp->fd != -1);
-  
-+ #ifdef __CYGWIN__
-+ 	/*
-+ 	 * Windows file locking interferes with read/write operations, so we
-+ 	 * map the ranges to an area past the end of the file.
-+ 	 */
-+ 	DB_ASSERT(dbenv, offset < (off_t) 1 << 62);
-+ 	offset += (off_t) 1 << 62;
-+ #endif
-+ 
-  	fl.l_start = offset;
-  	fl.l_len = 1;
-  	fl.l_type = acquire ? F_WRLCK : F_UNLCK;
-Only in db-4.5.20/os: os_flock.c~
diff --git a/pkgs/development/libraries/db/db-4.8.nix b/pkgs/development/libraries/db/db-4.8.nix
index 40869a865ae5f..bce91e5a94019 100644
--- a/pkgs/development/libraries/db/db-4.8.nix
+++ b/pkgs/development/libraries/db/db-4.8.nix
@@ -2,8 +2,9 @@
 
 import ./generic.nix (args // rec {
   version = "4.8.30";
-  extraPatches = [ ./clang-4.8.patch ];
   sha256 = "0ampbl2f0hb1nix195kz1syrqqxpmvnvnfvphambj7xjrl3iljg0";
-  branch = "4.8";
-  drvArgs = { hardeningDisable = [ "format" ]; };
+  extraPatches = [ ./clang-4.8.patch ];
+
+  drvArgs.hardeningDisable = [ "format" ];
+  drvArgs.doCheck = false;
 })
diff --git a/pkgs/development/libraries/db/db-5.3.nix b/pkgs/development/libraries/db/db-5.3.nix
index 91adfa24b58dc..d1d3c953fc9f8 100644
--- a/pkgs/development/libraries/db/db-5.3.nix
+++ b/pkgs/development/libraries/db/db-5.3.nix
@@ -3,9 +3,6 @@
 import ./generic.nix (args // rec {
   version = "5.3.28";
   sha256 = "0a1n5hbl7027fbz5lm0vp0zzfp1hmxnz14wx3zl9563h83br5ag0";
-  branch = "5.3";
-  # https://community.oracle.com/thread/3952592
-  # this patch renames some sybols that conflict with libc++-3.8
-  # symbols: atomic_compare_exchange, atomic_init, store
+  license = stdenv.lib.licenses.agpl3;
   extraPatches = [ ./clang-5.3.patch ];
 })
diff --git a/pkgs/development/libraries/db/db-6.0.nix b/pkgs/development/libraries/db/db-6.0.nix
index 716cad9ab074a..b7c5667b883e5 100644
--- a/pkgs/development/libraries/db/db-6.0.nix
+++ b/pkgs/development/libraries/db/db-6.0.nix
@@ -4,5 +4,5 @@ import ./generic.nix (args // rec {
   version = "6.0.20";
   sha256 = "00r2aaglq625y8r9xd5vw2y070plp88f1mb2gbq3kqsl7128lsl0";
   license = stdenv.lib.licenses.agpl3;
-  branch = "6.0";
+  extraPatches = [ ./clang-6.0.patch ];
 })
diff --git a/pkgs/development/libraries/db/generic.nix b/pkgs/development/libraries/db/generic.nix
index fdc828effdfbe..a6f9c676bba0d 100644
--- a/pkgs/development/libraries/db/generic.nix
+++ b/pkgs/development/libraries/db/generic.nix
@@ -4,9 +4,8 @@
 
 # Options from inherited versions
 , version, sha256
-, extraPatches ? [ ]
+, patchSrc ? "src", extraPatches ? [ ]
 , license ? stdenv.lib.licenses.sleepycat
-, branch ? null
 , drvArgs ? {}
 }:
 
@@ -36,11 +35,16 @@ stdenv.mkDerivation (rec {
     rm -rf $out/docs
   '';
 
+  doCheck = true;
+
+  checkPhase = ''
+    make examples_c examples_cxx
+  '';
+
   meta = with stdenv.lib; {
     homepage = "http://www.oracle.com/technetwork/database/database-technologies/berkeleydb/index.html";
     description = "Berkeley DB";
     license = license;
     platforms = platforms.unix;
-    branch = branch;
   };
 } // drvArgs)
diff --git a/pkgs/development/libraries/db/register-race-fix.patch b/pkgs/development/libraries/db/register-race-fix.patch
deleted file mode 100644
index bb05c966e5bd6..0000000000000
--- a/pkgs/development/libraries/db/register-race-fix.patch
+++ /dev/null
@@ -1,47 +0,0 @@
-diff -rc db-4.5.20-orig/env/env_register.c db-4.5.20/env/env_register.c
-*** db-4.5.20-orig/env/env_register.c	2006-09-09 16:29:04.000000000 +0200
---- db-4.5.20/env/env_register.c	2007-05-16 21:13:27.000000000 +0200
-***************
-*** 255,260 ****
---- 255,262 ----
-  			buf[nr - 1] = '\0';
-  		}
-  
-+                 //sleep(3);
-+ 
-  		pos = (off_t)lcnt * PID_LEN;
-  		if (REGISTRY_LOCK(dbenv, pos, 1) == 0) {
-  			if ((ret = REGISTRY_UNLOCK(dbenv, pos)) != 0)
-***************
-*** 361,366 ****
---- 363,392 ----
-  	if (recovery_failed)
-  		goto err;
-  
-+         //sleep(5);
-+ 
-+         /*
-+          * Acquire an exclusive lock to prevent a race like this:
-+          *
-+          * 1) Process X is about to exit and process Y is just
-+          *    starting.
-+          * 2) Process Y reads X's slot.
-+          * 3) Process X clears its slot.
-+          * 4) Process Y sees that X's slot isn't cleared yet (since it
-+          *    just read the old value).
-+          * 5) Process X closes the registry, releases the lock on its
-+          *    slot.
-+          * 6) Process Y tries to acquire X's slot and succeeds, so it
-+          *    concludes that X died and recovery is needed.
-+          *
-+          * A more efficient solution to this problem would be to let
-+          * __envreg_add acquire the lock on a slot first, and *then*
-+          * read the slot (instead of the other way around).  Then we
-+          * wouldn't need the exclusive lock here.
-+          */
-+ 	if ((ret = REGISTRY_EXCL_LOCK(dbenv, 0)) != 0)
-+ 		goto err;
-+ 
-  	/*
-  	 * Why isn't an exclusive lock necessary to discard a DB_ENV handle?
-  	 *
diff --git a/pkgs/development/libraries/jemalloc/default.nix b/pkgs/development/libraries/jemalloc/default.nix
index a332487d4edf2..84638bc01ea63 100644
--- a/pkgs/development/libraries/jemalloc/default.nix
+++ b/pkgs/development/libraries/jemalloc/default.nix
@@ -1,11 +1,12 @@
 { stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "jemalloc-4.1.1";
+  name = "jemalloc-${version}";
+  version = "4.3.1";
 
   src = fetchurl {
-    url = "http://www.canonware.com/download/jemalloc/${name}.tar.bz2";
-    sha256 = "1bmdr51wxiir595k2r6z9a7rcgm42kkgnr586xir7vdcndr3pwf8";
+    url = "https://github.com/jemalloc/jemalloc/releases/download/${version}/${name}.tar.bz2";
+    sha256 = "12r71i8nm3vwz21fc16rwbb0pwcg5s05n1qg3rwl2s85v0x1ifzp";
   };
 
   # By default, jemalloc puts a je_ prefix onto all its symbols on OSX, which
@@ -14,7 +15,7 @@ stdenv.mkDerivation rec {
   configureFlags = stdenv.lib.optional stdenv.isDarwin "--with-jemalloc-prefix=";
 
   meta = with stdenv.lib; {
-    homepage = http://www.canonware.com/jemalloc/index.html;
+    homepage = http://jemalloc.net;
     description = "General purpose malloc(3) implementation";
     longDescription = ''
       malloc(3)-compatible memory allocator that emphasizes fragmentation
diff --git a/pkgs/development/libraries/libdrm/default.nix b/pkgs/development/libraries/libdrm/default.nix
index f2174470becff..a0923a15d4ad0 100644
--- a/pkgs/development/libraries/libdrm/default.nix
+++ b/pkgs/development/libraries/libdrm/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkgconfig, libpthreadstubs, libpciaccess, udev, valgrind }:
+{ stdenv, fetchurl, pkgconfig, libpthreadstubs, libpciaccess, valgrind }:
 
 stdenv.mkDerivation rec {
-  name = "libdrm-2.4.71";
+  name = "libdrm-2.4.73";
 
   src = fetchurl {
     url = "http://dri.freedesktop.org/libdrm/${name}.tar.bz2";
-    sha256 = "c66287ddeee5f46ea8f8880b94b80acb3bbc33ba6321d17767eef145046df9b8";
+    sha256 = "0kayvwqqrjm45y6dk9q2b4gmjdasci0y28jzv4bq05py8a9d7gwn";
   };
 
   outputs = [ "out" "dev" ];
@@ -13,7 +13,6 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ libpthreadstubs libpciaccess ];
     # libdrm as of 2.4.70 does not actually do anything with udev.
-    #++ stdenv.lib.optional stdenv.isLinux udev;
 
   patches = stdenv.lib.optional stdenv.isDarwin ./libdrm-apple.patch;
 
@@ -21,7 +20,6 @@ stdenv.mkDerivation rec {
     "echo : \\\${ac_cv_func_clock_gettime=\'yes\'} > config.cache";
 
   configureFlags = [ "--enable-freedreno" "--disable-valgrind" ]
-    ++ stdenv.lib.optional stdenv.isLinux "--enable-udev"
     ++ stdenv.lib.optional stdenv.isDarwin "-C";
 
   crossAttrs.configureFlags = configureFlags ++ [ "--disable-intel" ];
@@ -30,7 +28,6 @@ stdenv.mkDerivation rec {
     homepage = http://dri.freedesktop.org/libdrm/;
     description = "Library for accessing the kernel's Direct Rendering Manager";
     license = "bsd";
-    maintainers = [ stdenv.lib.maintainers.urkud ];
     platforms = stdenv.lib.platforms.unix;
   };
 }
diff --git a/pkgs/development/libraries/libinput/default.nix b/pkgs/development/libraries/libinput/default.nix
index a3b0116291418..f0257ed8a44b3 100644
--- a/pkgs/development/libraries/libinput/default.nix
+++ b/pkgs/development/libraries/libinput/default.nix
@@ -17,11 +17,11 @@ in
 with stdenv.lib;
 stdenv.mkDerivation rec {
   name = "libinput-${version}";
-  version = "1.5.0";
+  version = "1.5.1";
 
   src = fetchurl {
     url = "http://www.freedesktop.org/software/libinput/${name}.tar.xz";
-    sha256 = "0708259k2qpdyi8z8n74d2pprjdvivmqkskjkq7s7ypchn9mb5js";
+    sha256 = "d4f63933b0967bd691735af5e3919e2d29c2121d4e05867cc4e10ff3ae8e2dd8";
   };
 
   outputs = [ "out" "dev" ];
diff --git a/pkgs/development/libraries/libpng/default.nix b/pkgs/development/libraries/libpng/default.nix
index ea6e1e50035d0..a20bc7e5f3c51 100644
--- a/pkgs/development/libraries/libpng/default.nix
+++ b/pkgs/development/libraries/libpng/default.nix
@@ -3,11 +3,11 @@
 assert zlib != null;
 
 let
-  version = "1.6.23";
-  sha256 = "1wb2j8sba6g2h4vmv4pwsp93q74qw4gyqqs4b7vfjmpcv9xix4kd";
+  version = "1.6.26";
+  sha256 = "1ybkgcqqsd4iiiyv60pxjfi1csszb50bd2cxxsy3sv4q4sil6rr6";
   patch_src = fetchurl {
     url = "mirror://sourceforge/libpng-apng/libpng-${version}-apng.patch.gz";
-    sha256 = "1lvsn1kmarzpn269zgykjfmxq16zrdhpd1a75nzgclx97436x408";
+    sha256 = "0b6p2k4afvhk1svargpllcvhxb4g3p857wkqk85cks0yv42ckph1";
   };
   whenPatched = stdenv.lib.optionalString apngSupport;
 
diff --git a/pkgs/development/libraries/libxml2/default.nix b/pkgs/development/libraries/libxml2/default.nix
index 4831f150f45b5..80354b10f3b99 100644
--- a/pkgs/development/libraries/libxml2/default.nix
+++ b/pkgs/development/libraries/libxml2/default.nix
@@ -1,5 +1,5 @@
 { stdenv, lib, fetchurl, zlib, xz, python2, findXMLCatalogs, libiconv, fetchpatch
-, supportPython ? (! stdenv ? cross) }:
+, pythonSupport ? (! stdenv ? cross) }:
 
 let
   python = python2;
@@ -28,10 +28,10 @@ in stdenv.mkDerivation rec {
   };
 
   outputs = [ "bin" "dev" "out" "doc" ]
-    ++ lib.optional supportPython "py";
-  propagatedBuildOutputs = "out bin" + lib.optionalString supportPython " py";
+    ++ lib.optional pythonSupport "py";
+  propagatedBuildOutputs = "out bin" + lib.optionalString pythonSupport " py";
 
-  buildInputs = lib.optional supportPython python
+  buildInputs = lib.optional pythonSupport python
     # Libxml2 has an optional dependency on liblzma.  However, on impure
     # platforms, it may end up using that from /usr/lib, and thus lack a
     # RUNPATH for that, leading to undefined references for its users.
@@ -39,7 +39,7 @@ in stdenv.mkDerivation rec {
 
   propagatedBuildInputs = [ zlib findXMLCatalogs ];
 
-  configureFlags = lib.optional supportPython "--with-python=${python}"
+  configureFlags = lib.optional pythonSupport "--with-python=${python}"
     ++ [ "--exec_prefix=$dev" ];
 
   enableParallelBuilding = true;
@@ -55,9 +55,9 @@ in stdenv.mkDerivation rec {
     propagatedBuildInputs =  [ findXMLCatalogs libiconv ];
   };
 
-  preInstall = lib.optionalString supportPython
+  preInstall = lib.optionalString pythonSupport
     ''substituteInPlace python/libxml2mod.la --replace "${python}" "$py"'';
-  installFlags = lib.optionalString supportPython
+  installFlags = lib.optionalString pythonSupport
     ''pythondir="$(py)/lib/${python.libPrefix}/site-packages"'';
 
   postFixup = ''
@@ -66,7 +66,7 @@ in stdenv.mkDerivation rec {
     moveToOutput share/man/man1 "$bin"
   '';
 
-  passthru = { inherit version; pythonSupport = supportPython; };
+  passthru = { inherit version; pythonSupport = pythonSupport; };
 
   meta = {
     homepage = http://xmlsoft.org/;
diff --git a/pkgs/development/libraries/libxslt/default.nix b/pkgs/development/libraries/libxslt/default.nix
index 2afbfc2fe9973..df05431947916 100644
--- a/pkgs/development/libraries/libxslt/default.nix
+++ b/pkgs/development/libraries/libxslt/default.nix
@@ -1,4 +1,9 @@
-{ stdenv, fetchurl, fetchpatch, libxml2, findXMLCatalogs }:
+{ stdenv, fetchurl, fetchpatch, libxml2, findXMLCatalogs
+, pythonSupport ? true, python2
+}:
+
+assert pythonSupport -> python2 != null;
+assert pythonSupport -> libxml2.pythonSupport;
 
 stdenv.mkDerivation rec {
   name = "libxslt-1.1.29";
@@ -10,26 +15,33 @@ stdenv.mkDerivation rec {
 
   patches = stdenv.lib.optional stdenv.isSunOS ./patch-ah.patch;
 
-  outputs = [ "bin" "dev" "out" "doc" ];
+  outputs = [ "bin" "dev" "out" "doc" ] ++ stdenv.lib.optional pythonSupport "py";
 
-  buildInputs = [ libxml2 ];
+  buildInputs = [ libxml2.dev ] ++ stdenv.lib.optionals pythonSupport [ libxml2.py python2 ];
 
   propagatedBuildInputs = [ findXMLCatalogs ];
 
   configureFlags = [
-    "--without-python"
     "--without-crypto"
     "--without-debug"
     "--without-mem-debug"
     "--without-debugger"
-  ];
+  ] ++ stdenv.lib.optional pythonSupport "--with-python=${python2}";
 
   postFixup = ''
     moveToOutput bin/xslt-config "$dev"
     moveToOutput lib/xsltConf.sh "$dev"
     moveToOutput share/man/man1 "$bin"
+  '' + stdenv.lib.optionalString pythonSupport ''
+    mkdir -p $py/nix-support
+    echo ${libxml2.py} >> $py/nix-support/propagated-native-build-inputs
+    moveToOutput lib/python2.7 "$py"
   '';
 
+  passthru = {
+    inherit pythonSupport;
+  };
+
   meta = with stdenv.lib; {
     homepage = http://xmlsoft.org/XSLT/;
     description = "A C library and tools to do XSL transformations";
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index 5ff884fd3c1d3..e923f87722aeb 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, fetchpatch
 , pkgconfig, intltool, autoreconfHook, substituteAll
-, file, expat, libdrm, xorg, wayland, systemd, openssl
+, file, expat, libdrm, xorg, wayland, openssl
 , llvmPackages, libffi, libomxil-bellagio, libva
 , libelf, libvdpau, python2
 , grsecEnabled ? false
@@ -26,7 +26,7 @@ if ! lists.elem stdenv.system platforms.mesaPlatforms then
 else
 
 let
-  version = "12.0.3";
+  version = "13.0.1";
   branch  = head (splitString "." version);
   driverLink = "/run/opengl-driver" + optionalString stdenv.isi686 "-32";
 in
@@ -40,7 +40,7 @@ stdenv.mkDerivation {
       "ftp://ftp.freedesktop.org/pub/mesa/older-versions/${branch}.x/${version}/mesa-${version}.tar.xz"
       "https://launchpad.net/mesa/trunk/${version}/+download/mesa-${version}.tar.xz"
     ];
-    sha256 = "1dc86dd9b51272eee1fad3df65e18cda2e556ef1bc0b6e07cd750b9757f493b1";
+    sha256 = "0cd7axwihwsay0i9fvcw14cldbxyvf8b8rd5sh53plvppyr2z5ki";
   };
 
   prePatch = "patchShebangs .";
@@ -51,11 +51,7 @@ stdenv.mkDerivation {
   patches = [
     ./glx_ro_text_segm.patch # fix for grsecurity/PaX
     ./symlink-drivers.patch
-  ] ++ optional stdenv.isLinux
-      (substituteAll {
-        src = ./dlopen-absolute-paths.diff;
-        libudev = systemd.lib;
-      });
+  ];
 
   postPatch = ''
     substituteInPlace src/egl/main/egldriver.c \
@@ -116,7 +112,7 @@ stdenv.mkDerivation {
     libffi wayland libvdpau libelf libXvMC
     libomxil-bellagio libva libpthreadstubs openssl/*or another sha1 provider*/
     (python2.withPackages (ps: [ ps.Mako ]))
-  ] ++ optional stdenv.isLinux systemd;
+  ];
 
 
   enableParallelBuilding = true;
diff --git a/pkgs/development/libraries/mesa/dlopen-absolute-paths.diff b/pkgs/development/libraries/mesa/dlopen-absolute-paths.diff
deleted file mode 100644
index 9a52265722391..0000000000000
--- a/pkgs/development/libraries/mesa/dlopen-absolute-paths.diff
+++ /dev/null
@@ -1,22 +0,0 @@
-diff --git a/loader.c b/loader.c
-index 4fdf3c2..69ea22d 100644
---- a/src/loader/loader.c
-+++ b/src/loader/loader.c
-@@ -112,7 +112,7 @@ static void *udev_handle = NULL;
- static void *
- udev_dlopen_handle(void)
- {
--   char name[80];
-+   char name[256];
-    unsigned flags = RTLD_NOLOAD | RTLD_LOCAL | RTLD_LAZY;
-    int version;
- 
-@@ -126,7 +126,7 @@ udev_dlopen_handle(void)
-    /* First try opening an already linked libudev, then try loading one */
-    do {
-       for (version = 1; version >= 0; version--) {
--         snprintf(name, sizeof(name), "libudev.so.%d", version);
-+         snprintf(name, sizeof(name), "@libudev@/lib/libudev.so.%d", version);
-          udev_handle = dlopen(name, flags);
-          if (udev_handle)
-             return udev_handle;
diff --git a/pkgs/development/libraries/zeitgeist/default.nix b/pkgs/development/libraries/zeitgeist/default.nix
index 879e1ccaec3f3..bb6af73356dea 100644
--- a/pkgs/development/libraries/zeitgeist/default.nix
+++ b/pkgs/development/libraries/zeitgeist/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, pkgconfig, glib, sqlite, gnome3, vala_0_23
 , intltool, libtool, python, dbus_libs, telepathy_glib
-, gtk3, json_glib, librdf_raptor2, pythonPackages, dbus_glib }:
+, gtk3, json_glib, librdf_raptor2, python2Packages, dbus_glib }:
 
 stdenv.mkDerivation rec {
   version = "0.9.15";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ pkgconfig glib sqlite gnome3.gnome_common intltool
                   libtool python dbus_libs telepathy_glib vala_0_23 dbus_glib
-                  gtk3 json_glib librdf_raptor2 pythonPackages.rdflib ];
+                  gtk3 json_glib librdf_raptor2 python2Packages.rdflib ];
 
   prePatch = "patchShebangs .";
 
diff --git a/pkgs/development/python-modules/bootstrapped-pip/default.nix b/pkgs/development/python-modules/bootstrapped-pip/default.nix
index 0fd6c1873b537..ed8bbab29a7a3 100644
--- a/pkgs/development/python-modules/bootstrapped-pip/default.nix
+++ b/pkgs/development/python-modules/bootstrapped-pip/default.nix
@@ -6,8 +6,8 @@ let
     sha256 = "ea8033fc9905804e652f75474d33410a07404c1a78dd3c949a66863bd1050ebd";
   };
   setuptools_source = fetchurl {
-    url = "https://files.pythonhosted.org/packages/3b/c7/e9724e6f81c96248fba5876054418c11d327b3093d075790903cd66fad44/setuptools-26.1.1-py2.py3-none-any.whl";
-    sha256 = "226c9ce65e76c6069e805982b036f36dc4b227b37dd87fc219aef721ec8604ae";
+    url = "https://files.pythonhosted.org/packages/3b/7e/293d19ccd106119e35db4bf3e111b1895098f618b455b758aa636496cf03/setuptools-28.8.0-py2.py3-none-any.whl";
+    sha256 = "2e59d06ac798efce29c567ee0e0687514efca529a665b8f364cf497cd10d21b2";
   };
   argparse_source = fetchurl {
     url = "https://pypi.python.org/packages/2.7/a/argparse/argparse-1.4.0-py2.py3-none-any.whl";
@@ -15,11 +15,11 @@ let
   };
 in stdenv.mkDerivation rec {
   name = "${python.libPrefix}-bootstrapped-pip-${version}";
-  version = "8.1.2";
+  version = "9.0.1";
 
   src = fetchurl {
-    url = "https://pypi.python.org/packages/9c/32/004ce0852e0a127f07f358b715015763273799bd798956fa930814b60f39/pip-${version}-py2.py3-none-any.whl";
-    sha256 = "18cjrd66mn4a0gwa99zzs89lrb0xn4xmajdzya6zqd7v16cdsr34";
+    url = "https://files.pythonhosted.org/packages/b6/ac/7015eb97dc749283ffdec1c3a88ddb8ae03b8fad0f0e611408f196358da3/pip-9.0.1-py2.py3-none-any.whl";
+    sha256 = "690b762c0a8460c303c089d5d0be034fb15a5ea2b75bdf565f40421f542fefb0";
   };
 
   unpackPhase = ''
diff --git a/pkgs/development/python-modules/poezio/make_default_config_writable.patch b/pkgs/development/python-modules/poezio/make_default_config_writable.patch
new file mode 100644
index 0000000000000..03d732e256c40
--- /dev/null
+++ b/pkgs/development/python-modules/poezio/make_default_config_writable.patch
@@ -0,0 +1,25 @@
+diff -ruN a/src/config.py b/src/config.py
+--- a/src/config.py	2015-07-31 19:35:37.000000000 +0000
++++ b/src/config.py	2015-08-03 09:23:34.322098081 +0000
+@@ -14,6 +14,7 @@
+ 
+ import logging.config
+ import os
++import stat
+ import sys
+ import pkg_resources
+ 
+@@ -563,6 +564,13 @@
+             copy2(default, options.filename)
+         elif path.isfile(other):
+             copy2(other, options.filename)
++
++        # Inside the nixstore, the reference file is readonly, so is the copy.
++        # Make it writable by the user who just created it.
++        if os.path.exists(options.filename):
++            os.chmod(options.filename,
++                     os.stat(options.filename).st_mode | stat.S_IWUSR)
++
+         global firstrun
+         firstrun = True
+ 
diff --git a/pkgs/development/python-modules/setuptools/default.nix b/pkgs/development/python-modules/setuptools/default.nix
index 3a38dee3174ff..bba5a6c942b05 100644
--- a/pkgs/development/python-modules/setuptools/default.nix
+++ b/pkgs/development/python-modules/setuptools/default.nix
@@ -1,14 +1,15 @@
 { stdenv, lib, fetchurl, python, wrapPython }:
 
 stdenv.mkDerivation rec {
-  shortName = "setuptools-${version}";
+  pname = "setuptools";
+  shortName = "${pname}-${version}";
   name = "${python.libPrefix}-${shortName}";
 
-  version = "26.1.1";  # 18.4 and up breaks python34Packages.characteristic and many others
+  version = "28.8.0";
 
   src = fetchurl {
-    url = "mirror://pypi/s/setuptools/${shortName}.tar.gz";
-    sha256 = "475ce28993d7cb75335942525b9fac79f7431a7f6e8a0079c0f2680641379481";
+    url = "mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${shortName}.tar.gz";
+    sha256 = "432a1ad4044338c34c2d09b0ff75d509b9849df8cf329f4c1c7706d9c2ba3c61";
   };
 
   buildInputs = [ python wrapPython ];
diff --git a/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix b/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
index aac213bb80475..92c54d9b679ec 100644
--- a/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/Libsystem/default.nix
@@ -56,9 +56,8 @@ appleDerivation rec {
     # The startup object files
     cp ${Csu}/lib/* $out/lib
 
-    # Narrowly speaking, these would work if we re-exported libsystem_c and libsystem_kernel,
-    # but we also need to run the original central libsystem constructor (which initializes
-    # a ton of crap for its consitutent libraries) so we link against the central library here.
+    # We can't re-exported libsystem_c and libsystem_kernel directly,
+    # so we link against the central library here.
     mkdir -p $out/lib/system
     ld -macosx_version_min 10.7 -arch x86_64 -dylib \
        -o $out/lib/system/libsystem_c.dylib \
@@ -70,8 +69,14 @@ appleDerivation rec {
        /usr/lib/libSystem.dylib \
        -reexported_symbols_list ${./system_kernel_symbols}
 
-    libs=$(otool -arch x86_64 -L /usr/lib/libSystem.dylib | tail -n +3 | awk '{ print $1 }')
+    # The umbrella libSystem also exports some symbols,
+    # but we don't want to pull in everything from the other libraries.
+    ld -macosx_version_min 10.7 -arch x86_64 -dylib \
+       -o $out/lib/libSystem_internal.dylib \
+       /usr/lib/libSystem.dylib \
+       -reexported_symbols_list ${./system_symbols}
 
+    libs=$(otool -arch x86_64 -L /usr/lib/libSystem.dylib | tail -n +3 | awk '{ print $1 }')
 
     for i in $libs; do
       if [ "$i" != "/usr/lib/system/libsystem_kernel.dylib" ] && [ "$i" != "/usr/lib/system/libsystem_c.dylib" ]; then
@@ -79,14 +84,13 @@ appleDerivation rec {
       fi
     done
 
-    ld -macosx_version_min 10.7 \
-       -arch x86_64 \
-       -dylib \
+    ld -macosx_version_min 10.7 -arch x86_64 -dylib \
        -o $out/lib/libSystem.B.dylib \
        -compatibility_version 1.0 \
        -current_version 1226.10.1 \
        -reexport_library $out/lib/system/libsystem_c.dylib \
        -reexport_library $out/lib/system/libsystem_kernel.dylib \
+       -reexport_library $out/lib/libSystem_internal.dylib \
        $args
 
     ln -s libSystem.B.dylib $out/lib/libSystem.dylib
diff --git a/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_symbols b/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_symbols
new file mode 100644
index 0000000000000..75a00acac4936
--- /dev/null
+++ b/pkgs/os-specific/darwin/apple-source-releases/Libsystem/system_symbols
@@ -0,0 +1 @@
+_mach_init_routine
diff --git a/pkgs/os-specific/linux/alsa-lib/default.nix b/pkgs/os-specific/linux/alsa-lib/default.nix
index a839158d0cfd8..b525cbfc261b2 100644
--- a/pkgs/os-specific/linux/alsa-lib/default.nix
+++ b/pkgs/os-specific/linux/alsa-lib/default.nix
@@ -1,14 +1,14 @@
 { stdenv, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "alsa-lib-1.1.1";
+  name = "alsa-lib-1.1.2";
 
   src = fetchurl {
     urls = [
      "ftp://ftp.alsa-project.org/pub/lib/${name}.tar.bz2"
      "http://alsa.cybermirror.org/lib/${name}.tar.bz2"
     ];
-    sha256 = "0sa24fy3qf3jg63xxvfb7j8halj1qmdbcak2lyfx8bpd8hqnriwa";
+    sha256 = "1mk1v2av6ibyydgr6f2mxrwy7clgnf0c68s9y2zvh1ibi7csr3fk";
   };
 
   patches = [
diff --git a/pkgs/os-specific/linux/alsa-plugins/default.nix b/pkgs/os-specific/linux/alsa-plugins/default.nix
index 22c3d46477472..7f065a1b9b060 100644
--- a/pkgs/os-specific/linux/alsa-plugins/default.nix
+++ b/pkgs/os-specific/linux/alsa-plugins/default.nix
@@ -1,14 +1,14 @@
 { stdenv, fetchurl, lib, pkgconfig, alsaLib, libogg, libpulseaudio ? null, libjack2 ? null }:
 
 stdenv.mkDerivation rec {
-  name = "alsa-plugins-1.1.0";
+  name = "alsa-plugins-1.1.1";
 
   src = fetchurl {
     urls = [
       "ftp://ftp.alsa-project.org/pub/plugins/${name}.tar.bz2"
       "http://alsa.cybermirror.org/plugins/${name}.tar.bz2"
     ];
-    sha256 = "3b83c329953bef99f5fe25ae04ec4a455fe6514939f3b45a5321966652b2c9ee";
+    sha256 = "1w81z5jlwqhd1l2m7qrq69lc4k9dnrg1wn52jsl2hrf3hbhd394f";
   };
 
   # ToDo: a52, etc.?
diff --git a/pkgs/os-specific/linux/alsa-utils/default.nix b/pkgs/os-specific/linux/alsa-utils/default.nix
index d47c9fa2c1a1f..3c2b53e0e3f10 100644
--- a/pkgs/os-specific/linux/alsa-utils/default.nix
+++ b/pkgs/os-specific/linux/alsa-utils/default.nix
@@ -2,14 +2,14 @@
 
 stdenv.mkDerivation rec {
   name = "alsa-utils-${version}";
-  version = "1.1.0";
+  version = "1.1.2";
 
   src = fetchurl {
     urls = [
       "ftp://ftp.alsa-project.org/pub/utils/${name}.tar.bz2"
       "http://alsa.cybermirror.org/utils/${name}.tar.bz2"
     ];
-    sha256 = "3b1c3135b76e14532d3dd23fb15759ddd7daf9ffbc183f7a9a0a3a86374748f1";
+    sha256 = "0wcha78c2sm8qqk5r3w83cvm8fp6fb1zpd35kmcm24kxhz007xks";
   };
 
   patchPhase = ''
diff --git a/pkgs/servers/http/apache-modules/mod_wsgi/default.nix b/pkgs/servers/http/apache-modules/mod_wsgi/default.nix
index 4cccf237b9e21..1d8507fc4eb38 100644
--- a/pkgs/servers/http/apache-modules/mod_wsgi/default.nix
+++ b/pkgs/servers/http/apache-modules/mod_wsgi/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, apacheHttpd, python }:
+{ stdenv, fetchurl, apacheHttpd, python2 }:
 
 stdenv.mkDerivation rec {
   name = "mod_wsgi-${version}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "14xz422jlakdhxzsl8xs9if86yf1fnkwdg0havjyqs7my0w4qrzh";
   };
 
-  buildInputs = [ apacheHttpd python ];
+  buildInputs = [ apacheHttpd python2 ];
 
   patchPhase = ''
     sed -r -i -e "s|^LIBEXECDIR=.*$|LIBEXECDIR=$out/modules|" \
diff --git a/pkgs/servers/x11/xorg/default.nix b/pkgs/servers/x11/xorg/default.nix
index 640c200e7cf22..2c27d6483bede 100644
--- a/pkgs/servers/x11/xorg/default.nix
+++ b/pkgs/servers/x11/xorg/default.nix
@@ -823,11 +823,11 @@ let
   }) // {inherit fontconfig freetype libX11 xproto libXrender ;};
 
   libXi = (mkDerivation "libXi" {
-    name = "libXi-1.7.7";
+    name = "libXi-1.7.8";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/lib/libXi-1.7.7.tar.bz2;
-      sha256 = "0c70n4aq0ba628wr88ih4740nci9d9f6y3v96sx376vvlm7q6vwr";
+      url = mirror://xorg/individual/lib/libXi-1.7.8.tar.bz2;
+      sha256 = "1fr7mi4nbcxsa88qin9g2ipmzh595ydxy9qnabzl270laf6zmwnq";
     };
     buildInputs = [pkgconfig inputproto libX11 libXext xextproto libXfixes xproto ];
     meta.platforms = stdenv.lib.platforms.unix;
diff --git a/pkgs/servers/x11/xorg/tarballs-7.7.list b/pkgs/servers/x11/xorg/tarballs-7.7.list
index b2b5f2dc2366f..161d7bda85e9f 100644
--- a/pkgs/servers/x11/xorg/tarballs-7.7.list
+++ b/pkgs/servers/x11/xorg/tarballs-7.7.list
@@ -71,7 +71,7 @@ mirror://xorg/individual/lib/libXfixes-5.0.2.tar.bz2
 mirror://xorg/individual/lib/libXfont-1.5.1.tar.bz2
 mirror://xorg/individual/lib/libXfont2-2.0.1.tar.bz2
 mirror://xorg/individual/lib/libXft-2.3.2.tar.bz2
-mirror://xorg/individual/lib/libXi-1.7.7.tar.bz2
+mirror://xorg/individual/lib/libXi-1.7.8.tar.bz2
 mirror://xorg/individual/lib/libXinerama-1.1.3.tar.bz2
 mirror://xorg/individual/lib/libxkbfile-1.0.9.tar.bz2
 mirror://xorg/individual/lib/libXmu-1.1.2.tar.bz2
diff --git a/pkgs/shells/rush/gets.patch b/pkgs/shells/rush/gets.patch
new file mode 100644
index 0000000000000..94b1f5dd2f51a
--- /dev/null
+++ b/pkgs/shells/rush/gets.patch
@@ -0,0 +1,13 @@
+--- rush-1.7/gnu/stdio.in.h.org	2010-06-13 19:14:59.000000000 +0200
++++ rush-1.7/gnu/stdio.in.h	2013-12-30 14:29:55.000000000 +0100
+@@ -138,8 +138,10 @@ _GL_WARN_ON_USE (fflush, "fflush is not
+ /* It is very rare that the developer ever has full control of stdin,
+    so any use of gets warrants an unconditional warning.  Assume it is
+    always declared, since it is required by C89.  */
++#if defined gets 
+ #undef gets
+ _GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
++#endif
+ 
+ #if @GNULIB_FOPEN@
+ # if @REPLACE_FOPEN@
diff --git a/pkgs/tools/X11/xpra/default.nix b/pkgs/tools/X11/xpra/default.nix
index 871d5a9dbd8c6..4ae367abf612b 100644
--- a/pkgs/tools/X11/xpra/default.nix
+++ b/pkgs/tools/X11/xpra/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, pythonPackages, pkgconfig
+{ stdenv, lib, fetchurl, python2Packages, pkgconfig
 , xorg, gtk2, glib, pango, cairo, gdk_pixbuf, atk
 , makeWrapper, xkbcomp, xorgserver, getopt, xauth, utillinux, which, fontsConf, xkeyboard_config
 , ffmpeg, x264, libvpx, libwebp
@@ -8,7 +8,7 @@
 with lib;
 
 let
-  inherit (pythonPackages) python cython buildPythonApplication;
+  inherit (python2Packages) python cython buildPythonApplication;
 in buildPythonApplication rec {
   name = "xpra-0.17.6";
   namePrefix = "";
@@ -39,7 +39,7 @@ in buildPythonApplication rec {
     makeWrapper
   ];
 
-  propagatedBuildInputs = with pythonPackages; [
+  propagatedBuildInputs = with python2Packages; [
     pillow pygtk pygobject2 rencode pycrypto cryptography pycups lz4 dbus-python
     netifaces numpy websockify pygobject3 gst-python
   ];
diff --git a/pkgs/tools/admin/certbot/default.nix b/pkgs/tools/admin/certbot/default.nix
index 80805666a3a4c..998b8d2e13de8 100644
--- a/pkgs/tools/admin/certbot/default.nix
+++ b/pkgs/tools/admin/certbot/default.nix
@@ -1,6 +1,8 @@
-{ stdenv, pythonPackages, fetchFromGitHub, dialog }:
+{ stdenv, python2Packages, fetchFromGitHub, dialog }:
 
-pythonPackages.buildPythonApplication rec {
+# Latest version of certbot supports python3 and python3 version of pythondialog
+
+python2Packages.buildPythonApplication rec {
   name = "certbot-${version}";
   version = "0.6.0";
 
@@ -11,7 +13,7 @@ pythonPackages.buildPythonApplication rec {
     sha256 = "1x0prlldkgg0hxmya4m5h3k3c872wr0jylmzpr3m04mk339yiw0c";
   };
 
-  propagatedBuildInputs = with pythonPackages; [
+  propagatedBuildInputs = with python2Packages; [
     ConfigArgParse
     acme
     configobj
@@ -26,7 +28,7 @@ pythonPackages.buildPythonApplication rec {
     zope_component
     zope_interface
   ];
-  buildInputs = [ dialog ] ++ (with pythonPackages; [ nose mock gnureadline ]);
+  buildInputs = [ dialog ] ++ (with python2Packages; [ nose mock gnureadline ]);
 
   patchPhase = ''
     substituteInPlace certbot/notify.py --replace "/usr/sbin/sendmail" "/var/setuid-wrappers/sendmail"
diff --git a/pkgs/tools/archivers/gnutar/default.nix b/pkgs/tools/archivers/gnutar/default.nix
index 80c84236b8db5..447ef1f623fc2 100644
--- a/pkgs/tools/archivers/gnutar/default.nix
+++ b/pkgs/tools/archivers/gnutar/default.nix
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "097hx7sbzp8qirl4m930lw84kn0wmxhmq7v1qpra3mrg0b8cyba0";
   };
 
-  patches = [ ./CVE-2016-6321.patch ]; # FIXME: remove on another stdenv rebuild
+  patches = [ ./CVE-2016-6321.patch ];
 
   # avoid retaining reference to CF during stdenv bootstrap
   configureFlags = stdenv.lib.optionals stdenv.isDarwin [
diff --git a/pkgs/tools/backup/bup/default.nix b/pkgs/tools/backup/bup/default.nix
index 075f1653adf86..4e035ab67acbe 100644
--- a/pkgs/tools/backup/bup/default.nix
+++ b/pkgs/tools/backup/bup/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchFromGitHub, fetchurl, makeWrapper
-, perl, pandoc, pythonPackages, git
+, perl, pandoc, python2Packages, git
 , par2cmdline ? null, par2Support ? false
 }:
 
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
     sha256 = "1hsxzrjvqa3pd74vmz8agiiwynrzynp1i726h0fzdsakc4adya4l";
   };
 
-  buildInputs = [ git pythonPackages.python ];
+  buildInputs = [ git python2Packages.python ];
   nativeBuildInputs = [ pandoc perl makeWrapper ];
 
   postPatch = ''
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
     wrapProgram $out/bin/bup \
       --prefix PATH : ${git}/bin \
       --prefix PYTHONPATH : ${concatStringsSep ":" (map (x: "$(toPythonPath ${x})")
-        (with pythonPackages;
+        (with python2Packages;
          [ setuptools tornado ]
          ++ stdenv.lib.optionals (!stdenv.isDarwin) [ pyxattr pylibacl fuse ]))}
   '';
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 05f97c2e4eea6..90ce4488c77d6 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -9423,27 +9423,27 @@ in
   });
 
   v8_3_14 = callPackage ../development/libraries/v8/3.14.nix {
-    inherit (pythonPackages) gyp;
+    inherit (python2Packages) python gyp;
   };
 
   v8_3_16_14 = callPackage ../development/libraries/v8/3.16.14.nix {
-    inherit (pythonPackages) gyp;
+    inherit (python2Packages) python gyp;
   };
 
   v8_3_24_10 = callPackage ../development/libraries/v8/3.24.10.nix {
-    inherit (pythonPackages) gyp;
+    inherit (python2Packages) python gyp;
   };
 
   v8_3_30_33 = callPackage ../development/libraries/v8/3.30.33.nix {
-    inherit (pythonPackages) gyp;
+    inherit (python2Packages) python gyp;
   };
 
   v8_4_5 = callPackage ../development/libraries/v8/4.5.nix {
-    inherit (pythonPackages) gyp;
+    inherit (python2Packages) python gyp;
   };
 
   v8 = callPackage ../development/libraries/v8 {
-    inherit (pythonPackages) gyp;
+    inherit (python2Packages) python gyp;
   };
 
   v8_static = lowPrio (self.v8.override { static = true; });
diff --git a/pkgs/top-level/emscripten-packages.nix b/pkgs/top-level/emscripten-packages.nix
index 633b4f8a211b9..ed9e09802b7d2 100644
--- a/pkgs/top-level/emscripten-packages.nix
+++ b/pkgs/top-level/emscripten-packages.nix
@@ -10,7 +10,7 @@ with pkgs; rec {
   
   libxml2 = (pkgs.libxml2.override {
     stdenv = emscriptenStdenv;
-    supportPython = false;
+    pythonSupport = false;
   }).overrideDerivation
     (old: { 
       buildInputs = old.buildInputs ++ [ autoreconfHook pkgconfig zlib nodejs ];
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 0e4a7220d4a17..dac77f7097908 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -13530,6 +13530,12 @@ in {
     clblas = pkgs.clblas-cuda;
   };
 
+  libxml2 = if isPy3k then throw "libxml2 not supported for interpreter ${python.executable}" else
+    (pkgs.libxml2.override{pythonSupport=true; python2=python;}).py;
+
+  libxslt = if isPy3k then throw "libxslt not supported for interpreter ${python.executable}" else
+    (pkgs.libxslt.override{pythonSupport=true; python2=python; inherit (self) libxml2;}).py;
+
   limnoria = buildPythonPackage rec {
     name = "limnoria-${version}";
     version = "2016.05.06";
@@ -18436,12 +18442,13 @@ in {
   };
 
   pip = buildPythonPackage rec {
-    version = "8.1.2";
-    name = "pip-${version}";
+    pname = "pip";
+    version = "9.0.1";
+    name = "${pname}-${version}";
 
     src = pkgs.fetchurl {
-      url = "mirror://pypi/p/pip/pip-${version}.tar.gz";
-      sha256 = "0cmpsy9lr9diskkypswm9s8glgr7w3crzh1im4zqlqv7z8zv092d";
+      url = "mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${name}.tar.gz";
+      sha256 = "09f243e1a7b461f654c26a725fa373211bb7ff17a9300058b205c61658ca940d";
     };
 
     # pip detects that we already have bootstrapped_pip "installed", so we need