about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/audio/opusfile/default.nix4
-rw-r--r--pkgs/applications/audio/quodlibet/default.nix4
-rw-r--r--pkgs/applications/misc/alacritty/default.nix22
-rw-r--r--pkgs/applications/misc/electron-cash/default.nix22
-rw-r--r--pkgs/applications/misc/gnuradio/limesdr.nix38
-rw-r--r--pkgs/applications/misc/mwic/default.nix4
-rw-r--r--pkgs/applications/networking/browsers/firefox/packages.nix6
-rw-r--r--pkgs/applications/networking/instant-messengers/jackline/default.nix10
-rw-r--r--pkgs/applications/networking/instant-messengers/jackline/tls-0.9.0.patch29
-rw-r--r--pkgs/applications/networking/instant-messengers/teamspeak/server.nix8
-rw-r--r--pkgs/applications/office/treesheets/default.nix8
-rw-r--r--pkgs/applications/version-management/git-and-tools/default.nix1
-rw-r--r--pkgs/applications/version-management/git-and-tools/git/default.nix9
-rw-r--r--pkgs/applications/version-management/git-and-tools/pre-commit/default.nix4
-rw-r--r--pkgs/applications/version-management/git-and-tools/tig/default.nix4
-rw-r--r--pkgs/applications/video/obs-studio/default.nix8
-rw-r--r--pkgs/applications/video/obs-studio/find-xcb.patch31
-rw-r--r--pkgs/applications/video/smplayer/default.nix4
-rwxr-xr-xpkgs/build-support/rust/cargo-vendor-normalise.py41
-rw-r--r--pkgs/build-support/rust/default.nix18
-rwxr-xr-xpkgs/build-support/rust/fetchcargo-default-config.toml7
-rw-r--r--pkgs/build-support/rust/fetchcargo.nix35
-rw-r--r--pkgs/build-support/setup-hooks/patch-shebangs.sh55
-rw-r--r--pkgs/build-support/vm/default.nix16
-rw-r--r--pkgs/data/fonts/ultimate-oldschool-pc-font-pack/default.nix31
-rw-r--r--pkgs/data/misc/iana-etc/default.nix5
-rw-r--r--pkgs/development/compilers/llvm/3.5/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/3.7/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/3.8/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/3.9/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/5/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/5/llvm.nix4
-rw-r--r--pkgs/development/compilers/llvm/6/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/7/clang/default.nix106
-rw-r--r--pkgs/development/compilers/llvm/7/clang/purity.patch30
-rw-r--r--pkgs/development/compilers/llvm/7/compiler-rt-codesign.patch33
-rw-r--r--pkgs/development/compilers/llvm/7/compiler-rt.nix37
-rw-r--r--pkgs/development/compilers/llvm/7/default.nix92
-rw-r--r--pkgs/development/compilers/llvm/7/libc++/default.nix50
-rw-r--r--pkgs/development/compilers/llvm/7/libc++/setup-hook.sh6
-rw-r--r--pkgs/development/compilers/llvm/7/libc++abi.nix49
-rw-r--r--pkgs/development/compilers/llvm/7/lld.nix32
-rw-r--r--pkgs/development/compilers/llvm/7/lldb.nix56
-rw-r--r--pkgs/development/compilers/llvm/7/llvm-outputs.patch26
-rw-r--r--pkgs/development/compilers/llvm/7/llvm.nix174
-rw-r--r--pkgs/development/compilers/llvm/7/openmp.nix25
-rw-r--r--pkgs/development/compilers/llvm/7/sanitizers-nongnu.patch413
-rw-r--r--pkgs/development/compilers/rust/bootstrap.nix14
-rw-r--r--pkgs/development/compilers/rust/cargo.nix3
-rw-r--r--pkgs/development/compilers/rust/default.nix6
-rw-r--r--pkgs/development/compilers/rust/rustc.nix5
-rw-r--r--pkgs/development/compilers/vala/default.nix12
-rw-r--r--pkgs/development/haskell-modules/configuration-common.nix30
-rw-r--r--pkgs/development/haskell-modules/configuration-hackage2nix.yaml1
-rw-r--r--pkgs/development/haskell-modules/configuration-nix.nix3
-rw-r--r--pkgs/development/interpreters/erlang/R18.nix12
-rw-r--r--pkgs/development/interpreters/perl/default.nix3
-rw-r--r--pkgs/development/interpreters/php/default.nix1
-rw-r--r--pkgs/development/interpreters/python/cpython/2.7/boot.nix9
-rw-r--r--pkgs/development/interpreters/wasm-gc/default.nix25
-rw-r--r--pkgs/development/interpreters/wasm-gc/fix-build.patch34
-rw-r--r--pkgs/development/libraries/boehm-gc/default.nix4
-rw-r--r--pkgs/development/libraries/cyrus-sasl/default.nix16
-rw-r--r--pkgs/development/libraries/ffmpeg/generic.nix10
-rw-r--r--pkgs/development/libraries/gdbm/default.nix6
-rw-r--r--pkgs/development/libraries/gettext/default.nix1
-rw-r--r--pkgs/development/libraries/gpgme/default.nix4
-rw-r--r--pkgs/development/libraries/libatomic_ops/default.nix4
-rw-r--r--pkgs/development/libraries/libdrm/default.nix4
-rw-r--r--pkgs/development/libraries/libgsf/default.nix4
-rw-r--r--pkgs/development/libraries/libinput/default.nix10
-rw-r--r--pkgs/development/libraries/libinput/udev-absolute-path.patch2
-rw-r--r--pkgs/development/libraries/libmediainfo/default.nix4
-rw-r--r--pkgs/development/libraries/libsndfile/default.nix5
-rw-r--r--pkgs/development/libraries/libunistring/default.nix14
-rw-r--r--pkgs/development/libraries/libuv/default.nix2
-rw-r--r--pkgs/development/libraries/mesa-darwin/default.nix73
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/0003-mesa-fix-per-level-max-texture-size-error-checking.patch147
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/0008-glsl-initialise-const-force-glsl-extension-warning-i.patch33
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/0009-mesa-test-for-GL_EXT_framebuffer_sRGB-in-glPopAttrib.patch28
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/0011-Apple-glFlush-is-not-needed-with-CGLFlushDrawable.patch29
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/0012-glapi-Avoid-heap-corruption-in-_glapi_table.patch28
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/0013-darwin-Fix-test-for-kCGLPFAOpenGLProfile-support-at-.patch40
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/1001-appleglx-Improve-error-reporting-if-CGLChoosePixelFo.patch30
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/1002-darwin-Write-errors-in-choosing-the-pixel-format-to-.patch55
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/1003-darwin-Guard-Core-Profile-usage-behind-a-testing-env.patch69
-rw-r--r--pkgs/development/libraries/mesa-darwin/patches/patch-src-mapi-vgapi-Makefile.diff11
-rw-r--r--pkgs/development/libraries/mesa/darwin-clock-gettime.patch76
-rw-r--r--pkgs/development/libraries/mesa/default.nix84
-rw-r--r--pkgs/development/libraries/mesa/missing-includes.patch10
-rw-r--r--pkgs/development/libraries/mono-addins/default.nix4
-rw-r--r--pkgs/development/libraries/qt-4.x/4.8/default.nix1
-rw-r--r--pkgs/development/libraries/qt-4.x/4.8/kill-legacy-darwin-apis.patch330
-rw-r--r--pkgs/development/libraries/science/math/openblas/default.nix21
-rw-r--r--pkgs/development/ocaml-modules/doc-ock-html/default.nix27
-rw-r--r--pkgs/development/ocaml-modules/doc-ock-xml/default.nix27
-rw-r--r--pkgs/development/ocaml-modules/doc-ock/default.nix27
-rw-r--r--pkgs/development/ocaml-modules/erm_xml/default.nix12
-rw-r--r--pkgs/development/ocaml-modules/erm_xmpp/0.3.nix29
-rw-r--r--pkgs/development/ocaml-modules/erm_xmpp/default.nix41
-rw-r--r--pkgs/development/ocaml-modules/odoc/default.nix28
-rw-r--r--pkgs/development/python-modules/autobahn/default.nix2
-rw-r--r--pkgs/development/python-modules/flask-assets/default.nix4
-rw-r--r--pkgs/development/python-modules/pyftgl/default.nix18
-rw-r--r--pkgs/development/python-modules/pyjet/default.nix21
-rw-r--r--pkgs/development/python-modules/pyopenssl/default.nix45
-rw-r--r--pkgs/development/python-modules/pytest/default.nix8
-rw-r--r--pkgs/development/python-modules/pytorch/default.nix18
-rw-r--r--pkgs/development/ruby-modules/solargraph/Gemfile.lock2
-rw-r--r--pkgs/development/ruby-modules/solargraph/gemset.nix4
-rw-r--r--pkgs/development/tools/analysis/valgrind/default.nix1
-rw-r--r--pkgs/development/tools/build-managers/ninja/default.nix12
-rw-r--r--pkgs/development/tools/documentation/gtk-doc/default.nix7
-rw-r--r--pkgs/development/tools/misc/ycmd/default.nix6
-rw-r--r--pkgs/misc/libcardiacarrest/default.nix6
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/CF/add-cfmachport.patch22
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/CF/cf-bridging.patch39
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/CF/default.nix51
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/CF/remove-xpc.patch17
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix4
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/default.nix3
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/libsecurity_generic/default.nix1
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/libsecurity_keychain/default.nix4
-rw-r--r--pkgs/os-specific/darwin/cctools/port.nix4
-rw-r--r--pkgs/os-specific/darwin/cf-private/default.nix74
-rw-r--r--pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix23
-rw-r--r--pkgs/os-specific/darwin/swift-corelibs/default.nix8
-rw-r--r--pkgs/os-specific/linux/iproute/default.nix4
-rw-r--r--pkgs/os-specific/linux/iwd/default.nix8
-rw-r--r--pkgs/os-specific/linux/kernel-headers/default.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-rpi.nix18
-rw-r--r--pkgs/os-specific/linux/kernel/linux-testing.nix6
-rw-r--r--pkgs/os-specific/linux/nvidia-x11/default.nix12
-rw-r--r--pkgs/os-specific/linux/nvidia-x11/drm_mode_connector.patch24
-rw-r--r--pkgs/os-specific/linux/systemd/default.nix4
-rw-r--r--pkgs/servers/nosql/influxdb/default.nix6
-rw-r--r--pkgs/servers/nosql/influxdb/deps-1.6.3.nix444
-rw-r--r--pkgs/servers/sql/postgresql/pgtap/default.nix4
-rw-r--r--pkgs/servers/x11/xorg/default.nix18
-rw-r--r--pkgs/servers/x11/xorg/extra.list4
-rw-r--r--pkgs/servers/x11/xorg/overrides.nix4
-rw-r--r--pkgs/servers/x11/xorg/tarballs-7.7.list2
-rw-r--r--pkgs/stdenv/darwin/default.nix48
-rw-r--r--pkgs/stdenv/darwin/make-bootstrap-tools.nix13
-rw-r--r--pkgs/stdenv/generic/make-derivation.nix2
-rw-r--r--pkgs/stdenv/generic/setup.sh13
-rw-r--r--pkgs/test/default.nix4
-rw-r--r--pkgs/test/patch-shebangs/default.nix26
-rw-r--r--pkgs/tools/X11/xloadimage/default.nix88
-rw-r--r--pkgs/tools/X11/xsecurelock/default.nix8
-rw-r--r--pkgs/tools/filesystems/e2fsprogs/default.nix12
-rw-r--r--pkgs/tools/misc/agedu/default.nix6
-rw-r--r--pkgs/tools/misc/bat/default.nix6
-rw-r--r--pkgs/tools/misc/findutils/default.nix9
-rw-r--r--pkgs/tools/misc/findutils/disable-getdtablesize-test.patch25
-rw-r--r--pkgs/tools/misc/hdf4/default.nix17
-rw-r--r--pkgs/tools/misc/parallel/default.nix6
-rw-r--r--pkgs/tools/networking/curl/default.nix4
-rw-r--r--pkgs/tools/networking/dhcpcd/default.nix10
-rw-r--r--pkgs/tools/networking/network-manager/fortisslvpn/default.nix1
-rw-r--r--pkgs/tools/networking/network-manager/iodine/default.nix1
-rw-r--r--pkgs/tools/networking/network-manager/l2tp/default.nix1
-rw-r--r--pkgs/tools/networking/network-manager/openconnect/default.nix1
-rw-r--r--pkgs/tools/networking/network-manager/openvpn/default.nix1
-rw-r--r--pkgs/tools/networking/network-manager/vpnc/default.nix1
-rw-r--r--pkgs/tools/package-management/packagekit/default.nix4
-rw-r--r--pkgs/tools/security/qesteidutil/default.nix9
-rw-r--r--pkgs/tools/security/rhash/default.nix6
-rw-r--r--pkgs/tools/security/tor/default.nix9
-rw-r--r--pkgs/tools/typesetting/tex/texlive/bin.nix17
-rw-r--r--pkgs/top-level/all-packages.nix50
-rw-r--r--pkgs/top-level/darwin-packages.nix10
-rw-r--r--pkgs/top-level/ocaml-packages.nix10
-rw-r--r--pkgs/top-level/perl-packages.nix199
-rw-r--r--pkgs/top-level/python-packages.nix2
-rw-r--r--pkgs/top-level/release.nix3
-rw-r--r--pkgs/top-level/stage.nix2
177 files changed, 3366 insertions, 1301 deletions
diff --git a/pkgs/applications/audio/opusfile/default.nix b/pkgs/applications/audio/opusfile/default.nix
index d864d5972bce..993e3c4fe8c5 100644
--- a/pkgs/applications/audio/opusfile/default.nix
+++ b/pkgs/applications/audio/opusfile/default.nix
@@ -1,10 +1,10 @@
 { stdenv, fetchurl, pkgconfig, openssl, libogg, libopus }:
 
 stdenv.mkDerivation rec {
-  name = "opusfile-0.10";
+  name = "opusfile-0.11";
   src = fetchurl {
     url = "http://downloads.xiph.org/releases/opus/${name}.tar.gz";
-    sha256 = "0bs1376sd131qdh7198jp64vv5d17az5wyy4y7srrvw7p8k3bq28";
+    sha256 = "1gq3aszzl5glgbajw5p1f5a1kdyf23w5vjdmwwrk246syin9pkkl";
   };
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/applications/audio/quodlibet/default.nix b/pkgs/applications/audio/quodlibet/default.nix
index f1a22bd839a0..baf49ff78e59 100644
--- a/pkgs/applications/audio/quodlibet/default.nix
+++ b/pkgs/applications/audio/quodlibet/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, python3, wrapGAppsHook, gettext, intltool, libsoup, gnome3, gtk3, gdk_pixbuf,
-  tag ? "", xvfb_run, dbus, glibcLocales, glib, gobjectIntrospection,
+  tag ? "", xvfb_run, dbus, glibcLocales, glib, glib-networking, gobjectIntrospection,
   gst_all_1, withGstPlugins ? true,
   xineBackend ? false, xineLib,
   withDbusPython ? false, withPyInotify ? false, withMusicBrainzNgs ? false, withPahoMqtt ? false,
@@ -24,7 +24,7 @@ python3.pkgs.buildPythonApplication rec {
 
   checkInputs = with python3.pkgs; [ pytest pytest_xdist pyflakes pycodestyle polib xvfb_run dbus.daemon glibcLocales ];
 
-  buildInputs = [ gnome3.defaultIconTheme libsoup glib gtk3 webkitgtk gdk_pixbuf keybinder3 gtksourceview libmodplug libappindicator-gtk3 kakasi gobjectIntrospection ]
+  buildInputs = [ gnome3.defaultIconTheme libsoup glib glib-networking gtk3 webkitgtk gdk_pixbuf keybinder3 gtksourceview libmodplug libappindicator-gtk3 kakasi gobjectIntrospection ]
     ++ (if xineBackend then [ xineLib ] else with gst_all_1;
     [ gstreamer gst-plugins-base ] ++ optionals withGstPlugins [ gst-plugins-good gst-plugins-ugly gst-plugins-bad ]);
 
diff --git a/pkgs/applications/misc/alacritty/default.nix b/pkgs/applications/misc/alacritty/default.nix
index 4544ed1fba3b..8be3db97c2b0 100644
--- a/pkgs/applications/misc/alacritty/default.nix
+++ b/pkgs/applications/misc/alacritty/default.nix
@@ -1,6 +1,6 @@
 { stdenv,
   lib,
-  fetchgit,
+  fetchFromGitHub,
   rustPlatform,
   cmake,
   makeWrapper,
@@ -50,19 +50,17 @@ let
     OpenGL
   ];
 in buildRustPackage rec {
-  name = "alacritty-unstable-${version}";
-  version = "2018-08-30";
-
-  # At the moment we cannot handle git dependencies in buildRustPackage.
-  # This fork only replaces rust-fontconfig/libfontconfig with a git submodules.
-  src = fetchgit {
-    url = https://github.com/Mic92/alacritty.git;
-    rev = "rev-${version}";
-    sha256 = "0izvg7dwwb763jc6gnmn47i5zrkxvmh3vssn6vzrrmqhd4j3msmf";
-    fetchSubmodules = true;
+  name = "alacritty-${version}";
+  version = "0.2.0";
+
+  src = fetchFromGitHub {
+    owner = "jwilm";
+    repo = "alacritty";
+    rev = "v${version}";
+    sha256 = "11z7diji64x6n3m5m2d0a9215aajg7mpklflvpwrglmghnvi74y6";
   };
 
-  cargoSha256 = "1ijgkwv9ij4haig1h6n2b9xbhp5vahy9vp1sx72wxaaj9476msjx";
+  cargoSha256 = "0ms0248bb2lgbzcqks6i0qhn1gaiim3jf1kl17qw52c8an3rc652";
 
   nativeBuildInputs = [
     cmake
diff --git a/pkgs/applications/misc/electron-cash/default.nix b/pkgs/applications/misc/electron-cash/default.nix
index 891222a0f10e..66a423238b34 100644
--- a/pkgs/applications/misc/electron-cash/default.nix
+++ b/pkgs/applications/misc/electron-cash/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, python3Packages }:
+{ stdenv, fetchurl, python3Packages, qtbase, makeWrapper, lib }:
 
 let
 
@@ -7,14 +7,14 @@ let
 in
 
 python3Packages.buildPythonApplication rec {
-  version = "3.1.6";
+  version = "3.3.1";
   name = "electron-cash-${version}";
 
   src = fetchurl {
     url = "https://electroncash.org/downloads/${version}/win-linux/ElectronCash-${version}.tar.gz";
     # Verified using official SHA-1 and signature from
     # https://github.com/fyookball/keys-n-hashes
-    sha256 = "062k5iw0jcp10zxrffvgiyfg51c5xzs7gmm638icx01yy67d58dm";
+    sha256 = "1jdy89rfdwc2jadx3rqj5yvynpcn90cx6482ax9f1cj9gfxp9j2b";
   };
 
   propagatedBuildInputs = with python3Packages; [
@@ -36,13 +36,14 @@ python3Packages.buildPythonApplication rec {
     trezor
   ];
 
+  nativeBuildInputs = [ makeWrapper ];
+
   postPatch = ''
     # Remove pyqt5 check
     sed -i '/pyqt5/d' setup.py
   '';
 
   preBuild = ''
-    sed -i 's,usr_share = .*,usr_share = "'$out'/share",g' setup.py
     pyrcc5 icons.qrc -o gui/qt/icons_rc.py
     # Recording the creation timestamps introduces indeterminism to the build
     sed -i '/Created: .*/d' gui/qt/icons_rc.py
@@ -51,18 +52,21 @@ python3Packages.buildPythonApplication rec {
   doCheck = false;
 
   postInstall = ''
-    # Despite setting usr_share above, these files are installed under
-    # $out/nix ...
-    mv $out/${python.sitePackages}/nix/store"/"*/share $out
-    rm -rf $out/${python.sitePackages}/nix
+    # These files are installed under $out/homeless-shelter ...
+    mv $out/${python.sitePackages}/homeless-shelter/.local/share $out
+    rm -rf $out/${python.sitePackages}/homeless-shelter
 
     substituteInPlace $out/share/applications/electron-cash.desktop \
       --replace "Exec=electron-cash %u" "Exec=$out/bin/electron-cash %u"
+
+    # Please remove this when #44047 is fixed
+    wrapProgram $out/bin/electron-cash \
+      --prefix QT_PLUGIN_PATH : ${qtbase}/lib/qt-5.${lib.versions.minor qtbase.version}/plugins
   '';
 
   doInstallCheck = true;
   installCheckPhase = ''
-    $out/bin/electrum help >/dev/null
+    $out/bin/electron-cash help >/dev/null
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/misc/gnuradio/limesdr.nix b/pkgs/applications/misc/gnuradio/limesdr.nix
new file mode 100644
index 000000000000..535dbfa3c53d
--- /dev/null
+++ b/pkgs/applications/misc/gnuradio/limesdr.nix
@@ -0,0 +1,38 @@
+{ stdenv, fetchFromGitHub, cmake, boost, gnuradio
+, pythonSupport ? true, python, swig, limesuite
+} :
+
+assert pythonSupport -> python != null && swig != null;
+
+let
+  version = "1.0.0-RC";
+
+in stdenv.mkDerivation rec {
+  name = "gnuradio-limesdr-${version}";
+
+  src = fetchFromGitHub {
+    owner = "myriadrf";
+    repo = "gr-limesdr";
+    rev = "v${version}";
+    sha256 = "0b34mg9nfar2gcir98004ixrxmxi8p3p2hrvvi1razd869x2a0lf";
+  };
+
+  nativeBuildInputs = [
+    cmake
+  ] ++ stdenv.lib.optionals pythonSupport [ swig ];
+
+  buildInputs = [
+    boost gnuradio limesuite
+  ] ++ stdenv.lib.optionals pythonSupport [ python ];
+
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    description = "Gnuradio source and sink blocks for LimeSDR";
+    homepage = https://wiki.myriadrf.org/Gr-limesdr_Plugin_for_GNURadio;
+    license = licenses.mit;
+    platforms = platforms.linux ++ platforms.darwin;
+    maintainers = [ maintainers.markuskowa ];
+  };
+}
diff --git a/pkgs/applications/misc/mwic/default.nix b/pkgs/applications/misc/mwic/default.nix
index 67e6ed3fa9ce..15904ab7c0ab 100644
--- a/pkgs/applications/misc/mwic/default.nix
+++ b/pkgs/applications/misc/mwic/default.nix
@@ -1,12 +1,12 @@
 { stdenv, fetchurl, pythonPackages }:
 
 stdenv.mkDerivation rec {
-  version = "0.7.5";
+  version = "0.7.6";
   name = "mwic-${version}";
 
   src = fetchurl {
     url = "https://github.com/jwilk/mwic/releases/download/${version}/${name}.tar.gz";
-    sha256 = "1b4fz9vs0aihg9nj9aj6d2jmykpa9nxi9rvz06v50wwk515plpmc";
+    sha256 = "0dl56979i54hrmz5l27c4q1f7jd1bpkmi7sm86946dagi4l1ns3i";
   };
 
   makeFlags=["PREFIX=\${out}"];
diff --git a/pkgs/applications/networking/browsers/firefox/packages.nix b/pkgs/applications/networking/browsers/firefox/packages.nix
index 11222cc65ba3..e5095323cc43 100644
--- a/pkgs/applications/networking/browsers/firefox/packages.nix
+++ b/pkgs/applications/networking/browsers/firefox/packages.nix
@@ -28,6 +28,12 @@ rec {
 
     patches = nixpkgsPatches ++ [
       ./no-buildconfig.patch
+      # fix build with rust >= 1.29 and firefox < 63
+      # https://bugzilla.mozilla.org/show_bug.cgi?id=1479540
+      (fetchpatch {
+        url = "https://github.com/mozilla/gecko-dev/commit/eec0d4f8714e6671402d41632232ef57348e65c4.patch";
+        sha256 = "1cjaqx811bcnp8b6z16q25csaclaic3b11q45ck02srd99n8qp0j";
+      })
     ];
 
     extraNativeBuildInputs = [ python3 ];
diff --git a/pkgs/applications/networking/instant-messengers/jackline/default.nix b/pkgs/applications/networking/instant-messengers/jackline/default.nix
index 9f85c940c1bc..689445d7dcb8 100644
--- a/pkgs/applications/networking/instant-messengers/jackline/default.nix
+++ b/pkgs/applications/networking/instant-messengers/jackline/default.nix
@@ -3,21 +3,19 @@
 assert stdenv.lib.versionAtLeast ocamlPackages.ocaml.version "4.02.2";
 
 stdenv.mkDerivation rec {
-  version = "2017-12-24";
+  version = "2018-05-11";
   name = "jackline-${version}";
 
   src = fetchFromGitHub {
     owner  = "hannesm";
     repo   = "jackline";
-    rev    = "8678e8a1a06e641218a31ae25150040202f89289";
-    sha256 = "05z9kvd7gwr59ic7hnmbayhwyyqd41xxz01cvdlcgplk3z7zlwg5";
+    rev    = "bc36b1c8b80fee6baba4f91011cd01b82a06e8eb";
+    sha256 = "1xx2yx8a95m84sa1bkxi3rlx7pd39zkqwk3znj0zzz3cni6apfrz";
   };
 
-  patches = [ ./tls-0.9.0.patch ];
-
   buildInputs = with ocamlPackages; [
                   ocaml ocamlbuild findlib topkg ppx_sexp_conv
-                  erm_xmpp_0_3 tls nocrypto x509 ocaml_lwt otr astring
+                  erm_xmpp tls nocrypto x509 ocaml_lwt otr astring
                   ptime notty sexplib hex uutf
                 ];
 
diff --git a/pkgs/applications/networking/instant-messengers/jackline/tls-0.9.0.patch b/pkgs/applications/networking/instant-messengers/jackline/tls-0.9.0.patch
deleted file mode 100644
index 38f38a03a802..000000000000
--- a/pkgs/applications/networking/instant-messengers/jackline/tls-0.9.0.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-diff --git a/cli/cli_config.ml b/cli/cli_config.ml
-index 991ee77..59a0edb 100644
---- a/cli/cli_config.ml
-+++ b/cli/cli_config.ml
-@@ -207,7 +207,9 @@ let configure term () =
-     ask above "CA file: " (fun x -> x) (fun x -> if Sys.file_exists x then `Ok x else `Invalid) term >>= fun trust_anchor ->
-     Lwt_unix.access trust_anchor [ Unix.F_OK ; Unix.R_OK ] >>= fun () ->
-     X509_lwt.certs_of_pem trust_anchor >>= fun tas ->
--    (match X509.Validation.valid_cas ~time:(Unix.time ()) tas with
-+    let time = match Ptime.of_float_s (Unix.time ())
-+      with Some time -> time | None -> assert false in
-+    (match X509.Validation.valid_cas ~time tas with
-      | [] -> Lwt.fail (Invalid_argument "trust anchor file is empty!")
-      | _ -> Lwt.return (`Trust_anchor trust_anchor))
-   | Some fp -> Lwt.return (`Fingerprint fp) ) >>= fun authenticator ->
-diff --git a/cli/cli_state.ml b/cli/cli_state.ml
-index d5db502..91540c9 100644
---- a/cli/cli_state.ml
-+++ b/cli/cli_state.ml
-@@ -262,7 +262,8 @@ module Connect = struct
-           (match config.Xconfig.authenticator with
-            | `Trust_anchor x -> X509_lwt.authenticator (`Ca_file x)
-            | `Fingerprint fp ->
--             let time = Unix.gettimeofday () in
-+             let time = match Ptime.of_float_s (Unix.gettimeofday ())
-+               with Some time -> time | None -> assert false in
-              let fp =
-                Nocrypto.Uncommon.Cs.of_hex
-                  (String.map (function ':' -> ' ' | x -> x) fp)
diff --git a/pkgs/applications/networking/instant-messengers/teamspeak/server.nix b/pkgs/applications/networking/instant-messengers/teamspeak/server.nix
index c86de07bc842..bd1346b12194 100644
--- a/pkgs/applications/networking/instant-messengers/teamspeak/server.nix
+++ b/pkgs/applications/networking/instant-messengers/teamspeak/server.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchurl, makeWrapper }:
 
 let
-  version = "3.0.13.6";
+  version = "3.3.0";
   arch = if stdenv.is64bit then "amd64" else "x86";
   libDir = if stdenv.is64bit then "lib64" else "lib";
 in
@@ -14,9 +14,9 @@ stdenv.mkDerivation {
       "http://dl.4players.de/ts/releases/${version}/teamspeak3-server_linux_${arch}-${version}.tar.bz2"
       "http://teamspeak.gameserver.gamed.de/ts3/releases/${version}/teamspeak3-server_linux_${arch}-${version}.tar.bz2"
     ];
-    sha256 = if stdenv.is64bit 
-      then "19ccd8db5427758d972a864b70d4a1263ebb9628fcc42c3de75ba87de105d179"
-      else "2f70b3e70a3d9bf86106fab67a938922c8d27fec24e66e229913f78a0791b967";
+    sha256 = if stdenv.is64bit
+      then "1jv5c1br3ypxz8px7fl5rg75j0kfdg8mqasdk2gka6yvgf7qc97i"
+      else "0m889xl9iz3fmq7wyjjn42swprpspagbkn52a82nzkhgvagd45bz";
   };
 
   buildInputs = [ makeWrapper ];
diff --git a/pkgs/applications/office/treesheets/default.nix b/pkgs/applications/office/treesheets/default.nix
index d8e6cdd86ea9..d0a4953c426b 100644
--- a/pkgs/applications/office/treesheets/default.nix
+++ b/pkgs/applications/office/treesheets/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   name    = "treesheets-${version}";
-  version = "2017-03-27";
+  version = "2018-08-18";
 
   src = fetchFromGitHub {
     owner  = "aardappel";
     repo   = "treesheets";
-    rev    = "1d1d6b214e3ae88445eb1ec0032d5fef14160f32";
-    sha256 = "0np91c4skq3yxq76c4zi33w73qb1w2nrcin490kkvrxk53jspklb";
+    rev    = "3af41d99c8f9f32603a36ab64af3560b6d61dd73";
+    sha256 = "147y8ggh3clwjgsi15z8i4jnzlkh8p17mmlg532jym53zzbcva65";
   };
 
   buildInputs = [ wxGTK makeWrapper ];
@@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
     '';
 
     homepage    = http://strlen.com/treesheets/;
-    maintainers = with maintainers; [ obadz ];
+    maintainers = with maintainers; [ obadz avery ];
     platforms   = platforms.linux;
     license     = licenses.zlib;
   };
diff --git a/pkgs/applications/version-management/git-and-tools/default.nix b/pkgs/applications/version-management/git-and-tools/default.nix
index 37745be5dc35..aa6073479668 100644
--- a/pkgs/applications/version-management/git-and-tools/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/default.nix
@@ -4,7 +4,6 @@
 args @ {config, lib, pkgs}: with args; with pkgs;
 let
   gitBase = callPackage ./git {
-    texinfo = texinfo5;
     svnSupport = false;         # for git-svn support
     guiSupport = false;         # requires tcl/tk
     sendEmailSupport = false;   # requires plenty of perl libraries
diff --git a/pkgs/applications/version-management/git-and-tools/git/default.nix b/pkgs/applications/version-management/git-and-tools/git/default.nix
index 6cc109c48c75..8bd6457a9e50 100644
--- a/pkgs/applications/version-management/git-and-tools/git/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/git/default.nix
@@ -20,7 +20,7 @@ assert sendEmailSupport -> perlSupport;
 assert svnSupport -> perlSupport;
 
 let
-  version = "2.18.0";
+  version = "2.19.0";
   svn = subversionClient.override { perlBindings = perlSupport; };
 in
 
@@ -29,7 +29,7 @@ stdenv.mkDerivation {
 
   src = fetchurl {
     url = "https://www.kernel.org/pub/software/scm/git/git-${version}.tar.xz";
-    sha256 = "14hfwfkrci829a9316hnvkglnqqw1p03cw9k56p4fcb078wbwh4b";
+    sha256 = "1x1y5z3awabmfg7hk6zb331jxngad4nal4507v96bnf0izsyy3qq";
   };
 
   outputs = [ "out" ] ++ stdenv.lib.optional perlSupport "gitweb";
@@ -283,7 +283,7 @@ EOF
 
     # XXX: I failed to understand why this one fails.
     # Could someone try to re-enable it on the next release ?
-    # Tested to fail: 2.18.0
+    # Tested to fail: 2.18.0 and 2.19.0
     disable_test t1700-split-index "null sha1"
 
     # Tested to fail: 2.18.0
@@ -292,6 +292,9 @@ EOF
 
     # Tested to fail: 2.18.0
     disable_test t9902-completion "sourcing the completion script clears cached --options"
+
+    # As of 2.19.0, t5562 refers to #!/usr/bin/perl
+    patchShebangs t/t5562/invoke-with-content-length.pl
   '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
     # Test fails (as of 2.17.0, musl 1.1.19)
     disable_test t3900-i18n-commit
diff --git a/pkgs/applications/version-management/git-and-tools/pre-commit/default.nix b/pkgs/applications/version-management/git-and-tools/pre-commit/default.nix
index bc36a8879f4d..331b020d8ca7 100644
--- a/pkgs/applications/version-management/git-and-tools/pre-commit/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/pre-commit/default.nix
@@ -1,11 +1,11 @@
 { stdenv, python3Packages }:
 with python3Packages; buildPythonApplication rec {
   pname = "pre_commit";
-  version = "1.11.0";
+  version = "1.11.1";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "03nxkma8qp5j2bg6ailclnyqfhakp8r8d1mn6zcnjw0ac5r9imc8";
+    sha256 = "1kjrq8z78b6aqhyyw07dlwf6cqls88kik6f5l07hs71fj5ddvs9w";
   };
 
   propagatedBuildInputs = [
diff --git a/pkgs/applications/version-management/git-and-tools/tig/default.nix b/pkgs/applications/version-management/git-and-tools/tig/default.nix
index 6d2753e45437..a407f6e7ab12 100644
--- a/pkgs/applications/version-management/git-and-tools/tig/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/tig/default.nix
@@ -31,6 +31,10 @@ stdenv.mkDerivation rec {
   installPhase = ''
     make install
     make install-doc
+
+    substituteInPlace contrib/tig-completion.zsh \
+      --replace 'e=$(dirname ''${funcsourcetrace[1]%:*})/tig-completion.bash' "e=$out/etc/bash_completion.d/tig-completion.bash"
+
     install -D contrib/tig-completion.bash $out/etc/bash_completion.d/tig-completion.bash
     install -D contrib/tig-completion.zsh $out/share/zsh/site-functions/_tig
     cp contrib/vim.tigrc $out/etc/
diff --git a/pkgs/applications/video/obs-studio/default.nix b/pkgs/applications/video/obs-studio/default.nix
index a07a15177d04..cacad5a3e629 100644
--- a/pkgs/applications/video/obs-studio/default.nix
+++ b/pkgs/applications/video/obs-studio/default.nix
@@ -18,6 +18,7 @@
 , makeWrapper
 , pkgconfig
 , vlc
+, mbedtls
 
 , alsaSupport ? false
 , alsaLib
@@ -29,17 +30,15 @@ let
   optional = stdenv.lib.optional;
 in stdenv.mkDerivation rec {
   name = "obs-studio-${version}";
-  version = "21.1.2";
+  version = "22.0.2";
 
   src = fetchFromGitHub {
     owner = "jp9000";
     repo = "obs-studio";
     rev = "${version}";
-    sha256 = "1gl6qibvckczk3yl44h3yshml6sn3izwn58qpxils5837rpkwlc5";
+    sha256 = "1bgp2lirpsbp54vvl3p345njlpgv0d78vac2aqwbl34wqx5sqdk0";
   };
 
-  patches = [ ./find-xcb.patch ];
-
   nativeBuildInputs = [ cmake
                         pkgconfig
                       ];
@@ -59,6 +58,7 @@ in stdenv.mkDerivation rec {
                   x264
                   vlc
                   makeWrapper
+                  mbedtls
                 ]
                 ++ optional alsaSupport alsaLib
                 ++ optional pulseaudioSupport libpulseaudio;
diff --git a/pkgs/applications/video/obs-studio/find-xcb.patch b/pkgs/applications/video/obs-studio/find-xcb.patch
deleted file mode 100644
index c45aba4ce2f0..000000000000
--- a/pkgs/applications/video/obs-studio/find-xcb.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-diff --git a/libobs/CMakeLists.txt b/libobs/CMakeLists.txt
-index cd2b80e1..7d829cdb 100644
---- a/libobs/CMakeLists.txt
-+++ b/libobs/CMakeLists.txt
-@@ -15,6 +15,7 @@ if(UNIX)
- 	find_package(DBus QUIET)
- 	if (NOT APPLE)
- 		find_package(X11_XCB REQUIRED)
-+		find_package(XCB REQUIRED)
- 	endif()
- else()
- 	set(HAVE_DBUS "0")
-@@ -161,12 +162,15 @@ elseif(UNIX)
- 	endif()
- 
- 	include_directories(
--		${X11_XCB_INCLUDE_DIRS})
-+		${X11_XCB_INCLUDE_DIRS}
-+		${XCB_INCLUDE_DIRS})
- 	add_definitions(
--		${X11_XCB_DEFINITIONS})
-+		${X11_XCB_DEFINITIONS}
-+		${XCB_DEFINITIONS})
- 	set(libobs_PLATFORM_DEPS
- 		${libobs_PLATFORM_DEPS}
--		${X11_XCB_LIBRARIES})
-+		${X11_XCB_LIBRARIES}
-+		${XCB_LIBRARIES})
- 
- 	if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
- 		# use the sysinfo compatibility library on bsd
diff --git a/pkgs/applications/video/smplayer/default.nix b/pkgs/applications/video/smplayer/default.nix
index 107939086325..58ed3ec59b24 100644
--- a/pkgs/applications/video/smplayer/default.nix
+++ b/pkgs/applications/video/smplayer/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, qmake, qtscript }:
 
 stdenv.mkDerivation rec {
-  name = "smplayer-18.6.0";
+  name = "smplayer-18.9.0";
 
   src = fetchurl {
     url = "mirror://sourceforge/smplayer/${name}.tar.bz2";
-    sha256 = "0pb862l175ycm6fm90nryzgbqy8kbwpv3i6cbn13h7jh1yrz8nqx";
+    sha256 = "0gff22yh2h76cyqsbjpa7rax51sfzygjl3isd8dk47zar9cyvw8d";
   };
 
   buildInputs = [ qtscript ];
diff --git a/pkgs/build-support/rust/cargo-vendor-normalise.py b/pkgs/build-support/rust/cargo-vendor-normalise.py
new file mode 100755
index 000000000000..2d7a18957184
--- /dev/null
+++ b/pkgs/build-support/rust/cargo-vendor-normalise.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+
+import sys
+
+import toml
+
+
+def quote(s: str) -> str:
+    escaped = s.replace('"', r"\"").replace("\n", r"\n").replace("\\", "\\\\")
+    return '"{}"'.format(escaped)
+
+
+def main() -> None:
+    data = toml.load(sys.stdin)
+
+    assert list(data.keys()) == ["source"]
+
+    # this value is non deterministic
+    data["source"]["vendored-sources"]["directory"] = "@vendor@"
+
+    lines = []
+    inner = data["source"]
+    for source, attrs in sorted(inner.items()):
+        lines.append("[source.{}]".format(quote(source)))
+        if source == "vendored-sources":
+            lines.append('"directory" = "@vendor@"\n')
+        else:
+            for key, value in sorted(attrs.items()):
+                attr = "{} = {}".format(quote(key), quote(value))
+                lines.append(attr)
+        lines.append("")
+
+    result = "\n".join(lines)
+    real = toml.loads(result)
+    assert real == data, "output = {} while input = {}".format(real, data)
+
+    print(result)
+
+
+if __name__ == "__main__":
+    main()
diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix
index 820989a76206..1d5de052f893 100644
--- a/pkgs/build-support/rust/default.nix
+++ b/pkgs/build-support/rust/default.nix
@@ -1,7 +1,7 @@
-{ stdenv, cacert, git, rust, cargo-vendor }:
+{ stdenv, cacert, git, rust, cargo-vendor, python3 }:
 let
   fetchcargo = import ./fetchcargo.nix {
-    inherit stdenv cacert git rust cargo-vendor;
+    inherit stdenv cacert git rust cargo-vendor python3;
   };
 in
 { name, cargoSha256 ? "unset"
@@ -61,14 +61,12 @@ in stdenv.mkDerivation (args // {
     ${setupVendorDir}
 
     mkdir .cargo
-    cat >.cargo/config <<-EOF
-      [source.crates-io]
-      registry = 'https://github.com/rust-lang/crates.io-index'
-      replace-with = 'vendored-sources'
-
-      [source.vendored-sources]
-      directory = '$(pwd)/$cargoDepsCopy'
-    EOF
+    config="$(pwd)/$cargoDepsCopy/.cargo/config";
+    if [[ ! -e $config ]]; then
+      config=${./fetchcargo-default-config.toml};
+    fi;
+    substitute $config .cargo/config \
+    --subst-var-by vendor "$(pwd)/$cargoDepsCopy"
 
     unset cargoDepsCopy
 
diff --git a/pkgs/build-support/rust/fetchcargo-default-config.toml b/pkgs/build-support/rust/fetchcargo-default-config.toml
new file mode 100755
index 000000000000..dd8ebbc32d31
--- /dev/null
+++ b/pkgs/build-support/rust/fetchcargo-default-config.toml
@@ -0,0 +1,7 @@
+[source."crates-io"]
+"replace-with" = "vendored-sources"
+
+[source."vendored-sources"]
+"directory" = "@vendor@"
+
+
diff --git a/pkgs/build-support/rust/fetchcargo.nix b/pkgs/build-support/rust/fetchcargo.nix
index 2670ed528640..9e77f8817b24 100644
--- a/pkgs/build-support/rust/fetchcargo.nix
+++ b/pkgs/build-support/rust/fetchcargo.nix
@@ -1,8 +1,26 @@
-{ stdenv, cacert, git, rust, cargo-vendor }:
+{ stdenv, cacert, git, rust, cargo-vendor, python3 }:
+let cargo-vendor-normalise = stdenv.mkDerivation {
+  name = "cargo-vendor-normalise";
+  src = ./cargo-vendor-normalise.py;
+  nativeBuildInputs = [ python3.pkgs.wrapPython ];
+  unpackPhase = ":";
+  installPhase = "install -D $src $out/bin/cargo-vendor-normalise";
+  pythonPath = [ python3.pkgs.toml ];
+  postFixup = "wrapPythonPrograms";
+  doInstallCheck = true;
+  installCheckPhase = ''
+    # check that ./fetchcargo-default-config.toml is a fix point
+    reference=${./fetchcargo-default-config.toml}
+    < $reference $out/bin/cargo-vendor-normalise > test;
+    cmp test $reference
+  '';
+  preferLocalBuild = true;
+};
+in
 { name ? "cargo-deps", src, srcs, patches, sourceRoot, sha256, cargoUpdateHook ? "" }:
 stdenv.mkDerivation {
   name = "${name}-vendor";
-  nativeBuildInputs = [ cacert cargo-vendor git rust.cargo ];
+  nativeBuildInputs = [ cacert cargo-vendor git cargo-vendor-normalise rust.cargo ];
   inherit src srcs patches sourceRoot;
 
   phases = "unpackPhase patchPhase installPhase";
@@ -23,9 +41,16 @@ stdenv.mkDerivation {
 
     ${cargoUpdateHook}
 
-    cargo vendor
-
-    cp -ar vendor $out
+    mkdir -p $out
+    cargo vendor $out | cargo-vendor-normalise > config
+    # fetchcargo used to never keep the config output by cargo vendor
+    # and instead hardcode the config in ./fetchcargo-default-config.toml.
+    # This broke on packages needing git dependencies, so now we keep the config.
+    # But not to break old cargoSha256, if the previous behavior was enough,
+    # we don't store the config.
+    if ! cmp config ${./fetchcargo-default-config.toml} > /dev/null; then
+      install -Dt $out/.cargo config;
+    fi;
   '';
 
   outputHashAlgo = "sha256";
diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh
index 1433d1e1f144..8fecf519e1aa 100644
--- a/pkgs/build-support/setup-hooks/patch-shebangs.sh
+++ b/pkgs/build-support/setup-hooks/patch-shebangs.sh
@@ -5,10 +5,32 @@
 # rewritten to /nix/store/<hash>/bin/python.  Interpreters that are
 # already in the store are left untouched.
 
-fixupOutputHooks+=('if [ -z "$dontPatchShebangs" -a -e "$prefix" ]; then patchShebangs "$prefix"; fi')
+fixupOutputHooks+=(patchShebangsAuto)
+
+# Run patch shebangs on a directory.
+# patchShebangs [--build | --host] directory
+
+# Flags:
+# --build : Lookup commands available at build-time
+# --host  : Lookup commands available at runtime
+
+# Example use cases,
+# $ patchShebangs --host /nix/store/...-hello-1.0/bin
+# $ patchShebangs --build configure
 
 patchShebangs() {
+    local pathName
+
+    if [ "$1" = "--host" ]; then
+        pathName=HOST_PATH
+        shift
+    elif [ "$1" = "--build" ]; then
+        pathName=PATH
+        shift
+    fi
+
     local dir="$1"
+
     header "patching script interpreter paths in $dir"
     local f
     local oldPath
@@ -27,22 +49,33 @@ patchShebangs() {
         oldInterpreterLine=$(head -1 "$f" | tail -c+3)
         read -r oldPath arg0 args <<< "$oldInterpreterLine"
 
+        if [ -z "$pathName" ]; then
+            if [ -n "$strictDeps" ] && [[ "$f" = "$NIX_STORE"* ]]; then
+                pathName=HOST_PATH
+            else
+                pathName=PATH
+            fi
+        fi
+
         if $(echo "$oldPath" | grep -q "/bin/env$"); then
             # Check for unsupported 'env' functionality:
             # - options: something starting with a '-'
             # - environment variables: foo=bar
             if $(echo "$arg0" | grep -q -- "^-.*\|.*=.*"); then
-                echo "unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)"
+                echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)"
                 exit 1
             fi
-            newPath="$(command -v "$arg0" || true)"
+
+            newPath="$(PATH="${!pathName}" command -v "$arg0" || true)"
         else
             if [ "$oldPath" = "" ]; then
                 # If no interpreter is specified linux will use /bin/sh. Set
                 # oldpath="/bin/sh" so that we get /nix/store/.../sh.
                 oldPath="/bin/sh"
             fi
-            newPath="$(command -v "$(basename "$oldPath")" || true)"
+
+            newPath="$(PATH="${!pathName}" command -v "$(basename "$oldPath")" || true)"
+
             args="$arg0 $args"
         fi
 
@@ -65,3 +98,17 @@ patchShebangs() {
 
     stopNest
 }
+
+patchShebangsAuto () {
+    if [ -z "$dontPatchShebangs" -a -e "$prefix" ]; then
+
+        # Dev output will end up being run on the build platform. An
+        # example case of this is sdl2-config. Otherwise, we can just
+        # use the runtime path (--host).
+        if [ "$output" != out ] && [ "$output" = "${!outputDev}" ]; then
+            patchShebangs --build "$prefix"
+        else
+            patchShebangs --host "$prefix"
+        fi
+    fi
+}
diff --git a/pkgs/build-support/vm/default.nix b/pkgs/build-support/vm/default.nix
index 03b3fb1f9f27..6e98099460f8 100644
--- a/pkgs/build-support/vm/default.nix
+++ b/pkgs/build-support/vm/default.nix
@@ -3,8 +3,9 @@
 , img ? pkgs.stdenv.hostPlatform.platform.kernelTarget
 , storeDir ? builtins.storeDir
 , rootModules ?
-    [ "virtio_pci" "virtio_mmio" "virtio_blk" "virtio_balloon" "virtio_rng" "ext4" "unix" "9p" "9pnet_virtio" "crc32c_generic" ]
+    [ "virtio_pci" "virtio_mmio" "virtio_blk" "virtio_balloon" "virtio_rng" "ext4" "unix" "9p" "9pnet_virtio" "crc32c_generic" "sym53c8xx" "virtio_scsi" "ahci "]
       ++ pkgs.lib.optional (pkgs.stdenv.isi686 || pkgs.stdenv.isx86_64) "rtc_cmos"
+, config
 }:
 
 with pkgs;
@@ -196,9 +197,17 @@ rec {
     ${qemuBinary qemu} \
       -nographic -no-reboot \
       -device virtio-rng-pci \
+      ${if "$diskInterface" == "scsi" then '' \
+        \ # FIXME: /dev/sda is not created within the VM
+        -device lsi53c895a \
+        -device scsi-hd,drive=hd,id=scsi1,bootindex=1 \
+        ''${diskImage:+-drive file=$diskImage,media=disk,if=none,id=hd,cache=unsafe,werror=report} \
+      '' else '' \
+        -drive file=$diskImage,media=disk,if=none,id=hd \
+        -device virtio-blk-pci,scsi=off,drive=hd,id=virtio0,bootindex=1 \
+      \''}
       -virtfs local,path=${storeDir},security_model=none,mount_tag=store \
       -virtfs local,path=$TMPDIR/xchg,security_model=none,mount_tag=xchg \
-      ''${diskImage:+-drive file=$diskImage,if=virtio,cache=unsafe,werror=report} \
       -kernel ${kernel}/${img} \
       -initrd ${initrd}/initrd \
       -append "console=${qemuSerialDevice} panic=1 command=${stage2Init} out=$out mountDisk=$mountDisk loglevel=4" \
@@ -298,12 +307,13 @@ rec {
      `run-vm' will be left behind in the temporary build directory
      that allows you to boot into the VM and debug it interactively. */
 
-  runInLinuxVM = drv: lib.overrideDerivation drv ({ memSize ? 512, QEMU_OPTS ? "", args, builder, ... }: {
+  runInLinuxVM = drv: lib.overrideDerivation drv ({ memSize ? 512, QEMU_OPTS ? "", args, builder, ...  } @ moreArgs : {
     requiredSystemFeatures = [ "kvm" ];
     builder = "${bash}/bin/sh";
     args = ["-e" (vmRunCommand qemuCommandLinux)];
     origArgs = args;
     origBuilder = builder;
+    diskInterface = "${moreArgs.diskInterface}";
     QEMU_OPTS = "${QEMU_OPTS} -m ${toString memSize}";
     passAsFile = []; # HACK fix - see https://github.com/NixOS/nixpkgs/issues/16742
   });
diff --git a/pkgs/data/fonts/ultimate-oldschool-pc-font-pack/default.nix b/pkgs/data/fonts/ultimate-oldschool-pc-font-pack/default.nix
new file mode 100644
index 000000000000..cb68c30a4a2c
--- /dev/null
+++ b/pkgs/data/fonts/ultimate-oldschool-pc-font-pack/default.nix
@@ -0,0 +1,31 @@
+{ stdenv, fetchurl, unzip }:
+
+stdenv.mkDerivation rec {
+  name = "ultimate-oldschool-pc-font-pack-${version}";
+  version = "1.0";
+
+  src = fetchurl {
+    url = "http://int10h.org/oldschool-pc-fonts/download/ultimate_oldschool_pc_font_pack_v${version}.zip";
+    sha256 = "7666cf23176e34ea03a218b5c1500f4ad729d97150ab7bdb7cf2adf4c99a9a7a";
+  };
+
+  buildInputs = [ unzip ];
+
+  dontBuild = true;
+
+  sourceRoot = ".";
+
+  installPhase = ''
+    mkdir -p $out/share/fonts/truetype
+    cp 'Px437 (TrueType - DOS charset)'/*.ttf $out/share/fonts/truetype
+    cp 'PxPlus (TrueType - extended charset)'/*.ttf $out/share/fonts/truetype
+  '';
+
+  meta = with stdenv.lib; {
+    description = "The Ultimate Oldschool PC Font Pack (TTF Fonts)";
+    homepage = "http://int10h.org/oldschool-pc-fonts/";
+    platforms = platforms.unix;
+    license = licenses.cc-by-sa-40;
+    maintainers = [ maintainers.endgame ];
+  };
+}
diff --git a/pkgs/data/misc/iana-etc/default.nix b/pkgs/data/misc/iana-etc/default.nix
index e6c33fc260e8..af8270e6eefa 100644
--- a/pkgs/data/misc/iana-etc/default.nix
+++ b/pkgs/data/misc/iana-etc/default.nix
@@ -1,12 +1,11 @@
 { stdenv, fetchzip }:
 
 let
-  version = "20180711";
+  version = "20180905";
 in fetchzip {
   name = "iana-etc-${version}";
-
   url = "https://github.com/Mic92/iana-etc/releases/download/${version}/iana-etc-${version}.tar.gz";
-  sha256 = "0vbgk3paix2v4rlh90a8yh1l39s322awng06izqj44zcg704fjbj";
+  sha256 = "1vl3by24xddl267cjq9bcwb7yvfd7gqalwgd5sgx8i7kz9bk40q2";
 
   postFetch = ''
     tar -xzvf $downloadedFile --strip-components=1
diff --git a/pkgs/development/compilers/llvm/3.5/default.nix b/pkgs/development/compilers/llvm/3.5/default.nix
index f588eb4407b5..b87fa747f145 100644
--- a/pkgs/development/compilers/llvm/3.5/default.nix
+++ b/pkgs/development/compilers/llvm/3.5/default.nix
@@ -6,7 +6,7 @@ let
 
   fetch = fetch_v version;
   fetch_v = ver: name: sha256: fetchurl {
-    url = "http://llvm.org/releases/${ver}/${name}-${ver}.src.tar.xz";
+    url = "https://releases.llvm.org/${ver}/${name}-${ver}.src.tar.xz";
     inherit sha256;
   };
 
diff --git a/pkgs/development/compilers/llvm/3.7/default.nix b/pkgs/development/compilers/llvm/3.7/default.nix
index f176894dedb9..3c557711449f 100644
--- a/pkgs/development/compilers/llvm/3.7/default.nix
+++ b/pkgs/development/compilers/llvm/3.7/default.nix
@@ -9,7 +9,7 @@ let
 
   fetch = fetch_v version;
   fetch_v = ver: name: sha256: fetchurl {
-    url = "http://llvm.org/releases/${ver}/${name}-${ver}.src.tar.xz";
+    url = "https://releases.llvm.org/${ver}/${name}-${ver}.src.tar.xz";
     inherit sha256;
   };
 
diff --git a/pkgs/development/compilers/llvm/3.8/default.nix b/pkgs/development/compilers/llvm/3.8/default.nix
index 99869e6e80a7..a848c8b9252b 100644
--- a/pkgs/development/compilers/llvm/3.8/default.nix
+++ b/pkgs/development/compilers/llvm/3.8/default.nix
@@ -8,7 +8,7 @@ let
 
   fetch = fetch_v version;
   fetch_v = ver: name: sha256: fetchurl {
-    url = "http://llvm.org/releases/${ver}/${name}-${ver}.src.tar.xz";
+    url = "https://releases.llvm.org/${ver}/${name}-${ver}.src.tar.xz";
     inherit sha256;
   };
 
diff --git a/pkgs/development/compilers/llvm/3.9/default.nix b/pkgs/development/compilers/llvm/3.9/default.nix
index 01c08f4bd209..752790cdd853 100644
--- a/pkgs/development/compilers/llvm/3.9/default.nix
+++ b/pkgs/development/compilers/llvm/3.9/default.nix
@@ -8,7 +8,7 @@ let
 
   fetch = fetch_v version;
   fetch_v = ver: name: sha256: fetchurl {
-    url = "http://llvm.org/releases/${version}/${name}-${ver}.src.tar.xz";
+    url = "https://releases.llvm.org/${version}/${name}-${ver}.src.tar.xz";
     inherit sha256;
   };
 
diff --git a/pkgs/development/compilers/llvm/5/default.nix b/pkgs/development/compilers/llvm/5/default.nix
index 38d2b0d461d4..68ee80fa7a62 100644
--- a/pkgs/development/compilers/llvm/5/default.nix
+++ b/pkgs/development/compilers/llvm/5/default.nix
@@ -9,7 +9,7 @@ let
   version = release_version; # differentiating these is important for rc's
 
   fetch = name: sha256: fetchurl {
-    url = "http://llvm.org/releases/${release_version}/${name}-${version}.src.tar.xz";
+    url = "https://releases.llvm.org/${release_version}/${name}-${version}.src.tar.xz";
     inherit sha256;
   };
 
diff --git a/pkgs/development/compilers/llvm/5/llvm.nix b/pkgs/development/compilers/llvm/5/llvm.nix
index 3abba0ed340f..6dae8be97c88 100644
--- a/pkgs/development/compilers/llvm/5/llvm.nix
+++ b/pkgs/development/compilers/llvm/5/llvm.nix
@@ -119,12 +119,14 @@ in stdenv.mkDerivation (rec {
   + stdenv.lib.optionalString enableSharedLibraries ''
     moveToOutput "lib/libLLVM-*" "$lib"
     moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
+    moveToOutput "lib/libLTO${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
     substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
       --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
   ''
   + stdenv.lib.optionalString (stdenv.isDarwin && enableSharedLibraries) ''
     substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
-      --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
+      --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib" \
+      --replace "\''${_IMPORT_PREFIX}/lib/libLTO.dylib" "$lib/lib/libLTO.dylib"
     ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
     ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
   '';
diff --git a/pkgs/development/compilers/llvm/6/default.nix b/pkgs/development/compilers/llvm/6/default.nix
index 831e4b65344c..5ee551f6b6b1 100644
--- a/pkgs/development/compilers/llvm/6/default.nix
+++ b/pkgs/development/compilers/llvm/6/default.nix
@@ -9,7 +9,7 @@ let
   version = release_version; # differentiating these is important for rc's
 
   fetch = name: sha256: fetchurl {
-    url = "http://releases.llvm.org/${release_version}/${name}-${version}.src.tar.xz";
+    url = "https://releases.llvm.org/${release_version}/${name}-${version}.src.tar.xz";
     inherit sha256;
   };
 
diff --git a/pkgs/development/compilers/llvm/7/clang/default.nix b/pkgs/development/compilers/llvm/7/clang/default.nix
new file mode 100644
index 000000000000..e1f4eb303603
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/clang/default.nix
@@ -0,0 +1,106 @@
+{ stdenv, fetch, cmake, libxml2, llvm, version, clang-tools-extra_src, python
+, fixDarwinDylibNames
+, enableManpages ? false
+}:
+
+let
+  gcc = if stdenv.cc.isGNU then stdenv.cc.cc else stdenv.cc.cc.gcc;
+  self = stdenv.mkDerivation ({
+    name = "clang-${version}";
+
+    unpackPhase = ''
+      unpackFile ${fetch "cfe" "0mdsbgj3p7mayhzm8hclzl3i46r2lwa8fr1cz399f9km3iqi40jm"}
+      mv cfe-${version}* clang
+      sourceRoot=$PWD/clang
+      unpackFile ${clang-tools-extra_src}
+      mv clang-tools-extra-* $sourceRoot/tools/extra
+    '';
+
+    nativeBuildInputs = [ cmake python ]
+      ++ stdenv.lib.optional enableManpages python.pkgs.sphinx;
+
+    buildInputs = [ libxml2 llvm ]
+      ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+    cmakeFlags = [
+      "-DCMAKE_CXX_FLAGS=-std=c++11"
+    ] ++ stdenv.lib.optionals enableManpages [
+      "-DCLANG_INCLUDE_DOCS=ON"
+      "-DLLVM_ENABLE_SPHINX=ON"
+      "-DSPHINX_OUTPUT_MAN=ON"
+      "-DSPHINX_OUTPUT_HTML=OFF"
+      "-DSPHINX_WARNINGS_AS_ERRORS=OFF"
+    ];
+
+    patches = [ ./purity.patch ];
+
+    postPatch = ''
+      sed -i -e 's/DriverArgs.hasArg(options::OPT_nostdlibinc)/true/' \
+             -e 's/Args.hasArg(options::OPT_nostdlibinc)/true/' \
+             lib/Driver/ToolChains/*.cpp
+
+      # Patch for standalone doc building
+      sed -i '1s,^,find_package(Sphinx REQUIRED)\n,' docs/CMakeLists.txt
+    '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+      sed -i -e 's/lgcc_s/lgcc_eh/' lib/Driver/ToolChains/*.cpp
+    '';
+
+    outputs = [ "out" "lib" "python" ];
+
+    # Clang expects to find LLVMgold in its own prefix
+    postInstall = ''
+      if [ -e ${llvm}/lib/LLVMgold.so ]; then
+        ln -sv ${llvm}/lib/LLVMgold.so $out/lib
+      fi
+
+      ln -sv $out/bin/clang $out/bin/cpp
+
+      # Move libclang to 'lib' output
+      moveToOutput "lib/libclang.*" "$lib"
+      substituteInPlace $out/lib/cmake/clang/ClangTargets-release.cmake \
+          --replace "\''${_IMPORT_PREFIX}/lib/libclang." "$lib/lib/libclang."
+
+      mkdir -p $python/bin $python/share/clang/
+      mv $out/bin/{git-clang-format,scan-view} $python/bin
+      if [ -e $out/bin/set-xcode-analyzer ]; then
+        mv $out/bin/set-xcode-analyzer $python/bin
+      fi
+      mv $out/share/clang/*.py $python/share/clang
+      rm $out/bin/c-index-test
+    '';
+
+    enableParallelBuilding = true;
+
+    passthru = {
+      isClang = true;
+      inherit llvm;
+    } // stdenv.lib.optionalAttrs stdenv.targetPlatform.isLinux {
+      inherit gcc;
+    };
+
+    meta = {
+      description = "A c, c++, objective-c, and objective-c++ frontend for the llvm compiler";
+      homepage    = http://llvm.org/;
+      license     = stdenv.lib.licenses.ncsa;
+      platforms   = stdenv.lib.platforms.all;
+    };
+  } // stdenv.lib.optionalAttrs enableManpages {
+    name = "clang-manpages-${version}";
+
+    buildPhase = ''
+      make docs-clang-man
+    '';
+
+    installPhase = ''
+      mkdir -p $out/share/man/man1
+      # Manually install clang manpage
+      cp docs/man/*.1 $out/share/man/man1/
+    '';
+
+    outputs = [ "out" ];
+
+    doCheck = false;
+
+    meta.description = "man page for Clang ${version}";
+  });
+in self
diff --git a/pkgs/development/compilers/llvm/7/clang/purity.patch b/pkgs/development/compilers/llvm/7/clang/purity.patch
new file mode 100644
index 000000000000..b30d0d0b5d5b
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/clang/purity.patch
@@ -0,0 +1,30 @@
+From 4add81bba40dcec62c4ea4481be8e35ac53e89d8 Mon Sep 17 00:00:00 2001
+From: Will Dietz <w@wdtz.org>
+Date: Thu, 18 May 2017 11:56:12 -0500
+Subject: [PATCH] "purity" patch for 5.0
+
+---
+ lib/Driver/ToolChains/Gnu.cpp | 7 -------
+ 1 file changed, 7 deletions(-)
+
+diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
+index fe3c0191bb..c6a482bece 100644
+--- a/lib/Driver/ToolChains/Gnu.cpp
++++ b/lib/Driver/ToolChains/Gnu.cpp
+@@ -494,13 +494,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
+   if (!Args.hasArg(options::OPT_static)) {
+     if (Args.hasArg(options::OPT_rdynamic))
+       CmdArgs.push_back("-export-dynamic");
+-
+-    if (!Args.hasArg(options::OPT_shared)) {
+-      const std::string Loader =
+-          D.DyldPrefix + ToolChain.getDynamicLinker(Args);
+-      CmdArgs.push_back("-dynamic-linker");
+-      CmdArgs.push_back(Args.MakeArgString(Loader));
+-    }
+   }
+ 
+   CmdArgs.push_back("-o");
+-- 
+2.11.0
+
diff --git a/pkgs/development/compilers/llvm/7/compiler-rt-codesign.patch b/pkgs/development/compilers/llvm/7/compiler-rt-codesign.patch
new file mode 100644
index 000000000000..3cc12b94b200
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/compiler-rt-codesign.patch
@@ -0,0 +1,33 @@
+From 3dec5f3475a26aeb4678627795c4b67c6b7b4785 Mon Sep 17 00:00:00 2001
+From: Will Dietz <w@wdtz.org>
+Date: Tue, 19 Sep 2017 13:13:06 -0500
+Subject: [PATCH] remove codesign use on Apple, disable ios sim testing that
+ needs it
+
+---
+ cmake/Modules/AddCompilerRT.cmake |  8 ------
+ test/asan/CMakeLists.txt          | 52 ---------------------------------------
+ test/tsan/CMakeLists.txt          | 47 -----------------------------------
+ 3 files changed, 107 deletions(-)
+
+diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake
+index bc5fb9ff7..b64eb4246 100644
+--- a/cmake/Modules/AddCompilerRT.cmake
++++ b/cmake/Modules/AddCompilerRT.cmake
+@@ -210,14 +210,6 @@ function(add_compiler_rt_runtime name type)
+         set_target_properties(${libname} PROPERTIES IMPORT_PREFIX "")
+         set_target_properties(${libname} PROPERTIES IMPORT_SUFFIX ".lib")
+       endif()
+-      if(APPLE)
+-        # Ad-hoc sign the dylibs
+-        add_custom_command(TARGET ${libname}
+-          POST_BUILD  
+-          COMMAND codesign --sign - $<TARGET_FILE:${libname}>
+-          WORKING_DIRECTORY ${COMPILER_RT_LIBRARY_OUTPUT_DIR}
+-        )
+-      endif()
+     endif()
+     install(TARGETS ${libname}
+       ARCHIVE DESTINATION ${COMPILER_RT_LIBRARY_INSTALL_DIR}
+2.14.1
+
diff --git a/pkgs/development/compilers/llvm/7/compiler-rt.nix b/pkgs/development/compilers/llvm/7/compiler-rt.nix
new file mode 100644
index 000000000000..ec739d22dd7a
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/compiler-rt.nix
@@ -0,0 +1,37 @@
+{ stdenv, version, fetch, cmake, python, llvm, libcxxabi }:
+with stdenv.lib;
+stdenv.mkDerivation rec {
+  name = "compiler-rt-${version}";
+  inherit version;
+  src = fetch "compiler-rt" "1mkhqvs8cxbfmprkzwyq7lmnzr1sv45znzf0arbgb19crzipzv5x";
+
+  nativeBuildInputs = [ cmake python llvm ];
+  buildInputs = stdenv.lib.optional stdenv.hostPlatform.isDarwin libcxxabi;
+
+  configureFlags = [
+    "-DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
+  ];
+
+  outputs = [ "out" "dev" ];
+
+  patches = [
+    ./compiler-rt-codesign.patch # Revert compiler-rt commit that makes codesign mandatory
+  ] ++ optional stdenv.hostPlatform.isMusl ./sanitizers-nongnu.patch;
+
+  # TSAN requires XPC on Darwin, which we have no public/free source files for. We can depend on the Apple frameworks
+  # to get it, but they're unfree. Since LLVM is rather central to the stdenv, we patch out TSAN support so that Hydra
+  # can build this. If we didn't do it, basically the entire nixpkgs on Darwin would have an unfree dependency and we'd
+  # get no binary cache for the entire platform. If you really find yourself wanting the TSAN, make this controllable by
+  # a flag and turn the flag off during the stdenv build.
+  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace cmake/config-ix.cmake \
+      --replace 'set(COMPILER_RT_HAS_TSAN TRUE)' 'set(COMPILER_RT_HAS_TSAN FALSE)'
+  '';
+
+  # Hack around weird upsream RPATH bug
+  postInstall = stdenv.lib.optionalString stdenv.isDarwin ''
+    ln -s "$out/lib"/*/* "$out/lib"
+  '';
+
+  enableParallelBuilding = true;
+}
diff --git a/pkgs/development/compilers/llvm/7/default.nix b/pkgs/development/compilers/llvm/7/default.nix
new file mode 100644
index 000000000000..5446f1b362a9
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/default.nix
@@ -0,0 +1,92 @@
+{ lowPrio, newScope, pkgs, stdenv, cmake, libstdcxxHook
+, libxml2, python, isl, fetchurl, overrideCC, wrapCCWith
+, buildLlvmTools # tools, but from the previous stage, for cross
+, targetLlvmLibraries # libraries, but from the next stage, for cross
+}:
+
+let
+  release_version = "7.0.0";
+  version = release_version; # differentiating these is important for rc's
+
+  fetch = name: sha256: fetchurl {
+    url = "https://releases.llvm.org/${release_version}/${name}-${version}.src.tar.xz";
+    inherit sha256;
+  };
+
+  clang-tools-extra_src = fetch "clang-tools-extra" "1glxl7bnr4k3j16s8xy8r9cl0llyg524f50591g1ig23ij65lz4k";
+
+  tools = stdenv.lib.makeExtensible (tools: let
+    callPackage = newScope (tools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
+    mkExtraBuildCommands = cc: ''
+      rsrc="$out/resource-root"
+      mkdir "$rsrc"
+      ln -s "${cc}/lib/clang/${release_version}/include" "$rsrc"
+      ln -s "${targetLlvmLibraries.compiler-rt.out}/lib" "$rsrc/lib"
+      echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
+    '' + stdenv.lib.optionalString stdenv.targetPlatform.isLinux ''
+      echo "--gcc-toolchain=${tools.clang-unwrapped.gcc}" >> $out/nix-support/cc-cflags
+    '';
+  in {
+
+    llvm = callPackage ./llvm.nix { };
+
+    clang-unwrapped = callPackage ./clang {
+      inherit clang-tools-extra_src;
+    };
+
+    llvm-manpages = lowPrio (tools.llvm.override {
+      enableManpages = true;
+      python = pkgs.python;  # don't use python-boot
+    });
+
+    clang-manpages = lowPrio (tools.clang-unwrapped.override {
+      enableManpages = true;
+      python = pkgs.python;  # don't use python-boot
+    });
+
+    libclang = tools.clang-unwrapped.lib;
+
+    clang = if stdenv.cc.isGNU then tools.libstdcxxClang else tools.libcxxClang;
+
+    libstdcxxClang = wrapCCWith rec {
+      cc = tools.clang-unwrapped;
+      extraPackages = [
+        libstdcxxHook
+        targetLlvmLibraries.compiler-rt
+      ];
+      extraBuildCommands = mkExtraBuildCommands cc;
+    };
+
+    libcxxClang = wrapCCWith rec {
+      cc = tools.clang-unwrapped;
+      extraPackages = [
+        targetLlvmLibraries.libcxx
+        targetLlvmLibraries.libcxxabi
+        targetLlvmLibraries.compiler-rt
+      ];
+      extraBuildCommands = mkExtraBuildCommands cc;
+    };
+
+    lld = callPackage ./lld.nix {};
+
+    lldb = callPackage ./lldb.nix {};
+  });
+
+  libraries = stdenv.lib.makeExtensible (libraries: let
+    callPackage = newScope (libraries // buildLlvmTools // { inherit stdenv cmake libxml2 python isl release_version version fetch; });
+  in {
+
+    compiler-rt = callPackage ./compiler-rt.nix {};
+
+    stdenv = overrideCC stdenv buildLlvmTools.clang;
+
+    libcxxStdenv = overrideCC stdenv buildLlvmTools.libcxxClang;
+
+    libcxx = callPackage ./libc++ {};
+
+    libcxxabi = callPackage ./libc++abi.nix {};
+
+    openmp = callPackage ./openmp.nix {};
+  });
+
+in { inherit tools libraries; } // libraries // tools
diff --git a/pkgs/development/compilers/llvm/7/libc++/default.nix b/pkgs/development/compilers/llvm/7/libc++/default.nix
new file mode 100644
index 000000000000..76bfb34975e6
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/libc++/default.nix
@@ -0,0 +1,50 @@
+{ lib, stdenv, fetch, cmake, python, libcxxabi, fixDarwinDylibNames, version }:
+
+stdenv.mkDerivation rec {
+  name = "libc++-${version}";
+
+  src = fetch "libcxx" "1w1l472p03csgz76p70pn9yk7h0nw5hj1av44ysnakigp8jjcd4v";
+
+  postUnpack = ''
+    unpackFile ${libcxxabi.src}
+    export LIBCXXABI_INCLUDE_DIR="$PWD/$(ls -d libcxxabi-${version}*)/include"
+  '';
+
+  patches = stdenv.lib.optional stdenv.hostPlatform.isMusl ../../libcxx-0001-musl-hacks.patch;
+
+  prePatch = ''
+    substituteInPlace lib/CMakeLists.txt --replace "/usr/lib/libc++" "\''${LIBCXX_LIBCXXABI_LIB_PATH}/libc++"
+  '';
+
+  preConfigure = ''
+    # Get headers from the cxxabi source so we can see private headers not installed by the cxxabi package
+    cmakeFlagsArray=($cmakeFlagsArray -DLIBCXX_CXX_ABI_INCLUDE_PATHS="$LIBCXXABI_INCLUDE_DIR")
+  '' + lib.optionalString stdenv.hostPlatform.isMusl ''
+    patchShebangs utils/cat_files.py
+  '';
+  nativeBuildInputs = [ cmake ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl python;
+
+  buildInputs = [ libcxxabi ] ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
+
+  cmakeFlags = [
+    "-DLIBCXX_LIBCXXABI_LIB_PATH=${libcxxabi}/lib"
+    "-DLIBCXX_LIBCPPABI_VERSION=2"
+    "-DLIBCXX_CXX_ABI=libcxxabi"
+  ] ++ stdenv.lib.optional stdenv.hostPlatform.isMusl "-DLIBCXX_HAS_MUSL_LIBC=1";
+
+  enableParallelBuilding = true;
+
+  linkCxxAbi = stdenv.isLinux;
+
+  setupHooks = [
+    ../../../../../build-support/setup-hooks/role.bash
+    ./setup-hook.sh
+  ];
+
+  meta = {
+    homepage = http://libcxx.llvm.org/;
+    description = "A new implementation of the C++ standard library, targeting C++11";
+    license = with stdenv.lib.licenses; [ ncsa mit ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/pkgs/development/compilers/llvm/7/libc++/setup-hook.sh b/pkgs/development/compilers/llvm/7/libc++/setup-hook.sh
new file mode 100644
index 000000000000..6611259165ae
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/libc++/setup-hook.sh
@@ -0,0 +1,6 @@
+# See pkgs/build-support/setup-hooks/role.bash
+getHostRole
+
+linkCxxAbi="@linkCxxAbi@"
+export NIX_${role_pre}CXXSTDLIB_COMPILE+=" -isystem @out@/include/c++/v1"
+export NIX_${role_pre}CXXSTDLIB_LINK=" -stdlib=libc++${linkCxxAbi:+" -lc++abi"}"
diff --git a/pkgs/development/compilers/llvm/7/libc++abi.nix b/pkgs/development/compilers/llvm/7/libc++abi.nix
new file mode 100644
index 000000000000..7dbda6c365e0
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/libc++abi.nix
@@ -0,0 +1,49 @@
+{ stdenv, cmake, fetch, libcxx, libunwind, llvm, version }:
+
+stdenv.mkDerivation {
+  name = "libc++abi-${version}";
+
+  src = fetch "libcxxabi" "0pr4xfx61r5mwmvhg4j9pb6df6vvha1gyf6rwkm14x9rzxcwficv";
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
+
+  postUnpack = ''
+    unpackFile ${libcxx.src}
+    unpackFile ${llvm.src}
+    export cmakeFlags="-DLLVM_PATH=$PWD/$(ls -d llvm-*) -DLIBCXXABI_LIBCXX_PATH=$PWD/$(ls -d libcxx-*)"
+  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    export TRIPLE=x86_64-apple-darwin
+  '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+    patch -p1 -d $(ls -d libcxx-*) -i ${../libcxx-0001-musl-hacks.patch}
+  '';
+
+  installPhase = if stdenv.isDarwin
+    then ''
+      for file in lib/*.dylib; do
+        # this should be done in CMake, but having trouble figuring out
+        # the magic combination of necessary CMake variables
+        # if you fancy a try, take a look at
+        # http://www.cmake.org/Wiki/CMake_RPATH_handling
+        install_name_tool -id $out/$file $file
+      done
+      make install
+      install -d 755 $out/include
+      install -m 644 ../include/*.h $out/include
+    ''
+    else ''
+      install -d -m 755 $out/include $out/lib
+      install -m 644 lib/libc++abi.so.1.0 $out/lib
+      install -m 644 ../include/cxxabi.h $out/include
+      ln -s libc++abi.so.1.0 $out/lib/libc++abi.so
+      ln -s libc++abi.so.1.0 $out/lib/libc++abi.so.1
+    '';
+
+  meta = {
+    homepage = http://libcxxabi.llvm.org/;
+    description = "A new implementation of low level support for a standard C++ library";
+    license = with stdenv.lib.licenses; [ ncsa mit ];
+    maintainers = with stdenv.lib.maintainers; [ vlstill ];
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/pkgs/development/compilers/llvm/7/lld.nix b/pkgs/development/compilers/llvm/7/lld.nix
new file mode 100644
index 000000000000..f6ce768d6484
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/lld.nix
@@ -0,0 +1,32 @@
+{ stdenv
+, fetch
+, cmake
+, libxml2
+, llvm
+, version
+}:
+
+stdenv.mkDerivation {
+  name = "lld-${version}";
+
+  src = fetch "lld" "173z50vx5mlsaiqmbz7asxy2297z4xivrfxrdfncvx23wp2lgkzv";
+
+  nativeBuildInputs = [ cmake ];
+  buildInputs = [ llvm libxml2 ];
+
+  outputs = [ "out" "dev" ];
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    moveToOutput include "$dev"
+    moveToOutput lib "$dev"
+  '';
+
+  meta = {
+    description = "The LLVM Linker";
+    homepage    = http://lld.llvm.org/;
+    license     = stdenv.lib.licenses.ncsa;
+    platforms   = stdenv.lib.platforms.all;
+  };
+}
diff --git a/pkgs/development/compilers/llvm/7/lldb.nix b/pkgs/development/compilers/llvm/7/lldb.nix
new file mode 100644
index 000000000000..6c3f0699978f
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/lldb.nix
@@ -0,0 +1,56 @@
+{ stdenv
+, fetch
+, cmake
+, zlib
+, ncurses
+, swig
+, which
+, libedit
+, libxml2
+, llvm
+, clang-unwrapped
+, python
+, version
+, darwin
+}:
+
+stdenv.mkDerivation {
+  name = "lldb-${version}";
+
+  src = fetch "lldb" "0cmah36ybyfws0z2ikq9fqn5k4kvjci7vgk97ddx4xwrwkzdixkz";
+
+  postPatch = ''
+    # Fix up various paths that assume llvm and clang are installed in the same place
+    sed -i 's,".*ClangConfig.cmake","${clang-unwrapped}/lib/cmake/clang/ClangConfig.cmake",' \
+      cmake/modules/LLDBStandalone.cmake
+    sed -i 's,".*tools/clang/include","${clang-unwrapped}/include",' \
+      cmake/modules/LLDBStandalone.cmake
+    sed -i 's,"$.LLVM_LIBRARY_DIR.",${llvm}/lib ${clang-unwrapped}/lib,' \
+      cmake/modules/LLDBStandalone.cmake
+  '';
+
+  nativeBuildInputs = [ cmake python which swig ];
+  buildInputs = [ ncurses zlib libedit libxml2 llvm ]
+    ++ stdenv.lib.optionals stdenv.isDarwin [ darwin.libobjc darwin.apple_sdk.libs.xpc darwin.apple_sdk.frameworks.Foundation darwin.bootstrap_cmds darwin.apple_sdk.frameworks.Carbon darwin.apple_sdk.frameworks.Cocoa ];
+
+  CXXFLAGS = "-fno-rtti";
+  hardeningDisable = [ "format" ];
+
+  cmakeFlags = [
+    "-DLLDB_CODESIGN_IDENTITY=" # codesigning makes nondeterministic
+  ];
+
+  enableParallelBuilding = true;
+
+  postInstall = ''
+    mkdir -p $out/share/man/man1
+    cp ../docs/lldb.1 $out/share/man/man1/
+  '';
+
+  meta = with stdenv.lib; {
+    description = "A next-generation high-performance debugger";
+    homepage    = http://llvm.org/;
+    license     = licenses.ncsa;
+    platforms   = platforms.all;
+  };
+}
diff --git a/pkgs/development/compilers/llvm/7/llvm-outputs.patch b/pkgs/development/compilers/llvm/7/llvm-outputs.patch
new file mode 100644
index 000000000000..40096fa3497f
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/llvm-outputs.patch
@@ -0,0 +1,26 @@
+diff --git a/tools/llvm-config/llvm-config.cpp b/tools/llvm-config/llvm-config.cpp
+index 94d426b..37f7794 100644
+--- a/tools/llvm-config/llvm-config.cpp
++++ b/tools/llvm-config/llvm-config.cpp
+@@ -333,6 +333,21 @@ int main(int argc, char **argv) {
+     ActiveIncludeOption = "-I" + ActiveIncludeDir;
+   }
+ 
++  /// Nix-specific multiple-output handling: override ActiveLibDir if --link-shared
++  if (!IsInDevelopmentTree) {
++    bool WantShared = true;
++    for (int i = 1; i < argc; ++i) {
++      StringRef Arg = argv[i];
++      if (Arg == "--link-shared")
++        WantShared = true;
++      else if (Arg == "--link-static")
++        WantShared = false; // the last one wins
++    }
++
++    if (WantShared)
++      ActiveLibDir = std::string("@lib@") + "/lib" + LLVM_LIBDIR_SUFFIX;
++  }
++
+   /// We only use `shared library` mode in cases where the static library form
+   /// of the components provided are not available; note however that this is
+   /// skipped if we're run from within the build dir. However, once installed,
diff --git a/pkgs/development/compilers/llvm/7/llvm.nix b/pkgs/development/compilers/llvm/7/llvm.nix
new file mode 100644
index 000000000000..67bde813feed
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/llvm.nix
@@ -0,0 +1,174 @@
+{ stdenv
+, fetch
+, cmake
+, python
+, libffi
+, libbfd
+, libpfm
+, libxml2
+, ncurses
+, version
+, release_version
+, zlib
+, debugVersion ? false
+, enableManpages ? false
+, enableSharedLibraries ? true
+, enableWasm ? true
+, enablePFM ? !stdenv.isDarwin
+}:
+
+let
+  src = fetch "llvm" "08p27wv1pr9ql2zc3f3qkkymci46q7myvh8r5ijippnbwr2gihcb";
+
+  # Used when creating a version-suffixed symlink of libLLVM.dylib
+  shortVersion = with stdenv.lib;
+    concatStringsSep "." (take 1 (splitString "." release_version));
+in stdenv.mkDerivation (rec {
+  name = "llvm-${version}";
+
+  unpackPhase = ''
+    unpackFile ${src}
+    mv llvm-${version}* llvm
+    sourceRoot=$PWD/llvm
+  '';
+
+  outputs = [ "out" "python" ]
+    ++ stdenv.lib.optional enableSharedLibraries "lib";
+
+  nativeBuildInputs = [ cmake python ]
+    ++ stdenv.lib.optional enableManpages python.pkgs.sphinx;
+
+  buildInputs = [ libxml2 libffi ]
+    ++ stdenv.lib.optional enablePFM libpfm; # exegesis
+
+  propagatedBuildInputs = [ ncurses zlib ];
+
+  postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace cmake/modules/AddLLVM.cmake \
+      --replace 'set(_install_name_dir INSTALL_NAME_DIR "@rpath")' "set(_install_name_dir INSTALL_NAME_DIR "$lib/lib")" \
+      --replace 'set(_install_rpath "@loader_path/../lib" ''${extra_libdir})' ""
+  ''
+  # Patch llvm-config to return correct library path based on --link-{shared,static}.
+  + stdenv.lib.optionalString (enableSharedLibraries) ''
+    substitute '${./llvm-outputs.patch}' ./llvm-outputs.patch --subst-var lib
+    patch -p1 < ./llvm-outputs.patch
+  '' + ''
+    # FileSystem permissions tests fail with various special bits
+    substituteInPlace unittests/Support/CMakeLists.txt \
+      --replace "Path.cpp" ""
+    rm unittests/Support/Path.cpp
+  '' + stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+    patch -p1 -i ${../TLI-musl.patch}
+    substituteInPlace unittests/Support/CMakeLists.txt \
+      --replace "add_subdirectory(DynamicLibrary)" ""
+    rm unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
+  '' + ''
+    patchShebangs test/BugPoint/compile-custom.ll.py
+  '';
+
+  # hacky fix: created binaries need to be run before installation
+  preBuild = ''
+    mkdir -p $out/
+    ln -sv $PWD/lib $out
+  '';
+
+  cmakeFlags = with stdenv; [
+    "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
+    "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
+    "-DLLVM_BUILD_TESTS=ON"
+    "-DLLVM_ENABLE_FFI=ON"
+    "-DLLVM_ENABLE_RTTI=ON"
+
+    "-DLLVM_HOST_TRIPLE=${stdenv.hostPlatform.config}"
+    "-DLLVM_DEFAULT_TARGET_TRIPLE=${stdenv.hostPlatform.config}"
+    "-DTARGET_TRIPLE=${stdenv.hostPlatform.config}"
+
+    "-DLLVM_ENABLE_DUMP=ON"
+  ]
+  ++ stdenv.lib.optional enableSharedLibraries
+    "-DLLVM_LINK_LLVM_DYLIB=ON"
+  ++ stdenv.lib.optionals enableManpages [
+    "-DLLVM_BUILD_DOCS=ON"
+    "-DLLVM_ENABLE_SPHINX=ON"
+    "-DSPHINX_OUTPUT_MAN=ON"
+    "-DSPHINX_OUTPUT_HTML=OFF"
+    "-DSPHINX_WARNINGS_AS_ERRORS=OFF"
+  ]
+  ++ stdenv.lib.optional (!isDarwin)
+    "-DLLVM_BINUTILS_INCDIR=${libbfd.dev}/include"
+  ++ stdenv.lib.optionals (isDarwin) [
+    "-DLLVM_ENABLE_LIBCXX=ON"
+    "-DCAN_TARGET_i386=false"
+  ]
+  ++ stdenv.lib.optional enableWasm
+   "-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=WebAssembly"
+  ;
+
+  postBuild = ''
+    rm -fR $out
+
+    paxmark m bin/{lli,llvm-rtdyld}
+    paxmark m unittests/ExecutionEngine/MCJIT/MCJITTests
+    paxmark m unittests/ExecutionEngine/Orc/OrcJITTests
+    paxmark m unittests/Support/SupportTests
+    paxmark m bin/lli-child-target
+  '';
+
+  preCheck = ''
+    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PWD/lib
+  '';
+
+  postInstall = ''
+    mkdir -p $python/share
+    mv $out/share/opt-viewer $python/share/opt-viewer
+  ''
+  + stdenv.lib.optionalString enableSharedLibraries ''
+    moveToOutput "lib/libLLVM-*" "$lib"
+    moveToOutput "lib/libLLVM${stdenv.hostPlatform.extensions.sharedLibrary}" "$lib"
+    substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
+      --replace "\''${_IMPORT_PREFIX}/lib/libLLVM-" "$lib/lib/libLLVM-"
+  ''
+  + stdenv.lib.optionalString (stdenv.isDarwin && enableSharedLibraries) ''
+    substituteInPlace "$out/lib/cmake/llvm/LLVMExports-${if debugVersion then "debug" else "release"}.cmake" \
+      --replace "\''${_IMPORT_PREFIX}/lib/libLLVM.dylib" "$lib/lib/libLLVM.dylib"
+    ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${shortVersion}.dylib
+    ln -s $lib/lib/libLLVM.dylib $lib/lib/libLLVM-${release_version}.dylib
+  '';
+
+  doCheck = stdenv.isLinux && (!stdenv.isi686);
+
+  checkTarget = "check-all";
+
+  enableParallelBuilding = true;
+
+  passthru.src = src;
+
+  meta = {
+    description = "Collection of modular and reusable compiler and toolchain technologies";
+    homepage    = http://llvm.org/;
+    license     = stdenv.lib.licenses.ncsa;
+    maintainers = with stdenv.lib.maintainers; [ lovek323 raskin dtzWill ];
+    platforms   = stdenv.lib.platforms.all;
+  };
+} // stdenv.lib.optionalAttrs enableManpages {
+  name = "llvm-manpages-${version}";
+
+  buildPhase = ''
+    make docs-llvm-man
+  '';
+
+  propagatedBuildInputs = [];
+
+  installPhase = ''
+    make -C docs install
+  '';
+
+  postPatch = null;
+  postInstall = null;
+
+  outputs = [ "out" ];
+
+  doCheck = false;
+
+  meta.description = "man pages for LLVM ${version}";
+})
diff --git a/pkgs/development/compilers/llvm/7/openmp.nix b/pkgs/development/compilers/llvm/7/openmp.nix
new file mode 100644
index 000000000000..31059b7c4c04
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/openmp.nix
@@ -0,0 +1,25 @@
+{ stdenv
+, fetch
+, cmake
+, llvm
+, perl
+, version
+}:
+
+stdenv.mkDerivation {
+  name = "openmp-${version}";
+
+  src = fetch "openmp" "1zrqlaxr954sp8lcr7g8m0z0pr8xyq4i6p11x6gcamjm5xijnrih";
+
+  nativeBuildInputs = [ cmake perl ];
+  buildInputs = [ llvm ];
+
+  enableParallelBuilding = true;
+
+  meta = {
+    description = "Components required to build an executable OpenMP program";
+    homepage    = http://openmp.llvm.org/;
+    license     = stdenv.lib.licenses.mit;
+    platforms   = stdenv.lib.platforms.all;
+  };
+}
diff --git a/pkgs/development/compilers/llvm/7/sanitizers-nongnu.patch b/pkgs/development/compilers/llvm/7/sanitizers-nongnu.patch
new file mode 100644
index 000000000000..6266eb1958d1
--- /dev/null
+++ b/pkgs/development/compilers/llvm/7/sanitizers-nongnu.patch
@@ -0,0 +1,413 @@
+From 7b4b3333a2718628b1d510ec1d8438ad67308299 Mon Sep 17 00:00:00 2001
+From: Will Dietz <w@wdtz.org>
+Date: Fri, 29 Jun 2018 09:48:59 -0500
+Subject: [PATCH] Ported to 6.0, taken from gentoo-musl project.
+
+------
+Ported to compiler-rt-sanitizers-5.0.0. Taken from
+
+https://gist.githubusercontent.com/pwaller/2337f3290f12634cad3e3730cff0a6c1/raw/83c87a8585e2f9662494db5662e5361beb093c26/nongnu.patch
+Signed-off-by: Jory A. Pratt <anarchy@gentoo.org>
+
+Taken from gentoo-musl project, with a few additional minor fixes.
+---
+ lib/asan/asan_linux.cc                        |  4 +-
+ lib/interception/interception_linux.cc        |  2 +-
+ lib/interception/interception_linux.h         |  3 +-
+ lib/msan/msan_linux.cc                        |  2 +-
+ lib/sanitizer_common/sanitizer_allocator.cc   |  2 +-
+ .../sanitizer_common_interceptors_ioctl.inc   |  4 +-
+ .../sanitizer_common_syscalls.inc             |  2 +-
+ lib/sanitizer_common/sanitizer_linux.cc       |  8 +++-
+ .../sanitizer_linux_libcdep.cc                | 10 ++---
+ lib/sanitizer_common/sanitizer_platform.h     |  6 +++
+ .../sanitizer_platform_interceptors.h         |  4 +-
+ .../sanitizer_platform_limits_posix.cc        | 37 +++++++++++--------
+ lib/tsan/rtl/tsan_platform_linux.cc           |  2 +-
+ 13 files changed, 51 insertions(+), 35 deletions(-)
+
+diff --git a/lib/asan/asan_linux.cc b/lib/asan/asan_linux.cc
+index 625f32d40..73cf77aca 100644
+--- a/lib/asan/asan_linux.cc
++++ b/lib/asan/asan_linux.cc
+@@ -46,7 +46,7 @@
+ #include <link.h>
+ #endif
+ 
+-#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_SOLARIS
++#if SANITIZER_ANDROID || SANITIZER_FREEBSD || SANITIZER_SOLARIS || SANITIZER_NONGNU
+ #include <ucontext.h>
+ extern "C" void* _DYNAMIC;
+ #elif SANITIZER_NETBSD
+@@ -139,7 +139,7 @@ void AsanApplyToGlobals(globals_op_fptr op, const void *needle) {
+   UNIMPLEMENTED();
+ }
+ 
+-#if SANITIZER_ANDROID
++#if SANITIZER_ANDROID || SANITIZER_NONGNU
+ // FIXME: should we do anything for Android?
+ void AsanCheckDynamicRTPrereqs() {}
+ void AsanCheckIncompatibleRT() {}
+diff --git a/lib/interception/interception_linux.cc b/lib/interception/interception_linux.cc
+index c991550a4..2b706418b 100644
+--- a/lib/interception/interception_linux.cc
++++ b/lib/interception/interception_linux.cc
+@@ -43,7 +43,7 @@ bool GetRealFunctionAddress(const char *func_name, uptr *func_addr,
+ }
+ 
+ // Android and Solaris do not have dlvsym
+-#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS
++#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS && !SANITIZER_NONGNU
+ void *GetFuncAddrVer(const char *func_name, const char *ver) {
+   return dlvsym(RTLD_NEXT, func_name, ver);
+ }
+diff --git a/lib/interception/interception_linux.h b/lib/interception/interception_linux.h
+index 98fe51b85..c13302b98 100644
+--- a/lib/interception/interception_linux.h
++++ b/lib/interception/interception_linux.h
+@@ -35,8 +35,7 @@ void *GetFuncAddrVer(const char *func_name, const char *ver);
+       (::__interception::uptr) & (func),                                   \
+       (::__interception::uptr) & WRAP(func))
+ 
+-// Android and Solaris do not have dlvsym
+-#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS
++#if !SANITIZER_ANDROID && !SANITIZER_SOLARIS && !SANITIZER_NONGNU
+ #define INTERCEPT_FUNCTION_VER_LINUX_OR_FREEBSD(func, symver) \
+   (::__interception::real_##func = (func##_f)(                \
+        unsigned long)::__interception::GetFuncAddrVer(#func, symver))
+diff --git a/lib/msan/msan_linux.cc b/lib/msan/msan_linux.cc
+index 4e6321fcb..4d50feb82 100644
+--- a/lib/msan/msan_linux.cc
++++ b/lib/msan/msan_linux.cc
+@@ -13,7 +13,7 @@
+ //===----------------------------------------------------------------------===//
+ 
+ #include "sanitizer_common/sanitizer_platform.h"
+-#if SANITIZER_FREEBSD || SANITIZER_LINUX || SANITIZER_NETBSD
++#if SANITIZER_FREEBSD || (SANITIZER_LINUX && !SANITIZER_NONGNU) || SANITIZER_NETBSD
+ 
+ #include "msan.h"
+ #include "msan_thread.h"
+diff --git a/lib/sanitizer_common/sanitizer_allocator.cc b/lib/sanitizer_common/sanitizer_allocator.cc
+index fc4f7a75a..76cf4f769 100644
+--- a/lib/sanitizer_common/sanitizer_allocator.cc
++++ b/lib/sanitizer_common/sanitizer_allocator.cc
+@@ -23,7 +23,7 @@ namespace __sanitizer {
+ 
+ // ThreadSanitizer for Go uses libc malloc/free.
+ #if SANITIZER_GO || defined(SANITIZER_USE_MALLOC)
+-# if SANITIZER_LINUX && !SANITIZER_ANDROID
++# if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
+ extern "C" void *__libc_malloc(uptr size);
+ #  if !SANITIZER_GO
+ extern "C" void *__libc_memalign(uptr alignment, uptr size);
+diff --git a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
+index 24e7548a5..20259b1d6 100644
+--- a/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
++++ b/lib/sanitizer_common/sanitizer_common_interceptors_ioctl.inc
+@@ -102,7 +102,7 @@ static void ioctl_table_fill() {
+   _(SIOCGETVIFCNT, WRITE, struct_sioc_vif_req_sz);
+ #endif
+ 
+-#if SANITIZER_LINUX
++#if SANITIZER_LINUX && !SANITIZER_NONGNU
+   // Conflicting request ids.
+   // _(CDROMAUDIOBUFSIZ, NONE, 0);
+   // _(SNDCTL_TMR_CONTINUE, NONE, 0);
+@@ -363,7 +363,7 @@ static void ioctl_table_fill() {
+   _(VT_WAITACTIVE, NONE, 0);
+ #endif
+ 
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
+   // _(SIOCDEVPLIP, WRITE, struct_ifreq_sz); // the same as EQL_ENSLAVE
+   _(CYGETDEFTHRESH, WRITE, sizeof(int));
+   _(CYGETDEFTIMEOUT, WRITE, sizeof(int));
+diff --git a/lib/sanitizer_common/sanitizer_common_syscalls.inc b/lib/sanitizer_common/sanitizer_common_syscalls.inc
+index 469c8eb7e..24f87867d 100644
+--- a/lib/sanitizer_common/sanitizer_common_syscalls.inc
++++ b/lib/sanitizer_common/sanitizer_common_syscalls.inc
+@@ -2038,7 +2038,7 @@ POST_SYSCALL(setrlimit)(long res, long resource, void *rlim) {
+   }
+ }
+ 
+-#if !SANITIZER_ANDROID
++#if !SANITIZER_ANDROID && !SANITIZER_NONGNU
+ PRE_SYSCALL(prlimit64)(long pid, long resource, const void *new_rlim,
+                        void *old_rlim) {
+   if (new_rlim) PRE_READ(new_rlim, struct_rlimit64_sz);
+diff --git a/lib/sanitizer_common/sanitizer_linux.cc b/lib/sanitizer_common/sanitizer_linux.cc
+index 6c83e8db4..542c4fe64 100644
+--- a/lib/sanitizer_common/sanitizer_linux.cc
++++ b/lib/sanitizer_common/sanitizer_linux.cc
+@@ -522,13 +522,13 @@ const char *GetEnv(const char *name) {
+ #endif
+ }
+ 
+-#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD
++#if !SANITIZER_FREEBSD && !SANITIZER_NETBSD && !SANITIZER_NONGNU
+ extern "C" {
+   SANITIZER_WEAK_ATTRIBUTE extern void *__libc_stack_end;
+ }
+ #endif
+ 
+-#if !SANITIZER_GO && !SANITIZER_FREEBSD && !SANITIZER_NETBSD
++#if (!SANITIZER_GO || SANITIZER_NONGNU) && !SANITIZER_FREEBSD && !SANITIZER_NETBSD
+ static void ReadNullSepFileToArray(const char *path, char ***arr,
+                                    int arr_size) {
+   char *buff;
+@@ -569,6 +569,10 @@ static void GetArgsAndEnv(char ***argv, char ***envp) {
+ #elif SANITIZER_NETBSD
+   *argv = __ps_strings->ps_argvstr;
+   *argv = __ps_strings->ps_envstr;
++#elif SANITIZER_NONGNU
++    static const int kMaxArgv = 2000, kMaxEnvp = 2000;
++    ReadNullSepFileToArray("/proc/self/cmdline", argv, kMaxArgv);
++    ReadNullSepFileToArray("/proc/self/environ", envp, kMaxEnvp);
+ #else
+ #if !SANITIZER_GO
+   if (&__libc_stack_end) {
+diff --git a/lib/sanitizer_common/sanitizer_linux_libcdep.cc b/lib/sanitizer_common/sanitizer_linux_libcdep.cc
+index 56fdfc870..a932d5db1 100644
+--- a/lib/sanitizer_common/sanitizer_linux_libcdep.cc
++++ b/lib/sanitizer_common/sanitizer_linux_libcdep.cc
+@@ -174,7 +174,7 @@ bool SanitizerGetThreadName(char *name, int max_len) {
+ }
+ 
+ #if !SANITIZER_FREEBSD && !SANITIZER_ANDROID && !SANITIZER_GO && \
+-    !SANITIZER_NETBSD && !SANITIZER_SOLARIS
++    !SANITIZER_NETBSD && !SANITIZER_SOLARIS && !SANITIZER_NONGNU
+ static uptr g_tls_size;
+ 
+ #ifdef __i386__
+@@ -207,7 +207,7 @@ void InitTlsSize() { }
+ 
+ #if (defined(__x86_64__) || defined(__i386__) || defined(__mips__) \
+     || defined(__aarch64__) || defined(__powerpc64__) || defined(__s390__) \
+-    || defined(__arm__)) && SANITIZER_LINUX && !SANITIZER_ANDROID
++    || defined(__arm__)) && SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
+ // sizeof(struct pthread) from glibc.
+ static atomic_uintptr_t kThreadDescriptorSize;
+ 
+@@ -391,7 +391,7 @@ int GetSizeFromHdr(struct dl_phdr_info *info, size_t size, void *data) {
+ 
+ #if !SANITIZER_GO
+ static void GetTls(uptr *addr, uptr *size) {
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
+ # if defined(__x86_64__) || defined(__i386__) || defined(__s390__)
+   *addr = ThreadSelf();
+   *size = GetTlsSize();
+@@ -432,7 +432,7 @@ static void GetTls(uptr *addr, uptr *size) {
+       *addr = (uptr)tcb->tcb_dtv[1];
+     }
+   }
+-#elif SANITIZER_ANDROID
++#elif SANITIZER_ANDROID || SANITIZER_NONGNU
+   *addr = 0;
+   *size = 0;
+ #elif SANITIZER_SOLARIS
+@@ -448,7 +448,7 @@ static void GetTls(uptr *addr, uptr *size) {
+ #if !SANITIZER_GO
+ uptr GetTlsSize() {
+ #if SANITIZER_FREEBSD || SANITIZER_ANDROID || SANITIZER_NETBSD || \
+-    SANITIZER_SOLARIS
++    SANITIZER_SOLARIS || SANITIZER_NONGNU
+   uptr addr, size;
+   GetTls(&addr, &size);
+   return size;
+diff --git a/lib/sanitizer_common/sanitizer_platform.h b/lib/sanitizer_common/sanitizer_platform.h
+index 334903c26..fc2afac2c 100644
+--- a/lib/sanitizer_common/sanitizer_platform.h
++++ b/lib/sanitizer_common/sanitizer_platform.h
+@@ -195,6 +195,12 @@
+ # define SANITIZER_SOLARIS32 0
+ #endif
+ 
++#if defined(__linux__) && !defined(__GLIBC__)
++# define SANITIZER_NONGNU 1
++#else
++# define SANITIZER_NONGNU 0
++#endif
++
+ // By default we allow to use SizeClassAllocator64 on 64-bit platform.
+ // But in some cases (e.g. AArch64's 39-bit address space) SizeClassAllocator64
+ // does not work well and we need to fallback to SizeClassAllocator32.
+diff --git a/lib/sanitizer_common/sanitizer_platform_interceptors.h b/lib/sanitizer_common/sanitizer_platform_interceptors.h
+index b99ac4480..628d226a1 100644
+--- a/lib/sanitizer_common/sanitizer_platform_interceptors.h
++++ b/lib/sanitizer_common/sanitizer_platform_interceptors.h
+@@ -38,7 +38,7 @@
+ # include "sanitizer_platform_limits_solaris.h"
+ #endif
+ 
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
+ # define SI_LINUX_NOT_ANDROID 1
+ #else
+ # define SI_LINUX_NOT_ANDROID 0
+@@ -291,7 +291,7 @@
+   (SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
+ #define SANITIZER_INTERCEPT_ETHER_R (SI_FREEBSD || SI_LINUX_NOT_ANDROID)
+ #define SANITIZER_INTERCEPT_SHMCTL                       \
+-  (SI_NETBSD || SI_SOLARIS || ((SI_FREEBSD || SI_LINUX_NOT_ANDROID) && \
++  (SI_NETBSD || SI_SOLARIS || ((SI_FREEBSD || SI_LINUX_NOT_ANDROID || SANITIZER_NONGNU) && \
+                  SANITIZER_WORDSIZE == 64))  // NOLINT
+ #define SANITIZER_INTERCEPT_RANDOM_R SI_LINUX_NOT_ANDROID
+ #define SANITIZER_INTERCEPT_PTHREAD_ATTR_GET SI_POSIX
+diff --git a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+index feb7bad6f..4e89ab2a6 100644
+--- a/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
++++ b/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
+@@ -14,6 +14,9 @@
+ 
+ #include "sanitizer_platform.h"
+ 
++// Workaround musl <--> linux conflicting definition of 'struct sysinfo'
++#define _LINUX_SYSINFO_H
++
+ #if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_MAC
+ // Tests in this file assume that off_t-dependent data structures match the
+ // libc ABI. For example, struct dirent here is what readdir() function (as
+@@ -138,12 +141,14 @@ typedef struct user_fpregs elf_fpregset_t;
+ 
+ #if SANITIZER_LINUX && !SANITIZER_ANDROID
+ #include <glob.h>
+-#include <obstack.h>
++#  if !SANITIZER_NONGNU
++#    include <obstack.h>
++#  endif
+ #include <mqueue.h>
+-#include <net/if_ppp.h>
+-#include <netax25/ax25.h>
+-#include <netipx/ipx.h>
+-#include <netrom/netrom.h>
++#include <linux/if_ppp.h>
++#include <linux/ax25.h>
++#include <linux/ipx.h>
++#include <linux/netrom.h>
+ #if HAVE_RPC_XDR_H
+ # include <rpc/xdr.h>
+ #elif HAVE_TIRPC_RPC_XDR_H
+@@ -251,7 +256,7 @@ namespace __sanitizer {
+   unsigned struct_itimerspec_sz = sizeof(struct itimerspec);
+ #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
+ 
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
+   // Use pre-computed size of struct ustat to avoid <sys/ustat.h> which
+   // has been removed from glibc 2.28.
+ #if defined(__aarch64__) || defined(__s390x__) || defined (__mips64) \
+@@ -322,7 +327,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(ElfW(Phdr));
+ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
+ #endif
+ 
+-#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
++#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU
+   int glob_nomatch = GLOB_NOMATCH;
+   int glob_altdirfunc = GLOB_ALTDIRFUNC;
+ #endif
+@@ -416,7 +421,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
+   unsigned struct_termios_sz = sizeof(struct termios);
+   unsigned struct_winsize_sz = sizeof(struct winsize);
+ 
+-#if SANITIZER_LINUX
++#if SANITIZER_LINUX && !SANITIZER_NONGNU
+   unsigned struct_arpreq_sz = sizeof(struct arpreq);
+   unsigned struct_cdrom_msf_sz = sizeof(struct cdrom_msf);
+   unsigned struct_cdrom_multisession_sz = sizeof(struct cdrom_multisession);
+@@ -466,7 +471,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
+   unsigned struct_vt_mode_sz = sizeof(struct vt_mode);
+ #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
+ 
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
+   unsigned struct_ax25_parms_struct_sz = sizeof(struct ax25_parms_struct);
+   unsigned struct_cyclades_monitor_sz = sizeof(struct cyclades_monitor);
+ #if EV_VERSION > (0x010000)
+@@ -834,7 +839,7 @@ unsigned struct_ElfW_Phdr_sz = sizeof(Elf_Phdr);
+   unsigned IOCTL_VT_WAITACTIVE = VT_WAITACTIVE;
+ #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
+ 
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
+   unsigned IOCTL_CYGETDEFTHRESH = CYGETDEFTHRESH;
+   unsigned IOCTL_CYGETDEFTIMEOUT = CYGETDEFTIMEOUT;
+   unsigned IOCTL_CYGETMON = CYGETMON;
+@@ -989,7 +994,7 @@ CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phdr);
+ CHECK_SIZE_AND_OFFSET(dl_phdr_info, dlpi_phnum);
+ #endif // SANITIZER_LINUX || SANITIZER_FREEBSD
+ 
+-#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
++#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU
+ CHECK_TYPE_SIZE(glob_t);
+ CHECK_SIZE_AND_OFFSET(glob_t, gl_pathc);
+ CHECK_SIZE_AND_OFFSET(glob_t, gl_pathv);
+@@ -1023,6 +1028,7 @@ CHECK_TYPE_SIZE(iovec);
+ CHECK_SIZE_AND_OFFSET(iovec, iov_base);
+ CHECK_SIZE_AND_OFFSET(iovec, iov_len);
+ 
++#if !SANITIZER_NONGNU
+ CHECK_TYPE_SIZE(msghdr);
+ CHECK_SIZE_AND_OFFSET(msghdr, msg_name);
+ CHECK_SIZE_AND_OFFSET(msghdr, msg_namelen);
+@@ -1036,6 +1042,7 @@ CHECK_TYPE_SIZE(cmsghdr);
+ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_len);
+ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_level);
+ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
++#endif
+ 
+ COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent));
+ CHECK_SIZE_AND_OFFSET(dirent, d_ino);
+@@ -1138,7 +1145,7 @@ CHECK_SIZE_AND_OFFSET(mntent, mnt_passno);
+ 
+ CHECK_TYPE_SIZE(ether_addr);
+ 
+-#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID
++#if (SANITIZER_LINUX || SANITIZER_FREEBSD) && !SANITIZER_ANDROID && !SANITIZER_NONGNU
+ CHECK_TYPE_SIZE(ipc_perm);
+ # if SANITIZER_FREEBSD
+ CHECK_SIZE_AND_OFFSET(ipc_perm, key);
+@@ -1199,7 +1206,7 @@ CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_dstaddr);
+ CHECK_SIZE_AND_OFFSET(ifaddrs, ifa_data);
+ #endif
+ 
+-#if SANITIZER_LINUX
++#if SANITIZER_LINUX && !SANITIZER_NONGNU
+ COMPILER_CHECK(sizeof(__sanitizer_mallinfo) == sizeof(struct mallinfo));
+ #endif
+ 
+@@ -1249,7 +1256,7 @@ COMPILER_CHECK(__sanitizer_XDR_DECODE == XDR_DECODE);
+ COMPILER_CHECK(__sanitizer_XDR_FREE == XDR_FREE);
+ #endif
+ 
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
+ COMPILER_CHECK(sizeof(__sanitizer_FILE) <= sizeof(FILE));
+ CHECK_SIZE_AND_OFFSET(FILE, _flags);
+ CHECK_SIZE_AND_OFFSET(FILE, _IO_read_ptr);
+@@ -1268,7 +1275,7 @@ CHECK_SIZE_AND_OFFSET(FILE, _chain);
+ CHECK_SIZE_AND_OFFSET(FILE, _fileno);
+ #endif
+ 
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
+ COMPILER_CHECK(sizeof(__sanitizer__obstack_chunk) <= sizeof(_obstack_chunk));
+ CHECK_SIZE_AND_OFFSET(_obstack_chunk, limit);
+ CHECK_SIZE_AND_OFFSET(_obstack_chunk, prev);
+diff --git a/lib/tsan/rtl/tsan_platform_linux.cc b/lib/tsan/rtl/tsan_platform_linux.cc
+index e14d5f575..389a3bc88 100644
+--- a/lib/tsan/rtl/tsan_platform_linux.cc
++++ b/lib/tsan/rtl/tsan_platform_linux.cc
+@@ -285,7 +285,7 @@ void InitializePlatform() {
+ // This is required to properly "close" the fds, because we do not see internal
+ // closes within glibc. The code is a pure hack.
+ int ExtractResolvFDs(void *state, int *fds, int nfd) {
+-#if SANITIZER_LINUX && !SANITIZER_ANDROID
++#if SANITIZER_LINUX && !SANITIZER_ANDROID && !SANITIZER_NONGNU
+   int cnt = 0;
+   struct __res_state *statp = (struct __res_state*)state;
+   for (int i = 0; i < MAXNS && cnt < nfd; i++) {
+-- 
+2.18.0
+
diff --git a/pkgs/development/compilers/rust/bootstrap.nix b/pkgs/development/compilers/rust/bootstrap.nix
index 901675ff31b4..55348c5795ad 100644
--- a/pkgs/development/compilers/rust/bootstrap.nix
+++ b/pkgs/development/compilers/rust/bootstrap.nix
@@ -3,16 +3,16 @@
 let
   # Note: the version MUST be one version prior to the version we're
   # building
-  version = "1.26.2";
+  version = "1.28.0";
 
   # fetch hashes by running `print-hashes.sh 1.24.1`
   hashes = {
-    i686-unknown-linux-gnu = "e22286190a074bfb6d47c9fde236d712a53675af1563ba85ea33e0d40165f755";
-    x86_64-unknown-linux-gnu = "d2b4fb0c544874a73c463993bde122f031c34897bb1eeb653d2ba2b336db83e6";
-    armv7-unknown-linux-gnueabihf = "1140387a61083e3ef10e7a097269200fc7e9db6f6cc9f270e04319b3b429c655";
-    aarch64-unknown-linux-gnu = "3dfad0dc9c795f7ee54c2099c9b7edf06b942adbbf02e9ed9e5d4b5e3f1f3759";
-    i686-apple-darwin = "3a5de30f3e334a66bd320ec0e954961d348434da39a826284e00d55ea60f8370";
-    x86_64-apple-darwin = "f193705d4c0572a358670dbacbf0ffadcd04b3989728b442f4680fa1e065fa72";
+    i686-unknown-linux-gnu = "de7cdb4e665e897ea9b10bf6fd545f900683296456d6a11d8510397bb330455f";
+    x86_64-unknown-linux-gnu = "2a1390340db1d24a9498036884e6b2748e9b4b057fc5219694e298bdaa37b810";
+    armv7-unknown-linux-gnueabihf = "346558d14050853b87049e5e1fbfae0bf0360a2f7c57433c6985b1a879c349a2";
+    aarch64-unknown-linux-gnu = "9b6fbcee73070332c811c0ddff399fa31965bec62ef258656c0c90354f6231c1";
+    i686-apple-darwin = "752e2c9182e057c4a54152d1e0b3949482c225d02bb69d9d9a4127dc2a65fb68";
+    x86_64-apple-darwin = "5d7a70ed4701fe9410041c1eea025c95cad97e5b3d8acc46426f9ac4f9f02393";
   };
 
   platform =
diff --git a/pkgs/development/compilers/rust/cargo.nix b/pkgs/development/compilers/rust/cargo.nix
index 34932c911ebc..25a71965e0b4 100644
--- a/pkgs/development/compilers/rust/cargo.nix
+++ b/pkgs/development/compilers/rust/cargo.nix
@@ -28,6 +28,9 @@ rustPlatform.buildRustPackage rec {
 
   LIBGIT2_SYS_USE_PKG_CONFIG=1;
 
+  # fixes: the cargo feature `edition` requires a nightly version of Cargo, but this is the `stable` channel
+  RUSTC_BOOTSTRAP=1;
+
   # FIXME: Use impure version of CoreFoundation because of missing symbols.
   # CFURLSetResourcePropertyForKey is defined in the headers but there's no
   # corresponding implementation in the sources from opensource.apple.com.
diff --git a/pkgs/development/compilers/rust/default.nix b/pkgs/development/compilers/rust/default.nix
index d368c977f8f8..47415ac9177b 100644
--- a/pkgs/development/compilers/rust/default.nix
+++ b/pkgs/development/compilers/rust/default.nix
@@ -6,11 +6,11 @@
 
 let
   rustPlatform = recurseIntoAttrs (makeRustPlatform (callPackage ./bootstrap.nix {}));
-  version = "1.27.0";
-  cargoVersion = "1.27.0";
+  version = "1.29.0";
+  cargoVersion = "1.29.0";
   src = fetchurl {
     url = "https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz";
-    sha256 = "089d7rhw55zpvnw71dj8vil6qrylvl4xjr4m8bywjj83d4zq1f9c";
+    sha256 = "1sb15znckj8pc8q3g7cq03pijnida6cg64yqmgiayxkzskzk9sx4";
   };
 in rec {
   rustc = callPackage ./rustc.nix {
diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix
index 9c9788ff4834..a054ed0eb557 100644
--- a/pkgs/development/compilers/rust/rustc.nix
+++ b/pkgs/development/compilers/rust/rustc.nix
@@ -105,6 +105,11 @@ stdenv.mkDerivation {
     # On Hydra: `TcpListener::bind(&addr)`: Address already in use (os error 98)'
     sed '/^ *fn fast_rebind()/i#[ignore]' -i src/libstd/net/tcp.rs
 
+    # https://github.com/rust-lang/rust/issues/39522
+    echo removing gdb-version-sensitive tests...
+    find src/test/debuginfo -type f -execdir grep -q ignore-gdb-version '{}' \; -print -delete
+    rm src/test/debuginfo/{borrowed-c-style-enum.rs,c-style-enum-in-composite.rs,gdb-pretty-struct-and-enums-pre-gdb-7-7.rs,generic-enum-with-different-disr-sizes.rs}
+
     # Useful debugging parameter
     # export VERBOSE=1
   '' + optionalString stdenv.isDarwin ''
diff --git a/pkgs/development/compilers/vala/default.nix b/pkgs/development/compilers/vala/default.nix
index a4a8aa980b62..fb2d9fc535af 100644
--- a/pkgs/development/compilers/vala/default.nix
+++ b/pkgs/development/compilers/vala/default.nix
@@ -45,20 +45,20 @@ let
 in rec {
   vala_0_34 = generic {
     major   = "0.34";
-    minor   = "17";
-    sha256  = "0wd2zxww4z1ys4iqz218lvzjqjjqwsaad4x2by8pcyy43sbr7qp2";
+    minor   = "18";
+    sha256  = "1lhw3ghns059y5d6pdldy5p4yjwlhcls84k892i6qmbhxg34945q";
   };
 
   vala_0_36 = generic {
     major   = "0.36";
-    minor   = "13";
-    sha256  = "0gxz7yisd9vh5d2889p60knaifz5zndgj98zkdfkkaykdfdq4m9k";
+    minor   = "15";
+    sha256  = "11lnwjbhiz2l7g6y1f0jb0s81ymgssinlil3alibzcwmzpk175ix";
   };
 
   vala_0_38 = generic {
     major   = "0.38";
-    minor   = "9";
-    sha256  = "1dh1qacfsc1nr6hxwhn9lqmhnq39rv8gxbapdmj1v65zs96j3fn3";
+    minor   = "10";
+    sha256  = "1rdwwqs973qv225v8b5izcgwvqn56jxgr4pa3wxxbliar3aww5sw";
     extraNativeBuildInputs = [ autoconf ] ++ lib.optional stdenv.isDarwin libtool;
   };
 
diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix
index 64a82ed42a87..8beca9572e7e 100644
--- a/pkgs/development/haskell-modules/configuration-common.nix
+++ b/pkgs/development/haskell-modules/configuration-common.nix
@@ -927,8 +927,9 @@ self: super: {
   text-icu = dontCheck super.text-icu;
 
   # https://github.com/haskell/cabal/issues/4969
-  haddock-library_1_4_4 = dontHaddock super.haddock-library_1_4_4;
-  haddock-api = super.haddock-api.override { haddock-library = self.haddock-library_1_4_4; };
+  haddock-api = (super.haddock-api.overrideScope (self: super: {
+    haddock-library = self.haddock-library_1_6_0;
+  })).override { hspec = self.hspec_2_4_8; };
 
   # Jailbreak "unix-compat >=0.1.2 && <0.5".
   # Jailbreak "graphviz >=2999.18.1 && <2999.20".
@@ -1112,7 +1113,7 @@ self: super: {
     })) ./patches/sexpr-0.2.1.patch;
 
   # Can be removed once yi-language >= 0.18 is in the LTS
-  yi-core = super.yi-core.override { yi-language = self.yi-language_0_18_0; };
+  yi-core = super.yi-core.overrideScope (self: super: { yi-language = self.yi-language_0_18_0; });
 
   # https://github.com/MarcWeber/hasktags/issues/52
   hasktags = dontCheck super.hasktags;
@@ -1124,11 +1125,11 @@ self: super: {
   xmlhtml = doJailbreak super.xmlhtml;
 
   # https://github.com/NixOS/nixpkgs/issues/46467
-  safe-money-aeson = super.safe-money-aeson.override { safe-money = self.safe-money_0_7; };
-  safe-money-store = super.safe-money-store.override { safe-money = self.safe-money_0_7; };
-  safe-money-cereal = super.safe-money-cereal.override { safe-money = self.safe-money_0_7; };
-  safe-money-serialise = super.safe-money-serialise.override { safe-money = self.safe-money_0_7; };
-  safe-money-xmlbf = super.safe-money-xmlbf.override { safe-money = self.safe-money_0_7; };
+  safe-money-aeson = super.safe-money-aeson.overrideScope (self: super: { safe-money = self.safe-money_0_7; });
+  safe-money-store = super.safe-money-store.overrideScope (self: super: { safe-money = self.safe-money_0_7; });
+  safe-money-cereal = super.safe-money-cereal.overrideScope (self: super: { safe-money = self.safe-money_0_7; });
+  safe-money-serialise = super.safe-money-serialise.overrideScope (self: super: { safe-money = self.safe-money_0_7; });
+  safe-money-xmlbf = super.safe-money-xmlbf.overrideScope (self: super: { safe-money = self.safe-money_0_7; });
 
   # https://github.com/adinapoli/mandrill/pull/52
   mandrill = appendPatch super.mandrill (pkgs.fetchpatch {
@@ -1136,4 +1137,17 @@ self: super: {
     sha256 = "1qair09xs6vln3vsjz7sy4hhv037146zak4mq3iv6kdhmp606hqv";
   });
 
+  # Can be removed once vinyl >= 0.10 is in the LTS.
+  Frames = super.Frames.overrideScope (self: super: { vinyl = self.vinyl_0_10_0; });
+
+  # https://github.com/Euterpea/Euterpea2/pull/22
+  Euterpea = overrideSrc super.Euterpea {
+    src = pkgs.fetchFromGitHub {
+      owner = "Euterpea";
+      repo = "Euterpea2";
+      rev = "6f49b790adfb8b65d95a758116c20098fb0cd34c";
+      sha256 = "0qz1svb96n42nmig16vyphwxas34hypgayvwc91ri7w7xd6yi1ba";
+    };
+  };
+
 } // import ./configuration-tensorflow.nix {inherit pkgs haskellLib;} self super
diff --git a/pkgs/development/haskell-modules/configuration-hackage2nix.yaml b/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
index 2eefe636ca97..7f9e31432892 100644
--- a/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
+++ b/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
@@ -2400,7 +2400,6 @@ extra-packages:
   - haddock-api == 2.17.*               # required on GHC 8.0.x
   - haddock-library == 1.2.*            # required for haddock-api-2.16.x
   - haddock-library == 1.4.3            # required for haddock-api-2.17.x
-  - haddock-library == 1.4.4            # required for haddock-api-2.18.x
   - haddock-library == 1.5.*            # required for stylish-cabal-0.4.0.1
   - happy <1.19.6                       # newer versions break Agda
   - haskell-gi-overloading == 0.0       # gi-* packages use this dependency to disable overloading support
diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix
index c3df7d38bfd0..43ba2d000eb5 100644
--- a/pkgs/development/haskell-modules/configuration-nix.nix
+++ b/pkgs/development/haskell-modules/configuration-nix.nix
@@ -517,4 +517,7 @@ self: super: builtins.intersectAttrs super {
     postPatch = ''
       sed -i -e 's|"z3"|"${pkgs.z3}/bin/z3"|' Data/SBV/Provers/Z3.hs'';
   });
+
+  # The test-suite requires a running PostgreSQL server.
+  Frames-beam = dontCheck super.Frames-beam;
 }
diff --git a/pkgs/development/interpreters/erlang/R18.nix b/pkgs/development/interpreters/erlang/R18.nix
index ee524feb4c6c..58b7fd71f0be 100644
--- a/pkgs/development/interpreters/erlang/R18.nix
+++ b/pkgs/development/interpreters/erlang/R18.nix
@@ -11,6 +11,16 @@ let
      sha256 = "00fx5wc88ki3z71z5q4xzi9h3whhjw1zblpn09w995ygn07m9qhm";
   };
 
+  makeOrderingPatch = fetchpatch {
+     url = "https://github.com/erlang/otp/commit/2f1a37f1011ff9d129bc35a6efa0ab937a2aa0e9.patch";
+     sha256 = "0xfa6hzxh9d7qllkyidcgh57xrrx11w65y7s1hyg52alm06l6b9n";
+  };
+
+  makeParallelInstallPatch = fetchpatch {
+     url ="https://github.com/erlang/otp/commit/de8fe86f67591dd992bae33f7451523dab36e5bd.patch";
+     sha256 = "1cj9fjhdng6yllajjm3gkk04ag9bwyb3n70hrb5nk6c292v8a45c";
+  };
+
 in mkDerivation rec {
   version = "18.3.4.8";
   sha256 = "16c0h25hh5yvkv436ks5jbd7qmxzb6ndvk64mr404347a20iib0g";
@@ -18,5 +28,7 @@ in mkDerivation rec {
   patches = [
     rmAndPwdPatch
     envAndCpPatch
+    makeOrderingPatch
+    makeParallelInstallPatch
   ];
 }
diff --git a/pkgs/development/interpreters/perl/default.nix b/pkgs/development/interpreters/perl/default.nix
index ec4f971eeeff..e4eca36b266b 100644
--- a/pkgs/development/interpreters/perl/default.nix
+++ b/pkgs/development/interpreters/perl/default.nix
@@ -37,6 +37,8 @@ let
       stdenv.lib.optional crossCompiling "dev";
     setOutputFlags = false;
 
+    disallowedReferences = [ stdenv.cc ];
+
     patches =
       [ ]
       # Do not look in /usr etc. for dependencies.
@@ -118,6 +120,7 @@ let
           --replace "${
               if stdenv.cc.cc or null != null then stdenv.cc.cc else "/no-such-path"
             }" /no-such-path \
+          --replace "${stdenv.cc}" /no-such-path \
           --replace "$man" /no-such-path
       '' + stdenv.lib.optionalString crossCompiling
       ''
diff --git a/pkgs/development/interpreters/php/default.nix b/pkgs/development/interpreters/php/default.nix
index 5af569a5e7c8..67c38a354b43 100644
--- a/pkgs/development/interpreters/php/default.nix
+++ b/pkgs/development/interpreters/php/default.nix
@@ -133,6 +133,7 @@ let
       ++ optionals mysqliSupport [
         "--with-mysqli=${if mysqlndSupport then "mysqlnd" else "${mysql.connector-c}/bin/mysql_config"}"
       ]
+      ++ optional ( pdo_mysqlSupport || mysqlSupport || mysqliSupport ) "--with-mysql-sock=/run/mysqld/mysqld.sock"
       ++ optional bcmathSupport "--enable-bcmath"
       # FIXME: Our own gd package doesn't work, see https://bugs.php.net/bug.php?id=60108.
       ++ optionals gdSupport [
diff --git a/pkgs/development/interpreters/python/cpython/2.7/boot.nix b/pkgs/development/interpreters/python/cpython/2.7/boot.nix
index 7d6f2541d3d1..976d30819dbe 100644
--- a/pkgs/development/interpreters/python/cpython/2.7/boot.nix
+++ b/pkgs/development/interpreters/python/cpython/2.7/boot.nix
@@ -43,6 +43,15 @@ stdenv.mkDerivation rec {
       ./deterministic-build.patch
     ];
 
+  # Hack hack hack to stop shit from failing from a missing _scproxy on Darwin. Since
+  # we only use this python for bootstrappy things, it doesn't really matter if it
+  # doesn't have perfect proxy support in urllib :) this just makes it fall back on env
+  # vars instead of attempting to read the proxy configuration automatically, so not a
+  # huge loss even if for whatever reason we did want proxy support.
+  postPatch = ''
+    substituteInPlace Lib/urllib.py --replace "if sys.platform == 'darwin'" "if False"
+  '';
+
   DETERMINISTIC_BUILD = 1;
 
   preConfigure = ''
diff --git a/pkgs/development/interpreters/wasm-gc/default.nix b/pkgs/development/interpreters/wasm-gc/default.nix
new file mode 100644
index 000000000000..cf0fad18d1ca
--- /dev/null
+++ b/pkgs/development/interpreters/wasm-gc/default.nix
@@ -0,0 +1,25 @@
+{ stdenv, fetchFromGitHub, rustPlatform }:
+
+rustPlatform.buildRustPackage rec {
+  name = "wasm-gc-${version}";
+  version = "0.1.6";
+
+  src = fetchFromGitHub {
+    owner = "alexcrichton";
+    repo = "wasm-gc";
+    rev = version;
+    sha256 = "1lc30xxqp3vv1r269xzznh2lf2dzdq89bi5f1vmqjw4yc3xmawm7";
+  };
+
+  cargoPatches = [ ./fix-build.patch ]; # Cargo.lock is not up-to-date
+
+  cargoSha256 = "1jvk9n324p3x3j6q6x0p5diig3b5c683k74cfflff25i7gsmmvc7";
+
+  meta = with stdenv.lib; {
+    description = "gc-sections for wasm";
+    homepage = "https://github.com/alexcrichton/wasm-gc";
+    maintainers = with maintainers; [ ekleog ];
+    platforms = platforms.all;
+    license = with licenses; [ mit asl20 ];
+  };
+}
diff --git a/pkgs/development/interpreters/wasm-gc/fix-build.patch b/pkgs/development/interpreters/wasm-gc/fix-build.patch
new file mode 100644
index 000000000000..3144dd898374
--- /dev/null
+++ b/pkgs/development/interpreters/wasm-gc/fix-build.patch
@@ -0,0 +1,34 @@
+diff --git a/Cargo.lock b/Cargo.lock
+index 923ed91..71f17c8 100644
+--- a/Cargo.lock
++++ b/Cargo.lock
+@@ -212,16 +212,16 @@ dependencies = [
+ 
+ [[package]]
+ name = "wasm-gc"
+-version = "0.1.1"
++version = "0.1.6"
+ dependencies = [
+  "env_logger 0.5.10 (registry+https://github.com/rust-lang/crates.io-index)",
+  "getopts 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)",
+- "wasm-gc-api 0.1.5",
++ "wasm-gc-api 0.1.6",
+ ]
+ 
+ [[package]]
+ name = "wasm-gc-api"
+-version = "0.1.5"
++version = "0.1.6"
+ dependencies = [
+  "log 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
+  "parity-wasm 0.31.0 (registry+https://github.com/rust-lang/crates.io-index)",
+@@ -234,7 +234,7 @@ version = "0.1.0"
+ dependencies = [
+  "cfg-if 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
+  "wasm-bindgen 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
+- "wasm-gc-api 0.1.5",
++ "wasm-gc-api 0.1.6",
+ ]
+ 
+ [[package]]
+
diff --git a/pkgs/development/libraries/boehm-gc/default.nix b/pkgs/development/libraries/boehm-gc/default.nix
index da71e40187f4..012c1d123b62 100644
--- a/pkgs/development/libraries/boehm-gc/default.nix
+++ b/pkgs/development/libraries/boehm-gc/default.nix
@@ -4,14 +4,14 @@
 
 stdenv.mkDerivation rec {
   name = "boehm-gc-${version}";
-  version = "7.6.6";
+  version = "7.6.8";
 
   src = fetchurl {
     urls = [
       "http://www.hboehm.info/gc/gc_source/gc-${version}.tar.gz"
       "https://github.com/ivmai/bdwgc/releases/download/v${version}/gc-${version}.tar.gz"
     ];
-    sha256 = "1p1r015a7jbpvkkbgzv1y8nxrbbp6dg0mq3ksi6ji0qdz3wfss79";
+    sha256 = "0n720a0i584ghcwmdsjiq6bl9ig0p9mrja29rp4cgsqvpz6wa2h4";
   };
 
   buildInputs = [ libatomic_ops ];
diff --git a/pkgs/development/libraries/cyrus-sasl/default.nix b/pkgs/development/libraries/cyrus-sasl/default.nix
index 7a9e3991aadb..bc5e23581ffa 100644
--- a/pkgs/development/libraries/cyrus-sasl/default.nix
+++ b/pkgs/development/libraries/cyrus-sasl/default.nix
@@ -36,15 +36,15 @@ stdenv.mkDerivation rec {
 
   configureFlags = [
     "--with-openssl=${openssl.dev}"
+    "--with-plugindir=${placeholder "out"}/lib/sasl2"
+    "--with-saslauthd=/run/saslauthd"
+    "--enable-login"
+    "--enable-shared"
   ] ++ lib.optional enableLdap "--with-ldap=${openldap.dev}";
 
-  # Set this variable at build-time to make sure $out can be evaluated.
-  preConfigure = ''
-    configureFlagsArray=( --with-plugindir=$out/lib/sasl2
-                          --with-saslauthd=/run/saslauthd
-                          --enable-login
-                        )
-  '';
+  # Avoid triggering regenerating using broken autoconf/libtool bits.
+  # (many distributions carry patches to remove/replace, but this works for now)
+  dontUpdateAutotoolsGnuConfigScripts = if stdenv.hostPlatform.isMusl then true else null;
 
   installFlags = lib.optional stdenv.isDarwin [ "framedir=$(out)/Library/Frameworks/SASL2.framework" ];
 
@@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
   '';
 
   meta = {
-    homepage = http://cyrusimap.web.cmu.edu/;
+    homepage = https://www.cyrusimap.org/sasl;
     description = "Library for adding authentication support to connection-based protocols";
     platforms = platforms.unix;
   };
diff --git a/pkgs/development/libraries/ffmpeg/generic.nix b/pkgs/development/libraries/ffmpeg/generic.nix
index 7d72de2a2ded..89e06f8b8d92 100644
--- a/pkgs/development/libraries/ffmpeg/generic.nix
+++ b/pkgs/development/libraries/ffmpeg/generic.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchurl, pkgconfig, perl, texinfo, yasm
 , alsaLib, bzip2, fontconfig, freetype, gnutls, libiconv, lame, libass, libogg
-, libtheora, libva, libvorbis, libvpx, lzma, libpulseaudio, soxr
-, x264, x265, xvidcore, zlib, libopus
+, libssh, libtheora, libva, libvorbis, libvpx, lzma, libpulseaudio, soxr
+, x264, x265, xvidcore, zlib, libopus, speex
 , openglSupport ? false, libGLU_combined ? null
 # Build options
 , runtimeCpuDetectBuild ? true # Detect CPU capabilities at runtime
@@ -128,6 +128,7 @@ stdenv.mkDerivation rec {
       "--enable-libmp3lame"
       (ifMinVer "1.2" "--enable-iconv")
       "--enable-libtheora"
+      "--enable-libssh"
       (ifMinVer "0.6" (enableFeature vaapiSupport "vaapi"))
       "--enable-vdpau"
       "--enable-libvorbis"
@@ -141,6 +142,7 @@ stdenv.mkDerivation rec {
       "--enable-libxvid"
       "--enable-zlib"
       (ifMinVer "2.8" "--enable-libopus")
+      "--enable-libspeex"
       (ifMinVer "2.8" "--enable-libx265")
     # Developer flags
       (enableFeature debugDeveloper "debug")
@@ -157,8 +159,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ perl pkgconfig texinfo yasm ];
 
   buildInputs = [
-    bzip2 fontconfig freetype gnutls libiconv lame libass libogg libtheora
-    libvdpau libvorbis lzma soxr x264 x265 xvidcore zlib libopus
+    bzip2 fontconfig freetype gnutls libiconv lame libass libogg libssh libtheora
+    libvdpau libvorbis lzma soxr x264 x265 xvidcore zlib libopus speex
   ] ++ optional openglSupport libGLU_combined
     ++ optional vpxSupport libvpx
     ++ optionals (!isDarwin && !isAarch32) [ libpulseaudio ] # Need to be fixed on Darwin and ARM
diff --git a/pkgs/development/libraries/gdbm/default.nix b/pkgs/development/libraries/gdbm/default.nix
index 685775e2918d..8d88dc04924b 100644
--- a/pkgs/development/libraries/gdbm/default.nix
+++ b/pkgs/development/libraries/gdbm/default.nix
@@ -1,13 +1,13 @@
 { stdenv, lib, fetchurl }:
 
 stdenv.mkDerivation rec {
-  name = "gdbm-1.17";
-  # FIXME: remove on update to > 1.17
+  name = "gdbm-1.18";
+  # FIXME: remove on update to > 1.18
   NIX_CFLAGS_COMPILE = if stdenv.cc.isClang then "-Wno-error=return-type" else null;
 
   src = fetchurl {
     url = "mirror://gnu/gdbm/${name}.tar.gz";
-    sha256 = "0zcp2iv5dbab18859a5fvacg8lkp8k4pr9af13kfvami6lpcrn3w";
+    sha256 = "1kimnv12bzjjhaqk4c8w2j6chdj9c6bg21lchaf7abcyfss2r0mq";
   };
 
   doCheck = true; # not cross;
diff --git a/pkgs/development/libraries/gettext/default.nix b/pkgs/development/libraries/gettext/default.nix
index 4531a5a01d4c..1b2f6bbc2225 100644
--- a/pkgs/development/libraries/gettext/default.nix
+++ b/pkgs/development/libraries/gettext/default.nix
@@ -51,6 +51,7 @@ stdenv.mkDerivation rec {
   gettextNeedsLdflags = stdenv.hostPlatform.libc != "glibc" && !stdenv.hostPlatform.isMusl;
 
   enableParallelBuilding = true;
+  enableParallelChecking = false; # fails sometimes
 
   meta = with lib; {
     description = "Well integrated set of translation tools and documentation";
diff --git a/pkgs/development/libraries/gpgme/default.nix b/pkgs/development/libraries/gpgme/default.nix
index 71fe23ea6b0d..416ecb5631ed 100644
--- a/pkgs/development/libraries/gpgme/default.nix
+++ b/pkgs/development/libraries/gpgme/default.nix
@@ -2,7 +2,7 @@
 , file, which
 , autoreconfHook
 , git
-, texinfo5
+, texinfo
 , qtbase ? null
 , withPython ? false, swig2 ? null, python ? null
 }:
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
     [ libgpgerror glib libassuan pth ]
     ++ lib.optional (qtbase != null) qtbase;
 
-  nativeBuildInputs = [ file pkgconfig gnupg autoreconfHook git texinfo5 ]
+  nativeBuildInputs = [ file pkgconfig gnupg autoreconfHook git texinfo ]
   ++ lib.optionals withPython [ python swig2 which ];
 
   postPatch =''
diff --git a/pkgs/development/libraries/libatomic_ops/default.nix b/pkgs/development/libraries/libatomic_ops/default.nix
index 0c0fc3861c9e..a887384f94da 100644
--- a/pkgs/development/libraries/libatomic_ops/default.nix
+++ b/pkgs/development/libraries/libatomic_ops/default.nix
@@ -2,14 +2,14 @@
 
 stdenv.mkDerivation rec {
   name = "libatomic_ops-${version}";
-  version = "7.6.4";
+  version = "7.6.6";
 
   src = fetchurl {
     urls = [
       "http://www.ivmaisoft.com/_bin/atomic_ops/libatomic_ops-${version}.tar.gz"
       "https://github.com/ivmai/libatomic_ops/releases/download/v${version}/libatomic_ops-${version}.tar.gz"
     ];
-    sha256 = "0knxncsjhbknlyy6lx7ycxhpzfk3sykhvicgxyp0rmsxd1d3v0jv";
+    sha256 = "0x7071z707msvyrv9dmgahd1sghbkw8fpbagvcag6xs8yp2spzlr";
   };
 
   outputs = [ "out" "dev" "doc" ];
diff --git a/pkgs/development/libraries/libdrm/default.nix b/pkgs/development/libraries/libdrm/default.nix
index 5107d8898d46..761216f420bb 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.93";
+  name = "libdrm-2.4.94";
 
   src = fetchurl {
     url = "https://dri.freedesktop.org/libdrm/${name}.tar.bz2";
-    sha256 = "0g6d9wsnb7lx8r1m4kq8js0wsc5jl20cz1csnlh6z9s8jpfd313f";
+    sha256 = "1ghn3l1dv1rsp9z6jpmy4ryna1s8rm4xx0ds532041bnlfq5jg5p";
   };
 
   outputs = [ "out" "dev" "bin" ];
diff --git a/pkgs/development/libraries/libgsf/default.nix b/pkgs/development/libraries/libgsf/default.nix
index 20a08885142a..bcd37396bf7f 100644
--- a/pkgs/development/libraries/libgsf/default.nix
+++ b/pkgs/development/libraries/libgsf/default.nix
@@ -2,11 +2,11 @@
 , python, perl, gdk_pixbuf, libiconv, libintl }:
 
 stdenv.mkDerivation rec {
-  name = "libgsf-1.14.42";
+  name = "libgsf-1.14.44";
 
   src = fetchurl {
     url    = "mirror://gnome/sources/libgsf/1.14/${name}.tar.xz";
-    sha256 = "1hhdz0ymda26q6bl5ygickkgrh998lxqq4z9i8dzpcvqna3zpzr9";
+    sha256 = "1ppzfk3zmmgrg9jh8vc4dacddbfngjslq2wpj94pcr3i0c8dxgk8";
   };
 
   nativeBuildInputs = [ pkgconfig intltool libintl ];
diff --git a/pkgs/development/libraries/libinput/default.nix b/pkgs/development/libraries/libinput/default.nix
index d42bd315d22f..4c85971cc3ce 100644
--- a/pkgs/development/libraries/libinput/default.nix
+++ b/pkgs/development/libraries/libinput/default.nix
@@ -16,11 +16,11 @@ in
 with stdenv.lib;
 stdenv.mkDerivation rec {
   name = "libinput-${version}";
-  version = "1.11.3";
+  version = "1.12.0";
 
   src = fetchurl {
     url = "https://www.freedesktop.org/software/libinput/${name}.tar.xz";
-    sha256 = "01nb1shnl871d939wgfd7nc9svclcnfjfhlq64b4yns2dvcr24gk";
+    sha256 = "1901wxh9k8kz3krfmvacf8xa8r4idfyisw8d80a2ql0bxiw2pb0m";
   };
 
   outputs = [ "bin" "out" "dev" ];
@@ -46,12 +46,6 @@ stdenv.mkDerivation rec {
 
   patches = [ ./udev-absolute-path.patch ];
 
-   preBuild = ''
-    # meson setup-hook changes the directory so the files are located one level up
-    patchShebangs ../udev/parse_hwdb.py
-    patchShebangs ../test/symbols-leak-test.in
-  '';
-
   doCheck = testsSupport;
 
   meta = {
diff --git a/pkgs/development/libraries/libinput/udev-absolute-path.patch b/pkgs/development/libraries/libinput/udev-absolute-path.patch
index fb22fea40e80..5c85b8639486 100644
--- a/pkgs/development/libraries/libinput/udev-absolute-path.patch
+++ b/pkgs/development/libraries/libinput/udev-absolute-path.patch
@@ -5,7 +5,7 @@
  
  udev_rules_config = configuration_data()
 -udev_rules_config.set('UDEV_TEST_PATH', '')
-+udev_rules_config.set('UDEV_TEST_PATH', udev_dir + '/')
++udev_rules_config.set('UDEV_TEST_PATH', dir_udev + '/')
  configure_file(input : 'udev/80-libinput-device-groups.rules.in',
  	       output : '80-libinput-device-groups.rules',
  	       install : true,
diff --git a/pkgs/development/libraries/libmediainfo/default.nix b/pkgs/development/libraries/libmediainfo/default.nix
index c4f41663c848..1ef2c6914ae4 100644
--- a/pkgs/development/libraries/libmediainfo/default.nix
+++ b/pkgs/development/libraries/libmediainfo/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, autoreconfHook, pkgconfig, libzen, zlib }:
 
 stdenv.mkDerivation rec {
-  version = "18.08";
+  version = "18.08.1";
   name = "libmediainfo-${version}";
   src = fetchurl {
     url = "https://mediaarea.net/download/source/libmediainfo/${version}/libmediainfo_${version}.tar.xz";
-    sha256 = "0h9fkfkil9y5xjxa7q4gxxihkn9kv9hak6ral2isvks5x3sy0ca8";
+    sha256 = "1h6brg98i39xprcl54gvs1scmv8d6f3iw5h2diwz5bbz4lspy8vs";
   };
 
   nativeBuildInputs = [ autoreconfHook pkgconfig ];
diff --git a/pkgs/development/libraries/libsndfile/default.nix b/pkgs/development/libraries/libsndfile/default.nix
index a68b5b2b6d5e..b150dd0f59c3 100644
--- a/pkgs/development/libraries/libsndfile/default.nix
+++ b/pkgs/development/libraries/libsndfile/default.nix
@@ -36,6 +36,11 @@ stdenv.mkDerivation rec {
       url = "https://github.com/erikd/libsndfile/commit/85c877d5072866aadbe8ed0c3e0590fbb5e16788.patch";
       sha256 = "0kc7vp22qsxidhvmlc6nfamw7k92n0hcfpmwhb3gaksjamwhb2df";
     })
+    (fetchurl {
+      name = "CVE-2018-13139.patch";
+      url = "https://github.com/erikd/libsndfile/commit/aaea680337267bfb6d2544da878890ee7f1c5077.patch";
+      sha256 = "01q3m7pa3xqkh05ijmfgv064v8flkg4p24bgy9wxnc6wfcdifggx";
+    })
   ];
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/development/libraries/libunistring/default.nix b/pkgs/development/libraries/libunistring/default.nix
index 24da3a8e2c7d..312a5c118103 100644
--- a/pkgs/development/libraries/libunistring/default.nix
+++ b/pkgs/development/libraries/libunistring/default.nix
@@ -19,7 +19,19 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  enableParallelBuilding = true;
+  /* This seems to cause several random failures like these, which I assume
+     is because of bad or missing target dependencies in their build system:
+
+        ./unistdio/test-u16-vasnprintf2.sh: line 16: ./test-u16-vasnprintf1: No such file or directory
+        FAIL unistdio/test-u16-vasnprintf2.sh (exit status: 1)
+
+        FAIL: unistdio/test-u16-vasnprintf3.sh
+        ======================================
+
+        ./unistdio/test-u16-vasnprintf3.sh: line 16: ./test-u16-vasnprintf1: No such file or directory
+        FAIL unistdio/test-u16-vasnprintf3.sh (exit status: 1)
+  */
+  enableParallelBuilding = false;
 
   meta = {
     homepage = http://www.gnu.org/software/libunistring/;
diff --git a/pkgs/development/libraries/libuv/default.nix b/pkgs/development/libraries/libuv/default.nix
index 067f8fb432d5..73d2db8e9993 100644
--- a/pkgs/development/libraries/libuv/default.nix
+++ b/pkgs/development/libraries/libuv/default.nix
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
         "tcp_open" "tcp_write_queue_order" "tcp_try_write" "tcp_writealot"
         "multiple_listen" "delayed_accept"
         "shutdown_close_tcp" "shutdown_eof" "shutdown_twice" "callback_stack"
-        "tty_pty"
+        "tty_pty" "condvar_5"
       ] ++ stdenv.lib.optionals stdenv.isAarch32 [
         # I observe this test failing with some regularity on ARMv7:
         # https://github.com/libuv/libuv/issues/1871
diff --git a/pkgs/development/libraries/mesa-darwin/default.nix b/pkgs/development/libraries/mesa-darwin/default.nix
deleted file mode 100644
index 2bfdb679156c..000000000000
--- a/pkgs/development/libraries/mesa-darwin/default.nix
+++ /dev/null
@@ -1,73 +0,0 @@
-{ stdenv, fetchurl, pkgconfig, intltool, flex, bison
-, python, libxml2Python, expat, makedepend, xorg, llvm, libffi, libvdpau
-, OpenGL, apple_sdk, Xplugin
-}:
-
-let
-  version = "8.0.5";
-  self = stdenv.mkDerivation rec {
-    name = "mesa-${version}";
-
-    src =  fetchurl {
-      url = "ftp://ftp.freedesktop.org/pub/mesa/older-versions/8.x/${version}/MesaLib-${version}.tar.bz2";
-      sha256 = "0pjs8x51c0i6mawgd4w03lxpyx5fnx7rc8plr8jfsscf9yiqs6si";
-    };
-
-    nativeBuildInputs = [ pkgconfig python makedepend flex bison ];
-
-    buildInputs = with xorg; [
-      glproto dri2proto libXfixes libXi libXmu
-      intltool expat libxml2Python llvm
-      presentproto
-      libX11 libXext libxcb libXt libxshmfence
-      libffi libvdpau
-    ] ++ stdenv.lib.optionals stdenv.isDarwin [ OpenGL apple_sdk.sdk Xplugin ];
-
-    propagatedBuildInputs = stdenv.lib.optionals stdenv.isDarwin [ OpenGL ];
-
-    postUnpack = ''
-      ln -s darwin $sourceRoot/configs/current
-    '';
-
-    preBuild = stdenv.lib.optionalString stdenv.isDarwin ''
-      substituteInPlace bin/mklib --replace g++ clang++
-    '';
-
-    patches = [
-      ./patches/0003-mesa-fix-per-level-max-texture-size-error-checking.patch
-      ./patches/0008-glsl-initialise-const-force-glsl-extension-warning-i.patch
-      ./patches/0009-mesa-test-for-GL_EXT_framebuffer_sRGB-in-glPopAttrib.patch
-      ./patches/0011-Apple-glFlush-is-not-needed-with-CGLFlushDrawable.patch
-      ./patches/0012-glapi-Avoid-heap-corruption-in-_glapi_table.patch
-      ./patches/0013-darwin-Fix-test-for-kCGLPFAOpenGLProfile-support-at-.patch
-      ./patches/1001-appleglx-Improve-error-reporting-if-CGLChoosePixelFo.patch
-      ./patches/1002-darwin-Write-errors-in-choosing-the-pixel-format-to-.patch
-      ./patches/1003-darwin-Guard-Core-Profile-usage-behind-a-testing-env.patch
-      ./patches/patch-src-mapi-vgapi-Makefile.diff
-    ];
-
-    postPatch = "patchShebangs .";
-
-    configurePhase = ":";
-
-    configureFlags = [
-      # NOTE: Patents expired on June 17 2018.
-      # For details see: https://www.phoronix.com/scan.php?page=news_item&px=OpenGL-Texture-Float-Freed
-      "texture-float"
-    ];
-
-    makeFlags = "INSTALL_DIR=\${out} CC=cc CXX=c++";
-
-    enableParallelBuilding = true;
-
-    passthru = { inherit version; };
-
-    meta = {
-      description = "An open source implementation of OpenGL";
-      homepage = http://www.mesa3d.org/;
-      license = "bsd";
-      platforms = stdenv.lib.platforms.darwin;
-      maintainers = with stdenv.lib.maintainers; [ cstrahan ];
-    };
-  };
-in self // { driverLink = self; }
diff --git a/pkgs/development/libraries/mesa-darwin/patches/0003-mesa-fix-per-level-max-texture-size-error-checking.patch b/pkgs/development/libraries/mesa-darwin/patches/0003-mesa-fix-per-level-max-texture-size-error-checking.patch
deleted file mode 100644
index 5466ffc90858..000000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/0003-mesa-fix-per-level-max-texture-size-error-checking.patch
+++ /dev/null
@@ -1,147 +0,0 @@
-From 9cf1afbf8ae87ddbb29b24a0f9f2724e9e2935c1 Mon Sep 17 00:00:00 2001
-From: Brian Paul <brianp@vmware.com>
-Date: Tue, 4 Sep 2012 20:17:15 -0600
-Subject: [PATCH 03/13] mesa: fix per-level max texture size error checking
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-This is a long-standing omission in Mesa's texture image size checking.
-We need to take the mipmap level into consideration when checking if the
-width, height and depth are too large.
-
-Fixes the new piglit max-texture-size-level test.
-Thanks to Stéphane Marchesin for finding this problem.
-
-Note: This is a candidate for the stable branches.
-
-Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
-(cherry picked from commit 771e7b6d884bb4294a89f276a904d90b28efb90a)
----
- src/mesa/main/teximage.c | 36 +++++++++++++++++++++---------------
- 1 file changed, 21 insertions(+), 15 deletions(-)
-
-diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
-index 3aecc0f..ed22fa9 100644
---- a/src/mesa/main/teximage.c
-+++ b/src/mesa/main/teximage.c
-@@ -1251,11 +1251,12 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
- 
-    switch (target) {
-    case GL_PROXY_TEXTURE_1D:
--      maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
--      if (width < 2 * border || width > 2 * border + maxSize)
--         return GL_FALSE;
-       if (level >= ctx->Const.MaxTextureLevels)
-          return GL_FALSE;
-+      maxSize = 1 << (ctx->Const.MaxTextureLevels - 1); /* level zero size */
-+      maxSize >>= level;  /* level size */
-+      if (width < 2 * border || width > 2 * border + maxSize)
-+         return GL_FALSE;
-       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-             return GL_FALSE;
-@@ -1263,13 +1264,14 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
-       return GL_TRUE;
- 
-    case GL_PROXY_TEXTURE_2D:
-+      if (level >= ctx->Const.MaxTextureLevels)
-+         return GL_FALSE;
-       maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-+      maxSize >>= level;
-       if (width < 2 * border || width > 2 * border + maxSize)
-          return GL_FALSE;
-       if (height < 2 * border || height > 2 * border + maxSize)
-          return GL_FALSE;
--      if (level >= ctx->Const.MaxTextureLevels)
--         return GL_FALSE;
-       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-             return GL_FALSE;
-@@ -1279,15 +1281,16 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
-       return GL_TRUE;
- 
-    case GL_PROXY_TEXTURE_3D:
-+      if (level >= ctx->Const.Max3DTextureLevels)
-+         return GL_FALSE;
-       maxSize = 1 << (ctx->Const.Max3DTextureLevels - 1);
-+      maxSize >>= level;
-       if (width < 2 * border || width > 2 * border + maxSize)
-          return GL_FALSE;
-       if (height < 2 * border || height > 2 * border + maxSize)
-          return GL_FALSE;
-       if (depth < 2 * border || depth > 2 * border + maxSize)
-          return GL_FALSE;
--      if (level >= ctx->Const.Max3DTextureLevels)
--         return GL_FALSE;
-       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-             return GL_FALSE;
-@@ -1299,23 +1302,24 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
-       return GL_TRUE;
- 
-    case GL_PROXY_TEXTURE_RECTANGLE_NV:
-+      if (level != 0)
-+         return GL_FALSE;
-       maxSize = ctx->Const.MaxTextureRectSize;
-       if (width < 0 || width > maxSize)
-          return GL_FALSE;
-       if (height < 0 || height > maxSize)
-          return GL_FALSE;
--      if (level != 0)
--         return GL_FALSE;
-       return GL_TRUE;
- 
-    case GL_PROXY_TEXTURE_CUBE_MAP_ARB:
-+      if (level >= ctx->Const.MaxCubeTextureLevels)
-+         return GL_FALSE;
-       maxSize = 1 << (ctx->Const.MaxCubeTextureLevels - 1);
-+      maxSize >>= level;
-       if (width < 2 * border || width > 2 * border + maxSize)
-          return GL_FALSE;
-       if (height < 2 * border || height > 2 * border + maxSize)
-          return GL_FALSE;
--      if (level >= ctx->Const.MaxCubeTextureLevels)
--         return GL_FALSE;
-       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-             return GL_FALSE;
-@@ -1325,13 +1329,14 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
-       return GL_TRUE;
- 
-    case GL_PROXY_TEXTURE_1D_ARRAY_EXT:
-+      if (level >= ctx->Const.MaxTextureLevels)
-+         return GL_FALSE;
-       maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-+      maxSize >>= level;
-       if (width < 2 * border || width > 2 * border + maxSize)
-          return GL_FALSE;
-       if (height < 1 || height > ctx->Const.MaxArrayTextureLayers)
-          return GL_FALSE;
--      if (level >= ctx->Const.MaxTextureLevels)
--         return GL_FALSE;
-       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-             return GL_FALSE;
-@@ -1339,15 +1344,16 @@ _mesa_test_proxy_teximage(struct gl_context *ctx, GLenum target, GLint level,
-       return GL_TRUE;
- 
-    case GL_PROXY_TEXTURE_2D_ARRAY_EXT:
-+      if (level >= ctx->Const.MaxTextureLevels)
-+         return GL_FALSE;
-       maxSize = 1 << (ctx->Const.MaxTextureLevels - 1);
-+      maxSize >>= level;
-       if (width < 2 * border || width > 2 * border + maxSize)
-          return GL_FALSE;
-       if (height < 2 * border || height > 2 * border + maxSize)
-          return GL_FALSE;
-       if (depth < 1 || depth > ctx->Const.MaxArrayTextureLayers)
-          return GL_FALSE;
--      if (level >= ctx->Const.MaxTextureLevels)
--         return GL_FALSE;
-       if (!ctx->Extensions.ARB_texture_non_power_of_two) {
-          if (width > 0 && !_mesa_is_pow_two(width - 2 * border))
-             return GL_FALSE;
--- 
-1.9.2
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/0008-glsl-initialise-const-force-glsl-extension-warning-i.patch b/pkgs/development/libraries/mesa-darwin/patches/0008-glsl-initialise-const-force-glsl-extension-warning-i.patch
deleted file mode 100644
index ff933b2ec284..000000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/0008-glsl-initialise-const-force-glsl-extension-warning-i.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From db8cb2250335a93cad6e877e634116e5cd6b42fc Mon Sep 17 00:00:00 2001
-From: Dave Airlie <airlied@redhat.com>
-Date: Tue, 13 Mar 2012 14:53:25 +0000
-Subject: [PATCH 08/13] glsl: initialise const force glsl extension warning in
- fake ctx
-
-valgrind complained about an uninitialised value being used in
-glsl_parser_extras.cpp, and this was the one it was giving out about.
-
-Just initialise the value in the fakectx.
-
-Signed-off-by: Dave Airlie <airlied@redhat.com>
-Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=48057
-(cherry picked from commit b78a77f979b21a84aecb6fa4f19a2ed51a48c306)
----
- src/glsl/builtins/tools/generate_builtins.py | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/src/glsl/builtins/tools/generate_builtins.py b/src/glsl/builtins/tools/generate_builtins.py
-index 72d12bb..bd15c4d 100755
---- a/src/glsl/builtins/tools/generate_builtins.py
-+++ b/src/glsl/builtins/tools/generate_builtins.py
-@@ -156,6 +156,7 @@ read_builtins(GLenum target, const char *protos, const char **functions, unsigne
-    fakeCtx.API = API_OPENGL;
-    fakeCtx.Const.GLSLVersion = 130;
-    fakeCtx.Extensions.ARB_ES2_compatibility = true;
-+   fakeCtx.Const.ForceGLSLExtensionsWarn = false;
-    gl_shader *sh = _mesa_new_shader(NULL, 0, target);
-    struct _mesa_glsl_parse_state *st =
-       new(sh) _mesa_glsl_parse_state(&fakeCtx, target, sh);
--- 
-1.9.2
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/0009-mesa-test-for-GL_EXT_framebuffer_sRGB-in-glPopAttrib.patch b/pkgs/development/libraries/mesa-darwin/patches/0009-mesa-test-for-GL_EXT_framebuffer_sRGB-in-glPopAttrib.patch
deleted file mode 100644
index 919443045e46..000000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/0009-mesa-test-for-GL_EXT_framebuffer_sRGB-in-glPopAttrib.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 2286bd68a832a4d4908d50e1a4496853e1f3305a Mon Sep 17 00:00:00 2001
-From: Brian Paul <brianp@vmware.com>
-Date: Mon, 27 Aug 2012 21:52:07 -0600
-Subject: [PATCH 09/13] mesa: test for GL_EXT_framebuffer_sRGB in glPopAttrib()
-
-To avoid spurious GL_INVALID_ENUM errors if the extension isn't supported.
-(cherry picked from commit 1aee8803f83f7ae24d9c2150c70afff2b1ee4c2f)
----
- src/mesa/main/attrib.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
-index 225ac89..cc384c7 100644
---- a/src/mesa/main/attrib.c
-+++ b/src/mesa/main/attrib.c
-@@ -993,7 +993,8 @@ _mesa_PopAttrib(void)
-                _mesa_ClampColorARB(GL_CLAMP_READ_COLOR_ARB, color->ClampReadColor);
- 
-                /* GL_ARB_framebuffer_sRGB / GL_EXT_framebuffer_sRGB */
--               _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB, color->sRGBEnabled);
-+               if (ctx->Extensions.EXT_framebuffer_sRGB)
-+                  _mesa_set_enable(ctx, GL_FRAMEBUFFER_SRGB, color->sRGBEnabled);
-             }
-             break;
-          case GL_CURRENT_BIT:
--- 
-1.9.2
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/0011-Apple-glFlush-is-not-needed-with-CGLFlushDrawable.patch b/pkgs/development/libraries/mesa-darwin/patches/0011-Apple-glFlush-is-not-needed-with-CGLFlushDrawable.patch
deleted file mode 100644
index 565d5e6c2737..000000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/0011-Apple-glFlush-is-not-needed-with-CGLFlushDrawable.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-From 9c50093adff0c7531ab32a7ec9ce3b91712b4d20 Mon Sep 17 00:00:00 2001
-From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-Date: Sat, 20 Jul 2013 10:25:28 -0700
-Subject: [PATCH 11/13] Apple: glFlush() is not needed with CGLFlushDrawable()
-
-<rdar://problem/14496373>
-
-Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-(cherry picked from commit fa5ed99d8e809fb86e486a40273a4a6971055398)
----
- src/glx/apple/apple_glx.c | 2 --
- 1 file changed, 2 deletions(-)
-
-diff --git a/src/glx/apple/apple_glx.c b/src/glx/apple/apple_glx.c
-index 56cff64..4e2aa33 100644
---- a/src/glx/apple/apple_glx.c
-+++ b/src/glx/apple/apple_glx.c
-@@ -132,8 +132,6 @@ apple_glx_swap_buffers(void *ptr)
- {
-    struct apple_glx_context *ac = ptr;
- 
--   /* This may not be needed with CGLFlushDrawable: */
--   glFlush();
-    apple_cgl.flush_drawable(ac->context_obj);
- }
- 
--- 
-1.9.2
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/0012-glapi-Avoid-heap-corruption-in-_glapi_table.patch b/pkgs/development/libraries/mesa-darwin/patches/0012-glapi-Avoid-heap-corruption-in-_glapi_table.patch
deleted file mode 100644
index 58ac66bd5511..000000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/0012-glapi-Avoid-heap-corruption-in-_glapi_table.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From 629600450b3845a768c0edc92ea3f444d03a2738 Mon Sep 17 00:00:00 2001
-From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-Date: Tue, 20 May 2014 01:37:58 -0700
-Subject: [PATCH 12/13] glapi: Avoid heap corruption in _glapi_table
-
-Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-Reviewed-by: Chia-I Wu <olv@lunarg.com>
-(cherry picked from commit ff5456d1acf6f627a6837be3f3f37c6a268c9e8e)
----
- src/mapi/glapi/gen/gl_gentable.py | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/mapi/glapi/gen/gl_gentable.py b/src/mapi/glapi/gen/gl_gentable.py
-index 5657e32..0d0a02d 100644
---- a/src/mapi/glapi/gen/gl_gentable.py
-+++ b/src/mapi/glapi/gen/gl_gentable.py
-@@ -111,7 +111,7 @@ __glapi_gentable_set_remaining_noop(struct _glapi_table *disp) {
- 
- struct _glapi_table *
- _glapi_create_table_from_handle(void *handle, const char *symbol_prefix) {
--    struct _glapi_table *disp = calloc(1, sizeof(struct _glapi_table));
-+    struct _glapi_table *disp = calloc(1, _glapi_get_dispatch_table_size() * sizeof(_glapi_proc));
-     char symboln[512];
- 
-     if(!disp)
--- 
-1.9.2
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/0013-darwin-Fix-test-for-kCGLPFAOpenGLProfile-support-at-.patch b/pkgs/development/libraries/mesa-darwin/patches/0013-darwin-Fix-test-for-kCGLPFAOpenGLProfile-support-at-.patch
deleted file mode 100644
index 5ec0d9024eff..000000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/0013-darwin-Fix-test-for-kCGLPFAOpenGLProfile-support-at-.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-From ba59a779ed41e08fa16805c1c60da39885546d0e Mon Sep 17 00:00:00 2001
-From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-Date: Tue, 20 May 2014 10:53:00 -0700
-Subject: [PATCH 13/13] darwin: Fix test for kCGLPFAOpenGLProfile support at
- runtime
-
-Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-(cherry picked from commit 7a109268ab5b3544e7f7b99e84ef1fdf54023fb4)
----
- src/glx/apple/apple_visual.c | 14 +++++++++-----
- 1 file changed, 9 insertions(+), 5 deletions(-)
-
-diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
-index 282934f..238c248 100644
---- a/src/glx/apple/apple_visual.c
-+++ b/src/glx/apple/apple_visual.c
-@@ -73,11 +73,15 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
-    GLint vsref = 0;
-    CGLError error = 0;
- 
--   /* Request an OpenGL 3.2 profile if one is available */
--   if(apple_cgl.version_major > 1 || (apple_cgl.version_major == 1 && apple_cgl.version_minor >= 3)) {
--      attr[numattr++] = kCGLPFAOpenGLProfile;
--      attr[numattr++] = kCGLOGLPVersion_3_2_Core;
--   }
-+   /* Request an OpenGL 3.2 profile if one is available and supported */
-+   attr[numattr++] = kCGLPFAOpenGLProfile;
-+   attr[numattr++] = kCGLOGLPVersion_3_2_Core;
-+
-+   /* Test for kCGLPFAOpenGLProfile support at runtime and roll it out if not supported */
-+   attr[numattr] = 0;
-+   error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
-+   if (error == kCGLBadAttribute)
-+      numattr -= 2;
- 
-    if (offscreen) {
-       apple_glx_diagnostic
--- 
-1.9.2
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/1001-appleglx-Improve-error-reporting-if-CGLChoosePixelFo.patch b/pkgs/development/libraries/mesa-darwin/patches/1001-appleglx-Improve-error-reporting-if-CGLChoosePixelFo.patch
deleted file mode 100644
index 372ce4a27a39..000000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/1001-appleglx-Improve-error-reporting-if-CGLChoosePixelFo.patch
+++ /dev/null
@@ -1,30 +0,0 @@
-From f0702d6e631bb912a230c081463bb51a0dde1bff Mon Sep 17 00:00:00 2001
-From: Jon TURNEY <jon.turney@dronecode.org.uk>
-Date: Mon, 12 May 2014 15:38:26 +0100
-Subject: [PATCH 1001/1003] appleglx: Improve error reporting if
- CGLChoosePixelFormat() didn't find any matching pixel formats.
-
-Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk>
-Reviewed-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-(cherry picked from commit 002a3a74273b81dfb226e1c3f0a8c18525ed0af4)
----
- src/glx/apple/apple_visual.c | 5 +++++
- 1 file changed, 5 insertions(+)
-
-diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
-index 238c248..c6ede51 100644
---- a/src/glx/apple/apple_visual.c
-+++ b/src/glx/apple/apple_visual.c
-@@ -167,4 +167,9 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
-       fprintf(stderr, "error: %s\n", apple_cgl.error_string(error));
-       abort();
-    }
-+
-+   if (!*pfobj) {
-+      fprintf(stderr, "No matching pixelformats found, perhaps try using LIBGL_ALLOW_SOFTWARE\n");
-+      abort();
-+   }
- }
--- 
-1.9.2 (Apple Git-49)
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/1002-darwin-Write-errors-in-choosing-the-pixel-format-to-.patch b/pkgs/development/libraries/mesa-darwin/patches/1002-darwin-Write-errors-in-choosing-the-pixel-format-to-.patch
deleted file mode 100644
index 4818ee63d4c9..000000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/1002-darwin-Write-errors-in-choosing-the-pixel-format-to-.patch
+++ /dev/null
@@ -1,55 +0,0 @@
-From 1b2f877c8ef052b183c1f20ece6c6e4a7bfd237c Mon Sep 17 00:00:00 2001
-From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-Date: Sat, 24 May 2014 14:13:33 -0700
-Subject: [PATCH 1002/1003] darwin: Write errors in choosing the pixel format
- to the crash log
-
-Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-(cherry picked from commit 9eb1d36c978a9b15ae2e999c630492dfffd7f165)
----
- src/glx/apple/apple_visual.c | 18 ++++++++++++++++--
- 1 file changed, 16 insertions(+), 2 deletions(-)
-
-diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
-index c6ede51..951b213 100644
---- a/src/glx/apple/apple_visual.c
-+++ b/src/glx/apple/apple_visual.c
-@@ -63,6 +63,16 @@ enum
-    MAX_ATTR = 60
- };
- 
-+static char __crashreporter_info_buff__[4096] = { 0 };
-+static const char *__crashreporter_info__ __attribute__((__used__)) =
-+    &__crashreporter_info_buff__[0];
-+#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1050
-+// This is actually a toolchain requirement, but I'm not sure the correct check,
-+// but it should be fine to just only include it for Leopard and later.  This line
-+// just tells the linker to never strip this symbol (such as for space optimization)
-+__asm__ (".desc ___crashreporter_info__, 0x10");
-+#endif
-+
- void
- apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * mode,
-                           bool * double_buffered, bool * uses_stereo,
-@@ -164,12 +174,16 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
-    error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
- 
-    if (error) {
--      fprintf(stderr, "error: %s\n", apple_cgl.error_string(error));
-+      snprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__),
-+               "CGLChoosePixelFormat error: %s\n", apple_cgl.error_string(error));
-+      fprintf(stderr, "%s", __crashreporter_info_buff__);
-       abort();
-    }
- 
-    if (!*pfobj) {
--      fprintf(stderr, "No matching pixelformats found, perhaps try using LIBGL_ALLOW_SOFTWARE\n");
-+      snprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__),
-+               "No matching pixelformats found, perhaps try using LIBGL_ALLOW_SOFTWARE\n");
-+      fprintf(stderr, "%s", __crashreporter_info_buff__);
-       abort();
-    }
- }
--- 
-1.9.2 (Apple Git-49)
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/1003-darwin-Guard-Core-Profile-usage-behind-a-testing-env.patch b/pkgs/development/libraries/mesa-darwin/patches/1003-darwin-Guard-Core-Profile-usage-behind-a-testing-env.patch
deleted file mode 100644
index 72841e2a2cce..000000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/1003-darwin-Guard-Core-Profile-usage-behind-a-testing-env.patch
+++ /dev/null
@@ -1,69 +0,0 @@
-From 9d6e12eb6b06202519e48a7321f32944d7a34b0f Mon Sep 17 00:00:00 2001
-From: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-Date: Sat, 24 May 2014 14:08:16 -0700
-Subject: [PATCH 1003/1003] darwin: Guard Core Profile usage behind a testing
- envvar
-
-Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@apple.com>
-(cherry picked from commit 04ce3be4010305902cc5ae81e8e0c8550d043a1e)
----
- src/glx/apple/apple_visual.c | 30 ++++++++++++++++++++----------
- 1 file changed, 20 insertions(+), 10 deletions(-)
-
-diff --git a/src/glx/apple/apple_visual.c b/src/glx/apple/apple_visual.c
-index 951b213..046581b 100644
---- a/src/glx/apple/apple_visual.c
-+++ b/src/glx/apple/apple_visual.c
-@@ -82,16 +82,7 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
-    int numattr = 0;
-    GLint vsref = 0;
-    CGLError error = 0;
--
--   /* Request an OpenGL 3.2 profile if one is available and supported */
--   attr[numattr++] = kCGLPFAOpenGLProfile;
--   attr[numattr++] = kCGLOGLPVersion_3_2_Core;
--
--   /* Test for kCGLPFAOpenGLProfile support at runtime and roll it out if not supported */
--   attr[numattr] = 0;
--   error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
--   if (error == kCGLBadAttribute)
--      numattr -= 2;
-+   bool use_core_profile = getenv("LIBGL_PROFILE_CORE");
- 
-    if (offscreen) {
-       apple_glx_diagnostic
-@@ -167,12 +158,31 @@ apple_visual_create_pfobj(CGLPixelFormatObj * pfobj, const struct glx_config * m
-       attr[numattr++] = mode->samples;
-    }
- 
-+   /* Debugging support for Core profiles to support newer versions of OpenGL */
-+   if (use_core_profile) {
-+      attr[numattr++] = kCGLPFAOpenGLProfile;
-+      attr[numattr++] = kCGLOGLPVersion_3_2_Core;
-+   }
-+
-    attr[numattr++] = 0;
- 
-    assert(numattr < MAX_ATTR);
- 
-    error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
- 
-+   if ((error == kCGLBadAttribute || vsref == 0) && use_core_profile) {
-+      apple_glx_diagnostic
-+         ("Trying again without CoreProfile: error=%s, vsref=%d\n", apple_cgl.error_string(error), vsref);
-+
-+      if (!error)
-+         apple_cgl.destroy_pixel_format(*pfobj);
-+
-+      numattr -= 3;
-+      attr[numattr++] = 0;
-+
-+      error = apple_cgl.choose_pixel_format(attr, pfobj, &vsref);
-+   }
-+
-    if (error) {
-       snprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__),
-                "CGLChoosePixelFormat error: %s\n", apple_cgl.error_string(error));
--- 
-1.9.2 (Apple Git-49)
-
diff --git a/pkgs/development/libraries/mesa-darwin/patches/patch-src-mapi-vgapi-Makefile.diff b/pkgs/development/libraries/mesa-darwin/patches/patch-src-mapi-vgapi-Makefile.diff
deleted file mode 100644
index e29a8464076d..000000000000
--- a/pkgs/development/libraries/mesa-darwin/patches/patch-src-mapi-vgapi-Makefile.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/src/mapi/vgapi/Makefile	2012-11-30 12:06:24.000000000 -0500
-+++ b/src/mapi/vgapi/Makefile	2012-11-30 12:06:52.000000000 -0500
-@@ -75,6 +75,8 @@
- install-headers:
- 	$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/VG
- 	$(INSTALL) -m 644 $(TOP)/include/VG/*.h $(DESTDIR)$(INSTALL_INC_DIR)/VG
-+	$(INSTALL) -d $(DESTDIR)$(INSTALL_INC_DIR)/KHR
-+	$(INSTALL) -m 644 $(TOP)/include/KHR/*.h $(DESTDIR)$(INSTALL_INC_DIR)/KHR
- 
- install: default install-headers install-pc
- 	$(INSTALL) -d $(DESTDIR)$(INSTALL_LIB_DIR)
diff --git a/pkgs/development/libraries/mesa/darwin-clock-gettime.patch b/pkgs/development/libraries/mesa/darwin-clock-gettime.patch
new file mode 100644
index 000000000000..94e90a1c5871
--- /dev/null
+++ b/pkgs/development/libraries/mesa/darwin-clock-gettime.patch
@@ -0,0 +1,76 @@
+diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h
+index 45cb6075e6..62937311b9 100644
+--- a/include/c11/threads_posix.h
++++ b/include/c11/threads_posix.h
+@@ -36,6 +36,11 @@
+ #include <sched.h>
+ #include <stdint.h> /* for intptr_t */
+ 
++#ifdef __MACH__
++#include <mach/clock.h>
++#include <mach/mach.h>
++#endif
++
+ /*
+ Configuration macro:
+ 
+@@ -383,12 +388,25 @@ tss_set(tss_t key, void *val)
+ /*-------------------- 7.25.7 Time functions --------------------*/
+ // 7.25.6.1
+ #ifndef HAVE_TIMESPEC_GET
++
+ static inline int
+ timespec_get(struct timespec *ts, int base)
+ {
+     if (!ts) return 0;
+     if (base == TIME_UTC) {
++#ifdef __MACH__
++        if (ts != NULL) {
++            clock_serv_t cclock;
++            mach_timespec_t mts;
++            host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
++            clock_get_time(cclock, &mts);
++            mach_port_deallocate(mach_task_self(), cclock);
++            ts->tv_sec = mts.tv_sec;
++            ts->tv_nsec = mts.tv_nsec;
++        }
++#else
+         clock_gettime(CLOCK_REALTIME, ts);
++#endif
+         return base;
+     }
+     return 0;
+diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
+index 1208ebb315..e1378fb1f0 100644
+--- a/src/egl/drivers/dri2/egl_dri2.c
++++ b/src/egl/drivers/dri2/egl_dri2.c
+@@ -65,6 +65,11 @@
+ #include "util/u_vector.h"
+ #include "mapi/glapi/glapi.h"
+ 
++#ifdef __MACH__
++#include <mach/clock.h>
++#include <mach/mach.h>
++#endif
++
+ #define NUM_ATTRIBS 12
+ 
+ static void
+@@ -3092,7 +3097,17 @@ dri2_client_wait_sync(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSync *sync,
+ 
+             /* We override the clock to monotonic when creating the condition
+              * variable. */
++#ifdef __MACH__
++            clock_serv_t cclock;
++            mach_timespec_t mts;
++            host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
++            clock_get_time(cclock, &mts);
++            mach_port_deallocate(mach_task_self(), cclock);
++            current.tv_sec = mts.tv_sec;
++            current.tv_nsec = mts.tv_nsec;
++#else
+             clock_gettime(CLOCK_MONOTONIC, &current);
++#endif
+ 
+             /* calculating when to expire */
+             expire.tv_nsec = timeout % 1000000000L;
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index 0a8a3c75a1c0..aca9a237b0c7 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -8,6 +8,8 @@
 , galliumDrivers ? null
 , driDrivers ? null
 , vulkanDrivers ? null
+, eglPlatforms ? [ "x11" ] ++ lib.optionals stdenv.isLinux [ "wayland" "drm" ]
+, OpenGL, Xplugin
 }:
 
 /** Packaging design:
@@ -29,19 +31,21 @@ else
 
 let
   defaultGalliumDrivers =
-    if stdenv.isAarch32
+    optionals (builtins.elem "drm" eglPlatforms)
+    (if stdenv.isAarch32
     then ["virgl" "nouveau" "freedreno" "vc4" "etnaviv" "imx"]
     else if stdenv.isAarch64
     then ["virgl" "nouveau" "vc4" ]
-    else ["virgl" "svga" "i915" "r300" "r600" "radeonsi" "nouveau"];
+    else ["virgl" "svga" "i915" "r300" "r600" "radeonsi" "nouveau"]);
   defaultDriDrivers =
-    if (stdenv.isAarch32 || stdenv.isAarch64)
+    optionals (builtins.elem "drm" eglPlatforms)
+    (if (stdenv.isAarch32 || stdenv.isAarch64)
     then ["nouveau"]
-    else ["i915" "i965" "nouveau" "radeon" "r200"];
+    else ["i915" "i965" "nouveau" "radeon" "r200"]);
   defaultVulkanDrivers =
-    if (stdenv.isAarch32 || stdenv.isAarch64)
+    optionals stdenv.isLinux (if (stdenv.isAarch32 || stdenv.isAarch64)
     then []
-    else ["intel"] ++ lib.optional enableRadv "radeon";
+    else ["intel"] ++ lib.optional enableRadv "radeon");
 in
 
 let gallium_ = galliumDrivers; dri_ = driDrivers; vulkan_ = vulkanDrivers; in
@@ -51,11 +55,11 @@ let
     (if gallium_ == null
           then defaultGalliumDrivers
           else gallium_)
-    ++ ["swrast" "virgl"];
+    ++ lib.optional stdenv.isLinux "swrast";
   driDrivers =
     (if dri_ == null
-      then defaultDriDrivers
-      else dri_) ++ ["swrast"];
+      then optionals (elem "drm" eglPlatforms) defaultDriDrivers
+      else dri_) ++ lib.optional stdenv.isLinux "swrast";
   vulkanDrivers =
     if vulkan_ == null
     then defaultVulkanDrivers
@@ -63,7 +67,7 @@ let
 in
 
 let
-  version = "18.1.7";
+  version = "18.2.1";
   branch  = head (splitString "." version);
 in
 
@@ -77,7 +81,7 @@ let self = stdenv.mkDerivation {
       "ftp://ftp.freedesktop.org/pub/mesa/older-versions/${branch}.x/${version}/mesa-${version}.tar.xz"
       "https://mesa.freedesktop.org/archive/mesa-${version}.tar.xz"
     ];
-    sha256 = "655e3b32ce3bdddd5e6e8768596e5d4bdef82d0dd37067c324cc4b2daa207306";
+    sha256 = "0mhhr1id11s1fbdxbvr4a81xjh1nsznpra9dl36bv2hq7mpxqdln";
   };
 
   prePatch = "patchShebangs .";
@@ -89,9 +93,10 @@ let self = stdenv.mkDerivation {
     ./symlink-drivers.patch
     ./missing-includes.patch # dev_t needs sys/stat.h, time_t needs time.h, etc.-- fixes build w/musl
     ./disk_cache-include-dri-driver-path-in-cache-key.patch
-  ];
+  ] ++ lib.optional stdenv.isDarwin ./darwin-clock-gettime.patch;
 
-  outputs = [ "out" "dev" "drivers" "osmesa" ];
+  outputs = [ "out" "dev" "drivers" ]
+            ++ lib.optional (elem "swrast" galliumDrivers) "osmesa";
 
   # TODO: Figure out how to enable opencl without having a runtime dependency on clang
   configureFlags = [
@@ -99,19 +104,11 @@ let self = stdenv.mkDerivation {
     "--localstatedir=/var"
     "--with-dri-driverdir=$(drivers)/lib/dri"
     "--with-dri-searchpath=${libglvnd.driverLink}/lib/dri"
-    "--with-platforms=x11,wayland,drm"
+    "--with-platforms=${concatStringsSep "," eglPlatforms}"
+    "--with-gallium-drivers=${concatStringsSep "," galliumDrivers}"
+    "--with-dri-drivers=${concatStringsSep "," driDrivers}"
+    "--with-vulkan-drivers=${concatStringsSep "," vulkanDrivers}"
     "--enable-texture-float"
-  ]
-  ++ (optional (galliumDrivers != [])
-      ("--with-gallium-drivers=" +
-        builtins.concatStringsSep "," galliumDrivers))
-  ++ (optional (driDrivers != [])
-      ("--with-dri-drivers=" +
-        builtins.concatStringsSep "," driDrivers))
-  ++ (optional (vulkanDrivers != [])
-      ("--with-vulkan-drivers=" +
-        builtins.concatStringsSep "," vulkanDrivers))
-  ++ [
     (enableFeature stdenv.isLinux "dri3")
     (enableFeature stdenv.isLinux "nine") # Direct3D in Wine
     "--enable-libglvnd"
@@ -122,17 +119,18 @@ let self = stdenv.mkDerivation {
     "--enable-glx"
     # https://bugs.freedesktop.org/show_bug.cgi?id=35268
     (enableFeature (!stdenv.hostPlatform.isMusl) "glx-tls")
-    "--enable-gallium-osmesa" # used by wine
+    # used by wine
+    (enableFeature (elem "swrast" galliumDrivers) "gallium-osmesa")
     "--enable-llvm"
-    "--enable-egl"
-    "--enable-xa" # used in vmware driver
-    "--enable-gbm"
+    (enableFeature stdenv.isLinux "egl")
+    (enableFeature stdenv.isLinux "xa") # used in vmware driver
+    (enableFeature stdenv.isLinux "gbm")
     "--enable-xvmc"
     "--enable-vdpau"
     "--enable-shared-glapi"
     "--enable-llvm-shared-libs"
-    "--enable-omx-bellagio"
-    "--enable-va"
+    (enableFeature stdenv.isLinux "omx-bellagio")
+    (enableFeature stdenv.isLinux "va")
     "--disable-opencl"
   ];
 
@@ -140,16 +138,18 @@ let self = stdenv.mkDerivation {
 
   propagatedBuildInputs = with xorg;
     [ libXdamage libXxf86vm ]
-    ++ optional stdenv.isLinux libdrm;
+    ++ optional stdenv.isLinux libdrm
+    ++ optionals stdenv.isDarwin [ OpenGL Xplugin ];
 
   buildInputs = with xorg; [
     expat llvmPackages.llvm libglvnd
     glproto dri2proto dri3proto presentproto
-    libX11 libXext libxcb libXt libXfixes libxshmfence
-    libffi wayland wayland-protocols libvdpau libelf libXvMC
-    libomxil-bellagio libva-minimal libpthreadstubs openssl/*or another sha1 provider*/
+    libX11 libXext libxcb libXt libXfixes libxshmfence libXrandr
+    libffi libvdpau libelf libXvMC
+    libpthreadstubs openssl/*or another sha1 provider*/
     valgrind-light python2 python2.pkgs.Mako
-  ];
+  ] ++ lib.optionals stdenv.isLinux [ wayland wayland-protocols
+                                      libomxil-bellagio libva-minimal ];
 
   enableParallelBuilding = true;
   doCheck = false;
@@ -161,7 +161,7 @@ let self = stdenv.mkDerivation {
   ];
 
   # TODO: probably not all .la files are completely fixed, but it shouldn't matter;
-  postInstall = ''
+  postInstall = optionalString (galliumDrivers != []) ''
     # move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
     mv -t "$drivers/lib/"    \
       $out/lib/libXvMC*      \
@@ -215,7 +215,7 @@ let self = stdenv.mkDerivation {
   # TODO:
   #  check $out doesn't depend on llvm: builder failures are ignored
   #  for some reason grep -qv '${llvmPackages.llvm}' -R "$out";
-  postFixup = ''
+  postFixup = optionalString (galliumDrivers != []) ''
     # add RPATH so the drivers can find the moved libgallium and libdricore9
     # moved here to avoid problems with stripping patchelfed files
     for lib in $drivers/lib/*.so* $drivers/lib/*/*.so*; do
@@ -235,7 +235,9 @@ let self = stdenv.mkDerivation {
 
       # Use stub libraries from libglvnd and headers from Mesa.
       buildCommand = ''
-        ln -s ${libglvnd.out} $out
+        mkdir -p $out/nix-support
+        ln -s ${libglvnd.out}/lib $out/lib
+
         mkdir -p $dev/{,lib/pkgconfig,nix-support}
         echo "$out" > $dev/nix-support/propagated-build-inputs
         ln -s ${self.dev}/include $dev/include
@@ -257,6 +259,8 @@ let self = stdenv.mkDerivation {
         genPkgConfig egl EGL
         genPkgConfig glesv1_cm GLESv1_CM
         genPkgConfig glesv2 GLESv2
+      '' + lib.optionalString stdenv.isDarwin ''
+        echo ${OpenGL} > $out/nix-support/propagated-build-inputs
       '';
     };
   };
@@ -265,7 +269,7 @@ let self = stdenv.mkDerivation {
     description = "An open source implementation of OpenGL";
     homepage = https://www.mesa3d.org/;
     license = licenses.mit; # X11 variant, in most files
-    platforms = platforms.linux;
+    platforms = platforms.linux ++ platforms.darwin;
     maintainers = with maintainers; [ vcunat ];
   };
 };
diff --git a/pkgs/development/libraries/mesa/missing-includes.patch b/pkgs/development/libraries/mesa/missing-includes.patch
index feb6ffe428c0..18e7d5437b15 100644
--- a/pkgs/development/libraries/mesa/missing-includes.patch
+++ b/pkgs/development/libraries/mesa/missing-includes.patch
@@ -32,16 +32,6 @@
  #include <unistd.h>
  #include <fcntl.h>
  #else
---- ./src/mesa/drivers/dri/i965/brw_bufmgr.h
-+++ ./src/mesa/drivers/dri/i965/brw_bufmgr.h
-@@ -37,6 +37,7 @@
- #include <stdbool.h>
- #include <stdint.h>
- #include <stdio.h>
-+#include <time.h>
- #include "util/u_atomic.h"
- #include "util/list.h"
-
 --- ./src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
 +++ ./src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.h
 @@ -28,6 +28,8 @@
diff --git a/pkgs/development/libraries/mono-addins/default.nix b/pkgs/development/libraries/mono-addins/default.nix
index 780f68e7d485..345c6e51f0b7 100644
--- a/pkgs/development/libraries/mono-addins/default.nix
+++ b/pkgs/development/libraries/mono-addins/default.nix
@@ -2,14 +2,14 @@
 
 stdenv.mkDerivation rec {
   name = "mono-addins-${version}";
-  version = "1.2";
+  version = "1.3.3";
 
   src = fetchFromGitHub {
     owner = "mono";
     repo = "mono-addins";
 
     rev = "mono-addins-${version}";
-    sha256 = "1hnn0a2qsjcjprsxas424bzvhsdwy0yc2jj5xbp698c0m9kfk24y";
+    sha256 = "018g3bd8afjc39h22h2j5r6ldsdn08ynx7wg889gdvnxg3hrxgl2";
   };
 
   nativeBuildInputs = [ pkgconfig autoreconfHook ];
diff --git a/pkgs/development/libraries/qt-4.x/4.8/default.nix b/pkgs/development/libraries/qt-4.x/4.8/default.nix
index f7ddf8ff780c..8715aaaa44d0 100644
--- a/pkgs/development/libraries/qt-4.x/4.8/default.nix
+++ b/pkgs/development/libraries/qt-4.x/4.8/default.nix
@@ -68,6 +68,7 @@ stdenv.mkDerivation rec {
       ./parallel-configure.patch
       ./clang-5-darwin.patch
       ./qt-4.8.7-unixmake-darwin.patch
+      ./kill-legacy-darwin-apis.patch
       (substituteAll {
         src = ./dlopen-absolute-paths.diff;
         cups = if cups != null then lib.getLib cups else null;
diff --git a/pkgs/development/libraries/qt-4.x/4.8/kill-legacy-darwin-apis.patch b/pkgs/development/libraries/qt-4.x/4.8/kill-legacy-darwin-apis.patch
new file mode 100644
index 000000000000..c1338e98d851
--- /dev/null
+++ b/pkgs/development/libraries/qt-4.x/4.8/kill-legacy-darwin-apis.patch
@@ -0,0 +1,330 @@
+diff --git a/src/corelib/io/qfilesystemengine_unix.cpp b/src/corelib/io/qfilesystemengine_unix.cpp
+index 4a9049b..c0ac9db 100644
+--- a/src/corelib/io/qfilesystemengine_unix.cpp
++++ b/src/corelib/io/qfilesystemengine_unix.cpp
+@@ -242,9 +242,8 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry,
+ #else
+     char *ret = 0;
+ # if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
+-    // When using -mmacosx-version-min=10.4, we get the legacy realpath implementation,
+-    // which does not work properly with the realpath(X,0) form. See QTBUG-28282.
+-    if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) {
++    // In Nix-on-Darwin, we don't support ancient macOS anyway, and the deleted branch relies on
++    // a symbol that's been deprecated for years and that our CF doesn't have
+         ret = (char*)malloc(PATH_MAX + 1);
+         if (ret && realpath(entry.nativeFilePath().constData(), (char*)ret) == 0) {
+             const int savedErrno = errno; // errno is checked below, and free() might change it
+@@ -252,19 +251,6 @@ QFileSystemEntry QFileSystemEngine::canonicalName(const QFileSystemEntry &entry,
+             errno = savedErrno;
+             ret = 0;
+         }
+-    } else {
+-        // on 10.5 we can use FSRef to resolve the file path.
+-        QString path = QDir::cleanPath(entry.filePath());
+-        FSRef fsref;
+-        if (FSPathMakeRef((const UInt8 *)path.toUtf8().data(), &fsref, 0) == noErr) {
+-            CFURLRef urlref = CFURLCreateFromFSRef(NULL, &fsref);
+-            CFStringRef canonicalPath = CFURLCopyFileSystemPath(urlref, kCFURLPOSIXPathStyle);
+-            QString ret = QCFString::toQString(canonicalPath);
+-            CFRelease(canonicalPath);
+-            CFRelease(urlref);
+-            return QFileSystemEntry(ret);
+-        }
+-    }
+ # else
+ #  if _POSIX_VERSION >= 200801L
+     ret = realpath(entry.nativeFilePath().constData(), (char*)0);
+diff --git a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.h b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.h
+index 3bf7342..b6bcfc0 100644
+--- a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.h
++++ b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.h
+@@ -43,7 +43,6 @@ BOOL stringIsCaseInsensitiveEqualToString(NSString *first, NSString *second);
+ BOOL hasCaseInsensitiveSuffix(NSString *string, NSString *suffix);
+ BOOL hasCaseInsensitiveSubstring(NSString *string, NSString *substring);
+ NSString *filenameByFixingIllegalCharacters(NSString *string);
+-CFStringEncoding stringEncodingForResource(Handle resource);
+ 
+ #ifdef __cplusplus
+ }
+diff --git a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm
+index d6c3f0c..c88ca76 100644
+--- a/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm
++++ b/src/3rdparty/webkit/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm
+@@ -68,45 +68,4 @@ BOOL hasCaseInsensitiveSubstring(NSString *string, NSString *substring)
+     return filename;
+ }
+ 
+-CFStringEncoding stringEncodingForResource(Handle resource)
+-{
+-    short resRef = HomeResFile(resource);
+-    if (ResError() != noErr)
+-        return NSMacOSRomanStringEncoding;
+-    
+-    // Get the FSRef for the current resource file
+-    FSRef fref;
+-    OSStatus error = FSGetForkCBInfo(resRef, 0, NULL, NULL, NULL, &fref, NULL);
+-    if (error != noErr)
+-        return NSMacOSRomanStringEncoding;
+-    
+-    RetainPtr<CFURLRef> url(AdoptCF, CFURLCreateFromFSRef(NULL, &fref));
+-    if (!url)
+-        return NSMacOSRomanStringEncoding;
+-
+-    NSString *path = [(NSURL *)url.get() path];
+-
+-    // Get the lproj directory name
+-    path = [path stringByDeletingLastPathComponent];
+-    if (!stringIsCaseInsensitiveEqualToString([path pathExtension], @"lproj"))
+-        return NSMacOSRomanStringEncoding;
+-    
+-    NSString *directoryName = [[path stringByDeletingPathExtension] lastPathComponent];
+-    RetainPtr<CFStringRef> locale(AdoptCF, CFLocaleCreateCanonicalLocaleIdentifierFromString(NULL, (CFStringRef)directoryName));
+-    if (!locale)
+-        return NSMacOSRomanStringEncoding;
+-
+-    LangCode lang;
+-    RegionCode region;
+-    error = LocaleStringToLangAndRegionCodes([(NSString *)locale.get() UTF8String], &lang, &region);
+-    if (error != noErr)
+-        return NSMacOSRomanStringEncoding;
+-
+-    TextEncoding encoding;
+-    error = UpgradeScriptInfoToTextEncoding(kTextScriptDontCare, lang, region, NULL, &encoding);
+-    if (error != noErr)
+-        return NSMacOSRomanStringEncoding;
+-    
+-    return encoding;
+-}
+ 
+diff --git a/src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginPackageMac.cpp b/src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginPackageMac.cpp
+index 865ea32..20bda8d 100644
+--- a/src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginPackageMac.cpp
++++ b/src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginPackageMac.cpp
+@@ -101,33 +101,6 @@ static WTF::RetainPtr<CFDictionaryRef> readPListFile(CFStringRef fileName, bool
+     return map;
+ }
+ 
+-static Vector<String> stringListFromResourceId(SInt16 id)
+-{
+-    Vector<String> list;
+-
+-    Handle handle = Get1Resource('STR#', id);
+-    if (!handle)
+-        return list;
+-
+-    CFStringEncoding encoding = stringEncodingForResource(handle);
+-
+-    unsigned char* p = (unsigned char*)*handle;
+-    if (!p)
+-        return list;
+-
+-    SInt16 count = *(SInt16*)p;
+-    p += sizeof(SInt16);
+-
+-    for (SInt16 i = 0; i < count; ++i) {
+-        unsigned char length = *p;
+-        WTF::RetainPtr<CFStringRef> str = CFStringCreateWithPascalString(0, p, encoding);
+-        list.append(str.get());
+-        p += 1 + length;
+-    }
+-
+-    return list;
+-}
+-
+ bool PluginPackage::fetchInfo()
+ {
+     if (!load())
+@@ -202,36 +175,8 @@ bool PluginPackage::fetchInfo()
+         m_description = (CFStringRef)CFBundleGetValueForInfoDictionaryKey(m_module, CFSTR("WebPluginDescription"));
+ 
+     } else {
+-        int resFile = CFBundleOpenBundleResourceMap(m_module);
+-
+-        UseResFile(resFile);
+-
+-        Vector<String> mimes = stringListFromResourceId(MIMEListStringStringNumber);
+-
+-        if (mimes.size() % 2 != 0)
+-            return false;
+-
+-        Vector<String> descriptions = stringListFromResourceId(MIMEDescriptionStringNumber);
+-        if (descriptions.size() != mimes.size() / 2)
+-            return false;
+-
+-        for (size_t i = 0;  i < mimes.size(); i += 2) {
+-            String mime = mimes[i].lower();
+-            Vector<String> extensions;
+-            mimes[i + 1].lower().split(UChar(','), extensions);
+-
+-            m_mimeToExtensions.set(mime, extensions);
+-
+-            m_mimeToDescriptions.set(mime, descriptions[i / 2]);
+-        }
+-
+-        Vector<String> names = stringListFromResourceId(PluginNameOrDescriptionStringNumber);
+-        if (names.size() == 2) {
+-            m_description = names[0];
+-            m_name = names[1];
+-        }
+-
+-        CFBundleCloseBundleResourceMap(m_module, resFile);
++        LOG(Plugins, "Nix removed ancient code that relies on long-deprecated functionality that we don't want to support!");
++        return false;
+     }
+ 
+     LOG(Plugins, "PluginPackage::fetchInfo(): Found plug-in '%s'", m_name.utf8().data());
+diff --git a/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm b/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
+index b206e48..669d442 100644
+--- a/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
++++ b/src/3rdparty/webkit/Source/WebKit2/Shared/Plugins/Netscape/mac/NetscapePluginModuleMac.mm
+@@ -26,7 +26,6 @@
+ #import "config.h"
+ #import "NetscapePluginModule.h"
+ 
+-#import <WebCore/WebCoreNSStringExtras.h>
+ #import <wtf/HashSet.h>
+ 
+ using namespace WebCore;
+@@ -196,132 +195,6 @@ static bool getPluginInfoFromPropertyLists(CFBundleRef bundle, PluginInfo& plugi
+     return true;    
+ }
+ 
+-class ResourceMap {
+-public:
+-    explicit ResourceMap(CFBundleRef bundle)
+-        : m_bundle(bundle)
+-        , m_currentResourceFile(CurResFile())
+-        , m_bundleResourceMap(CFBundleOpenBundleResourceMap(m_bundle))
+-    {
+-        UseResFile(m_bundleResourceMap);
+-    }
+-
+-    ~ResourceMap()
+-    {
+-        // Close the resource map.
+-        CFBundleCloseBundleResourceMap(m_bundle, m_bundleResourceMap);
+-        
+-        // And restore the old resource.
+-        UseResFile(m_currentResourceFile);
+-    }
+-
+-    bool isValid() const { return m_bundleResourceMap != -1; }
+-
+-private:
+-    CFBundleRef m_bundle;
+-    ResFileRefNum m_currentResourceFile;
+-    ResFileRefNum m_bundleResourceMap;
+-};
+-
+-static bool getStringListResource(ResID resourceID, Vector<String>& stringList) {
+-    Handle stringListHandle = Get1Resource('STR#', resourceID);
+-    if (!stringListHandle || !*stringListHandle)
+-        return false;
+-
+-    // Get the string list size.
+-    Size stringListSize = GetHandleSize(stringListHandle);
+-    if (stringListSize < static_cast<Size>(sizeof(UInt16)))
+-        return false;
+-
+-    CFStringEncoding stringEncoding = stringEncodingForResource(stringListHandle);
+-
+-    unsigned char* ptr = reinterpret_cast<unsigned char*>(*stringListHandle);
+-    unsigned char* end = ptr + stringListSize;
+-    
+-    // Get the number of strings in the string list.
+-    UInt16 numStrings = *reinterpret_cast<UInt16*>(ptr);
+-    ptr += sizeof(UInt16);
+-
+-    for (UInt16 i = 0; i < numStrings; ++i) {
+-        // We're past the end of the string, bail.
+-        if (ptr >= end)
+-            return false;
+-
+-        // Get the string length.
+-        unsigned char stringLength = *ptr++;
+-
+-        RetainPtr<CFStringRef> cfString(AdoptCF, CFStringCreateWithBytesNoCopy(kCFAllocatorDefault, ptr, stringLength, stringEncoding, false, kCFAllocatorNull));
+-        if (!cfString.get())
+-            return false;
+-
+-        stringList.append(cfString.get());
+-        ptr += stringLength;
+-    }
+-
+-    if (ptr != end)
+-        return false;
+-
+-    return true;
+-}
+-
+-static const ResID PluginNameOrDescriptionStringNumber = 126;
+-static const ResID MIMEDescriptionStringNumber = 127;
+-static const ResID MIMEListStringStringNumber = 128;
+-
+-static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginInfo& pluginInfo)
+-{
+-    ResourceMap resourceMap(bundle);
+-    if (!resourceMap.isValid())
+-        return false;
+-
+-    // Get the description and name string list.
+-    Vector<String> descriptionAndName;
+-    if (!getStringListResource(PluginNameOrDescriptionStringNumber, descriptionAndName))
+-        return false;
+-
+-    // Get the MIME types and extensions string list. This list needs to be a multiple of two.
+-    Vector<String> mimeTypesAndExtensions;
+-    if (!getStringListResource(MIMEListStringStringNumber, mimeTypesAndExtensions))
+-        return false;
+-
+-    if (mimeTypesAndExtensions.size() % 2)
+-        return false;
+-
+-    // Now get the MIME type descriptions string list. This string list needs to be the same length as the number of MIME types.
+-    Vector<String> mimeTypeDescriptions;
+-    if (!getStringListResource(MIMEDescriptionStringNumber, mimeTypeDescriptions))
+-        return false;
+-
+-    // Add all MIME types.
+-    for (size_t i = 0; i < mimeTypesAndExtensions.size() / 2; ++i) {
+-        MimeClassInfo mimeClassInfo;
+-        
+-        const String& mimeType = mimeTypesAndExtensions[i * 2];
+-        String description;
+-        if (i < mimeTypeDescriptions.size())
+-            description = mimeTypeDescriptions[i];
+-        
+-        mimeClassInfo.type = mimeType.lower();
+-        mimeClassInfo.desc = description;
+-        
+-        Vector<String> extensions;
+-        mimeTypesAndExtensions[i * 2 + 1].split(',', extensions);
+-        
+-        for (size_t i = 0; i < extensions.size(); ++i)
+-            mimeClassInfo.extensions.append(extensions[i].lower());
+-
+-        pluginInfo.mimes.append(mimeClassInfo);
+-    }
+-
+-    // Set the description and name if they exist.
+-    if (descriptionAndName.size() > 0)
+-        pluginInfo.desc = descriptionAndName[0];
+-    if (descriptionAndName.size() > 1)
+-        pluginInfo.name = descriptionAndName[1];
+-
+-    return true;
+-}
+-
+ bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginInfoStore::Plugin& plugin)
+ {
+     RetainPtr<CFStringRef> bundlePath(AdoptCF, pluginPath.createCFString());
+@@ -344,8 +217,7 @@ static bool getPluginInfoFromCarbonResources(CFBundleRef bundle, PluginInfo& plu
+         return false;
+     
+     // Check that there's valid info for this plug-in.
+-    if (!getPluginInfoFromPropertyLists(bundle.get(), plugin.info) &&
+-        !getPluginInfoFromCarbonResources(bundle.get(), plugin.info))
++    if (!getPluginInfoFromPropertyLists(bundle.get(), plugin.info))
+         return false;
+     
+     plugin.path = pluginPath;
diff --git a/pkgs/development/libraries/science/math/openblas/default.nix b/pkgs/development/libraries/science/math/openblas/default.nix
index 3f271d015027..453ad884b423 100644
--- a/pkgs/development/libraries/science/math/openblas/default.nix
+++ b/pkgs/development/libraries/science/math/openblas/default.nix
@@ -79,12 +79,12 @@ let
 in
 stdenv.mkDerivation rec {
   name = "openblas-${version}";
-  version = "0.3.1";
+  version = "0.3.3";
   src = fetchFromGitHub {
     owner = "xianyi";
     repo = "OpenBLAS";
     rev = "v${version}";
-    sha256 = "1dkwp4gz1hzpmhzks9y9ipb4c5h0r6c7yff62x3s8x9z6f8knaqc";
+    sha256 = "0cpkvfvc14xm9mifrm919rp8vrq70gpl7r2sww4f0izrl39wklwx";
   };
 
   inherit blas64;
@@ -118,20 +118,7 @@ stdenv.mkDerivation rec {
     ] ++ stdenv.lib.optional (stdenv.hostPlatform.libc == "musl") "NO_AFFINITY=1"
     ++ mapAttrsToList (var: val: var + "=" + val) config;
 
-    patches = [
-      # Backport of https://github.com/xianyi/OpenBLAS/pull/1667, which
-      # is causing problems and was already accepted upstream.
-      (fetchpatch {
-        url = "https://github.com/xianyi/OpenBLAS/commit/5f2a3c05cd0e3872be3c5686b9da6b627658eeb7.patch";
-        sha256 = "1qvxhk92likrshw6z6hjqxvkblwzgsbzis2b2f71bsvx9174qfk1";
-      })
-      # Double "MAX_ALLOCATING_THREADS", fix with Go and Octave
-      # https://github.com/xianyi/OpenBLAS/pull/1663 (see also linked issue)
-      (fetchpatch {
-        url = "https://github.com/xianyi/OpenBLAS/commit/a49203b48c4a3d6f86413fc8c4b1fbfaa1946463.patch";
-        sha256 = "0v6kjkbgbw7hli6xkism48wqpkypxmcqvxpx564snll049l2xzq2";
-      })
-    ];
+    patches = [];
 
   doCheck = true;
   checkTarget = "tests";
@@ -140,7 +127,7 @@ stdenv.mkDerivation rec {
     # Write pkgconfig aliases. Upstream report:
     # https://github.com/xianyi/OpenBLAS/issues/1740
     for alias in blas cblas lapack; do
-      cat <<EOF > $out/lib/pkgconfig/openblas-$alias.pc
+      cat <<EOF > $out/lib/pkgconfig/$alias.pc
 Name: $alias
 Version: ${version}
 Description: $alias provided by the OpenBLAS package.
diff --git a/pkgs/development/ocaml-modules/doc-ock-html/default.nix b/pkgs/development/ocaml-modules/doc-ock-html/default.nix
new file mode 100644
index 000000000000..cb2756b0977c
--- /dev/null
+++ b/pkgs/development/ocaml-modules/doc-ock-html/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, ocaml, findlib, dune, doc-ock, tyxml, xmlm }:
+
+stdenv.mkDerivation rec {
+  name = "ocaml${ocaml.version}-doc-ock-html-${version}";
+  version = "1.2.1";
+
+  src = fetchFromGitHub {
+    owner = "ocaml-doc";
+    repo = "doc-ock-html";
+    rev = "v${version}";
+    sha256 = "1y620h48qrplmcm78g7c78zibpkai4j3icwmnx95zb3r8xq8554y";
+  };
+
+  buildInputs = [ ocaml findlib dune ];
+
+  propagatedBuildInputs = [ doc-ock tyxml xmlm ];
+
+  inherit (dune) installPhase;
+
+  meta = {
+    description = "From doc-ock to HTML";
+    license = stdenv.lib.licenses.isc;
+    maintainers = [ stdenv.lib.maintainers.vbgl ];
+    inherit (ocaml.meta) platforms;
+    inherit (src.meta) homepage;
+  };
+}
diff --git a/pkgs/development/ocaml-modules/doc-ock-xml/default.nix b/pkgs/development/ocaml-modules/doc-ock-xml/default.nix
new file mode 100644
index 000000000000..72e562cb5f36
--- /dev/null
+++ b/pkgs/development/ocaml-modules/doc-ock-xml/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, ocaml, findlib, dune, doc-ock, menhir, xmlm }:
+
+stdenv.mkDerivation rec {
+  name = "ocaml${ocaml.version}-doc-ock-xml-${version}";
+  version = "1.2.1";
+
+  src = fetchFromGitHub {
+    owner = "ocaml-doc";
+    repo = "doc-ock-xml";
+    rev = "v${version}";
+    sha256 = "1s27ri7vj9ixi5p5ixg6g6invk96807bvxbqjrr1dm8sxgl1nd20";
+  };
+
+  buildInputs = [ ocaml findlib dune ];
+
+  propagatedBuildInputs = [ doc-ock menhir xmlm ];
+
+  inherit (dune) installPhase;
+
+  meta = {
+    description = "XML printer and parser for Doc-Ock";
+    license = stdenv.lib.licenses.isc;
+    maintainers = [ stdenv.lib.maintainers.vbgl ];
+    inherit (ocaml.meta) platforms;
+    inherit (src.meta) homepage;
+  };
+}
diff --git a/pkgs/development/ocaml-modules/doc-ock/default.nix b/pkgs/development/ocaml-modules/doc-ock/default.nix
new file mode 100644
index 000000000000..c158f08b0687
--- /dev/null
+++ b/pkgs/development/ocaml-modules/doc-ock/default.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, ocaml, findlib, dune, octavius, cppo }:
+
+stdenv.mkDerivation rec {
+  name = "ocaml${ocaml.version}-doc-ock-${version}";
+  version = "1.2.1";
+
+  src = fetchFromGitHub {
+    owner = "ocaml-doc";
+    repo = "doc-ock";
+    rev = "v${version}";
+    sha256 = "090vprm12jrl55yllk1hdzbsqyr107yjs2qnc49yahdhvnr4h5b7";
+  };
+
+  buildInputs = [ ocaml findlib dune cppo ];
+
+  propagatedBuildInputs = [ octavius ];
+
+  inherit (dune) installPhase;
+
+  meta = {
+    description = "Extract documentation from OCaml files";
+    license = stdenv.lib.licenses.isc;
+    maintainers = [ stdenv.lib.maintainers.vbgl ];
+    inherit (ocaml.meta) platforms;
+    inherit (src.meta) homepage;
+  };
+}
diff --git a/pkgs/development/ocaml-modules/erm_xml/default.nix b/pkgs/development/ocaml-modules/erm_xml/default.nix
index c944752ff6b6..35b5c73b578b 100644
--- a/pkgs/development/ocaml-modules/erm_xml/default.nix
+++ b/pkgs/development/ocaml-modules/erm_xml/default.nix
@@ -1,17 +1,17 @@
 { stdenv, fetchzip, ocaml, findlib, ocamlbuild }:
 
-if stdenv.lib.versionAtLeast ocaml.version "4.06"
+if !stdenv.lib.versionAtLeast ocaml.version "4.02"
 then throw "erm_xml is not available for OCaml ${ocaml.version}"
 else
 
-let version = "0.3"; in
+let version = "0.3+20180112"; in
 
 stdenv.mkDerivation {
-  name = "ocaml-erm_xml-${version}";
+  name = "ocaml${ocaml.version}-erm_xml-${version}";
 
   src = fetchzip {
-    url = "https://github.com/ermine/xml/archive/v${version}.tar.gz";
-    sha256 = "19znk5w0qiw3wij4n6w3h5bcr221yy57jf815fr8k9m8kin710g3";
+    url = "https://github.com/hannesm/xml/archive/bbabdade807d8281fc48806da054b70dfe482479.tar.gz";
+    sha256 = "1gawpmg8plip0wia0xq60m024dn7l3ykwbjpbqx9f9bdmx74n1rr";
   };
 
   buildInputs = [ ocaml findlib ocamlbuild ];
@@ -19,7 +19,7 @@ stdenv.mkDerivation {
   createFindlibDestdir = true;
 
   meta = {
-    homepage = https://github.com/ermine/xml;
+    homepage = https://github.com/hannesm/xml;
     description = "XML Parser for discrete data";
     platforms = ocaml.meta.platforms or [];
     license = stdenv.lib.licenses.bsd3;
diff --git a/pkgs/development/ocaml-modules/erm_xmpp/0.3.nix b/pkgs/development/ocaml-modules/erm_xmpp/0.3.nix
deleted file mode 100644
index 1a8f854185a2..000000000000
--- a/pkgs/development/ocaml-modules/erm_xmpp/0.3.nix
+++ /dev/null
@@ -1,29 +0,0 @@
-{ stdenv, buildOcaml, fetchFromGitHub, ocaml, findlib, erm_xml, nocrypto }:
-
-buildOcaml rec {
-  version = "0.3";
-  name = "erm_xmpp";
-
-  src = fetchFromGitHub {
-    owner  = "hannesm";
-    repo   = "xmpp";
-    rev    = "eee18bd3dd343550169969c0b45548eafd51cfe1";
-    sha256 = "0hzs528lrx1ayalv6fh555pjn0b4l8xch1f72hd3b07g1xahdas5";
-  };
-
-  buildInputs = [ ocaml findlib ];
-  propagatedBuildInputs = [ erm_xml nocrypto ];
-
-  configurePhase = "ocaml setup.ml -configure --prefix $out";
-  buildPhase = "ocaml setup.ml -build";
-  installPhase = "ocaml setup.ml -install";
-
-  createFindlibDestdir = true;
-
-  meta = {
-    homepage = https://github.com/hannesm/xmpp;
-    description = "OCaml based XMPP implementation (fork)";
-    license = stdenv.lib.licenses.bsd3;
-    maintainers = with stdenv.lib.maintainers; [ sternenseemann ];
-  };
-}
diff --git a/pkgs/development/ocaml-modules/erm_xmpp/default.nix b/pkgs/development/ocaml-modules/erm_xmpp/default.nix
index c6027ce11ce5..a6bb75e61c24 100644
--- a/pkgs/development/ocaml-modules/erm_xmpp/default.nix
+++ b/pkgs/development/ocaml-modules/erm_xmpp/default.nix
@@ -1,33 +1,32 @@
-{ stdenv, fetchurl, fetchzip, ocaml, findlib, ocamlbuild, erm_xml, cryptokit, camlp4 }:
+{ stdenv, fetchFromGitHub, ocaml, findlib, camlp4, ocamlbuild
+, erm_xml, nocrypto
+}:
 
-let
-  version = "0.2";
-  disable-tests = fetchurl {
-    url = https://raw.githubusercontent.com/ocaml/opam-repository/master/packages/erm_xmpp/erm_xmpp.0.2/files/disable_tests.patch;
-    sha256 = "09d8630nmx2x8kb8ap1zmsb93zs14cqg7ga1gmdl92jvsjxbhgc1";
-  };
-in
-
-stdenv.mkDerivation {
-  name = "ocaml-erm_xmpp-${version}";
+stdenv.mkDerivation rec {
+  version = "0.3+20180112";
+  name = "ocaml${ocaml.version}-erm_xmpp-${version}";
 
-  src = fetchzip {
-    url = "https://github.com/ermine/xmpp/archive/v${version}.tar.gz";
-    sha256 = "0saw2dmrzv2aadrznvyvchnhivvcwm78x9nwf6flq5v0pqddapk2";
+  src = fetchFromGitHub {
+    owner  = "hannesm";
+    repo   = "xmpp";
+    rev    = "184dc70fab7d46d09b9148ca4448f07f1e0a2df2";
+    sha256 = "1dsqsfacvd9xqsqjzh6xwbnf2mv1dvhy210riyvjd260q085ch6n";
   };
 
-  patches = [ disable-tests ];
-
   buildInputs = [ ocaml findlib ocamlbuild camlp4 ];
-  propagatedBuildInputs = [ erm_xml cryptokit ];
+  propagatedBuildInputs = [ erm_xml nocrypto ];
+
+  configurePhase = "ocaml setup.ml -configure --prefix $out";
+  buildPhase = "ocaml setup.ml -build";
+  installPhase = "ocaml setup.ml -install";
 
   createFindlibDestdir = true;
 
   meta = {
-    homepage = https://github.com/ermine/xmpp;
-    description = "OCaml based XMPP implementation";
-    platforms = ocaml.meta.platforms or [];
+    homepage = https://github.com/hannesm/xmpp;
+    description = "OCaml based XMPP implementation (fork)";
     license = stdenv.lib.licenses.bsd3;
-    maintainers = with stdenv.lib.maintainers; [ vbgl ];
+    maintainers = with stdenv.lib.maintainers; [ sternenseemann ];
+    inherit (ocaml.meta) platforms;
   };
 }
diff --git a/pkgs/development/ocaml-modules/odoc/default.nix b/pkgs/development/ocaml-modules/odoc/default.nix
new file mode 100644
index 000000000000..4c5da695eb6c
--- /dev/null
+++ b/pkgs/development/ocaml-modules/odoc/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, ocaml, findlib, dune
+, bos, cmdliner, doc-ock-html, doc-ock-xml
+}:
+
+stdenv.mkDerivation rec {
+  name = "ocaml${ocaml.version}-odoc-${version}";
+  version = "1.2.0";
+  src = fetchFromGitHub {
+    owner = "ocaml";
+    repo = "odoc";
+    rev = "v${version}";
+    sha256 = "0ixnhfpm1nw4bvjj8qhcyy283pdr5acqpg5wxwq3n1l4mad79cgh";
+  };
+
+  buildInputs = [ ocaml findlib dune cmdliner ];
+
+  propagatedBuildInputs = [ bos doc-ock-html doc-ock-xml ];
+
+  inherit (dune) installPhase;
+
+  meta = {
+    description = "A documentation generator for OCaml";
+    license = stdenv.lib.licenses.isc;
+    maintainers = [ stdenv.lib.maintainers.vbgl ];
+    inherit (ocaml.meta) platforms;
+    inherit (src.meta) homepage;
+  };
+}
diff --git a/pkgs/development/python-modules/autobahn/default.nix b/pkgs/development/python-modules/autobahn/default.nix
index 87a337a154dd..04aa9411247e 100644
--- a/pkgs/development/python-modules/autobahn/default.nix
+++ b/pkgs/development/python-modules/autobahn/default.nix
@@ -21,7 +21,9 @@ buildPythonPackage rec {
     (stdenv.lib.optionals (!isPy3k) [ trollius futures ]);
 
   checkPhase = ''
+    runHook preCheck
     USE_TWISTED=true py.test $out
+    runHook postCheck
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/python-modules/flask-assets/default.nix b/pkgs/development/python-modules/flask-assets/default.nix
index 7f3b6367b6ee..a8e454f4a2cc 100644
--- a/pkgs/development/python-modules/flask-assets/default.nix
+++ b/pkgs/development/python-modules/flask-assets/default.nix
@@ -9,6 +9,10 @@ buildPythonPackage rec {
     sha256 = "0ivqsihk994rxw58vdgzrx4d77d7lpzjm4qxb38hjdgvi5xm4cb0";
   };
 
+  patchPhase = ''
+    substituteInPlace tests/test_integration.py --replace 'static_path=' 'static_url_path='
+  '';
+
   propagatedBuildInputs = [ flask webassets flask_script nose ];
 
   meta = with lib; {
diff --git a/pkgs/development/python-modules/pyftgl/default.nix b/pkgs/development/python-modules/pyftgl/default.nix
index a85837472255..1163f007b092 100644
--- a/pkgs/development/python-modules/pyftgl/default.nix
+++ b/pkgs/development/python-modules/pyftgl/default.nix
@@ -1,5 +1,13 @@
-{ stdenv, buildPythonPackage, fetchFromGitHub, isPy3k
-, boost, freetype, ftgl, libGLU_combined }:
+{ lib, buildPythonPackage, fetchFromGitHub, isPy3k
+, boost, freetype, ftgl, libGLU_combined
+, python
+}:
+
+let
+
+  pythonVersion = with lib.versions; "${major python.version}${minor python.version}";
+
+in
 
 buildPythonPackage rec {
   pname = "pyftgl";
@@ -13,13 +21,13 @@ buildPythonPackage rec {
     sha256 = "12zcjv4cwwjihiaf74kslrdmmk4bs47h7006gyqfwdfchfjdgg4r";
   };
 
-  postPatch = stdenv.lib.optional isPy3k ''
-    sed -i "s,'boost_python','boost_python3',g" setup.py
+  postPatch = ''
+    sed -i "s,'boost_python','boost_python${pythonVersion}',g" setup.py
   '';
 
   buildInputs = [ boost freetype ftgl libGLU_combined ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Python bindings for FTGL (FreeType for OpenGL)";
     license = licenses.gpl2Plus;
   };
diff --git a/pkgs/development/python-modules/pyjet/default.nix b/pkgs/development/python-modules/pyjet/default.nix
new file mode 100644
index 000000000000..69d20863a772
--- /dev/null
+++ b/pkgs/development/python-modules/pyjet/default.nix
@@ -0,0 +1,21 @@
+{ lib, buildPythonPackage, fetchPypi, nose, numpy }:
+
+buildPythonPackage rec {
+  pname = "pyjet";
+  version = "1.3.0";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1glcwv9ni8i40smfw6m456xjadlkackim5nk33xmas1fa96lpagg";
+  };
+
+  propagatedBuildInputs = [ numpy ];
+  checkInputs = [ nose ];
+
+  meta = with lib; {
+    homepage = "https://github.com/scikit-hep/pyjet";
+    description = "The interface between FastJet and NumPy";
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ veprbl ];
+  };
+}
diff --git a/pkgs/development/python-modules/pyopenssl/default.nix b/pkgs/development/python-modules/pyopenssl/default.nix
index 035c70f3995a..d6b966b6df3c 100644
--- a/pkgs/development/python-modules/pyopenssl/default.nix
+++ b/pkgs/development/python-modules/pyopenssl/default.nix
@@ -11,6 +11,41 @@
 , glibcLocales
 }:
 
+with stdenv.lib;
+
+
+let
+  # https://github.com/pyca/pyopenssl/issues/791
+  # These tests, we disable in the case that libressl is passed in as openssl.
+  failingLibresslTests = [
+    "test_op_no_compression"
+    "test_npn_advertise_error"
+    "test_npn_select_error"
+    "test_npn_client_fail"
+    "test_npn_success"
+    "test_use_certificate_chain_file_unicode"
+    "test_use_certificate_chain_file_bytes"
+    "test_add_extra_chain_cert"
+    "test_set_session_id_fail"
+    "test_verify_with_revoked"
+    "test_set_notAfter"
+    "test_set_notBefore"
+  ];
+
+  disabledTests = [
+    # https://github.com/pyca/pyopenssl/issues/692
+    # These tests, we disable always.
+    "test_set_default_verify_paths"
+    "test_fallback_default_verify_paths"
+  ] ++ (optionals (hasPrefix "libressl" openssl.meta.name) failingLibresslTests);
+
+  # Compose the final string expression, including the "-k" and the single quotes.
+  testExpression = optionalString (disabledTests != [])
+    "-k 'not ${concatStringsSep " and not " disabledTests}'";
+
+in
+
+
 buildPythonPackage rec {
   pname = "pyOpenSSL";
   version = "18.0.0";
@@ -22,16 +57,10 @@ buildPythonPackage rec {
 
   outputs = [ "out" "dev" ];
 
-  preCheck = ''
-    sed -i 's/test_set_default_verify_paths/noop/' tests/test_ssl.py
-    # https://github.com/pyca/pyopenssl/issues/692
-    sed -i 's/test_fallback_default_verify_paths/noop/' tests/test_ssl.py
-  '';
-
   checkPhase = ''
     runHook preCheck
     export LANG="en_US.UTF-8"
-    py.test
+    py.test tests ${testExpression}
     runHook postCheck
   '';
 
@@ -43,4 +72,4 @@ buildPythonPackage rec {
   propagatedBuildInputs = [ cryptography pyasn1 idna ];
 
   checkInputs = [ pytest pretend flaky glibcLocales ];
-}
\ No newline at end of file
+}
diff --git a/pkgs/development/python-modules/pytest/default.nix b/pkgs/development/python-modules/pytest/default.nix
index 3770f62f1a5b..6146159ad0ab 100644
--- a/pkgs/development/python-modules/pytest/default.nix
+++ b/pkgs/development/python-modules/pytest/default.nix
@@ -29,9 +29,11 @@ buildPythonPackage rec {
 
   # Remove .pytest_cache when using py.test in a Nix build
   setupHook = writeText "pytest-hook" ''
-    postFixupHooks+=(
-        'find $out -name .pytest_cache -type d -exec rm -rf {} +'
-    )
+    pytestcachePhase() {
+        find $out -name .pytest_cache -type d -exec rm -rf {} +
+    }
+
+    preDistPhases+=" pytestcachePhase"
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/python-modules/pytorch/default.nix b/pkgs/development/python-modules/pytorch/default.nix
index d31719efa172..7d56f1990a52 100644
--- a/pkgs/development/python-modules/pytorch/default.nix
+++ b/pkgs/development/python-modules/pytorch/default.nix
@@ -42,6 +42,22 @@ in buildPythonPackage rec {
     export CUDNN_INCLUDE_DIR=${cudnn}/include
   '';
 
+  preFixup = ''
+    function join_by { local IFS="$1"; shift; echo "$*"; }
+    function strip2 {
+      IFS=':'
+      read -ra RP <<< $(patchelf --print-rpath $1)
+      IFS=' '
+      RP_NEW=$(join_by : ''${RP[@]:2})
+      patchelf --set-rpath \$ORIGIN:''${RP_NEW} "$1"
+    }
+
+    for f in $(find ''${out} -name 'libcaffe2*.so')
+    do
+      strip2 $f
+    done
+  '';
+
   buildInputs = [
      cmake
      numpy.blas
@@ -56,7 +72,7 @@ in buildPythonPackage rec {
   ] ++ lib.optional (pythonOlder "3.5") typing;
 
   checkPhase = ''
-    ${cudaStubEnv}python test/run_test.py --exclude distributed autograd distributions jit sparse torch utils nn
+    ${cudaStubEnv}python test/run_test.py --exclude dataloader sparse torch utils
   '';
 
   meta = {
diff --git a/pkgs/development/ruby-modules/solargraph/Gemfile.lock b/pkgs/development/ruby-modules/solargraph/Gemfile.lock
index 436d31830ff4..04d274d05621 100644
--- a/pkgs/development/ruby-modules/solargraph/Gemfile.lock
+++ b/pkgs/development/ruby-modules/solargraph/Gemfile.lock
@@ -26,7 +26,7 @@ GEM
       ruby-progressbar (~> 1.7)
       unicode-display_width (~> 1.0, >= 1.0.1)
     ruby-progressbar (1.10.0)
-    solargraph (0.27.1)
+    solargraph (0.28.1)
       coderay (~> 1.1)
       eventmachine (~> 1.2, >= 1.2.5)
       htmlentities (~> 4.3, >= 4.3.4)
diff --git a/pkgs/development/ruby-modules/solargraph/gemset.nix b/pkgs/development/ruby-modules/solargraph/gemset.nix
index 840cf922419b..3319f2a68de5 100644
--- a/pkgs/development/ruby-modules/solargraph/gemset.nix
+++ b/pkgs/development/ruby-modules/solargraph/gemset.nix
@@ -127,10 +127,10 @@
     dependencies = ["coderay" "eventmachine" "htmlentities" "kramdown" "parser" "reverse_markdown" "rubocop" "thor" "tilt" "yard"];
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "1wp4k6ayv9gv1rzxqccz6zb1fss7klszqwha9wvs6mj3c1vhghac";
+      sha256 = "11l759mrzjla2iqy5wdd20r01196pfxkw0b0gzgskdbfi8y8mvg5";
       type = "gem";
     };
-    version = "0.27.1";
+    version = "0.28.1";
   };
   thor = {
     source = {
diff --git a/pkgs/development/tools/analysis/valgrind/default.nix b/pkgs/development/tools/analysis/valgrind/default.nix
index 5734a0f27953..ccc2cf9b4ab5 100644
--- a/pkgs/development/tools/analysis/valgrind/default.nix
+++ b/pkgs/development/tools/analysis/valgrind/default.nix
@@ -17,6 +17,7 @@ stdenv.mkDerivation rec {
   buildInputs = [ perl gdb ]  ++ stdenv.lib.optionals (stdenv.isDarwin) [ bootstrap_cmds xnu ];
 
   enableParallelBuilding = true;
+  separateDebugInfo = stdenv.isLinux;
 
   preConfigure = stdenv.lib.optionalString stdenv.isDarwin (
     let OSRELEASE = ''
diff --git a/pkgs/development/tools/build-managers/ninja/default.nix b/pkgs/development/tools/build-managers/ninja/default.nix
index b1df54f9bd5c..bb08ae2f3af5 100644
--- a/pkgs/development/tools/build-managers/ninja/default.nix
+++ b/pkgs/development/tools/build-managers/ninja/default.nix
@@ -1,4 +1,6 @@
-{ stdenv, fetchFromGitHub, python, asciidoc, docbook_xml_dtd_45, docbook_xsl, libxslt, re2c }:
+{ stdenv, fetchFromGitHub, python, buildDocs ? true, asciidoc, docbook_xml_dtd_45, docbook_xsl, libxslt, re2c }:
+
+with stdenv.lib;
 
 stdenv.mkDerivation rec {
   name = "ninja-${version}";
@@ -11,10 +13,11 @@ stdenv.mkDerivation rec {
     sha256 = "16scq9hcq6c5ap6sy8j4qi75qps1zvrf3p79j1vbrvnqzp928i5f";
   };
 
-  nativeBuildInputs = [ python asciidoc docbook_xml_dtd_45 docbook_xsl libxslt.bin re2c ];
+  nativeBuildInputs = [ python ] ++ optionals buildDocs [ asciidoc docbook_xml_dtd_45 docbook_xsl libxslt.bin re2c ];
 
   buildPhase = ''
     python configure.py --bootstrap
+  '' + optionalString buildDocs ''
     # "./ninja -vn manual" output copied here to support cross compilation.
     asciidoc -b docbook -d book -o build/manual.xml doc/manual.asciidoc
     xsltproc --nonet doc/docbook.xsl build/manual.xml > doc/manual.html
@@ -22,14 +25,15 @@ stdenv.mkDerivation rec {
 
   installPhase = ''
     install -Dm555 -t $out/bin ninja
-    install -Dm444 -t $out/share/doc/ninja doc/manual.asciidoc doc/manual.html
     install -Dm444 misc/bash-completion $out/share/bash-completion/completions/ninja
     install -Dm444 misc/zsh-completion $out/share/zsh/site-functions/_ninja
+  '' + optionalString buildDocs ''
+    install -Dm444 -t $out/share/doc/ninja doc/manual.asciidoc doc/manual.html
   '';
 
   setupHook = ./setup-hook.sh;
 
-  meta = with stdenv.lib; {
+  meta = {
     description = "Small build system with a focus on speed";
     longDescription = ''
       Ninja is a small build system with a focus on speed. It differs from
diff --git a/pkgs/development/tools/documentation/gtk-doc/default.nix b/pkgs/development/tools/documentation/gtk-doc/default.nix
index 8ec6aec9918e..0213eca30d22 100644
--- a/pkgs/development/tools/documentation/gtk-doc/default.nix
+++ b/pkgs/development/tools/documentation/gtk-doc/default.nix
@@ -1,5 +1,6 @@
 { stdenv, fetchurl, autoreconfHook, pkgconfig, perl, python, libxml2Python, libxslt, which
-, docbook_xml_dtd_43, docbook_xsl, gnome-doc-utils, dblatex, gettext, itstool
+, docbook_xml_dtd_43, docbook_xsl, gnome-doc-utils, gettext, itstool
+, withDblatex ? false, dblatex
 }:
 
 stdenv.mkDerivation rec {
@@ -20,8 +21,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ autoreconfHook ];
   buildInputs =
     [ pkgconfig perl python libxml2Python libxslt docbook_xml_dtd_43 docbook_xsl
-      gnome-doc-utils dblatex gettext which itstool
-    ];
+      gnome-doc-utils gettext which itstool
+    ] ++ stdenv.lib.optional withDblatex dblatex;
 
   configureFlags = [ "--disable-scrollkeeper" ];
 
diff --git a/pkgs/development/tools/misc/ycmd/default.nix b/pkgs/development/tools/misc/ycmd/default.nix
index c0e12aa22c44..062f90e3389d 100644
--- a/pkgs/development/tools/misc/ycmd/default.nix
+++ b/pkgs/development/tools/misc/ycmd/default.nix
@@ -7,12 +7,12 @@
 
 stdenv.mkDerivation rec {
   name = "ycmd-${version}";
-  version = "2018-07-24";
+  version = "2018-09-20";
 
   src = fetchgit {
     url = "https://github.com/Valloric/ycmd.git";
-    rev = "f8a8b04892b925efeee24298a957cc6d6a69ad06";
-    sha256 = "1br2sh6bs0fg1axq2hq9f48fz8klkzydi1mf0j0jdsh3zjzkmxbn";
+    rev = "bf658fd78722c517674c0aaf2381e199bca8f163";
+    sha256 = "1lwa8xr76vapfpncvp81cn3m9219yw14fl7fzk5gnly60zkphbbl";
   };
 
   nativeBuildInputs = [ cmake ];
diff --git a/pkgs/misc/libcardiacarrest/default.nix b/pkgs/misc/libcardiacarrest/default.nix
index 28e9b81df86a..1a07878b3302 100644
--- a/pkgs/misc/libcardiacarrest/default.nix
+++ b/pkgs/misc/libcardiacarrest/default.nix
@@ -4,13 +4,13 @@ with stdenv.lib;
 
 stdenv.mkDerivation rec {
   name = "libcardiacarrest-${version}";
-  version = "12.1-6"; # <PA API version>-<version>
+  version = "12.1-7"; # <PA API version>-<version>
 
   src = fetchFromGitHub {
     owner = "oxij";
     repo = "libcardiacarrest";
-    rev = "4df92b6cc66c7f9fe947dd9bbf4802cf20fe63a2";
-    sha256 = "0zfjn4nvcx8r4f6czcix5b9nsszhhhlbypcwqzi4ddhazl1gyfm6";
+    rev = "d44288d9a24d6b7793fb36a4c9a548b6b55375ec";
+    sha256 = "0j3l5s6r9hgpy5y7q7kx0rkh05rk0bgfdvzbmadqps720lqjs4xm";
   };
 
   outputs = [ "out" "dev" ];
diff --git a/pkgs/os-specific/darwin/apple-source-releases/CF/add-cfmachport.patch b/pkgs/os-specific/darwin/apple-source-releases/CF/add-cfmachport.patch
deleted file mode 100644
index a1018d389c14..000000000000
--- a/pkgs/os-specific/darwin/apple-source-releases/CF/add-cfmachport.patch
+++ /dev/null
@@ -1,22 +0,0 @@
---- CF-855.17/CoreFoundation.h  2015-01-03 00:17:41.000000000 -0500
-+++ CF-855.17/CoreFoundation.h.new  2015-01-03 00:18:35.000000000 -0500
-@@ -72,6 +72,7 @@
- #include <CoreFoundation/CFDictionary.h>
- #include <CoreFoundation/CFError.h>
- #include <CoreFoundation/CFLocale.h>
-+#include <CoreFoundation/CFMachPort.h>
- #include <CoreFoundation/CFNumber.h>
- #include <CoreFoundation/CFNumberFormatter.h>
- #include <CoreFoundation/CFPreferences.h>
-
---- CF-855.17/Makefile  2015-01-03 00:32:52.000000000 -0500
-+++ CF-855.17/Makefile.new  2015-01-03 00:33:07.000000000 -0500
-@@ -9,7 +9,7 @@
- HFILES = $(wildcard *.h)
- INTERMEDIATE_HFILES = $(addprefix $(OBJBASE)/CoreFoundation/,$(HFILES))
- 
--PUBLIC_HEADERS=CFArray.h CFBag.h CFBase.h CFBinaryHeap.h CFBitVector.h CFBundle.h CFByteOrder.h CFCalendar.h CFCharacterSet.h CFData.h CFDate.h CFDateFormatter.h CFDictionary.h CFError.h CFLocale.h CFMessagePort.h CFNumber.h CFNumberFormatter.h CFPlugIn.h CFPlugInCOM.h CFPreferences.h CFPropertyList.h CFRunLoop.h CFSet.h CFSocket.h CFStream.h CFString.h CFStringEncodingExt.h CFTimeZone.h CFTree.h CFURL.h CFURLAccess.h CFUUID.h CFUserNotification.h CFXMLNode.h CFXMLParser.h CFAvailability.h CFUtilities.h CoreFoundation.h
-+PUBLIC_HEADERS=CFArray.h CFBag.h CFBase.h CFBinaryHeap.h CFBitVector.h CFBundle.h CFByteOrder.h CFCalendar.h CFCharacterSet.h CFData.h CFDate.h CFDateFormatter.h CFDictionary.h CFError.h CFLocale.h CFMachPort.h CFMessagePort.h CFNumber.h CFNumberFormatter.h CFPlugIn.h CFPlugInCOM.h CFPreferences.h CFPropertyList.h CFRunLoop.h CFSet.h CFSocket.h CFStream.h CFString.h CFStringEncodingExt.h CFTimeZone.h CFTree.h CFURL.h CFURLAccess.h CFUUID.h CFUserNotification.h CFXMLNode.h CFXMLParser.h CFAvailability.h CFUtilities.h CoreFoundation.h
- 
- PRIVATE_HEADERS=CFBundlePriv.h CFCharacterSetPriv.h CFError_Private.h CFLogUtilities.h CFPriv.h CFRuntime.h CFStorage.h CFStreamAbstract.h CFStreamPriv.h CFStreamInternal.h CFStringDefaultEncoding.h CFStringEncodingConverter.h CFStringEncodingConverterExt.h CFUniChar.h CFUnicodeDecomposition.h CFUnicodePrecomposition.h ForFoundationOnly.h CFBurstTrie.h CFICULogging.h
- 
diff --git a/pkgs/os-specific/darwin/apple-source-releases/CF/cf-bridging.patch b/pkgs/os-specific/darwin/apple-source-releases/CF/cf-bridging.patch
deleted file mode 100644
index 068a6311a9cb..000000000000
--- a/pkgs/os-specific/darwin/apple-source-releases/CF/cf-bridging.patch
+++ /dev/null
@@ -1,39 +0,0 @@
-diff --git a/CFBase.h b/CFBase.h
-index ffddd2b..e5a926b 100644
---- a/CFBase.h
-+++ b/CFBase.h
-@@ -249,6 +249,33 @@ CF_EXTERN_C_BEGIN
- #endif
- #endif
- 
-+#if __has_attribute(objc_bridge) && __has_feature(objc_bridge_id) && __has_feature(objc_bridge_id_on_typedefs)
-+
-+#ifdef __OBJC__
-+@class NSArray;
-+@class NSAttributedString;
-+@class NSString;
-+@class NSNull;
-+@class NSCharacterSet;
-+@class NSData;
-+@class NSDate;
-+@class NSTimeZone;
-+@class NSDictionary;
-+@class NSError;
-+@class NSLocale;
-+@class NSNumber;
-+@class NSSet;
-+@class NSURL;
-+#endif
-+
-+#define CF_BRIDGED_TYPE(T)		__attribute__((objc_bridge(T)))
-+#define CF_BRIDGED_MUTABLE_TYPE(T)	__attribute__((objc_bridge_mutable(T)))
-+#define CF_RELATED_TYPE(T,C,I)		__attribute__((objc_bridge_related(T,C,I)))
-+#else
-+#define CF_BRIDGED_TYPE(T)
-+#define CF_BRIDGED_MUTABLE_TYPE(T)
-+#define CF_RELATED_TYPE(T,C,I)
-+#endif
- 
- CF_EXPORT double kCFCoreFoundationVersionNumber;
- 
-
diff --git a/pkgs/os-specific/darwin/apple-source-releases/CF/default.nix b/pkgs/os-specific/darwin/apple-source-releases/CF/default.nix
deleted file mode 100644
index 5589d1592f46..000000000000
--- a/pkgs/os-specific/darwin/apple-source-releases/CF/default.nix
+++ /dev/null
@@ -1,51 +0,0 @@
-{ stdenv, appleDerivation, ICU, dyld, libdispatch, libplatform, launchd, libclosure }:
-
-# this project uses blocks, a clang-only extension
-assert stdenv.cc.isClang;
-
-appleDerivation {
-  buildInputs = [ dyld ICU libdispatch libplatform launchd libclosure ];
-
-  patches = [ ./add-cfmachport.patch ./cf-bridging.patch ./remove-xpc.patch ];
-
-  __propagatedImpureHostDeps = [ "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation" ];
-
-  preBuild = ''
-    substituteInPlace Makefile \
-      --replace "/usr/bin/clang" "clang" \
-      --replace "-arch i386 " "" \
-      --replace "/usr/bin/" "" \
-      --replace "/usr/sbin/" "" \
-      --replace "/bin/" "" \
-      --replace "INSTALLNAME=/System" "INSTALLNAME=$out" \
-      --replace "install_name_tool -id /System/Library/Frameworks" "install_name_tool -id @rpath" \
-      --replace 'chown -RH -f root:wheel $(DSTBASE)/CoreFoundation.framework' "" \
-      --replace 'chmod -RH' 'chmod -R'
-
-    # with this file present, CoreFoundation gets a _main symbol defined, which can
-    # interfere with linking other programs
-    rm plconvert.c
-
-    replacement=''$'#define __PTK_FRAMEWORK_COREFOUNDATION_KEY5 55\n#define _pthread_getspecific_direct(key) pthread_getspecific((key))\n#define _pthread_setspecific_direct(key, val) pthread_setspecific((key), (val))'
-
-    substituteInPlace CFPlatform.c --replace "#include <pthread/tsd_private.h>" "$replacement"
-
-    substituteInPlace CFRunLoop.c --replace "#include <pthread/private.h>" ""
-
-    substituteInPlace CFURLPriv.h \
-      --replace "#include <CoreFoundation/CFFileSecurity.h>" "" \
-      --replace "#include <CoreFoundation/CFURLEnumerator.h>" "" \
-      --replace "CFFileSecurityRef" "void *" \
-      --replace "CFURLEnumeratorResult" "void *" \
-      --replace "CFURLEnumeratorRef" "void *"
-
-    export DSTROOT=$out
-  '';
-
-  postInstall = ''
-    mv $out/System/* $out
-    rmdir $out/System
-    mv $out/Library/Frameworks/CoreFoundation.framework/Versions/A/PrivateHeaders/* \
-       $out/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers
-  '';
-}
diff --git a/pkgs/os-specific/darwin/apple-source-releases/CF/remove-xpc.patch b/pkgs/os-specific/darwin/apple-source-releases/CF/remove-xpc.patch
deleted file mode 100644
index a7b9fe486434..000000000000
--- a/pkgs/os-specific/darwin/apple-source-releases/CF/remove-xpc.patch
+++ /dev/null
@@ -1,17 +0,0 @@
-diff --git a/CFBundlePriv.h b/CFBundlePriv.h
-index d4feb5f..e7b52e8 100644
---- a/CFBundlePriv.h
-+++ b/CFBundlePriv.h
-@@ -254,12 +254,6 @@ Boolean _CFBundleGetStringsFilesShared(CFBundleRef bundle);
- CF_EXPORT
- CFURLRef _CFBundleCopyFrameworkURLForExecutablePath(CFStringRef executablePath);
- 
--#if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)
--#include <xpc/xpc.h>
--CF_EXPORT
--void _CFBundleSetupXPCBootstrap(xpc_object_t bootstrap) CF_AVAILABLE(10_10, 8_0);
--#endif
--
- /* Functions deprecated as SPI */
- 
- CF_EXPORT
diff --git a/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix b/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix
index 89ff68266a29..761ff3ea9252 100644
--- a/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/ICU/default.nix
@@ -1,8 +1,6 @@
-{ cctools, appleDerivation }:
+{ appleDerivation }:
 
 appleDerivation {
-  nativeBuildInputs = [ cctools ];
-
   patches = [ ./clang-5.patch ];
 
   postPatch = ''
diff --git a/pkgs/os-specific/darwin/apple-source-releases/default.nix b/pkgs/os-specific/darwin/apple-source-releases/default.nix
index e2d62cef1ba4..4fa0c0e3e47f 100644
--- a/pkgs/os-specific/darwin/apple-source-releases/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/default.nix
@@ -204,7 +204,6 @@ let
     bootstrap_cmds  = applePackage "bootstrap_cmds"    "dev-tools-7.0"   "1v5dv2q3af1xwj5kz0a5g54fd5dm6j4c9dd2g66n4kc44ixyrhp3" {};
     bsdmake         = applePackage "bsdmake"           "dev-tools-3.2.6" "11a9kkhz5bfgi1i8kpdkis78lhc6b5vxmhd598fcdgra1jw4iac2" {};
     CarbonHeaders   = applePackage "CarbonHeaders"     "osx-10.6.2"      "1zam29847cxr6y9rnl76zqmkbac53nx0szmqm9w5p469a6wzjqar" {};
-    CF              = applePackage "CF"                "osx-10.10.5"     "07f5psjxi7wyd13ci4x83ya5hy6p69sjfqcpp2mmxdlhd8yzkf74" {};
     CommonCrypto    = applePackage "CommonCrypto"      "osx-10.11.6"     "0vllfpb8f4f97wj2vpdd7w5k9ibnsbr6ff1zslpp6q323h01n25y" {};
     configd         = applePackage "configd"           "osx-10.8.5"      "1gxakahk8gallf16xmhxhprdxkh3prrmzxnmxfvj0slr0939mmr2" {};
     copyfile        = applePackage "copyfile"          "osx-10.11.6"     "1rkf3iaxmjz5ycgrmf0g971kh90jb2z1zqxg5vlqz001s4y457gs" {};
@@ -216,7 +215,7 @@ let
 
     # Splicing is currently broken in Nixpkgs
     # cctools need to be specified manually here to handle this
-    ICU             = applePackage "ICU"               "osx-10.10.5"     "1qihlp42n5g4dl0sn0f9pc0bkxy1452dxzf0vr6y5gqpshlzy03p" { inherit (buildPackages.darwin) cctools; };
+    ICU             = applePackage "ICU"               "osx-10.10.5"     "1qihlp42n5g4dl0sn0f9pc0bkxy1452dxzf0vr6y5gqpshlzy03p" {};
 
     IOKit           = applePackage "IOKit"             "osx-10.11.6"     "0kcbrlyxcyirvg5p95hjd9k8a01k161zg0bsfgfhkb90kh2s8x00" { inherit IOKitSrcs; };
     launchd         = applePackage "launchd"           "osx-10.9.5"      "0w30hvwqq8j5n90s3qyp0fccxflvrmmjnicjri4i1vd2g196jdgj" {};
diff --git a/pkgs/os-specific/darwin/apple-source-releases/libsecurity_generic/default.nix b/pkgs/os-specific/darwin/apple-source-releases/libsecurity_generic/default.nix
index fe68ee78d1f0..714524e8da58 100644
--- a/pkgs/os-specific/darwin/apple-source-releases/libsecurity_generic/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/libsecurity_generic/default.nix
@@ -33,7 +33,6 @@ name: version: sha256: args: let
         pkgs.gnustep.make
         pkgs.darwin.apple_sdk.frameworks.AppKit
         pkgs.darwin.apple_sdk.frameworks.Foundation
-        pkgs.darwin.cf-private
       ];
       makeFlags = [
         "-f${makeFile}"
diff --git a/pkgs/os-specific/darwin/apple-source-releases/libsecurity_keychain/default.nix b/pkgs/os-specific/darwin/apple-source-releases/libsecurity_keychain/default.nix
index 609d07fda100..724c4788b6cc 100644
--- a/pkgs/os-specific/darwin/apple-source-releases/libsecurity_keychain/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/libsecurity_keychain/default.nix
@@ -39,9 +39,5 @@ appleDerivation {
       --replace 'return mLoginDLDbIdentifier;' 'return mLoginDLDbIdentifier; }' \
       --replace '_xpc_runtime_is_app_sandboxed()' 'false'
       # hope that doesn't hurt anything
-
-    substituteInPlace lib/KCEventNotifier.h --replace \
-      'CoreFoundation/CFNotificationCenter.h' \
-      '${apple_sdk.sdk.out}/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/CFNotificationCenter.h'
   '';
 }
diff --git a/pkgs/os-specific/darwin/cctools/port.nix b/pkgs/os-specific/darwin/cctools/port.nix
index fff6eaaa5c1d..bad17cf6de46 100644
--- a/pkgs/os-specific/darwin/cctools/port.nix
+++ b/pkgs/os-specific/darwin/cctools/port.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchFromGitHub, autoconf, automake, libtool_2, autoreconfHook
-, libcxxabi, libuuid
+, libcxxabi, libuuid, llvm
 , libobjc ? null, maloader ? null
 , enableDumpNormalizedLibArgs ? false
 }:
@@ -56,7 +56,7 @@ let
       autoreconfHook
     ];
     buildInputs = [ libuuid ] ++
-      stdenv.lib.optionals stdenv.isDarwin [ libcxxabi libobjc ];
+      stdenv.lib.optionals stdenv.isDarwin [ llvm libcxxabi libobjc ];
 
     patches = [
       ./ld-rpath-nonfinal.patch ./ld-ignore-rpath-link.patch
diff --git a/pkgs/os-specific/darwin/cf-private/default.nix b/pkgs/os-specific/darwin/cf-private/default.nix
index 603c0f652b01..3fac20d23c78 100644
--- a/pkgs/os-specific/darwin/cf-private/default.nix
+++ b/pkgs/os-specific/darwin/cf-private/default.nix
@@ -1,21 +1,59 @@
-{ stdenv, osx_private_sdk, CF }:
+{ CF, apple_sdk }:
 
-stdenv.mkDerivation {
-  name = "${CF.name}-private";
-  phases = [ "installPhase" "fixupPhase" ];
-  installPhase = ''
-    dest=$out/Library/Frameworks/CoreFoundation.framework/Headers
-    mkdir -p $dest
-    pushd $dest
-      for file in ${CF}/Library/Frameworks/CoreFoundation.framework/Headers/*; do
-        ln -sf $file
-      done
-
-      # Copy or overwrite private headers, some of these might already
-      # exist in CF but the private versions have more information.
-      cp -Lfv ${osx_private_sdk}/include/CoreFoundationPrivateHeaders/* $dest
-    popd
-  '';
+# cf-private is a bit weird, but boils down to CF with a weird setup-hook that
+# makes a build link against the system CoreFoundation rather than our pure one.
+# The reason it exists is that although our CF headers and build are pretty legit
+# now, the underlying runtime is quite different. Apple's in a bit of flux around CF
+# right now, and support three different backends for it: swift, "C", and an ObjC
+# one. The former two can be built from public sources, but the ObjC one isn't really
+# public. Unfortunately, it's also one of the core underpinnings of a lot of Mac-
+# specific behavior, and defines a lot of symbols that some Objective C apps depend
+# on, even though one might expect those symbols to derive from Foundation. So if
+# your app relies on NSArray and several other basic ObjC types, it turns out that
+# because of their magic "toll-free bridging" support, the symbols for those types
+# live in CoreFoundation with an ObjC runtime. And because that isn't public, we have
+# this hack in place to let people link properly anyway. Phew!
+# 
+# This can be revisited if Apple ever decide to release the ObjC backend in a publicly
+# buildable form.
+# 
+# This doesn't really need to rebuild CF, but it's cheap, and adding a setup hook to
+# an existing package was annoying. We need a buildEnv that knows how to add those
+CF.overrideAttrs (orig: {
+  # PLEASE if you add things to this derivation, explain in reasonable detail why
+  # you're adding them and when the workaround can go away. This whole derivation is
+  # a workaround and if you don't explain what you're working around, it makes it
+  # very hard for people to clean it up later.
 
+  name = "${orig.name}-private";
   setupHook = ./setup-hook.sh;
-}
+
+  # TODO: consider re-adding https://github.com/NixOS/nixpkgs/blob/master/pkgs/os-specific/darwin/apple-source-releases/CF/cf-bridging.patch
+  # once the missing headers are in and see if that fixes all need for this.
+
+  # This can go away once https://bugs.swift.org/browse/SR-8741 happens, which is
+  # looking more likely these days with the friendly people at Apple! We only need
+  # the header because the setup hook takes care of linking us against a version
+  # of the framework with the functionality built into it. The main user I know of
+  # this is watchman, who can almost certainly switch to the pure CF once the header
+  # and functionality is merged in.
+  installPhase = orig.installPhase + ''
+    basepath="Library/Frameworks/CoreFoundation.framework/Headers"
+    path="$basepath/CFFileDescriptor.h"
+
+    # Append the include at top level or nobody will notice the header we're about to add
+    sed -i '/CFNotificationCenter.h/a #include <CoreFoundation/CFFileDescriptor.h>' \
+      "$out/$basepath/CoreFoundation.h"
+
+    cp ${apple_sdk.frameworks.CoreFoundation}/$path $out/$path
+  '' +
+  # This one is less likely to go away, but I'll mention it anyway. The issue is at
+  # https://bugs.swift.org/browse/SR-8744, and the main user I know of is qtbase
+  ''
+    path="$basepath/CFURLEnumerator.h"    
+    sed -i '/CFNotificationCenter.h/a #include <CoreFoundation/CFURLEnumerator.h>' \
+      "$out/$basepath/CoreFoundation.h"
+
+    cp ${apple_sdk.frameworks.CoreFoundation}/$path $out/$path
+  '';
+})
\ No newline at end of file
diff --git a/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix b/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix
index 1dea55cccc9e..f819429f4deb 100644
--- a/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix
+++ b/pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix
@@ -14,11 +14,12 @@ in stdenv.mkDerivation {
   src = fetchFromGitHub {
     owner  = "apple";
     repo   = "swift-corelibs-foundation";
-    rev    = "85c640e7ce50e6ca61a134c72270e214bc63fdba"; # https://github.com/apple/swift-corelibs-foundation/pull/1686
-    sha256 = "0z2v278wy7jh0c92g1dszd8hj8naxari660sqx6yab5dwapd46qc";
+    rev    = "71aaba20e1450a82c516af1342fe23268e15de0a";
+    sha256 = "17kpql0f27xxz4jjw84vpas5f5sn4vdqwv10g151rc3rswbwln1z";
   };
 
-  buildInputs = [ ninja python libxml2 objc4 ICU curl ];
+  nativeBuildInputs = [ ninja python ];
+  buildInputs = [ libxml2 objc4 ICU curl ];
 
   sourceRoot = "source/CoreFoundation";
 
@@ -31,8 +32,7 @@ in stdenv.mkDerivation {
     # 3. Use the legit CoreFoundation.h, not the one telling you not to use it because of Swift
     substituteInPlace build.py \
       --replace "cf.CFLAGS += '-DDEPLOYMENT" '#' \
-      --replace "cf.LDFLAGS += '-ldispatch" '#' \
-      --replace "Base.subproj/SwiftRuntime/CoreFoundation.h" 'Base.subproj/CoreFoundation.h'
+      --replace "cf.LDFLAGS += '-ldispatch" '#'
 
     # Includes xpc for some initialization routine that they don't define anyway, so no harm here
     substituteInPlace PlugIn.subproj/CFBundlePriv.h \
@@ -53,8 +53,11 @@ in stdenv.mkDerivation {
 
   BUILD_DIR = "./Build";
   CFLAGS = "-DINCLUDE_OBJC -I${libxml2.dev}/include/libxml2"; # They seem to assume we include objc in some places and not in others, make a PR; also not sure why but libxml2 include path isn't getting picked up from buildInputs
-  LDFLAGS = "-install_name ${placeholder "out"}/Frameworks/CoreFoundation.framework/CoreFoundation -current_version 1234.56.7 -compatibility_version 150.0.0 -init ___CFInitialize";
-  configurePhase = "../configure --sysroot unused";
+  
+  # I'm guessing at the version here. https://github.com/apple/swift-corelibs-foundation/commit/df3ec55fe6c162d590a7653d89ad669c2b9716b1 imported "high sierra"
+  # and this version is a version from there. No idea how accurate it is.
+  LDFLAGS = "-current_version 1454.90.0 -compatibility_version 150.0.0 -init ___CFInitialize";
+  configurePhase = "../configure release --sysroot UNUSED";
 
   enableParallelBuilding = true;
   buildPhase = "ninja -j $NIX_BUILD_CORES";
@@ -66,6 +69,12 @@ in stdenv.mkDerivation {
     mkdir -p $base/Versions/A/{Headers,PrivateHeaders,Modules}
 
     cp ./Build/CoreFoundation/libCoreFoundation.dylib $base/Versions/A/CoreFoundation
+
+    # Note that this could easily live in the ldflags above as `-install_name @rpath/...` but
+    # https://github.com/NixOS/nixpkgs/issues/46434 thwarts that, so for now I'm hacking it up
+    # after the fact.
+    install_name_tool -id '@rpath/CoreFoundation.framework/Versions/A/CoreFoundation' $base/Versions/A/CoreFoundation
+
     cp ./Build/CoreFoundation/usr/include/CoreFoundation/*.h $base/Versions/A/Headers
     cp ./Build/CoreFoundation/usr/include/CoreFoundation/module.modulemap $base/Versions/A/Modules
 
diff --git a/pkgs/os-specific/darwin/swift-corelibs/default.nix b/pkgs/os-specific/darwin/swift-corelibs/default.nix
deleted file mode 100644
index 0d96b8fd008e..000000000000
--- a/pkgs/os-specific/darwin/swift-corelibs/default.nix
+++ /dev/null
@@ -1,8 +0,0 @@
-{ callPackage, darwin }:
-
-rec {
-  corefoundation = callPackage ./corefoundation.nix { inherit (darwin) objc4 ICU; };
-  libdispatch = callPackage ./libdispatch.nix {
-   inherit (darwin) apple_sdk_sierra xnu;
-  };
-}
diff --git a/pkgs/os-specific/linux/iproute/default.nix b/pkgs/os-specific/linux/iproute/default.nix
index 13135844aa7a..8f81ec4918ed 100644
--- a/pkgs/os-specific/linux/iproute/default.nix
+++ b/pkgs/os-specific/linux/iproute/default.nix
@@ -16,6 +16,8 @@ stdenv.mkDerivation rec {
     substituteInPlace Makefile --replace " netem " " "
   '';
 
+  outputs = [ "out" "dev"];
+
   makeFlags = [
     "DESTDIR="
     "LIBDIR=$(out)/lib"
@@ -23,7 +25,7 @@ stdenv.mkDerivation rec {
     "MANDIR=$(out)/share/man"
     "BASH_COMPDIR=$(out)/share/bash-completion/completions"
     "DOCDIR=$(TMPDIR)/share/doc/${name}" # Don't install docs
-    "HDRDIR=$(TMPDIR)/include/iproute2" # Don't install headers
+    "HDRDIR=$(dev)/include/iproute2"
   ];
 
   buildFlags = [
diff --git a/pkgs/os-specific/linux/iwd/default.nix b/pkgs/os-specific/linux/iwd/default.nix
index 79179f3fcbb8..1e3286f64d68 100644
--- a/pkgs/os-specific/linux/iwd/default.nix
+++ b/pkgs/os-specific/linux/iwd/default.nix
@@ -3,17 +3,17 @@
 let
   ell = fetchgit {
      url = https://git.kernel.org/pub/scm/libs/ell/ell.git;
-     rev = "0.9";
-     sha256 = "1kg7cx7ir8bvz33n624ncrq9r4fh7rg9z22fly894a3mk1imq22p";
+     rev = "0.10";
+     sha256 = "1yzbx4l3a6hbdmirgbvnrjfiwflyzd38mbxnp23gn9hg3ni3br34";
   };
 in stdenv.mkDerivation rec {
   name = "iwd-${version}";
-  version = "0.7";
+  version = "0.8";
 
   src = fetchgit {
     url = https://git.kernel.org/pub/scm/network/wireless/iwd.git;
     rev = version;
-    sha256 = "0q76fh6fcl7nxyjl8z2n4plp2qaxc1fqx575by6xqf1rnv4nk0ab";
+    sha256 = "0bx31f77mz3rbl3xja48lb5zgwgialg7hvax889kpkz92wg26mgv";
   };
 
   nativeBuildInputs = [
diff --git a/pkgs/os-specific/linux/kernel-headers/default.nix b/pkgs/os-specific/linux/kernel-headers/default.nix
index f7c3650f8187..23dcbb05f30a 100644
--- a/pkgs/os-specific/linux/kernel-headers/default.nix
+++ b/pkgs/os-specific/linux/kernel-headers/default.nix
@@ -43,7 +43,7 @@ let
 in {
 
   linuxHeaders = common {
-    version = "4.15";
-    sha256 = "0sd7l9n9h7vf9c6gd6ciji28hawda60yj0llh17my06m0s4lf9js";
+    version = "4.18.3";
+    sha256 = "1m23hjd02bg8mqnd8dc4z4m3kxds1cyrc6j5saiwnhzbz373rvc1";
   };
 }
diff --git a/pkgs/os-specific/linux/kernel/linux-rpi.nix b/pkgs/os-specific/linux/kernel/linux-rpi.nix
index d061e41eb2fe..d95c2caa2cf0 100644
--- a/pkgs/os-specific/linux/kernel/linux-rpi.nix
+++ b/pkgs/os-specific/linux/kernel/linux-rpi.nix
@@ -1,10 +1,10 @@
-{ stdenv, buildPackages, fetchFromGitHub, perl, buildLinux, ... } @ args:
+{ stdenv, lib, buildPackages, fetchFromGitHub, perl, buildLinux, ... } @ args:
 
 let
   modDirVersion = "4.14.62";
   tag = "1.20180817";
 in
-stdenv.lib.overrideDerivation (buildLinux (args // rec {
+lib.overrideDerivation (buildLinux (args // rec {
   version = "${modDirVersion}-${tag}";
   inherit modDirVersion;
 
@@ -18,6 +18,7 @@ stdenv.lib.overrideDerivation (buildLinux (args // rec {
   defconfig = {
     "armv6l-linux" = "bcmrpi_defconfig";
     "armv7l-linux" = "bcm2709_defconfig";
+    "aarch64-linux" = "bcmrpi3_defconfig";
   }.${stdenv.hostPlatform.system} or (throw "linux_rpi not supported on '${stdenv.hostPlatform.system}'");
 
   features = {
@@ -31,14 +32,15 @@ stdenv.lib.overrideDerivation (buildLinux (args // rec {
     sed -i $buildRoot/.config -e 's/^CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/'
   '';
 
+  # Make copies of the DTBs named after the upstream names so that U-Boot finds them.
+  # This is ugly as heck, but I don't know a better solution so far.
   postFixup = ''
-    # Make copies of the DTBs named after the upstream names so that U-Boot finds them.
-    # This is ugly as heck, but I don't know a better solution so far.
-    rm $out/dtbs/bcm283*.dtb
+    dtbDir=${if stdenv.isAarch64 then "$out/dtbs/broadcom" else "$out/dtbs"}
+    rm $dtbDir/bcm283*.dtb
     copyDTB() {
-      cp -v "$out/dtbs/$1" "$out/dtbs/$2"
+      cp -v "$dtbDir/$1" "$dtbDir/$2"
     }
-
+  '' + lib.optionalString (lib.elem stdenv.hostPlatform.system ["armv6l-linux"]) ''
     copyDTB bcm2708-rpi-0-w.dtb bcm2835-rpi-zero.dtb
     copyDTB bcm2708-rpi-0-w.dtb bcm2835-rpi-zero-w.dtb
     copyDTB bcm2708-rpi-b.dtb bcm2835-rpi-a.dtb
@@ -48,7 +50,9 @@ stdenv.lib.overrideDerivation (buildLinux (args // rec {
     copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-b-plus.dtb
     copyDTB bcm2708-rpi-b-plus.dtb bcm2835-rpi-zero.dtb
     copyDTB bcm2708-rpi-cm.dtb bcm2835-rpi-cm.dtb
+  '' + lib.optionalString (lib.elem stdenv.hostPlatform.system ["armv7l-linux"]) ''
     copyDTB bcm2709-rpi-2-b.dtb bcm2836-rpi-2-b.dtb
+  '' + lib.optionalString (lib.elem stdenv.hostPlatform.system ["armv7l-linux" "aarch64-linux"]) ''
     copyDTB bcm2710-rpi-3-b.dtb bcm2837-rpi-3-b.dtb
     copyDTB bcm2710-rpi-3-b-plus.dtb bcm2837-rpi-3-b-plus.dtb
     copyDTB bcm2710-rpi-cm3.dtb bcm2837-rpi-cm3.dtb
diff --git a/pkgs/os-specific/linux/kernel/linux-testing.nix b/pkgs/os-specific/linux/kernel/linux-testing.nix
index 4bfea7a10988..4b6be2556637 100644
--- a/pkgs/os-specific/linux/kernel/linux-testing.nix
+++ b/pkgs/os-specific/linux/kernel/linux-testing.nix
@@ -1,13 +1,13 @@
 { stdenv, buildPackages, fetchurl, perl, buildLinux, libelf, utillinux, ... } @ args:
 
 buildLinux (args // rec {
-  version = "4.19-rc4";
-  modDirVersion = "4.19.0-rc4";
+  version = "4.19-rc5";
+  modDirVersion = "4.19.0-rc5";
   extraMeta.branch = "4.19";
 
   src = fetchurl {
     url = "https://git.kernel.org/torvalds/t/linux-${version}.tar.gz";
-    sha256 = "083nlh25zddrbg1hzyxfpg9i7h91ij9f299i52r5zwzi85yi8whn";
+    sha256 = "0fpv2g6x1hgdrxvh1acjcxmyk2fzqcx1ypi0mqw72swbm587irck";
   };
 
   # Should the testing kernels ever be built on Hydra?
diff --git a/pkgs/os-specific/linux/nvidia-x11/default.nix b/pkgs/os-specific/linux/nvidia-x11/default.nix
index 16bab9979d03..d9ff157e1429 100644
--- a/pkgs/os-specific/linux/nvidia-x11/default.nix
+++ b/pkgs/os-specific/linux/nvidia-x11/default.nix
@@ -17,11 +17,13 @@ in
 rec {
   # Policy: use the highest stable version as the default (on our master).
   stable = generic {
-    version = "390.77";
-    sha256_32bit = "1yd313ghh2qbn07d5wbkshfwgkm4mh49vcqkydds3b3xk0mx4i8l";
-    sha256_64bit = "10kjccrkdn360035lh985cadhwy6lk9xrw3wlmww2wqfaa25f775";
-    settingsSha256 = "1wvxldpjkrx0ldjm5l6ycm6paxpcw89h0n6hfkznfkahkq7fwxdj";
-    persistencedSha256 = "1gklmc0v17m018cwpdlzwdyd45y4sjvjhj8a3l44baygix5zn30f";
+    version = "390.87";
+    sha256_32bit = "0rlr1f4lnpb8c4qz4w5r8xw5gdy9bzz26qww45qyl1qav3wwaaaw";
+    sha256_64bit = "07k1kq8lkgbvjyr2dnbxcz6nppcwpq17wf925w8kfq78345hla9q";
+    settingsSha256 = "0xlaiy7jr95z0v2c6cwll89nxnb142pybw7m08jg44r7n13ffv3r";
+    persistencedSha256 = "0mhwk321garyl6m12261cj03ycv0qz1sbrlbq6cqwjpq4f1s7h58";
+
+    patches = lib.optional (kernel.meta.branch == "4.19") ./drm_mode_connector.patch;
   };
 
   beta = stable; # not enough interest to maintain beta ATM
diff --git a/pkgs/os-specific/linux/nvidia-x11/drm_mode_connector.patch b/pkgs/os-specific/linux/nvidia-x11/drm_mode_connector.patch
new file mode 100644
index 000000000000..58cf06fae45f
--- /dev/null
+++ b/pkgs/os-specific/linux/nvidia-x11/drm_mode_connector.patch
@@ -0,0 +1,24 @@
+diff -ura a/kernel/nvidia-drm/nvidia-drm-connector.c b/kernel/nvidia-drm/nvidia-drm-connector.c
+--- a/kernel/nvidia-drm/nvidia-drm-connector.c	2018-09-07 17:38:31.807453997 -0400
++++ b/kernel/nvidia-drm/nvidia-drm-connector.c	2018-09-07 17:39:22.446185824 -0400
+@@ -226,7 +226,7 @@
+ 
+ 
+     if (nv_connector->edid != NULL) {
+-        drm_mode_connector_update_edid_property(
++        drm_connector_update_edid_property(
+             connector, nv_connector->edid);
+     }
+ 
+diff -ura a/kernel/nvidia-drm/nvidia-drm-encoder.c b/kernel/nvidia-drm/nvidia-drm-encoder.c
+--- a/kernel/nvidia-drm/nvidia-drm-encoder.c	2018-09-07 17:38:31.807453997 -0400
++++ b/kernel/nvidia-drm/nvidia-drm-encoder.c	2018-09-07 17:39:35.083798484 -0400
+@@ -216,7 +216,7 @@
+ 
+     /* Attach encoder and connector */
+ 
+-    ret = drm_mode_connector_attach_encoder(connector, encoder);
++    ret = drm_connector_attach_encoder(connector, encoder);
+ 
+     if (ret != 0) {
+         NV_DRM_DEV_LOG_ERR(
diff --git a/pkgs/os-specific/linux/systemd/default.nix b/pkgs/os-specific/linux/systemd/default.nix
index 482e3e0bc796..dd8105c8c058 100644
--- a/pkgs/os-specific/linux/systemd/default.nix
+++ b/pkgs/os-specific/linux/systemd/default.nix
@@ -26,8 +26,8 @@ in stdenv.mkDerivation rec {
   src = fetchFromGitHub {
     owner = "NixOS";
     repo = "systemd";
-    rev = "21efe60844fda21039c052442076dabcf8643a90";
-    sha256 = "0aqifjsb0kaxnqy5nlmzvyzgfd99lm60k1494lbnnk8ahdh8ab07";
+    rev = "31859ddd35fc3fa82a583744caa836d356c31d7f";
+    sha256 = "1xci0491j95vdjgs397n618zii3sgwnvanirkblqqw6bcvcjvir1";
   };
 
   outputs = [ "out" "lib" "man" "dev" ];
diff --git a/pkgs/servers/nosql/influxdb/default.nix b/pkgs/servers/nosql/influxdb/default.nix
index e73233bd1447..a47553b975e3 100644
--- a/pkgs/servers/nosql/influxdb/default.nix
+++ b/pkgs/servers/nosql/influxdb/default.nix
@@ -2,13 +2,13 @@
 
 buildGoPackage rec {
   name = "influxdb-${version}";
-  version = "1.4.1";
+  version = "1.6.3";
 
   src = fetchFromGitHub {
     owner = "influxdata";
     repo = "influxdb";
     rev = "v${version}";
-    sha256 = "048ap70hdfkxhy0y8q1jsb0lql1i99jnf3cqaqar6qs2ynzsw9hd";
+    sha256 = "0xf16liapllk8qnw0vsy1ja4if1xlazwwaa4p0r5j7bny5lxm7zy";
   };
 
   buildFlagsArray = [ ''-ldflags=
@@ -19,7 +19,7 @@ buildGoPackage rec {
 
   excludedPackages = "test";
 
-  # Generated with the nix2go
+  # Generated with dep2nix (for 1.6.3) / nix2go (for 1.4.1).
   goDeps = ./. + "/deps-${version}.nix";
 
   meta = with lib; {
diff --git a/pkgs/servers/nosql/influxdb/deps-1.6.3.nix b/pkgs/servers/nosql/influxdb/deps-1.6.3.nix
new file mode 100644
index 000000000000..a2f4dfaeb8d6
--- /dev/null
+++ b/pkgs/servers/nosql/influxdb/deps-1.6.3.nix
@@ -0,0 +1,444 @@
+# file generated from Gopkg.lock using dep2nix (https://github.com/nixcloud/dep2nix)
+[
+  {
+    goPackagePath  = "collectd.org";
+    fetch = {
+      type = "git";
+      url = "https://github.com/collectd/go-collectd";
+      rev =  "2ce144541b8903101fb8f1483cc0497a68798122";
+      sha256 = "0rr9rnc777jk27a7yxhdb7vgkj493158a8k6q44x51s30dkp78x3";
+    };
+  }
+  {
+    goPackagePath  = "github.com/BurntSushi/toml";
+    fetch = {
+      type = "git";
+      url = "https://github.com/BurntSushi/toml";
+      rev =  "a368813c5e648fee92e5f6c30e3944ff9d5e8895";
+      sha256 = "1sjxs2lwc8jpln80s4rlzp7nprbcljhy5mz4rf9995gq93wqnym5";
+    };
+  }
+  {
+    goPackagePath  = "github.com/RoaringBitmap/roaring";
+    fetch = {
+      type = "git";
+      url = "https://github.com/RoaringBitmap/roaring";
+      rev =  "d6540aab65a17321470b1661bfc52da1823871e9";
+      sha256 = "1lsrz7j55blalpp95vgz214b35sjf8nfmrw3fxybdl4xipk2ssdj";
+    };
+  }
+  {
+    goPackagePath  = "github.com/beorn7/perks";
+    fetch = {
+      type = "git";
+      url = "https://github.com/beorn7/perks";
+      rev =  "4c0e84591b9aa9e6dcfdf3e020114cd81f89d5f9";
+      sha256 = "1hrybsql68xw57brzj805xx2mghydpdiysv3gbhr7f5wlxj2514y";
+    };
+  }
+  {
+    goPackagePath  = "github.com/bmizerany/pat";
+    fetch = {
+      type = "git";
+      url = "https://github.com/bmizerany/pat";
+      rev =  "6226ea591a40176dd3ff9cd8eff81ed6ca721a00";
+      sha256 = "0qjkm7169y6pybwh0s02fjjk251isa2b367xqfzrwvl6cy4yzfxp";
+    };
+  }
+  {
+    goPackagePath  = "github.com/boltdb/bolt";
+    fetch = {
+      type = "git";
+      url = "https://github.com/boltdb/bolt";
+      rev =  "2f1ce7a837dcb8da3ec595b1dac9d0632f0f99e8";
+      sha256 = "0z7j06lijfi4y30ggf2znak2zf2srv2m6c68ar712wd2ys44qb3r";
+    };
+  }
+  {
+    goPackagePath  = "github.com/cespare/xxhash";
+    fetch = {
+      type = "git";
+      url = "https://github.com/cespare/xxhash";
+      rev =  "5c37fe3735342a2e0d01c87a907579987c8936cc";
+      sha256 = "02aii7z46sasagw816zz3v0gzax1z5d1hkjslz7ng25386p0gzk1";
+    };
+  }
+  {
+    goPackagePath  = "github.com/davecgh/go-spew";
+    fetch = {
+      type = "git";
+      url = "https://github.com/davecgh/go-spew";
+      rev =  "346938d642f2ec3594ed81d874461961cd0faa76";
+      sha256 = "0d4jfmak5p6lb7n2r6yvf5p1zcw0l8j74kn55ghvr7zr7b7axm6c";
+    };
+  }
+  {
+    goPackagePath  = "github.com/dgrijalva/jwt-go";
+    fetch = {
+      type = "git";
+      url = "https://github.com/dgrijalva/jwt-go";
+      rev =  "06ea1031745cb8b3dab3f6a236daf2b0aa468b7e";
+      sha256 = "08m27vlms74pfy5z79w67f9lk9zkx6a9jd68k3c4msxy75ry36mp";
+    };
+  }
+  {
+    goPackagePath  = "github.com/dgryski/go-bitstream";
+    fetch = {
+      type = "git";
+      url = "https://github.com/dgryski/go-bitstream";
+      rev =  "9f22ccc24718d9643ac427c8c897ae1a01575783";
+      sha256 = "0x3hbsrn7qafhhjz6lgyc1pd1p5kgkrkbccvsr6yygkl785h5lhn";
+    };
+  }
+  {
+    goPackagePath  = "github.com/glycerine/go-unsnap-stream";
+    fetch = {
+      type = "git";
+      url = "https://github.com/glycerine/go-unsnap-stream";
+      rev =  "62a9a9eb44fd8932157b1a8ace2149eff5971af6";
+      sha256 = "1ray7p4q3vv5zn9w5xs7m9kjh68b2ck98nh25mxhfiwl9jxkabrc";
+    };
+  }
+  {
+    goPackagePath  = "github.com/gogo/protobuf";
+    fetch = {
+      type = "git";
+      url = "https://github.com/gogo/protobuf";
+      rev =  "1adfc126b41513cc696b209667c8656ea7aac67c";
+      sha256 = "1j7azzlnihcvnd1apw5zr0bz30h7n0gyimqqkgc76vzb1n5dpi7m";
+    };
+  }
+  {
+    goPackagePath  = "github.com/golang/protobuf";
+    fetch = {
+      type = "git";
+      url = "https://github.com/golang/protobuf";
+      rev =  "925541529c1fa6821df4e44ce2723319eb2be768";
+      sha256 = "1d3zjvhl115l23xakj0014qpjchivlg098h10v5nfirkk1i9f9sa";
+    };
+  }
+  {
+    goPackagePath  = "github.com/golang/snappy";
+    fetch = {
+      type = "git";
+      url = "https://github.com/golang/snappy";
+      rev =  "d9eb7a3d35ec988b8585d4a0068e462c27d28380";
+      sha256 = "0wynarlr1y8sm9y9l29pm9dgflxriiialpwn01066snzjxnpmbyn";
+    };
+  }
+  {
+    goPackagePath  = "github.com/google/go-cmp";
+    fetch = {
+      type = "git";
+      url = "https://github.com/google/go-cmp";
+      rev =  "3af367b6b30c263d47e8895973edcca9a49cf029";
+      sha256 = "1fbv0x27k9sn8svafc0hjwsnckk864lv4yi7bvzrxvmd3d5hskds";
+    };
+  }
+  {
+    goPackagePath  = "github.com/influxdata/influxql";
+    fetch = {
+      type = "git";
+      url = "https://github.com/influxdata/influxql";
+      rev =  "a7267bff5327e316e54c54342b0bc9598753e3d5";
+      sha256 = "0mqc9xki5l9yfbb0dqjb417cmv3pca1bj71m90dkshladr2wlcg3";
+    };
+  }
+  {
+    goPackagePath  = "github.com/influxdata/usage-client";
+    fetch = {
+      type = "git";
+      url = "https://github.com/influxdata/usage-client";
+      rev =  "6d3895376368aa52a3a81d2a16e90f0f52371967";
+      sha256 = "0a5adnid42f9vpckgcpkj7v60fh147j7zlg1rhxcpq5vkw698ifl";
+    };
+  }
+  {
+    goPackagePath  = "github.com/influxdata/yamux";
+    fetch = {
+      type = "git";
+      url = "https://github.com/influxdata/yamux";
+      rev =  "1f58ded512de5feabbe30b60c7d33a7a896c5f16";
+      sha256 = "08y1lgcyyaa8zrg24ck64b5dfassgb2pp1fb9x5lw9q16fb170bx";
+    };
+  }
+  {
+    goPackagePath  = "github.com/influxdata/yarpc";
+    fetch = {
+      type = "git";
+      url = "https://github.com/influxdata/yarpc";
+      rev =  "f0da2db138cad2fb425541938fc28dd5a5bc6918";
+      sha256 = "1g71flc8s8xas7vmaiwv0425paii1akc7jsdqsgxkhyfxx2gvib0";
+    };
+  }
+  {
+    goPackagePath  = "github.com/jsternberg/zap-logfmt";
+    fetch = {
+      type = "git";
+      url = "https://github.com/jsternberg/zap-logfmt";
+      rev =  "ac4bd917e18a4548ce6e0e765b29a4e7f397b0b6";
+      sha256 = "0pqp2nsqvsq8kqc7l14340lrvl03715s12bag63kdbi25s8fcdkx";
+    };
+  }
+  {
+    goPackagePath  = "github.com/jwilder/encoding";
+    fetch = {
+      type = "git";
+      url = "https://github.com/jwilder/encoding";
+      rev =  "b4e1701a28efcc637d9afcca7d38e495fe909a09";
+      sha256 = "195js5njz86k096p3ggglgpc7rw3801mpqzdfwfr3miflhnp7nwg";
+    };
+  }
+  {
+    goPackagePath  = "github.com/klauspost/compress";
+    fetch = {
+      type = "git";
+      url = "https://github.com/klauspost/compress";
+      rev =  "6c8db69c4b49dd4df1fff66996cf556176d0b9bf";
+      sha256 = "00h2lpqcyc3pg2xk3q4a9cgyv0vkn15bx0hb725j5zbkr9vah23x";
+    };
+  }
+  {
+    goPackagePath  = "github.com/klauspost/cpuid";
+    fetch = {
+      type = "git";
+      url = "https://github.com/klauspost/cpuid";
+      rev =  "ae7887de9fa5d2db4eaa8174a7eff2c1ac00f2da";
+      sha256 = "178apw89g8nsd7w6mbdylxn956h3iig6rbw3bkivp6lplhb5dvq4";
+    };
+  }
+  {
+    goPackagePath  = "github.com/klauspost/crc32";
+    fetch = {
+      type = "git";
+      url = "https://github.com/klauspost/crc32";
+      rev =  "cb6bfca970f6908083f26f39a79009d608efd5cd";
+      sha256 = "0q4yr4isgmph1yf1vq527lpmid7vqv56q7vxh3gkp5679fb90q6n";
+    };
+  }
+  {
+    goPackagePath  = "github.com/klauspost/pgzip";
+    fetch = {
+      type = "git";
+      url = "https://github.com/klauspost/pgzip";
+      rev =  "0bf5dcad4ada2814c3c00f996a982270bb81a506";
+      sha256 = "0dgp2iljvhibzxia1g3lsfg4bjmfh4kf0bfrmfi7sd49hwhrvk7s";
+    };
+  }
+  {
+    goPackagePath  = "github.com/mattn/go-isatty";
+    fetch = {
+      type = "git";
+      url = "https://github.com/mattn/go-isatty";
+      rev =  "6ca4dbf54d38eea1a992b3c722a76a5d1c4cb25c";
+      sha256 = "0zs92j2cqaw9j8qx1sdxpv3ap0rgbs0vrvi72m40mg8aa36gd39w";
+    };
+  }
+  {
+    goPackagePath  = "github.com/matttproud/golang_protobuf_extensions";
+    fetch = {
+      type = "git";
+      url = "https://github.com/matttproud/golang_protobuf_extensions";
+      rev =  "3247c84500bff8d9fb6d579d800f20b3e091582c";
+      sha256 = "12hcych25wf725zxdkpnyx4wa0gyxl8v4m8xmhdmmaki9bbmqd0d";
+    };
+  }
+  {
+    goPackagePath  = "github.com/mschoch/smat";
+    fetch = {
+      type = "git";
+      url = "https://github.com/mschoch/smat";
+      rev =  "90eadee771aeab36e8bf796039b8c261bebebe4f";
+      sha256 = "141saq6d4z3c7v3jw45zy4gn6wwjlyralqygjff1fzvz1gkvimk3";
+    };
+  }
+  {
+    goPackagePath  = "github.com/opentracing/opentracing-go";
+    fetch = {
+      type = "git";
+      url = "https://github.com/opentracing/opentracing-go";
+      rev =  "328fceb7548c744337cd010914152b74eaf4c4ab";
+      sha256 = "1w6s42n9glqwif6awyiapr7sh1wjvkxan41qhc1yi555byyw200k";
+    };
+  }
+  {
+    goPackagePath  = "github.com/paulbellamy/ratecounter";
+    fetch = {
+      type = "git";
+      url = "https://github.com/paulbellamy/ratecounter";
+      rev =  "524851a93235ac051e3540563ed7909357fe24ab";
+      sha256 = "0z4c61ac6v8mpnr9z37d91h1cf8v9psja5jfdxmsf69r1b7qr4f9";
+    };
+  }
+  {
+    goPackagePath  = "github.com/peterh/liner";
+    fetch = {
+      type = "git";
+      url = "https://github.com/peterh/liner";
+      rev =  "6106ee4fe3e8435f18cd10e34557e5e50f0e792a";
+      sha256 = "178s1amw5r60lywgmh24pd2ljim0b05fdfsm4c8px22fkycmn1qr";
+    };
+  }
+  {
+    goPackagePath  = "github.com/philhofer/fwd";
+    fetch = {
+      type = "git";
+      url = "https://github.com/philhofer/fwd";
+      rev =  "bb6d471dc95d4fe11e432687f8b70ff496cf3136";
+      sha256 = "1pg84khadh79v42y8sjsdgfb54vw2kzv7hpapxkifgj0yvcp30g2";
+    };
+  }
+  {
+    goPackagePath  = "github.com/prometheus/client_golang";
+    fetch = {
+      type = "git";
+      url = "https://github.com/prometheus/client_golang";
+      rev =  "661e31bf844dfca9aeba15f27ea8aa0d485ad212";
+      sha256 = "0r9sr3m57ks7rc5bbghl0gy9wxlznzmz331xdp42zlgk6g774xcn";
+    };
+  }
+  {
+    goPackagePath  = "github.com/prometheus/client_model";
+    fetch = {
+      type = "git";
+      url = "https://github.com/prometheus/client_model";
+      rev =  "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c";
+      sha256 = "19y4ywsivhpxj7ikf2j0gm9k3cmyw37qcbfi78n526jxcc7kw998";
+    };
+  }
+  {
+    goPackagePath  = "github.com/prometheus/common";
+    fetch = {
+      type = "git";
+      url = "https://github.com/prometheus/common";
+      rev =  "e4aa40a9169a88835b849a6efb71e05dc04b88f0";
+      sha256 = "0m1n616d694jca0qjwjn5ci7scfgm2jpi94dhi356arm9lhda4jc";
+    };
+  }
+  {
+    goPackagePath  = "github.com/prometheus/procfs";
+    fetch = {
+      type = "git";
+      url = "https://github.com/prometheus/procfs";
+      rev =  "54d17b57dd7d4a3aa092476596b3f8a933bde349";
+      sha256 = "1b5218hi6k9i637k6xc7ynpll577zbnrhjm9jr2iczy3j0rr4rvr";
+    };
+  }
+  {
+    goPackagePath  = "github.com/retailnext/hllpp";
+    fetch = {
+      type = "git";
+      url = "https://github.com/retailnext/hllpp";
+      rev =  "101a6d2f8b52abfc409ac188958e7e7be0116331";
+      sha256 = "1dyyjyrscd3d22jhh2pbn67c6nzva0v069215sjjmj313k1xzmj3";
+    };
+  }
+  {
+    goPackagePath  = "github.com/tinylib/msgp";
+    fetch = {
+      type = "git";
+      url = "https://github.com/tinylib/msgp";
+      rev =  "b2b6a672cf1e5b90748f79b8b81fc8c5cf0571a1";
+      sha256 = "0pypfknghg1hcjjrqz3f1riaylk6hcxn9h0qyzynb74rp0qmlxjc";
+    };
+  }
+  {
+    goPackagePath  = "github.com/willf/bitset";
+    fetch = {
+      type = "git";
+      url = "https://github.com/willf/bitset";
+      rev =  "d860f346b89450988a379d7d705e83c58d1ea227";
+      sha256 = "18419ip5mnblnyx2rjixad90dhjb1x2kaiidr7zk9b3qci799rh0";
+    };
+  }
+  {
+    goPackagePath  = "github.com/xlab/treeprint";
+    fetch = {
+      type = "git";
+      url = "https://github.com/xlab/treeprint";
+      rev =  "f3a15cfd24bf976c724324cb6846a8b54b88b639";
+      sha256 = "0fgbdyk2mfj5vh8902sga33w5gw7q0f1if4nqx631ca33fd6pfbn";
+    };
+  }
+  {
+    goPackagePath  = "go.uber.org/atomic";
+    fetch = {
+      type = "git";
+      url = "https://github.com/uber-go/atomic";
+      rev =  "8474b86a5a6f79c443ce4b2992817ff32cf208b8";
+      sha256 = "166shnjw8rvjvksymi2gqw1ygsbxlq15xb10j2dx5rwy4y4asq8x";
+    };
+  }
+  {
+    goPackagePath  = "go.uber.org/multierr";
+    fetch = {
+      type = "git";
+      url = "https://github.com/uber-go/multierr";
+      rev =  "3c4937480c32f4c13a875a1829af76c98ca3d40a";
+      sha256 = "1slfc6syvw8cvr6rbrjsy6ja5w8gsx0f8aq8qm16rp2x5c2pj07w";
+    };
+  }
+  {
+    goPackagePath  = "go.uber.org/zap";
+    fetch = {
+      type = "git";
+      url = "https://github.com/uber-go/zap";
+      rev =  "35aad584952c3e7020db7b839f6b102de6271f89";
+      sha256 = "0n79ir7jcr7s51j85swji7an0jgy1w5dxg1g68j722rmpbvsagwv";
+    };
+  }
+  {
+    goPackagePath  = "golang.org/x/crypto";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/crypto";
+      rev =  "c3a3ad6d03f7a915c0f7e194b7152974bb73d287";
+      sha256 = "0x18275g5xlaw55bpx8hdna66d2hpbcw6hs0pxf1kmvfds6gzn6n";
+    };
+  }
+  {
+    goPackagePath  = "golang.org/x/net";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/net";
+      rev =  "92b859f39abd2d91a854c9f9c4621b2f5054a92d";
+      sha256 = "1nzbay48k53pxa1sh102v571k6pa57540p0bzcil4qgan47yxba6";
+    };
+  }
+  {
+    goPackagePath  = "golang.org/x/sync";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/sync";
+      rev =  "1d60e4601c6fd243af51cc01ddf169918a5407ca";
+      sha256 = "046jlanz2lkxq1r57x9bl6s4cvfqaic6p2xybsj8mq1120jv4rs6";
+    };
+  }
+  {
+    goPackagePath  = "golang.org/x/sys";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/sys";
+      rev =  "d8e400bc7db4870d786864138af681469693d18c";
+      sha256 = "08d23f9gjarp63dw0wj54nlqh3x2lqnchzkw8n5d7ik3wy7qy4yf";
+    };
+  }
+  {
+    goPackagePath  = "golang.org/x/text";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/text";
+      rev =  "f21a4dfb5e38f5895301dc265a8def02365cc3d0";
+      sha256 = "0r6x6zjzhr8ksqlpiwm5gdd7s209kwk5p4lw54xjvz10cs3qlq19";
+    };
+  }
+  {
+    goPackagePath  = "golang.org/x/time";
+    fetch = {
+      type = "git";
+      url = "https://go.googlesource.com/time";
+      rev =  "26559e0f760e39c24d730d3224364aef164ee23f";
+      sha256 = "00fx6m59cjbi7y0ri4a57q1zs6r310xbg5yqns5kfm2cax0dkmnf";
+    };
+  }
+]
\ No newline at end of file
diff --git a/pkgs/servers/sql/postgresql/pgtap/default.nix b/pkgs/servers/sql/postgresql/pgtap/default.nix
index c6eb4013c5ce..2f37d3a85d3e 100644
--- a/pkgs/servers/sql/postgresql/pgtap/default.nix
+++ b/pkgs/servers/sql/postgresql/pgtap/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   name = "pgtap-${version}";
-  version = "0.98.0";
+  version = "0.99.0";
 
   src = fetchFromGitHub {
     owner = "theory";
     repo = "pgtap";
     rev = "v${version}";
-    sha256 = "17r3b409k05pbypmwdwgm1fl669jc6a1391szyxizx784k44a369";
+    sha256 = "0xakjlbb99mgd8za6m0xa6n3s5fhif217iip6b3aywqw7nh1j6nv";
   };
 
   nativeBuildInputs = [ postgresql perl perlPackages.TAPParserSourceHandlerpgTAP which ];
diff --git a/pkgs/servers/x11/xorg/default.nix b/pkgs/servers/x11/xorg/default.nix
index c9e8dd04c470..06dd540a4818 100644
--- a/pkgs/servers/x11/xorg/default.nix
+++ b/pkgs/servers/x11/xorg/default.nix
@@ -1136,11 +1136,11 @@ let
   }) // {inherit ;};
 
   libxcb = (mkDerivation "libxcb" {
-    name = "libxcb-1.12";
+    name = "libxcb-1.13";
     builder = ./builder.sh;
     src = fetchurl {
-      url = http://xcb.freedesktop.org/dist/libxcb-1.12.tar.bz2;
-      sha256 = "0nvv0la91cf8p5qqlb3r5xnmg1jn2wphn4fb5jfbr6byqsvv3psa";
+      url = http://xcb.freedesktop.org/dist/libxcb-1.13.tar.bz2;
+      sha256 = "1ahxhmdqp4bhb90zmc275rmf5wixqra4bnw9pqnzyl1w3598g30q";
     };
     nativeBuildInputs = [ pkgconfig ];
     buildInputs = [ libxslt libpthreadstubs python libXau xcbproto libXdmcp ];
@@ -1448,11 +1448,11 @@ let
   }) // {inherit ;};
 
   xcbproto = (mkDerivation "xcbproto" {
-    name = "xcb-proto-1.12";
+    name = "xcb-proto-1.13";
     builder = ./builder.sh;
     src = fetchurl {
-      url = http://xcb.freedesktop.org/dist/xcb-proto-1.12.tar.bz2;
-      sha256 = "01j91946q8f34l1mbvmmgvyc393sm28ym4lxlacpiav4qsjan8jr";
+      url = http://xcb.freedesktop.org/dist/xcb-proto-1.13.tar.bz2;
+      sha256 = "1qdxw9syhbvswiqj5dvj278lrmfhs81apzmvx6205s4vcqg7563v";
     };
     nativeBuildInputs = [ pkgconfig ];
     buildInputs = [ python ];
@@ -1760,11 +1760,11 @@ let
   }) // {inherit inputproto xorgserver xproto ;};
 
   xf86inputlibinput = (mkDerivation "xf86inputlibinput" {
-    name = "xf86-input-libinput-0.26.0";
+    name = "xf86-input-libinput-0.28.0";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/driver/xf86-input-libinput-0.26.0.tar.bz2;
-      sha256 = "0yrqs88b7yn9nljwlxzn76jfmvf0sh939kzij5b2jvr2qa7mbjmb";
+      url = mirror://xorg/individual/driver/xf86-input-libinput-0.28.0.tar.bz2;
+      sha256 = "189h8vl0005yizwrs4d0sng6j8lwkd3xi1zwqg8qavn2bw34v691";
     };
     nativeBuildInputs = [ pkgconfig ];
     buildInputs = [ inputproto xorgserver xproto ];
diff --git a/pkgs/servers/x11/xorg/extra.list b/pkgs/servers/x11/xorg/extra.list
index 28b698bdc816..222a9f654266 100644
--- a/pkgs/servers/x11/xorg/extra.list
+++ b/pkgs/servers/x11/xorg/extra.list
@@ -1,6 +1,6 @@
 http://xcb.freedesktop.org/dist/libpthread-stubs-0.4.tar.bz2
-http://xcb.freedesktop.org/dist/libxcb-1.12.tar.bz2
-http://xcb.freedesktop.org/dist/xcb-proto-1.12.tar.bz2
+http://xcb.freedesktop.org/dist/libxcb-1.13.tar.bz2
+http://xcb.freedesktop.org/dist/xcb-proto-1.13.tar.bz2
 http://xcb.freedesktop.org/dist/xcb-util-0.4.0.tar.bz2
 http://xcb.freedesktop.org/dist/xcb-util-cursor-0.1.3.tar.bz2
 http://xcb.freedesktop.org/dist/xcb-util-image-0.4.0.tar.bz2
diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix
index b1a749c7ec4a..32a4e67642ad 100644
--- a/pkgs/servers/x11/xorg/overrides.nix
+++ b/pkgs/servers/x11/xorg/overrides.nix
@@ -335,10 +335,10 @@ in
   };
 
   xf86inputlibinput = attrs: attrs // rec {
-    name = "xf86-input-libinput-0.26.0";
+    name = "xf86-input-libinput-0.28.0";
     src = args.fetchurl {
       url = "mirror://xorg/individual/driver/${name}.tar.bz2";
-      sha256 = "0yrqs88b7yn9nljwlxzn76jfmvf0sh939kzij5b2jvr2qa7mbjmb";
+      sha256 = "189h8vl0005yizwrs4d0sng6j8lwkd3xi1zwqg8qavn2bw34v691";
     };
     outputs = [ "out" "dev" ];
     buildInputs = attrs.buildInputs ++ [ args.libinput ];
diff --git a/pkgs/servers/x11/xorg/tarballs-7.7.list b/pkgs/servers/x11/xorg/tarballs-7.7.list
index 6e67e8eb6e14..ca77e6408149 100644
--- a/pkgs/servers/x11/xorg/tarballs-7.7.list
+++ b/pkgs/servers/x11/xorg/tarballs-7.7.list
@@ -123,7 +123,7 @@ mirror://xorg/X11R7.7/src/everything/xf86driproto-2.1.1.tar.bz2
 mirror://xorg/individual/driver/xf86-input-evdev-2.10.5.tar.bz2
 mirror://xorg/individual/driver/xf86-input-joystick-1.6.3.tar.bz2
 mirror://xorg/individual/driver/xf86-input-keyboard-1.9.0.tar.bz2
-mirror://xorg/individual/driver/xf86-input-libinput-0.26.0.tar.bz2
+mirror://xorg/individual/driver/xf86-input-libinput-0.28.0.tar.bz2
 mirror://xorg/individual/driver/xf86-input-mouse-1.9.2.tar.bz2
 mirror://xorg/individual/driver/xf86-input-synaptics-1.9.0.tar.bz2
 mirror://xorg/individual/driver/xf86-input-vmmouse-13.1.0.tar.bz2
diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix
index bfeac09ea650..5fb410b64ebd 100644
--- a/pkgs/stdenv/darwin/default.nix
+++ b/pkgs/stdenv/darwin/default.nix
@@ -197,6 +197,10 @@ in rec {
         CF = null;  # use CoreFoundation from bootstrap-tools
         configd = null;
       };
+      python2 = self.python;
+
+      ninja = super.ninja.override { buildDocs = false; };
+      darwin = super.darwin // { cctools = super.darwin.cctools.override { llvm = null; }; };
     };
   in with prevStage; stageFun 1 prevStage {
     extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${bootstrapTools}/Library/Frameworks\"";
@@ -216,11 +220,12 @@ in rec {
         zlib patchutils m4 scons flex perl bison unifdef unzip openssl python
         libxml2 gettext sharutils gmp libarchive ncurses pkg-config libedit groff
         openssh sqlite sed serf openldap db cyrus-sasl expat apr-util subversion xz
-        findfreetype libssh curl cmake autoconf automake libtool ed cpio coreutils;
+        findfreetype libssh curl cmake autoconf automake libtool ed cpio coreutils
+        libssh2 nghttp2 libkrb5 python2 ninja;
 
       darwin = super.darwin // {
         inherit (darwin)
-          dyld Libsystem xnu configd ICU libdispatch libclosure launchd;
+          dyld Libsystem xnu configd ICU libdispatch libclosure launchd CF;
       };
     };
   in with prevStage; stageFun 2 prevStage {
@@ -234,7 +239,10 @@ in rec {
 
     allowedRequisites =
       [ bootstrapTools ] ++
-      (with pkgs; [ xz.bin xz.out libcxx libcxxabi ]) ++
+      (with pkgs; [
+        xz.bin xz.out libcxx libcxxabi zlib libxml2.out curl.out openssl.out libssh2.out
+        nghttp2.lib libkrb5
+      ]) ++
       (with pkgs.darwin; [ dyld Libsystem CF ICU locale ]);
 
     overrides = persistent;
@@ -246,9 +254,10 @@ in rec {
         patchutils m4 scons flex perl bison unifdef unzip openssl python
         gettext sharutils libarchive pkg-config groff bash subversion
         openssh sqlite sed serf openldap db cyrus-sasl expat apr-util
-        findfreetype libssh curl cmake autoconf automake libtool cpio;
+        findfreetype libssh curl cmake autoconf automake libtool cpio
+        libssh2 nghttp2 libkrb5 python2 ninja;
 
-      # Avoid pulling in a full python and it's extra dependencies for the llvm/clang builds.
+      # Avoid pulling in a full python and its extra dependencies for the llvm/clang builds.
       libxml2 = super.libxml2.override { pythonSupport = false; };
 
       llvmPackages_5 = super.llvmPackages_5 // (let
@@ -280,7 +289,10 @@ in rec {
 
     allowedRequisites =
       [ bootstrapTools ] ++
-      (with pkgs; [ xz.bin xz.out bash libcxx libcxxabi ]) ++
+      (with pkgs; [
+        xz.bin xz.out bash libcxx libcxxabi zlib libxml2.out curl.out openssl.out libssh2.out
+        nghttp2.lib libkrb5
+      ]) ++
       (with pkgs.darwin; [ dyld ICU Libsystem locale ]);
 
     overrides = persistent;
@@ -291,7 +303,7 @@ in rec {
       inherit
         gnumake gzip gnused bzip2 gawk ed xz patch bash
         ncurses libffi zlib gmp pcre gnugrep
-        coreutils findutils diffutils patchutils;
+        coreutils findutils diffutils patchutils ninja;
 
       # Hack to make sure we don't link ncurses in bootstrap tools. The proper
       # solution is to avoid passing -L/nix-store/...-bootstrap-tools/lib,
@@ -311,8 +323,14 @@ in rec {
         });
       in { inherit tools libraries; } // tools // libraries);
 
-      darwin = super.darwin // {
+      darwin = super.darwin // rec {
         inherit (darwin) dyld Libsystem libiconv locale;
+
+        libxml2-nopython = super.libxml2.override { pythonSupport = false; };
+        CF = super.darwin.CF.override {
+          libxml2 = libxml2-nopython;
+          python = prevStage.python;
+        };
       };
     };
   in with prevStage; stageFun 4 prevStage {
@@ -344,6 +362,17 @@ in rec {
         });
       in { inherit tools libraries; } // tools // libraries);
 
+      # N.B: the important thing here is to ensure that python == python2
+      # == python27 or you get weird issues with inconsistent package sets.
+      # In a particularly subtle bug, I overrode python2 instead of python27
+      # here, and it caused gnome-doc-utils to complain about:
+      # "PyThreadState_Get: no current thread". This is because Python gets
+      # really unhappy if you have Python A which loads a native python lib
+      # which was linked against Python B, which in our case was happening
+      # because we didn't override python "deeply enough". Anyway, this works
+      # and I'm just leaving this blurb here so people realize why it matters
+      python27 = super.python27.override { CF = prevStage.darwin.CF; };
+
       darwin = super.darwin // {
         inherit (darwin) dyld ICU Libsystem libiconv;
       } // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) {
@@ -397,9 +426,10 @@ in rec {
       gzip ncurses.out ncurses.dev ncurses.man gnused bash gawk
       gnugrep llvmPackages.clang-unwrapped llvmPackages.clang-unwrapped.lib patch pcre.out gettext
       binutils.bintools darwin.binutils darwin.binutils.bintools
+      curl.out openssl.out libssh2.out nghttp2.lib libkrb5
       cc.expand-response-params
     ]) ++ (with pkgs.darwin; [
-      dyld Libsystem CF cctools ICU libiconv locale
+      dyld Libsystem CF cctools ICU libiconv locale libxml2-nopython.out
     ]);
 
     overrides = lib.composeExtensions persistent (self: super: {
diff --git a/pkgs/stdenv/darwin/make-bootstrap-tools.nix b/pkgs/stdenv/darwin/make-bootstrap-tools.nix
index 66c5f419f2f6..eee3b1ce0759 100644
--- a/pkgs/stdenv/darwin/make-bootstrap-tools.nix
+++ b/pkgs/stdenv/darwin/make-bootstrap-tools.nix
@@ -3,7 +3,7 @@
 with import pkgspath { inherit system; };
 
 let
-  llvmPackages = llvmPackages_4;
+  llvmPackages = llvmPackages_5;
 in rec {
   coreutils_ = coreutils.override (args: {
     # We want coreutils without ACL support.
@@ -12,6 +12,10 @@ in rec {
     singleBinary = false;
   });
 
+  # We want a version of cctools without LLVM, because the LTO support ends up making
+  # the bootstrap tools huge and isn't really necessary for bootstrap
+  cctools_ = darwin.cctools.override { llvm = null; };
+
   # Avoid debugging larger changes for now.
   bzip2_ = bzip2.override (args: { linkStatic = true; });
 
@@ -73,6 +77,7 @@ in rec {
       cp -d ${gettext}/lib/libintl*.dylib $out/lib
       chmod +x $out/lib/libintl*.dylib
       cp -d ${ncurses.out}/lib/libncurses*.dylib $out/lib
+      cp -d ${libxml2.out}/lib/libxml2*.dylib $out/lib
 
       # Copy what we need of clang
       cp -d ${llvmPackages.clang-unwrapped}/bin/clang $out/bin
@@ -94,7 +99,7 @@ in rec {
 
       # Copy binutils.
       for i in as ld ar ranlib nm strip otool install_name_tool dsymutil lipo; do
-        cp ${darwin.cctools}/bin/$i $out/bin
+        cp ${cctools_}/bin/$i $out/bin
       done
 
       cp -rd ${pkgs.darwin.CF}/Library $out
@@ -104,9 +109,9 @@ in rec {
       nuke-refs $out/bin/*
 
       rpathify() {
-        local libs=$(${darwin.cctools}/bin/otool -L "$1" | tail -n +2 | grep -o "$NIX_STORE.*-\S*") || true
+        local libs=$(${cctools_}/bin/otool -L "$1" | tail -n +2 | grep -o "$NIX_STORE.*-\S*") || true
         for lib in $libs; do
-          ${darwin.cctools}/bin/install_name_tool -change $lib "@rpath/$(basename $lib)" "$1"
+          ${cctools_}/bin/install_name_tool -change $lib "@rpath/$(basename $lib)" "$1"
         done
       }
 
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index c663c3743ed6..2db40fc43e36 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -225,6 +225,8 @@ rec {
           inherit doCheck doInstallCheck;
 
           inherit outputs;
+        } // lib.optionalAttrs (attrs.enableParallelBuilding or false) {
+          enableParallelChecking = attrs.enableParallelChecking or true;
         } // lib.optionalAttrs (hardeningDisable != [] || hardeningEnable != []) {
           NIX_HARDENING_ENABLE = enabledHardeningOptions;
         } // lib.optionalAttrs (stdenv.buildPlatform.isDarwin) {
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index 141e94c5ed46..11d0f1fbce43 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -257,9 +257,17 @@ shopt -s nullglob
 
 # Set up the initial path.
 PATH=
+HOST_PATH=
 for i in $initialPath; do
     if [ "$i" = / ]; then i=; fi
     addToSearchPath PATH "$i/bin"
+
+    # For backward compatibility, we add initial path to HOST_PATH so
+    # it can be used in auto patch-shebangs. Unfortunately this will
+    # not work with cross compilation.
+    if [ -z "${strictDeps-}" ]; then
+        addToSearchPath HOST_PATH "$i/bin"
+    fi
 done
 
 if (( "${NIX_DEBUG:-0}" >= 1 )); then
@@ -272,7 +280,6 @@ if [ -z "${SHELL:-}" ]; then echo "SHELL not set"; exit 1; fi
 BASH="$SHELL"
 export CONFIG_SHELL="$SHELL"
 
-
 # Dummy implementation of the paxmark function. On Linux, this is
 # overwritten by paxctl's setup hook.
 paxmark() { true; }
@@ -1044,7 +1051,7 @@ checkPhase() {
         # Old bash empty array hack
         # shellcheck disable=SC2086
         local flagsArray=(
-            ${enableParallelBuilding:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}}
+            ${enableParallelChecking:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}}
             $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"}
             ${checkFlags:-VERBOSE=y} ${checkFlagsArray+"${checkFlagsArray[@]}"}
             ${checkTarget}
@@ -1176,7 +1183,7 @@ installCheckPhase() {
         # Old bash empty array hack
         # shellcheck disable=SC2086
         local flagsArray=(
-            ${enableParallelBuilding:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}}
+            ${enableParallelChecking:+-j${NIX_BUILD_CORES} -l${NIX_BUILD_CORES}}
             $makeFlags ${makeFlagsArray+"${makeFlagsArray[@]}"}
             $installCheckFlags ${installCheckFlagsArray+"${installCheckFlagsArray[@]}"}
             ${installCheckTarget:-installcheck}
diff --git a/pkgs/test/default.nix b/pkgs/test/default.nix
index 774077949b25..24948ce9aa4e 100644
--- a/pkgs/test/default.nix
+++ b/pkgs/test/default.nix
@@ -17,6 +17,8 @@ with pkgs;
   cc-wrapper-libcxx-5 = callPackage ./cc-wrapper { stdenv = llvmPackages_5.libcxxStdenv; };
   cc-wrapper-clang-6 = callPackage ./cc-wrapper { stdenv = llvmPackages_6.stdenv; };
   cc-wrapper-libcxx-6 = callPackage ./cc-wrapper { stdenv = llvmPackages_6.libcxxStdenv; };
+  cc-wrapper-clang-7 = callPackage ./cc-wrapper { stdenv = llvmPackages_7.stdenv; };
+  cc-wrapper-libcxx-7 = callPackage ./cc-wrapper { stdenv = llvmPackages_7.libcxxStdenv; };
   stdenv-inputs = callPackage ./stdenv-inputs { };
 
   cc-multilib-gcc = callPackage ./cc-wrapper/multilib.nix { stdenv = gccMultiStdenv; };
@@ -27,4 +29,6 @@ with pkgs;
   macOSSierraShared = callPackage ./macos-sierra-shared {};
 
   cross = callPackage ./cross {};
+
+  patch-shebangs = callPackage ./patch-shebangs {};
 }
diff --git a/pkgs/test/patch-shebangs/default.nix b/pkgs/test/patch-shebangs/default.nix
new file mode 100644
index 000000000000..a82e5e1e1982
--- /dev/null
+++ b/pkgs/test/patch-shebangs/default.nix
@@ -0,0 +1,26 @@
+{ stdenv, runCommand }:
+
+let
+  bad-shebang = stdenv.mkDerivation {
+    name         = "bad-shebang";
+    unpackPhase  = ":";
+    installPhase = ''
+      mkdir -p $out/bin
+      echo "#!/bin/sh" > $out/bin/test
+      echo "echo -n hello" >> $out/bin/test
+      chmod +x $out/bin/test
+    '';
+  };
+in runCommand "patch-shebangs-test" {
+  passthru = { inherit bad-shebang; };
+  meta.platforms = stdenv.lib.platforms.all;
+} ''
+  printf "checking whether patchShebangs works properly... ">&2
+  if ! grep -q '^#!/bin/sh' ${bad-shebang}/bin/test; then
+    echo "yes" >&2
+    touch $out
+  else
+    echo "no" >&2
+    exit 1
+  fi
+''
\ No newline at end of file
diff --git a/pkgs/tools/X11/xloadimage/default.nix b/pkgs/tools/X11/xloadimage/default.nix
new file mode 100644
index 000000000000..a58d16ab82e8
--- /dev/null
+++ b/pkgs/tools/X11/xloadimage/default.nix
@@ -0,0 +1,88 @@
+{ stdenv
+, fetchurl
+, libX11
+, libXt
+
+, libjpeg ? null
+, libpng ? null
+, libtiff ? null
+
+, withJpegSupport ? true
+, withPngSupport ? true
+, withTiffSupport ? true
+}:
+
+assert withJpegSupport -> libjpeg != null;
+assert withPngSupport -> libpng != null;
+assert withTiffSupport -> libtiff != null;
+
+let
+  deb_patch = "25";
+in
+stdenv.mkDerivation rec {
+  version = "4.1";
+  name = "xloadimage-${version}";
+
+  src = fetchurl {
+    url = "mirror://debian/pool/main/x/xloadimage/xloadimage_${version}.orig.tar.gz";
+    sha256 = "1i7miyvk5ydhi6yi8593vapavhwxcwciir8wg9d2dcyg9pccf2s0";
+  };
+
+  patches = fetchurl {
+    url = "mirror://debian/pool/main/x/xloadimage/xloadimage_${version}-${deb_patch}.debian.tar.xz";
+    sha256 = "17k518vrdrya5c9dqhpmm4g0h2vlkq1iy87sg2ngzygypbli1xvn";
+  };
+
+  buildInputs = [
+    libX11 libXt
+  ] ++ stdenv.lib.optionals withJpegSupport [
+    libjpeg
+  ] ++ stdenv.lib.optionals withPngSupport [
+    libpng
+  ] ++ stdenv.lib.optionals withTiffSupport [
+    libtiff
+  ];
+
+  # NOTE: we patch the build-info script so that it never detects the utilities
+  # it's trying to find; one of the Debian patches adds support for
+  # $SOURCE_DATE_EPOCH, but we want to make sure we don't even call these.
+  preConfigure = ''
+    substituteInPlace build-info \
+      --replace '[ -x /bin/date ]' 'false' \
+      --replace '[ -x /bin/id ]' 'false' \
+      --replace '[ -x /bin/uname ]' 'false' \
+      --replace '[ -x /usr/bin/id ]' 'false'
+
+    chmod +x build-info configure
+  '';
+
+  enableParallelBuilding = true;
+
+  # NOTE: we're not installing the `uufilter` binary; if needed, the standard
+  # `uudecode` tool should work just fine.
+  installPhase = ''
+    install -Dm755 xloadimage $out/bin/xloadimage
+    ln -sv $out/bin/{xloadimage,xsetbg}
+
+    install -D -m644 xloadimagerc $out/etc/xloadimagerc.example
+    install -D -m644 xloadimage.man $out/share/man/man1/xloadimage.1x
+    ln -sv $out/share/man/man1/{xloadimage,xsetbg}.1x
+  '';
+
+  meta = {
+    description = "Graphics file viewer under X11";
+
+    longDescription = ''
+      Can view png, jpeg, gif, tiff, niff, sunraster, fbm, cmuraster, pbm,
+      faces, rle, xwd, vff, mcidas, vicar, pcx, gem, macpaint, xpm and xbm
+      files. Can view images, put them on the root window, or dump them. Does a
+      variety of processing, including: clipping, dithering, depth reduction,
+      zoom, brightening/darkening and merging.
+    '';
+
+    license = stdenv.lib.licenses.gpl2Plus;
+
+    maintainers = with stdenv.lib.maintainers; [ andrew-d ];
+    platforms = stdenv.lib.platforms.linux;  # arbitrary choice
+  };
+}
diff --git a/pkgs/tools/X11/xsecurelock/default.nix b/pkgs/tools/X11/xsecurelock/default.nix
index c252894dbfec..4ee51100b339 100644
--- a/pkgs/tools/X11/xsecurelock/default.nix
+++ b/pkgs/tools/X11/xsecurelock/default.nix
@@ -1,21 +1,21 @@
 { lib, stdenv, fetchFromGitHub, autoreconfHook, pkgconfig
-, libX11, libXcomposite, libXft, pam, apacheHttpd, imagemagick
+, libX11, libXcomposite, libXft, libXmu, pam, apacheHttpd, imagemagick
 , pamtester, xscreensaver }:
 
 stdenv.mkDerivation rec {
   name = "xsecurelock-${version}";
-  version = "1.0";
+  version = "1.1";
 
   src = fetchFromGitHub {
     owner = "google";
     repo = "xsecurelock";
     rev = "v${version}";
-    sha256 = "0k135hnfnn1j82wvc03b8jkq06wws1xk325x5m25ps6xwsn725sw";
+    sha256 = "0yqp5xhkl9jpjyrmrxbyp7azwxmqc3lxv5lxrjqjaapl3q3096g5";
   };
 
   nativeBuildInputs = [ autoreconfHook pkgconfig ];
   buildInputs = [
-    libX11 libXcomposite libXft pam
+    libX11 libXcomposite libXft libXmu pam
     apacheHttpd imagemagick pamtester
   ];
 
diff --git a/pkgs/tools/filesystems/e2fsprogs/default.nix b/pkgs/tools/filesystems/e2fsprogs/default.nix
index e2b87007b09f..168bf7d076ce 100644
--- a/pkgs/tools/filesystems/e2fsprogs/default.nix
+++ b/pkgs/tools/filesystems/e2fsprogs/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, buildPackages, fetchurl, pkgconfig, libuuid, gettext, texinfo, perl }:
+{ stdenv, buildPackages, fetchurl, fetchpatch, pkgconfig, libuuid, gettext, texinfo, perl }:
 
 stdenv.mkDerivation rec {
   name = "e2fsprogs-1.44.4";
@@ -15,8 +15,14 @@ stdenv.mkDerivation rec {
   buildInputs = [ libuuid gettext ];
 
   # Only use glibc's __GNUC_PREREQ(X,Y) (checks if compiler is gcc version >= X.Y) when using glibc
-  NIX_CFLAGS_COMPILE = stdenv.lib.optional (stdenv.hostPlatform.libc != "glibc")
-    "-D__GNUC_PREREQ(maj,min)=0";
+  patches = if stdenv.hostPlatform.libc == "glibc" then null
+    else [
+      (fetchpatch {
+      url = "https://raw.githubusercontent.com/void-linux/void-packages/1f3b51493031cc0309009804475e3db572fc89ad/srcpkgs/e2fsprogs/patches/fix-glibcism.patch";
+      sha256 = "1q7y8nhsfwl9r1q7nhrlikazxxj97p93kgz5wh7723cshlji2vaa";
+      extraPrefix = "";
+      })
+    ];
 
   configureFlags =
     if stdenv.isLinux then [
diff --git a/pkgs/tools/misc/agedu/default.nix b/pkgs/tools/misc/agedu/default.nix
index 2f9615a1fdbb..d0254e9ce9f5 100644
--- a/pkgs/tools/misc/agedu/default.nix
+++ b/pkgs/tools/misc/agedu/default.nix
@@ -1,7 +1,7 @@
 {stdenv, fetchgit, autoreconfHook, halibut}:
 let
-  date = "20180522";
-  rev = "5b12791";
+  date = "20180918";
+  rev = "80c7beb";
 in
 stdenv.mkDerivation {
   name = "agedu-${date}.${rev}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation {
   src = fetchgit {
     url = https://git.tartarus.org/simon/agedu.git;
     inherit rev;
-    sha256 = "1zyxif0i3yil4xm8y9aqk6wsdwi7b3jg682lv6ds6a6bl047fz1q";
+    sha256 = "0i930izna3s73p2q52qa377ixd14zij5q1n7w3irl7csyy78g0cd";
   };
 
   nativeBuildInputs = [autoreconfHook halibut];
diff --git a/pkgs/tools/misc/bat/default.nix b/pkgs/tools/misc/bat/default.nix
index ec2062805ab1..0cacfa6e54e4 100644
--- a/pkgs/tools/misc/bat/default.nix
+++ b/pkgs/tools/misc/bat/default.nix
@@ -4,17 +4,17 @@
 
 rustPlatform.buildRustPackage rec {
   name    = "bat-${version}";
-  version = "0.7.0";
+  version = "0.7.1";
 
   src = fetchFromGitHub {
     owner  = "sharkdp";
     repo   = "bat";
     rev    = "v${version}";
-    sha256 = "1dhn88asf08dvl4827v4mkxafcr01m1h5jmicvzda9ywmr82g1cs";
+    sha256 = "1fzk0z7r70rjvv2c6531zaa1jzbcb7j9wbi0xqb9y4dls538bmz0";
     fetchSubmodules = true;
   };
 
-  cargoSha256 = "10s8ig08prs1wcsisrllvsixqkrkwjx769y1w5fypldn9kfk2lka";
+  cargoSha256 = "19syz0sxcpk3i4675bfq5gpb9i6hp81in36w820kkvamaimq10nd";
 
   nativeBuildInputs = [ cmake pkgconfig zlib ];
 
diff --git a/pkgs/tools/misc/findutils/default.nix b/pkgs/tools/misc/findutils/default.nix
index d6eca100411b..d19117d4dcda 100644
--- a/pkgs/tools/misc/findutils/default.nix
+++ b/pkgs/tools/misc/findutils/default.nix
@@ -10,7 +10,14 @@ stdenv.mkDerivation rec {
     sha256 = "178nn4dl7wbcw499czikirnkniwnx36argdnqgz4ik9i6zvwkm6y";
   };
 
-  patches = [ ./memory-leak.patch ./no-install-statedir.patch ];
+  patches = [
+    ./memory-leak.patch
+    ./no-install-statedir.patch
+
+    # Prevent tests from failing on old kernels (2.6x)
+    # getdtablesize reports incorrect values if getrlimit() fails
+    ./disable-getdtablesize-test.patch
+  ];
 
   buildInputs = [ coreutils ]; # bin/updatedb script needs to call sort
 
diff --git a/pkgs/tools/misc/findutils/disable-getdtablesize-test.patch b/pkgs/tools/misc/findutils/disable-getdtablesize-test.patch
new file mode 100644
index 000000000000..611df364b687
--- /dev/null
+++ b/pkgs/tools/misc/findutils/disable-getdtablesize-test.patch
@@ -0,0 +1,25 @@
+diff --git a/tests/test-dup2.c b/tests/test-dup2.c
+--- a/tests/test-dup2.c
++++ b/tests/test-dup2.c
+@@ -157,8 +157,6 @@ main (void)
+       ASSERT (close (255) == 0);
+       ASSERT (close (256) == 0);
+     }
+-  ASSERT (dup2 (fd, bad_fd - 1) == bad_fd - 1);
+-  ASSERT (close (bad_fd - 1) == 0);
+   errno = 0;
+   ASSERT (dup2 (fd, bad_fd) == -1);
+   ASSERT (errno == EBADF);
+diff --git a/tests/test-getdtablesize.c b/tests/test-getdtablesize.c
+index a0325af..a83f8ec 100644
+--- a/tests/test-getdtablesize.c
++++ b/tests/test-getdtablesize.c
+@@ -29,8 +29,6 @@ int
+ main (int argc, char *argv[])
+ {
+   ASSERT (getdtablesize () >= 3);
+-  ASSERT (dup2 (0, getdtablesize() - 1) == getdtablesize () - 1);
+-  ASSERT (dup2 (0, getdtablesize()) == -1);
+ 
+   return 0;
+ }
diff --git a/pkgs/tools/misc/hdf4/default.nix b/pkgs/tools/misc/hdf4/default.nix
index d0bbd10d1e51..ef3839f67de9 100644
--- a/pkgs/tools/misc/hdf4/default.nix
+++ b/pkgs/tools/misc/hdf4/default.nix
@@ -1,4 +1,5 @@
 { stdenv
+, fetchpatch
 , fetchurl
 , cmake
 , libjpeg
@@ -14,6 +15,22 @@ stdenv.mkDerivation rec {
     sha256 = "0n29klrrbwan9307np0d9hr128dlpc4nnlf57a140080ll3jmp8l";
   };
 
+  patches = let
+    # The Debian patch revision to fetch from; this may differ from our package
+    # version, but older patches should still apply.
+    patchRev = "4.2.13-4";
+    getPatch = name: sha256: fetchpatch {
+      inherit sha256;
+      url = "https://salsa.debian.org/debian-gis-team/hdf4/raw/debian/${patchRev}/debian/patches/${name}";
+    };
+
+  in [
+    (getPatch "64bit"                     "1xqk9zpch4m6ipa0f3x2cm8rwaz4p0ppp1vqglvz18j6q91p8b5y")
+    (getPatch "hdfi.h"                    "01fr9csylnvk9jd9jn9y23bvxy192s07p32pr76mm3gwhgs9h7r4")
+    (getPatch "hdf-4.2.10-aarch64.patch"  "1hl0xw5pd9xhpq49xpwgg7c4z6vv5p19x6qayixw0myvgwj1r4zn")
+    (getPatch "reproducible-builds.patch" "02j639w26xkxpxx3pdhbi18ywz8w3qmjpqjb83n47gq29y4g13hc")
+  ];
+
   buildInputs = [
     cmake
     libjpeg
diff --git a/pkgs/tools/misc/parallel/default.nix b/pkgs/tools/misc/parallel/default.nix
index 7af5e12081b6..11a9cd4ff87a 100644
--- a/pkgs/tools/misc/parallel/default.nix
+++ b/pkgs/tools/misc/parallel/default.nix
@@ -8,12 +8,12 @@ stdenv.mkDerivation rec {
     sha256 = "0jjs7fpvdjjb5v0j39a6k7hq9h5ap3db1j7vg1r2dq4swk23h9bm";
   };
 
-  nativeBuildInputs = [ makeWrapper perl ];
+  nativeBuildInputs = [ makeWrapper ];
+  buildInputs = [ perl procps ];
 
   postInstall = ''
     wrapProgram $out/bin/parallel \
-      --prefix PATH : "${procps}/bin" \
-      --prefix PATH : "${perl}/bin" \
+      --prefix PATH : "${stdenv.lib.makeBinPath [ procps perl ]}"
   '';
 
   doCheck = true;
diff --git a/pkgs/tools/networking/curl/default.nix b/pkgs/tools/networking/curl/default.nix
index d42cdcd4a347..dda97d34d869 100644
--- a/pkgs/tools/networking/curl/default.nix
+++ b/pkgs/tools/networking/curl/default.nix
@@ -24,14 +24,14 @@ assert brotliSupport -> brotli != null;
 assert gssSupport -> kerberos != null;
 
 stdenv.mkDerivation rec {
-  name = "curl-7.61.0";
+  name = "curl-7.61.1";
 
   src = fetchurl {
     urls = [
       "https://curl.haxx.se/download/${name}.tar.bz2"
       "https://github.com/curl/curl/releases/download/${lib.replaceStrings ["."] ["_"] name}/${name}.tar.bz2"
     ];
-    sha256 = "173ccmnnr4qcawzgn7vm0ciyzphanzghigdgavg88nyg45lk6vsz";
+    sha256 = "1f8rljpa98g7ry7qyvv6657cmvgrwmam9mdbjklv45lspiykf253";
   };
 
   outputs = [ "bin" "dev" "out" "man" "devdoc" ];
diff --git a/pkgs/tools/networking/dhcpcd/default.nix b/pkgs/tools/networking/dhcpcd/default.nix
index a03d2a123932..fa025a2ec89e 100644
--- a/pkgs/tools/networking/dhcpcd/default.nix
+++ b/pkgs/tools/networking/dhcpcd/default.nix
@@ -11,7 +11,10 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ udev ];
+  buildInputs = [
+    udev
+    runtimeShellPackage # So patchShebangs finds a bash suitable for the installed scripts
+  ];
 
   preConfigure = "patchShebangs ./configure";
 
@@ -29,11 +32,6 @@ stdenv.mkDerivation rec {
   # Check that the udev plugin got built.
   postInstall = stdenv.lib.optional (udev != null) "[ -e $out/lib/dhcpcd/dev/udev.so ]";
 
-  # TODO shlevy remove once patchShebangs is fixed
-  postFixup = ''
-    find $out -type f -print0 | xargs --null sed -i 's|${stdenv.shellPackage}|${runtimeShellPackage}|'
-  '';
-
   meta = with stdenv.lib; {
     description = "A client for the Dynamic Host Configuration Protocol (DHCP)";
     homepage = https://roy.marples.name/projects/dhcpcd;
diff --git a/pkgs/tools/networking/network-manager/fortisslvpn/default.nix b/pkgs/tools/networking/network-manager/fortisslvpn/default.nix
index 16964e4db945..facf1b6a6670 100644
--- a/pkgs/tools/networking/network-manager/fortisslvpn/default.nix
+++ b/pkgs/tools/networking/network-manager/fortisslvpn/default.nix
@@ -28,6 +28,7 @@ in stdenv.mkDerivation rec {
     "--without-libnm-glib"
     "--with-gnome=${if withGnome then "yes" else "no"}"
     "--localstatedir=/tmp"
+    "--enable-absolute-paths"
   ];
 
   passthru = {
diff --git a/pkgs/tools/networking/network-manager/iodine/default.nix b/pkgs/tools/networking/network-manager/iodine/default.nix
index a6fd3e7303df..ad58dc97b0a6 100644
--- a/pkgs/tools/networking/network-manager/iodine/default.nix
+++ b/pkgs/tools/networking/network-manager/iodine/default.nix
@@ -31,6 +31,7 @@ in stdenv.mkDerivation rec {
     "--without-libnm-glib"
     "--with-gnome=${if withGnome then "yes" else "no"}"
     "--localstatedir=/" # needed for the management socket under /run/NetworkManager
+    "--enable-absolute-paths"
   ];
 
   passthru = {
diff --git a/pkgs/tools/networking/network-manager/l2tp/default.nix b/pkgs/tools/networking/network-manager/l2tp/default.nix
index 3cac1b5e63cf..b44933f7f5f8 100644
--- a/pkgs/tools/networking/network-manager/l2tp/default.nix
+++ b/pkgs/tools/networking/network-manager/l2tp/default.nix
@@ -35,6 +35,7 @@ stdenv.mkDerivation rec {
     "--with-gnome=${if withGnome then "yes" else "no"}"
     "--localstatedir=/var"
     "--sysconfdir=$(out)/etc"
+    "--enable-absolute-paths"
   ];
 
   enableParallelBuilding = true;
diff --git a/pkgs/tools/networking/network-manager/openconnect/default.nix b/pkgs/tools/networking/network-manager/openconnect/default.nix
index 23d4c816a20d..0c02569aa27a 100644
--- a/pkgs/tools/networking/network-manager/openconnect/default.nix
+++ b/pkgs/tools/networking/network-manager/openconnect/default.nix
@@ -26,6 +26,7 @@ in stdenv.mkDerivation rec {
 
   configureFlags = [
     "--with-gnome=${if withGnome then "yes" else "no"}"
+    "--enable-absolute-paths"
   ];
 
   passthru = {
diff --git a/pkgs/tools/networking/network-manager/openvpn/default.nix b/pkgs/tools/networking/network-manager/openvpn/default.nix
index 0d3a4174744f..66a306ffb66c 100644
--- a/pkgs/tools/networking/network-manager/openvpn/default.nix
+++ b/pkgs/tools/networking/network-manager/openvpn/default.nix
@@ -28,6 +28,7 @@ in stdenv.mkDerivation rec {
     "--without-libnm-glib"
     "--with-gnome=${if withGnome then "yes" else "no"}"
     "--localstatedir=/" # needed for the management socket under /run/NetworkManager
+    "--enable-absolute-paths"
   ];
 
   passthru = {
diff --git a/pkgs/tools/networking/network-manager/vpnc/default.nix b/pkgs/tools/networking/network-manager/vpnc/default.nix
index ef45defb7d5a..5d77be86dffe 100644
--- a/pkgs/tools/networking/network-manager/vpnc/default.nix
+++ b/pkgs/tools/networking/network-manager/vpnc/default.nix
@@ -26,6 +26,7 @@ in stdenv.mkDerivation rec {
   configureFlags = [
     "--without-libnm-glib"
     "--with-gnome=${if withGnome then "yes" else "no"}"
+    "--enable-absolute-paths"
   ];
 
   passthru = {
diff --git a/pkgs/tools/package-management/packagekit/default.nix b/pkgs/tools/package-management/packagekit/default.nix
index 456469f150f7..2acb39c0b732 100644
--- a/pkgs/tools/package-management/packagekit/default.nix
+++ b/pkgs/tools/package-management/packagekit/default.nix
@@ -11,6 +11,8 @@ stdenv.mkDerivation rec {
   name = "packagekit-${version}";
   version = "1.1.10";
 
+  outputs = [ "out" "dev" ];
+
   src = fetchFromGitHub {
     owner = "hughsie";
     repo = "PackageKit";
@@ -33,7 +35,7 @@ stdenv.mkDerivation rec {
     (if enableSystemd then "--enable-systemd" else "--disable-systemd")
     "--disable-dummy"
     "--disable-cron"
-    "--disable-introspection"
+    "--enable-introspection"
     "--disable-offline-update"
     "--localstatedir=/var"
     "--sysconfdir=/etc"
diff --git a/pkgs/tools/security/qesteidutil/default.nix b/pkgs/tools/security/qesteidutil/default.nix
index 016017205ab4..20135895d766 100644
--- a/pkgs/tools/security/qesteidutil/default.nix
+++ b/pkgs/tools/security/qesteidutil/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub
+{ stdenv, fetchFromGitHub, fetchpatch
 , cmake, ccid, qttools, qttranslations
 , pkgconfig, pcsclite, hicolor-icon-theme 
 }:
@@ -19,6 +19,13 @@ stdenv.mkDerivation rec {
     fetchSubmodules = true;
   };
 
+  patches = [
+    (fetchpatch {
+      url = https://github.com/open-eid/qesteidutil/commit/868e8245f2481e29e1154e168ac92d32e93a5425.patch;
+      sha256 = "0pwrkd8inf0qaf7lcchmj558k6z34ah672zcb722aa5ybbif0lkn";
+    })
+  ];
+
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ cmake ccid qttools pcsclite qttranslations
                   hicolor-icon-theme
diff --git a/pkgs/tools/security/rhash/default.nix b/pkgs/tools/security/rhash/default.nix
index 22d7e93fe476..27f2ca04d710 100644
--- a/pkgs/tools/security/rhash/default.nix
+++ b/pkgs/tools/security/rhash/default.nix
@@ -1,14 +1,14 @@
 { stdenv, fetchFromGitHub, which }:
 
 stdenv.mkDerivation rec {
-  version = "2018-02-05";
+  version = "1.3.6";
   name = "rhash-${version}";
 
   src = fetchFromGitHub {
     owner = "rhash";
     repo = "RHash";
-    rev = "cc26d54ff5df0f692907a5e3132a5eeca559ed61";
-    sha256 = "1ldagp931lmxxpyvsb9rrar4iqwmv94m6lfjzkbkshpmk3p5ng7h";
+    rev = "v${version}";
+    sha256 = "1c8gngjj34ylx1f56hjbvml22bif0bx1b88dx2cyxbix8praxqh7";
   };
 
   nativeBuildInputs = [ which ];
diff --git a/pkgs/tools/security/tor/default.nix b/pkgs/tools/security/tor/default.nix
index 338afb7b3e17..d7344884951c 100644
--- a/pkgs/tools/security/tor/default.nix
+++ b/pkgs/tools/security/tor/default.nix
@@ -23,8 +23,6 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "geoip" ];
 
-  enableParallelBuilding = true;
-
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ libevent openssl zlib ] ++
     stdenv.lib.optionals stdenv.isLinux [ libseccomp systemd libcap ];
@@ -37,14 +35,17 @@ stdenv.mkDerivation rec {
       --replace 'exec torsocks' 'exec ${torsocks}/bin/torsocks'
   '';
 
+  enableParallelBuilding = true;
+  enableParallelChecking = false; # 4 tests fail randomly
+
+  doCheck = true;
+
   postInstall = ''
     mkdir -p $geoip/share/tor
     mv $out/share/tor/geoip{,6} $geoip/share/tor
     rm -rf $out/share/tor
   '';
 
-  doCheck = true;
-
   passthru.updateScript = import ./update.nix {
     inherit (stdenv) lib;
     inherit
diff --git a/pkgs/tools/typesetting/tex/texlive/bin.nix b/pkgs/tools/typesetting/tex/texlive/bin.nix
index 53fac978ebb0..73d8b6d0edb6 100644
--- a/pkgs/tools/typesetting/tex/texlive/bin.nix
+++ b/pkgs/tools/typesetting/tex/texlive/bin.nix
@@ -2,7 +2,7 @@
 , texlive
 , zlib, libiconv, libpng, libX11
 , freetype, gd, libXaw, icu, ghostscript, libXpm, libXmu, libXext
-, perl, pkgconfig
+, perl, pkgconfig, autoreconfHook
 , poppler, libpaper, graphite2, zziplib, harfbuzz, potrace, gmp, mpfr
 , cairo, pixman, xorg, clisp, biber
 , makeWrapper
@@ -32,7 +32,15 @@ let
         url = https://git.archlinux.org/svntogit/packages.git/plain/trunk/texlive-poppler-0.64.patch?h=packages/texlive-bin;
         sha256 = "0443d074zl3c5raba8jyhavish706arjcd80ibb84zwnwck4ai0w";
       })
+      (fetchurl {
+        name = "synctex-missing-header.patch";
+        url = https://git.archlinux.org/svntogit/packages.git/plain/trunk/synctex-missing-header.patch?h=packages/texlive-bin&id=da56abf0f8a1e85daca0ec0f031b8fa268519e6b;
+        sha256 = "1c4aq8lk8g3mlfq3mdjnxvmhss3qs7nni5rmw0k054dmj6q1xj5n";
+      })
     ];
+    # remove when removing synctex-missing-header.patch
+    preAutoreconf = "pushd texk/web2c";
+    postAutoreconf = "popd";
 
     configureFlags = [
       "--with-banner-add=/NixOS.org"
@@ -64,11 +72,11 @@ texliveYear = year;
 core = stdenv.mkDerivation rec {
   name = "texlive-bin-${version}";
 
-  inherit (common) src patches;
+  inherit (common) src patches preAutoreconf postAutoreconf;
 
   outputs = [ "out" "doc" ];
 
-  nativeBuildInputs = [ pkgconfig ];
+  nativeBuildInputs = [ pkgconfig autoreconfHook ];
   buildInputs = [
     /*teckit*/ zziplib poppler mpfr gmp
     pixman potrace gd freetype libpng libpaper zlib
@@ -101,7 +109,6 @@ core = stdenv.mkDerivation rec {
       "xetex" "bibtexu" "bibtex8" "bibtex-x" "upmendex" # ICU isn't small
     ] ++ stdenv.lib.optional (stdenv.hostPlatform.isPower && stdenv.hostPlatform.is64bit) "mfluajit")
     ++ [ "--without-system-harfbuzz" "--without-system-icu" ] # bogus configure
-    
     ;
 
   enableParallelBuilding = true;
@@ -165,7 +172,7 @@ inherit (core-big) metafont metapost luatex xetex;
 core-big = stdenv.mkDerivation { #TODO: upmendex
   name = "texlive-core-big.bin-${version}";
 
-  inherit (common) src patches;
+  inherit (common) src patches preAutoreconf postAutoreconf;
 
   hardeningDisable = [ "format" ];
 
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 8e9b5aa8b49c..0f4f2e8166d2 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -6381,6 +6381,7 @@ with pkgs;
     };
   };
 
+  clang_7  = llvmPackages_7.clang;
   clang_6  = llvmPackages_6.clang;
   clang_5  = llvmPackages_5.clang;
   clang_4  = llvmPackages_4.clang;
@@ -6978,15 +6979,18 @@ with pkgs;
   lld_4 = llvmPackages_4.lld;
   lld_5 = llvmPackages_5.lld;
   lld_6 = llvmPackages_6.lld;
+  lld_7 = llvmPackages_7.lld;
 
   lldb = llvmPackages.lldb;
   lldb_4 = llvmPackages_4.lldb;
   lldb_5 = llvmPackages_5.lldb;
   lldb_6 = llvmPackages_6.lldb;
+  lldb_7 = llvmPackages_7.lldb;
 
   llvm = llvmPackages.llvm;
   llvm-manpages = llvmPackages.llvm-manpages;
 
+  llvm_7  = llvmPackages_7.llvm;
   llvm_6  = llvmPackages_6.llvm;
   llvm_5  = llvmPackages_5.llvm;
   llvm_4  = llvmPackages_4.llvm;
@@ -7051,6 +7055,14 @@ with pkgs;
     stdenv = overrideCC stdenv buildPackages.gcc6; # with gcc-7: undefined reference to `__divmoddi4'
   });
 
+  llvmPackages_7 = callPackage ../development/compilers/llvm/7 ({
+    inherit (stdenvAdapters) overrideCC;
+    buildLlvmTools = buildPackages.llvmPackages_7.tools;
+    targetLlvmLibraries = targetPackages.llvmPackages_7.libraries;
+  } // stdenv.lib.optionalAttrs (stdenv.cc.isGNU && stdenv.hostPlatform.isi686) {
+    stdenv = overrideCC stdenv buildPackages.gcc6; # with gcc-7: undefined reference to `__divmoddi4'
+  });
+
   manticore = callPackage ../development/compilers/manticore { };
 
   mentorToolchains = recurseIntoAttrs (
@@ -7809,6 +7821,8 @@ with pkgs;
 
   wasm = callPackage ../development/interpreters/wasm { };
 
+  wasm-gc = callPackage ../development/interpreters/wasm-gc { };
+
 
   ### DEVELOPMENT / MISC
 
@@ -8820,7 +8834,6 @@ with pkgs;
 
   valgrind = callPackage ../development/tools/analysis/valgrind {
     inherit (darwin) xnu bootstrap_cmds cctools;
-    llvm = llvm_39;
   };
   valgrind-light = self.valgrind.override { gdb = null; };
 
@@ -11187,37 +11200,32 @@ with pkgs;
   ## libGL/libGLU/Mesa stuff
 
   # Default libGL implementation, should provide headers and libGL.so/libEGL.so/... to link agains them
-  libGL = libGLDarwinOr mesa_noglu.stubs;
+  libGL = mesa_noglu.stubs;
 
   # Default libGLU
-  libGLU = libGLDarwinOr mesa_glu;
+  libGLU = mesa_glu;
 
   # Combined derivation, contains both libGL and libGLU
   # Please, avoid using this attribute.  It was meant as transitional hack
   # for packages that assume that libGLU and libGL live in the same prefix.
   # libGLU_combined propagates both libGL and libGLU
-  libGLU_combined = libGLDarwinOr (buildEnv {
+  libGLU_combined = buildEnv {
     name = "libGLU-combined";
     paths = [ libGL libGLU ];
     extraOutputsToInstall = [ "dev" ];
-  });
+  };
 
   # Default derivation with libGL.so.1 to link into /run/opengl-drivers (if need)
-  libGL_driver = libGLDarwinOr mesa_drivers;
+  libGL_driver = mesa_drivers;
 
   libGLSupported = lib.elem stdenv.hostPlatform.system lib.platforms.mesaPlatforms;
 
-  libGLDarwin = callPackage ../development/libraries/mesa-darwin {
-    inherit (darwin.apple_sdk.frameworks) OpenGL;
-    inherit (darwin.apple_sdk.libs) Xplugin;
-    inherit (darwin) apple_sdk;
-  };
-
-  libGLDarwinOr = alternative: if stdenv.isDarwin then libGLDarwin else alternative;
-
   mesa_noglu = callPackage ../development/libraries/mesa {
     llvmPackages = llvmPackages_6;
+    inherit (darwin.apple_sdk.frameworks) OpenGL;
+    inherit (darwin.apple_sdk.libs) Xplugin;
   };
+  mesa = mesa_noglu;
 
   mesa_glu =  callPackage ../development/libraries/mesa-glu { };
 
@@ -15322,6 +15330,8 @@ with pkgs;
 
   ucs-fonts = callPackage ../data/fonts/ucs-fonts { };
 
+  ultimate-oldschool-pc-font-pack = callPackage ../data/fonts/ultimate-oldschool-pc-font-pack { };
+
   uni-vga = callPackage ../data/fonts/uni-vga { };
 
   unifont = callPackage ../data/fonts/unifont { };
@@ -16405,7 +16415,7 @@ with pkgs;
 
   gnuradio-with-packages = callPackage ../applications/misc/gnuradio/wrapper.nix {
     inherit (python2Packages) python;
-    extraPackages = [ gnuradio-nacl gnuradio-osmosdr gnuradio-gsm gnuradio-ais gnuradio-rds ];
+    extraPackages = [ gnuradio-nacl gnuradio-osmosdr gnuradio-gsm gnuradio-ais gnuradio-rds gnuradio-limesdr ];
   };
 
   gnuradio-nacl = callPackage ../applications/misc/gnuradio/nacl.nix { };
@@ -16414,6 +16424,8 @@ with pkgs;
 
   gnuradio-ais = callPackage ../applications/misc/gnuradio/ais.nix { };
 
+  gnuradio-limesdr = callPackage ../applications/misc/gnuradio/limesdr.nix { };
+
   gnuradio-rds = callPackage ../applications/misc/gnuradio/rds.nix { };
 
   gnuradio-osmosdr = callPackage ../applications/misc/gnuradio/osmosdr.nix { };
@@ -16950,9 +16962,7 @@ with pkgs;
     extra-packages = [ csound ];
   };
 
-  jackline = callPackage ../applications/networking/instant-messengers/jackline {
-    ocamlPackages = ocaml-ng.ocamlPackages_4_05;
-  };
+  jackline = callPackage ../applications/networking/instant-messengers/jackline { };
 
   slack = callPackage ../applications/networking/instant-messengers/slack { };
 
@@ -18994,7 +19004,7 @@ with pkgs;
 
   tree = callPackage ../tools/system/tree {};
 
-  treesheets = callPackage ../applications/office/treesheets { wxGTK = wxGTK30; };
+  treesheets = callPackage ../applications/office/treesheets { wxGTK = wxGTK31; };
 
   trezor-bridge = callPackage ../applications/networking/browsers/mozilla-plugins/trezor { };
 
@@ -19602,6 +19612,8 @@ with pkgs;
 
   xss-lock = callPackage ../misc/screensavers/xss-lock { };
 
+  xloadimage = callPackage ../tools/X11/xloadimage { };
+
   xssproxy = callPackage ../misc/screensavers/xssproxy { };
 
   xsynth_dssi = callPackage ../applications/audio/xsynth-dssi { };
diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix
index b0c82508c114..3bf7c31b7008 100644
--- a/pkgs/top-level/darwin-packages.nix
+++ b/pkgs/top-level/darwin-packages.nix
@@ -31,10 +31,7 @@ in
     libcxxabi = pkgs.libcxxabi;
   };
 
-  cf-private = callPackage ../os-specific/darwin/cf-private {
-    inherit (apple-source-releases) CF;
-    inherit (darwin) osx_private_sdk;
-  };
+  cf-private = callPackage ../os-specific/darwin/cf-private { inherit (darwin) CF apple_sdk; };
 
   DarwinTools = callPackage ../os-specific/darwin/DarwinTools { };
 
@@ -76,7 +73,10 @@ in
 
   CoreSymbolication = callPackage ../os-specific/darwin/CoreSymbolication { };
 
-  swift-corelibs = callPackages ../os-specific/darwin/swift-corelibs { };
+  CF = callPackage ../os-specific/darwin/swift-corelibs/corefoundation.nix { inherit (darwin) objc4 ICU; };
+  
+  # As the name says, this is broken, but I don't want to lose it since it's a direction we want to go in
+  # libdispatch-broken = callPackage ../os-specific/darwin/swift-corelibs/libdispatch.nix { inherit (darwin) apple_sdk_sierra xnu; };
 
   darling = callPackage ../os-specific/darwin/darling/default.nix { };
 
diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix
index f5e5cfb3972b..779a24352bf8 100644
--- a/pkgs/top-level/ocaml-packages.nix
+++ b/pkgs/top-level/ocaml-packages.nix
@@ -220,6 +220,12 @@ let
 
     digestif =  callPackage ../development/ocaml-modules/digestif { };
 
+    doc-ock =  callPackage ../development/ocaml-modules/doc-ock { };
+
+    doc-ock-html =  callPackage ../development/ocaml-modules/doc-ock-html { };
+
+    doc-ock-xml =  callPackage ../development/ocaml-modules/doc-ock-xml { };
+
     dolmen =  callPackage ../development/ocaml-modules/dolmen { };
 
     dolog = callPackage ../development/ocaml-modules/dolog { };
@@ -240,8 +246,6 @@ let
 
     erm_xmpp = callPackage ../development/ocaml-modules/erm_xmpp { };
 
-    erm_xmpp_0_3 = callPackage ../development/ocaml-modules/erm_xmpp/0.3.nix { };
-
     estring = callPackage ../development/ocaml-modules/estring { };
 
     ezjsonm = callPackage ../development/ocaml-modules/ezjsonm { };
@@ -535,6 +539,8 @@ let
 
     octavius = callPackage ../development/ocaml-modules/octavius { };
 
+    odoc = callPackage ../development/ocaml-modules/odoc { };
+
     ojquery = callPackage ../development/ocaml-modules/ojquery { };
 
     omd = callPackage ../development/ocaml-modules/omd { };
diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix
index f2d2da0cc6ff..18ca62c02b04 100644
--- a/pkgs/top-level/perl-packages.nix
+++ b/pkgs/top-level/perl-packages.nix
@@ -165,10 +165,10 @@ let
   };
 
   AnyEventHTTP = buildPerlPackage rec {
-    name = "AnyEvent-HTTP-2.23";
+    name = "AnyEvent-HTTP-2.24";
     src = fetchurl {
       url = "mirror://cpan/authors/id/M/ML/MLEHMANN/${name}.tar.gz";
-      sha256 = "2e3376d03bfa5f172f43d4c615ba496281c9ffe3093a828c539683e17e2fbbcb";
+      sha256 = "0358a542baa45403d81c0a70e43e79c044ddfa1371161d043f002acef63121dd";
     };
     propagatedBuildInputs = [ AnyEvent commonsense ];
   };
@@ -501,10 +501,10 @@ let
   };
 
   ArchiveTar = buildPerlPackage rec {
-    name = "Archive-Tar-2.30";
+    name = "Archive-Tar-2.32";
     src = fetchurl {
       url = "mirror://cpan/authors/id/B/BI/BINGOS/${name}.tar.gz";
-      sha256 = "4a5a172cfefe08cb2d32f99ed388a3b55967588bbf254e950bc8a48a8bf1d2e5";
+      sha256 = "92783780731ab0c9247adf43e70f4801e8317e3915ea87e38b85c8f734e8fca2";
     };
     meta = {
       description = "Manipulates TAR archives";
@@ -526,10 +526,10 @@ let
   };
 
   ArchiveZip = buildPerlPackage {
-    name = "Archive-Zip-1.62";
+    name = "Archive-Zip-1.64";
     src = fetchurl {
-      url = mirror://cpan/authors/id/P/PH/PHRED/Archive-Zip-1.62.tar.gz;
-      sha256 = "1jax173w7nm5r6k7ymfcskvs1rw590lyscbqrnfbkjj4cxc65wrb";
+      url = mirror://cpan/authors/id/P/PH/PHRED/Archive-Zip-1.64.tar.gz;
+      sha256 = "0zfinh8nx3rxzscp57vq3w8hihpdb0zs67vvalykcf402kr88pyy";
     };
     buildInputs = [ TestMockModule ];
     meta = {
@@ -811,10 +811,10 @@ let
   };
 
   BKeywords = buildPerlPackage rec {
-    name = "B-Keywords-1.18";
+    name = "B-Keywords-1.19";
     src = fetchurl {
       url = "mirror://cpan/authors/id/R/RU/RURBAN/${name}.tar.gz";
-      sha256 = "0f5bb2fpbq5jzdb2jfs73hrggrq2gnpacd2kkxgifjl7q7xd9ck5";
+      sha256 = "1kdzhdksnqrmij98bnifv2p2125zvpf0rmzxjiav65ipydi4rsw9";
     };
     meta = {
       description = "Lists of reserved barewords and symbol names";
@@ -1082,10 +1082,10 @@ let
   };
 
   Carp = buildPerlPackage rec {
-    name = "Carp-1.38";
+    name = "Carp-1.50";
     src = fetchurl {
-      url = "mirror://cpan/authors/id/R/RJ/RJBS/${name}.tar.gz";
-      sha256 = "00bijwwc0ix27h2ma3lvsf3b56biar96bl9dikxgx7cmpcycxad5";
+      url = mirror://cpan/authors/id/X/XS/XSAWYERX/Carp-1.50.tar.gz;
+      sha256 = "1ngbpjyd9qi7n4h5r3q3qibd8by7rfiv7364jqlv4lbd3973n9zm";
     };
     meta = with stdenv.lib; {
       description = "Alternative warn and die for modules";
@@ -2347,10 +2347,10 @@ let
   };
 
   CodeTidyAll = buildPerlPackage rec {
-     name = "Code-TidyAll-0.70";
+     name = "Code-TidyAll-0.71";
      src = fetchurl {
-       url = mirror://cpan/authors/id/D/DR/DROLSKY/Code-TidyAll-0.70.tar.gz;
-       sha256 = "16s847y7jhx07yn15p84lpr1jn8srqb8ma12g4ngwr46hhkrbz06";
+       url = mirror://cpan/authors/id/D/DR/DROLSKY/Code-TidyAll-0.71.tar.gz;
+       sha256 = "043s0fkg8y9g38m9p87jh9p1kkznz7yq96x2rnjj221hpl3zysdr";
      };
      propagatedBuildInputs = [ CaptureTiny ConfigINI FileWhich Filepushd IPCRun3 IPCSystemSimple ListCompare ListSomeUtils LogAny Moo ScopeGuard SpecioLibraryPathTiny TextDiff TimeDate TimeDurationParse ];
      buildInputs = [ TestClass TestClassMost TestDeep TestDifferences TestException TestFatal TestMost TestWarn TestWarnings librelative ];
@@ -2519,10 +2519,10 @@ let
   };
 
   ConfigIniFiles = buildPerlModule rec {
-    name = "Config-IniFiles-2.98";
+    name = "Config-IniFiles-3.000000";
     src = fetchurl {
       url = "mirror://cpan/authors/id/S/SH/SHLOMIF/${name}.tar.gz";
-      sha256 = "9d5fc5c2192058e58ad35150ddae3043a2679f2aa4e1fb7e18e36794622b1797";
+      sha256 = "cd92f6b7f1aa3e03abf6251f1e6129dab8a2b835e8b17c7c4cc3e8305c1c9b29";
     };
     propagatedBuildInputs = [ IOStringy ];
     meta = {
@@ -2771,10 +2771,10 @@ let
   };
 
   CpanelJSONXS = buildPerlPackage rec {
-    name = "Cpanel-JSON-XS-4.05";
+    name = "Cpanel-JSON-XS-4.06";
     src = fetchurl {
       url = "mirror://cpan/authors/id/R/RU/RURBAN/${name}.tar.gz";
-      sha256 = "dd2b69265604ac6f18b47131565f712d55ed8df3b85f8f58f0c98cad17383663";
+      sha256 = "63481d9d2d6251cf520bb6a62147faf6e8f35b9fe6b3ddd81c5bfd71e31ec9ba";
     };
     meta = {
       description = "CPanel fork of JSON::XS, fast and correct serializing";
@@ -2954,10 +2954,10 @@ let
   };
 
   CryptJWT = buildPerlPackage rec {
-    name = "Crypt-JWT-0.022";
+    name = "Crypt-JWT-0.023";
     src = fetchurl {
       url = "mirror://cpan/authors/id/M/MI/MIK/${name}.tar.gz";
-      sha256 = "eb0a591f91c431929d8788dc26cc8cd98d1dc37af2a45b5754ca5039c8282476";
+      sha256 = "540594d0051028e00e586eb7827df09b01c091c648bb6b210de3124fe118524b";
     };
     propagatedBuildInputs = [ CryptX JSONMaybeXS ];
     meta = {
@@ -3249,10 +3249,10 @@ let
   };
 
   DataDumper = buildPerlPackage rec {
-    name = "Data-Dumper-2.161";
+    name = "Data-Dumper-2.172";
     src = fetchurl {
-      url = "mirror://cpan/authors/id/S/SM/SMUELLER/${name}.tar.gz";
-      sha256 = "3aa4ac1b042b3880438165fb2b2139d377564a8e9928ffe689ede5304ee90558";
+      url = mirror://cpan/authors/id/X/XS/XSAWYERX/Data-Dumper-2.172.tar.gz;
+      sha256 = "a95a3037163817221021ac145500968be44dc155c261f4097136392c0a9fecd9";
     };
     outputs = [ "out" ];
     meta = {
@@ -3614,10 +3614,10 @@ let
   };
 
   DateManip = buildPerlPackage rec {
-    name = "Date-Manip-6.72";
+    name = "Date-Manip-6.73";
     src = fetchurl {
       url = "mirror://cpan/authors/id/S/SB/SBECK/${name}.tar.gz";
-      sha256 = "19jdm73kqbv1biw4v8bdzy5qr2xvqdrfz8lxgg59445ljjfxvx1q";
+      sha256 = "0md25ik7pwbwgidiprcq20db8jdniknxs0qj1m3l76ziqg3rb4nk";
     };
     # for some reason, parsing /etc/localtime does not work anymore - make sure that the fallback "/bin/date +%Z" will work
     patchPhase = ''
@@ -3717,10 +3717,10 @@ let
   };
 
   DateTimeFormatFlexible = buildPerlPackage {
-    name = "DateTime-Format-Flexible-0.30";
+    name = "DateTime-Format-Flexible-0.31";
     src = fetchurl {
-      url = mirror://cpan/authors/id/T/TH/THINC/DateTime-Format-Flexible-0.30.tar.gz;
-      sha256 = "e7974e0492d7801682b400dd8e9a6fbfd8a56602942883cd7867a2008734cca4";
+      url = mirror://cpan/authors/id/T/TH/THINC/DateTime-Format-Flexible-0.31.tar.gz;
+      sha256 = "0daf62fe4af0b336d45e367143a580b5a34912a679eef788d54c4d5ad685c2d1";
     };
     propagatedBuildInputs = [ DateTimeFormatBuilder ListMoreUtils ModulePluggable ];
     meta = {
@@ -4009,10 +4009,10 @@ let
   };
 
   DevelPPPort = buildPerlPackage rec {
-    name = "Devel-PPPort-3.42";
+    name = "Devel-PPPort-3.43";
     src = fetchurl {
-      url = mirror://cpan/authors/id/X/XS/XSAWYERX/Devel-PPPort-3.42.tar.gz;
-      sha256 = "bac5d98b92fe2673a84ea45f1c9b615e3a46c3cc6db59c61a2fc95dd3cf9e14a";
+      url = mirror://cpan/authors/id/X/XS/XSAWYERX/Devel-PPPort-3.43.tar.gz;
+      sha256 = "90fd98fb24e1d7252011ff181244e04c8c8135933e67eab93c57ed6a61ed86f4";
     };
     meta = {
       description = "Perl/Pollution/Portability";
@@ -5976,10 +5976,10 @@ let
   };
 
   FilePath = buildPerlPackage rec {
-    name = "File-Path-2.15";
+    name = "File-Path-2.16";
     src = fetchurl {
-      url = mirror://cpan/authors/id/J/JK/JKEENAN/File-Path-2.15.tar.gz;
-      sha256 = "1570f3c1cdf93c50f65c2072e8f20ee121550771dfb7f6e563f503a2a7050744";
+      url = mirror://cpan/authors/id/J/JK/JKEENAN/File-Path-2.16.tar.gz;
+      sha256 = "21f7d69b59c381f459c5f0bf697d512109bd911f12ca33270b70ca9a9ef6fa05";
     };
     meta = {
       description = "Create or remove directory trees";
@@ -6297,10 +6297,10 @@ let
   };
 
   ForksSuper = buildPerlPackage {
-    name = "Forks-Super-0.94";
+    name = "Forks-Super-0.96";
     src = fetchurl {
-      url = mirror://cpan/authors/id/M/MO/MOB/Forks-Super-0.94.tar.gz;
-      sha256 = "145nj2wsymr5vr93ikrakjx3dd07q63fxb1bq7lkiranm9974v8s";
+      url = mirror://cpan/authors/id/M/MO/MOB/Forks-Super-0.96.tar.gz;
+      sha256 = "0vzxfxdgxjk83cwg9p5dzvfydrah53xcxkickznrrd5rhp1rasqx";
     };
     doCheck = false;
     meta = {
@@ -6349,10 +6349,10 @@ let
   };
 
   GD = buildPerlPackage rec {
-    name = "GD-2.68";
+    name = "GD-2.69";
     src = fetchurl {
-      url = mirror://cpan/authors/id/R/RU/RURBAN/GD-2.68.tar.gz;
-      sha256 = "0p2ya641nl5cvcqgw829xgabh835qijfd6vq2ba12862946xx8va";
+      url = mirror://cpan/authors/id/R/RU/RURBAN/GD-2.69.tar.gz;
+      sha256 = "0palmq7l42fibqxhrabnjm7di4q8kciq9323902d717x3i4jvc6x";
     };
 
     buildInputs = [ pkgs.gd pkgs.libjpeg pkgs.zlib pkgs.freetype pkgs.libpng pkgs.fontconfig pkgs.xorg.libXpm ExtUtilsPkgConfig TestFork ];
@@ -7760,12 +7760,12 @@ let
   };
 
   IOSocketSSL = buildPerlPackage rec {
-    name = "IO-Socket-SSL-2.059";
+    name = "IO-Socket-SSL-2.060";
     src = fetchurl {
       url = "mirror://cpan/authors/id/S/SU/SULLR/${name}.tar.gz";
-      sha256 = "217debbe0a79f0b7c5669978b4d733271998df4497f4718f78456e5f54d64849";
+      sha256 = "fb5b2877ac5b686a5d7b8dd71cf5464ffe75d10c32047b5570674870e46b1b8c";
     };
-    propagatedBuildInputs = [ NetSSLeay ];
+    propagatedBuildInputs = [ MozillaCA NetSSLeay ];
     # Fix path to default certificate store.
     postPatch = ''
       substituteInPlace lib/IO/Socket/SSL.pm \
@@ -8320,10 +8320,10 @@ let
   };
 
   LinguaENTagger = buildPerlPackage {
-    name = "Lingua-EN-Tagger-0.29";
+    name = "Lingua-EN-Tagger-0.30";
     src = fetchurl {
-      url = mirror://cpan/authors/id/A/AC/ACOBURN/Lingua-EN-Tagger-0.29.tar.gz;
-      sha256 = "0dssn101kmpkh2ik1430mj2ikk04849vbpgi60382kvh9xn795na";
+      url = mirror://cpan/authors/id/A/AC/ACOBURN/Lingua-EN-Tagger-0.30.tar.gz;
+      sha256 = "0nrnkvsf9f0a7lp82sanmy89ms2nqq1lvjqicvsagsvzp513bl5b";
     };
     propagatedBuildInputs = [ HTMLParser LinguaStem MemoizeExpireLRU ];
     meta = {
@@ -8552,10 +8552,10 @@ let
   };
 
   LocaleCodes = buildPerlPackage {
-    name = "Locale-Codes-3.57";
+    name = "Locale-Codes-3.58";
     src = fetchurl {
-      url = mirror://cpan/authors/id/S/SB/SBECK/Locale-Codes-3.57.tar.gz;
-      sha256 = "3547cffeb6098a706a5647f6079e06cbdb68a6b7f9c8d5b0032659df7bfd8812";
+      url = mirror://cpan/authors/id/S/SB/SBECK/Locale-Codes-3.58.tar.gz;
+      sha256 = "345c0b0170288d74a147fbe218b7c78147aa2baf4e839fe8680a2b0a2d8e505b";
     };
     meta = {
       description = "A distribution of modules to handle locale codes";
@@ -8768,10 +8768,10 @@ let
   };
 
   LogDispatch = buildPerlPackage {
-    name = "Log-Dispatch-2.67";
+    name = "Log-Dispatch-2.68";
     src = fetchurl {
-      url = mirror://cpan/authors/id/D/DR/DROLSKY/Log-Dispatch-2.67.tar.gz;
-      sha256 = "017ks3i0k005dqz7fz53w7x35csqqlr4vfb95c0ijdablajs4kd9";
+      url = mirror://cpan/authors/id/D/DR/DROLSKY/Log-Dispatch-2.68.tar.gz;
+      sha256 = "1bxd3bhrn1h2q9f8r65z3101a32nl2kdb7l40bxg4vbsk4wk0ynh";
     };
     propagatedBuildInputs = [ DevelGlobalDestruction ParamsValidationCompiler Specio namespaceautoclean ];
     meta = {
@@ -8830,10 +8830,10 @@ let
   };
 
   MCE = buildPerlPackage rec {
-     name = "MCE-1.836";
+     name = "MCE-1.837";
      src = fetchurl {
-       url = mirror://cpan/authors/id/M/MA/MARIOROY/MCE-1.836.tar.gz;
-       sha256 = "04nkcbs27plwq31w541phfci3391s10p2xv5lmry5wq7fbdw5iwy";
+       url = mirror://cpan/authors/id/M/MA/MARIOROY/MCE-1.837.tar.gz;
+       sha256 = "0si12wv02i8cn2xw6lk0m2apqrd88awcli1yadmvikq5rnfhcypa";
      };
      meta = {
        description = "Many-Core Engine for Perl providing parallel processing capabilities";
@@ -8959,7 +8959,7 @@ let
       sha256 = "1rxrpwylfw1afah0nk96kgkwjbl2p1a7lwx50iipg8c4rx3cjb2j";
     };
     patches = [ ../development/perl-modules/lwp-protocol-https-cert-file.patch ];
-    propagatedBuildInputs = [ IOSocketSSL LWP MozillaCA ];
+    propagatedBuildInputs = [ IOSocketSSL LWP ];
     doCheck = false; # tries to connect to https://www.apache.org/.
     meta = {
       description = "Provide https support for LWP::UserAgent";
@@ -9078,10 +9078,10 @@ let
   };
 
   MailMessage = buildPerlPackage rec {
-     name = "Mail-Message-3.006";
+     name = "Mail-Message-3.007";
      src = fetchurl {
-       url = mirror://cpan/authors/id/M/MA/MARKOV/Mail-Message-3.006.tar.gz;
-       sha256 = "08bdf06bmxdqbslk3k9av542pjhyw9wx10j79fxz0dwpalimc6zi";
+       url = mirror://cpan/authors/id/M/MA/MARKOV/Mail-Message-3.007.tar.gz;
+       sha256 = "1hpf68i5w20dxcibqj5w5h8mx9qa6vjhr34bicrvdh7d3dfxq0bn";
      };
      propagatedBuildInputs = [ IOStringy MIMETypes MailTools URI UserIdentity ];
      meta = {
@@ -9186,10 +9186,10 @@ let
   };
 
   MailTransport = buildPerlPackage rec {
-     name = "Mail-Transport-3.002";
+     name = "Mail-Transport-3.003";
      src = fetchurl {
-       url = mirror://cpan/authors/id/M/MA/MARKOV/Mail-Transport-3.002.tar.gz;
-       sha256 = "0wm4j9w15nsvjxi9x22fn2rnljbffd88v27p0z0305bfg35gh4kg";
+       url = mirror://cpan/authors/id/M/MA/MARKOV/Mail-Transport-3.003.tar.gz;
+       sha256 = "0lb1awpk2wcnn5wg663982jl45x9fdn8ikxscayscxa16rim116p";
      };
      propagatedBuildInputs = [ MailMessage ];
      meta = {
@@ -9553,11 +9553,11 @@ let
   };
 
   ModernPerl = buildPerlModule {
-    name = "Modern-Perl-1.20180701";
+    name = "Modern-Perl-1.20180901";
 
     src = fetchurl {
-      url = mirror://cpan/authors/id/C/CH/CHROMATIC/Modern-Perl-1.20180701.tar.gz;
-      sha256 = "cfdf390bc565599ef90ef086a81233dc1dfc7867676dc28e1deedcd7e5543da6";
+      url = mirror://cpan/authors/id/C/CH/CHROMATIC/Modern-Perl-1.20180901.tar.gz;
+      sha256 = "5c289bbe59cfc90abb9b8c6b9903b7625ca9ea26239d397d87f7b57517cd61a1";
     };
     meta = {
       homepage = https://github.com/chromatic/Modern-Perl;
@@ -9926,10 +9926,10 @@ let
   };
 
   ModuleSignature = buildPerlPackage {
-    name = "Module-Signature-0.81";
+    name = "Module-Signature-0.83";
     src = fetchurl {
-      url = mirror://cpan/authors/id/A/AU/AUDREYT/Module-Signature-0.81.tar.gz;
-      sha256 = "7df547ceb8e45d40f75e481a868f389aaed5641c2cf4e133146ccea4b8facec6";
+      url = mirror://cpan/authors/id/A/AU/AUDREYT/Module-Signature-0.83.tar.gz;
+      sha256 = "3c15f3845a85d2a76a81253be53cb0f716465a3f696eb9c50e92eef34e9601cb";
     };
     buildInputs = [ IPCRun ];
     meta = {
@@ -10010,7 +10010,7 @@ let
     name = "Mojo-IOLoop-ForkCall-0.20";
     src = fetchurl {
       url = "mirror://cpan/authors/id/J/JB/JBERGER/${name}.tar.gz";
-      sha256 = "19pih5x0ayxs2m8j29qwdpi6ky3w4ghv6vrmax3ix9r59hj6569b";
+      sha256 = "2b9962244c25a71e4757356fb3e1237cf869e26d1c27215115ba7b057a81f1a6";
     };
     propagatedBuildInputs = [ IOPipely Mojolicious ];
     meta = {
@@ -11072,13 +11072,13 @@ let
   };
 
   NetAmazonS3 = buildPerlPackage rec {
-    name = "Net-Amazon-S3-0.84";
+    name = "Net-Amazon-S3-0.85";
     src = fetchurl {
-      url = mirror://cpan/authors/id/L/LL/LLAP/Net-Amazon-S3-0.84.tar.gz;
-      sha256 = "9e995f7d7982d4ab3510bf30e842426b341be20e4b7e6fe48edafeb067f49626";
+      url = mirror://cpan/authors/id/L/LL/LLAP/Net-Amazon-S3-0.85.tar.gz;
+      sha256 = "49b91233b9e994ce3536dd69c5106c968a03d199ff3968c8fc2f2b5be3d55430";
     };
-    buildInputs = [ TestDeep TestException ];
-    propagatedBuildInputs = [ DataStreamBulk DateTimeFormatHTTP DigestHMAC DigestMD5File FileFindRule LWPUserAgentDetermined MIMETypes MooseXStrictConstructor MooseXTypesDateTimeMoreCoercions RefUtil RegexpCommon TermEncoding TermProgressBarSimple XMLLibXML ];
+    buildInputs = [ TestDeep TestException TestLoadAllModules TestMockTime TestWarnings ];
+    propagatedBuildInputs = [ DataStreamBulk DateTimeFormatHTTP DigestHMAC DigestMD5File FileFindRule LWPUserAgentDetermined MIMETypes MooseXRoleParameterized MooseXStrictConstructor MooseXTypesDateTimeMoreCoercions RefUtil RegexpCommon SubOverride TermEncoding TermProgressBarSimple XMLLibXML ];
     meta = {
       description = "Use the Amazon S3 - Simple Storage Service";
       license = with stdenv.lib.licenses; [ artistic1 gpl1Plus ];
@@ -11981,13 +11981,13 @@ let
   };
 
   PathTools = buildPerlPackage {
-    name = "PathTools-3.74";
+    name = "PathTools-3.75";
     preConfigure = ''
       substituteInPlace Cwd.pm --replace '/usr/bin/pwd' '${pkgs.coreutils}/bin/pwd'
     '';
     src = fetchurl {
-      url = mirror://cpan/authors/id/X/XS/XSAWYERX/PathTools-3.74.tar.gz;
-      sha256 = "25724cc54c59a3bfabadec95e72db292c98676bf3632497384e8dc6277936e11";
+      url = mirror://cpan/authors/id/X/XS/XSAWYERX/PathTools-3.75.tar.gz;
+      sha256 = "a558503aa6b1f8c727c0073339081a77888606aa701ada1ad62dd9d8c3f945a2";
     };
   };
 
@@ -12026,10 +12026,10 @@ let
   };
 
   Pegex = buildPerlPackage rec {
-    name = "Pegex-0.64";
+    name = "Pegex-0.67";
     src = fetchurl {
       url = "mirror://cpan/authors/id/I/IN/INGY/${name}.tar.gz";
-      sha256 = "27e00264bdafb9c2109212b9654542032617fecf7b7814915d2bdac198f067cd";
+      sha256 = "3cb9df73aece2a5fa769a89bd74daaac302cc077e2489b3b552f3aa172092091";
     };
     buildInputs = [ FileShareDirInstall YAMLLibYAML ];
     meta = {
@@ -12214,10 +12214,10 @@ let
   };
 
   PkgConfig = buildPerlPackage rec {
-    name = "PkgConfig-0.21026";
+    name = "PkgConfig-0.22026";
     src = fetchurl {
       url = "mirror://cpan/authors/id/P/PL/PLICEASE/${name}.tar.gz";
-      sha256 = "018f8d3c74e661df66046b26e57f4c5991adafe202af7ea2d1c6f6bcafde584b";
+      sha256 = "d01849bf88f3d56f4efe304cfe56f806867a45b716e3963dcacce17b829433ce";
     };
     meta = {
       description = "Pure-Perl Core-Only replacement for pkg-config";
@@ -13355,10 +13355,10 @@ let
   };
 
   ScopeUpper = buildPerlPackage rec {
-    name = "Scope-Upper-0.30";
+    name = "Scope-Upper-0.31";
     src = fetchurl {
       url = "mirror://cpan/authors/id/V/VP/VPIT/${name}.tar.gz";
-      sha256 = "7f151582423850d814034404b1e23b5efb281b9dd656b9afe81c761ebb88bbb4";
+      sha256 = "cc4d2ce0f185b4867d73b4083991117052a523fd409debf15bdd7e374cc16d8c";
     };
     meta = {
       description = "Act on upper scopes";
@@ -15287,6 +15287,19 @@ let
     };
   };
 
+  TestLoadAllModules = buildPerlPackage {
+    name = "Test-LoadAllModules-0.022";
+    src = fetchurl {
+      url = mirror://cpan/authors/id/K/KI/KITANO/Test-LoadAllModules-0.022.tar.gz;
+      sha256 = "1zjwbqk1ns9m8srrhyj3i5zih976i4d2ibflh5s8lr10a1aiz1hv";
+    };
+    propagatedBuildInputs = [ ListMoreUtils ModulePluggable ];
+    meta = {
+      description = "do use_ok for modules in search path";
+      license = with stdenv.lib.licenses; [ artistic1 gpl1Plus ];
+    };
+  };
+
   TestLongString = buildPerlPackage rec {
     name = "Test-LongString-0.17";
     src = fetchurl {
@@ -15340,10 +15353,10 @@ let
   };
 
   TestMockModule = buildPerlModule {
-    name = "Test-MockModule-0.15";
+    name = "Test-MockModule-0.170.0";
     src = fetchurl {
-      url = mirror://cpan/authors/id/G/GF/GFRANKS/Test-MockModule-0.15.tar.gz;
-      sha256 = "0nx3nz7yvgcw9vw646520hh1jb3kz6sspsfqa69v3vczdkfgx5qn";
+      url = mirror://cpan/authors/id/G/GF/GFRANKS/Test-MockModule-v0.170.0.tar.gz;
+      sha256 = "0pggwrlqj6k44qayhbpjqkzry1r626iy2vf30zlf2jdhbjbvlycz";
     };
     propagatedBuildInputs = [ SUPER ];
     meta = {
@@ -15629,10 +15642,10 @@ let
   };
 
   TestRoutine = buildPerlPackage {
-    name = "Test-Routine-0.025";
+    name = "Test-Routine-0.027";
     src = fetchurl {
-      url = mirror://cpan/authors/id/R/RJ/RJBS/Test-Routine-0.025.tar.gz;
-      sha256 = "13gxczy0mx3rqnp55vc0j2d936qldrimmad87nmf4wrj0kd2lw92";
+      url = mirror://cpan/authors/id/R/RJ/RJBS/Test-Routine-0.027.tar.gz;
+      sha256 = "0n6k310v2py787lkvhzrn8vndws9icdf8mighgl472k0x890xm5s";
     };
     buildInputs = [ TestAbortable TestFatal ];
     propagatedBuildInputs = [ Moose TestSimple13 namespaceautoclean ];
@@ -17896,10 +17909,10 @@ let
   };
 
   YAMLLibYAML = buildPerlPackage rec {
-    name = "YAML-LibYAML-0.72";
+    name = "YAML-LibYAML-0.74";
     src = fetchurl {
-      url = "mirror://cpan/authors/id/T/TI/TINITA/${name}.tar.gz";
-      sha256 = "0dn50pranjyai4gclb501m29y0ks03y87g132wqpb469rb3sjd0g";
+      url = mirror://cpan/authors/id/I/IN/INGY/YAML-LibYAML-0.74.tar.gz;
+      sha256 = "021l0gf6z93xd6vd604vpvb9d4b714zph17g6hg47fpawdq0xpd0";
     };
   };
 
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index df28860accff..0354bdda6ef6 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -1841,6 +1841,8 @@ in {
 
   pyjade = callPackage ../development/python-modules/pyjade {};
 
+  pyjet = callPackage ../development/python-modules/pyjet {};
+
   PyLD = callPackage ../development/python-modules/PyLD { };
 
   python-jose = callPackage ../development/python-modules/python-jose {};
diff --git a/pkgs/top-level/release.nix b/pkgs/top-level/release.nix
index 6ebc640ea219..93400bf0ee65 100644
--- a/pkgs/top-level/release.nix
+++ b/pkgs/top-level/release.nix
@@ -77,6 +77,7 @@ let
               jobs.tests.cc-wrapper-libcxx-39.x86_64-darwin
               jobs.tests.stdenv-inputs.x86_64-darwin
               jobs.tests.macOSSierraShared.x86_64-darwin
+              jobs.tests.patch-shebangs.x86_64-darwin
             ];
         } else null;
 
@@ -119,6 +120,7 @@ let
               jobs.tests.cc-multilib-gcc.x86_64-linux
               jobs.tests.cc-multilib-clang.x86_64-linux
               jobs.tests.stdenv-inputs.x86_64-linux
+              jobs.tests.patch-shebangs.x86_64-linux
             ]
             ++ lib.collect lib.isDerivation jobs.stdenvBootstrapTools
             ++ lib.optionals supportDarwin [
@@ -148,6 +150,7 @@ let
               jobs.tests.cc-wrapper-libcxx-6.x86_64-darwin
               jobs.tests.stdenv-inputs.x86_64-darwin
               jobs.tests.macOSSierraShared.x86_64-darwin
+              jobs.tests.patch-shebangs.x86_64-darwin
             ];
         };
 
diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix
index 06978d1067bf..7637371a40f1 100644
--- a/pkgs/top-level/stage.nix
+++ b/pkgs/top-level/stage.nix
@@ -83,7 +83,7 @@ let
     inherit (super.stdenv) buildPlatform hostPlatform targetPlatform;
   in {
     inherit buildPlatform hostPlatform targetPlatform;
-    inherit (buildPlatform) system;
+    inherit (hostPlatform) system;
   };
 
   splice = self: super: import ./splice.nix lib self (buildPackages != null);