summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/altcoins/default.nix3
-rw-r--r--pkgs/applications/display-managers/sddm/default.nix9
-rw-r--r--pkgs/applications/display-managers/sddm/sddm-ignore-config-mtime.patch59
-rw-r--r--pkgs/applications/display-managers/sddm/series1
-rw-r--r--pkgs/applications/editors/android-studio/packages.nix6
-rw-r--r--pkgs/applications/editors/eclipse/default.nix23
-rw-r--r--pkgs/applications/editors/eclipse/plugins.nix6
-rw-r--r--pkgs/applications/editors/rstudio/default.nix8
-rw-r--r--pkgs/applications/editors/vscode/default.nix8
-rw-r--r--pkgs/applications/graphics/digikam/0001-Disable-fno-operator-names.patch25
-rw-r--r--pkgs/applications/graphics/digikam/default.nix22
-rw-r--r--pkgs/applications/misc/alacritty/default.nix8
-rw-r--r--pkgs/applications/misc/bitcoinarmory/default.nix6
-rw-r--r--pkgs/applications/misc/blender/default.nix9
-rw-r--r--pkgs/applications/misc/electrum/default.nix2
-rw-r--r--pkgs/applications/misc/playonlinux/default.nix4
-rw-r--r--pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix15
-rw-r--r--pkgs/applications/networking/browsers/tor-browser-bundle/extensions.nix12
-rw-r--r--pkgs/applications/science/math/caffe/default.nix23
-rw-r--r--pkgs/applications/science/math/cntk/default.nix98
-rw-r--r--pkgs/applications/science/misc/root/ROOT-8728-extra.patch175
-rw-r--r--pkgs/applications/science/misc/root/default.nix14
-rw-r--r--pkgs/applications/science/misc/root/thisroot.patch15
-rw-r--r--pkgs/applications/virtualization/docker/default.nix38
-rw-r--r--pkgs/applications/virtualization/lkl/default.nix6
-rw-r--r--pkgs/applications/virtualization/xen/4.5.nix3
-rw-r--r--pkgs/applications/window-managers/sway/default.nix8
-rw-r--r--pkgs/desktops/plasma-5/default.nix1
-rw-r--r--pkgs/desktops/plasma-5/fetch.sh2
-rw-r--r--pkgs/desktops/plasma-5/kde-cli-tools.nix4
-rw-r--r--pkgs/desktops/plasma-5/plasma-desktop/ibus.patch26
-rw-r--r--pkgs/desktops/plasma-5/plasma-desktop/qml-import-paths.patch27
-rw-r--r--pkgs/desktops/plasma-5/plasma-desktop/series1
-rw-r--r--pkgs/desktops/plasma-5/plasma-integration.nix4
-rw-r--r--pkgs/desktops/plasma-5/plasma-vault/cryfs-path.patch17
-rw-r--r--pkgs/desktops/plasma-5/plasma-vault/default.nix38
-rw-r--r--pkgs/desktops/plasma-5/plasma-vault/encfs-path.patch24
-rw-r--r--pkgs/desktops/plasma-5/plasma-vault/fusermount-path.patch18
-rw-r--r--pkgs/desktops/plasma-5/plasma-workspace/qml-import-path.patch51
-rw-r--r--pkgs/desktops/plasma-5/srcs.nix352
-rw-r--r--pkgs/desktops/plasma-5/systemsettings.nix4
-rw-r--r--pkgs/development/compilers/cudatoolkit/default.nix68
-rw-r--r--pkgs/development/compilers/openjdk/8.nix20
-rw-r--r--pkgs/development/compilers/oraclejdk/jdk8cpu-linux.nix6
-rw-r--r--pkgs/development/compilers/oraclejdk/jdk8psu-linux.nix6
-rw-r--r--pkgs/development/compilers/oraclejdk/jdk9-linux.nix8
-rw-r--r--pkgs/development/compilers/ponyc/default.nix4
-rw-r--r--pkgs/development/compilers/scala/default.nix4
-rw-r--r--pkgs/development/compilers/tinycc/default.nix6
-rw-r--r--pkgs/development/coq-modules/flocq/default.nix6
-rw-r--r--pkgs/development/libraries/alembic/default.nix47
-rw-r--r--pkgs/development/libraries/boost/1.65.nix12
-rw-r--r--pkgs/development/libraries/boost/generic.nix15
-rw-r--r--pkgs/development/libraries/grantlee/5/default.nix8
-rw-r--r--pkgs/development/libraries/kde-frameworks/default.nix1
-rw-r--r--pkgs/development/libraries/kde-frameworks/kirigami2.nix11
-rw-r--r--pkgs/development/libraries/libdrm/default.nix4
-rw-r--r--pkgs/development/libraries/libqtav/default.nix16
-rw-r--r--pkgs/development/libraries/libtorrent-rasterbar/1.0.nix13
-rw-r--r--pkgs/development/libraries/libtorrent-rasterbar/default.nix10
-rw-r--r--pkgs/development/libraries/libtorrent-rasterbar/generic.nix8
-rw-r--r--pkgs/development/libraries/opencv/3.x.nix10
-rw-r--r--pkgs/development/libraries/openexrid-unstable/default.nix50
-rw-r--r--pkgs/development/libraries/openexrid-unstable/openexrid.patch35
-rw-r--r--pkgs/development/libraries/openfx/default.nix38
-rw-r--r--pkgs/development/libraries/opensubdiv/default.nix10
-rw-r--r--pkgs/development/libraries/openvdb/default.nix47
-rw-r--r--pkgs/development/libraries/partio/default.nix52
-rw-r--r--pkgs/development/libraries/ptex/default.nix45
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/default.nix7
-rw-r--r--pkgs/development/libraries/qt-5/5.9/qtbase/mkspecs-features-mac.patch66
-rw-r--r--pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh3
-rw-r--r--pkgs/development/libraries/science/math/clblas/cuda/default.nix73
-rw-r--r--pkgs/development/libraries/science/math/clblas/default.nix62
-rw-r--r--pkgs/development/libraries/science/math/clblas/platform.patch (renamed from pkgs/development/libraries/science/math/clblas/cuda/platform.patch)0
-rw-r--r--pkgs/development/libraries/science/math/cudnn/7.5-5.0/default.nix46
-rw-r--r--pkgs/development/libraries/science/math/cudnn/8.0-5.1/default.nix40
-rw-r--r--pkgs/development/libraries/science/math/cudnn/8.0-6.0/default.nix40
-rw-r--r--pkgs/development/libraries/science/math/cudnn/default.nix57
-rw-r--r--pkgs/development/libraries/science/math/cudnn/generic.nix (renamed from pkgs/development/libraries/science/math/cudnn/8.0-5.0/default.nix)27
-rw-r--r--pkgs/development/libraries/wlc/default.nix4
-rw-r--r--pkgs/development/libraries/wt/cmake.patch10
-rw-r--r--pkgs/development/libraries/wt/default.nix6
-rw-r--r--pkgs/development/libraries/xxHash/default.nix31
-rw-r--r--pkgs/development/ocaml-modules/camomile/0.8.5.nix30
-rw-r--r--pkgs/development/ocaml-modules/camomile/default.nix41
-rw-r--r--pkgs/development/ocaml-modules/lablgtk/default.nix4
-rw-r--r--pkgs/development/ocaml-modules/ocamlgraph/default.nix4
-rw-r--r--pkgs/development/python-modules/Theano/default.nix75
-rw-r--r--pkgs/development/python-modules/Theano/theano-with-cuda/default.nix65
-rw-r--r--pkgs/development/python-modules/Theano/theano-without-cuda/default.nix44
-rw-r--r--pkgs/development/python-modules/colorlover/default.nix23
-rw-r--r--pkgs/development/python-modules/cufflinks/default.nix25
-rw-r--r--pkgs/development/python-modules/django/1_11.nix9
-rw-r--r--pkgs/development/python-modules/libgpuarray/cuda/default.nix129
-rw-r--r--pkgs/development/python-modules/libgpuarray/default.nix81
-rw-r--r--pkgs/development/python-modules/powerline/default.nix5
-rw-r--r--pkgs/development/python-modules/pyftgl/default.nix6
-rw-r--r--pkgs/development/python-modules/python-fontconfig/default.nix30
-rw-r--r--pkgs/development/python-modules/tensorflow/default.nix303
-rw-r--r--pkgs/development/python-modules/twilio/default.nix27
-rw-r--r--pkgs/development/python-modules/waitress-django/default.nix8
-rw-r--r--pkgs/development/python-modules/waitress-django/setup.py12
-rwxr-xr-xpkgs/development/python-modules/waitress-django/src/waitress-serve-django14
-rw-r--r--pkgs/development/tools/build-managers/bazel/0.4.nix34
-rw-r--r--pkgs/development/tools/build-managers/bazel/nix-hacks.patch51
-rw-r--r--pkgs/development/tools/continuous-integration/jenkins/default.nix4
-rw-r--r--pkgs/development/tools/scalafmt/default.nix1
-rw-r--r--pkgs/games/bastet/default.nix10
-rw-r--r--pkgs/games/openra/default.nix100
-rw-r--r--pkgs/games/openrct2/default.nix70
-rw-r--r--pkgs/os-specific/linux/kernel/linux-4.13.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-4.9.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-hardened-copperhead.nix4
-rw-r--r--pkgs/os-specific/linux/kexectools/default.nix4
-rw-r--r--pkgs/os-specific/linux/musl/default.nix9
-rw-r--r--pkgs/os-specific/linux/spl/default.nix6
-rw-r--r--pkgs/os-specific/linux/wireguard/default.nix4
-rw-r--r--pkgs/os-specific/linux/zfs/default.nix11
-rw-r--r--pkgs/servers/atlassian/confluence.nix4
-rw-r--r--pkgs/servers/atlassian/jira.nix4
-rw-r--r--pkgs/servers/dns/knot-dns/default.nix7
-rw-r--r--pkgs/servers/monitoring/telegraf/default.nix4
-rw-r--r--pkgs/servers/monitoring/telegraf/deps-1.4.2.nix (renamed from pkgs/servers/monitoring/telegraf/deps-1.4.1.nix)0
-rw-r--r--pkgs/servers/uftp/default.nix4
-rw-r--r--pkgs/tools/audio/liquidsoap/full.nix6
-rw-r--r--pkgs/tools/graphics/povray/default.nix4
-rw-r--r--pkgs/tools/misc/snapper/default.nix10
-rw-r--r--pkgs/tools/networking/isync/default.nix8
-rw-r--r--pkgs/tools/package-management/nix/default.nix6
-rw-r--r--pkgs/tools/typesetting/tex/texlive/bin.nix1
-rw-r--r--pkgs/top-level/all-packages.nix147
-rw-r--r--pkgs/top-level/ocaml-packages.nix7
-rw-r--r--pkgs/top-level/perl-packages.nix4
-rw-r--r--pkgs/top-level/python-packages.nix143
135 files changed, 2183 insertions, 1634 deletions
diff --git a/pkgs/applications/altcoins/default.nix b/pkgs/applications/altcoins/default.nix
index 0264ce397762..1a21efc32322 100644
--- a/pkgs/applications/altcoins/default.nix
+++ b/pkgs/applications/altcoins/default.nix
@@ -1,4 +1,4 @@
-{ callPackage, boost155, boost162, boost163, openssl_1_1_0, haskellPackages, darwin, libsForQt5 }:
+{ callPackage, boost155, boost162, openssl_1_1_0, haskellPackages, darwin, libsForQt5 }:
 
 rec {
 
@@ -59,6 +59,5 @@ rec {
   zcash = callPackage ./zcash {
     withGui = false;
     openssl = openssl_1_1_0;
-    boost = boost163;
   };
 }
diff --git a/pkgs/applications/display-managers/sddm/default.nix b/pkgs/applications/display-managers/sddm/default.nix
index 3ce8d075410b..86a963bdac48 100644
--- a/pkgs/applications/display-managers/sddm/default.nix
+++ b/pkgs/applications/display-managers/sddm/default.nix
@@ -1,11 +1,11 @@
-{ mkDerivation, lib, copyPathsToStore, fetchFromGitHub, fetchpatch
+{ mkDerivation, lib, fetchFromGitHub, fetchpatch
 , cmake, extra-cmake-modules, pkgconfig, libxcb, libpthreadstubs, lndir
 , libXdmcp, libXau, qtbase, qtdeclarative, qttools, pam, systemd
 }:
 
 let
 
-  version = "0.15.0";
+  version = "0.16.0";
 
 in mkDerivation rec {
   name = "sddm-${version}";
@@ -14,11 +14,10 @@ in mkDerivation rec {
     owner = "sddm";
     repo = "sddm";
     rev = "v${version}";
-    sha256 = "1wissgl7wd7fblq8ghz8n2fr6wqip7h88p9fiarfpvi1918fgng8";
+    sha256 = "1j0rc8nk8bz7sxa0bc6lx9v7r3zlcfyicngfjqb894ni9k71kzsb";
   };
 
-  patches =
-    copyPathsToStore (lib.readPathsFromFile ./. ./series);
+  patches = [ ./sddm-ignore-config-mtime.patch ];
 
   postPatch =
     # Module Qt5::Test must be included in `find_package` before it is used.
diff --git a/pkgs/applications/display-managers/sddm/sddm-ignore-config-mtime.patch b/pkgs/applications/display-managers/sddm/sddm-ignore-config-mtime.patch
index 836df2de292d..aac09dfe876b 100644
--- a/pkgs/applications/display-managers/sddm/sddm-ignore-config-mtime.patch
+++ b/pkgs/applications/display-managers/sddm/sddm-ignore-config-mtime.patch
@@ -1,28 +1,43 @@
-From e9d82bfbc49993a5be2c93f6b72a969630587f26 Mon Sep 17 00:00:00 2001
-From: Thomas Tuegel <ttuegel@gmail.com>
-Date: Mon, 23 Nov 2015 06:56:28 -0600
-Subject: [PATCH 1/2] ignore config mtime
-
----
- src/common/ConfigReader.cpp | 5 -----
- 1 file changed, 5 deletions(-)
-
 diff --git a/src/common/ConfigReader.cpp b/src/common/ConfigReader.cpp
-index cfc9940..5bf5a6a 100644
+index 4b5983c..911c511 100644
 --- a/src/common/ConfigReader.cpp
 +++ b/src/common/ConfigReader.cpp
-@@ -138,11 +138,6 @@ namespace SDDM {
-         QString currentSection = QStringLiteral(IMPLICIT_SECTION);
+@@ -147,16 +147,13 @@ namespace SDDM {
+         // * m_path (classic fallback /etc/sddm.conf)
  
-         QFile in(m_path);
--        QDateTime modificationTime = QFileInfo(in).lastModified();
--        if (modificationTime <= m_fileModificationTime) {
+         QStringList files;
+-        QDateTime latestModificationTime = QFileInfo(m_path).lastModified();
+ 
+         if (!m_sysConfigDir.isEmpty()) {
+             //include the configDir in modification time so we also reload on any files added/removed
+             QDir dir(m_sysConfigDir);
+             if (dir.exists()) {
+-                latestModificationTime = std::max(latestModificationTime,  QFileInfo(m_sysConfigDir).lastModified());
+                 foreach (const QFileInfo &file, dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot, QDir::LocaleAware)) {
+                     files << (file.absoluteFilePath());
+-                    latestModificationTime = std::max(latestModificationTime, file.lastModified());
+                 }
+             }
+         }
+@@ -164,21 +161,14 @@ namespace SDDM {
+             //include the configDir in modification time so we also reload on any files added/removed
+             QDir dir(m_configDir);
+             if (dir.exists()) {
+-                latestModificationTime = std::max(latestModificationTime,  QFileInfo(m_configDir).lastModified());
+                 foreach (const QFileInfo &file, dir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot, QDir::LocaleAware)) {
+                     files << (file.absoluteFilePath());
+-                    latestModificationTime = std::max(latestModificationTime, file.lastModified());
+                 }
+             }
+         }
+ 
+         files << m_path;
+ 
+-        if (latestModificationTime <= m_fileModificationTime) {
 -            return;
 -        }
--        m_fileModificationTime = modificationTime;
- 
-         in.open(QIODevice::ReadOnly);
-         while (!in.atEnd()) {
--- 
-2.6.3
-
+-        m_fileModificationTime = latestModificationTime;
+-
+         foreach (const QString &filepath, files) {
+             loadInternal(filepath);
+         }
diff --git a/pkgs/applications/display-managers/sddm/series b/pkgs/applications/display-managers/sddm/series
deleted file mode 100644
index cb6ea65fedb1..000000000000
--- a/pkgs/applications/display-managers/sddm/series
+++ /dev/null
@@ -1 +0,0 @@
-sddm-ignore-config-mtime.patch
\ No newline at end of file
diff --git a/pkgs/applications/editors/android-studio/packages.nix b/pkgs/applications/editors/android-studio/packages.nix
index 061d75d4016f..4e834afa9d06 100644
--- a/pkgs/applications/editors/android-studio/packages.nix
+++ b/pkgs/applications/editors/android-studio/packages.nix
@@ -27,9 +27,9 @@ in rec {
 
   preview = mkStudio rec {
     pname = "android-studio-preview";
-    version = "3.0.0.16"; # "Android Studio 3.0 RC 1"
-    build = "171.4392136";
-    sha256Hash = "13zaqbbl7bqhiwh0ybbxkfv0h90qsfpa7sim778n2j32jjvdcby5";
+    version = "3.0.0.17"; # "Android Studio 3.0 RC 2"
+    build = "171.4402976";
+    sha256Hash = "18f5cq1dcmyjxaq520kqjac332bpp35pis02yplh6gzp65i4bvvf";
 
     meta = stable.meta // {
       description = "The Official IDE for Android (preview version)";
diff --git a/pkgs/applications/editors/eclipse/default.nix b/pkgs/applications/editors/eclipse/default.nix
index b039bd168d87..5ef29081cf01 100644
--- a/pkgs/applications/editors/eclipse/default.nix
+++ b/pkgs/applications/editors/eclipse/default.nix
@@ -8,6 +8,9 @@
 
 assert stdenv ? glibc;
 
+# http://download.eclipse.org/eclipse/downloads/ is the main place to
+# find the downloads needed for new versions
+
 rec {
 
   buildEclipse = import ./build-eclipse.nix {
@@ -111,16 +114,16 @@ rec {
   };
 
   eclipse-platform-47 = buildEclipse {
-    name = "eclipse-platform-4.7";
+    name = "eclipse-platform-4.7.1a";
     description = "Eclipse Platform Oxygen";
     sources = {
       "x86_64-linux" = fetchurl {
-          url = https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops4/R-4.7-201706120950/eclipse-platform-4.7-linux-gtk-x86_64.tar.gz;
-          sha256 = "0hrgijydxvd2zz1npv5qw8d79f48a6lsdw3qy1wqf7k59aqyg2fq";
+          url = https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops4/R-4.7.1a-201710090410/eclipse-platform-4.7.1a-linux-gtk-x86_64.tar.gz;
+          sha256 = "13gyrnhyhdpsrbi5nl0fhpwrqz3gdyqq3r0m1f2z3y6yr75sgw33";
         };
       "i686-linux" = fetchurl {
-          url = https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops4/R-4.7-201706120950/eclipse-platform-4.7-linux-gtk.tar.gz;
-          sha256 = "00m89j26m8nj190q144wx8d88mldx1z6i797p8isg3rhbz3x5dbc";
+          url = https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops4/R-4.7.1a-201710090410/eclipse-platform-4.7.1a-linux-gtk.tar.gz;
+          sha256 = "013dfk23wa4jy177ywrkkr16wdjf6jxzjcz6mkl4ygki47yj9c5s";
         };
     };
   };
@@ -165,16 +168,16 @@ rec {
   };
 
   eclipse-sdk-47 = buildEclipse {
-    name = "eclipse-sdk-4.7";
+    name = "eclipse-sdk-4.7.1a";
     description = "Eclipse Oxygen Classic";
     sources = {
       "x86_64-linux" = fetchurl {
-          url = https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops4/R-4.7-201706120950/eclipse-SDK-4.7-linux-gtk-x86_64.tar.gz;
-          sha256 = "1nz0hl0gg4a8iffnaggbhdw0ra8a7wljlimvijbbybh0nhvfd9n3";
+          url = https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops4/R-4.7.1a-201710090410/eclipse-SDK-4.7.1a-linux-gtk-x86_64.tar.gz;
+          sha256 = "05xpdbig170rw7k5dx33dlyz187wv62mma8s5wxrqi7f4117sx4y";
         };
       "i686-linux" = fetchurl {
-          url = https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops4/R-4.7-201706120950/eclipse-SDK-4.7-linux-gtk.tar.gz;
-          sha256 = "0dar69v7d7bkl18si45bccvil809a85ghb7k88m1q2cq1kd2r8z5";
+          url = https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops4/R-4.7.1a-201710090410/eclipse-SDK-4.7.1a-linux-gtk.tar.gz;
+          sha256 = "09c9m88k1cm9bhd900p5yf2q9pijrymgjcbhmagz0fcwhldrv0ys";
         };
     };
   };
diff --git a/pkgs/applications/editors/eclipse/plugins.nix b/pkgs/applications/editors/eclipse/plugins.nix
index b9b0ee61c0b0..f3459e57d9b2 100644
--- a/pkgs/applications/editors/eclipse/plugins.nix
+++ b/pkgs/applications/editors/eclipse/plugins.nix
@@ -364,12 +364,12 @@ rec {
 
   jdt = buildEclipseUpdateSite rec {
     name = "jdt-${version}";
-    version = "4.7";
+    version = "4.7.1a";
 
     src = fetchzip {
       stripRoot = false;
-      url = "https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops4/R-4.7-201706120950/org.eclipse.jdt-4.7.zip";
-      sha256 = "0y17shnlh90gg9226lraknvdnp2i71ck91dnxbbzvxl8b64v8v1p";
+      url = https://www.eclipse.org/downloads/download.php?r=1&nf=1&file=/eclipse/downloads/drops4/R-4.7.1a-201710090410/org.eclipse.jdt-4.7.1a.zip;
+      sha256 = "1hpvpj8ghfk8aqbzfrpcxw3wxrczq6zd3bpx4sxjrsi926jsjaf4";
     };
 
     meta = with stdenv.lib; {
diff --git a/pkgs/applications/editors/rstudio/default.nix b/pkgs/applications/editors/rstudio/default.nix
index bf8374fdaaa1..a5049e4236b3 100644
--- a/pkgs/applications/editors/rstudio/default.nix
+++ b/pkgs/applications/editors/rstudio/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, makeDesktopItem, cmake, boost163, zlib, openssl,
+{ stdenv, fetchurl, fetchpatch, makeDesktopItem, cmake, boost, zlib, openssl,
 R, qt5, libuuid, hunspellDicts, unzip, ant, jdk, gnumake, makeWrapper, pandoc
 }:
 
@@ -10,7 +10,9 @@ in
 stdenv.mkDerivation rec {
   name = "RStudio-${version}";
 
-  buildInputs = [ cmake boost163 zlib openssl R qt5.full qt5.qtwebkit qt5.qtwebchannel libuuid unzip ant jdk makeWrapper pandoc ];
+  nativeBuildInputs = [ cmake unzip ant jdk makeWrapper pandoc ];
+
+  buildInputs = [ boost zlib openssl R qt5.full qt5.qtwebkit qt5.qtwebchannel libuuid ];
 
   src = fetchurl {
     url = "https://github.com/rstudio/rstudio/archive/v${version}.tar.gz";
@@ -96,6 +98,8 @@ stdenv.mkDerivation rec {
       cp ${pandoc}/bin/pandoc dependencies/common/pandoc/
     '';
 
+  enableParallelBuilding = true;
+
   cmakeFlags = [ "-DRSTUDIO_TARGET=Desktop" "-DQT_QMAKE_EXECUTABLE=$NIX_QT5_TMP/bin/qmake" ];
 
   desktopItem = makeDesktopItem {
diff --git a/pkgs/applications/editors/vscode/default.nix b/pkgs/applications/editors/vscode/default.nix
index b5b2a49c42b6..23bcdae5fb21 100644
--- a/pkgs/applications/editors/vscode/default.nix
+++ b/pkgs/applications/editors/vscode/default.nix
@@ -2,7 +2,7 @@
   makeWrapper, libXScrnSaver, libxkbfile, libsecret }:
 
 let
-  version = "1.17.1";
+  version = "1.17.2";
   channel = "stable";
 
   plat = {
@@ -12,9 +12,9 @@ let
   }.${stdenv.system};
 
   sha256 = {
-    "i686-linux" = "09nvibfn2z5cxjcdxqa2xy63jqwpvfgk7hdy1pc0mnpszz6kn4v7";
-    "x86_64-linux" = "1fb3hil7dggnz7hks1i806ckd3wl5g0a2syjdbh9dx5iqarp2782";
-    "x86_64-darwin" = "1vgbsmbcsdxc0h0ny61a3rhbwxzrfzkxl47sy3w410xcqlv8ad2v";
+    "i686-linux" = "04mnj74pqkgfgdacq4643qrd7ybka1366lr7mwn0f70lk05wb2h2";
+    "x86_64-linux" = "0y37wwvq6flaa2fh2r6b9cplbcszq726zrx6b8slzq6s5wl2lgmr";
+    "x86_64-darwin" = "1cqyir7ijwafy68d5vbw47cs1x2lqs1wjnvhhw15yi2d7c14fq7q";
   }.${stdenv.system};
 
   archive_fmt = if stdenv.system == "x86_64-darwin" then "zip" else "tar.gz";
diff --git a/pkgs/applications/graphics/digikam/0001-Disable-fno-operator-names.patch b/pkgs/applications/graphics/digikam/0001-Disable-fno-operator-names.patch
deleted file mode 100644
index 149a2b2b1aca..000000000000
--- a/pkgs/applications/graphics/digikam/0001-Disable-fno-operator-names.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From beb9ad0149adfe448acfa650fb3e171d5fdd7e27 Mon Sep 17 00:00:00 2001
-From: Moritz Ulrich <moritz@tarn-vedra.de>
-Date: Wed, 22 Feb 2017 15:28:11 +0100
-Subject: [PATCH] Disable `-fno-operator-names`
-
----
- core/CMakeLists.txt | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
-index 89e06827e6..01d0c88ea9 100644
---- a/core/CMakeLists.txt
-+++ b/core/CMakeLists.txt
-@@ -98,6 +98,8 @@ include(MacroOpenCV)
- include(MacroJPEG)
- include(MacroBoolTo01)
- 
-+string(REPLACE "-fno-operator-names" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
-+
- # ==================================================================================================
- 
- option(ENABLE_OPENCV3               "Build digiKam with OpenCV3 instead OpenCV2 (default=OFF)"                           OFF)
--- 
-2.11.1
-
diff --git a/pkgs/applications/graphics/digikam/default.nix b/pkgs/applications/graphics/digikam/default.nix
index 96b1ca54d558..44ee807fe984 100644
--- a/pkgs/applications/graphics/digikam/default.nix
+++ b/pkgs/applications/graphics/digikam/default.nix
@@ -8,6 +8,7 @@
 , qtsvg
 , qtwebkit
 
+, kcalcore
 , kconfigwidgets
 , kcoreaddons
 , kdoctools
@@ -28,12 +29,15 @@
 , lensfun
 , libgphoto2
 , libkipi
+, libksane
 , liblqr1
 , libqtav
 , libusb1
+, mesa
 , marble
 , mysql
-, opencv
+, opencv3
+, pcre
 , threadweaver
 
 # For panorama and focus stacking
@@ -46,17 +50,15 @@
 
 mkDerivation rec {
   name    = "digikam-${version}";
-  version = "5.4.0";
+  version = "5.7.0";
 
   src = fetchurl {
     url = "http://download.kde.org/stable/digikam/${name}.tar.xz";
-    sha256 = "0dgsgji14l5zvxny36hrfsp889fsfrsbbn9bg57m18404xp903kg";
+    sha256 = "1xah079g47fih8l9qy1ifppfvmq5yms5y1z54nvxdyz8nsszy19n";
   };
 
   nativeBuildInputs = [ cmake extra-cmake-modules kdoctools wrapGAppsHook ];
 
-  patches = [ ./0001-Disable-fno-operator-names.patch ];
-
   buildInputs = [
     bison
     boost
@@ -68,19 +70,21 @@ mkDerivation rec {
     lensfun
     libgphoto2
     libkipi
+    libksane
     liblqr1
     libqtav
     libusb1
+    mesa
     mysql
-    opencv
-  ];
+    opencv3
+    pcre
 
-  propagatedBuildInputs = [
     qtbase
     qtxmlpatterns
     qtsvg
     qtwebkit
 
+    kcalcore
     kconfigwidgets
     kcoreaddons
     kfilemetadata
@@ -98,8 +102,6 @@ mkDerivation rec {
   enableParallelBuilding = true;
 
   cmakeFlags = [
-    "-DLIBUSB_LIBRARIES=${libusb1.out}/lib"
-    "-DLIBUSB_INCLUDE_DIR=${libusb1.dev}/include/libusb-1.0"
     "-DENABLE_MYSQLSUPPORT=1"
     "-DENABLE_INTERNALMYSQL=1"
     "-DENABLE_MEDIAPLAYER=1"
diff --git a/pkgs/applications/misc/alacritty/default.nix b/pkgs/applications/misc/alacritty/default.nix
index 79333e7d9fa1..411705e6a6ae 100644
--- a/pkgs/applications/misc/alacritty/default.nix
+++ b/pkgs/applications/misc/alacritty/default.nix
@@ -29,16 +29,16 @@ let
 in
 
 buildRustPackage rec {
-  name = "alacritty-unstable-2017-09-02";
+  name = "alacritty-unstable-2017-10-17";
 
   src = fetchFromGitHub {
     owner = "jwilm";
     repo = "alacritty";
-    rev = "22fa4260fc9210fbb5288090df79c92e7b3788e4";
-    sha256 = "0jjvvm0fm25p1h1rgfqlnhq4bwrjdxpb2pgnmpik9pl7qwy3q7s1";
+    rev = "5ac42bb13bc68c5cbc44869dc9fc9ac19402a6e6";
+    sha256 = "0h37x12r33xwz9vf1n8y24c0ph5w17lhkpfi5q6lbpgidvbs6fyx";
   };
 
-  depsSha256 = "19lrj4i6vzmf22r6xg99zcwvzjpiar8pqin1m2nvv78xzxx5yvgb";
+  depsSha256 = "05gkl2zg546i2pm0gx11s56f7dk72qpm39kml1d2myj81s0vyb5z";
 
   buildInputs = [
     cmake
diff --git a/pkgs/applications/misc/bitcoinarmory/default.nix b/pkgs/applications/misc/bitcoinarmory/default.nix
index f4547c69dc4a..a9d32d4b2522 100644
--- a/pkgs/applications/misc/bitcoinarmory/default.nix
+++ b/pkgs/applications/misc/bitcoinarmory/default.nix
@@ -7,9 +7,9 @@ let
 
   version = "0.96.1";
   sitePackages = pythonPackages.python.sitePackages;
-  inherit (pythonPackages) mkPythonDerivation pyqt4 psutil twisted;
+  inherit (pythonPackages) buildPythonApplication pyqt4 psutil twisted;
 
-in mkPythonDerivation {
+in buildPythonApplication {
 
   name = "bitcoinarmory-${version}";
 
@@ -21,6 +21,8 @@ in mkPythonDerivation {
     sha256 = "0pjk5qx16n3kvs9py62666qkwp2awkgd87by4karbj7vk6p1l14h"; fetchSubmodules = true;
   };
 
+  format = "other";
+
   # FIXME bitcoind doesn't die on shutdown. Need some sort of patch to fix that.
   #patches = [ ./shutdown-fix.patch ];
 
diff --git a/pkgs/applications/misc/blender/default.nix b/pkgs/applications/misc/blender/default.nix
index 86b2ab6eb1ca..b348f253b350 100644
--- a/pkgs/applications/misc/blender/default.nix
+++ b/pkgs/applications/misc/blender/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, stdenv_gcc5, lib, fetchurl, boost, cmake, ffmpeg, gettext, glew
+{ stdenv, lib, fetchurl, boost, cmake, ffmpeg, gettext, glew
 , ilmbase, libXi, libX11, libXext, libXrender
 , libjpeg, libpng, libsamplerate, libsndfile
 , libtiff, mesa, openal, opencolorio, openexr, openimageio, openjpeg_1, python
@@ -10,7 +10,7 @@
 
 with lib;
 
-(if cudaSupport then stdenv_gcc5 else stdenv).mkDerivation rec {
+stdenv.mkDerivation rec {
   name = "blender-2.79";
 
   src = fetchurl {
@@ -57,9 +57,8 @@ with lib;
     ++ optional jackaudioSupport "-DWITH_JACK=ON"
     ++ optionals cudaSupport
       [ "-DWITH_CYCLES_CUDA_BINARIES=ON"
-        # Disable the sm_20 architecture to work around a segfault in
-        # ptxas, as suggested on #blendercoders.
-        "-DCYCLES_CUDA_BINARIES_ARCH=sm_21;sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61"
+        # Disable architectures before sm_30 to support new CUDA toolkits.
+        "-DCYCLES_CUDA_BINARIES_ARCH=sm_30;sm_35;sm_37;sm_50;sm_52;sm_60;sm_61"
       ]
     ++ optional colladaSupport "-DWITH_OPENCOLLADA=ON";
 
diff --git a/pkgs/applications/misc/electrum/default.nix b/pkgs/applications/misc/electrum/default.nix
index 0781617eb695..abe8d0dde84b 100644
--- a/pkgs/applications/misc/electrum/default.nix
+++ b/pkgs/applications/misc/electrum/default.nix
@@ -13,6 +13,7 @@ python2Packages.buildPythonApplication rec {
     dns
     ecdsa
     jsonrpclib
+    matplotlib
     pbkdf2
     protobuf
     pyaes
@@ -30,7 +31,6 @@ python2Packages.buildPythonApplication rec {
     # TODO plugins
     # amodem
     # btchip
-    # matplotlib
   ];
 
   preBuild = ''
diff --git a/pkgs/applications/misc/playonlinux/default.nix b/pkgs/applications/misc/playonlinux/default.nix
index b604905320b2..3f39a356312e 100644
--- a/pkgs/applications/misc/playonlinux/default.nix
+++ b/pkgs/applications/misc/playonlinux/default.nix
@@ -24,7 +24,7 @@
 assert stdenv.isLinux;
 
 let
-  version = "4.2.10";
+  version = "4.2.12";
 
   binpath = stdenv.lib.makeBinPath
     [ cabextract
@@ -57,7 +57,7 @@ in stdenv.mkDerivation {
 
   src = fetchurl {
     url = "https://www.playonlinux.com/script_files/PlayOnLinux/${version}/PlayOnLinux_${version}.tar.gz";
-    sha256 = "0ws94hgxajaww450q8ivrp28ypv39mashs29ak41faxf29cr097m";
+    sha256 = "03k8v9dknc5hfrfzqw1nkpifz7wkixv3mvjl1vnp4fx8rj2xrjrq";
   };
 
   nativeBuildInputs = [ makeWrapper ];
diff --git a/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix b/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix
index c9c67c015992..56cab9de5d07 100644
--- a/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix
+++ b/pkgs/applications/networking/browsers/tor-browser-bundle-bin/default.nix
@@ -98,7 +98,7 @@ let
   fteLibPath = makeLibraryPath [ stdenv.cc.cc gmp ];
 
   # Upstream source
-  version = "7.0.6";
+  version = "7.0.7";
 
   lang = "en-US";
 
@@ -108,7 +108,7 @@ let
         "https://github.com/TheTorProject/gettorbrowser/releases/download/v${version}/tor-browser-linux64-${version}_${lang}.tar.xz"
         "https://dist.torproject.org/torbrowser/${version}/tor-browser-linux64-${version}_${lang}.tar.xz"
       ];
-      sha256 = "11z3r0577p78ifi9lk4lrh9wb46k77wy77g5p9l8il02760bgq6m";
+      sha256 = "1848j28majbb61r080g6dw0lmh7hbp515iidyjdrpgcwhazzg06j";
     };
 
     "i686-linux" = fetchurl {
@@ -116,7 +116,7 @@ let
         "https://github.com/TheTorProject/gettorbrowser/releases/download/v${version}/tor-browser-linux32-${version}_${lang}.tar.xz"
         "https://dist.torproject.org/torbrowser/${version}/tor-browser-linux32-${version}_${lang}.tar.xz"
       ];
-      sha256 = "1r8v5w66clmm76kzpkf0f5jcxs76whb5xrl20rkirp79fybqn4hx";
+      sha256 = "08wvpymmyg16ifz23awnjy0pbva8xh1fdx2i8c1n18x3k12d5r7h";
     };
   };
 in
@@ -246,6 +246,11 @@ stdenv.mkDerivation rec {
     # having to synchronize between local state and store.
     mv TorBrowser/Data/Browser/profile.default/preferences/extension-overrides.js defaults/pref/torbrowser.js
 
+    # Preload extensions by moving into the runtime instead of storing under the
+    # user's profile directory.
+    mv "$TBB_IN_STORE/TorBrowser/Data/Browser/profile.default/extensions/"* \
+      "$TBB_IN_STORE/browser/extensions"
+
     # Hard-code paths to geoip data files.  TBB resolves the geoip files
     # relative to torrc-defaults_path but if we do not hard-code them
     # here, these paths end up being written to the torrc in the user's
@@ -301,10 +306,6 @@ stdenv.mkDerivation rec {
     # easily generated by firefox at startup.
     rm -f "\$HOME/TorBrowser/Data/Browser/profile.default"/{compatibility.ini,extensions.ini,extensions.json}
 
-    # Ensure that we're always using the up-to-date extensions.
-    ln -snf "$TBB_IN_STORE/TorBrowser/Data/Browser/profile.default/extensions" \
-      "\$HOME/TorBrowser/Data/Browser/profile.default/extensions"
-
     ${optionalString pulseaudioSupport ''
       # Figure out some envvars for pulseaudio
       : "\''${XDG_RUNTIME_DIR:=/run/user/\$(id -u)}"
diff --git a/pkgs/applications/networking/browsers/tor-browser-bundle/extensions.nix b/pkgs/applications/networking/browsers/tor-browser-bundle/extensions.nix
index 53c278bc0650..86c2f53b9add 100644
--- a/pkgs/applications/networking/browsers/tor-browser-bundle/extensions.nix
+++ b/pkgs/applications/networking/browsers/tor-browser-bundle/extensions.nix
@@ -16,14 +16,14 @@
 {
   https-everywhere = stdenv.mkDerivation rec {
     name = "https-everywhere-${version}";
-    version = "2017.9.12";
+    version = "2017.10.4";
 
     extid = "https-everywhere-eff@eff.org";
 
     src = fetchgit {
       url = "https://git.torproject.org/https-everywhere.git";
       rev = "refs/tags/${version}";
-      sha256 = "179429pngyksp9xkr86nf2m5q6zmg19c7ng1dhqjfb1vsncwgw66";
+      sha256 = "1g7971xygnhagnb25xjdf6mli6091ai9igx42d0ww88g8i0cqfzj";
       fetchSubmodules = true; # for translations, TODO: remove
     };
 
@@ -47,13 +47,13 @@
 
   noscript = stdenv.mkDerivation rec {
     name = "noscript-${version}";
-    version = "5.0.10";
+    version = "5.1.2";
 
     extid = "{73a6fe31-595d-460b-a920-fcc0f8843232}";
 
     src = fetchurl {
       url = "https://secure.informaction.com/download/releases/noscript-${version}.xpi";
-      sha256 = "18k5karbaj5mhd9cyjbqgik6044bw88rjalkh6anjanxbn503j6g";
+      sha256 = "1fzspdiwhjabwz1yxb3gzj7giz9jbc1xxm65i93rvhzcp537cs42";
     };
 
     unpackPhase = ":";
@@ -88,14 +88,14 @@
 
   tor-launcher = stdenv.mkDerivation rec {
     name = "tor-launcher-${version}";
-    version = "0.2.12.3";
+    version = "0.2.13";
 
     extid = "tor-launcher@torproject.org";
 
     src = fetchgit {
       url = "https://git.torproject.org/tor-launcher.git";
       rev = "refs/tags/${version}";
-      sha256 = "0126x48pjiy2zm4l8jzhk70w24hviaz560ffp4lb9x0ar615bc9q";
+      sha256 = "1f98v88y2clwvjiw77kxqc9cacp5h0489a540nc2wmsx7vnskrq0";
     };
 
     nativeBuildInputs = [ zip ];
diff --git a/pkgs/applications/science/math/caffe/default.nix b/pkgs/applications/science/math/caffe/default.nix
index cb28d38bf1d0..8dc3e3ce43dc 100644
--- a/pkgs/applications/science/math/caffe/default.nix
+++ b/pkgs/applications/science/math/caffe/default.nix
@@ -22,22 +22,23 @@ assert pythonSupport -> (python != null && numpy != null);
 
 stdenv.mkDerivation rec {
   name = "caffe-${version}";
-  version = "1.0-rc5";
+  version = "1.0";
 
   src = fetchFromGitHub {
     owner = "BVLC";
     repo = "caffe";
-    rev = "rc5";
-    sha256 = "0lfmmc0n6xvkpygvxclzrvd0zigb4yfc5612anv2ahlxpfi9031c";
+    rev = version;
+    sha256 = "104jp3cm823i3cdph7hgsnj6l77ygbwsy35mdmzhmsi4jxprd9j3";
   };
 
   enableParallelBuilding = true;
 
   nativeBuildInputs = [ cmake doxygen ];
 
-  cmakeFlags = [ "-DCUDA_ARCH_NAME=All" ]
-               ++ lib.optional (!cudaSupport) "-DCPU_ONLY=ON"
-               ++ lib.optional (!pythonSupport) "-DBUILD_python=OFF";
+  cmakeFlags = [
+    "-DCUDA_ARCH_NAME=All"
+    (if pythonSupport then "-Dpython_version=${python.version}" else "-DBUILD_python=OFF")
+  ] ++ lib.optional (!cudaSupport) "-DCPU_ONLY=ON";
 
   buildInputs = [ boost google-gflags glog protobuf hdf5-cpp lmdb leveldb snappy opencv atlas ]
                 ++ lib.optional cudaSupport cudatoolkit
@@ -49,6 +50,16 @@ stdenv.mkDerivation rec {
   outputs = [ "bin" "out"];
   propagatedBuildOutputs = []; # otherwise propagates out -> bin cycle
 
+  preConfigure = lib.optionalString (cudaSupport && lib.versionAtLeast cudatoolkit.version "9.0") ''
+    # CUDA 9.0 doesn't support sm_20
+    sed -i 's,20 21(20) ,,' cmake/Cuda.cmake
+  '' + lib.optionalString (python.isPy3 or false) ''
+    sed -i \
+      -e 's,"python-py''${boost_py_version}",python3,g' \
+      -e 's,''${Boost_PYTHON-PY''${boost_py_version}_FOUND},''${Boost_PYTHON3_FOUND},g' \
+      cmake/Dependencies.cmake
+  '';
+
   postInstall = ''
     # Internal static library.
     rm $out/lib/libproto.a
diff --git a/pkgs/applications/science/math/cntk/default.nix b/pkgs/applications/science/math/cntk/default.nix
new file mode 100644
index 000000000000..80a5f6f032b7
--- /dev/null
+++ b/pkgs/applications/science/math/cntk/default.nix
@@ -0,0 +1,98 @@
+{ lib, stdenv, fetchgit, fetchFromGitHub, fetchpatch, cmake
+, openblas, opencv3, libzip, boost, protobuf, openmpi
+, onebitSGDSupport ? false
+, cudaSupport ? false, cudatoolkit, nvidia_x11
+, cudnnSupport ? false, cudnn
+}:
+
+assert cudnnSupport -> cudaSupport;
+
+let
+  # Old specific version required for CNTK.
+  cub = fetchFromGitHub {
+    owner = "NVlabs";
+    repo = "cub";
+    rev = "1.4.1";
+    sha256 = "1lcdwblz03c0yq1lxndg566kg14b5qm14x5qixjbmz6wq85kgmqc";
+  };
+
+in stdenv.mkDerivation rec {
+  name = "CNTK-${version}";
+  version = "2.2";
+
+  # Submodules
+  src = fetchgit {
+    url = "https://github.com/Microsoft/CNTK";
+    rev = "v${version}";
+    sha256 = "0q4knrwiyphb2fbqf9jzqvkz2jzj6jmbmang3lavdvsh7z0n8zz9";
+  };
+
+  patches = [
+    # Fix "'exp' was not declared"
+    (fetchpatch {
+      url = "https://github.com/imriss/CNTK/commit/ef1cca6df95cc507deb8471df2c0dd8cbfeef23b.patch";
+      sha256 = "0z7xyrxwric0c4h7rfs05f544mcq6d10wgs0vvfcyd2pcf410hy7";
+    })
+  ];
+
+  nativeBuildInputs = [ cmake ];
+
+  buildInputs = [ openblas opencv3 libzip boost protobuf openmpi ]
+             ++ lib.optional cudaSupport cudatoolkit
+             ++ lib.optional cudnnSupport cudnn;
+
+  configureFlags = [
+    "--with-opencv=${opencv3}"
+    "--with-libzip=${libzip.dev}"
+    "--with-openblas=${openblas}"
+    "--with-boost=${boost.dev}"
+    "--with-protobuf=${protobuf}"
+    "--with-mpi=${openmpi}"
+  ] ++ lib.optionals cudaSupport [
+    "--cuda=yes"
+    "--with-cuda=${cudatoolkit}"
+    "--with-gdk-include=${cudatoolkit}/include"
+    "--with-gdk-nvml-lib=${nvidia_x11}/lib"
+    "--with-cub=${cub}"
+  ] ++ lib.optional onebitSGDSupport "--1bitsgd=yes";
+
+  configurePhase = ''
+    sed -i \
+      -e 's,^GIT_STATUS=.*,GIT_STATUS=,' \
+      -e 's,^GIT_COMMIT=.*,GIT_COMMIT=v${version},' \
+      -e 's,^GIT_BRANCH=.*,GIT_BRANCH=v${version},' \
+      -e 's,^BUILDER=.*,BUILDER=nixbld,' \
+      -e 's,^BUILDMACHINE=.*,BUILDMACHINE=machine,' \
+      -e 's,^BUILDPATH=.*,BUILDPATH=/homeless-shelter,' \
+      -e '/git does not exist/d' \
+      Tools/generate_build_info
+
+    patchShebangs .
+    mkdir build
+    cd build
+    ${lib.optionalString cudnnSupport ''
+      mkdir cuda
+      ln -s ${cudnn}/include cuda
+      export configureFlags="$configureFlags --with-cudnn=$PWD"
+    ''}
+    ../configure $configureFlags
+  '';
+
+  installPhase = ''
+    mkdir -p $out/bin
+    # Moving to make patchelf remove references later.
+    mv lib $out
+    cp bin/cntk $out/bin
+  '';
+
+  hardeningDisable = [ "format" ];
+
+  enableParallelBuilding = true;
+
+  meta = with lib; {
+    homepage = "https://github.com/Microsoft/CNTK";
+    description = "An open source deep-learning toolkit";
+    license = if onebitSGDSupport then licenses.unfreeRedistributable else licenses.mit;
+    maintainers = with maintainers; [ abbradar ];
+  };
+}
diff --git a/pkgs/applications/science/misc/root/ROOT-8728-extra.patch b/pkgs/applications/science/misc/root/ROOT-8728-extra.patch
deleted file mode 100644
index a396a848f142..000000000000
--- a/pkgs/applications/science/misc/root/ROOT-8728-extra.patch
+++ /dev/null
@@ -1,175 +0,0 @@
-diff --git a/core/metacling/src/TCling.cxx b/core/metacling/src/TCling.cxx
-index d71cb74..076facb 100644
---- a/core/metacling/src/TCling.cxx
-+++ b/core/metacling/src/TCling.cxx
-@@ -756,7 +756,7 @@ int TCling_GenerateDictionary(const std::vector<std::string> &classes,
-                gSystem->PrependPathName(dirbase, header);
-                dir = gSystem->DirName(dir);
-             }
--            fileContent += TString("#include \"") + header + "\"\n";
-+            fileContent += (TString("#include \"") + header + "\"\n").Data();
-          }
-       }
-       for (it = fwdDecls.begin(); it != fwdDecls.end(); ++it) {
-@@ -1061,7 +1061,7 @@ TCling::TCling(const char *name, const char *title)
-       ROOT::TMetaUtils::SetPathsForRelocatability(clingArgsStorage);
- 
-       // Add -I early so ASTReader can find the headers.
--      std::string interpInclude(TROOT::GetEtcDir());
-+      std::string interpInclude(TROOT::GetEtcDir().Data());
-       clingArgsStorage.push_back("-I" + interpInclude);
- 
-       // Add include path to etc/cling. FIXME: This is a short term solution. The
-@@ -1070,7 +1070,7 @@ TCling::TCling(const char *name, const char *title)
-       clingArgsStorage.push_back("-I" + interpInclude + "/cling");
- 
-       // Add the root include directory and etc/ to list searched by default.
--      clingArgsStorage.push_back(std::string("-I" + TROOT::GetIncludeDir()));
-+      clingArgsStorage.push_back(std::string(("-I" + TROOT::GetIncludeDir()).Data()));
- 
-       // Add the current path to the include path
-       // TCling::AddIncludePath(".");
-diff --git a/hist/hist/src/TFormula.cxx b/hist/hist/src/TFormula.cxx
-index abf3929..e7dad98 100644
---- a/hist/hist/src/TFormula.cxx
-+++ b/hist/hist/src/TFormula.cxx
-@@ -1677,7 +1677,7 @@ void TFormula::ProcessFormula(TString &formula)
-          if(fun.fName.Contains("::")) // add support for nested namespaces
-          {
-             // look for last occurence of "::"
--            std::string name(fun.fName);
-+            std::string name(fun.fName.Data());
-             size_t index = name.rfind("::");
-             assert(index != std::string::npos);
-             TString className = fun.fName(0,fun.fName(0,index).Length());
-@@ -1869,7 +1869,7 @@ void TFormula::ProcessFormula(TString &formula)
- 
-          // save copy of inputFormula in a std::strig for the unordered map
-          // and also formula is same as FClingInput typically and it will be modified
--         std::string inputFormula = std::string(formula);
-+         std::string inputFormula = std::string(formula.Data());
- 
- 
-          // valid input formula - try to put into Cling
-diff --git a/main/src/nbmain.cxx b/main/src/nbmain.cxx
-index 55d4f2f..8490149 100644
---- a/main/src/nbmain.cxx
-+++ b/main/src/nbmain.cxx
-@@ -173,9 +173,9 @@ static bool CreateStamp(string dest)
- 
- int main()
- {
--   string rootbin(TROOT::GetBinDir());
--   string rootlib(TROOT::GetLibDir());
--   string rootetc(TROOT::GetEtcDir());
-+   string rootbin(TROOT::GetBinDir().Data());
-+   string rootlib(TROOT::GetLibDir().Data());
-+   string rootetc(TROOT::GetEtcDir().Data());
- 
-    // If needed, install ROOT notebook files in the user's home directory
- #ifdef WIN32
-diff --git a/math/minuit/src/TMinuitMinimizer.cxx b/math/minuit/src/TMinuitMinimizer.cxx
-index 4e2082a..18215c0 100644
---- a/math/minuit/src/TMinuitMinimizer.cxx
-+++ b/math/minuit/src/TMinuitMinimizer.cxx
-@@ -454,7 +454,7 @@ std::string TMinuitMinimizer::VariableName(unsigned int ivar) const {
-    // return the variable name
-    if (!CheckMinuitInstance()) return std::string();
-    if (!CheckVarIndex(ivar)) return std::string();
--   return std::string(fMinuit->fCpnam[ivar]);
-+   return std::string(fMinuit->fCpnam[ivar].Data());
- }
- 
- int TMinuitMinimizer::VariableIndex(const std::string & ) const {
-diff --git a/tmva/tmva/src/Factory.cxx b/tmva/tmva/src/Factory.cxx
-index 36060ef..a1bbe34 100644
---- a/tmva/tmva/src/Factory.cxx
-+++ b/tmva/tmva/src/Factory.cxx
-@@ -390,7 +390,7 @@ TMVA::MethodBase* TMVA::Factory::BookMethod( TMVA::DataLoader *loader, TString t
-    // initialize methods
-    IMethod* im;
-    if (!boostNum) {
--      im = ClassifierFactory::Instance().Create( std::string(theMethodName),
-+      im = ClassifierFactory::Instance().Create( std::string(theMethodName.Data()),
-                                                  fJobName,
-                                                  methodTitle,
-                                                  loader->DefaultDataSetInfo(),
-@@ -933,7 +933,7 @@ void TMVA::Factory::TrainAllMethods()
- 
-        // recreate
-        m = dynamic_cast<MethodBase*>( ClassifierFactory::Instance()
--                   .Create( std::string(Types::Instance().GetMethodName(methodType)),
-+                   .Create( std::string(Types::Instance().GetMethodName(methodType).Data()),
-                       dataSetInfo, weightfile ) );
-        if( m->GetMethodType() == Types::kCategory ){
-       MethodCategory *methCat = (dynamic_cast<MethodCategory*>(m));
-diff --git a/tmva/tmva/src/MethodBoost.cxx b/tmva/tmva/src/MethodBoost.cxx
-index 1349e5d..2125ab3 100644
---- a/tmva/tmva/src/MethodBoost.cxx
-+++ b/tmva/tmva/src/MethodBoost.cxx
-@@ -389,7 +389,7 @@ void TMVA::MethodBoost::Train()
-       // the first classifier shows the option string output, the rest not
-       if (fCurrentMethodIdx>0) TMVA::MsgLogger::InhibitOutput();
- 
--      IMethod* method = ClassifierFactory::Instance().Create(std::string(fBoostedMethodName),
-+      IMethod* method = ClassifierFactory::Instance().Create(std::string(fBoostedMethodName.Data()),
-                                                              GetJobName(),
-                                                              Form("%s_B%04i", fBoostedMethodTitle.Data(),fCurrentMethodIdx),
-                                                              DataInfo(),
-diff --git a/tmva/tmva/src/MethodCategory.cxx b/tmva/tmva/src/MethodCategory.cxx
-index c2cbe80..d278cca 100644
---- a/tmva/tmva/src/MethodCategory.cxx
-+++ b/tmva/tmva/src/MethodCategory.cxx
-@@ -147,7 +147,7 @@ TMVA::IMethod* TMVA::MethodCategory::AddMethod( const TCut& theCut,
-                                                 const TString& theTitle,
-                                                 const TString& theOptions )
- {
--   std::string addedMethodName = std::string(Types::Instance().GetMethodName(theMethod));
-+   std::string addedMethodName = std::string(Types::Instance().GetMethodName(theMethod).Data());
- 
-    Log() << kINFO << "Adding sub-classifier: " << addedMethodName << "::" << theTitle << Endl;
- 
-diff --git a/tmva/tmva/src/MethodCompositeBase.cxx b/tmva/tmva/src/MethodCompositeBase.cxx
-index 98fa5da..96bd9a3 100644
---- a/tmva/tmva/src/MethodCompositeBase.cxx
-+++ b/tmva/tmva/src/MethodCompositeBase.cxx
-@@ -194,7 +194,7 @@ void TMVA::MethodCompositeBase::ReadWeightsFromXML( void* wghtnode )
-          ((TMVA::MethodBoost*)this)->BookMethod( Types::Instance().GetMethodType( methodTypeName), methodName,  optionString );
-       }
-       fMethods.push_back(ClassifierFactory::Instance().Create(
--                                                              std::string(methodTypeName),jobName, methodName,DataInfo(),optionString));
-+                                                              std::string(methodTypeName.Data()),jobName, methodName,DataInfo(),optionString));
- 
-       fMethodWeight.push_back(methodWeight);
-       MethodBase* meth = dynamic_cast<MethodBase*>(fMethods.back());
-@@ -259,7 +259,7 @@ void  TMVA::MethodCompositeBase::ReadWeightsFromStream( std::istream& istr )
-             ((TMVA::MethodBoost*)this)->BookMethod( Types::Instance().GetMethodType( methodName), methodTitle,  optionString );
-       }
-       else methodTitle=Form("%s (%04i)",GetMethodName().Data(),fCurrentMethodIdx);
--      fMethods.push_back(ClassifierFactory::Instance().Create( std::string(methodName), jobName,
-+      fMethods.push_back(ClassifierFactory::Instance().Create( std::string(methodName.Data()), jobName,
-                                                                methodTitle,DataInfo(), optionString) );
-       fMethodWeight.push_back( methodWeight );
-       if(MethodBase* m = dynamic_cast<MethodBase*>(fMethods.back()) )
-diff --git a/tmva/tmva/src/Reader.cxx b/tmva/tmva/src/Reader.cxx
-index 94a8b28..0b67867 100644
---- a/tmva/tmva/src/Reader.cxx
-+++ b/tmva/tmva/src/Reader.cxx
-@@ -401,7 +401,7 @@ TMVA::IMethod* TMVA::Reader::BookMVA( const TString& methodTag, const TString& w
- 
- TMVA::IMethod* TMVA::Reader::BookMVA( TMVA::Types::EMVA methodType, const TString& weightfile )
- {
--   IMethod* im = ClassifierFactory::Instance().Create(std::string(Types::Instance().GetMethodName( methodType )),
-+   IMethod* im = ClassifierFactory::Instance().Create(std::string(Types::Instance().GetMethodName( methodType ).Data()),
-                                                       DataInfo(), weightfile );
- 
-    MethodBase *method = (dynamic_cast<MethodBase*>(im));
-@@ -440,7 +440,7 @@ TMVA::IMethod* TMVA::Reader::BookMVA( TMVA::Types::EMVA methodType, const char*
- #if ROOT_VERSION_CODE >= ROOT_VERSION(5,26,00)
- 
-    // books MVA method from weightfile
--   IMethod* im = ClassifierFactory::Instance().Create(std::string(Types::Instance().GetMethodName( methodType )),
-+   IMethod* im = ClassifierFactory::Instance().Create(std::string(Types::Instance().GetMethodName( methodType ).Data()),
-                                                       DataInfo(), "" );
- 
-    MethodBase *method = (dynamic_cast<MethodBase*>(im));
diff --git a/pkgs/applications/science/misc/root/default.nix b/pkgs/applications/science/misc/root/default.nix
index ac04321ae0c4..676395d03d53 100644
--- a/pkgs/applications/science/misc/root/default.nix
+++ b/pkgs/applications/science/misc/root/default.nix
@@ -1,30 +1,24 @@
 { stdenv, fetchurl, fetchpatch, cmake, pcre, pkgconfig, python2
-, libX11, libXpm, libXft, libXext, mesa, zlib, libxml2, lzma, gsl
+, libX11, libXpm, libXft, libXext, mesa, zlib, libxml2, lz4, lzma, gsl, xxHash
 , Cocoa, OpenGL, noSplash ? false }:
 
 stdenv.mkDerivation rec {
   name = "root-${version}";
-  version = "6.10.04";
+  version = "6.10.08";
 
   src = fetchurl {
     url = "https://root.cern.ch/download/root_v${version}.source.tar.gz";
-    sha256 = "0nwg4bw02v6vahm2rwfaj7fzp3ffhjg5jk7h20il4246swhxw6s6";
+    sha256 = "12mddl6pqwwc9nr4jqzp6h1jm4zycazd3v88dz306m1nmk97dlic";
   };
 
   nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ cmake pcre python2 zlib libxml2 lzma gsl ]
+  buildInputs = [ cmake pcre python2 zlib libxml2 lz4 lzma gsl xxHash ]
     ++ stdenv.lib.optionals (!stdenv.isDarwin) [ libX11 libXpm libXft libXext mesa ]
     ++ stdenv.lib.optionals (stdenv.isDarwin) [ Cocoa OpenGL ]
     ;
 
   patches = [
     ./sw_vers.patch
-
-    # this prevents thisroot.sh from setting $p, which interferes with stdenv setup
-    ./thisroot.patch
-
-    # https://sft.its.cern.ch/jira/browse/ROOT-8728
-    ./ROOT-8728-extra.patch
   ];
 
   preConfigure = ''
diff --git a/pkgs/applications/science/misc/root/thisroot.patch b/pkgs/applications/science/misc/root/thisroot.patch
deleted file mode 100644
index 57cd5838e64a..000000000000
--- a/pkgs/applications/science/misc/root/thisroot.patch
+++ /dev/null
@@ -1,15 +0,0 @@
-diff --git a/config/thisroot.sh b/config/thisroot.sh
-index 85dee20..532cb28 100644
---- a/config/thisroot.sh
-+++ b/config/thisroot.sh
-@@ -15,8 +15,8 @@ drop_from_path()
-       return 1
-    fi
- 
--   p=$1
--   drop=$2
-+   local p=$1
-+   local drop=$2
- 
-    newpath=`echo $p | sed -e "s;:${drop}:;:;g" \
-                           -e "s;:${drop};;g"   \
diff --git a/pkgs/applications/virtualization/docker/default.nix b/pkgs/applications/virtualization/docker/default.nix
index 49920e28f766..48bb512e1341 100644
--- a/pkgs/applications/virtualization/docker/default.nix
+++ b/pkgs/applications/virtualization/docker/default.nix
@@ -46,10 +46,10 @@ rec {
       };
 
       # This should go into the containerd derivation once 1.0.0 is out
-      preBuild = (optionalString (version == "17.09.0-ce") ''
+      preBuild = ''
         mkdir $(pwd)/vendor/src
         mv $(pwd)/vendor/{github.com,golang.org,google.golang.org} $(pwd)/vendor/src/
-      '') + oldAttrs.preBuild;
+      '' + oldAttrs.preBuild;
     });
     docker-tini = tini.overrideAttrs  (oldAttrs: rec {
       name = "docker-init";
@@ -122,7 +122,13 @@ rec {
 
     installPhase = ''
       install -Dm755 ./components/cli/docker $out/libexec/docker/docker
-      install -Dm755 ./components/engine/bundles/${version}/dynbinary-daemon/dockerd-${version} $out/libexec/docker/dockerd
+
+      if [ -d "./components/engine/bundles/${version}" ]; then
+        install -Dm755 ./components/engine/bundles/${version}/dynbinary-daemon/dockerd-${version} $out/libexec/docker/dockerd
+      else
+        install -Dm755 ./components/engine/bundles/dynbinary-daemon/dockerd-${version} $out/libexec/docker/dockerd
+      fi
+
       makeWrapper $out/libexec/docker/docker $out/bin/docker \
         --prefix PATH : "$out/libexec/docker:$extraPath"
       makeWrapper $out/libexec/docker/dockerd $out/bin/dockerd \
@@ -175,7 +181,7 @@ rec {
       homepage = https://www.docker.com/;
       description = "An open source project to pack, ship and run any application as a lightweight container";
       license = licenses.asl20;
-      maintainers = with maintainers; [ offline tailhook vdemeester ];
+      maintainers = with maintainers; [ nequissimus offline tailhook vdemeester ];
       platforms = platforms.linux;
     };
   };
@@ -183,18 +189,6 @@ rec {
   # Get revisions from
   # https://github.com/docker/docker-ce/blob/v${version}/components/engine/hack/dockerfile/binaries-commits
 
-  docker_17_06 = dockerGen rec {
-    version = "17.06.2-ce";
-    rev = "cec0b72a9940e047e945a09e1febd781e88366d6"; # git commit
-    sha256 = "1scqx28vzh72ziq00lbx92vsb896mj974j8f0zg11y6qc5n5jx3l";
-    runcRev = "810190ceaa507aa2727d7ae6f4790c76ec150bd2";
-    runcSha256 = "0f1x1z262qg579qb1w21axj3mibq4fbff3gamliw49sdqqnb7vk3";
-    containerdRev = "6e23458c129b551d5c9871e5174f6b1b7f6d1170";
-    containerdSha256 = "12kzc5z1nhxdbizzr494ywilbs6rdv39v5ql7lmfzwh350gwlg93";
-    tiniRev = "949e6facb77383876aeff8a6944dde66b3089574";
-    tiniSha256 = "0zj4kdis1vvc6dwn4gplqna0bs7v6d1y2zc8v80s3zi018inhznw";
-  };
-
   docker_17_09 = dockerGen rec {
     version = "17.09.0-ce";
     rev = "afdb6d44a80f777069885a9ee0e0f86cf841b1bb"; # git commit
@@ -206,4 +200,16 @@ rec {
     tiniRev = "949e6facb77383876aeff8a6944dde66b3089574";
     tiniSha256 = "0zj4kdis1vvc6dwn4gplqna0bs7v6d1y2zc8v80s3zi018inhznw";
   };
+
+  docker_17_10 = dockerGen rec {
+    version = "17.10.0-ce";
+    rev = "f4ffd2511ce93aa9e5eefdf0e912f77543080b0b"; # git commit
+    sha256 = "07x47cfdaz4lhlga1pchcbqqy0nd2q6zch0ycag18vzi99w4gmh2";
+    runcRev = "0351df1c5a66838d0c392b4ac4cf9450de844e2d";
+    runcSha256 = "1cmkdv6rli7v0y0fddqxvrvzd486fg9ssp3kgkya3szkljzz4xj0";
+    containerdRev = "06b9cb35161009dcb7123345749fef02f7cea8e0";
+    containerdSha256 = "10hms8a2nn69nfnwly6923jzx40c3slpsdhjhff4bxh36flpf9gd";
+    tiniRev = "949e6facb77383876aeff8a6944dde66b3089574";
+    tiniSha256 = "0zj4kdis1vvc6dwn4gplqna0bs7v6d1y2zc8v80s3zi018inhznw";
+  };
 }
diff --git a/pkgs/applications/virtualization/lkl/default.nix b/pkgs/applications/virtualization/lkl/default.nix
index b790a15e607f..c62fa63ea594 100644
--- a/pkgs/applications/virtualization/lkl/default.nix
+++ b/pkgs/applications/virtualization/lkl/default.nix
@@ -1,8 +1,8 @@
 { stdenv, fetchFromGitHub, bc, python, fuse, libarchive }:
 
 stdenv.mkDerivation rec {
-  name = "lkl-2017-08-09";
-  rev  = "083cdeece0577635d523244dcf0da86074e23e4e";
+  name = "lkl-2017-10-18";
+  rev  = "bfb315c4612c38427e3239d0a427a125d9ba0ede";
 
   outputs = [ "dev" "lib" "out" ];
 
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
     inherit rev;
     owner  = "lkl";
     repo   = "linux";
-    sha256 = "1fyh0p54jgsqywswj40zbw64jbqx2w10wax1k3j2szzlhjrv9x1a";
+    sha256 = "172ccn2gsybnji7giiqq63bvp9nsw8kri88pjlvinwpwsv7x81aa";
   };
 
   # Fix a /usr/bin/env reference in here that breaks sandboxed builds
diff --git a/pkgs/applications/virtualization/xen/4.5.nix b/pkgs/applications/virtualization/xen/4.5.nix
index 5fe4fa823fea..614122a3b24e 100644
--- a/pkgs/applications/virtualization/xen/4.5.nix
+++ b/pkgs/applications/virtualization/xen/4.5.nix
@@ -1,4 +1,5 @@
 { stdenv, callPackage, fetchurl, fetchpatch, fetchgit
+, ocamlPackages_4_02
 , withInternalQemu ? true
 , withInternalTraditionalQemu ? true
 , withInternalSeabios ? true
@@ -414,4 +415,4 @@ callPackage (import ./generic.nix (rec {
       -i tools/libxl/libxl_device.c
   '';
 
-})) args
+})) ({ ocamlPackages = ocamlPackages_4_02; } // args)
diff --git a/pkgs/applications/window-managers/sway/default.nix b/pkgs/applications/window-managers/sway/default.nix
index 2c94f7f6fecc..8de87d2e8fd6 100644
--- a/pkgs/applications/window-managers/sway/default.nix
+++ b/pkgs/applications/window-managers/sway/default.nix
@@ -5,17 +5,15 @@
 , libXdmcp
 }:
 
-let
-  # TODO: Sway 0.14.0 with wlc 0.0.10 segfaults
-  version = "0.13.0";
-in stdenv.mkDerivation rec {
+stdenv.mkDerivation rec {
   name = "sway-${version}";
+  version = "0.14.0";
 
   src = fetchFromGitHub {
     owner = "Sircmpwn";
     repo = "sway";
     rev = "${version}";
-    sha256 = "1vgk4rl51nx66yzpwg4yhnbj7wc30k5q0hh5lf8y0i1nvpal0p3q";
+    sha256 = "1l8v9cdzd44bm4q71d47vqg6933b8j42q1a61r362vz2la1rcpq2";
   };
 
   nativeBuildInputs = [
diff --git a/pkgs/desktops/plasma-5/default.nix b/pkgs/desktops/plasma-5/default.nix
index 2bb4b7deceff..a9b3f1781324 100644
--- a/pkgs/desktops/plasma-5/default.nix
+++ b/pkgs/desktops/plasma-5/default.nix
@@ -133,6 +133,7 @@ let
       plasma-integration = callPackage ./plasma-integration.nix {};
       plasma-nm = callPackage ./plasma-nm {};
       plasma-pa = callPackage ./plasma-pa.nix { inherit gconf; };
+      plasma-vault = callPackage ./plasma-vault {};
       plasma-workspace = callPackage ./plasma-workspace {};
       plasma-workspace-wallpapers = callPackage ./plasma-workspace-wallpapers.nix {};
       polkit-kde-agent = callPackage ./polkit-kde-agent.nix {};
diff --git a/pkgs/desktops/plasma-5/fetch.sh b/pkgs/desktops/plasma-5/fetch.sh
index 7513c83c107c..f4d396047261 100644
--- a/pkgs/desktops/plasma-5/fetch.sh
+++ b/pkgs/desktops/plasma-5/fetch.sh
@@ -1 +1 @@
-WGET_ARGS=( https://download.kde.org/stable/plasma/5.10.5/ -A '*.tar.xz' )
+WGET_ARGS=( https://download.kde.org/stable/plasma/5.11.1/ -A '*.tar.xz' )
diff --git a/pkgs/desktops/plasma-5/kde-cli-tools.nix b/pkgs/desktops/plasma-5/kde-cli-tools.nix
index 6bcafc5813a9..63219d8cbe1a 100644
--- a/pkgs/desktops/plasma-5/kde-cli-tools.nix
+++ b/pkgs/desktops/plasma-5/kde-cli-tools.nix
@@ -1,7 +1,7 @@
 {
   mkDerivation, extra-cmake-modules, kdoctools,
   kcmutils, kconfig, kdesu, ki18n, kiconthemes, kinit, kio, kwindowsystem,
-  qtsvg, qtx11extras,
+  qtsvg, qtx11extras, kactivities
 }:
 
 mkDerivation {
@@ -9,6 +9,6 @@ mkDerivation {
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   buildInputs = [
     kcmutils kconfig kdesu ki18n kiconthemes kinit kio kwindowsystem qtsvg
-    qtx11extras
+    qtx11extras kactivities
   ];
 }
diff --git a/pkgs/desktops/plasma-5/plasma-desktop/ibus.patch b/pkgs/desktops/plasma-5/plasma-desktop/ibus.patch
deleted file mode 100644
index d5ac4b250875..000000000000
--- a/pkgs/desktops/plasma-5/plasma-desktop/ibus.patch
+++ /dev/null
@@ -1,26 +0,0 @@
-Index: plasma-desktop-5.8.5/kcms/keyboard/xkb_helper.cpp
-===================================================================
---- plasma-desktop-5.8.5.orig/kcms/keyboard/xkb_helper.cpp
-+++ plasma-desktop-5.8.5/kcms/keyboard/xkb_helper.cpp
-@@ -185,21 +185,5 @@ bool XkbHelper::initializeKeyboardLayout
- 
- bool XkbHelper::preInitialize()
- {
--    // stop ibus so it does not mess with our layouts, we can remove this when we integrate IM into keyboard module
--
--    QString ibusExe = QStandardPaths::findExecutable(QStringLiteral("ibus"));
--    if( ibusExe.isEmpty() ) {
--        return 0;
--    }
--
--    KProcess ibusProcess;
--    ibusProcess << ibusExe << QStringLiteral("exit");
--    ibusProcess.setOutputChannelMode(KProcess::SeparateChannels);
--    int res = ibusProcess.execute();
--
--    if( res == 0 ) {
--        qCWarning(KCM_KEYBOARD) << "ibus successfully stopped";
--    }
--
-     return 0;
- }
diff --git a/pkgs/desktops/plasma-5/plasma-desktop/qml-import-paths.patch b/pkgs/desktops/plasma-5/plasma-desktop/qml-import-paths.patch
index def5b577b972..d3f5166d5ed9 100644
--- a/pkgs/desktops/plasma-5/plasma-desktop/qml-import-paths.patch
+++ b/pkgs/desktops/plasma-5/plasma-desktop/qml-import-paths.patch
@@ -1,27 +1,14 @@
-Index: plasma-desktop-5.8.5/applets/pager/package/contents/ui/main.qml
-===================================================================
---- plasma-desktop-5.8.5.orig/applets/pager/package/contents/ui/main.qml
-+++ plasma-desktop-5.8.5/applets/pager/package/contents/ui/main.qml
-@@ -25,7 +25,7 @@ import org.kde.plasma.components 2.0 as
- import org.kde.kquickcontrolsaddons 2.0 as KQuickControlsAddonsComponents
- import org.kde.draganddrop 2.0
- import org.kde.plasma.private.pager 2.0
--import "utils.js" as Utils
-+import "../code/utils.js" as Utils
- 
- MouseArea {
-     id: root
 Index: plasma-desktop-5.8.5/containments/desktop/package/contents/ui/FolderView.qml
 ===================================================================
 --- plasma-desktop-5.8.5.orig/containments/desktop/package/contents/ui/FolderView.qml
 +++ plasma-desktop-5.8.5/containments/desktop/package/contents/ui/FolderView.qml
 @@ -27,7 +27,7 @@ import org.kde.plasma.extras 2.0 as Plas
  import org.kde.kquickcontrolsaddons 2.0
- 
+
  import org.kde.private.desktopcontainment.folder 0.1 as Folder
 -import "FolderTools.js" as FolderTools
 +import "../code/FolderTools.js" as FolderTools
- 
+
  Item {
      id: main
 Index: plasma-desktop-5.8.5/containments/desktop/package/contents/ui/main.qml
@@ -29,14 +16,14 @@ Index: plasma-desktop-5.8.5/containments/desktop/package/contents/ui/main.qml
 --- plasma-desktop-5.8.5.orig/containments/desktop/package/contents/ui/main.qml
 +++ plasma-desktop-5.8.5/containments/desktop/package/contents/ui/main.qml
 @@ -30,8 +30,8 @@ import org.kde.kquickcontrolsaddons 2.0
- 
+
  import org.kde.private.desktopcontainment.desktop 0.1 as Desktop
- 
+
 -import "LayoutManager.js" as LayoutManager
 -import "FolderTools.js" as FolderTools
 +import "../code/LayoutManager.js" as LayoutManager
 +import "../code/FolderTools.js" as FolderTools
- 
+
  DragDrop.DropArea {
      id: root
 Index: plasma-desktop-5.8.5/containments/panel/contents/ui/main.qml
@@ -46,9 +33,9 @@ Index: plasma-desktop-5.8.5/containments/panel/contents/ui/main.qml
 @@ -25,7 +25,7 @@ import org.kde.plasma.components 2.0 as
  import org.kde.kquickcontrolsaddons 2.0
  import org.kde.draganddrop 2.0 as DragDrop
- 
+
 -import "LayoutManager.js" as LayoutManager
 +import "../code/LayoutManager.js" as LayoutManager
- 
+
  DragDrop.DropArea {
      id: root
diff --git a/pkgs/desktops/plasma-5/plasma-desktop/series b/pkgs/desktops/plasma-5/plasma-desktop/series
index 36778cd1c560..6334deb7d973 100644
--- a/pkgs/desktops/plasma-5/plasma-desktop/series
+++ b/pkgs/desktops/plasma-5/plasma-desktop/series
@@ -1,4 +1,3 @@
 qml-import-paths.patch
 hwclock-path.patch
 tzdir.patch
-ibus.patch
diff --git a/pkgs/desktops/plasma-5/plasma-integration.nix b/pkgs/desktops/plasma-5/plasma-integration.nix
index de46bb4373c6..f69644287624 100644
--- a/pkgs/desktops/plasma-5/plasma-integration.nix
+++ b/pkgs/desktops/plasma-5/plasma-integration.nix
@@ -2,7 +2,7 @@
   mkDerivation,
   extra-cmake-modules,
   breeze-qt5, kconfig, kconfigwidgets, kiconthemes, kio, knotifications,
-  kwayland, libXcursor
+  kwayland, libXcursor, qtquickcontrols2
 }:
 
 # TODO: install Noto Sans and Oxygen Mono fonts with plasma-integration
@@ -12,6 +12,6 @@ mkDerivation {
   nativeBuildInputs = [ extra-cmake-modules ];
   buildInputs = [
     breeze-qt5 kconfig kconfigwidgets kiconthemes kio knotifications kwayland
-    libXcursor
+    libXcursor qtquickcontrols2
   ];
 }
diff --git a/pkgs/desktops/plasma-5/plasma-vault/cryfs-path.patch b/pkgs/desktops/plasma-5/plasma-vault/cryfs-path.patch
new file mode 100644
index 000000000000..b3f19c4e0025
--- /dev/null
+++ b/pkgs/desktops/plasma-5/plasma-vault/cryfs-path.patch
@@ -0,0 +1,17 @@
+diff --git a/kded/engine/backends/cryfs/cryfsbackend.cpp b/kded/engine/backends/cryfs/cryfsbackend.cpp
+index f6ef54f..160034a 100644
+--- a/kded/engine/backends/cryfs/cryfsbackend.cpp
++++ b/kded/engine/backends/cryfs/cryfsbackend.cpp
+@@ -136,11 +136,10 @@ bool CryFsBackend::isInitialized(const Device &device) const
+ 
+ QProcess *CryFsBackend::cryfs(const QStringList &arguments) const
+ {
+-    return process("cryfs",
++    return process(NIXPKGS_CRYFS,
+                    arguments,
+                    { { "CRYFS_FRONTEND", "noninteractive" } });
+ }
+ 
+ 
+ } // namespace PlasmaVault
+-
diff --git a/pkgs/desktops/plasma-5/plasma-vault/default.nix b/pkgs/desktops/plasma-5/plasma-vault/default.nix
new file mode 100644
index 000000000000..203ff50d7357
--- /dev/null
+++ b/pkgs/desktops/plasma-5/plasma-vault/default.nix
@@ -0,0 +1,38 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+
+  kactivities,
+  plasma-framework,
+  kwindowsystem,
+  libksysguard,
+
+  encfs,
+  cryfs,
+  fuse
+}:
+
+mkDerivation {
+  name = "plasma-vault";
+  nativeBuildInputs = [ extra-cmake-modules ];
+
+  patches = [
+    ./encfs-path.patch
+    ./cryfs-path.patch
+    ./fusermount-path.patch
+  ];
+
+  buildInputs = [
+    kactivities plasma-framework kwindowsystem libksysguard
+  ];
+
+  NIX_CFLAGS_COMPILE = [
+    ''-DNIXPKGS_ENCFS="${lib.getBin encfs}/bin/encfs"''
+    ''-DNIXPKGS_ENCFSCTL="${lib.getBin encfs}/bin/encfsctl"''
+
+    ''-DNIXPKGS_CRYFS="${lib.getBin cryfs}/bin/cryfs"''
+
+    ''-DNIXPKGS_FUSERMOUNT="${lib.getBin fuse}/bin/fusermount"''
+  ];
+
+}
diff --git a/pkgs/desktops/plasma-5/plasma-vault/encfs-path.patch b/pkgs/desktops/plasma-5/plasma-vault/encfs-path.patch
new file mode 100644
index 000000000000..b494df55c5d0
--- /dev/null
+++ b/pkgs/desktops/plasma-5/plasma-vault/encfs-path.patch
@@ -0,0 +1,24 @@
+diff --git a/kded/engine/backends/encfs/encfsbackend.cpp b/kded/engine/backends/encfs/encfsbackend.cpp
+index 47bb237..4ff064d 100644
+--- a/kded/engine/backends/encfs/encfsbackend.cpp
++++ b/kded/engine/backends/encfs/encfsbackend.cpp
+@@ -132,17 +132,16 @@ bool EncFsBackend::isInitialized(const Device &device) const
+ 
+ QProcess *EncFsBackend::encfs(const QStringList &arguments) const
+ {
+-    return process("encfs", arguments, {});
++    return process(NIXPKGS_ENCFS, arguments, {});
+ }
+ 
+ 
+ 
+ QProcess *EncFsBackend::encfsctl(const QStringList &arguments) const
+ {
+-    return process("encfsctl", arguments, {});
++    return process(NIXPKGS_ENCFSCTL, arguments, {});
+ }
+ 
+ 
+ 
+ } // namespace PlasmaVault
+-
diff --git a/pkgs/desktops/plasma-5/plasma-vault/fusermount-path.patch b/pkgs/desktops/plasma-5/plasma-vault/fusermount-path.patch
new file mode 100644
index 000000000000..cd1b736a103f
--- /dev/null
+++ b/pkgs/desktops/plasma-5/plasma-vault/fusermount-path.patch
@@ -0,0 +1,18 @@
+diff --git a/kded/engine/fusebackend_p.cpp b/kded/engine/fusebackend_p.cpp
+index 81ce494..d3c5c9f 100644
+--- a/kded/engine/fusebackend_p.cpp
++++ b/kded/engine/fusebackend_p.cpp
+@@ -103,7 +103,7 @@ QProcess *FuseBackend::process(const QString &executable,
+ 
+ QProcess *FuseBackend::fusermount(const QStringList &arguments) const
+ {
+-    return process("fusermount", arguments, {});
++    return process(NIXPKGS_FUSERMOUNT, arguments, {});
+ }
+ 
+ 
+@@ -245,4 +245,3 @@ bool FuseBackend::isOpened(const MountPoint &mountPoint) const
+ }
+ 
+ } // namespace PlasmaVault
+-
diff --git a/pkgs/desktops/plasma-5/plasma-workspace/qml-import-path.patch b/pkgs/desktops/plasma-5/plasma-workspace/qml-import-path.patch
index 12eb65caa717..3b3d318d3bbf 100644
--- a/pkgs/desktops/plasma-5/plasma-workspace/qml-import-path.patch
+++ b/pkgs/desktops/plasma-5/plasma-workspace/qml-import-path.patch
@@ -1,16 +1,3 @@
-Index: plasma-workspace-5.6.3/applets/analog-clock/contents/ui/analogclock.qml
-===================================================================
---- plasma-workspace-5.6.3.orig/applets/analog-clock/contents/ui/analogclock.qml
-+++ plasma-workspace-5.6.3/applets/analog-clock/contents/ui/analogclock.qml
-@@ -26,7 +26,7 @@ import QtQuick.Layouts 1.1
- 
- import org.kde.plasma.core 2.0 as PlasmaCore
- import org.kde.plasma.components 2.0 as PlasmaComponents
--import "logic.js" as Logic
-+import "../code/logic.js" as Logic
- 
- Item {
-     id: analogclock
 Index: plasma-workspace-5.6.3/applets/batterymonitor/package/contents/ui/BatteryItem.qml
 ===================================================================
 --- plasma-workspace-5.6.3.orig/applets/batterymonitor/package/contents/ui/BatteryItem.qml
@@ -21,35 +8,9 @@ Index: plasma-workspace-5.6.3/applets/batterymonitor/package/contents/ui/Battery
  import org.kde.kcoreaddons 1.0 as KCoreAddons
 -import "logic.js" as Logic
 +import "../code/logic.js" as Logic
- 
+
  Item {
      id: batteryItem
-Index: plasma-workspace-5.6.3/applets/batterymonitor/package/contents/ui/CompactRepresentation.qml
-===================================================================
---- plasma-workspace-5.6.3.orig/applets/batterymonitor/package/contents/ui/CompactRepresentation.qml
-+++ plasma-workspace-5.6.3/applets/batterymonitor/package/contents/ui/CompactRepresentation.qml
-@@ -24,7 +24,7 @@ import QtQuick.Layouts 1.1
- import org.kde.plasma.core 2.0 as PlasmaCore
- import org.kde.plasma.components 2.0 as Components
- import org.kde.plasma.workspace.components 2.0
--import "logic.js" as Logic
-+import "../code/logic.js" as Logic
- 
- MouseArea {
-     id: root
-Index: plasma-workspace-5.6.3/applets/batterymonitor/package/contents/ui/PopupDialog.qml
-===================================================================
---- plasma-workspace-5.6.3.orig/applets/batterymonitor/package/contents/ui/PopupDialog.qml
-+++ plasma-workspace-5.6.3/applets/batterymonitor/package/contents/ui/PopupDialog.qml
-@@ -23,7 +23,7 @@ import org.kde.plasma.core 2.0 as Plasma
- import org.kde.plasma.components 2.0 as Components
- import org.kde.plasma.extras 2.0 as PlasmaExtras
- import org.kde.kquickcontrolsaddons 2.0
--import "logic.js" as Logic
-+import "../code/logic.js" as Logic
- 
- FocusScope {
-     id: dialog
 Index: plasma-workspace-5.6.3/applets/batterymonitor/package/contents/ui/batterymonitor.qml
 ===================================================================
 --- plasma-workspace-5.6.3.orig/applets/batterymonitor/package/contents/ui/batterymonitor.qml
@@ -60,7 +21,7 @@ Index: plasma-workspace-5.6.3/applets/batterymonitor/package/contents/ui/battery
  import org.kde.kquickcontrolsaddons 2.0
 -import "logic.js" as Logic
 +import "../code/logic.js" as Logic
- 
+
  Item {
      id: batterymonitor
 Index: plasma-workspace-5.6.3/applets/lock_logout/contents/ui/lockout.qml
@@ -73,7 +34,7 @@ Index: plasma-workspace-5.6.3/applets/lock_logout/contents/ui/lockout.qml
  import org.kde.kquickcontrolsaddons 2.0
 -import "data.js" as Data
 +import "../code/data.js" as Data
- 
+
  Flow {
      id: lockout
 Index: plasma-workspace-5.6.3/applets/notifications/package/contents/ui/main.qml
@@ -81,11 +42,11 @@ Index: plasma-workspace-5.6.3/applets/notifications/package/contents/ui/main.qml
 --- plasma-workspace-5.6.3.orig/applets/notifications/package/contents/ui/main.qml
 +++ plasma-workspace-5.6.3/applets/notifications/package/contents/ui/main.qml
 @@ -28,7 +28,7 @@ import org.kde.plasma.extras 2.0 as Plas
- 
+
  import org.kde.plasma.private.notifications 1.0
- 
+
 -import "uiproperties.js" as UiProperties
 +import "../code/uiproperties.js" as UiProperties
- 
+
  MouseEventListener {
      id: notificationsApplet
diff --git a/pkgs/desktops/plasma-5/srcs.nix b/pkgs/desktops/plasma-5/srcs.nix
index 854b86c1640d..900c6c0b2c43 100644
--- a/pkgs/desktops/plasma-5/srcs.nix
+++ b/pkgs/desktops/plasma-5/srcs.nix
@@ -3,339 +3,355 @@
 
 {
   bluedevil = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/bluedevil-5.10.5.tar.xz";
-      sha256 = "01nhfggikkygfzyjbm7zqszhq2x1fhc619wskwjb7hm9p35laj9r";
-      name = "bluedevil-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/bluedevil-5.11.1.tar.xz";
+      sha256 = "0p1y3p87xg7rjj35n81jg4v4yr2k7bf80qzfnwslbvwrpnzs982q";
+      name = "bluedevil-5.11.1.tar.xz";
     };
   };
   breeze = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/breeze-5.10.5.tar.xz";
-      sha256 = "0rmc3nn9b63jyij814hqx1zg38iphvd03pg7qybkp61zw40ng90v";
-      name = "breeze-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/breeze-5.11.1.tar.xz";
+      sha256 = "0yqbr7j0iqnmczbfv454f1l5x3787vzfchgkrd995d6za2d0w2lp";
+      name = "breeze-5.11.1.tar.xz";
     };
   };
   breeze-grub = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/breeze-grub-5.10.5.tar.xz";
-      sha256 = "0am1hldqyrsryda907q2qwfc09xcsxrv7bq9v23ig0xmylcsq3if";
-      name = "breeze-grub-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/breeze-grub-5.11.1.tar.xz";
+      sha256 = "0pcri1z4min5m6wb6ncyjavwd9nszyis3cqdyw6mqb4av55z0xl0";
+      name = "breeze-grub-5.11.1.tar.xz";
     };
   };
   breeze-gtk = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/breeze-gtk-5.10.5.tar.xz";
-      sha256 = "0i5ddrq9h1www5362qyfwpqpspn3brr43mbsv7ax7gk30san6w0a";
-      name = "breeze-gtk-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/breeze-gtk-5.11.1.tar.xz";
+      sha256 = "0qb3ykf1mdw1iparsaxnypc4z41lfal6idksz9va25p3vclh02gr";
+      name = "breeze-gtk-5.11.1.tar.xz";
     };
   };
   breeze-plymouth = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/breeze-plymouth-5.10.5.tar.xz";
-      sha256 = "197g84mvh8s3f163zx24y1mmzk26fg3ni19pw21njdj2j813hd35";
-      name = "breeze-plymouth-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/breeze-plymouth-5.11.1.tar.xz";
+      sha256 = "1z175176583aqdvv6gwy7mdkndr50x1c8xdihrrcvdhvqy9qc7hr";
+      name = "breeze-plymouth-5.11.1.tar.xz";
     };
   };
   discover = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/discover-5.10.5.tar.xz";
-      sha256 = "085lq0y9a6r12jbx2ik7zqp4r9bjw332ykfh2gbzzz4s7l7rj4xf";
-      name = "discover-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/discover-5.11.1.tar.xz";
+      sha256 = "0zr53nw9lix80wlf7wa7irng2vvy80wccjs439ib8r1yh3ggiq4c";
+      name = "discover-5.11.1.tar.xz";
+    };
+  };
+  drkonqi = {
+    version = "5.11.1";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.11.1/drkonqi-5.11.1.tar.xz";
+      sha256 = "0kq06sz39m8qg19b4cjqfwnx19j3s29hddhls8wywswwxlz4aq35";
+      name = "drkonqi-5.11.1.tar.xz";
     };
   };
   kactivitymanagerd = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/kactivitymanagerd-5.10.5.tar.xz";
-      sha256 = "19c297iyaq54vxc6xmvqsa1qlj5vr8071ydmkkfx3fa3lijp34v7";
-      name = "kactivitymanagerd-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/kactivitymanagerd-5.11.1.tar.xz";
+      sha256 = "1j36mbngga492xxhm1ndw1bnq1qn480qpvzi94wyax9y3r4szmhg";
+      name = "kactivitymanagerd-5.11.1.tar.xz";
     };
   };
   kde-cli-tools = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/kde-cli-tools-5.10.5.tar.xz";
-      sha256 = "1i2frbxvzlqlv210w50ccxn8ksqxranc93v0wfjvnhd7f8p9c7vk";
-      name = "kde-cli-tools-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/kde-cli-tools-5.11.1.tar.xz";
+      sha256 = "0di7ypyhda4gpadhi0lbji4nyi9xk1y844kxfb586wpzkim5w82c";
+      name = "kde-cli-tools-5.11.1.tar.xz";
     };
   };
   kdecoration = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/kdecoration-5.10.5.tar.xz";
-      sha256 = "0g24gisbnp92niff36bcnjk5pp84qc8cwmx283b887fzcn8v4mf3";
-      name = "kdecoration-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/kdecoration-5.11.1.tar.xz";
+      sha256 = "1jpvdscmy5ymyvj22784swvf6181f7ggr875djhx57c7i4shb3ph";
+      name = "kdecoration-5.11.1.tar.xz";
     };
   };
   kde-gtk-config = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/kde-gtk-config-5.10.5.tar.xz";
-      sha256 = "1a5q8skykhvr5mixi59db2w1qsh8nj2dqncw4nmsh5nlh2ldmgm5";
-      name = "kde-gtk-config-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/kde-gtk-config-5.11.1.tar.xz";
+      sha256 = "1afbwdrjdv9a2qwyxysgnslavan20cmhrz88kmnf9imxlll0i7al";
+      name = "kde-gtk-config-5.11.1.tar.xz";
     };
   };
   kdeplasma-addons = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/kdeplasma-addons-5.10.5.tar.xz";
-      sha256 = "1xdsa38i60x24p6xiv4x1cqd7f2xijs15c19qsjv594lnmbizbr5";
-      name = "kdeplasma-addons-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/kdeplasma-addons-5.11.1.tar.xz";
+      sha256 = "09dwmd1aiiivkvdbyv97fili067sd8mw9dpknawair4mh7qb0zln";
+      name = "kdeplasma-addons-5.11.1.tar.xz";
     };
   };
   kgamma5 = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/kgamma5-5.10.5.tar.xz";
-      sha256 = "0rci4v5amhfiwawf2sj5f6cmcyq3lrx68mn8id279bpq35mr23v1";
-      name = "kgamma5-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/kgamma5-5.11.1.tar.xz";
+      sha256 = "1m9maxzn5y3zijmj2fkwsfwhinprhz97v9fi312dmwyvfhq3qvyd";
+      name = "kgamma5-5.11.1.tar.xz";
     };
   };
   khotkeys = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/khotkeys-5.10.5.tar.xz";
-      sha256 = "1ixxb18nz3f4i2qqr1lvss7b662sgj78kzqjs0gd9mf5ylhqj5is";
-      name = "khotkeys-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/khotkeys-5.11.1.tar.xz";
+      sha256 = "0d1p1sia9qvdls38m29jijsf1ya8zvza557flmhcajb5ldn243l5";
+      name = "khotkeys-5.11.1.tar.xz";
     };
   };
   kinfocenter = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/kinfocenter-5.10.5.tar.xz";
-      sha256 = "0flfjypp6v2k99h11srigyc0ahy23869wz3ljbqbm3b0pgqs69sm";
-      name = "kinfocenter-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/kinfocenter-5.11.1.tar.xz";
+      sha256 = "0ivhf460y83qv4qdphdvskx2nlfqzy453xfnq7ldyzp2yacdmcc8";
+      name = "kinfocenter-5.11.1.tar.xz";
     };
   };
   kmenuedit = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/kmenuedit-5.10.5.tar.xz";
-      sha256 = "0b786l5gm093dq1hvxcn97yg9fr0jmjhfl7sfd0cdn4pkg6almam";
-      name = "kmenuedit-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/kmenuedit-5.11.1.tar.xz";
+      sha256 = "081lqh5ck854pha1f99w6w4j032spl3v28ild61fmhvhzkvx48a6";
+      name = "kmenuedit-5.11.1.tar.xz";
     };
   };
   kscreen = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/kscreen-5.10.5.tar.xz";
-      sha256 = "1a8bqa4wqnjav2w0s39dh7hmb3mqxjnhqwsw6mycgaxicl0h37vf";
-      name = "kscreen-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/kscreen-5.11.1.tar.xz";
+      sha256 = "1skdg59qacxxkiyz3gc1nn4y4lflbynpcb4mpsliqb2n2xdhvg8r";
+      name = "kscreen-5.11.1.tar.xz";
     };
   };
   kscreenlocker = {
-    version = "5.10.5.1";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/kscreenlocker-5.10.5.1.tar.xz";
-      sha256 = "03ih0dyyjljv40wl7mpbssfirkkljw8mnpjjhzk357lzadkplzvp";
-      name = "kscreenlocker-5.10.5.1.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/kscreenlocker-5.11.1.tar.xz";
+      sha256 = "0jgq2w7zi1i4wdlfmfz1jh1kbkcn2lxkdg9ds5brisc3f6r4n3vg";
+      name = "kscreenlocker-5.11.1.tar.xz";
     };
   };
   ksshaskpass = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/ksshaskpass-5.10.5.tar.xz";
-      sha256 = "194ca18kclwmg7j9kcl02hm01cidy0hh2r68j6gxkafnlmn1cjjw";
-      name = "ksshaskpass-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/ksshaskpass-5.11.1.tar.xz";
+      sha256 = "00ghycjmagc8mjwsgny9bkr45ppnad6aay44ha6fn5gyx973xcmx";
+      name = "ksshaskpass-5.11.1.tar.xz";
     };
   };
   ksysguard = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/ksysguard-5.10.5.tar.xz";
-      sha256 = "0ywz0ax29y0gm7c3lxwdkn5xvzpkd82a313wb3cz4iphqqga3jqn";
-      name = "ksysguard-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/ksysguard-5.11.1.tar.xz";
+      sha256 = "11z29w95ji815gwaggs0n9bw8f040z4fd87ci2wmqcpyrjs7a6z1";
+      name = "ksysguard-5.11.1.tar.xz";
     };
   };
   kwallet-pam = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/kwallet-pam-5.10.5.tar.xz";
-      sha256 = "0ws0835a0j3wqia85hcdsgfn48d71v96dmmvc2y5pp45ki648bn4";
-      name = "kwallet-pam-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/kwallet-pam-5.11.1.tar.xz";
+      sha256 = "0zipldqjg3mazm2j7vrxkc0pqp7x7mmdq7cg1vlb1xlj8ld2vl7y";
+      name = "kwallet-pam-5.11.1.tar.xz";
     };
   };
   kwayland-integration = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/kwayland-integration-5.10.5.tar.xz";
-      sha256 = "0s1yhrvjgn455ayi368fkmdpmpyxl97c2pxy8rchfnk3g1ffhmdy";
-      name = "kwayland-integration-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/kwayland-integration-5.11.1.tar.xz";
+      sha256 = "1h1lcvzbcf628hs5hj3ykpzy086ylvf5bz63gr0clhyckjxrbbkh";
+      name = "kwayland-integration-5.11.1.tar.xz";
     };
   };
   kwin = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/kwin-5.10.5.tar.xz";
-      sha256 = "1nxyn31a00r9kh0aw5fmvxklw21b2l07y267m0q0n9w6bmn6nzyc";
-      name = "kwin-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/kwin-5.11.1.tar.xz";
+      sha256 = "1anc8pblpsb8g7lvnq43ji6fgpwxsnmypc3gkip26lb4j7gqfhqm";
+      name = "kwin-5.11.1.tar.xz";
     };
   };
   kwrited = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/kwrited-5.10.5.tar.xz";
-      sha256 = "0wphhb4l6qb7lbklgxh2sc6wgqij4n3iwnhaarv2d17864r7ykc9";
-      name = "kwrited-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/kwrited-5.11.1.tar.xz";
+      sha256 = "11y2dpjs0g01nah1924dzf39y1smzlswc6nx1cwgfky3raaz3cj0";
+      name = "kwrited-5.11.1.tar.xz";
     };
   };
   libkscreen = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/libkscreen-5.10.5.tar.xz";
-      sha256 = "0a2lrrp8wp7ndgdvnh48781isin868ndsqw0xr21rn78n90580n6";
-      name = "libkscreen-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/libkscreen-5.11.1.tar.xz";
+      sha256 = "0drv6f8gzilirwp7p31qrng7cdp7b23ar5v1d5bkdrr1q29z8wdv";
+      name = "libkscreen-5.11.1.tar.xz";
     };
   };
   libksysguard = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/libksysguard-5.10.5.tar.xz";
-      sha256 = "0ldcpjxy10cnwwc82ihy8xqjkavycrmv6wlbn0rwhnfs04n2rryn";
-      name = "libksysguard-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/libksysguard-5.11.1.tar.xz";
+      sha256 = "1m8514jv2487fbypxys65qb0a55psqvyzkw5l81ka4ydnrhl2hhm";
+      name = "libksysguard-5.11.1.tar.xz";
     };
   };
   milou = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/milou-5.10.5.tar.xz";
-      sha256 = "06kq9s9lij66vy5024aps03pzpcz1ixf0b79a7ii1px2h1s7z4gz";
-      name = "milou-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/milou-5.11.1.tar.xz";
+      sha256 = "1v7rbjw8i1pdvl60xh8s0srrp17jks360zk42rp3hq9srsffd8cp";
+      name = "milou-5.11.1.tar.xz";
     };
   };
   oxygen = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/oxygen-5.10.5.tar.xz";
-      sha256 = "0p1isrb8v0dkd27jnz6nbq44py7y3zzsjljn9xbv3d02vg802ym9";
-      name = "oxygen-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/oxygen-5.11.1.tar.xz";
+      sha256 = "0b3yl4q5cbcj6d07xrmifpvwysaa870gf56a7l38zjba6z04819z";
+      name = "oxygen-5.11.1.tar.xz";
     };
   };
   plasma-desktop = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/plasma-desktop-5.10.5.tar.xz";
-      sha256 = "1sxy2k2p15ag5pcy36lpn83nz8d1jb1iyq2nihf4yrc9jlxx9gqm";
-      name = "plasma-desktop-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/plasma-desktop-5.11.1.tar.xz";
+      sha256 = "1r7chviykyq2650k513qcp665pv8vpdczvbrvqfhbpn4yy47crps";
+      name = "plasma-desktop-5.11.1.tar.xz";
     };
   };
   plasma-integration = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/plasma-integration-5.10.5.tar.xz";
-      sha256 = "15cxwsdp78kx55py0wkwqpv4w8cf130hadmdvdw64lwr4gssvhjn";
-      name = "plasma-integration-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/plasma-integration-5.11.1.tar.xz";
+      sha256 = "0jpshilcpklyx7cbpn0cf96md2h6pwd86bk8lphzm64zv3c655ly";
+      name = "plasma-integration-5.11.1.tar.xz";
     };
   };
   plasma-nm = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/plasma-nm-5.10.5.tar.xz";
-      sha256 = "004nmkfy74qaba6hslv2cyb52l7q6ihpavi5j5ax8k66n5zx00bi";
-      name = "plasma-nm-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/plasma-nm-5.11.1.tar.xz";
+      sha256 = "0479cqy7503krish11djg7rc4g7kdlbj3gapsbgvlq9x6j7ixz1p";
+      name = "plasma-nm-5.11.1.tar.xz";
     };
   };
   plasma-pa = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/plasma-pa-5.10.5.tar.xz";
-      sha256 = "0300x3w7mhyb5wpsj47qsfm73fc90iw1vxrgzl9014pxc3h14np1";
-      name = "plasma-pa-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/plasma-pa-5.11.1.tar.xz";
+      sha256 = "0g565v4dwcn6jppn1p2dvljg5r39xmgjzgf8rcipw70kcwc1nx4c";
+      name = "plasma-pa-5.11.1.tar.xz";
     };
   };
   plasma-sdk = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/plasma-sdk-5.10.5.tar.xz";
-      sha256 = "0mjndw132rn46sqjw5jdin8hn6lbrx5955h05jawk95sncr3d0yb";
-      name = "plasma-sdk-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/plasma-sdk-5.11.1.tar.xz";
+      sha256 = "0ss148yig5zzprkk2ydq3np34gr0bnbh1gn18hgb5z33iglbdl3n";
+      name = "plasma-sdk-5.11.1.tar.xz";
     };
   };
   plasma-tests = {
-    version = "5.10.5";
+    version = "5.11.1";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.11.1/plasma-tests-5.11.1.tar.xz";
+      sha256 = "03r5dczb9iqigg2s7h0k6zgb616358lqvl2h0k0bg2hxggnh8lpk";
+      name = "plasma-tests-5.11.1.tar.xz";
+    };
+  };
+  plasma-vault = {
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/plasma-tests-5.10.5.tar.xz";
-      sha256 = "0mfh35zdc4n52q01jbagxgr51hsvjlyfmnj6x4l2zpif0fpqpxh8";
-      name = "plasma-tests-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/plasma-vault-5.11.1.tar.xz";
+      sha256 = "09wbjk0bsbjyh5n1d5gywdvaimajqr50sd23dbfdbnpi3br0gk10";
+      name = "plasma-vault-5.11.1.tar.xz";
     };
   };
   plasma-workspace = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/plasma-workspace-5.10.5.tar.xz";
-      sha256 = "1n12vzjnrhndkzki7dh9kzrwrvll5xqq0y02srb9bg3gyjbp54jl";
-      name = "plasma-workspace-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/plasma-workspace-5.11.1.tar.xz";
+      sha256 = "1fy4bdxrz8mn29nc2qjxjnpxzjy9mynwwdjxj0jr61w0ljd40wiy";
+      name = "plasma-workspace-5.11.1.tar.xz";
     };
   };
   plasma-workspace-wallpapers = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/plasma-workspace-wallpapers-5.10.5.tar.xz";
-      sha256 = "1z7mqk9nxh232dxl5jg20zbc5nkq5srks4f8b02va6wzfjhwhc88";
-      name = "plasma-workspace-wallpapers-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/plasma-workspace-wallpapers-5.11.1.tar.xz";
+      sha256 = "0dcfrad2543fxapizmlikv52m9nmdg45gddvh9chc83kangsydlc";
+      name = "plasma-workspace-wallpapers-5.11.1.tar.xz";
     };
   };
   plymouth-kcm = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/plymouth-kcm-5.10.5.tar.xz";
-      sha256 = "11vfaaqd3mxbnq16rv7xsmfcj33i2cmdljdxib1sg5minybd072y";
-      name = "plymouth-kcm-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/plymouth-kcm-5.11.1.tar.xz";
+      sha256 = "0w3yhazbx79s9k1yc3lj16hanc3wrqphhk9zjl9q1vxsn2rzas8h";
+      name = "plymouth-kcm-5.11.1.tar.xz";
     };
   };
   polkit-kde-agent = {
-    version = "1-5.10.5";
+    version = "1-5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/polkit-kde-agent-1-5.10.5.tar.xz";
-      sha256 = "158lkf76fz65nr0lx14skkcsk2p3xw98nh43z00wvm2c5qqzmnp2";
-      name = "polkit-kde-agent-1-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/polkit-kde-agent-1-5.11.1.tar.xz";
+      sha256 = "04ycjqx9hnk3ab8qxk5gqz7b4r7im3bwap613qcgxjqr5cagp66w";
+      name = "polkit-kde-agent-1-5.11.1.tar.xz";
     };
   };
   powerdevil = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/powerdevil-5.10.5.tar.xz";
-      sha256 = "0dghlgva8fybvhc09y1avzhgak246n4ad2njjvfnxpazpi2laxv7";
-      name = "powerdevil-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/powerdevil-5.11.1.tar.xz";
+      sha256 = "02rf8iz2spcc78xs88dknl6a7slwgfgh4ra8lhwk69d210cxgahq";
+      name = "powerdevil-5.11.1.tar.xz";
     };
   };
   sddm-kcm = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/sddm-kcm-5.10.5.tar.xz";
-      sha256 = "13hld5bndxhs6j3lja08zrc6czvpl4k385i8lb3g9zvn9vrk29sw";
-      name = "sddm-kcm-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/sddm-kcm-5.11.1.tar.xz";
+      sha256 = "0sac2cknq7m26v8a59q1aakn6xjzmspnslfs6k633a8yz8w4lh19";
+      name = "sddm-kcm-5.11.1.tar.xz";
     };
   };
   systemsettings = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/systemsettings-5.10.5.tar.xz";
-      sha256 = "0b3wpmfjj2zmi7ickppz32i63dpn4jja3nnjrxn912yw47z4bri2";
-      name = "systemsettings-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/systemsettings-5.11.1.tar.xz";
+      sha256 = "0bnygmb3g573b7a8g0qg3ddj65miw29v3p25sh0ic9ij5bx6f4rw";
+      name = "systemsettings-5.11.1.tar.xz";
     };
   };
   user-manager = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/user-manager-5.10.5.tar.xz";
-      sha256 = "1fiih72jafshxgwfq4q9csv1i62mgj35qr87lh6lyady6aghajnq";
-      name = "user-manager-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/user-manager-5.11.1.tar.xz";
+      sha256 = "1iz5wm8d3ljn97msbh1bc7v8zmmgxrfr5mwfzh0ssdldba4wqlpm";
+      name = "user-manager-5.11.1.tar.xz";
     };
   };
   xdg-desktop-portal-kde = {
-    version = "5.10.5";
+    version = "5.11.1";
     src = fetchurl {
-      url = "${mirror}/stable/plasma/5.10.5/xdg-desktop-portal-kde-5.10.5.tar.xz";
-      sha256 = "0rgv4nqkrwjzvhg8cmkin348n0i6sd4v444bk6j83y4m0lxdi1ba";
-      name = "xdg-desktop-portal-kde-5.10.5.tar.xz";
+      url = "${mirror}/stable/plasma/5.11.1/xdg-desktop-portal-kde-5.11.1.tar.xz";
+      sha256 = "0w822jlg0h7qim70zamm7q5x2b614qmiggz9wr8yxq80lajizxnf";
+      name = "xdg-desktop-portal-kde-5.11.1.tar.xz";
     };
   };
 }
diff --git a/pkgs/desktops/plasma-5/systemsettings.nix b/pkgs/desktops/plasma-5/systemsettings.nix
index a24eabc39f31..954a8f9f45ba 100644
--- a/pkgs/desktops/plasma-5/systemsettings.nix
+++ b/pkgs/desktops/plasma-5/systemsettings.nix
@@ -1,7 +1,8 @@
 {
   mkDerivation, extra-cmake-modules, kdoctools,
   kcmutils, kconfig, kdbusaddons, khtml, ki18n, kiconthemes, kio, kitemviews,
-  kservice, kwindowsystem, kxmlgui, qtquickcontrols, qtquickcontrols2
+  kservice, kwindowsystem, kxmlgui, qtquickcontrols, qtquickcontrols2,
+  kactivities, kactivities-stats, kirigami2
 }:
 
 mkDerivation {
@@ -10,6 +11,7 @@ mkDerivation {
   buildInputs = [
     kcmutils kconfig kdbusaddons khtml ki18n kiconthemes kio kitemviews kservice
     kwindowsystem kxmlgui qtquickcontrols qtquickcontrols2
+    kactivities kactivities-stats kirigami2
   ];
   outputs = [ "out" "dev" "bin" ];
 }
diff --git a/pkgs/development/compilers/cudatoolkit/default.nix b/pkgs/development/compilers/cudatoolkit/default.nix
index f6e52a59fe59..62b2e7c18508 100644
--- a/pkgs/development/compilers/cudatoolkit/default.nix
+++ b/pkgs/development/compilers/cudatoolkit/default.nix
@@ -1,30 +1,44 @@
-{ lib, stdenv, fetchurl, patchelf, perl, ncurses, expat, python27, zlib
+{ lib, stdenv, makeWrapper, fetchurl, requireFile, patchelf, perl, ncurses, expat, python27, zlib
+, gcc48, gcc49, gcc5, gcc6
 , xorg, gtk2, glib, fontconfig, freetype, unixODBC, alsaLib, glibc
 }:
 
 let
 
   common =
-    { version, url, sha256
+    args@{ gcc, version, sha256
+    , url ? ""
+    , name ? ""
+    , developerProgram ? false
     , python ? python27
     }:
 
     stdenv.mkDerivation rec {
       name = "cudatoolkit-${version}";
+      inherit (args) version;
 
       dontPatchELF = true;
       dontStrip = true;
 
       src =
-        if stdenv.system == "x86_64-linux" then
-          fetchurl {
-            inherit url sha256;
+        if developerProgram then
+          requireFile {
+            message = ''
+              This nix expression requires that ${args.name} is already part of the store.
+              Register yourself to NVIDIA Accelerated Computing Developer Program, retrieve the CUDA toolkit
+              at https://developer.nvidia.com/cuda-toolkit, and run the following command in the download directory:
+              nix-prefetch-url file://${args.name}
+            '';
+            inherit (args) name sha256;
           }
-        else throw "cudatoolkit does not support platform ${stdenv.system}";
+        else
+          fetchurl {
+            inherit (args) url sha256;
+          };
 
       outputs = [ "out" "lib" "doc" ];
 
-      buildInputs = [ perl ];
+      nativeBuildInputs = [ perl makeWrapper ];
 
       runtimeDependencies = [
         ncurses expat python zlib glibc
@@ -37,8 +51,8 @@ let
       unpackPhase = ''
         sh $src --keep --noexec
         cd pkg/run_files
-        sh cuda-linux64-rel-${version}-*.run --keep --noexec
-        sh cuda-samples-linux-${version}-*.run --keep --noexec
+        sh cuda-linux*.run --keep --noexec
+        sh cuda-samples*.run --keep --noexec
         cd pkg
       '';
 
@@ -92,15 +106,25 @@ let
         # Remove OpenCL libraries as they are provided by ocl-icd and driver.
         rm -f $out/lib64/libOpenCL*
 
+        # Set compiler for NVCC.
+        wrapProgram $out/bin/nvcc \
+          --prefix PATH : ${gcc}/bin
       '' + lib.optionalString (lib.versionOlder version "8.0") ''
         # Hack to fix building against recent Glibc/GCC.
         echo "NIX_CFLAGS_COMPILE+=' -D_FORCE_INLINES'" >> $out/nix-support/setup-hook
       '';
 
+      passthru = {
+        cc = gcc;
+        majorVersion =
+          let versionParts = lib.splitString "." version;
+          in "${lib.elemAt versionParts 0}.${lib.elemAt versionParts 1}";
+      };
+
       meta = with stdenv.lib; {
         description = "A compiler for NVIDIA GPUs, math libraries, and tools";
-        homepage = https://developer.nvidia.com/cuda-toolkit;
-        platforms = platforms.linux;
+        homepage = "https://developer.nvidia.com/cuda-toolkit";
+        platforms = [ "x86_64-linux" ];
         license = licenses.unfree;
       };
     };
@@ -109,32 +133,44 @@ in {
 
   cudatoolkit6 = common {
     version = "6.0.37";
-    url = http://developer.download.nvidia.com/compute/cuda/6_0/rel/installers/cuda_6.0.37_linux_64.run;
+    url = "http://developer.download.nvidia.com/compute/cuda/6_0/rel/installers/cuda_6.0.37_linux_64.run";
     sha256 = "991e436c7a6c94ec67cf44204d136adfef87baa3ded270544fa211179779bc40";
+    gcc = gcc48;
   };
 
   cudatoolkit65 = common {
     version = "6.5.19";
-    url = http://developer.download.nvidia.com/compute/cuda/6_5/rel/installers/cuda_6.5.19_linux_64.run;
+    url = "http://developer.download.nvidia.com/compute/cuda/6_5/rel/installers/cuda_6.5.19_linux_64.run";
     sha256 = "1x9zdmk8z784d3d35vr2ak1l4h5v4jfjhpxfi9fl9dvjkcavqyaj";
+    gcc = gcc48;
   };
 
   cudatoolkit7 = common {
     version = "7.0.28";
-    url = http://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/cuda_7.0.28_linux.run;
+    url = "http://developer.download.nvidia.com/compute/cuda/7_0/Prod/local_installers/cuda_7.0.28_linux.run";
     sha256 = "1km5hpiimx11jcazg0h3mjzk220klwahs2vfqhjavpds5ff2wafi";
+    gcc = gcc49;
   };
 
   cudatoolkit75 = common {
     version = "7.5.18";
-    url = http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run;
+    url = "http://developer.download.nvidia.com/compute/cuda/7.5/Prod/local_installers/cuda_7.5.18_linux.run";
     sha256 = "1v2ylzp34ijyhcxyh5p6i0cwawwbbdhni2l5l4qm21s1cx9ish88";
+    gcc = gcc49;
   };
 
   cudatoolkit8 = common {
     version = "8.0.61";
-    url = https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run;
+    url = "https://developer.nvidia.com/compute/cuda/8.0/Prod2/local_installers/cuda_8.0.61_375.26_linux-run";
     sha256 = "1i4xrsqbad283qffvysn88w2pmxzxbbby41lw0j1113z771akv4w";
+    gcc = gcc5;
+  };
+
+  cudatoolkit9 = common {
+    version = "9.0.176";
+    url = "https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda_9.0.176_384.81_linux-run";
+    sha256 = "0308rmmychxfa4inb1ird9bpgfppgr9yrfg1qp0val5azqik91ln";
+    gcc = gcc6;
   };
 
 }
diff --git a/pkgs/development/compilers/openjdk/8.nix b/pkgs/development/compilers/openjdk/8.nix
index fef41d33d080..4499a9126a0c 100644
--- a/pkgs/development/compilers/openjdk/8.nix
+++ b/pkgs/development/compilers/openjdk/8.nix
@@ -21,42 +21,42 @@ let
     else
       throw "openjdk requires i686-linux or x86_64 linux";
 
-  update = "144";
-  build = "01";
+  update = "152";
+  build = "16";
   baseurl = "http://hg.openjdk.java.net/jdk8u/jdk8u";
   repover = "jdk8u${update}-b${build}";
   paxflags = if stdenv.isi686 then "msp" else "m";
   jdk8 = fetchurl {
              url = "${baseurl}/archive/${repover}.tar.gz";
-             sha256 = "08b7ia2ifvcl8xnpflf019ak3xcbdjnxcy1mhfp3nbfsbk2sia45";
+             sha256 = "12r5v6srwbm5hcfwz5kib7419a72cppls1d1xkrh5pjlina74zpf";
           };
   langtools = fetchurl {
              url = "${baseurl}/langtools/archive/${repover}.tar.gz";
-             sha256 = "0g7q6ljvn79psrcak3l4imd27w047ngavn9jcn3xwivg5wppsfks";
+             sha256 = "002f0nfw2g3q41iy8cvaqyiglcy1fx9dglgik8gv067c2zslwwqm";
           };
   hotspot = fetchurl {
              url = "${baseurl}/hotspot/archive/${repover}.tar.gz";
-             sha256 = "1hbbzf0m2a78dm8pyvc11jwfpj7q67pvjrp3hf0cnc38k9mzrn8q";
+             sha256 = "0mnck2c3ky4hbcjfy6p3z831dxm1y2fkxq5k94zbswm4wcvlkzia";
           };
   corba = fetchurl {
              url = "${baseurl}/corba/archive/${repover}.tar.gz";
-             sha256 = "1znc0prsb814ggm6qjgbsykm864mwypnxgi9w9f9riq8gs0578gh";
+             sha256 = "1xl3mc3hd5lwh1bxzck4hw60d678h3mjh144kq90iz8kfi197hpj";
           };
   jdk = fetchurl {
              url = "${baseurl}/jdk/archive/${repover}.tar.gz";
-             sha256 = "0gx5md1v1jmqhdwcc7smpf46sgp4alvb6jz3n6yjlcyfzk92yi78";
+             sha256 = "1hsfgjhp5nrsy4v6c282wq6cv37hgpm8l51cls0rnpbfqvd2cw16";
           };
   jaxws = fetchurl {
              url = "${baseurl}/jaxws/archive/${repover}.tar.gz";
-             sha256 = "0ad9w7gnwlpdssw2p3kfny02mmvzc6z8i2n7qq0177ml48c88iji";
+             sha256 = "07ispgrzcf39nxs7a9yn6gkbq0ygdzlzyq32sfk57w6vy1mrgwjh";
           };
   jaxp = fetchurl {
              url = "${baseurl}/jaxp/archive/${repover}.tar.gz";
-             sha256 = "14yzbbishsyrzmymws6mnndqj6hvs69ivfdbjhgwi0wl23g9siym";
+             sha256 = "1kj5w6gk579wh1iszq2bn6k1ib7kjpjf1lp46p5rqkx0qin79sn9";
           };
   nashorn = fetchurl {
              url = "${baseurl}/nashorn/archive/${repover}.tar.gz";
-             sha256 = "175q29n4bfmm1cyyga7x58zhh6ann9rm3wibw0scrhgy23lx052x";
+             sha256 = "1j9r5r8rihp02n0ciwqr01c07d91z1hs0069rd8hk6i03dkkhk84";
           };
   openjdk8 = stdenv.mkDerivation {
     name = "openjdk-8u${update}b${build}";
diff --git a/pkgs/development/compilers/oraclejdk/jdk8cpu-linux.nix b/pkgs/development/compilers/oraclejdk/jdk8cpu-linux.nix
index 0d12b3ac89b0..f8f37160a26f 100644
--- a/pkgs/development/compilers/oraclejdk/jdk8cpu-linux.nix
+++ b/pkgs/development/compilers/oraclejdk/jdk8cpu-linux.nix
@@ -1,9 +1,9 @@
 import ./jdk-linux-base.nix {
   productVersion = "8";
-  patchVersion = "144";
+  patchVersion = "151";
   downloadUrl = http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html;
-  sha256_i686 = "1i5pginc65xl5vxzwid21ykakmfkqn59v3g01vpr94v28w30jk32";
-  sha256_x86_64 = "1r5axvr8dg2qmr4zjanj73sk9x50m7p0w3vddz8c6ckgav7438z8";
+  sha256_i686 = "0w1snn9hxwvdnk77frhdzbsm6v30v99dy5zmpy8ij7yxd57z6ql0";
+  sha256_x86_64 = "0zq2dxbxmshz080yskhc8y2wbqi0y0kl9girxjbb4rwk837010n7";
   sha256_armv7l = "10r3nyssx8piyjaspravwgj2bnq4537041pn0lz4fk5b3473kgfb";
   jceName = "jce_policy-8.zip";
   jceDownloadUrl = http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html;
diff --git a/pkgs/development/compilers/oraclejdk/jdk8psu-linux.nix b/pkgs/development/compilers/oraclejdk/jdk8psu-linux.nix
index 0d12b3ac89b0..863621bf6b07 100644
--- a/pkgs/development/compilers/oraclejdk/jdk8psu-linux.nix
+++ b/pkgs/development/compilers/oraclejdk/jdk8psu-linux.nix
@@ -1,9 +1,9 @@
 import ./jdk-linux-base.nix {
   productVersion = "8";
-  patchVersion = "144";
+  patchVersion = "152";
   downloadUrl = http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html;
-  sha256_i686 = "1i5pginc65xl5vxzwid21ykakmfkqn59v3g01vpr94v28w30jk32";
-  sha256_x86_64 = "1r5axvr8dg2qmr4zjanj73sk9x50m7p0w3vddz8c6ckgav7438z8";
+  sha256_i686 = "0gjc7kcfx40f43z1w1qsn1fqxdz8d46wml2g11qgm55ishhv2q7w";
+  sha256_x86_64 = "1gv1348hrgna9l3sssv3g9jzs37y1lkx05xq83chav9z1hs3p2r1";
   sha256_armv7l = "10r3nyssx8piyjaspravwgj2bnq4537041pn0lz4fk5b3473kgfb";
   jceName = "jce_policy-8.zip";
   jceDownloadUrl = http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html;
diff --git a/pkgs/development/compilers/oraclejdk/jdk9-linux.nix b/pkgs/development/compilers/oraclejdk/jdk9-linux.nix
index 7f0a5750c0e8..fbda96e14258 100644
--- a/pkgs/development/compilers/oraclejdk/jdk9-linux.nix
+++ b/pkgs/development/compilers/oraclejdk/jdk9-linux.nix
@@ -30,7 +30,7 @@ assert stdenv.system == "x86_64-linux";
 assert swingSupport -> xorg != null;
 
 let
-  version = "9";
+  version = "9.0.1";
 
   downloadUrlBase = http://www.oracle.com/technetwork/java/javase/downloads;
 
@@ -63,19 +63,19 @@ let result = stdenv.mkDerivation rec {
       requireFile {
         name = "jdk-${version}_linux-x64_bin.tar.gz";
         url =  "${downloadUrlBase}/jdk9-downloads-3848520.html";
-        sha256 = "0vbgy7h9h089l3xh6sl57v57g28x1djyiigqs4z6gh7wahx7hv8w";
+        sha256 = "0560dc3icrwb0ifykshvzkr04b1jr153m26x1r8rp0nhjbzz1nic";
       }
     else if packageType == "JRE" then
       requireFile {
         name = "jre-${version}_linux-x64_bin.tar.gz";
         url = "${downloadUrlBase}/jre9-downloads-3848532.html";
-        sha256 = "18i4jjb6sby67xg5ql6dkk3ja1nackbb23g1bnp522450nclpxdb";
+        sha256 = "11pfcck8am48yv7riaj10g6h79xdiy8lm5a9wjqbm3g9cls9ar1w";
       }
     else if packageType == "ServerJRE" then
       requireFile {
         name = "serverjre-${version}_linux-x64_bin.tar.gz";
         url = "${downloadUrlBase}/server-jre9-downloads-3848530.html";
-        sha256 = "01bxi7lx13lhlpbifw93b6r7a9bayiykw8kzwlyyqi8pz3pw8c5h";
+        sha256 = "1biyks6jy0a2kksaj9qbsjifv34ym5mdw8akibmkwr1xh0wavygc";
       }
     else abort "unknown package Type ${packageType}";
 
diff --git a/pkgs/development/compilers/ponyc/default.nix b/pkgs/development/compilers/ponyc/default.nix
index 63c1d97006f3..8c744e7038e8 100644
--- a/pkgs/development/compilers/ponyc/default.nix
+++ b/pkgs/development/compilers/ponyc/default.nix
@@ -3,13 +3,13 @@
 
 stdenv.mkDerivation ( rec {
   name = "ponyc-${version}";
-  version = "0.19.3";
+  version = "0.20.0";
 
   src = fetchFromGitHub {
     owner = "ponylang";
     repo = "ponyc";
     rev = version;
-    sha256 = "0aishczaasp877z1a17iq0vk6pp369bv7yz5mvinr7wm44930qr3";
+    sha256 = "0shln9v0bp0q9qfipm3834vl284q5vwz9333yzgx46d0l2ivggyi";
   };
 
   buildInputs = [ llvm makeWrapper which ];
diff --git a/pkgs/development/compilers/scala/default.nix b/pkgs/development/compilers/scala/default.nix
index d4d4a0f31bc5..7622fbb9d18d 100644
--- a/pkgs/development/compilers/scala/default.nix
+++ b/pkgs/development/compilers/scala/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, makeWrapper, jre, gnugrep, coreutils }:
 
 stdenv.mkDerivation rec {
-  name = "scala-2.12.3";
+  name = "scala-2.12.4";
 
   src = fetchurl {
     url = "http://www.scala-lang.org/files/archive/${name}.tgz";
-    sha256 = "133w4r2214ci7r4sg2yyk9lhn62ldm4ad0d89drwrvgvffvnly9b";
+    sha256 = "089a54qj8psh4jxqbrrwk5zahw13fyqq24l87s3031xa675a0m4m";
   };
 
   propagatedBuildInputs = [ jre ] ;
diff --git a/pkgs/development/compilers/tinycc/default.nix b/pkgs/development/compilers/tinycc/default.nix
index 4d6555213345..e88246ecb939 100644
--- a/pkgs/development/compilers/tinycc/default.nix
+++ b/pkgs/development/compilers/tinycc/default.nix
@@ -2,9 +2,9 @@
 with stdenv.lib;
 
 let
-  date = "20170924";
-  rev = "1443039416dd02750765efde1af35e31c8d41be3";
-  sha256 = "060l0f77hirq3i5bg294gxcszlvyn89ds2q21jwgy3ryrapfbl8i";
+  date = "20171016";
+  rev = "da8c62f75d893449e232944fc62566c020b4d010";
+  sha256 = "0pdvyhrx7g9imxpc7gr75116imi6ifn0ihsl4fbffsji2dpi61y2";
   version = "0.9.27pre-${date}";
 in
 
diff --git a/pkgs/development/coq-modules/flocq/default.nix b/pkgs/development/coq-modules/flocq/default.nix
index 30ec69ba6537..092337125a4d 100644
--- a/pkgs/development/coq-modules/flocq/default.nix
+++ b/pkgs/development/coq-modules/flocq/default.nix
@@ -3,11 +3,11 @@
 stdenv.mkDerivation rec {
 
   name = "coq${coq.coq-version}-flocq-${version}";
-  version = "2.5.2";
+  version = "2.6.0";
 
   src = fetchurl {
-    url = https://gforge.inria.fr/frs/download.php/file/36199/flocq-2.5.2.tar.gz;
-    sha256 = "0h5mlasirfzc0wwn2isg4kahk384n73145akkpinrxq5jsn5d22h";
+    url = https://gforge.inria.fr/frs/download.php/file/37054/flocq-2.6.0.tar.gz;
+    sha256 = "13fv150dcwnjrk00d7zj2c5x9jwmxgrq0ay440gkr730l8mvk3l3";
   };
 
   buildInputs = [ coq.ocaml coq.camlp5 bash which autoconf automake ];
diff --git a/pkgs/development/libraries/alembic/default.nix b/pkgs/development/libraries/alembic/default.nix
new file mode 100644
index 000000000000..4ab09f5bb1d5
--- /dev/null
+++ b/pkgs/development/libraries/alembic/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchFromGitHub, unzip, cmake, openexr, hdf5 }:
+
+stdenv.mkDerivation rec
+{
+  name = "alembic-${version}";
+  version = "1.7.4";
+
+  src = fetchFromGitHub {
+    owner = "alembic";
+    repo = "alembic";
+    rev = "${version}";
+    sha256 = "00r6d8xk2sq5hdl5lp14nhyh1b2d68fxpzbm69fk6iq2f2gv0iqv";
+  };
+
+  outputs = [ "bin" "dev" "out" "lib" ];
+
+  buildInputs = [ unzip cmake openexr hdf5 ];
+
+  sourceRoot = "${name}-src";
+
+  enableParallelBuilding = true;
+
+  buildPhase = ''
+    cmake -DUSE_HDF5=ON -DCMAKE_INSTALL_PREFIX=$out/ -DUSE_TESTS=OFF .
+
+    mkdir $out
+    mkdir -p $bin/bin
+    mkdir -p $dev/include
+    mkdir -p $lib/lib
+  '';
+
+  installPhase = ''
+    make install
+
+    mv $out/bin $bin/
+    mv $out/lib $lib/
+    mv $out/include $dev/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "An open framework for storing and sharing scene data";
+    homepage = "http://alembic.io/";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+    maintainers = [ maintainers.guibou ];
+  };
+}
diff --git a/pkgs/development/libraries/boost/1.65.nix b/pkgs/development/libraries/boost/1.65.nix
new file mode 100644
index 000000000000..9837e1c69193
--- /dev/null
+++ b/pkgs/development/libraries/boost/1.65.nix
@@ -0,0 +1,12 @@
+{ stdenv, callPackage, fetchurl, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "1.65.1";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/boost/boost_1_65_1.tar.bz2";
+    # SHA256 from http://www.boost.org/users/history/version_1_65_1.html
+    sha256 = "9807a5d16566c57fd74fb522764e0b134a8bbe6b6e8967b83afefd30dcd3be81";
+  };
+
+})
diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix
index 22ef02023f88..3f9ae113f849 100644
--- a/pkgs/development/libraries/boost/generic.nix
+++ b/pkgs/development/libraries/boost/generic.nix
@@ -9,6 +9,8 @@
 , enableStatic ? !enableShared
 , enablePIC ? false
 , enableExceptions ? false
+, enablePython ? hostPlatform == buildPlatform
+, enableNumpy ? false, numpy ? null
 , taggedLayout ? ((enableRelease && enableDebug) || (enableSingleThreaded && enableMultiThreaded) || (enableShared && enableStatic))
 , patches ? null
 , mpi ? null
@@ -21,6 +23,9 @@
 # We must build at least one type of libraries
 assert !enableShared -> enableStatic;
 
+assert enablePython -> hostPlatform == buildPlatform;
+assert enableNumpy -> enablePython;
+
 with stdenv.lib;
 let
 
@@ -62,7 +67,8 @@ let
   ] ++ optional (link != "static") "runtime-link=${runtime-link}" ++ [
     "link=${link}"
     "${cflags}"
-  ] ++ optional (variant == "release") "debug-symbols=off";
+  ] ++ optional (variant == "release") "debug-symbols=off"
+    ++ optional (!enablePython) "--without-python";
 
   nativeB2Flags = [
     "-sEXPAT_INCLUDE=${expat.dev}/include"
@@ -76,7 +82,6 @@ let
     "-sEXPAT_LIBPATH=${expat.crossDrv}/lib"
     "--user-config=user-config.jam"
     "toolset=gcc-cross"
-    "--without-python"
   ] ++ optionals (hostPlatform.libc == "msvcrt") [
     "target-os=windows"
     "threadapi=win32"
@@ -148,8 +153,10 @@ stdenv.mkDerivation {
   enableParallelBuilding = true;
 
   buildInputs = [ expat zlib bzip2 libiconv ]
-    ++ stdenv.lib.optionals (hostPlatform == buildPlatform) [ python icu ]
-    ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+    ++ optional (hostPlatform == buildPlatform) icu
+    ++ optional stdenv.isDarwin fixDarwinDylibNames
+    ++ optional enablePython python
+    ++ optional enableNumpy numpy;
 
   configureScript = "./bootstrap.sh";
   configureFlags = commonConfigureFlags
diff --git a/pkgs/development/libraries/grantlee/5/default.nix b/pkgs/development/libraries/grantlee/5/default.nix
index 6fae90a8d890..3eed4f0c2e29 100644
--- a/pkgs/development/libraries/grantlee/5/default.nix
+++ b/pkgs/development/libraries/grantlee/5/default.nix
@@ -21,8 +21,12 @@ mkDerivation rec {
   postFixup =
     # Disabuse CMake of the notion that libraries are in $dev
     ''
-      sed -i $dev/lib/cmake/Grantlee5/GrantleeTargets-release.cmake \
-          -e "s|\''${_IMPORT_PREFIX}|$out|"
+      for way in release debug; do
+          cmake="$dev/lib/cmake/Grantlee5/GrantleeTargets-$way.cmake"
+          if [ -f "$cmake" ]; then
+              sed -i "$cmake" -e "s|\''${_IMPORT_PREFIX}|$out|"
+          fi
+      done
     '';
 
   setupHook = ./setup-hook.sh;
diff --git a/pkgs/development/libraries/kde-frameworks/default.nix b/pkgs/development/libraries/kde-frameworks/default.nix
index d5995459fd4f..de99503131c1 100644
--- a/pkgs/development/libraries/kde-frameworks/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/default.nix
@@ -132,6 +132,7 @@ let
       sonnet = callPackage ./sonnet.nix {};
       syntax-highlighting = callPackage ./syntax-highlighting.nix {};
       threadweaver = callPackage ./threadweaver.nix {};
+      kirigami2 = callPackage ./kirigami2.nix {};
 
     # TIER 2
       kactivities = callPackage ./kactivities.nix {};
diff --git a/pkgs/development/libraries/kde-frameworks/kirigami2.nix b/pkgs/development/libraries/kde-frameworks/kirigami2.nix
new file mode 100644
index 000000000000..f4fc40f6d31d
--- /dev/null
+++ b/pkgs/development/libraries/kde-frameworks/kirigami2.nix
@@ -0,0 +1,11 @@
+{ mkDerivation, extra-cmake-modules, qtbase, qtquickcontrols2, qttranslations }:
+
+mkDerivation {
+  name = "kirigami2";
+  meta = {
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtbase qtquickcontrols2 qttranslations ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/pkgs/development/libraries/libdrm/default.nix b/pkgs/development/libraries/libdrm/default.nix
index 4903d8e66dfe..992b1ea70dca 100644
--- a/pkgs/development/libraries/libdrm/default.nix
+++ b/pkgs/development/libraries/libdrm/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, pkgconfig, libpthreadstubs, libpciaccess, valgrind-light }:
 
 stdenv.mkDerivation rec {
-  name = "libdrm-2.4.83";
+  name = "libdrm-2.4.84";
 
   src = fetchurl {
     url = "http://dri.freedesktop.org/libdrm/${name}.tar.bz2";
-    sha256 = "1minzvsyz5hgm6ixpj8ysa6jsv7vm8qc8nx390jxdsk0v9ljd983";
+    sha256 = "7ae9c24d91139ac9a2cdee06fe46dbe1c401a1eda1c0bd2a6d1ecf72f479e0aa";
   };
 
   outputs = [ "out" "dev" "bin" ];
diff --git a/pkgs/development/libraries/libqtav/default.nix b/pkgs/development/libraries/libqtav/default.nix
index a79e6d903842..93d8ced49cea 100644
--- a/pkgs/development/libraries/libqtav/default.nix
+++ b/pkgs/development/libraries/libqtav/default.nix
@@ -9,13 +9,10 @@ with lib;
 
 mkDerivation rec {
   name = "libqtav-${version}";
-
-  # Awaiting upcoming `v1.12.0` release. `v1.11.0` is not supporting cmake which is the
-  # the reason behind taking an unstable git rev. 
-  version = "unstable-2017-03-30";
+  version = "1.12.0";
 
   nativeBuildInputs = [ extra-cmake-modules qttools ];
-  buildInputs = [ 
+  buildInputs = [
     qtbase qtmultimedia qtquick1
     mesa libX11
     libass openal ffmpeg libuchardet
@@ -23,18 +20,13 @@ mkDerivation rec {
   ];
 
   src = fetchFromGitHub {
-    sha256 = "1xw0ynm9w501651rna3ppf8p336ag1p60i9dxhghzm543l7as93v";
-    rev = "4b4ae3b470b2fcbbcf1b541c2537fb270ee0bcfa";
+    sha256 = "03ii9l38l3fsr27g42fx4151ipzkip2kr4akdr8x28sx5r9rr5m2";
+    rev = "v${version}";
     repo = "QtAV";
     owner = "wang-bin";
     fetchSubmodules = true;
   };
 
-  patchPhase = ''
-    sed -i -e 's#CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT#TRUE#g' ./CMakeLists.txt
-    sed -i -e 's#DESTINATION ''${QT_INSTALL_LIBS}/cmake#DESTINATION ''${QTAV_INSTALL_LIBS}/cmake#g' ./CMakeLists.txt
-  '';
-
   # Make sure libqtav finds its libGL dependancy at both link and run time
   # by adding mesa to rpath. Not sure why it wasn't done automatically like
   # the other libraries as `mesa` is part of our `buildInputs`.
diff --git a/pkgs/development/libraries/libtorrent-rasterbar/1.0.nix b/pkgs/development/libraries/libtorrent-rasterbar/1.0.nix
index 877d8ed434c6..fbd30ac04f76 100644
--- a/pkgs/development/libraries/libtorrent-rasterbar/1.0.nix
+++ b/pkgs/development/libraries/libtorrent-rasterbar/1.0.nix
@@ -1,6 +1,13 @@
-{ callPackage, ... } @ args:
+args@{ callPackage, fetchpatch, ... }:
 
-callPackage ./generic.nix (args // {
+callPackage (import ./generic.nix {
   version = "1.0.11";
   sha256 = "17p34d3n29q04pvz975gfl1fyj3sg9cl5l6j673xqfq3fpyis58i";
-})
+  patches = [
+    # Compatibility with new Boost
+    (fetchpatch {
+      url = "https://github.com/arvidn/libtorrent/commit/7eb3cf6bc6dbada3fa7bb7ff4d5981182813a0e2.patch";
+      sha256 = "07agbrii6i8q4wmgpqbln7ldhhadaf5npcinvi6hnyipsr48jbj5";
+    })
+  ];
+}) args
diff --git a/pkgs/development/libraries/libtorrent-rasterbar/default.nix b/pkgs/development/libraries/libtorrent-rasterbar/default.nix
index ed52902938db..ff5027fd472e 100644
--- a/pkgs/development/libraries/libtorrent-rasterbar/default.nix
+++ b/pkgs/development/libraries/libtorrent-rasterbar/default.nix
@@ -1,6 +1,6 @@
-{ callPackage, ... } @ args:
+args@{ callPackage, ... }:
 
-callPackage ./generic.nix (args // {
-  version = "1.1.4";
-  sha256 = "1rrp4b7zfz0fnjvax2r9r5rrh6z1s4xqb9dx20gzr4gs8x5v5jws";
-})
+callPackage (import ./generic.nix {
+  version = "1.1.5";
+  sha256 = "1ifpcqw5mj2dwk23lhc2vpb47mg3j573v5z4zp8dkczpz7wg5jxq";
+}) args
diff --git a/pkgs/development/libraries/libtorrent-rasterbar/generic.nix b/pkgs/development/libraries/libtorrent-rasterbar/generic.nix
index 351ec3e77331..315385cba6c8 100644
--- a/pkgs/development/libraries/libtorrent-rasterbar/generic.nix
+++ b/pkgs/development/libraries/libtorrent-rasterbar/generic.nix
@@ -1,7 +1,7 @@
-{ stdenv, fetchurl, automake, autoconf, boost, openssl, lib, libtool, pkgconfig, zlib, python, libiconv, geoip
 # Version specific options
-, version, sha256
-, ... }:
+{ version, sha256, patches ? [] }:
+
+{ stdenv, fetchurl, automake, autoconf, boost, openssl, lib, libtool, pkgconfig, zlib, python, libiconv, geoip, ... }:
 
 let formattedVersion = lib.replaceChars ["."] ["_"] version;
 
@@ -15,6 +15,8 @@ stdenv.mkDerivation rec {
     inherit sha256;
   };
 
+  inherit patches;
+
   nativeBuildInputs = [ automake autoconf libtool pkgconfig ];
   buildInputs = [ boost openssl zlib python libiconv geoip ];
 
diff --git a/pkgs/development/libraries/opencv/3.x.nix b/pkgs/development/libraries/opencv/3.x.nix
index 8596ab6de88f..ecb7bf78b206 100644
--- a/pkgs/development/libraries/opencv/3.x.nix
+++ b/pkgs/development/libraries/opencv/3.x.nix
@@ -16,7 +16,7 @@
 , enableGStreamer ? false, gst_all_1
 , enableEigen     ? true, eigen
 , enableOpenblas  ? true, openblas
-, enableCuda      ? false, cudatoolkit, gcc5
+, enableCuda      ? false, cudatoolkit
 , enableTesseract ? false, tesseract, leptonica
 , AVFoundation, Cocoa, QTKit
 }:
@@ -145,7 +145,7 @@ stdenv.mkDerivation rec {
     # simply enabled automatically if contrib is built, and it detects
     # tesseract & leptonica.
     ++ lib.optionals enableTesseract [ tesseract leptonica ]
-    ++ lib.optionals enableCuda [ cudatoolkit gcc5 ]
+    ++ lib.optional enableCuda cudatoolkit
     ++ lib.optional buildContrib protobuf
     ++ lib.optionals stdenv.isDarwin [ AVFoundation Cocoa QTKit ];
 
@@ -165,8 +165,10 @@ stdenv.mkDerivation rec {
     (opencvFlag "OPENEXR" enableEXR)
     (opencvFlag "CUDA" enableCuda)
     (opencvFlag "CUBLAS" enableCuda)
-  ] ++ lib.optionals enableCuda [ "-DCUDA_FAST_MATH=ON" ]
-    ++ lib.optional buildContrib "-DBUILD_PROTOBUF=off"
+  ] ++ lib.optionals enableCuda [
+    "-DCUDA_FAST_MATH=ON"
+    "-DCUDA_HOST_COMPILER=${cudatoolkit.cc}/bin/gcc"
+  ] ++ lib.optional buildContrib "-DBUILD_PROTOBUF=off"
     ++ lib.optionals stdenv.isDarwin ["-DWITH_OPENCL=OFF" "-DWITH_LAPACK=OFF"];
 
   enableParallelBuilding = true;
diff --git a/pkgs/development/libraries/openexrid-unstable/default.nix b/pkgs/development/libraries/openexrid-unstable/default.nix
new file mode 100644
index 000000000000..fcf4c2c2468f
--- /dev/null
+++ b/pkgs/development/libraries/openexrid-unstable/default.nix
@@ -0,0 +1,50 @@
+{ stdenv, fetchFromGitHub, unzip, re2, openfx, zlib, ilmbase, mesa, openexr }:
+
+stdenv.mkDerivation rec
+{
+  name = "openexrid-unstable-${version}";
+  version = "2017-09-17";
+
+  src = fetchFromGitHub {
+    owner = "MercenariesEngineering";
+    repo = "openexrid";
+    rev = "bec0081548a096f9bcdd1504970c96264b0fc050";
+    sha256 = "0h4b74lv59p4hhrvrqdmlnchn2i0v5id4kl8xc7j26l9884q0383";
+  };
+
+  outputs = [ "dev" "out" "lib" ];
+
+  patches = [ ./openexrid.patch ];
+
+  NIX_CFLAGS_COMPILE=''-I${ilmbase.dev}/include/OpenEXR
+                       -I${openexr.dev}/include/OpenEXR
+                       -I${openfx.dev}/include/OpenFX
+                      '';
+
+  buildInputs = [ unzip re2 openfx zlib ilmbase mesa openexr ];
+
+  enableParallelBuilding = true;
+
+  buildPhase = ''
+      mkdir openexrid/release
+
+      PREFIX=$out make -C openexrid install
+
+      mkdir $dev;
+      mkdir $lib;
+  '';
+
+  installPhase = ''
+      find $out
+      mv $out/include $dev/
+      mv $out/lib $lib/
+      '';
+
+  meta = with stdenv.lib; {
+    description = "OpenEXR files able to isolate any object of a CG image with a perfect antialiazing";
+    homepage = "https://github.com/MercenariesEngineering/openexrid";
+    maintainers = [ maintainers.guibou ];
+    platforms = platforms.all;
+    license = licenses.mit;
+  };
+}
diff --git a/pkgs/development/libraries/openexrid-unstable/openexrid.patch b/pkgs/development/libraries/openexrid-unstable/openexrid.patch
new file mode 100644
index 000000000000..bbbf75b575dc
--- /dev/null
+++ b/pkgs/development/libraries/openexrid-unstable/openexrid.patch
@@ -0,0 +1,35 @@
+diff --git a/makefile b/makefile
+index 7a92771..31ef664 100644
+--- a/makefile
++++ b/makefile
+@@ -8,8 +8,8 @@ _openexrid:
+ _openfx:
+ 	make -C openfx
+ 
+-_test: _openexrid
+-	make -C test
++#_test: _openexrid
++#	make -C test
+ 
+ clean:
+ 	make -C openfx clean
+diff --git a/makefile.config b/makefile.config
+index 0c6cdfa..0166c4c 100644
+--- a/makefile.config
++++ b/makefile.config
+@@ -4,7 +4,7 @@
+ 
+ PREFIX ?= ~/openexrid
+ 
+-OFX_INCLUDE ?= /usr/include/openfx
++OFX_INCLUDE ?= /usr/include/OpenFX
+ EXR_INCLUDE ?= /usr/include/OpenEXR
+ EXR_LIB ?= /usr/lib
+ RE2_INCLUDE ?= /usr/include
+@@ -13,5 +13,5 @@ RE2_LIB ?= /usr/lib
+ VERSION ?= release
+ CPPFLAGS += -O3 -Wall -DNDEBUG -fPIC -I $(EXR_INCLUDE) -I $(OFX_INCLUDE) -I $(RE2_INCLUDE) -Dlinux
+ LDFLAGS += -L$(EXR_LIB) -L$(RE2_LIB) -L../openexrid/$(VERSION) -lpthread
+-LDFLAGS += -Wl,-Bstatic -lopenexrid -lIlmImf -lIlmThread -lIex -lImath -lHalf -lz -lre2 -Wl,-Bdynamic
++LDFLAGS += -lopenexrid -lIlmImf -lIlmThread -lIex -lImath -lHalf -lz -lre2 -Wl,-Bdynamic
+ 
diff --git a/pkgs/development/libraries/openfx/default.nix b/pkgs/development/libraries/openfx/default.nix
new file mode 100644
index 000000000000..42edb1958ce0
--- /dev/null
+++ b/pkgs/development/libraries/openfx/default.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, unzip }:
+
+stdenv.mkDerivation rec
+{
+  name = "openfx-${version}";
+  version = "1.4";
+
+  src = fetchFromGitHub {
+    owner = "ofxa";
+    repo = "openfx";
+    rev = "OFX_Release_1_4_TAG";
+    sha256 = "0k9ggzr6bisn77mipjfvawg3mv4bz50b63v8f7w1jhldi1sfy548";
+  };
+
+  buildInputs = [ unzip ];
+
+  outputs = [ "dev" "out" ];
+
+  enableParallelBuilding = true;
+
+  buildPhase = ''
+      mkdir $dev
+      mkdir $out
+      '';
+
+  installPhase = ''
+     mkdir -p $dev/include/OpenFX/
+     cp -r include/* $dev/include/OpenFX/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Image processing plug-in standard";
+    homepage = "http://openeffects.org/";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+    maintainers = [ maintainers.guibou ];
+  };
+}
diff --git a/pkgs/development/libraries/opensubdiv/default.nix b/pkgs/development/libraries/opensubdiv/default.nix
index 442a8444942a..91899ad8da43 100644
--- a/pkgs/development/libraries/opensubdiv/default.nix
+++ b/pkgs/development/libraries/opensubdiv/default.nix
@@ -1,17 +1,17 @@
-{ lib, stdenv, stdenv_gcc5, fetchurl, fetchFromGitHub, cmake, pkgconfig, xorg, mesa_glu
+{ lib, stdenv, fetchurl, fetchFromGitHub, cmake, pkgconfig, xorg, mesa_glu
 , mesa_noglu, glew, ocl-icd, python3
 , cudaSupport ? false, cudatoolkit
 }:
 
-(if cudaSupport then stdenv_gcc5 else stdenv).mkDerivation rec {
+stdenv.mkDerivation rec {
   name = "opensubdiv-${version}";
-  version = "3.2.0";
+  version = "3.3.0";
 
   src = fetchFromGitHub {
     owner = "PixarAnimationStudios";
     repo = "OpenSubdiv";
     rev = "v${lib.replaceChars ["."] ["_"] version}";
-    sha256 = "0wk12n1s8za3sz8d6bmfm3rfjyx20j48gy1xp57dvbnjvlvzqy3w";
+    sha256 = "0wpjwfik4q9s4r30hndhzmfyzv968mmg5lgng0123l07mn47d2yl";
   };
 
   outputs = [ "out" "dev" ];
@@ -30,7 +30,7 @@
       "-DNO_EXAMPLES=1"
       "-DGLEW_INCLUDE_DIR=${glew.dev}/include"
       "-DGLEW_LIBRARY=${glew.dev}/lib"
-    ];
+    ] ++ lib.optional cudaSupport "-DOSD_CUDA_NVCC_FLAGS=--gpu-architecture=compute_30";
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/openvdb/default.nix b/pkgs/development/libraries/openvdb/default.nix
new file mode 100644
index 000000000000..b172b82a295c
--- /dev/null
+++ b/pkgs/development/libraries/openvdb/default.nix
@@ -0,0 +1,47 @@
+{ stdenv, fetchFromGitHub, unzip, openexr, boost, jemalloc, c-blosc, ilmbase, tbb }:
+
+stdenv.mkDerivation rec
+{
+  name = "openvdb-${version}";
+  version = "4.0.2";
+
+  src = fetchFromGitHub {
+    owner = "dreamworksanimation";
+    repo = "openvdb";
+    rev = "v${version}";
+    sha256 = "0kqlsfa9rdpxpw7v61vfknvs11axh196ilqk6bnyyfkslmmcak45";
+  };
+
+  outputs = [ "out" ];
+
+  buildInputs = [ unzip openexr boost tbb jemalloc c-blosc ilmbase ];
+
+  sourceRoot = "openvdb-v${version}-src/openvdb";
+
+  installTargets = "install_lib";
+
+  enableParallelBuilding = true;
+
+  buildFlags = ''lib
+    DESTDIR=$(out)
+    HALF_LIB=-lHalf
+    TBB_LIB=-ltbb
+    BLOSC_LIB=-lblosc
+    LOG4CPLUS_LIB=
+    BLOSC_INCLUDE_DIR=${c-blosc}/include/
+    BLOSC_LIB_DIR=${c-blosc}/lib/
+    '';
+
+  installFlags = ''DESTDIR=$(out)'';
+
+  NIX_CFLAGS_COMPILE="-I${openexr.dev}/include/OpenEXR -I${ilmbase.dev}/include/OpenEXR/";
+  NIX_LDFLAGS="-lboost_iostreams";
+
+  meta = with stdenv.lib; {
+    description = "An open framework for voxel";
+    homepage = "http://www.openvdb.org";
+    maintainers = [ maintainers.guibou ];
+    platforms = platforms.all;
+    license = licenses.mpl20;
+  };
+}
diff --git a/pkgs/development/libraries/partio/default.nix b/pkgs/development/libraries/partio/default.nix
new file mode 100644
index 000000000000..ed0f38f8538b
--- /dev/null
+++ b/pkgs/development/libraries/partio/default.nix
@@ -0,0 +1,52 @@
+{ stdenv, fetchFromGitHub, unzip, cmake, freeglut, mesa, zlib, swig, python, doxygen, xorg }:
+
+stdenv.mkDerivation rec
+{
+  name = "partio-${version}";
+  version = "1.1.0";
+
+  src = fetchFromGitHub {
+    owner = "wdas";
+    repo = "partio";
+    rev = "v${version}";
+    sha256 = "0z7n5ay21ca7g7xb80v6jmr96x9k7vm7zawawvmx71yj32rg1n34";
+  };
+
+  outputs = [ "dev" "out" "lib" ];
+
+  buildInputs = [ unzip cmake freeglut mesa zlib swig python doxygen xorg.libXi xorg.libXmu ];
+
+  sourceRoot = "partio-v${version}-src";
+
+  enableParallelBuilding = true;
+
+  buildPhase = ''
+    sed 's/ADD_LIBRARY (partio /ADD_LIBRARY (partio SHARED /' -i ../src/lib/CMakeLists.txt
+    CXXFLAGS="-std=c++11" cmake .
+    make partio
+
+    mkdir $dev
+    mkdir -p $lib/lib
+    mkdir $out
+      '';
+
+  # TODO:
+  # Sexpr support
+
+  installPhase = ''
+    mkdir $dev/lib
+    mkdir -p $dev/include/partio
+
+    mv lib/libpartio.so $lib/lib
+
+    mv ../src/lib/* $dev/include/partio
+  '';
+
+  meta = with stdenv.lib; {
+    description = "C++ (with python bindings) library for easily reading/writing/manipulating common animation particle formats such as PDB, BGEO, PTC";
+    homepage = "https://www.disneyanimation.com/technology/partio.html";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+    maintainers = [ maintainers.guibou ];
+  };
+}
diff --git a/pkgs/development/libraries/ptex/default.nix b/pkgs/development/libraries/ptex/default.nix
new file mode 100644
index 000000000000..7774cdbcb888
--- /dev/null
+++ b/pkgs/development/libraries/ptex/default.nix
@@ -0,0 +1,45 @@
+{ stdenv, fetchFromGitHub, zlib, python, cmake }:
+
+stdenv.mkDerivation rec
+{
+  name = "ptex-${version}";
+  version = "2.1.28";
+
+  src = fetchFromGitHub {
+    owner = "wdas";
+    repo = "ptex";
+    rev = "v${version}";
+    sha256 = "1h6gb3mpis4m6ph7h9q764w50f9jrar3jz2ja76rn5czy6wn318x";
+  };
+
+  outputs = [ "bin" "dev" "out" "lib" ];
+
+  buildInputs = [ zlib python cmake ];
+
+  sourceRoot = "ptex-v${version}-src";
+
+  enableParallelBuilding = true;
+
+  buildPhase = ''
+      mkdir -p $out
+
+      make prefix=$out
+
+      mkdir -p $bin/bin
+      mkdir -p $dev/include
+      mkdir -p $lib/lib
+      '';
+
+  installPhase = ''
+    make install
+    mv $out/bin $bin/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Per-Face Texture Mapping for Production Rendering";
+    homepage = "http://ptex.us/";
+    license = licenses.bsd3;
+    platforms = platforms.all;
+    maintainers = [ maintainers.guibou ];
+  };
+}
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.9/qtbase/default.nix
index fc5e5d39c63c..b7f9b3eb42e8 100644
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/default.nix
+++ b/pkgs/development/libraries/qt-5/5.9/qtbase/default.nix
@@ -86,7 +86,7 @@ stdenv.mkDerivation {
     ''
       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
+      sed -e 's@/\(usr\|opt\)/@/var/empty/@g' -i mkspecs/*/*.conf
 
       sed -i '/PATHS.*NO_DEFAULT_PATH/ d' src/corelib/Qt5Config.cmake.in
       sed -i '/PATHS.*NO_DEFAULT_PATH/ d' src/corelib/Qt5CoreMacros.cmake
@@ -105,6 +105,7 @@ stdenv.mkDerivation {
           -e 's|! /usr/bin/xcode-select --print-path >/dev/null 2>&1;|false;|' \
           -e 's|! /usr/bin/xcrun -find xcodebuild >/dev/null 2>&1;|false;|' \
           -e 's|sysroot=$(/usr/bin/xcodebuild -sdk $sdk -version Path 2>/dev/null)|sysroot=/nonsense|' \
+          -e 's|sysroot=$(/usr/bin/xcrun --sdk $sdk --show-sdk-path 2>/dev/null)|sysroot=/nonsense|' \
           -e 's|QMAKE_CONF_COMPILER=`getXQMakeConf QMAKE_CXX`|QMAKE_CXX="clang++"\nQMAKE_CONF_COMPILER="clang++"|' \
           -e 's|XCRUN=`/usr/bin/xcrun -sdk macosx clang -v 2>&1`|XCRUN="clang -v 2>&1"|' \
           -e 's#sdk_val=$(/usr/bin/xcrun -sdk $sdk -find $(echo $val | cut -d \x27 \x27 -f 1))##' \
@@ -155,6 +156,7 @@ stdenv.mkDerivation {
 
     ++ lib.optionals stdenv.isDarwin
     [
+      "-Wno-missing-sysroot"
       "-D__MAC_OS_X_VERSION_MAX_ALLOWED=1090"
       "-D__AVAILABILITY_INTERNAL__MAC_10_10=__attribute__((availability(macosx,introduced=10.10)))"
       # Note that nixpkgs's objc4 is from macOS 10.11 while the SDK is
@@ -252,6 +254,9 @@ stdenv.mkDerivation {
       "-inotify"
       "-system-libjpeg"
       "-system-libpng"
+      # gold linker of binutils 2.28 generates duplicate symbols
+      # TODO: remove for newer version of binutils 
+      "-no-use-gold-linker"
     ]
 
     ++ lib.optionals stdenv.isDarwin [
diff --git a/pkgs/development/libraries/qt-5/5.9/qtbase/mkspecs-features-mac.patch b/pkgs/development/libraries/qt-5/5.9/qtbase/mkspecs-features-mac.patch
index 6f7baa558db3..46d950a767bb 100644
--- a/pkgs/development/libraries/qt-5/5.9/qtbase/mkspecs-features-mac.patch
+++ b/pkgs/development/libraries/qt-5/5.9/qtbase/mkspecs-features-mac.patch
@@ -1,7 +1,7 @@
-diff -u qtbase-opensource-src-5.9.1.orig/mkspecs/features/mac/default_post.prf qtbase-opensource-src-5.9.1/mkspecs/features/mac/default_post.prf
---- qtbase-opensource-src-5.9.1.orig/mkspecs/features/mac/default_post.prf	2017-09-16 16:40:30.000000000 +0800
-+++ qtbase-opensource-src-5.9.1/mkspecs/features/mac/default_post.prf	2017-09-16 16:41:03.000000000 +0800
-@@ -24,165 +24,3 @@
+diff -u -r qtbase-opensource-src-5.9.2.orig/mkspecs/features/mac/default_post.prf qtbase-opensource-src-5.9.2/mkspecs/features/mac/default_post.prf
+--- qtbase-opensource-src-5.9.2.orig/mkspecs/features/mac/default_post.prf	2017-10-14 12:31:04.000000000 +0800
++++ qtbase-opensource-src-5.9.2/mkspecs/features/mac/default_post.prf	2017-10-14 12:42:02.000000000 +0800
+@@ -24,166 +24,3 @@
          }
      }
  }
@@ -164,13 +164,14 @@ diff -u qtbase-opensource-src-5.9.1.orig/mkspecs/features/mac/default_post.prf q
 -}
 -
 -cache(QMAKE_XCODE_DEVELOPER_PATH, stash)
--cache(QMAKE_XCODE_VERSION, stash)
+-!isEmpty(QMAKE_XCODE_VERSION): \
+-    cache(QMAKE_XCODE_VERSION, stash)
 -
 -QMAKE_XCODE_LIBRARY_SUFFIX = $$qtPlatformTargetSuffix()
-diff -u qtbase-opensource-src-5.9.1.orig/mkspecs/features/mac/default_pre.prf qtbase-opensource-src-5.9.1/mkspecs/features/mac/default_pre.prf
---- qtbase-opensource-src-5.9.1.orig/mkspecs/features/mac/default_pre.prf	2017-09-16 16:40:30.000000000 +0800
-+++ qtbase-opensource-src-5.9.1/mkspecs/features/mac/default_pre.prf	2017-09-16 16:40:45.000000000 +0800
-@@ -1,51 +1,2 @@
+diff -u -r qtbase-opensource-src-5.9.2.orig/mkspecs/features/mac/default_pre.prf qtbase-opensource-src-5.9.2/mkspecs/features/mac/default_pre.prf
+--- qtbase-opensource-src-5.9.2.orig/mkspecs/features/mac/default_pre.prf	2017-10-14 12:31:04.000000000 +0800
++++ qtbase-opensource-src-5.9.2/mkspecs/features/mac/default_pre.prf	2017-10-14 12:42:02.000000000 +0800
+@@ -1,56 +1,2 @@
  CONFIG = asset_catalogs rez $$CONFIG
  load(default_pre)
 -
@@ -183,18 +184,23 @@ diff -u qtbase-opensource-src-5.9.1.orig/mkspecs/features/mac/default_pre.prf qt
 -    # Make sure Xcode path is valid
 -    !exists($$QMAKE_XCODE_DEVELOPER_PATH): \
 -        error("Xcode is not installed in $${QMAKE_XCODE_DEVELOPER_PATH}. Please use xcode-select to choose Xcode installation path.")
--
--    # Make sure Xcode is set up properly
--    isEmpty($$list($$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null"))): \
--        error("Xcode not set up properly. You may need to confirm the license agreement by running /usr/bin/xcodebuild.")
 -}
 -
--isEmpty(QMAKE_XCODE_VERSION) {
--    # Extract Xcode version using xcodebuild
--    xcode_version = $$system("/usr/bin/xcodebuild -version")
--    QMAKE_XCODE_VERSION = $$member(xcode_version, 1)
--    isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.")
--    unset(xcode_version)
+-isEmpty(QMAKE_XCODEBUILD_PATH): \
+-    QMAKE_XCODEBUILD_PATH = $$system("/usr/bin/xcrun -find xcodebuild 2>/dev/null")
+-
+-!isEmpty(QMAKE_XCODEBUILD_PATH) {
+-    # Make sure Xcode is set up properly
+-    !system("/usr/bin/xcrun xcodebuild -license check 2>/dev/null"): \
+-        error("Xcode not set up properly. You need to confirm the license agreement by running 'sudo xcrun xcodebuild -license accept'.")
+-
+-    isEmpty(QMAKE_XCODE_VERSION) {
+-        # Extract Xcode version using xcodebuild
+-        xcode_version = $$system("/usr/bin/xcrun xcodebuild -version")
+-        QMAKE_XCODE_VERSION = $$member(xcode_version, 1)
+-        isEmpty(QMAKE_XCODE_VERSION): error("Could not resolve Xcode version.")
+-        unset(xcode_version)
+-    }
 -}
 -
 -isEmpty(QMAKE_TARGET_BUNDLE_PREFIX) {
@@ -222,10 +228,10 @@ diff -u qtbase-opensource-src-5.9.1.orig/mkspecs/features/mac/default_pre.prf qt
 -# feature, which allows Xcode to choose the Qt libraries to link to
 -# at build time, depending on the current Xcode SDK and configuration.
 -QMAKE_XCODE_LIBRARY_SUFFIX_SETTING = QT_LIBRARY_SUFFIX
-diff -u qtbase-opensource-src-5.9.1.orig/mkspecs/features/mac/sdk.prf qtbase-opensource-src-5.9.1/mkspecs/features/mac/sdk.prf
---- qtbase-opensource-src-5.9.1.orig/mkspecs/features/mac/sdk.prf	2017-09-16 16:40:30.000000000 +0800
-+++ qtbase-opensource-src-5.9.1/mkspecs/features/mac/sdk.prf	2017-09-16 16:41:16.000000000 +0800
-@@ -1,49 +0,0 @@
+diff -u -r qtbase-opensource-src-5.9.2.orig/mkspecs/features/mac/sdk.prf qtbase-opensource-src-5.9.2/mkspecs/features/mac/sdk.prf
+--- qtbase-opensource-src-5.9.2.orig/mkspecs/features/mac/sdk.prf	2017-10-14 12:31:04.000000000 +0800
++++ qtbase-opensource-src-5.9.2/mkspecs/features/mac/sdk.prf	2017-10-14 12:42:10.000000000 +0800
+@@ -1,58 +0,0 @@
 -
 -isEmpty(QMAKE_MAC_SDK): \
 -    error("QMAKE_MAC_SDK must be set when using CONFIG += sdk.")
@@ -235,13 +241,22 @@ diff -u qtbase-opensource-src-5.9.1.orig/mkspecs/features/mac/sdk.prf qtbase-ope
 -
 -defineReplace(xcodeSDKInfo) {
 -    info = $$1
+-    equals(info, "Path"): \
+-        info = --show-sdk-path
+-    equals(info, "PlatformPath"): \
+-        info = --show-sdk-platform-path
+-    equals(info, "SDKVersion"): \
+-        info = --show-sdk-version
 -    sdk = $$2
 -    isEmpty(sdk): \
 -        sdk = $$QMAKE_MAC_SDK
 -
 -    isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}) {
--        QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcodebuild -sdk $$sdk -version $$info 2>/dev/null")
--        isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}): error("Could not resolve SDK $$info for \'$$sdk\'")
+-        QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$info 2>/dev/null")
+-        # --show-sdk-platform-path won't work for Command Line Tools; this is fine
+-        # only used by the XCTest backend to testlib
+-        isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(info, "--show-sdk-platform-path")): \
+-            error("Could not resolve SDK $$info for \'$$sdk\'")
 -        cache(QMAKE_MAC_SDK.$${sdk}.$${info}, set stash, QMAKE_MAC_SDK.$${sdk}.$${info})
 -    }
 -
@@ -275,4 +290,3 @@ diff -u qtbase-opensource-src-5.9.1.orig/mkspecs/features/mac/sdk.prf qtbase-ope
 -    $$tool = $$sysrooted $$member(value, 1, -1)
 -    cache($$tool_variable, set stash, $$tool)
 -}
-Common subdirectories: qtbase-opensource-src-5.9.1.orig/mkspecs/features/mac/unsupported and qtbase-opensource-src-5.9.1/mkspecs/features/mac/unsupported
diff --git a/pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh b/pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh
index 4458e18a454f..ce1dada0c479 100644
--- a/pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh
+++ b/pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh
@@ -182,7 +182,8 @@ _qtFixCMakePaths() {
     find "${!outputLib}" -name "*.cmake" | while read file; do
         substituteInPlace "$file" \
             --subst-var-by NIX_OUT "${!outputLib}" \
-            --subst-var-by NIX_DEV "${!outputDev}"
+            --subst-var-by NIX_DEV "${!outputDev}" \
+            --subst-var-by NIX_BIN "${!outputBin}"
     done
 }
 
diff --git a/pkgs/development/libraries/science/math/clblas/cuda/default.nix b/pkgs/development/libraries/science/math/clblas/cuda/default.nix
deleted file mode 100644
index ae568bc6db17..000000000000
--- a/pkgs/development/libraries/science/math/clblas/cuda/default.nix
+++ /dev/null
@@ -1,73 +0,0 @@
-{ stdenv
-, fetchFromGitHub
-, cmake
-, gfortran
-, blas
-, boost
-, python
-, ocl-icd
-, cudatoolkit
-, nvidia_x11
-, gtest
-}:
-
-stdenv.mkDerivation rec {
-  name = "clblas-cuda-${version}"; 
-  version = "git-20160505"; 
-
-  src = fetchFromGitHub {
-    owner = "clMathLibraries"; 
-    repo = "clBLAS";
-    rev = "d20977ec4389c6b3751e318779410007c5e272f8";
-    sha256 = "1jna176cxznv7iz43svd6cjrbbf0fc2lrbpfpg4s08vc7xnwp0n4";
-  }; 
-
-  patches = [ ./platform.patch ]; 
-
-  postPatch = ''
-    sed -i -re 's/(set\(\s*Boost_USE_STATIC_LIBS\s+).*/\1OFF\ \)/g' src/CMakeLists.txt
-  '';
-
-  configurePhase = ''
-    findInputs ${boost.dev} boost_dirs propagated-native-build-inputs
-
-    export BOOST_INCLUDEDIR=$(echo $boost_dirs | sed -e s/\ /\\n/g - | grep '\-dev')/include
-    export BOOST_LIBRARYDIR=$(echo $boost_dirs | sed -e s/\ /\\n/g - | grep -v '\-dev')/lib
-
-    mkdir -p Build
-    pushd Build
-
-    export LD_LIBRARY_PATH="${stdenv.lib.makeLibraryPath [ blas nvidia_x11 ]}"
-
-    cmake ../src -DCMAKE_INSTALL_PREFIX=$out \
-                 -DCMAKE_BUILD_TYPE=Release \
-                 -DOPENCL_ROOT=${cudatoolkit} \
-                 -DUSE_SYSTEM_GTEST=ON
-  '';
-
-  dontStrip = true; 
-
-  buildInputs = [
-    cmake
-    gfortran
-    blas
-    python
-    ocl-icd
-    cudatoolkit
-    nvidia_x11
-    gtest
-  ]; 
-
-  meta = with stdenv.lib; {
-    homepage = https://github.com/clMathLibraries/clBLAS;
-    description = "A software library containing BLAS functions written in OpenCL";
-    longDescription = ''
-      This package contains a library of BLAS functions on top of OpenCL. 
-      The current version is linked to the NVIDIA OpenCL implementation provided by the CUDA toolkit. 
-    '';
-    license = licenses.asl20;
-    maintainers = with maintainers; [ artuuge ];
-    platforms = platforms.linux;
-  };
-
-}
diff --git a/pkgs/development/libraries/science/math/clblas/default.nix b/pkgs/development/libraries/science/math/clblas/default.nix
new file mode 100644
index 000000000000..40b02d303417
--- /dev/null
+++ b/pkgs/development/libraries/science/math/clblas/default.nix
@@ -0,0 +1,62 @@
+{ stdenv
+, fetchFromGitHub
+, cmake
+, gfortran
+, blas
+, boost
+, python
+, ocl-icd
+, opencl-headers
+, gtest
+}:
+
+stdenv.mkDerivation rec {
+  name = "clblas-${version}"; 
+  version = "2.12";
+
+  src = fetchFromGitHub {
+    owner = "clMathLibraries"; 
+    repo = "clBLAS";
+    rev = "v${version}";
+    sha256 = "154mz52r5hm0jrp5fqrirzzbki14c1jkacj75flplnykbl36ibjs";
+  }; 
+
+  patches = [ ./platform.patch ]; 
+
+  postPatch = ''
+    sed -i -re 's/(set\(\s*Boost_USE_STATIC_LIBS\s+).*/\1OFF\ \)/g' src/CMakeLists.txt
+  '';
+
+  preConfigure = ''
+    cd src
+  '';
+
+  cmakeFlags = [
+    "-DUSE_SYSTEM_GTEST=ON"
+  ];
+
+  buildInputs = [
+    cmake
+    gfortran
+    blas
+    python
+    ocl-icd
+    opencl-headers
+    boost
+    gtest
+  ]; 
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/clMathLibraries/clBLAS";
+    description = "A software library containing BLAS functions written in OpenCL";
+    longDescription = ''
+      This package contains a library of BLAS functions on top of OpenCL. 
+    '';
+    license = licenses.asl20;
+    maintainers = with maintainers; [ artuuge ];
+    platforms = platforms.linux;
+  };
+
+}
diff --git a/pkgs/development/libraries/science/math/clblas/cuda/platform.patch b/pkgs/development/libraries/science/math/clblas/platform.patch
index 87404a426a4b..87404a426a4b 100644
--- a/pkgs/development/libraries/science/math/clblas/cuda/platform.patch
+++ b/pkgs/development/libraries/science/math/clblas/platform.patch
diff --git a/pkgs/development/libraries/science/math/cudnn/7.5-5.0/default.nix b/pkgs/development/libraries/science/math/cudnn/7.5-5.0/default.nix
deleted file mode 100644
index 2e0b98496f3c..000000000000
--- a/pkgs/development/libraries/science/math/cudnn/7.5-5.0/default.nix
+++ /dev/null
@@ -1,46 +0,0 @@
-{ stdenv
-, requireFile
-, cudatoolkit
-}:
-
-stdenv.mkDerivation rec {
-  version = "5.0";
-  cudatoolkit_version = "7.5";
-
-  name = "cudatoolkit-${cudatoolkit_version}-cudnn-${version}";
-
-  src = requireFile rec {
-    name = "cudnn-${cudatoolkit_version}-linux-x64-v${version}-ga.tgz";
-    message = ''
-      This nix expression requires that ${name} is already part of the store.
-      Register yourself to NVIDIA Accelerated Computing Developer Program, retrieve the cuDNN library
-      at https://developer.nvidia.com/cudnn, and run the following command in the download directory:
-      nix-prefetch-url file://${name}
-    '';
-    sha256 = "c4739a00608c3b66a004a74fc8e721848f9112c5cb15f730c1be4964b3a23b3a";
-  };
-
-  phases = "unpackPhase installPhase fixupPhase";
-
-  installPhase = ''
-    function fixRunPath {
-      p=$(patchelf --print-rpath $1)
-      patchelf --set-rpath "$p:${stdenv.lib.makeLibraryPath [ stdenv.cc.cc ]}" $1
-    }
-    fixRunPath lib64/libcudnn.so
-
-    mkdir -p $out
-    cp -a include $out/include
-    cp -a lib64 $out/lib64
-  '';
-
-  propagatedBuildInputs = [
-    cudatoolkit
-  ];
-
-  meta = {
-    description = "NVIDIA CUDA Deep Neural Network library (cuDNN)";
-    homepage = https://developer.nvidia.com/cudnn;
-    license = stdenv.lib.licenses.unfree;
-  };
-}
diff --git a/pkgs/development/libraries/science/math/cudnn/8.0-5.1/default.nix b/pkgs/development/libraries/science/math/cudnn/8.0-5.1/default.nix
deleted file mode 100644
index fd98001da82b..000000000000
--- a/pkgs/development/libraries/science/math/cudnn/8.0-5.1/default.nix
+++ /dev/null
@@ -1,40 +0,0 @@
-{ stdenv
-, requireFile
-, cudatoolkit
-, fetchurl
-}:
-
-stdenv.mkDerivation rec {
-  version = "5.1";
-  cudatoolkit_version = "8.0";
-
-  name = "cudatoolkit-${cudatoolkit_version}-cudnn-${version}";
-
-  src = fetchurl {
-    url = "http://developer.download.nvidia.com/compute/redist/cudnn/v5.1/cudnn-8.0-linux-x64-v5.1.tgz";
-    sha256 = "1kj50smlkm347wfbfqvy09ylvad1zapqjc9yqvfykmiddyrij1y1";
-  };
-
-  installPhase = ''
-    function fixRunPath {
-      p=$(patchelf --print-rpath $1)
-      patchelf --set-rpath "$p:${stdenv.lib.makeLibraryPath [ stdenv.cc.cc ]}" $1
-    }
-    fixRunPath lib64/libcudnn.so
-
-    mkdir -p $out
-    cp -a include $out/include
-    cp -a lib64 $out/lib64
-  '';
-
-  propagatedBuildInputs = [
-    cudatoolkit
-  ];
-
-  meta = with stdenv.lib; {
-    description = "NVIDIA CUDA Deep Neural Network library (cuDNN)";
-    homepage = https://developer.nvidia.com/cudnn;
-    license = stdenv.lib.licenses.unfree;
-    maintainers = with maintainers; [ mdaiter ];
-  };
-}
diff --git a/pkgs/development/libraries/science/math/cudnn/8.0-6.0/default.nix b/pkgs/development/libraries/science/math/cudnn/8.0-6.0/default.nix
deleted file mode 100644
index f0cfb906b1fe..000000000000
--- a/pkgs/development/libraries/science/math/cudnn/8.0-6.0/default.nix
+++ /dev/null
@@ -1,40 +0,0 @@
-{ stdenv
-, requireFile
-, cudatoolkit
-, fetchurl
-}:
-
-stdenv.mkDerivation rec {
-  version = "6.0";
-  cudatoolkit_version = "8.0";
-
-  name = "cudatoolkit-${cudatoolkit_version}-cudnn-${version}";
-
-  src = fetchurl {
-    url = "http://developer.download.nvidia.com/compute/redist/cudnn/v6.0/cudnn-8.0-linux-x64-v6.0.tgz";
-    sha256 = "173zpgrk55ri8if7s5yngsc89ajd6hz4pss4cdxlv6lcyh5122cv";
-  };
-
-  installPhase = ''
-    function fixRunPath {
-      p=$(patchelf --print-rpath $1)
-      patchelf --set-rpath "$p:${stdenv.lib.makeLibraryPath [ stdenv.cc.cc ]}" $1
-    }
-    fixRunPath lib64/libcudnn.so
-
-    mkdir -p $out
-    cp -a include $out/include
-    cp -a lib64 $out/lib64
-  '';
-
-  propagatedBuildInputs = [
-    cudatoolkit
-  ];
-
-  meta = with stdenv.lib; {
-    description = "NVIDIA CUDA Deep Neural Network library (cuDNN)";
-    homepage = https://developer.nvidia.com/cudnn;
-    license = stdenv.lib.licenses.unfree;
-    maintainers = with maintainers; [ jyp ];
-  };
-}
diff --git a/pkgs/development/libraries/science/math/cudnn/default.nix b/pkgs/development/libraries/science/math/cudnn/default.nix
index 1e1a37af2f0e..db66d8545883 100644
--- a/pkgs/development/libraries/science/math/cudnn/default.nix
+++ b/pkgs/development/libraries/science/math/cudnn/default.nix
@@ -1,34 +1,45 @@
-{ stdenv, requireFile, cudatoolkit }:
+{ callPackage, cudatoolkit7, cudatoolkit75, cudatoolkit8, cudatoolkit9 }:
 
-stdenv.mkDerivation rec {
-  version = "4.0";
+let
+  generic = args: callPackage (import ./generic.nix (removeAttrs args ["cudatoolkit"])) {
+    inherit (args) cudatoolkit;
+  };
 
-  name = "cudnn-${version}";
+in
 
-  src = requireFile rec {
-    name = "cudnn-7.0-linux-x64-v${version}-prod.tgz";
-    message = '' 
-      This nix expression requires that ${name} is
-      already part of the store. Register yourself to NVIDIA Accelerated Computing Developer Program
-      and download cuDNN library at https://developer.nvidia.com/cudnn, and store it to the nix store with nix-store --add-fixed sha256 <FILE>.
-    '';
+{
+  cudnn_cudatoolkit7 = generic rec {
+    version = "4.0";
+    cudatoolkit = cudatoolkit7;
+    srcName = "cudnn-${cudatoolkit.majorVersion}-linux-x64-v${version}-prod.tgz";
     sha256 = "0zgr6qdbc29qw6sikhrh6diwwz7150rqc8a49f2qf37j2rvyyr2f";
-
   };
 
-  phases = "unpackPhase installPhase fixupPhase";
+  cudnn_cudatoolkit75 = generic rec {
+    version = "6.0";
+    cudatoolkit = cudatoolkit75;
+    srcName = "cudnn-${cudatoolkit.majorVersion}-linux-x64-v${version}.tgz";
+    sha256 = "0b68hv8pqcvh7z8xlgm4cxr9rfbjs0yvg1xj2n5ap4az1h3lp3an";
+  };
 
-  propagatedBuildInputs = [ cudatoolkit ];
+  cudnn6_cudatoolkit8 = generic rec {
+    version = "6.0";
+    cudatoolkit = cudatoolkit8;
+    srcName = "cudnn-${cudatoolkit.majorVersion}-linux-x64-v${version}.tgz";
+    sha256 = "173zpgrk55ri8if7s5yngsc89ajd6hz4pss4cdxlv6lcyh5122cv";
+  };
 
-  installPhase = ''
-    mkdir -p $out
-    cp -a include $out/include
-    cp -a lib64 $out/lib64
-  '';
+  cudnn_cudatoolkit8 = generic rec {
+    version = "7.0";
+    cudatoolkit = cudatoolkit8;
+    srcName = "cudnn-${cudatoolkit.majorVersion}-linux-x64-v7.tgz";
+    sha256 = "19yjdslrslwv5ic4vgpzb0fa0mqbgi6a66b7gc66vdc9n9589398";
+  };
 
-  meta = {
-    description = "NVIDIA CUDA Deep Neural Network library (cuDNN)";
-    homepage = https://developer.nvidia.com/cudnn;
-    license = stdenv.lib.licenses.unfree;
+  cudnn_cudatoolkit9 = generic rec {
+    version = "7.0";
+    cudatoolkit = cudatoolkit9;
+    srcName = "cudnn-${cudatoolkit.majorVersion}-linux-x64-v7.tgz";
+    sha256 = "1ld5x819vya6p2ppmr7i3lz9ac2y81kssgbzgd0lsign7r2qjapc";
   };
 }
diff --git a/pkgs/development/libraries/science/math/cudnn/8.0-5.0/default.nix b/pkgs/development/libraries/science/math/cudnn/generic.nix
index a0d8baae78fd..663b741e4748 100644
--- a/pkgs/development/libraries/science/math/cudnn/8.0-5.0/default.nix
+++ b/pkgs/development/libraries/science/math/cudnn/generic.nix
@@ -1,29 +1,34 @@
+{ version
+, srcName
+, sha256
+}:
+
 { stdenv
+, lib
 , requireFile
 , cudatoolkit
 }:
 
 stdenv.mkDerivation rec {
-  version = "5.0";
-  cudatoolkit_version = "8.0";
+  name = "cudatoolkit-${cudatoolkit.majorVersion}-cudnn-${version}";
 
-  name = "cudatoolkit-${cudatoolkit_version}-cudnn-${version}";
+  inherit version;
 
   src = requireFile rec {
-    name = "cudnn-${cudatoolkit_version}-linux-x64-v${version}-ga.tgz";
+    name = srcName;
+    inherit sha256;
     message = ''
       This nix expression requires that ${name} is already part of the store.
       Register yourself to NVIDIA Accelerated Computing Developer Program, retrieve the cuDNN library
       at https://developer.nvidia.com/cudnn, and run the following command in the download directory:
       nix-prefetch-url file://${name}
     '';
-    sha256 = "af80eb1ce0cb51e6a734b2bdc599e6d50b676eab3921e5bddfe5443485df86b6";
   };
 
   installPhase = ''
     function fixRunPath {
       p=$(patchelf --print-rpath $1)
-      patchelf --set-rpath "$p:${stdenv.lib.makeLibraryPath [ stdenv.cc.cc ]}" $1
+      patchelf --set-rpath "$p:${lib.makeLibraryPath [ stdenv.cc.cc ]}" $1
     }
     fixRunPath lib64/libcudnn.so
 
@@ -36,10 +41,16 @@ stdenv.mkDerivation rec {
     cudatoolkit
   ];
 
+  passthru = {
+    inherit cudatoolkit;
+    majorVersion = lib.head (lib.splitString "." version);
+  };
+
   meta = with stdenv.lib; {
     description = "NVIDIA CUDA Deep Neural Network library (cuDNN)";
-    homepage = https://developer.nvidia.com/cudnn;
-    license = stdenv.lib.licenses.unfree;
+    homepage = "https://developer.nvidia.com/cudnn";
+    license = licenses.unfree;
+    platforms = [ "x86_64-linux" ];
     maintainers = with maintainers; [ mdaiter ];
   };
 }
diff --git a/pkgs/development/libraries/wlc/default.nix b/pkgs/development/libraries/wlc/default.nix
index c67070094de6..95a8603e08ca 100644
--- a/pkgs/development/libraries/wlc/default.nix
+++ b/pkgs/development/libraries/wlc/default.nix
@@ -7,14 +7,14 @@
 
 stdenv.mkDerivation rec {
   name = "wlc-${version}";
-  version = "0.0.9"; # 0.0.10 currently causes segfaults
+  version = "0.0.10";
 
   src = fetchFromGitHub {
     owner = "Cloudef";
     repo = "wlc";
     rev = "v${version}";
     fetchSubmodules = true;
-    sha256 = "1r6jf64gs7n9a8129wsc0mdwhcv44p8k87kg0714rhx3g2w22asg";
+    sha256 = "09kvwhrpgkxlagn9lgqxc80jbg56djn29a6z0n6h0dsm90ysyb2k";
   };
 
   nativeBuildInputs = [ cmake pkgconfig ];
diff --git a/pkgs/development/libraries/wt/cmake.patch b/pkgs/development/libraries/wt/cmake.patch
deleted file mode 100644
index e7b1f87411d9..000000000000
--- a/pkgs/development/libraries/wt/cmake.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- a/CMakeLists.txt	2016-07-13 14:27:26.000000000 +0200
-+++ b/CMakeLists.txt	2016-08-16 12:58:28.135652964 +0200
-@@ -6,6 +6,7 @@
-   CMAKE_POLICY(SET CMP0002 OLD)
-   CMAKE_POLICY(SET CMP0003 OLD)
-   CMAKE_POLICY(SET CMP0005 OLD)
-+  CMAKE_POLICY(SET CMP0037 OLD)
- ENDIF(COMMAND CMAKE_POLICY)
- 
- PROJECT(WT)
diff --git a/pkgs/development/libraries/wt/default.nix b/pkgs/development/libraries/wt/default.nix
index 5d4caed890a8..8dc6db03bc31 100644
--- a/pkgs/development/libraries/wt/default.nix
+++ b/pkgs/development/libraries/wt/default.nix
@@ -4,13 +4,13 @@
 
 stdenv.mkDerivation rec {
   name = "wt";
-  version = "3.3.6";
+  version = "4.0.0";
 
   src = fetchFromGitHub {
     owner = "kdeforche";
     repo = name;
     rev = version;
-    sha256 = "1pvykc969l9cpd0da8bgpi4gr8f6qczrbpprrxamyj1pn0ydzvq3";
+    sha256 = "1451xxvnx6mlvxg0jxlr1mfv5v18h2214kijk5kacilqashfc43i";
   };
 
   enableParallelBuilding = true;
@@ -28,8 +28,6 @@ stdenv.mkDerivation rec {
     "--no-warn-unused-cli"
   ];
 
-  patches = [ ./cmake.patch ];  # fix a cmake warning; PR sent to upstream 
-
   meta = with stdenv.lib; {
     homepage = https://www.webtoolkit.eu/wt;
     description = "C++ library for developing web applications";
diff --git a/pkgs/development/libraries/xxHash/default.nix b/pkgs/development/libraries/xxHash/default.nix
new file mode 100644
index 000000000000..d702500bf719
--- /dev/null
+++ b/pkgs/development/libraries/xxHash/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchFromGitHub }:
+
+stdenv.mkDerivation rec {
+  name = "xxHash-${version}";
+  version = "0.6.3.20171018";
+
+  src = fetchFromGitHub {
+    sha256 = "0061ivxpx0p24m4vg7kfx9fs9f0jxvv4g76bmyss5gp90p05hc18";
+    rev = "333804ccf0c0339451accac023deeab9e5f7c002";
+    repo = "xxHash";
+    owner = "Cyan4973";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  makeFlags = [ "PREFIX=$(out)" "INCLUDEDIR=$(dev)/include" ];
+
+  meta = with stdenv.lib; {
+    description = "Extremely fast hash algorithm";
+    longDescription = ''
+      xxHash is an Extremely fast Hash algorithm, running at RAM speed limits.
+      It successfully completes the SMHasher test suite which evaluates
+      collision, dispersion and randomness qualities of hash functions. Code is
+      highly portable, and hashes are identical on all platforms (little / big
+      endian).
+    '';
+    homepage = https://github.com/Cyan4973/xxHash;
+    license = with licenses; [ bsd2 gpl2 ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/pkgs/development/ocaml-modules/camomile/0.8.5.nix b/pkgs/development/ocaml-modules/camomile/0.8.5.nix
new file mode 100644
index 000000000000..48517036dc6d
--- /dev/null
+++ b/pkgs/development/ocaml-modules/camomile/0.8.5.nix
@@ -0,0 +1,30 @@
+{stdenv, fetchurl, fetchpatch, ocaml, findlib, camlp4}:
+
+stdenv.mkDerivation rec {
+  name = "camomile-${version}";
+  version = "0.8.5";
+
+  src = fetchurl {
+    url = https://github.com/yoriyuki/Camomile/releases/download/rel-0.8.5/camomile-0.8.5.tar.bz2;
+    sha256 = "003ikpvpaliy5hblhckfmln34zqz0mk3y2m1fqvbjngh3h2np045";
+  };
+
+  patches = [ (fetchpatch {
+    url = https://raw.githubusercontent.com/ocaml/opam-repository/master/packages/camomile/camomile.0.8.5/files/4.05-typing-fix.patch;
+    sha256 = "167279lia6qx62mdcyc5rjsi4gf4yi52wn9mhgd9y1v3754z7fwb";
+  })];
+
+  buildInputs = [ocaml findlib camlp4];
+
+  createFindlibDestdir = true;
+
+  meta = {
+    homepage = https://github.com/yoriyuki/Camomile/tree/master/Camomile;
+    description = "A comprehensive Unicode library for OCaml";
+    license = stdenv.lib.licenses.lgpl21;
+    platforms = ocaml.meta.platforms or [];
+    maintainers = [
+      stdenv.lib.maintainers.z77z
+    ];
+  };
+}
diff --git a/pkgs/development/ocaml-modules/camomile/default.nix b/pkgs/development/ocaml-modules/camomile/default.nix
index 48517036dc6d..897a3ff6036d 100644
--- a/pkgs/development/ocaml-modules/camomile/default.nix
+++ b/pkgs/development/ocaml-modules/camomile/default.nix
@@ -1,30 +1,27 @@
-{stdenv, fetchurl, fetchpatch, ocaml, findlib, camlp4}:
+{ stdenv, fetchFromGitHub, ocaml, findlib, jbuilder, cppo }:
 
 stdenv.mkDerivation rec {
-  name = "camomile-${version}";
-  version = "0.8.5";
+	version = "0.8.6";
+	name = "ocaml${ocaml.version}-camomile-${version}";
 
-  src = fetchurl {
-    url = https://github.com/yoriyuki/Camomile/releases/download/rel-0.8.5/camomile-0.8.5.tar.bz2;
-    sha256 = "003ikpvpaliy5hblhckfmln34zqz0mk3y2m1fqvbjngh3h2np045";
-  };
+	src = fetchFromGitHub {
+		owner = "yoriyuki";
+		repo = "camomile";
+		rev = "rel-${version}";
+		sha256 = "1jq1xhaikczk6lbvas7c35aa04q0kjaqd8m54c4jivpj80yvg4x9";
+	};
 
-  patches = [ (fetchpatch {
-    url = https://raw.githubusercontent.com/ocaml/opam-repository/master/packages/camomile/camomile.0.8.5/files/4.05-typing-fix.patch;
-    sha256 = "167279lia6qx62mdcyc5rjsi4gf4yi52wn9mhgd9y1v3754z7fwb";
-  })];
+	buildInputs = [ ocaml findlib jbuilder cppo ];
 
-  buildInputs = [ocaml findlib camlp4];
+	configurePhase = "ocaml configure.ml --share $out/share/camomile";
 
-  createFindlibDestdir = true;
+	inherit (jbuilder) installPhase;
 
-  meta = {
-    homepage = https://github.com/yoriyuki/Camomile/tree/master/Camomile;
-    description = "A comprehensive Unicode library for OCaml";
-    license = stdenv.lib.licenses.lgpl21;
-    platforms = ocaml.meta.platforms or [];
-    maintainers = [
-      stdenv.lib.maintainers.z77z
-    ];
-  };
+	meta = {
+		inherit (ocaml.meta) platforms;
+		inherit (src.meta) homepage;
+		maintainers = [ stdenv.lib.maintainers.vbgl ];
+		license = stdenv.lib.licenses.lgpl21;
+		description = "A Unicode library for OCaml";
+	};
 }
diff --git a/pkgs/development/ocaml-modules/lablgtk/default.nix b/pkgs/development/ocaml-modules/lablgtk/default.nix
index d6e56126018c..9d01b73479a4 100644
--- a/pkgs/development/ocaml-modules/lablgtk/default.nix
+++ b/pkgs/development/ocaml-modules/lablgtk/default.nix
@@ -1,4 +1,4 @@
-{stdenv, fetchurl, ocaml, findlib, pkgconfig, gtk2, libgnomecanvas, libglade, gtksourceview, camlp4}:
+{ stdenv, fetchurl, ocaml, findlib, pkgconfig, gtk2, libgnomecanvas, libglade, gtksourceview }:
 
 let
   pname = "lablgtk";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ocaml findlib gtk2 libgnomecanvas libglade gtksourceview camlp4];
+  buildInputs = [ ocaml findlib gtk2 libgnomecanvas libglade gtksourceview ];
 
   configureFlags = "--with-libdir=$(out)/lib/ocaml/${ocaml.version}/site-lib";
   buildFlags = "world";
diff --git a/pkgs/development/ocaml-modules/ocamlgraph/default.nix b/pkgs/development/ocaml-modules/ocamlgraph/default.nix
index f6379c8b5a75..e005024d2225 100644
--- a/pkgs/development/ocaml-modules/ocamlgraph/default.nix
+++ b/pkgs/development/ocaml-modules/ocamlgraph/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "ocamlgraph-${version}";
-  version = "1.8.7";
+  version = "1.8.8";
 
   src = fetchurl {
     url = "http://ocamlgraph.lri.fr/download/ocamlgraph-${version}.tar.gz";
-    sha256 = "1845r537swjil2fcj7lgbibc2zybfwqqasrd2s7bncajs83cl1nz";
+    sha256 = "0m9g16wrrr86gw4fz2fazrh8nkqms0n863w7ndcvrmyafgxvxsnr";
   };
 
   buildInputs = [ ocaml findlib lablgtk ];
diff --git a/pkgs/development/python-modules/Theano/default.nix b/pkgs/development/python-modules/Theano/default.nix
new file mode 100644
index 000000000000..e0ff839ce1b7
--- /dev/null
+++ b/pkgs/development/python-modules/Theano/default.nix
@@ -0,0 +1,75 @@
+{ stdenv
+, lib
+, fetchPypi
+, gcc
+, writeScriptBin
+, buildPythonPackage
+, isPyPy
+, pythonOlder
+, isPy3k
+, nose
+, numpy
+, pydot_ng
+, scipy
+, six
+, libgpuarray
+, cudaSupport ? false, cudatoolkit
+, cudnnSupport ? false, cudnn
+}:
+
+assert cudnnSupport -> cudaSupport;
+
+let
+  extraFlags =
+    lib.optionals cudaSupport [ "-I ${cudatoolkit}/include" "-L ${cudatoolkit}/lib" ]
+    ++ lib.optionals cudnnSupport [ "-I ${cudnn}/include" "-L ${cudnn}/lib" ];
+
+  gcc_ = writeScriptBin "g++" ''
+    #!${stdenv.shell}
+    export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE ${toString extraFlags}"
+    exec ${gcc}/bin/g++ "$@"
+  '';
+
+  libgpuarray_ = libgpuarray.override { inherit cudaSupport; };
+
+in buildPythonPackage rec {
+  name = "${pname}-${version}";
+  pname = "Theano";
+  version = "0.9.0";
+
+  disabled = isPyPy || pythonOlder "2.6" || (isPy3k && pythonOlder "3.3");
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "05xwg00da8smkvkh6ywbywqzj8dw7x840jr74wqhdy9icmqncpbl";
+  };
+
+  postPatch = ''
+    sed -i 's,g++,${gcc_}/bin/g++,g' theano/configdefaults.py
+  '' + lib.optionalString cudnnSupport ''
+    sed -i \
+      -e "s,ctypes.util.find_library('cudnn'),'${cudnn}/lib/libcudnn.so',g" \
+      -e "s/= _dnn_check_compile()/= (True, None)/g" \
+      theano/gpuarray/dnn.py
+  '';
+
+  preCheck = ''
+    mkdir -p check-phase
+    export HOME=$(pwd)/check-phase
+  '';
+  doCheck = false;
+  # takes far too long, also throws "TypeError: sort() missing 1 required positional argument: 'a'"
+  # when run from the installer, and testing with Python 3.5 hits github.com/Theano/Theano/issues/4276,
+  # the fix for which hasn't been merged yet.
+
+  # keep Nose around since running the tests by hand is possible from Python or bash
+  checkInputs = [ nose ];
+  propagatedBuildInputs = [ numpy numpy.blas scipy six libgpuarray_ ];
+
+  meta = with stdenv.lib; {
+    homepage = http://deeplearning.net/software/theano/;
+    description = "A Python library for large-scale array computation";
+    license = licenses.bsd3;
+    maintainers = with maintainers; [ maintainers.bcdarwin ];
+  };
+}
diff --git a/pkgs/development/python-modules/Theano/theano-with-cuda/default.nix b/pkgs/development/python-modules/Theano/theano-with-cuda/default.nix
deleted file mode 100644
index f8b7a713d08e..000000000000
--- a/pkgs/development/python-modules/Theano/theano-with-cuda/default.nix
+++ /dev/null
@@ -1,65 +0,0 @@
-{ buildPythonPackage
-, fetchFromGitHub
-, pythonOlder
-, future
-, numpy
-, six
-, scipy
-, nose
-, nose-parameterized
-, pydot_ng
-, sphinx
-, pygments
-, libgpuarray
-, python
-, pycuda
-, cudatoolkit
-, cudnn
-, stdenv
-}:
-
-buildPythonPackage rec {
-  name = "Theano-cuda-${version}";
-  version = "0.8.2";
-
-  src = fetchFromGitHub {
-    owner = "Theano";
-    repo = "Theano";
-    rev = "46fbfeb628220b5e42bf8277a5955c52d153e874";
-    sha256 = "1sl91gli3jaw5gpjqqab4fiq4x6282spqciaid1s65pjsf3k55sc";
-  };
-
-  doCheck = false;
-
-  patchPhase = ''
-    pushd theano/sandbox/gpuarray
-    sed -i -re '2s/^/from builtins import bytes\n/g' subtensor.py
-    sed -i -re "s/(b'2')/int(bytes(\1))/g" subtensor.py
-    sed -i -re "s/(ctx.bin_id\[\-2\])/int(\1)/g" subtensor.py
-
-    sed -i -re '2s/^/from builtins import bytes\n/g' dnn.py
-    sed -i -re "s/(b'30')/int(bytes(\1))/g" dnn.py
-    sed -i -re "s/(ctx.bin_id\[\-2:\])/int(\1)/g" dnn.py
-    popd
-  '';
-
-  dontStrip = true;
-
-  propagatedBuildInputs = [
-    numpy.blas
-    numpy
-    six
-    scipy
-    nose
-    nose-parameterized
-    pydot_ng
-    sphinx
-    pygments
-    pycuda
-    cudatoolkit
-    libgpuarray
-    cudnn
-  ] ++ (stdenv.lib.optional (pythonOlder "3.0") future);
-
-  passthru.cudaSupport = true;
-}
diff --git a/pkgs/development/python-modules/Theano/theano-without-cuda/default.nix b/pkgs/development/python-modules/Theano/theano-without-cuda/default.nix
deleted file mode 100644
index e93af7436190..000000000000
--- a/pkgs/development/python-modules/Theano/theano-without-cuda/default.nix
+++ /dev/null
@@ -1,44 +0,0 @@
-{ stdenv
-, fetchurl
-, buildPythonPackage
-, isPyPy
-, pythonOlder
-, isPy3k
-, nose
-, numpy
-, pydot_ng
-, scipy
-, six
-}:
-
-buildPythonPackage rec {
-  name = "Theano-0.9.0";
-
-  disabled = isPyPy || pythonOlder "2.6" || (isPy3k && pythonOlder "3.3");
-
-  src = fetchurl {
-    url = "mirror://pypi/T/Theano/${name}.tar.gz";
-    sha256 = "05xwg00da8smkvkh6ywbywqzj8dw7x840jr74wqhdy9icmqncpbl";
-  };
-
-  #preCheck = ''
-  #  mkdir -p check-phase
-  #  export HOME=$(pwd)/check-phase
-  #'';
-  doCheck = false;
-  # takes far too long, also throws "TypeError: sort() missing 1 required positional argument: 'a'"
-  # when run from the installer, and testing with Python 3.5 hits github.com/Theano/Theano/issues/4276,
-  # the fix for which hasn't been merged yet.
-
-  # keep Nose around since running the tests by hand is possible from Python or bash
-  propagatedBuildInputs = [ nose numpy numpy.blas pydot_ng scipy six ];
-
-  meta = {
-    homepage = http://deeplearning.net/software/theano/;
-    description = "A Python library for large-scale array computation";
-    license = stdenv.lib.licenses.bsd3;
-    maintainers = [ stdenv.lib.maintainers.bcdarwin ];
-  };
-
-  passthru.cudaSupport = false;
-}
diff --git a/pkgs/development/python-modules/colorlover/default.nix b/pkgs/development/python-modules/colorlover/default.nix
new file mode 100644
index 000000000000..7c2147a6431a
--- /dev/null
+++ b/pkgs/development/python-modules/colorlover/default.nix
@@ -0,0 +1,23 @@
+{ buildPythonPackage, fetchPypi, python, stdenv, nose
+}:
+
+buildPythonPackage rec {
+  pname = "colorlover";
+  version = "0.2.1";
+  name = "${pname}-${version}";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1clwvssrj007r07prfvkqnpjy3f77dlp584lj879x8mwl8f0japi";
+  };
+
+  # no tests included in distributed archive
+  doCheck = false;
+
+  meta = {
+    homepage = https://github.com/jackparmer/colorlover;
+    description = "Color scales in Python for humans";
+    license = stdenv.lib.licenses.mit;
+    maintainers = with stdenv.lib.maintainers; [ globin ];
+  };
+}
diff --git a/pkgs/development/python-modules/cufflinks/default.nix b/pkgs/development/python-modules/cufflinks/default.nix
new file mode 100644
index 000000000000..620f85e436d3
--- /dev/null
+++ b/pkgs/development/python-modules/cufflinks/default.nix
@@ -0,0 +1,25 @@
+{ buildPythonPackage, stdenv, fetchPypi, pandas, plotly, colorlover
+}:
+
+buildPythonPackage rec {
+  pname = "cufflinks";
+  version = "0.12.0";
+  name = "${pname}-${version}";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "04ninvwm6277n3hqc17ririss90cd832wza3q3vf115rrrds3xyy";
+  };
+
+  propagatedBuildInputs = [ pandas plotly colorlover ];
+
+  # tests not included in archive
+  doCheck = false;
+
+  meta = {
+    homepage = https://github.com/santosjorge/cufflinks;
+    description = "Productivity Tools for Plotly + Pandas";
+    license = stdenv.lib.licenses.mit;
+    maintainers = with stdenv.lib.maintainers; [ globin ];
+  };
+}
diff --git a/pkgs/development/python-modules/django/1_11.nix b/pkgs/development/python-modules/django/1_11.nix
index 483a8eb23d01..fb5a62296b92 100644
--- a/pkgs/development/python-modules/django/1_11.nix
+++ b/pkgs/development/python-modules/django/1_11.nix
@@ -1,21 +1,22 @@
 { stdenv, buildPythonPackage, fetchurl, substituteAll,
   pythonOlder,
-  geos, gdal, pytz
+  geos, gdal, pytz,
+  withGdal ? false
 }:
 
 buildPythonPackage rec {
   pname = "Django";
   name = "${pname}-${version}";
-  version = "1.11.5";
+  version = "1.11.6";
 
   disabled = pythonOlder "2.7";
 
   src = fetchurl {
     url = "http://www.djangoproject.com/m/releases/1.11/${name}.tar.gz";
-    sha256 = "0a9bk1a0n0264lcr67fmwzqyhkhy6bqdzkxsj9a8dpyzca0qfdhq";
+    sha256 = "0q0cmwifa6c0k6kh8fpa3mjmqw7yqd616qz8m4ls3h51xyhjrd63";
   };
 
-  patches = [
+  patches = stdenv.lib.optionals withGdal [
     (substituteAll {
       src = ./1.10-gis-libs.template.patch;
       geos = geos;
diff --git a/pkgs/development/python-modules/libgpuarray/cuda/default.nix b/pkgs/development/python-modules/libgpuarray/cuda/default.nix
deleted file mode 100644
index a9c64cd7d7f8..000000000000
--- a/pkgs/development/python-modules/libgpuarray/cuda/default.nix
+++ /dev/null
@@ -1,129 +0,0 @@
-{ stdenv 
-, buildPythonPackage
-, fetchFromGitHub
-, cmake
-, cython
-, numpy
-, Mako
-, six
-, nose
-, beaker
-, memcached
-, pkgconfig
-, glibc
-, clblas
-, Babel
-, pygments
-, scipy
-, python
-, cudatoolkit
-, nvidia_x11
-}: 
-buildPythonPackage rec {
-  name = "libgpuarray-cuda-${version}";
-  version = "-9998.0"; 
-
-  src = fetchFromGitHub {
-    owner = "Theano"; 
-    repo = "libgpuarray";
-    rev = "fc36a40526c0a8303ace6c574ffdefba7feafe17"; 
-    sha256 = "1kb0k42addqjxiahlcbv6v6271yhsmz71j12186fpy60870i7zm7"; 
-  }; 
-
-  doCheck = true;
-
-  configurePhase = ''
-    mkdir -p Build/Install
-    pushd Build
-
-    cmake .. -DCMAKE_BUILD_TYPE=Release \
-             -DCMAKE_INSTALL_PREFIX=./Install \
-             -DCLBLAS_ROOT_DIR=${clblas}
-
-    popd
-  ''; 
-
-  preBuild = ''
-    pushd Build
-    make 
-    make install
-
-    function fixRunPath {
-      p=$(patchelf --print-rpath $1)
-      patchelf --set-rpath "$p:${stdenv.lib.makeLibraryPath [ cudatoolkit clblas nvidia_x11 ]}" $1
-    }
-
-    fixRunPath Install/lib/libgpuarray.so
-
-    popd
-  ''; 
-
-  setupPyBuildFlags = [ "-L $(pwd)/Build/Install/lib" "-I $(pwd)/Build/Install/include" ];
-
-  preInstall = ''
-    cp -r Build/Install $out
-  '';
-
-  postInstall = ''
-    pushd $out/${python.sitePackages}/pygpu
-    for f in $(find $out/pygpu -name "*.h"); do
-      ln -s $f $(basename $f)
-    done
-    popd
-  ''; 
-  checkPhase = ''
-    mkdir -p my_bin
-    pushd my_bin
-
-    cat > libgpuarray_run_tests << EOF
-#!/bin/sh
-if [ \$# -eq 0 ]; then 
-  echo "No argument provided."
-  echo "Available tests:"
-  ls $out/${python.sitePackages}/pygpu/tests | grep "test_"
-  exit 1
-else
-  nosetests -v "$out/${python.sitePackages}/pygpu/tests/\$@"
-fi
-EOF
-
-    chmod +x libgpuarray_run_tests
-    popd
-
-    cp -r my_bin $out/bin
-  '';
-
-  dontStrip = true; 
-
-  propagatedBuildInputs = [
-    numpy
-    scipy
-    nose
-    six
-    Mako
-  ];
-
-  buildInputs = [ 
-    cmake 
-    cython 
-    beaker 
-    memcached 
-    pkgconfig 
-    glibc 
-    Babel 
-    pygments 
-    numpy.blas 
-    cudatoolkit
-    nvidia_x11
-    clblas
-  ]; 
-
-  meta = with stdenv.lib; {
-    homepage = https://github.com/Theano/libgpuarray;
-    description = "Library to manipulate tensors on GPU.";
-    license = licenses.free;
-    maintainers = with maintainers; [ artuuge ];
-    platforms = platforms.linux;
-  };
-
-}
diff --git a/pkgs/development/python-modules/libgpuarray/default.nix b/pkgs/development/python-modules/libgpuarray/default.nix
new file mode 100644
index 000000000000..3c24c2ed24cb
--- /dev/null
+++ b/pkgs/development/python-modules/libgpuarray/default.nix
@@ -0,0 +1,81 @@
+{ stdenv 
+, lib
+, buildPythonPackage
+, fetchFromGitHub
+, cmake
+, cython
+, numpy
+, six
+, nose
+, Mako
+, python
+, cudaSupport ? false, cudatoolkit
+, openclSupport ? true, ocl-icd, clblas
+}: 
+
+buildPythonPackage rec {
+  name = "libgpuarray-${version}";
+  version = "0.6.9";
+
+  src = fetchFromGitHub {
+    owner = "Theano"; 
+    repo = "libgpuarray";
+    rev = "v${version}";
+    sha256 = "06z47ls42a37gbv0x7f3l1qvils7q0hvy02s95l530klgibp19s0";
+  }; 
+
+  # requires a GPU
+  doCheck = false;
+
+  configurePhase = "cmakeConfigurePhase";
+
+  libraryPath = lib.makeLibraryPath (
+    []
+    ++ lib.optionals cudaSupport [ cudatoolkit.lib cudatoolkit.out ]
+    ++ lib.optionals openclSupport [ ocl-icd clblas ]
+  );
+
+  preBuild = ''
+    make -j$NIX_BUILD_CORES
+    make install
+
+    ls $out/lib
+    export NIX_CFLAGS_COMPILE="-L $out/lib -I $out/include $NIX_CFLAGS_COMPILE"
+
+    cd ..
+  ''; 
+
+  postFixup = ''
+    rm $out/lib/libgpuarray-static.a
+
+    function fixRunPath {
+      p=$(patchelf --print-rpath $1)
+      patchelf --set-rpath "$p:$libraryPath" $1
+    }
+
+    fixRunPath $out/lib/libgpuarray.so
+  '';
+
+  propagatedBuildInputs = [
+    numpy
+    six
+    Mako
+  ];
+
+  enableParallelBuilding = true;
+
+  buildInputs = [ 
+    cmake 
+    cython 
+    nose
+  ]; 
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/Theano/libgpuarray";
+    description = "Library to manipulate tensors on GPU.";
+    license = licenses.free;
+    maintainers = with maintainers; [ artuuge ];
+    platforms = platforms.linux;
+  };
+
+}
diff --git a/pkgs/development/python-modules/powerline/default.nix b/pkgs/development/python-modules/powerline/default.nix
index 86f5adb28244..028d81d2934f 100644
--- a/pkgs/development/python-modules/powerline/default.nix
+++ b/pkgs/development/python-modules/powerline/default.nix
@@ -8,6 +8,9 @@
 , pygit2
 }:
 
+# The source of this package needs to be patched to include the full path to
+# the executables of git, mercurial and bazaar.
+
 buildPythonPackage rec {
   rev  = "2.6";
   name = "powerline-${rev}";
@@ -17,7 +20,7 @@ buildPythonPackage rec {
     sha256 = "c108f11fe10dc910febb94b87d3abded85d4363fb950366a9e30282b9ba7c272";
   };
 
-  propagatedBuildInputs = [ git mercurial bazaar psutil pygit2];
+  propagatedBuildInputs = [ psutil pygit2];
 
 # error: This is still beta and some tests still fail
   doCheck = false;
diff --git a/pkgs/development/python-modules/pyftgl/default.nix b/pkgs/development/python-modules/pyftgl/default.nix
index 51de5e8fad5c..a02aa94576e5 100644
--- a/pkgs/development/python-modules/pyftgl/default.nix
+++ b/pkgs/development/python-modules/pyftgl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, buildPythonPackage, fetchFromGitHub
+{ stdenv, buildPythonPackage, fetchFromGitHub, isPy3k
 , boost, freetype, ftgl, mesa }:
 
 buildPythonPackage rec {
@@ -11,6 +11,10 @@ buildPythonPackage rec {
     sha256 = "12zcjv4cwwjihiaf74kslrdmmk4bs47h7006gyqfwdfchfjdgg4r";
   };
 
+  postPatch = stdenv.lib.optional isPy3k ''
+    sed -i "s,'boost_python','boost_python3',g" setup.py
+  '';
+
   buildInputs = [ boost freetype ftgl mesa ];
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/python-modules/python-fontconfig/default.nix b/pkgs/development/python-modules/python-fontconfig/default.nix
new file mode 100644
index 000000000000..a8faadffc112
--- /dev/null
+++ b/pkgs/development/python-modules/python-fontconfig/default.nix
@@ -0,0 +1,30 @@
+{ lib, buildPythonPackage, fetchPypi, fontconfig, python, freefont_ttf, makeFontsConf }:
+
+let
+  fontsConf = makeFontsConf {
+    fontDirectories = [ freefont_ttf ];
+  };
+in buildPythonPackage rec {
+  pname = "Python-fontconfig";
+  version = "0.5.1";
+  name = "${pname}-${version}";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "154rfd0ygcbj9y8m32n537b457yijpfx9dvmf76vi0rg4ikf7kxp";
+  };
+
+  buildInputs = [ fontconfig ];
+
+  checkPhase = ''
+    export FONTCONFIG_FILE=${fontsConf};
+    echo y | ${python.interpreter} test/test.py
+  '';
+
+  meta = {
+    homepage = https://github.com/Vayn/python-fontconfig;
+    description = "Python binding for Fontconfig";
+    license = lib.licenses.gpl3;
+    maintainers = with lib.maintainers; [ gnidorah ];
+  };
+}
diff --git a/pkgs/development/python-modules/tensorflow/default.nix b/pkgs/development/python-modules/tensorflow/default.nix
index 00a5df843c5e..a0a2f3a24afc 100644
--- a/pkgs/development/python-modules/tensorflow/default.nix
+++ b/pkgs/development/python-modules/tensorflow/default.nix
@@ -1,156 +1,179 @@
-{ stdenv
-, symlinkJoin
-, lib
-, fetchurl
-, buildPythonPackage
-, isPy3k, isPy35, isPy36, isPy27
-, cudaSupport ? false
-, cudatoolkit ? null
-, cudnn ? null
-, linuxPackages ? null
-, numpy
-, six
-, protobuf
-, mock
-, backports_weakref
-, zlib
-, tensorflow-tensorboard
+{ stdenv, lib, fetchFromGitHub, fetchpatch, symlinkJoin, buildPythonPackage, isPy3k, pythonOlder
+, bazel, which, swig, binutils, glibcLocales
+, python, jemalloc, openmpi
+, numpy, six, protobuf, tensorflow-tensorboard, backports_weakref
+, wheel, mock, scipy
+, xlaSupport ? true
+, cudaSupport ? false, nvidia_x11 ? null, cudatoolkit ? null, cudnn ? null
+# Default from ./configure script
+, cudaCapabilities ? [ "3.5" "5.2" ]
 }:
 
 assert cudaSupport -> cudatoolkit != null
-                   && cudnn != null
-                   && linuxPackages != null;
+                   && cudnn != null;
 
 # unsupported combination
 assert ! (stdenv.isDarwin && cudaSupport);
 
-# tensorflow is built from a downloaded wheel, because the upstream
-# project's build system is an arcane beast based on
-# bazel. Untangling it and building the wheel from source is an open
-# problem.
+let
 
-buildPythonPackage rec {
-  pname = "tensorflow";
-  version = "1.3.0";
-  name = "${pname}-${version}";
-  format = "wheel";
-  disabled = ! (isPy35 || isPy36 || isPy27);
+  withTensorboard = pythonOlder "3.6";
 
-  # cudatoolkit is split (see https://github.com/NixOS/nixpkgs/commit/bb1c9b027d343f2ce263496582d6b56af8af92e6)
-  # However this means that libcusolver is not loadable by tensor flow. So we undo the split here.
   cudatoolkit_joined = symlinkJoin {
-    name = "unsplit_cudatoolkit";
-    paths = [ cudatoolkit.out
-              cudatoolkit.lib ];};
-
-  src = let
-      tfurl = sys: proc: pykind:
-        let
-          tfpref = if proc == "gpu"
-            then "gpu/tensorflow_gpu"
-            else "cpu/tensorflow";
-        in
-        "https://storage.googleapis.com/tensorflow/${sys}/${tfpref}-${version}-${pykind}.whl";
-      dls =
-        {
-        darwin.cpu = {
-          py2 = {
-            url = tfurl "mac" "cpu" "py2-none-any" ;
-            sha256 = "0nkymqbqjx8rsmc8vkc26cfsg4hpr6lj9zrwhjnfizvkzbbsh5z4";
-          };
-          py3 = {
-            url = tfurl "mac" "cpu" "py3-none-any" ;
-            sha256 = "1rj4m817w3lajnb1lgn3bwfwwk3qwvypyx11dim1ybakbmsc1j20";
-          };
-        };
-        linux-x86_64.cpu = {
-          py2 = {
-            url = tfurl "linux" "cpu" "cp27-none-linux_x86_64";
-            sha256 = "09pcyx0yfil4dm6cij8n3907pfgva07a38avrbai4qk5h6hxm8w9";
-          };
-          py35 = {
-            url = tfurl "linux" "cpu" "cp35-cp35m-linux_x86_64";
-            sha256 = "0p10zcf41pi33bi025fibqkq9rpd3v0rrbdmc9i9yd7igy076a07";
-          };
-          py36 = {
-            url = tfurl "linux" "cpu" "cp36-cp36m-linux_x86_64";
-            sha256 = "1qm8lm2f6bf9d462ybgwrz0dn9i6cnisgwdvyq9ssmy2f1gp8hxk";
-          };
-        };
-        linux-x86_64.cuda = {
-          py2 = {
-            url = tfurl "linux" "gpu" "cp27-none-linux_x86_64";
-            sha256 = "10yyyn4g2fsv1xgmw99bbr0fg7jvykay4gb5pxrrylh7h38h6wah";
-          };
-          py35 = {
-            url = tfurl "linux" "gpu" "cp35-cp35m-linux_x86_64";
-            sha256 = "0icwnhkcf3fxr6bmbihqzipnn4pxybd06qv7l3k0p4xdgycwzmzk";
-          };
-          py36 = {
-            url = tfurl "linux" "gpu" "cp36-cp36m-linux_x86_64";
-            sha256 = "12g3akkr083gs3sisjbmm0lpsk8phn3dvy7jjfadfxshqc7za14i";
-          };
-        };
-      };
-    in
-    fetchurl (
-      if stdenv.isDarwin then
-        if isPy3k then
-          dls.darwin.cpu.py3
-        else
-          dls.darwin.cpu.py2
-      else
-        if isPy35 then
-          if cudaSupport then
-            dls.linux-x86_64.cuda.py35
-          else
-            dls.linux-x86_64.cpu.py35
-        else if isPy36 then
-          if cudaSupport then
-            dls.linux-x86_64.cuda.py36
-          else
-            dls.linux-x86_64.cpu.py36
-        else
-          if cudaSupport then
-            dls.linux-x86_64.cuda.py2
-          else
-            dls.linux-x86_64.cpu.py2
-    );
-
-  propagatedBuildInputs =
-    [ numpy six protobuf mock backports_weakref ]
-    ++ lib.optional (!isPy36) tensorflow-tensorboard
-    ++ lib.optionals cudaSupport [ cudatoolkit_joined cudnn stdenv.cc ];
-
-  # tensorflow-gpu depends on tensorflow_tensorboard, which cannot be
+    name = "${cudatoolkit.name}-unsplit";
+    paths = [ cudatoolkit.out cudatoolkit.lib ];
+  };
+
+  cudaLibPath = lib.makeLibraryPath [ cudatoolkit.out cudatoolkit.lib nvidia_x11 cudnn ];
+
+  tfFeature = x: if x then "1" else "0";
+
+  common = rec {
+    version = "1.3.1";
+
+    src = fetchFromGitHub {
+      owner = "tensorflow";
+      repo = "tensorflow";
+      rev = "v${version}";
+      sha256 = "0gvi32dvv4ynr05p0gg5i0a6c55pig48k5qm7zslcqnp4sifwx0i";
+    };
+
+    nativeBuildInputs = [ swig which wheel scipy ];
+
+    buildInputs = [ python jemalloc openmpi glibcLocales ]
+      ++ lib.optionals cudaSupport [ cudatoolkit cudnn ];
+
+    propagatedBuildInputs = [ numpy six protobuf ]
+                            ++ lib.optional (!isPy3k) mock
+                            ++ lib.optional (pythonOlder "3.4") backports_weakref
+                            ++ lib.optional withTensorboard tensorflow-tensorboard;
+
+    preConfigure = ''
+      patchShebangs configure
+      export HOME="$NIX_BUILD_TOP"
+
+      export PYTHON_BIN_PATH="${python.interpreter}"
+      export TF_NEED_GCP=1
+      export TF_NEED_HDFS=1
+      export TF_NEED_CUDA=${tfFeature cudaSupport}
+      export TF_NEED_MPI=1
+      export TF_ENABLE_XLA=${tfFeature xlaSupport}
+      ${lib.optionalString cudaSupport ''
+        export CUDA_TOOLKIT_PATH=${cudatoolkit_joined}
+        export TF_CUDA_VERSION=${cudatoolkit.majorVersion}
+        export CUDNN_INSTALL_PATH=${cudnn}
+        export TF_CUDNN_VERSION=${cudnn.majorVersion}
+        export GCC_HOST_COMPILER_PATH=${cudatoolkit.cc}/bin/gcc
+        export TF_CUDA_COMPUTE_CAPABILITIES=${lib.concatStringsSep "," cudaCapabilities}
+      ''}
+
+      # There is _no_ non-interactive mode of configure.
+      sed -i \
+        -e 's,read -p,echo,g' \
+        -e 's,lib64,lib,g' \
+        configure
+    '';
+
+    hardeningDisable = [ "all" ];
+
+    bazelFlags = [ "--config=opt" ]
+                 ++ lib.optional cudaSupport "--config=cuda";
+
+    bazelTarget = "//tensorflow/tools/pip_package:build_pip_package";
+
+    meta = with stdenv.lib; {
+      description = "Computation using data flow graphs for scalable machine learning";
+      homepage = "http://tensorflow.org";
+      license = licenses.asl20;
+      maintainers = with maintainers; [ jyp abbradar ];
+      platforms = with platforms; if cudaSupport then linux else linux ++ darwin;
+    };
+  };
+
+in buildPythonPackage (common // {
+  name = "tensorflow-${common.version}";
+
+  deps = stdenv.mkDerivation (common // {
+    name = "tensorflow-external-${common.version}";
+
+    nativeBuildInputs = common.nativeBuildInputs ++ [ bazel ];
+
+    preConfigure = common.preConfigure + ''
+      export PYTHON_LIB_PATH="$(pwd)/site-packages"
+    '';
+
+    buildPhase = ''
+      mkdir site-packages
+      bazel --output_base="$(pwd)/output" fetch $bazelFlags $bazelTarget
+    '';
+
+    installPhase = ''
+      rm -rf output/external/{bazel_tools,\@bazel_tools.marker,local_*,\@local_*}
+      # Patching markers to make them deterministic
+      for i in output/external/\@*.marker; do
+        sed -i 's, -\?[0-9][0-9]*$, 1,' "$i"
+      done
+      # Patching symlinks to remove build directory reference
+      find output/external -type l | while read symlink; do
+        ln -sf $(readlink "$symlink" | sed "s,$NIX_BUILD_TOP,NIX_BUILD_TOP,") "$symlink"
+      done
+
+      cp -r output/external $out
+    '';
+
+    dontFixup = true;
+
+    outputHashMode = "recursive";
+    outputHashAlgo = "sha256";
+    outputHash = "0xs2n061gnpizfcnhs5jjpfk2av634j1l2l17zhy10bbmrwn3vrp";
+  });
+
+  nativeBuildInputs = common.nativeBuildInputs ++ [ (bazel.override { enableNixHacks = true; }) ];
+
+  configurePhase = ''
+    runHook preConfigure
+    export PYTHON_LIB_PATH="$out/${python.sitePackages}"
+    ./configure
+    runHook postConfigure
+  '';
+
+  buildPhase = ''
+    mkdir -p output/external
+    cp -r $deps/* output/external
+    chmod -R +w output
+    find output -type l | while read symlink; do
+      ln -sf $(readlink "$symlink" | sed "s,NIX_BUILD_TOP,$NIX_BUILD_TOP,") "$symlink"
+    done
+
+    patchShebangs .
+    find -type f -name CROSSTOOL\* -exec sed -i \
+      -e 's,/usr/bin/ar,${binutils}/bin/ar,g' \
+      {} \;
+
+    mkdir -p $out/${python.sitePackages}
+    bazel --output_base="$(pwd)/output" build $bazelFlags $bazelTarget
+
+    bazel-bin/tensorflow/tools/pip_package/build_pip_package $PWD/dist
+  '';
+
+  # tensorflow depends on tensorflow_tensorboard, which cannot be
   # built at the moment (some of its dependencies do not build
   # [htlm5lib9999999 (seven nines) -> tensorboard], and it depends on an old version of
   # bleach) Hence we disable dependency checking for now.
-  installFlags = lib.optional isPy36 "--no-dependencies";
-
-  # Note that we need to run *after* the fixup phase because the
-  # libraries are loaded at runtime. If we run in preFixup then
-  # patchelf --shrink-rpath will remove the cuda libraries.
-  postFixup = let
-    rpath = stdenv.lib.makeLibraryPath
-      (if cudaSupport then
-        [ stdenv.cc.cc.lib zlib cudatoolkit_joined cudnn
-          linuxPackages.nvidia_x11 ]
-      else
-        [ stdenv.cc.cc.lib zlib ]
-      );
-  in
-  ''
-    find $out -name '*.so' -exec patchelf --set-rpath "${rpath}" {} \;
-  '';
+  installFlags = lib.optional (!withTensorboard) "--no-dependencies";
 
+  # Tests are slow and impure.
   doCheck = false;
 
-  meta = with stdenv.lib; {
-    description = "TensorFlow helps the tensors flow";
-    homepage = http://tensorflow.org;
-    license = licenses.asl20;
-    maintainers = with maintainers; [ jyp ];
-    platforms = with platforms; if cudaSupport then linux else linux ++ darwin;
-  };
-}
+  # For some reason, CUDA is not retained in RPATH.
+  postFixup = lib.optionalString cudaSupport ''
+    libPath="$out/${python.sitePackages}/tensorflow/python/_pywrap_tensorflow_internal.so"
+    patchelf --set-rpath "$(patchelf --print-rpath "$libPath"):${cudaLibPath}" "$libPath"
+  '';
+
+  doInstallCheck = true;
+  installCheckPhase = ''
+    cd $NIX_BUILD_TOP
+    ${python.interpreter} -c "import tensorflow"
+  '';
+})
diff --git a/pkgs/development/python-modules/twilio/default.nix b/pkgs/development/python-modules/twilio/default.nix
new file mode 100644
index 000000000000..faca6edace5e
--- /dev/null
+++ b/pkgs/development/python-modules/twilio/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, buildPythonPackage, fetchFromGitHub
+, pyjwt, pysocks, pytz, requests, six, nose, mock }:
+
+buildPythonPackage rec {
+  pname = "twilio";
+  version = "6.8.0";
+  name = "${pname}-${version}";
+
+  # tests not included in PyPi, so fetch from github instead
+  src = fetchFromGitHub {
+    owner = "twilio";
+    repo = "twilio-python";
+    rev = version;
+    sha256 = "1vi3m6kvbmv643jbz95q59rcn871y0sss48kw2nqziyr5iswfx8c";
+  };
+
+  buildInputs = [ nose mock ];
+
+  propagatedBuildInputs = [ pyjwt pysocks pytz six requests ];
+
+  meta = with stdenv.lib; {
+    description = "Twilio API client and TwiML generator";
+    homepage = https://github.com/twilio/twilio-python/;
+    license = licenses.mit;
+    maintainers = with maintainers; [ flokli ];
+  };
+}
diff --git a/pkgs/development/python-modules/waitress-django/default.nix b/pkgs/development/python-modules/waitress-django/default.nix
new file mode 100644
index 000000000000..6efaf800b3cd
--- /dev/null
+++ b/pkgs/development/python-modules/waitress-django/default.nix
@@ -0,0 +1,8 @@
+{ buildPythonPackage, django_1_8, waitress }:
+buildPythonPackage {
+  name = "waitress-django";
+  src = ./.;
+  pythonPath = [ django_1_8 waitress ];
+  doCheck = false;
+  meta.description = "A waitress WSGI server serving django";
+}
diff --git a/pkgs/development/python-modules/waitress-django/setup.py b/pkgs/development/python-modules/waitress-django/setup.py
new file mode 100644
index 000000000000..07f7b326fdaf
--- /dev/null
+++ b/pkgs/development/python-modules/waitress-django/setup.py
@@ -0,0 +1,12 @@
+#!/usr/bin/env python
+
+from distutils.core import setup
+
+setup( name         = "waitress-django"
+     , version      = "0.0.0"
+     , description  = "A waitress WSGI server serving django"
+     , author       = "Bas van Dijk"
+     , author_email = "v.dijk.bas@gmail.com"
+     , package_dir  = {"" : "src"}
+     , scripts      = ["src/waitress-serve-django"]
+     )
diff --git a/pkgs/development/python-modules/waitress-django/src/waitress-serve-django b/pkgs/development/python-modules/waitress-django/src/waitress-serve-django
new file mode 100755
index 000000000000..b710086c22b9
--- /dev/null
+++ b/pkgs/development/python-modules/waitress-django/src/waitress-serve-django
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+import sys
+from waitress import serve
+from waitress.adjustments import Adjustments
+import django
+from django.core.handlers.wsgi import WSGIHandler
+from django.contrib.staticfiles.handlers import StaticFilesHandler
+
+if __name__ == "__main__":
+  kw, args = Adjustments.parse_args(sys.argv[1:])
+  django.setup()
+  # These arguments are specific to the runner, not waitress itself.
+  del kw['call'], kw['help']
+  serve(StaticFilesHandler(WSGIHandler()), **kw)
diff --git a/pkgs/development/tools/build-managers/bazel/0.4.nix b/pkgs/development/tools/build-managers/bazel/0.4.nix
index 2137c5c1497b..0b25623511a9 100644
--- a/pkgs/development/tools/build-managers/bazel/0.4.nix
+++ b/pkgs/development/tools/build-managers/bazel/0.4.nix
@@ -1,4 +1,8 @@
-{ stdenv, fetchurl, jdk, zip, unzip, bash, makeWrapper, which }:
+{ stdenv, lib, fetchurl, jdk, zip, unzip, bash, makeWrapper, which, coreutils
+# Always assume all markers valid (don't redownload dependencies).
+# Also, don't clean up environment variables.
+, enableNixHacks ? false
+}:
 
 stdenv.mkDerivation rec {
 
@@ -9,7 +13,7 @@ stdenv.mkDerivation rec {
     description = "Build tool that builds code quickly and reliably";
     license = licenses.asl20;
     maintainers = with maintainers; [ cstrahan philandstuff ];
-    platforms = platforms.linux;
+    platforms = platforms.unix;
   };
 
   name = "bazel-${version}";
@@ -19,25 +23,24 @@ stdenv.mkDerivation rec {
     sha256 = "0asmq3kxnl4326zhgh13mvcrc8jvmiswjj4ymrq0943q4vj7nwrb";
   };
 
+  preUnpack = ''
+    mkdir bazel
+    cd bazel
+  '';
   sourceRoot = ".";
 
+  patches = lib.optional enableNixHacks ./nix-hacks.patch;
+
   postPatch = ''
-    for f in $(grep -l -r '#!/bin/bash'); do
-      substituteInPlace "$f" --replace '#!/bin/bash' '#!${bash}/bin/bash'
+    for f in $(grep -l -r '/bin/bash'); do
+      substituteInPlace "$f" --replace '/bin/bash' '${bash}/bin/bash'
     done
-    for f in \
-      src/main/java/com/google/devtools/build/lib/analysis/CommandHelper.java \
-      src/main/java/com/google/devtools/build/lib/bazel/rules/BazelConfiguration.java \
-      src/main/java/com/google/devtools/build/lib/bazel/rules/sh/BazelShRuleClasses.java \
-      src/main/java/com/google/devtools/build/lib/rules/cpp/LinkCommandLine.java \
-      ; do
-      substituteInPlace "$f" --replace /bin/bash ${bash}/bin/bash
+    for f in $(grep -l -r '/usr/bin/env'); do
+      substituteInPlace "$f" --replace '/usr/bin/env' '${coreutils}/bin/env'
     done
   '';
 
   buildInputs = [
-    stdenv.cc
-    stdenv.cc.cc.lib
     jdk
     zip
     unzip
@@ -52,12 +55,7 @@ stdenv.mkDerivation rec {
     bash
   ];
 
-  # If TMPDIR is in the unpack dir we run afoul of blaze's infinite symlink
-  # detector (see com.google.devtools.build.lib.skyframe.FileFunction).
-  # Change this to $(mktemp -d) as soon as we figure out why.
-
   buildPhase = ''
-    export TMPDIR=/tmp
     ./compile.sh
     ./output/bazel --output_user_root=/tmp/.bazel build //scripts:bash_completion \
       --spawn_strategy=standalone \
diff --git a/pkgs/development/tools/build-managers/bazel/nix-hacks.patch b/pkgs/development/tools/build-managers/bazel/nix-hacks.patch
new file mode 100644
index 000000000000..563fe635e6b0
--- /dev/null
+++ b/pkgs/development/tools/build-managers/bazel/nix-hacks.patch
@@ -0,0 +1,51 @@
+diff --git a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java
+index eafa09fb5..d2d5e40e8 100644
+--- a/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java
++++ b/src/main/java/com/google/devtools/build/lib/rules/repository/RepositoryDelegatorFunction.java
+@@ -287,21 +287,8 @@ public final class RepositoryDelegatorFunction implements SkyFunction {
+           markerData.put(key, value);
+         }
+       }
+-      boolean result = false;
+-      if (markerRuleKey.equals(ruleKey)) {
+-        result = handler.verifyMarkerData(rule, markerData, env);
+-        if (env.valuesMissing()) {
+-          return null;
+-        }
+-      }
+ 
+-      if (result) {
+-        return new Fingerprint().addString(content).digestAndReset();
+-      } else {
+-        // So that we are in a consistent state if something happens while fetching the repository
+-        markerPath.delete();
+-        return null;
+-      }
++      return new Fingerprint().addString(content).digestAndReset();
+ 
+     } catch (IOException e) {
+       throw new RepositoryFunctionException(e, Transience.TRANSIENT);
+diff --git a/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java b/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java
+index a7ebc8f7a..40f2049fa 100644
+--- a/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java
++++ b/src/main/java/com/google/devtools/build/lib/shell/JavaSubprocessFactory.java
+@@ -129,7 +129,6 @@ public class JavaSubprocessFactory implements SubprocessFactory {
+     ProcessBuilder builder = new ProcessBuilder();
+     builder.command(params.getArgv());
+     if (params.getEnv() != null) {
+-      builder.environment().clear();
+       builder.environment().putAll(params.getEnv());
+     }
+ 
+diff --git a/src/main/java/com/google/devtools/build/lib/worker/Worker.java b/src/main/java/com/google/devtools/build/lib/worker/Worker.java
+index 0268d1b2b..637364657 100644
+--- a/src/main/java/com/google/devtools/build/lib/worker/Worker.java
++++ b/src/main/java/com/google/devtools/build/lib/worker/Worker.java
+@@ -77,7 +77,6 @@ class Worker {
+         new ProcessBuilder(command)
+             .directory(workDir.getPathFile())
+             .redirectError(Redirect.appendTo(logFile.getPathFile()));
+-    processBuilder.environment().clear();
+     processBuilder.environment().putAll(workerKey.getEnv());
+ 
+     this.process = processBuilder.start();
diff --git a/pkgs/development/tools/continuous-integration/jenkins/default.nix b/pkgs/development/tools/continuous-integration/jenkins/default.nix
index bcd637699159..1c5950a04c27 100644
--- a/pkgs/development/tools/continuous-integration/jenkins/default.nix
+++ b/pkgs/development/tools/continuous-integration/jenkins/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "jenkins-${version}";
-  version = "2.84";
+  version = "2.85";
 
   src = fetchurl {
     url = "http://mirrors.jenkins-ci.org/war/${version}/jenkins.war";
-    sha256 = "0pwmviaps4gbv9a3sdn17kqdv9jmh5fpbms1wm95jfj77m5dyyq6";
+    sha256 = "0z8rv6fxsvnw71f8s711n9s60r8jd43bigy9rqz5805k3xa68whr";
   };
 
   buildCommand = ''
diff --git a/pkgs/development/tools/scalafmt/default.nix b/pkgs/development/tools/scalafmt/default.nix
index dc7f96ea8a09..391c653b98ab 100644
--- a/pkgs/development/tools/scalafmt/default.nix
+++ b/pkgs/development/tools/scalafmt/default.nix
@@ -30,7 +30,6 @@ stdenv.mkDerivation rec {
     description = "Opinionated code formatter for Scala";
     homepage = http://scalafmt.org;
     license = licenses.asl20;
-    platforms = platforms.linux;
     maintainers = [ maintainers.markus1189 ];
   };
 }
diff --git a/pkgs/games/bastet/default.nix b/pkgs/games/bastet/default.nix
index 4c55d571bd51..27ddec616bc8 100644
--- a/pkgs/games/bastet/default.nix
+++ b/pkgs/games/bastet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, ncurses, boost }:
+{ stdenv, fetchFromGitHub, fetchpatch, ncurses, boost }:
 
 stdenv.mkDerivation rec {
   name = "bastet-${version}";
@@ -12,6 +12,14 @@ stdenv.mkDerivation rec {
     sha256 = "09kamxapm9jw9przpsgjfg33n9k94bccv65w95dakj0br33a75wn";
   };
 
+  patches = [
+    # Compatibility with new Boost
+    (fetchpatch {
+      url = "https://github.com/fph/bastet/commit/0e03f8d4d6bc6949cf1c447e632ce0d1b98c4be1.patch";
+      sha256 = "1475hisbm44jirsrhdlnddppsyn83xmvcx09gfkm9drcix05alzj";
+    })
+  ];
+
   installPhase = ''
     mkdir -p "$out"/bin
     cp bastet "$out"/bin/
diff --git a/pkgs/games/openra/default.nix b/pkgs/games/openra/default.nix
index ee8e865a6f11..fb01346d84e8 100644
--- a/pkgs/games/openra/default.nix
+++ b/pkgs/games/openra/default.nix
@@ -1,12 +1,11 @@
-{ stdenv, fetchurl, mono, makeWrapper, lua
+{ stdenv, fetchFromGitHub, mono, makeWrapper, lua
 , SDL2, freetype, openal, systemd, pkgconfig,
-  dotnetPackages, gnome3, curl, unzip
+  dotnetPackages, gnome3, curl, unzip, which
 }:
 
-let
-  version = "20161019";
-in stdenv.mkDerivation rec {
+stdenv.mkDerivation rec {
   name = "openra-${version}";
+  version = "20171014";
 
   meta = with stdenv.lib; {
     description = "Real Time Strategy game engine recreating the C&C titles";
@@ -16,24 +15,33 @@ in stdenv.mkDerivation rec {
     platforms   = platforms.linux;
   };
 
-  src = fetchurl {
-    name = "${name}.tar.gz";
-    url = "https://github.com/OpenRA/OpenRA/archive/release-${version}.tar.gz";
-    sha256 = "1psmq3kb2whkavh5pm0xc4m5b4bihvrl8pfrk851iqg1cs22bg0w";
+  src = fetchFromGitHub {
+    owner = "OpenRA";
+    repo = "OpenRA";
+    rev = "release-${version}";
+    sha256 = "0nlwpmiwhjs3qc2lxwnrh4p874v5y6mf4avi6bqgr1wvzc43n8wr";
+
+    extraPostFetch = ''
+      sed -i 's,curl,curl --insecure,g' $out/thirdparty/{fetch-thirdparty-deps,noget}.sh
+      $out/thirdparty/fetch-thirdparty-deps.sh
+    '';
   };
 
   dontStrip = true;
 
-  buildInputs = with dotnetPackages;
-     [ NUnit3 NewtonsoftJson MonoNat FuzzyLogicLibrary SmartIrc4net SharpZipLib MaxMindGeoIP2 MaxMindDb SharpFont StyleCopMSBuild StyleCopPlusMSBuild RestSharp NUnitConsole OpenNAT ]
+  buildInputs = (with dotnetPackages;
+     [ NUnit3 NewtonsoftJson MonoNat FuzzyLogicLibrary SmartIrc4net SharpZipLib MaxMindGeoIP2 MaxMindDb SharpFont StyleCopMSBuild StyleCopPlusMSBuild RestSharp NUnitConsole OpenNAT ])
      ++ [ curl unzip lua gnome3.zenity ];
   nativeBuildInputs = [ curl unzip mono makeWrapper lua pkgconfig ];
 
-  patchPhase = ''
+  postPatch = ''
     mkdir Support
-    sed -i 's/^VERSION.*/VERSION = release-${version}/g' Makefile
+    sed -i \
+      -e 's/^VERSION.*/VERSION = release-${version}/g' \
+      -e '/GeoLite2-Country.mmdb.gz/d' \
+      -e '/fetch-geoip-db.sh/d' \
+      Makefile
     substituteInPlace thirdparty/configure-native-deps.sh --replace "locations=\"" "locations=\"${lua}/lib "
-    substituteInPlace Makefile --replace "@./thirdparty/fetch-geoip-db.sh" ""
   '';
 
   preConfigure = ''
@@ -41,63 +49,6 @@ in stdenv.mkDerivation rec {
     make version
   '';
 
-  preBuild = let dotnetPackagesDlls = with dotnetPackages; [
-    "${OpenNAT}/lib/dotnet/Open.NAT/net45/Open.Nat.dll"
-    "${MonoNat}/lib/dotnet/Mono.Nat/net40/Mono.Nat.dll"
-    "${FuzzyLogicLibrary}/lib/dotnet/FuzzyLogicLibrary/Release/FuzzyLogicLibrary.dll"
-    "${SmartIrc4net}/lib/dotnet/SmartIrc4net/net40/SmarIrc4net*"
-    "${SharpZipLib}/lib/dotnet/SharpZipLib/20/ICSharpCode.SharpZipLib.dll"
-    "${MaxMindGeoIP2}/lib/dotnet/MaxMind.GeoIP2/net40/MaxMind.GeoIP2*"
-    "${MaxMindDb}/lib/dotnet/MaxMind.Db/net40/MaxMind.Db.*"
-    "${SharpFont}/lib/dotnet/SharpFont/net20/SharpFont.dll"
-    "${SharpFont}/lib/dotnet/SharpFont/SharpFont.dll.config"
-    "${StyleCopMSBuild}/lib/dotnet/StyleCop.MSBuild/StyleCop*.dll"
-    "${StyleCopPlusMSBuild}/lib/dotnet/StyleCopPlus.MSBuild/StyleCopPlus.dll"
-    "${RestSharp}/lib/dotnet/RestSharp/net4-client/RestSharp.dll"
-    "${NUnit}/lib/dotnet/NUnit/nunit.framework.*"
-    "${NUnitConsole}/lib/dotnet/NUnit.Console/*"
-    "${NewtonsoftJson}/lib/dotnet/Newtonsoft.Json/Newtonsoft.Json.dll"
-    ];
-    movePackages = [
-      ( let filename = "Eluant.dll"; in { origin = fetchurl {
-          url = "https://github.com/OpenRA/Eluant/releases/download/20160124/${filename}";
-          sha256 = "1c20whz7dzfhg3szd62rvb79745x5iwrd5pp62j3bbj1q9wpddmb";
-        }; target = filename; })
-
-      ( let filename = "SDL2-CS.dll"; in { origin = fetchurl {
-          url = "https://github.com/OpenRA/SDL2-CS/releases/download/20151227/${filename}";
-          sha256 = "0gqw2wg37cqhhlc2a9lfc4ndkyfi4m8bkv7ckxbawgydjlknq83n";
-        }; target = filename; })
-
-      ( let filename = "SDL2-CS.dll.config"; in { origin = fetchurl {
-          url = "https://github.com/OpenRA/SDL2-CS/releases/download/20151227/${filename}";
-          sha256 = "15709iscdg44wd33szw5y0fdxwvqfjw8v3xjq6a0mm46gr7mkw7g";
-        }; target = filename; })
-
-      ( let filename = "OpenAL-CS.dll"; in { origin = fetchurl {
-          url = "https://github.com/OpenRA/OpenAL-CS/releases/download/20151227/${filename}";
-          sha256 = "0lvyjkn7fqys97wym8rwlcp6ay2z059iabfvlcxhlrscjpyr2cyk";
-        }; target = filename; })
-
-      ( let filename = "OpenAL-CS.dll.config"; in { origin = fetchurl {
-          url = "https://github.com/OpenRA/OpenAL-CS/releases/download/20151227/${filename}";
-          sha256 = "0wcmk3dw26s93598ck5jism5609v0y233i0f1b76yilyfimg9sjq";
-        }; target = filename; })
-
-      ( let filename = "GeoLite2-Country.mmdb.gz"; in { origin = fetchurl {
-          url = "http://geolite.maxmind.com/download/geoip/database/${filename}";
-          sha256 = "0a82v0sj4zf5vigrn1pd6mnbqz6zl3rgk9nidqqzy836as2kxk9v";
-        }; target = filename; })
-    ];
-  in ''
-    mkdir thirdparty/download/
-
-    ${stdenv.lib.concatMapStringsSep "\n" (from: "cp -r ${from} thirdparty/download") dotnetPackagesDlls}
-    ${stdenv.lib.concatMapStringsSep "\n" ({origin, target}: "cp ${origin} thirdparty/download/${target}") movePackages}
-
-    make dependencies
-  '';
-
   buildFlags = [ "DEBUG=false" "default" "man-page" ];
 
   doCheck = true;
@@ -109,14 +60,13 @@ in stdenv.mkDerivation rec {
 
   postInstall = with stdenv.lib; let
     runtime = makeLibraryPath [ SDL2 freetype openal systemd lua ];
+    binaries= makeBinPath [ which mono gnome3.zenity ];
   in ''
     wrapProgram $out/lib/openra/launch-game.sh \
-      --prefix PATH : "${mono}/bin" \
-      --set PWD $out/lib/openra/ \
+      --prefix PATH : "${binaries}" \
       --prefix LD_LIBRARY_PATH : "${runtime}"
 
     mkdir -p $out/bin
-    echo -e "#!${stdenv.shell}\ncd $out/lib/openra && $out/lib/openra/launch-game.sh" > $out/bin/openra
-    chmod +x $out/bin/openra
+    makeWrapper $out/lib/openra/launch-game.sh $out/bin/openra --run "cd $out/lib/openra"
   '';
 }
diff --git a/pkgs/games/openrct2/default.nix b/pkgs/games/openrct2/default.nix
new file mode 100644
index 000000000000..a54d3a45ae81
--- /dev/null
+++ b/pkgs/games/openrct2/default.nix
@@ -0,0 +1,70 @@
+{ stdenv, fetchurl, fetchFromGitHub,
+  SDL2, cmake, curl, fontconfig, freetype, jansson, libiconv, libpng,
+  libpthreadstubs, libzip, mesa_glu, openssl, pkgconfig, speexdsp, zlib
+}:
+
+let
+  name = "openrct2-${version}";
+  version = "0.1.1";
+
+  openrct2-src = fetchFromGitHub {
+    owner = "OpenRCT2";
+    repo = "OpenRCT2";
+    rev = "v${version}";
+    sha256 = "1xxwqx2gzvsdrsy76rz3sys9m4pyn9q25nbnkba3cw1z4l2b73lg";
+  };
+
+  title-sequences-src = fetchFromGitHub {
+    owner = "OpenRCT2";
+    repo = "title-sequences";
+    rev = "v0.1.0";
+    sha256 = "17c926lhby90ilvyyl6jsiy0df8dw5jws97xigp3x8hddhvv7c16";
+  };
+in
+stdenv.mkDerivation rec {
+  inherit name;
+
+  srcs = [ openrct2-src title-sequences-src ];
+  sourceRoot = ".";
+
+  buildInputs = [
+    SDL2
+    cmake
+    curl
+    fontconfig
+    freetype
+    jansson
+    libiconv
+    libpng
+    libpthreadstubs
+    libzip
+    mesa_glu
+    openssl
+    pkgconfig
+    speexdsp
+    zlib
+  ];
+
+  postUnpack = ''
+    cp -r ${openrct2-src}/* ${sourceRoot}
+    cp -r ${title-sequences-src} ${sourceRoot}/title
+
+    # creating temporary files in fixCmakeFiles fails otherwise
+    chmod -R u+w ${sourceRoot}
+  '';
+
+  cmakeFlags = [
+    "-DCMAKE_BUILD_TYPE=RELWITHDEBINFO" "-DDOWNLOAD_TITLE_SEQUENCES=OFF"];
+
+  makeFlags = ["all" "g2"];
+
+  preFixup = "ln -s $out/share/openrct2 $out/bin/data";
+
+  meta = with stdenv.lib; {
+    description = "An open source re-implementation of RollerCoaster Tycoon 2 (original game required)";
+    homepage = https://openrct2.website/;
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ geistesk ];
+  };
+}
diff --git a/pkgs/os-specific/linux/kernel/linux-4.13.nix b/pkgs/os-specific/linux/kernel/linux-4.13.nix
index d54586c5f4f5..ee1aa79f5404 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.13.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.13.nix
@@ -1,11 +1,11 @@
 { stdenv, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
 
 import ./generic.nix (args // rec {
-  version = "4.13.7";
+  version = "4.13.8";
   extraMeta.branch = "4.13";
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "16vjjl3qw0a8ci6xbnywhb8bpr3ccbs0i6xa54lc094cd5gvx4v3";
+    sha256 = "09zl4gpw9j4xn6p78s6ba6qjjxpsy8whhvn19wnjhr9w4al8rrk4";
   };
 } // (args.argsOverride or {}))
diff --git a/pkgs/os-specific/linux/kernel/linux-4.9.nix b/pkgs/os-specific/linux/kernel/linux-4.9.nix
index b820b6a917b4..8a1ad7ca9ddc 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.9.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.9.nix
@@ -1,11 +1,11 @@
 { stdenv, hostPlatform, fetchurl, perl, buildLinux, ... } @ args:
 
 import ./generic.nix (args // rec {
-  version = "4.9.56";
+  version = "4.9.57";
   extraMeta.branch = "4.9";
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "1jnkf0ir42xkandx1lnqrxmskzwl6j46aqmzrxilddx9pkdjplhi";
+    sha256 = "19lndirbyryx0qdwqqhn1g4rng7d79rk4sra5lpa2d3axia0a8q9";
   };
 } // (args.argsOverride or {}))
diff --git a/pkgs/os-specific/linux/kernel/linux-hardened-copperhead.nix b/pkgs/os-specific/linux/kernel/linux-hardened-copperhead.nix
index 35222f207962..0c9c05312ba6 100644
--- a/pkgs/os-specific/linux/kernel/linux-hardened-copperhead.nix
+++ b/pkgs/os-specific/linux/kernel/linux-hardened-copperhead.nix
@@ -3,9 +3,9 @@
 with stdenv.lib;
 
 let
-  version = "4.13.7";
+  version = "4.13.8";
   revision = "a";
-  sha256 = "1ddhjj77pslivy6ngkqn020z08n5nvq8p261hz14sgp8h69v30is";
+  sha256 = "1yjam6ni32f9p7c1x2q12vi9fc9v10g1w35pr4p7qgs12zx8dy27";
 
   # modVersion needs to be x.y.z, will automatically add .0 if needed
   modVersion = concatStrings (intersperse "." (take 3 (splitString "." "${version}.0")));
diff --git a/pkgs/os-specific/linux/kexectools/default.nix b/pkgs/os-specific/linux/kexectools/default.nix
index 206dc6889e8b..4a68160ce05a 100644
--- a/pkgs/os-specific/linux/kexectools/default.nix
+++ b/pkgs/os-specific/linux/kexectools/default.nix
@@ -2,14 +2,14 @@
 
 stdenv.mkDerivation rec {
   name = "kexec-tools-${version}";
-  version = "2.0.14";
+  version = "2.0.15";
 
   src = fetchurl {
     urls = [
       "mirror://kernel/linux/utils/kernel/kexec/${name}.tar.xz"
       "http://horms.net/projects/kexec/kexec-tools/${name}.tar.xz"
     ];
-    sha256 = "1ihd3kzw8xnc5skq4pb633rr80007knjm4n1dd67a24xkplygcpz";
+    sha256 = "1rwl04y1mpb28yq5ynnk8j124dmhj5p8c4hcdn453sri2j37p6w9";
   };
 
   hardeningDisable = [ "format" "pic" "relro" ];
diff --git a/pkgs/os-specific/linux/musl/default.nix b/pkgs/os-specific/linux/musl/default.nix
index e37a2b9f55e6..c51b8b26c809 100644
--- a/pkgs/os-specific/linux/musl/default.nix
+++ b/pkgs/os-specific/linux/musl/default.nix
@@ -2,17 +2,17 @@
 
 stdenv.mkDerivation rec {
   name    = "musl-${version}";
-  version = "1.1.16";
+  version = "1.1.17";
 
   src = fetchurl {
     url    = "http://www.musl-libc.org/releases/${name}.tar.gz";
-    sha256 = "048h0w4yjyza4h05bkc6dpwg3hq6l03na46g0q1ha8fpwnjqawck";
+    sha256 = "0r0lyp2w6v2bvm8h1si7w3p2qx037szl14qnxm5p00568z3m3an8";
   };
 
   enableParallelBuilding = true;
 
-  # required to avoid busybox segfaulting on startup when invoking
-  # nix-build "<nixpkgs/pkgs/stdenv/linux/make-bootstrap-tools.nix>"
+  # Disable auto-adding stack protector flags,
+  # so musl can selectively disable as needed
   hardeningDisable = [ "stackprotector" ];
 
   preConfigure = ''
@@ -22,6 +22,7 @@ stdenv.mkDerivation rec {
   configureFlags = [
     "--enable-shared"
     "--enable-static"
+    "CFLAGS=-fstack-protector-strong"
   ];
 
   patches = [];
diff --git a/pkgs/os-specific/linux/spl/default.nix b/pkgs/os-specific/linux/spl/default.nix
index 75fbacfb90ef..5e0f83c4c681 100644
--- a/pkgs/os-specific/linux/spl/default.nix
+++ b/pkgs/os-specific/linux/spl/default.nix
@@ -68,8 +68,8 @@ in
     };
 
     splUnstable = common {
-      version = "2017-09-26";
-      rev = "e8474f9ad3b3d23c3277535c4f53f8fd1e6cbd74";
-      sha256 = "0251cnffgx98nckgz6imwa8dnvba44wc02aacmr1n430gmq72xra";
+      version = "2017-10-16";
+      rev = "28920ea3346c1c905c5f727ea3e54297e6257568";
+      sha256 = "0m42na009ivb9q9gz15ra94wqx5xdw18waanm56aqzrjxbqqa3ll";
     };
 }
diff --git a/pkgs/os-specific/linux/wireguard/default.nix b/pkgs/os-specific/linux/wireguard/default.nix
index b6d294836c28..18ed3287edc4 100644
--- a/pkgs/os-specific/linux/wireguard/default.nix
+++ b/pkgs/os-specific/linux/wireguard/default.nix
@@ -6,11 +6,11 @@ assert kernel != null -> stdenv.lib.versionAtLeast kernel.version "3.10";
 let
   name = "wireguard-${version}";
 
-  version = "0.0.20171011";
+  version = "0.0.20171017";
 
   src = fetchurl {
     url    = "https://git.zx2c4.com/WireGuard/snapshot/WireGuard-${version}.tar.xz";
-    sha256 = "15hby5fi85r7h7adr8kva26w9b2sz3147d7nl2y0fdblb3v4zr72";
+    sha256 = "1k9m980d7zmnhpj9kanyfavqrn7ryva16iblk9jrk6sdhxi9mdsp";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/os-specific/linux/zfs/default.nix b/pkgs/os-specific/linux/zfs/default.nix
index dfcb3896244a..bfa8dac72ba7 100644
--- a/pkgs/os-specific/linux/zfs/default.nix
+++ b/pkgs/os-specific/linux/zfs/default.nix
@@ -2,7 +2,7 @@
 , configFile ? "all"
 
 # Userspace dependencies
-, zlib, libuuid, python, attr
+, zlib, libuuid, python, attr, openssl
 
 # Kernel dependencies
 , kernel ? null, spl ? null, splUnstable ? null
@@ -41,7 +41,8 @@ let
       nativeBuildInputs = [ autoreconfHook nukeReferences ];
       buildInputs =
            optionals buildKernel [ spl ]
-        ++ optionals buildUser [ zlib libuuid python attr ];
+        ++ optionals buildUser [ zlib libuuid python attr ]
+        ++ optionals (buildUser && isUnstable) [ openssl ];
 
       # for zdb to get the rpath to libgcc_s, needed for pthread_cancel to work
       NIX_CFLAGS_LINK = "-lgcc_s";
@@ -158,10 +159,10 @@ in {
     incompatibleKernelVersion = null;
 
     # this package should point to a version / git revision compatible with the latest kernel release
-    version = "2017-09-26";
+    version = "2017-10-16";
 
-    rev = "7e98073379353a05498ac5a2f1a5df2a2257d6b0";
-    sha256 = "1hydfhmngpq31gxkxipqxnin74l760d1ia202h12vsgix9sp32h7";
+    rev = "7670f721fc82e6cdcdd31f83760a79b6f2f2b998";
+    sha256 = "0ask9d9936s7mhs9q5wzvn6c8fd322i76hs2n7fajfk17b1a1lkj";
     isUnstable = true;
 
     extraPatches = [
diff --git a/pkgs/servers/atlassian/confluence.nix b/pkgs/servers/atlassian/confluence.nix
index a4cc5c8780da..8b107e74f3f2 100644
--- a/pkgs/servers/atlassian/confluence.nix
+++ b/pkgs/servers/atlassian/confluence.nix
@@ -5,11 +5,11 @@
 
 stdenv.mkDerivation rec {
   name = "atlassian-confluence-${version}";
-  version = "6.4.0";
+  version = "6.4.2";
 
   src = fetchurl {
     url = "https://www.atlassian.com/software/confluence/downloads/binary/${name}.tar.gz";
-    sha256 = "1ba8zpcywnnanzqxjaqiyfc6j5qr6jk6laryz8npiqz4grv3qk61";
+    sha256 = "1akwbgbks6k63m22vrcvvz9jz4wqz380j8gb8lzbzm4yk8y7f4p9";
   };
 
   phases = [ "unpackPhase" "buildPhase" "installPhase" ];
diff --git a/pkgs/servers/atlassian/jira.nix b/pkgs/servers/atlassian/jira.nix
index f2ccb523e2ff..c8b9978a9edc 100644
--- a/pkgs/servers/atlassian/jira.nix
+++ b/pkgs/servers/atlassian/jira.nix
@@ -5,11 +5,11 @@
 
 stdenv.mkDerivation rec {
   name = "atlassian-jira-${version}";
-  version = "7.5.0";
+  version = "7.5.1";
 
   src = fetchurl {
     url = "https://downloads.atlassian.com/software/jira/downloads/atlassian-jira-software-${version}.tar.gz";
-    sha256 = "12pf0q1ixsf9ld0569mbwvjz5v9bhh7ad3bd8x9qx188vq5cz381";
+    sha256 = "0dl9sjp1z7h340phmfhwha2j7hj5zcspk8v7n6vhsrfsjbkm80vy";
   };
 
   phases = [ "unpackPhase" "buildPhase" "installPhase" "fixupPhase" ];
diff --git a/pkgs/servers/dns/knot-dns/default.nix b/pkgs/servers/dns/knot-dns/default.nix
index cdbdf04f4454..00d1c5c568d0 100644
--- a/pkgs/servers/dns/knot-dns/default.nix
+++ b/pkgs/servers/dns/knot-dns/default.nix
@@ -1,5 +1,6 @@
 { stdenv, fetchurl, pkgconfig, gnutls, jansson, liburcu, lmdb, libcap_ng, libidn
 , systemd, nettle, libedit, zlib, libiconv, libintlOrEmpty
+, fetchpatch
 }:
 
 let inherit (stdenv.lib) optional optionals; in
@@ -14,6 +15,12 @@ stdenv.mkDerivation rec {
     sha256 = "68e04961d0bf6ba193cb7ec658b295c4ff6e60b3754d64bcd77ebdcee0f283fd";
   };
 
+  patches = [(fetchpatch { # remove for >= 2.6.1
+    name = "kdig-tls.patch";
+    url = "https://gitlab.labs.nic.cz/knot/knot-dns/commit/b72d5cd032795.diff";
+    sha256 = "0ig31rp82j49jh8n3s0dcf5abhh35mcp2k2wii7bh0c60ngb29k6";
+  })];
+
   outputs = [ "bin" "out" "dev" ];
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/servers/monitoring/telegraf/default.nix b/pkgs/servers/monitoring/telegraf/default.nix
index 8e11fe877c83..59b27efba568 100644
--- a/pkgs/servers/monitoring/telegraf/default.nix
+++ b/pkgs/servers/monitoring/telegraf/default.nix
@@ -2,7 +2,7 @@
 
 buildGoPackage rec {
   name = "telegraf-${version}";
-  version = "1.4.1";
+  version = "1.4.2";
 
   goPackagePath = "github.com/influxdata/telegraf";
 
@@ -12,7 +12,7 @@ buildGoPackage rec {
     owner = "influxdata";
     repo = "telegraf";
     rev = "${version}";
-    sha256 = "1q0xl599zyqyralsl6mml1xl0h2206564sa2azivjmg48z7blcll";
+    sha256 = "1lmk0czqbr4mn1zf99403r8s6nyyk3bxwgvxfx7w4apvxl433iw4";
   };
 
   buildFlagsArray = [ ''-ldflags=
diff --git a/pkgs/servers/monitoring/telegraf/deps-1.4.1.nix b/pkgs/servers/monitoring/telegraf/deps-1.4.2.nix
index 4391d58164f0..4391d58164f0 100644
--- a/pkgs/servers/monitoring/telegraf/deps-1.4.1.nix
+++ b/pkgs/servers/monitoring/telegraf/deps-1.4.2.nix
diff --git a/pkgs/servers/uftp/default.nix b/pkgs/servers/uftp/default.nix
index 2e32f75c8673..102868c0d46c 100644
--- a/pkgs/servers/uftp/default.nix
+++ b/pkgs/servers/uftp/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "uftp-${version}";
-  version = "4.9.3";
+  version = "4.9.4";
 
   src = fetchurl {
     url = "mirror://sourceforge/uftp-multicast/source-tar/uftp-${version}.tar.gz";
-    sha256 = "13y7k6g6jksnllw0mwgzw4dqczh5c5hvq3zlqin7q98m0fpib4ly";
+    sha256 = "1npfl7n1w2l0j6c6iizw1szzq0lz9wy6jb55qmwhfkzwj0zd7mqp";
   };
 
   buildInputs = [ openssl ];
diff --git a/pkgs/tools/audio/liquidsoap/full.nix b/pkgs/tools/audio/liquidsoap/full.nix
index 318bb2859e54..eb544fc693e4 100644
--- a/pkgs/tools/audio/liquidsoap/full.nix
+++ b/pkgs/tools/audio/liquidsoap/full.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, which, pkgconfig
-, ocaml, ocamlPackages
+, ocamlPackages
 , libao, portaudio, alsaLib, libpulseaudio, libjack2
 , libsamplerate, libmad, taglib, lame, libogg
 , libvorbis, speex, libtheora, libopus, fdk_aac
@@ -26,7 +26,7 @@ stdenv.mkDerivation {
   configureFlags = [ "--localstatedir=/var" ];
 
   buildInputs =
-    [ which ocaml ocamlPackages.findlib pkgconfig
+    [ which ocamlPackages.ocaml ocamlPackages.findlib pkgconfig
       libao portaudio alsaLib libpulseaudio libjack2
       libsamplerate libmad taglib lame libogg
       libvorbis speex libtheora libopus fdk_aac
@@ -40,6 +40,6 @@ stdenv.mkDerivation {
     homepage = http://liquidsoap.fm/;
     maintainers = with maintainers; [ ehmry ];
     license = licenses.gpl2;
-    platforms = ocaml.meta.platforms or [];
+    platforms = ocamlPackages.ocaml.meta.platforms or [];
   };
 }
diff --git a/pkgs/tools/graphics/povray/default.nix b/pkgs/tools/graphics/povray/default.nix
index 6bdff06699b9..7284ee95a909 100644
--- a/pkgs/tools/graphics/povray/default.nix
+++ b/pkgs/tools/graphics/povray/default.nix
@@ -4,13 +4,13 @@
 
 stdenv.mkDerivation rec {
   name = "povray-${version}";
-  version = "3.7.0.3";
+  version = "3.7.0.4";
 
   src = fetchFromGitHub {
     owner = "POV-Ray";
     repo = "povray";
     rev = "v${version}";
-    sha256 = "0mzkgk3gn8jfrw1fq0z3kqbysdfq8nwdl8a28l18v8gzb31bblhq";
+    sha256 = "1wkwb43w5r9pa79yazy4w4s8n6g280igag97hgl7dyi289q39n0q";
   };
 
 
diff --git a/pkgs/tools/misc/snapper/default.nix b/pkgs/tools/misc/snapper/default.nix
index 9895fff3ba8f..4b7857d60e7b 100644
--- a/pkgs/tools/misc/snapper/default.nix
+++ b/pkgs/tools/misc/snapper/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ stdenv, fetchFromGitHub, fetchpatch
 , autoreconfHook, pkgconfig, docbook_xsl, libxslt, docbook_xml_dtd_45
 , acl, attr, boost, btrfs-progs, dbus_libs, diffutils, e2fsprogs, libxml2
 , lvm2, pam, python, utillinux }:
@@ -14,6 +14,14 @@ stdenv.mkDerivation rec {
     sha256 = "14hrv23film4iihyclcvc2r2dgxl8w3as50r81xjjc85iyp6yxkm";
   };
 
+  patches = [
+    # Fix build with new Boost
+    (fetchpatch {
+      url = "https://github.com/openSUSE/snapper/commit/2e3812d2c1d1f54861fb79f5c2b0197de96a00a3.patch";
+      sha256 = "0yrzss1v7lmcvkajmchz917yqsvlsdfz871szzw790v6pql1322s";
+    })
+  ];
+
   nativeBuildInputs = [
     autoreconfHook pkgconfig
     docbook_xsl libxslt docbook_xml_dtd_45
diff --git a/pkgs/tools/networking/isync/default.nix b/pkgs/tools/networking/isync/default.nix
index 8b81e0696c23..7dcfc6b512fb 100644
--- a/pkgs/tools/networking/isync/default.nix
+++ b/pkgs/tools/networking/isync/default.nix
@@ -1,14 +1,14 @@
-{ fetchurl, stdenv, openssl, pkgconfig, db, cyrus_sasl }:
+{ fetchurl, stdenv, openssl, pkgconfig, db, cyrus_sasl, perl }:
 
 stdenv.mkDerivation rec {
-  name = "isync-1.2.1";
+  name = "isync-1.3.0";
 
   src = fetchurl {
     url = "mirror://sourceforge/isync/${name}.tar.gz";
-    sha256 = "1bij6nm06ghkg98n2pdyacam2fyg5y8f7ajw0d5653m0r4ldw5p7";
+    sha256 = "173wd7x8y5sp94slzwlnb7zhgs32r57zl9xspl2rf4g3fqwmhpwd";
   };
 
-  nativeBuildInputs = [ pkgconfig ];
+  nativeBuildInputs = [ pkgconfig perl ];
   buildInputs = [ openssl db cyrus_sasl ];
 
   meta = with stdenv.lib; {
diff --git a/pkgs/tools/package-management/nix/default.nix b/pkgs/tools/package-management/nix/default.nix
index de6c1178221b..4359682d96a0 100644
--- a/pkgs/tools/package-management/nix/default.nix
+++ b/pkgs/tools/package-management/nix/default.nix
@@ -161,12 +161,12 @@ in rec {
 
   nixUnstable = (lib.lowPrio (common rec {
     name = "nix-1.12${suffix}";
-    suffix = "pre5655_cbc21691";
+    suffix = "pre5663_c7af84ce";
     src = fetchFromGitHub {
       owner = "NixOS";
       repo = "nix";
-      rev = "cbc216911dbda23c3bc050c969bc725fe60760ef";
-      sha256 = "0ynnk2m2n5pjmhy5gry90dy5k2wwy29v2wnq6zz32ak9zwz36x8r";
+      rev = "c7af84ce846a9deefa5b4db1b1bce1c091ca2a1e";
+      sha256 = "1sc6rkx0500jz4fyfqm7443s1q24whmpx10mfs12wdk516f0q8qh";
     };
     fromGit = true;
   })) // { perl-bindings = perl-bindings { nix = nixUnstable; }; };
diff --git a/pkgs/tools/typesetting/tex/texlive/bin.nix b/pkgs/tools/typesetting/tex/texlive/bin.nix
index 34a689ee9bd6..30979e312fc5 100644
--- a/pkgs/tools/typesetting/tex/texlive/bin.nix
+++ b/pkgs/tools/typesetting/tex/texlive/bin.nix
@@ -187,6 +187,7 @@ core-big = stdenv.mkDerivation { #TODO: upmendex
   '';
 
   preBuild = "cd texk/web2c";
+  CXXFLAGS = "-std=c++11 -Wno-reserved-user-defined-literal"; # TODO: remove once texlive 2017 is out?
   enableParallelBuilding = true;
 
   # now distribute stuff into outputs, roughly as upstream TL
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 6076927584fc..da1c6c7e1ae9 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -645,9 +645,7 @@ with pkgs;
   };
   aria = aria2;
 
-  aspcud = callPackage ../tools/misc/aspcud {
-    boost = boost163;
-  };
+  aspcud = callPackage ../tools/misc/aspcud { };
 
   at = callPackage ../tools/system/at { };
 
@@ -1151,9 +1149,7 @@ with pkgs;
 
   nfdump = callPackage ../tools/networking/nfdump { };
 
-  patdiff = callPackage ../tools/misc/patdiff {
-    ocamlPackages = ocamlPackages_4_03;
-  };
+  patdiff = callPackage ../tools/misc/patdiff { };
 
   playerctl = callPackage ../tools/audio/playerctl { };
 
@@ -1402,9 +1398,7 @@ with pkgs;
 
   citrix_receiver = callPackage ../applications/networking/remote/citrix-receiver { };
 
-  citra = libsForQt5.callPackage ../misc/emulators/citra {
-    boost = boost163;
-  };
+  citra = libsForQt5.callPackage ../misc/emulators/citra { };
 
   cmst = libsForQt5.callPackage ../tools/networking/cmst { };
 
@@ -1581,27 +1575,19 @@ with pkgs;
     cudatoolkit65
     cudatoolkit7
     cudatoolkit75
-    cudatoolkit8;
-
-  cudatoolkit = cudatoolkit8;
+    cudatoolkit8
+    cudatoolkit9;
 
-  cudnn = callPackage ../development/libraries/science/math/cudnn/default.nix {};
+  cudatoolkit = cudatoolkit9;
 
-  cudnn5_cudatoolkit75 = callPackage ../development/libraries/science/math/cudnn/7.5-5.0 {
-    cudatoolkit = cudatoolkit75;
-  };
-
-  cudnn5_cudatoolkit80 = callPackage ../development/libraries/science/math/cudnn/8.0-5.0 {
-    cudatoolkit = cudatoolkit8;
-  };
-
-  cudnn51_cudatoolkit80 = callPackage ../development/libraries/science/math/cudnn/8.0-5.1 {
-    cudatoolkit = cudatoolkit8;
-  };
+  inherit (callPackages ../development/libraries/science/math/cudnn { })
+    cudnn_cudatoolkit7
+    cudnn_cudatoolkit75
+    cudnn6_cudatoolkit8
+    cudnn_cudatoolkit8
+    cudnn_cudatoolkit9;
 
-  cudnn60_cudatoolkit80 = callPackage ../development/libraries/science/math/cudnn/8.0-6.0 {
-    cudatoolkit = cudatoolkit8;
-  };
+  cudnn = cudnn_cudatoolkit9;
 
   curlFull = curl.override {
     idnSupport = true;
@@ -2905,6 +2891,7 @@ with pkgs;
 
   liquidsoap = callPackage ../tools/audio/liquidsoap/full.nix {
     ffmpeg = ffmpeg_2;
+    ocamlPackages = ocamlPackages_4_02;
   };
 
   lksctp-tools = callPackage ../os-specific/linux/lksctp-tools { };
@@ -4391,7 +4378,7 @@ with pkgs;
 
   skippy-xd = callPackage ../tools/X11/skippy-xd {};
 
-  sks = callPackage ../servers/sks { inherit (ocamlPackages) ocaml camlp4; };
+  sks = callPackage ../servers/sks { inherit (ocamlPackages_4_02) ocaml camlp4; };
 
   skydns = callPackage ../servers/skydns { };
 
@@ -6159,9 +6146,7 @@ with pkgs;
 
   ocaml-top = callPackage ../development/tools/ocaml/ocaml-top { };
 
-  ocsigen-i18n = callPackage ../development/tools/ocaml/ocsigen-i18n {
-    ocamlPackages = ocamlPackages_4_03;
-  };
+  ocsigen-i18n = callPackage ../development/tools/ocaml/ocsigen-i18n { };
 
   opa = callPackage ../development/compilers/opa {
     nodejs = nodejs-4_x;
@@ -6300,6 +6285,7 @@ with pkgs;
   };
 
   teyjus = callPackage ../development/compilers/teyjus {
+    inherit (ocamlPackages_4_02) ocaml;
     omake = omake_rc1;
   };
 
@@ -7201,10 +7187,12 @@ with pkgs;
   flow = callPackage ../development/tools/analysis/flow {
     inherit (darwin.apple_sdk.frameworks) CoreServices;
     inherit (darwin) cf-private;
-    inherit (ocamlPackages_4_03) ocaml findlib camlp4 sedlex ocamlbuild;
+    inherit (ocamlPackages) ocaml findlib camlp4 sedlex ocamlbuild;
   };
 
-  framac = callPackage ../development/tools/analysis/frama-c { };
+  framac = callPackage ../development/tools/analysis/frama-c {
+    ocamlPackages = ocamlPackages_4_03;
+  };
 
   frame = callPackage ../development/libraries/frame { };
 
@@ -7426,9 +7414,7 @@ with pkgs;
   noweb = callPackage ../development/tools/literate-programming/noweb { };
   nuweb = callPackage ../development/tools/literate-programming/nuweb { tex = texlive.combined.scheme-small; };
 
-  obelisk = callPackage ../development/tools/ocaml/obelisk {
-    ocamlPackages = ocaml-ng.ocamlPackages_4_03;
-  };
+  obelisk = callPackage ../development/tools/ocaml/obelisk { };
 
   obuild = callPackage ../development/tools/ocaml/obuild { };
 
@@ -7827,8 +7813,9 @@ with pkgs;
   boost162 = callPackage ../development/libraries/boost/1.62.nix { };
   boost163 = callPackage ../development/libraries/boost/1.63.nix { };
   boost164 = callPackage ../development/libraries/boost/1.64.nix { };
-  boost16x = boost164;
-  boost = boost162;
+  boost165 = callPackage ../development/libraries/boost/1.65.nix { };
+  boost16x = boost165;
+  boost = boost16x;
 
   boost_process = callPackage ../development/libraries/boost-process { };
 
@@ -8034,6 +8021,18 @@ with pkgs;
 
   dotconf = callPackage ../development/libraries/dotconf { };
 
+  # Multi-arch "drivers" which we want to build for i686.
+  driversi686Linux = recurseIntoAttrs {
+    inherit (pkgsi686Linux)
+      mesa_noglu
+      vaapiIntel
+      libvdpau-va-gl
+      vaapiVdpau
+      beignet
+      glxinfo
+      vdpauinfo;
+  };
+
   dssi = callPackage ../development/libraries/dssi {};
 
   dxflib = callPackage ../development/libraries/dxflib {};
@@ -10026,6 +10025,8 @@ with pkgs;
   };
 
   opencv3 = callPackage ../development/libraries/opencv/3.x.nix {
+    enableCuda = config.cudaSupport or false;
+    cudatoolkit = cudatoolkit8;
     inherit (darwin.apple_sdk.frameworks) AVFoundation Cocoa QTKit;
   };
 
@@ -10034,6 +10035,8 @@ with pkgs;
 
   openexr = callPackage ../development/libraries/openexr { };
 
+  openexrid-unstable = callPackage ../development/libraries/openexrid-unstable { };
+
   openldap = callPackage ../development/libraries/openldap { };
 
   opencolorio = callPackage ../development/libraries/opencolorio { };
@@ -10058,6 +10061,8 @@ with pkgs;
 
   openslp = callPackage ../development/libraries/openslp {};
 
+  openvdb = callPackage ../development/libraries/openvdb {};
+
   inherit (callPackages ../development/libraries/libressl { })
     libressl_2_5
     libressl_2_6;
@@ -10088,7 +10093,7 @@ with pkgs;
   };
 
   opensubdiv = callPackage ../development/libraries/opensubdiv {
-    stdenv_gcc5 = overrideCC stdenv gcc5;
+    cudaSupport = config.cudaSupport or false;
     cmake = cmake_2_8;
   };
 
@@ -10098,6 +10103,8 @@ with pkgs;
 
   ortp = callPackage ../development/libraries/ortp { };
 
+  openrct2 = callPackage ../games/openrct2/default.nix { };
+
   osm-gps-map = callPackage ../development/libraries/osm-gps-map { };
 
   p11_kit = callPackage ../development/libraries/p11-kit { };
@@ -10313,7 +10320,7 @@ with pkgs;
       kservice ktexteditor ktextwidgets kunitconversion kwallet kwayland
       kwidgetsaddons kwindowsystem kxmlgui kxmlrpcclient modemmanager-qt
       networkmanager-qt plasma-framework prison solid sonnet syntax-highlighting
-      threadweaver;
+      threadweaver kirigami2;
 
     ### KDE PLASMA 5
 
@@ -11054,6 +11061,8 @@ with pkgs;
 
   xvidcore = callPackage ../development/libraries/xvidcore { };
 
+  xxHash = callPackage ../development/libraries/xxHash {};
+
   xylib = callPackage ../development/libraries/xylib { };
 
   yajl = callPackage ../development/libraries/yajl { };
@@ -12930,7 +12939,6 @@ with pkgs;
 
   systemd = callPackage ../os-specific/linux/systemd {
     utillinux = utillinuxMinimal; # break the cyclic dependency
-    gperf = gperf_3_0; # fix build until v233
   }
     // {
       udev.bin = systemd;     # ${systemd.udev.bin}/bin/udevadm
@@ -13623,6 +13631,8 @@ with pkgs;
 
   airwave = callPackage ../applications/audio/airwave/default.nix { };
 
+  alembic = callPackage ../development/libraries/alembic {};
+
   alchemy = callPackage ../applications/graphics/alchemy { };
 
   alock = callPackage ../misc/screensavers/alock { };
@@ -13824,7 +13834,7 @@ with pkgs;
   bleachbit = callPackage ../applications/misc/bleachbit { };
 
   blender = callPackage  ../applications/misc/blender {
-    stdenv_gcc5 = overrideCC stdenv gcc5;
+    cudaSupport = config.cudaSupport or false;
     python = python35;
   };
 
@@ -14101,11 +14111,11 @@ with pkgs;
   };
 
   inherit (callPackage ../applications/virtualization/docker { })
-    docker_17_06
-    docker_17_09;
+    docker_17_09
+    docker_17_10;
 
   docker = docker_17_09;
-  docker-edge = docker_17_09;
+  docker-edge = docker_17_10;
 
   docker-proxy = callPackage ../applications/virtualization/docker/proxy.nix { };
 
@@ -15410,7 +15420,7 @@ with pkgs;
     bison = bison2;
   };
 
-  llpp = ocaml-ng.ocamlPackages_4_04.callPackage ../applications/misc/llpp { };
+  llpp = ocaml-ng.ocamlPackages.callPackage ../applications/misc/llpp { };
 
   lmms = callPackage ../applications/audio/lmms {
     stdenv = overrideCC stdenv gcc5;
@@ -15724,6 +15734,8 @@ with pkgs;
     ruby = ruby_2_1;
   };
 
+  partio = callPackage ../development/libraries/partio {};
+
   pcmanfm = callPackage ../applications/misc/pcmanfm { };
 
   pcmanfm-qt = lxqt.pcmanfm-qt;
@@ -15742,6 +15754,8 @@ with pkgs;
 
   polybar = callPackage ../applications/misc/polybar { };
 
+  ptex = callPackage ../development/libraries/ptex {};
+
   rssguard = libsForQt5.callPackage ../applications/networking/feedreaders/rssguard { };
 
   scudcloud = callPackage ../applications/networking/instant-messengers/scudcloud { };
@@ -15886,6 +15900,8 @@ with pkgs;
 
   opencpn = callPackage ../applications/misc/opencpn { };
 
+  openfx = callPackage ../development/libraries/openfx {};
+
   openimageio = callPackage ../applications/graphics/openimageio { };
 
   openjump = callPackage ../applications/misc/openjump { };
@@ -15906,7 +15922,7 @@ with pkgs;
 
   opusTools = callPackage ../applications/audio/opus-tools { };
 
-  orpie = callPackage ../applications/misc/orpie { gsl = gsl_1; };
+  orpie = callPackage ../applications/misc/orpie { gsl = gsl_1; ocamlPackages = ocamlPackages_4_02; };
 
   osmo = callPackage ../applications/office/osmo { };
 
@@ -16557,7 +16573,7 @@ with pkgs;
 
   stalonetray = callPackage ../applications/window-managers/stalonetray {};
 
-  inherit (ocamlPackages_4_03) stog;
+  inherit (ocamlPackages) stog;
 
   stp = callPackage ../applications/science/logic/stp {};
 
@@ -17576,6 +17592,7 @@ with pkgs;
 
   digikam = libsForQt5.callPackage ../applications/graphics/digikam {
     inherit (plasma5) oxygen;
+    inherit (kdeApplications) kcalcore;
     boost = boost160;
   };
 
@@ -18256,7 +18273,7 @@ with pkgs;
     kactivitymanagerd kde-cli-tools kde-gtk-config kdeplasma-addons kgamma5
     kinfocenter kmenuedit kscreen kscreenlocker ksshaskpass ksysguard
     kwallet-pam kwayland-integration kwin kwrited milou oxygen plasma-desktop
-    plasma-integration plasma-nm plasma-pa plasma-workspace
+    plasma-integration plasma-nm plasma-pa plasma-vault plasma-workspace
     plasma-workspace-wallpapers polkit-kde-agent powerdevil sddm-kcm startkde
     systemsettings;
 
@@ -18356,10 +18373,7 @@ with pkgs;
 
   blas = callPackage ../development/libraries/science/math/blas { };
 
-  clblas-cuda = callPackage ../development/libraries/science/math/clblas/cuda {
-    cudatoolkit = pkgs.cudatoolkit75;
-    inherit (linuxPackages) nvidia_x11;
-  };
+  clblas = callPackage ../development/libraries/science/math/clblas { };
 
   jags = callPackage ../applications/science/math/jags { };
 
@@ -18485,9 +18499,7 @@ with pkgs;
 
   abella = callPackage ../applications/science/logic/abella {};
 
-  acgtk = callPackage ../applications/science/logic/acgtk {
-    ocamlPackages = ocamlPackages_4_03;
-  };
+  acgtk = callPackage ../applications/science/logic/acgtk { };
 
   alt-ergo = callPackage ../applications/science/logic/alt-ergo {
     ocamlPackages = ocamlPackages_4_02;
@@ -18588,7 +18600,9 @@ with pkgs;
   };
   cvc4 = callPackage ../applications/science/logic/cvc4 {};
 
-  ekrhyper = callPackage ../applications/science/logic/ekrhyper {};
+  ekrhyper = callPackage ../applications/science/logic/ekrhyper {
+    inherit (ocamlPackages_4_02) ocaml;
+  };
 
   eprover = callPackage ../applications/science/logic/eprover { };
 
@@ -18619,7 +18633,9 @@ with pkgs;
     java = if stdenv.isLinux then jre else jdk;
   };
 
-  iprover = callPackage ../applications/science/logic/iprover {};
+  iprover = callPackage ../applications/science/logic/iprover {
+    inherit (ocamlPackages_4_02) ocaml;
+  };
 
   jonprl = callPackage ../applications/science/logic/jonprl {
     smlnj = if stdenv.isDarwin
@@ -18741,8 +18757,15 @@ with pkgs;
 
   caffe = callPackage ../applications/science/math/caffe rec {
     cudaSupport = config.caffe.cudaSupport or config.cudaSupport or false;
-    # CUDA 8 doesn't support GCC 6.
-    stdenv = if cudaSupport then overrideCC pkgs.stdenv gcc5 else pkgs.stdenv;
+    cudnnSupport = cudaSupport;
+  };
+
+  cntk = callPackage ../applications/science/math/cntk rec {
+    cudaSupport = pkgs.config.cudaSupport or false;
+    cudnnSupport = cudaSupport;
+    inherit (linuxPackages) nvidia_x11;
+    cudatoolkit = cudatoolkit8;
+    cudnn = cudnn6_cudatoolkit8;
   };
 
   ecm = callPackage ../applications/science/math/ecm { };
@@ -18766,7 +18789,9 @@ with pkgs;
     sbcl = null;
   };
 
-  mxnet = callPackage ../applications/science/math/mxnet {
+  mxnet = callPackage ../applications/science/math/mxnet rec {
+    cudaSupport = config.cudaSupport or false;
+    cudnnSupport = cudaSupport;
     inherit (linuxPackages) nvidia_x11;
   };
 
diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix
index 275c0739ce65..43c249e7b1d9 100644
--- a/pkgs/top-level/ocaml-packages.nix
+++ b/pkgs/top-level/ocaml-packages.nix
@@ -98,7 +98,10 @@ let
     camlzip = callPackage ../development/ocaml-modules/camlzip { };
 
     camomile_0_8_2 = callPackage ../development/ocaml-modules/camomile/0.8.2.nix { };
-    camomile = callPackage ../development/ocaml-modules/camomile { };
+    camomile =
+      if lib.versionOlder "4.03" ocaml.version
+      then callPackage ../development/ocaml-modules/camomile { }
+      else callPackage ../development/ocaml-modules/camomile/0.8.5.nix { };
 
     camlimages_4_0 =
       if lib.versionOlder "4.02" ocaml.version
@@ -986,5 +989,5 @@ in rec
 
   ocamlPackages_latest = ocamlPackages_4_05;
 
-  ocamlPackages = ocamlPackages_4_02;
+  ocamlPackages = ocamlPackages_4_04;
 }
diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix
index 69c89c2529d3..9f1423c65c1c 100644
--- a/pkgs/top-level/perl-packages.nix
+++ b/pkgs/top-level/perl-packages.nix
@@ -2917,10 +2917,10 @@ let self = _self // overrides; _self = with self; {
   };
 
   CryptX = buildPerlPackage rec {
-    name = "CryptX-0.050";
+    name = "CryptX-0.054";
     src = fetchurl {
       url = "mirror://cpan/authors/id/M/MI/MIK/${name}.tar.gz";
-      sha256 = "c1de040779d9f5482d0a2f17a9a5aa6b069c7c58c07fbe26ab62bc689a5c9161";
+      sha256 = "f084a706f6ff032ca5c46ec6f90ba5b6a26ae8752584911830f6535bf76d8e57";
     };
     propagatedBuildInputs = [ JSONMaybeXS ];
     meta = {
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index 231d5fecf6ba..daee60ccec43 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -60,7 +60,7 @@ let
 
   buildPythonApplication = args: buildPythonPackage ({namePrefix="";} // args );
 
-  graphiteVersion = "0.9.15";
+  graphiteVersion = "1.0.2";
 
   fetchPypi = makeOverridable( {format ? "setuptools", ... } @attrs:
     let
@@ -535,6 +535,8 @@ in {
     };
   } else null;
 
+  python-fontconfig = callPackage ../development/python-modules/python-fontconfig { };
+
   funcsigs = callPackage ../development/python-modules/funcsigs { };
 
   APScheduler = callPackage ../development/python-modules/APScheduler { };
@@ -1476,7 +1478,10 @@ in {
 
   # Build boost for this specific Python version
   # TODO: use separate output for libboost_python.so
-  boost = pkgs.boost.override {inherit python;};
+  boost = pkgs.boost.override {
+    inherit (self) python numpy;
+    enablePython = true;
+  };
 
   buttersink = buildPythonPackage rec {
     name = "buttersink-0.6.8";
@@ -1531,7 +1536,6 @@ in {
     python = self.python;
     boost = self.boost;
     numpy = self.numpy;
-    pythonSupport = true;
   };
 
   capstone = buildPythonPackage rec {
@@ -1667,6 +1671,8 @@ in {
 
   csvkit =  callPackage ../development/python-modules/csvkit { };
 
+  cufflinks = callPackage ../development/python-modules/cufflinks { };
+
   cx_Freeze = callPackage ../development/python-modules/cx_freeze {};
 
   cvxopt = buildPythonPackage rec {
@@ -2576,6 +2582,27 @@ in {
     };
   };
 
+  cntk = buildPythonPackage rec {
+    inherit (pkgs.cntk) name version src meta;
+
+    buildInputs = [ pkgs.cntk pkgs.swig pkgs.openmpi ];
+    propagatedBuildInputs = with self; [ numpy scipy enum34 protobuf pip ];
+
+    CNTK_LIB_PATH = "${pkgs.cntk}/lib";
+    CNTK_COMPONENT_VERSION = pkgs.cntk.version;
+
+    postPatch = ''
+      cd bindings/python
+    '';
+
+    postInstall = ''
+      rm -rf $out/${python.sitePackages}/cntk/libs
+      ln -s ${pkgs.cntk}/lib $out/${python.sitePackages}/cntk/libs
+      # It's not installed for some reason.
+      cp cntk/cntk_py.py $out/${python.sitePackages}/cntk
+    '';
+  };
+
   celery = buildPythonPackage rec {
     name = "celery-${version}";
     version = "4.0.2";
@@ -2909,6 +2936,8 @@ in {
 
   colorama = callPackage ../development/python-modules/colorama { };
 
+  colorlover = callPackage ../development/python-modules/colorlover { };
+
   CommonMark = buildPythonPackage rec {
     name = "CommonMark-${version}";
     version = "0.6.3";
@@ -6648,14 +6677,15 @@ in {
     };
   };
 
-  python-mapnik = buildPythonPackage {
-    name = "python-mapnik-git-2016-08-30";
+  python-mapnik = buildPythonPackage rec {
+    name = "python-mapnik-${version}";
+    version = "3.0.13";
 
     src = pkgs.fetchFromGitHub {
       owner = "mapnik";
       repo = "python-mapnik";
-      rev = "541fd962d4fc99d50ec472af6ddccfdbf98cff37";
-      sha256 = "1d93qjnzggdpbhnmxlmk5jh0zd2jnpfl4n4aip5ypd39ilqibhf3";
+      rev = "v${version}";
+      sha256 = "0biw9bfkbsgfyjihyvkj4abx9s9r3h81rk6dc1y32022rypsqhkp";
     };
 
     disabled = isPyPy;
@@ -8286,14 +8316,14 @@ in {
 
   django_tagging = callPackage ../development/python-modules/django_tagging { };
 
-  django_tagging_0_3 = self.django_tagging.overrideAttrs (attrs: rec {
-    name = "django-tagging-0.3.6";
+  django_tagging_0_4_3 = self.django_tagging.overrideAttrs (attrs: rec {
+    name = "django-tagging-0.4.3";
 
     src = pkgs.fetchurl {
       url = "mirror://pypi/d/django-tagging/${name}.tar.gz";
-      sha256 = "03zlbq13rydfh28wh0jk3x3cjk9x6jjmqnx1i3ngjmfwbxf8x6j1";
+      sha256 = "0617azpmp6jpg3d88v2ir97qrc9aqcs2s9gyvv9bgf2cp55khxhs";
     };
-    propagatedBuildInputs = with self; [ django ];
+    propagatedBuildInputs = with self; [ django_1_8 ];
   });
 
   django_classytags = buildPythonPackage rec {
@@ -11127,14 +11157,12 @@ in {
     };
   });
 
-  libgpuarray-cuda = callPackage ../development/python-modules/libgpuarray/cuda/default.nix rec {
-    inherit (self) numpy scipy;
-    inherit (pkgs.linuxPackages) nvidia_x11;
-    cudatoolkit = pkgs.cudatoolkit75;
-    clblas = pkgs.clblas-cuda;
+  libgpuarray = callPackage ../development/python-modules/libgpuarray {
+    clblas = pkgs.clblas.override { boost = self.boost; };
+    cudaSupport = pkgs.config.cudaSupport or false;
   };
 
-  libnacl = callPackage ../development/python-modules/libnacl/default.nix {
+  libnacl = callPackage ../development/python-modules/libnacl {
     inherit (pkgs) libsodium;
   };
 
@@ -19833,24 +19861,20 @@ in {
 
   stevedore = callPackage ../development/python-modules/stevedore {};
 
-  Theano = self.TheanoWithoutCuda;
+  Theano = callPackage ../development/python-modules/Theano rec {
+    cudaSupport = pkgs.config.cudaSupport or false;
+    cudnnSupport = cudaSupport;
+  };
 
-  TheanoWithoutCuda = callPackage ../development/python-modules/Theano/theano-without-cuda { };
+  TheanoWithoutCuda = self.Theano.override {
+    cudaSupport = true;
+    cudnnSupport = true;
+  };
 
-  TheanoWithCuda = callPackage ../development/python-modules/Theano/theano-with-cuda (
-  let
-    boost = pkgs.boost159.override {
-      inherit (self) python numpy scipy;
-    };
-  in rec {
-    cudatoolkit = pkgs.cudatoolkit75;
-    cudnn = pkgs.cudnn5_cudatoolkit75;
-    inherit (self) numpy scipy;
-    pycuda = self.pycuda.override { inherit boost; };
-    libgpuarray = self.libgpuarray-cuda.override {
-      clblas = pkgs.clblas-cuda.override { inherit boost; };
-    };
-  });
+  TheanoWithCuda = self.Theano.override {
+    cudaSupport = false;
+    cudnnSupport = false;
+  };
 
   tidylib = buildPythonPackage rec {
     version = "0.2.4";
@@ -22250,11 +22274,11 @@ EOF
   };
 
   waitress = buildPythonPackage rec {
-    name = "waitress-0.8.9";
+    name = "waitress-1.0.2";
 
     src = pkgs.fetchurl {
       url = "mirror://pypi/w/waitress/${name}.tar.gz";
-      sha256 = "826527dc9d334ed4ed76cdae672fdcbbccf614186657db71679ab58df869458a";
+      sha256 = "0pw6yyxi348r2xpq3ykqnf7gwi881azv2422d2ixb0xi5jws2ky7";
     };
 
     doCheck = false;
@@ -22265,6 +22289,8 @@ EOF
     };
   };
 
+  waitress-django = callPackage ../development/python-modules/waitress-django { };
+
   webassets = buildPythonPackage rec {
     name = "webassets-${version}";
     version = "0.12.1";
@@ -23457,7 +23483,7 @@ EOF
 
     src = pkgs.fetchurl {
       url = "mirror://pypi/w/whisper/${name}.tar.gz";
-      sha256 = "1chkphxwnwvy2cs7jc2h2i0lqqvi9jx6vqj3ly88lwk7m35r4ss2";
+      sha256 = "1v1bi3fl1i6p4z4ki692bykrkw6907dn3mfq0151f70lvi3zpns3";
     };
 
     # error: invalid command 'test'
@@ -23524,7 +23550,7 @@ EOF
 
     src = pkgs.fetchurl {
       url = "mirror://pypi/c/carbon/${name}.tar.gz";
-      sha256 = "f01db6d37726c6fc0a8aaa66a7bf14436b0dd0d62ef3c20ecb31605a4d365d2e";
+      sha256 = "142smpmgbnjinvfb6s4ijazish4vfgzyd8zcmdkh55y051fkixkn";
     };
 
     propagatedBuildInputs = with self; [ whisper txamqp zope_interface twisted ];
@@ -23739,10 +23765,13 @@ EOF
 
     src = pkgs.fetchurl rec {
       url = "mirror://pypi/g/graphite-web/${name}.tar.gz";
-      sha256 = "1c0kclbv8shv9nvjx19wqm4asia58s3qmd9fapchc6y9fjpjax6q";
+      sha256 = "0q8bwlj75jqyzmazfsi5sa26xl58ssa8wdxm2l4j0jqyn8xpfnmc";
     };
 
-    propagatedBuildInputs = with self; [ django django_tagging_0_3 whisper pycairo ldap memcached pytz ];
+    propagatedBuildInputs = with self; [
+      django_1_8 django_tagging_0_4_3 whisper pycairo cairocffi
+      ldap memcached pytz urllib3 scandir
+    ];
 
     postInstall = ''
       wrapProgram $out/bin/run-graphite-devel-server.py \
@@ -23750,10 +23779,20 @@ EOF
     '';
 
     preConfigure = ''
-      substituteInPlace webapp/graphite/thirdparty/pytz/__init__.py --replace '/usr/share/zoneinfo' '/etc/zoneinfo'
-      substituteInPlace webapp/graphite/settings.py --replace "join(WEBAPP_DIR, 'content')" "join('$out', 'webapp', 'content')"
-      cp webapp/graphite/manage.py bin/manage-graphite.py
-      substituteInPlace bin/manage-graphite.py --replace 'settings' 'graphite.settings'
+      # graphite is configured by storing a local_settings.py file inside the
+      # graphite python package. Since that package is stored in the immutable
+      # Nix store we can't modify it. So how do we configure graphite?
+      #
+      # First of all we rename "graphite.local_settings" to
+      # "graphite_local_settings" so that the settings are not looked up in the
+      # graphite package anymore. Secondly we place a directory containing a
+      # graphite_local_settings.py on the PYTHONPATH in the graphite module
+      # <nixpkgs/nixos/modules/services/monitoring/graphite.nix>.
+      substituteInPlace webapp/graphite/settings.py \
+        --replace "graphite.local_settings" " graphite_local_settings"
+
+      substituteInPlace webapp/graphite/settings.py \
+        --replace "join(WEBAPP_DIR, 'content')" "join('$out', 'webapp', 'content')"
     '';
 
     # error: invalid command 'test'
@@ -25963,14 +26002,20 @@ EOF
 
   tensorflow-tensorboard = callPackage ../development/python-modules/tensorflow-tensorboard { };
 
-  tensorflow = self.tensorflowWithoutCuda;
+  tensorflow = callPackage ../development/python-modules/tensorflow rec {
+    bazel = pkgs.bazel_0_4;
+    cudaSupport = pkgs.config.cudaSupport or false;
+    inherit (pkgs.linuxPackages) nvidia_x11;
+    cudatoolkit = pkgs.cudatoolkit8;
+    cudnn = pkgs.cudnn6_cudatoolkit8;
+  };
 
-  tensorflowWithoutCuda = callPackage ../development/python-modules/tensorflow { };
+  tensorflowWithoutCuda = self.tensorflow.override {
+    cudaSupport = false;
+  };
 
-  tensorflowWithCuda = callPackage ../development/python-modules/tensorflow {
+  tensorflowWithCuda = self.tensorflow.override {
     cudaSupport = true;
-    cudatoolkit = pkgs.cudatoolkit8;
-    cudnn = pkgs.cudnn60_cudatoolkit80;
   };
 
   tflearn = buildPythonPackage rec {
@@ -26486,6 +26531,8 @@ EOF
 
   stripe = callPackage ../development/python-modules/stripe { };
 
+  twilio = callPackage ../development/python-modules/twilio { };
+
   uranium = callPackage ../development/python-modules/uranium { };
 
   vine = callPackage ../development/python-modules/vine { };