summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2018-01-02 19:10:45 +0100
committerFrederik Rietdijk <fridh@fridh.nl>2018-01-02 19:10:45 +0100
commit804285f589ded484b530750dd1ec03b9052bcdac (patch)
tree8b20955e293215e1b8d672a3fd38867c39484609 /pkgs
parent63c1a54257a5cef15b926c0843b3c7557c6f9a24 (diff)
parent4cc2a38854338ba783fb867ff924200b59867773 (diff)
downloadnixpkgs-804285f589ded484b530750dd1ec03b9052bcdac.tar
nixpkgs-804285f589ded484b530750dd1ec03b9052bcdac.tar.gz
nixpkgs-804285f589ded484b530750dd1ec03b9052bcdac.tar.bz2
nixpkgs-804285f589ded484b530750dd1ec03b9052bcdac.tar.lz
nixpkgs-804285f589ded484b530750dd1ec03b9052bcdac.tar.xz
nixpkgs-804285f589ded484b530750dd1ec03b9052bcdac.tar.zst
nixpkgs-804285f589ded484b530750dd1ec03b9052bcdac.zip
Merge remote-tracking branch 'upstream/staging' into HEAD
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/audio/amarok/kf5.nix5
-rw-r--r--pkgs/applications/gis/grass/default.nix23
-rw-r--r--pkgs/applications/graphics/digikam/default.nix1
-rw-r--r--pkgs/applications/kde/kmime.nix4
-rw-r--r--pkgs/applications/kde/libkcddb.nix4
-rw-r--r--pkgs/applications/misc/deepin-terminal/default.nix8
-rw-r--r--pkgs/applications/misc/font-manager/default.nix7
-rw-r--r--pkgs/applications/misc/haxor-news/default.nix24
-rw-r--r--pkgs/applications/misc/kupfer/default.nix7
-rw-r--r--pkgs/applications/misc/pdfpc/default.nix8
-rw-r--r--pkgs/applications/misc/synapse/default.nix8
-rw-r--r--pkgs/applications/misc/valauncher/default.nix10
-rw-r--r--pkgs/applications/networking/browsers/lynx/default.nix6
-rw-r--r--pkgs/applications/office/kexi/default.nix4
-rw-r--r--pkgs/applications/office/skrooge/default.nix7
-rw-r--r--pkgs/applications/office/watson/default.nix27
-rw-r--r--pkgs/applications/science/logic/coq/8.4.nix2
-rw-r--r--pkgs/applications/science/logic/coq/default.nix2
-rw-r--r--pkgs/applications/science/math/R/setup-hook.sh6
-rw-r--r--pkgs/applications/science/math/glsurf/default.nix2
-rw-r--r--pkgs/applications/video/kodi/default.nix2
-rw-r--r--pkgs/applications/video/mplayer/default.nix3
-rw-r--r--pkgs/build-support/bintools-wrapper/default.nix16
-rw-r--r--pkgs/build-support/bintools-wrapper/ld-wrapper.sh5
-rw-r--r--pkgs/build-support/bintools-wrapper/setup-hook.sh45
-rw-r--r--pkgs/build-support/cc-wrapper/default.nix3
-rw-r--r--pkgs/build-support/cc-wrapper/setup-hook.sh55
-rw-r--r--pkgs/build-support/emacs/setup-hook.sh6
-rw-r--r--pkgs/build-support/gcc-wrapper-old/setup-hook.sh4
-rw-r--r--pkgs/build-support/setup-hooks/find-xml-catalogs.sh2
-rw-r--r--pkgs/build-support/setup-hooks/set-java-classpath.sh2
-rw-r--r--pkgs/build-support/setup-hooks/setup-debug-info-dirs.sh2
-rw-r--r--pkgs/build-support/setup-hooks/strip.sh37
-rw-r--r--pkgs/build-support/setup-hooks/wrap-gapps-hook.sh2
-rw-r--r--pkgs/data/icons/hicolor-icon-theme/setup-hook.sh3
-rw-r--r--pkgs/desktops/gnome-3/apps/gnome-characters/default.nix6
-rw-r--r--pkgs/desktops/gnome-3/core/eog/default.nix4
-rw-r--r--pkgs/desktops/gnome-3/core/gconf/default.nix4
-rw-r--r--pkgs/desktops/gnome-3/core/gnome-bluetooth/default.nix4
-rw-r--r--pkgs/desktops/gnome-3/core/grilo/setup-hook.sh2
-rw-r--r--pkgs/desktops/gnome-3/core/gtksourceview/default.nix12
-rw-r--r--pkgs/desktops/gnome-3/core/gucharmap/default.nix11
-rw-r--r--pkgs/desktops/gnome-3/core/libpeas/default.nix6
-rw-r--r--pkgs/desktops/gnome-3/core/simple-scan/default.nix8
-rw-r--r--pkgs/desktops/gnome-3/misc/gspell/default.nix4
-rw-r--r--pkgs/desktops/gnustep/make/setup-hook.sh2
-rw-r--r--pkgs/desktops/pantheon/apps/pantheon-terminal/default.nix8
-rw-r--r--pkgs/development/compilers/chicken/setup-hook.sh2
-rw-r--r--pkgs/development/compilers/gcc/4.5/default.nix68
-rw-r--r--pkgs/development/compilers/gcc/4.8/default.nix54
-rw-r--r--pkgs/development/compilers/gcc/4.9/default.nix68
-rw-r--r--pkgs/development/compilers/gcc/5/default.nix72
-rw-r--r--pkgs/development/compilers/gcc/6/default.nix71
-rw-r--r--pkgs/development/compilers/gcc/7/default.nix71
-rw-r--r--pkgs/development/compilers/gcc/snapshot/default.nix71
-rw-r--r--pkgs/development/compilers/gerbil/default.nix6
-rw-r--r--pkgs/development/compilers/go/setup-hook.sh2
-rw-r--r--pkgs/development/compilers/haxe/setup-hook.sh2
-rw-r--r--pkgs/development/compilers/hhvm/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/3.7/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/3.8/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/3.9/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/4/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/5/clang/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/5/default.nix10
-rw-r--r--pkgs/development/compilers/llvm/5/libc++/default.nix2
-rw-r--r--pkgs/development/compilers/llvm/5/libc++abi.nix2
-rw-r--r--pkgs/development/compilers/llvm/5/lld.nix2
-rw-r--r--pkgs/development/compilers/llvm/5/lldb.nix2
-rw-r--r--pkgs/development/compilers/llvm/5/llvm.nix2
-rw-r--r--pkgs/development/compilers/llvm/5/openmp.nix2
-rw-r--r--pkgs/development/compilers/neko/default.nix4
-rw-r--r--pkgs/development/compilers/sbcl/default.nix2
-rw-r--r--pkgs/development/compilers/urweb/default.nix6
-rw-r--r--pkgs/development/compilers/vala/default.nix24
-rw-r--r--pkgs/development/haskell-modules/configuration-common.nix2
-rw-r--r--pkgs/development/haskell-modules/configuration-nix.nix2
-rw-r--r--pkgs/development/haskell-modules/generic-builder.nix4
-rw-r--r--pkgs/development/idris-modules/build-idris-package.nix3
-rw-r--r--pkgs/development/idris-modules/with-packages.nix2
-rw-r--r--pkgs/development/interpreters/elixir/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/erlang/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/guile/setup-hook-2.0.sh2
-rw-r--r--pkgs/development/interpreters/guile/setup-hook-2.2.sh2
-rw-r--r--pkgs/development/interpreters/guile/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/jruby/default.nix2
-rw-r--r--pkgs/development/interpreters/perl/setup-hook.sh2
-rw-r--r--pkgs/development/interpreters/php/default.nix7
-rw-r--r--pkgs/development/interpreters/python/mk-python-derivation.nix17
-rw-r--r--pkgs/development/interpreters/python/setup-hook.sh5
-rw-r--r--pkgs/development/interpreters/ruby/default.nix2
-rw-r--r--pkgs/development/libraries/SDL/setup-hook.sh6
-rw-r--r--pkgs/development/libraries/SDL2/setup-hook.sh6
-rw-r--r--pkgs/development/libraries/atk/default.nix4
-rw-r--r--pkgs/development/libraries/boost/1.59.nix58
-rw-r--r--pkgs/development/libraries/boost/1.65.nix2
-rw-r--r--pkgs/development/libraries/boost/1.66.nix14
-rw-r--r--pkgs/development/libraries/boost/generic.nix150
-rw-r--r--pkgs/development/libraries/cppdb/default.nix6
-rw-r--r--pkgs/development/libraries/gdal/default.nix2
-rw-r--r--pkgs/development/libraries/gdal/gdal-1_11.nix4
-rw-r--r--pkgs/development/libraries/gdk-pixbuf/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/glib/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/glibc/2.26-75to115.diff.gzbin0 -> 32865 bytes
-rw-r--r--pkgs/development/libraries/glibc/allow-kernel-2.6.32.patch39
-rw-r--r--pkgs/development/libraries/glibc/common.nix24
-rw-r--r--pkgs/development/libraries/gmp/6.x.nix4
-rw-r--r--pkgs/development/libraries/gobject-introspection/setup-hook.sh12
-rw-r--r--pkgs/development/libraries/grantlee/5/setup-hook.sh6
-rw-r--r--pkgs/development/libraries/gstreamer/core/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/gtk+/2.x.nix4
-rw-r--r--pkgs/development/libraries/kdb/default.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdoctools/default.nix14
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/libagar/default.nix5
-rw-r--r--pkgs/development/libraries/libassuan/default.nix4
-rw-r--r--pkgs/development/libraries/libdbi-drivers/default.nix18
-rw-r--r--pkgs/development/libraries/libdrm/default.nix4
-rw-r--r--pkgs/development/libraries/libelf/default.nix24
-rw-r--r--pkgs/development/libraries/libgcrypt/default.nix4
-rw-r--r--pkgs/development/libraries/libnftnl/default.nix4
-rw-r--r--pkgs/development/libraries/libopcodes/default.nix3
-rw-r--r--pkgs/development/libraries/librdf/redland.nix2
-rw-r--r--pkgs/development/libraries/librep/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/mesa/default.nix4
-rw-r--r--pkgs/development/libraries/ncurses/default.nix3
-rw-r--r--pkgs/development/libraries/opendbx/default.nix6
-rw-r--r--pkgs/development/libraries/pcre/default.nix3
-rw-r--r--pkgs/development/libraries/pcre/stacksize-detection.patch16
-rw-r--r--pkgs/development/libraries/poco/default.nix5
-rw-r--r--pkgs/development/libraries/qt-3/default.nix2
-rw-r--r--pkgs/development/libraries/qt-4.x/4.8/default.nix2
-rw-r--r--pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh6
-rw-r--r--pkgs/development/libraries/qt-5/modules/qtbase.nix2
-rw-r--r--pkgs/development/libraries/rep-gtk/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/slib/setup-hook.sh2
-rw-r--r--pkgs/development/libraries/tntdb/default.nix2
-rw-r--r--pkgs/development/libraries/unixODBCDrivers/default.nix12
-rw-r--r--pkgs/development/libraries/wt/default.nix6
-rw-r--r--pkgs/development/libraries/xapian/default.nix2
-rw-r--r--pkgs/development/libraries/xapian/tools/omega/default.nix2
-rw-r--r--pkgs/development/lisp-modules/clwrapper/setup-hook.sh2
-rw-r--r--pkgs/development/lisp-modules/quicklisp-to-nix-overrides.nix6
-rw-r--r--pkgs/development/lisp-modules/shell.nix4
-rw-r--r--pkgs/development/ocaml-modules/eliom/setup-hook.sh2
-rw-r--r--pkgs/development/ocaml-modules/mysql/default.nix11
-rw-r--r--pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh2
-rw-r--r--pkgs/development/perl-modules/DBD-mysql/default.nix2
-rw-r--r--pkgs/development/pure-modules/glpk/default.nix6
-rw-r--r--pkgs/development/python-modules/APScheduler/default.nix4
-rw-r--r--pkgs/development/python-modules/Mako/default.nix32
-rw-r--r--pkgs/development/python-modules/MechanicalSoup/default.nix10
-rw-r--r--pkgs/development/python-modules/Nikola/default.nix4
-rw-r--r--pkgs/development/python-modules/Theano/default.nix4
-rw-r--r--pkgs/development/python-modules/absl-py/default.nix4
-rw-r--r--pkgs/development/python-modules/aenum/default.nix4
-rw-r--r--pkgs/development/python-modules/aiohttp/default.nix4
-rw-r--r--pkgs/development/python-modules/arrow/default.nix11
-rw-r--r--pkgs/development/python-modules/asgiref/default.nix4
-rw-r--r--pkgs/development/python-modules/asn1crypto/default.nix4
-rw-r--r--pkgs/development/python-modules/astor/default.nix4
-rw-r--r--pkgs/development/python-modules/astroid/default.nix4
-rw-r--r--pkgs/development/python-modules/astropy/default.nix4
-rw-r--r--pkgs/development/python-modules/attrs/default.nix10
-rw-r--r--pkgs/development/python-modules/aws-xray-sdk/default.nix29
-rw-r--r--pkgs/development/python-modules/backports_abc/default.nix25
-rw-r--r--pkgs/development/python-modules/backports_functools_lru_cache/default.nix24
-rw-r--r--pkgs/development/python-modules/backports_lzma/default.nix32
-rw-r--r--pkgs/development/python-modules/biopython/default.nix32
-rw-r--r--pkgs/development/python-modules/blaze/default.nix12
-rw-r--r--pkgs/development/python-modules/bokeh/default.nix4
-rw-r--r--pkgs/development/python-modules/bootstrapped-pip/default.nix4
-rw-r--r--pkgs/development/python-modules/boto3/default.nix50
-rw-r--r--pkgs/development/python-modules/botocore/default.nix4
-rw-r--r--pkgs/development/python-modules/brotlipy/default.nix36
-rw-r--r--pkgs/development/python-modules/cached-property/default.nix25
-rw-r--r--pkgs/development/python-modules/credstash/default.nix4
-rw-r--r--pkgs/development/python-modules/csscompressor/default.nix4
-rw-r--r--pkgs/development/python-modules/cx_freeze/default.nix4
-rw-r--r--pkgs/development/python-modules/cytoolz/default.nix4
-rw-r--r--pkgs/development/python-modules/dask/default.nix4
-rw-r--r--pkgs/development/python-modules/decorator/default.nix20
-rw-r--r--pkgs/development/python-modules/distro/default.nix4
-rw-r--r--pkgs/development/python-modules/django-jinja2/default.nix4
-rw-r--r--pkgs/development/python-modules/djangorestframework/default.nix4
-rw-r--r--pkgs/development/python-modules/docker/default.nix4
-rw-r--r--pkgs/development/python-modules/docker_compose/default.nix11
-rw-r--r--pkgs/development/python-modules/easy-thumbnails/default.nix4
-rw-r--r--pkgs/development/python-modules/eve/default.nix4
-rw-r--r--pkgs/development/python-modules/extras/default.nix23
-rw-r--r--pkgs/development/python-modules/faker/default.nix4
-rw-r--r--pkgs/development/python-modules/fastimport/default.nix8
-rw-r--r--pkgs/development/python-modules/faulthandler/default.nix4
-rw-r--r--pkgs/development/python-modules/filelock/default.nix4
-rw-r--r--pkgs/development/python-modules/fiona/default.nix4
-rw-r--r--pkgs/development/python-modules/flake8-debugger/default.nix4
-rw-r--r--pkgs/development/python-modules/flask-testing/default.nix4
-rw-r--r--pkgs/development/python-modules/flit/default.nix14
-rw-r--r--pkgs/development/python-modules/fonttools/default.nix4
-rw-r--r--pkgs/development/python-modules/ftfy/default.nix4
-rw-r--r--pkgs/development/python-modules/gensim/default.nix4
-rw-r--r--pkgs/development/python-modules/gflags/default.nix8
-rw-r--r--pkgs/development/python-modules/google_api_core/default.nix4
-rw-r--r--pkgs/development/python-modules/gpy/default.nix4
-rw-r--r--pkgs/development/python-modules/grpcio/default.nix4
-rw-r--r--pkgs/development/python-modules/gssapi/default.nix4
-rw-r--r--pkgs/development/python-modules/html5lib/default.nix42
-rw-r--r--pkgs/development/python-modules/htmlmin/default.nix4
-rw-r--r--pkgs/development/python-modules/httpbin/default.nix4
-rw-r--r--pkgs/development/python-modules/idna/default.nix20
-rw-r--r--pkgs/development/python-modules/ipykernel/default.nix4
-rw-r--r--pkgs/development/python-modules/ipywidgets/default.nix4
-rw-r--r--pkgs/development/python-modules/iso8601/default.nix27
-rw-r--r--pkgs/development/python-modules/jdcal/default.nix28
-rw-r--r--pkgs/development/python-modules/jedi/default.nix4
-rw-r--r--pkgs/development/python-modules/jellyfish/default.nix24
-rw-r--r--pkgs/development/python-modules/jinja2/default.nix20
-rw-r--r--pkgs/development/python-modules/jsbeautifier/default.nix4
-rw-r--r--pkgs/development/python-modules/jsondiff/default.nix24
-rw-r--r--pkgs/development/python-modules/jsonpatch/default.nix4
-rw-r--r--pkgs/development/python-modules/jsonpickle/default.nix23
-rw-r--r--pkgs/development/python-modules/jupyter_client/default.nix18
-rw-r--r--pkgs/development/python-modules/jupyter_client/wheel_workaround.patch13
-rw-r--r--pkgs/development/python-modules/jupyter_core/default.nix6
-rw-r--r--pkgs/development/python-modules/jupyter_core/tests_respect_pythonpath.patch44
-rw-r--r--pkgs/development/python-modules/keras/default.nix4
-rw-r--r--pkgs/development/python-modules/keyring/default.nix4
-rw-r--r--pkgs/development/python-modules/ldap/default.nix8
-rw-r--r--pkgs/development/python-modules/ldap3/default.nix5
-rw-r--r--pkgs/development/python-modules/libusb1/default.nix2
-rw-r--r--pkgs/development/python-modules/line_profiler/default.nix4
-rw-r--r--pkgs/development/python-modules/llfuse/default.nix4
-rw-r--r--pkgs/development/python-modules/llvmlite/default.nix13
-rw-r--r--pkgs/development/python-modules/lxml/default.nix27
-rw-r--r--pkgs/development/python-modules/marionette-harness/default.nix4
-rw-r--r--pkgs/development/python-modules/markdown/default.nix28
-rw-r--r--pkgs/development/python-modules/marshmallow/default.nix4
-rw-r--r--pkgs/development/python-modules/matplotlib/default.nix4
-rw-r--r--pkgs/development/python-modules/mistune/default.nix4
-rw-r--r--pkgs/development/python-modules/moto/default.nix20
-rw-r--r--pkgs/development/python-modules/mygpoclient/default.nix5
-rw-r--r--pkgs/development/python-modules/nbxmpp/default.nix4
-rw-r--r--pkgs/development/python-modules/networkx/default.nix34
-rw-r--r--pkgs/development/python-modules/nilearn/default.nix4
-rw-r--r--pkgs/development/python-modules/notebook/default.nix4
-rw-r--r--pkgs/development/python-modules/numba/default.nix13
-rw-r--r--pkgs/development/python-modules/odfpy/default.nix11
-rw-r--r--pkgs/development/python-modules/pandas/default.nix4
-rw-r--r--pkgs/development/python-modules/parse-type/default.nix7
-rw-r--r--pkgs/development/python-modules/partd/default.nix35
-rw-r--r--pkgs/development/python-modules/path.py/default.nix4
-rw-r--r--pkgs/development/python-modules/pathlib2/default.nix7
-rw-r--r--pkgs/development/python-modules/pexpect/default.nix4
-rw-r--r--pkgs/development/python-modules/phonenumbers/default.nix4
-rw-r--r--pkgs/development/python-modules/pip-tools/default.nix6
-rw-r--r--pkgs/development/python-modules/plone-testing/default.nix27
-rw-r--r--pkgs/development/python-modules/plotly/default.nix4
-rw-r--r--pkgs/development/python-modules/pluggy/default.nix29
-rw-r--r--pkgs/development/python-modules/plumbum/default.nix4
-rw-r--r--pkgs/development/python-modules/psutil/default.nix4
-rw-r--r--pkgs/development/python-modules/py/default.nix4
-rw-r--r--pkgs/development/python-modules/pyaml/default.nix27
-rw-r--r--pkgs/development/python-modules/pyasn1-modules/default.nix4
-rw-r--r--pkgs/development/python-modules/pyasn1/default.nix4
-rw-r--r--pkgs/development/python-modules/pyblake2/default.nix4
-rw-r--r--pkgs/development/python-modules/pycangjie/default.nix13
-rw-r--r--pkgs/development/python-modules/pychromecast/default.nix4
-rw-r--r--pkgs/development/python-modules/pycollada/default.nix7
-rw-r--r--pkgs/development/python-modules/pydot/default.nix4
-rw-r--r--pkgs/development/python-modules/pygit2/default.nix4
-rw-r--r--pkgs/development/python-modules/pyglet/default.nix11
-rw-r--r--pkgs/development/python-modules/pylast/default.nix4
-rw-r--r--pkgs/development/python-modules/pylint/default.nix4
-rw-r--r--pkgs/development/python-modules/pymongo/default.nix4
-rw-r--r--pkgs/development/python-modules/pyobjc/default.nix4
-rw-r--r--pkgs/development/python-modules/pyopencl/default.nix13
-rw-r--r--pkgs/development/python-modules/pysc2/default.nix2
-rw-r--r--pkgs/development/python-modules/pysoundfile/default.nix4
-rw-r--r--pkgs/development/python-modules/pytest-localserver/default.nix4
-rw-r--r--pkgs/development/python-modules/pytest-xdist/default.nix4
-rw-r--r--pkgs/development/python-modules/pytest/3_2.nix27
-rw-r--r--pkgs/development/python-modules/pytest/default.nix12
-rw-r--r--pkgs/development/python-modules/python-fuse/default.nix28
-rw-r--r--pkgs/development/python-modules/pytoml/default.nix16
-rw-r--r--pkgs/development/python-modules/pytools/default.nix39
-rw-r--r--pkgs/development/python-modules/pywbem/default.nix2
-rw-r--r--pkgs/development/python-modules/pywinrm/default.nix4
-rw-r--r--pkgs/development/python-modules/regex/default.nix23
-rw-r--r--pkgs/development/python-modules/relatorio/default.nix4
-rw-r--r--pkgs/development/python-modules/restview/default.nix4
-rw-r--r--pkgs/development/python-modules/robomachine/default.nix4
-rw-r--r--pkgs/development/python-modules/ropper/default.nix12
-rw-r--r--pkgs/development/python-modules/scrapy/default.nix4
-rw-r--r--pkgs/development/python-modules/seaborn/default.nix4
-rw-r--r--pkgs/development/python-modules/serpy/default.nix4
-rw-r--r--pkgs/development/python-modules/setuptools/default.nix4
-rw-r--r--pkgs/development/python-modules/shapely/default.nix4
-rw-r--r--pkgs/development/python-modules/simplejson/default.nix4
-rw-r--r--pkgs/development/python-modules/six/default.nix3
-rw-r--r--pkgs/development/python-modules/smart_open/default.nix4
-rw-r--r--pkgs/development/python-modules/spacy/default.nix17
-rw-r--r--pkgs/development/python-modules/splinter/default.nix30
-rw-r--r--pkgs/development/python-modules/sqlalchemy/default.nix4
-rw-r--r--pkgs/development/python-modules/sqlmap/default.nix4
-rw-r--r--pkgs/development/python-modules/stevedore/default.nix4
-rw-r--r--pkgs/development/python-modules/stripe/default.nix4
-rw-r--r--pkgs/development/python-modules/structlog/default.nix32
-rw-r--r--pkgs/development/python-modules/supervise_api/default.nix4
-rw-r--r--pkgs/development/python-modules/sybil/default.nix4
-rw-r--r--pkgs/development/python-modules/tabulate/default.nix4
-rw-r--r--pkgs/development/python-modules/testtools/default.nix12
-rw-r--r--pkgs/development/python-modules/textacy/default.nix4
-rw-r--r--pkgs/development/python-modules/texttable/default.nix20
-rw-r--r--pkgs/development/python-modules/thespian/default.nix4
-rw-r--r--pkgs/development/python-modules/toolz/default.nix4
-rw-r--r--pkgs/development/python-modules/tox/default.nix24
-rw-r--r--pkgs/development/python-modules/tqdm/default.nix4
-rw-r--r--pkgs/development/python-modules/tzlocal/default.nix4
-rw-r--r--pkgs/development/python-modules/vowpalwabbit/default.nix4
-rw-r--r--pkgs/development/python-modules/websockets/default.nix4
-rw-r--r--pkgs/development/python-modules/werkzeug/default.nix14
-rw-r--r--pkgs/development/python-modules/widgetsnbextension/default.nix4
-rw-r--r--pkgs/development/python-modules/ws4py/default.nix4
-rw-r--r--pkgs/development/python-modules/xarray/default.nix19
-rw-r--r--pkgs/development/python-modules/yapf/default.nix4
-rw-r--r--pkgs/development/python-modules/yarl/default.nix19
-rw-r--r--pkgs/development/python-modules/zope_copy/default.nix27
-rw-r--r--pkgs/development/r-modules/default.nix6
-rw-r--r--pkgs/development/ruby-modules/gem-config/default.nix6
-rwxr-xr-xpkgs/development/tools/build-managers/cmake/setup-hook.sh6
-rw-r--r--pkgs/development/tools/database/shmig/default.nix4
-rw-r--r--pkgs/development/tools/misc/automake/setup-hook.sh2
-rw-r--r--pkgs/development/tools/misc/binutils/always-search-rpath.patch14
-rw-r--r--pkgs/development/tools/misc/binutils/default.nix17
-rw-r--r--pkgs/development/tools/misc/d-feet/default.nix4
-rw-r--r--pkgs/development/tools/misc/pkgconfig/setup-hook.sh6
-rw-r--r--pkgs/development/tools/misc/sysbench/default.nix6
-rw-r--r--pkgs/development/tools/ocaml/findlib/default.nix2
-rw-r--r--pkgs/development/tools/tora/default.nix4
-rw-r--r--pkgs/development/web/nodejs/setup-hook.sh2
-rw-r--r--pkgs/games/zod/default.nix6
-rw-r--r--pkgs/os-specific/darwin/apple-sdk/framework-setup-hook.sh2
-rw-r--r--pkgs/os-specific/darwin/apple-sdk/security-setup-hook.sh2
-rw-r--r--pkgs/os-specific/darwin/apple-source-releases/libresolv/default.nix2
-rw-r--r--pkgs/os-specific/linux/busybox/default.nix2
-rw-r--r--pkgs/os-specific/linux/kernel-headers/4.4.nix3
-rw-r--r--pkgs/servers/clickhouse/default.nix9
-rw-r--r--pkgs/servers/computing/slurm/default.nix2
-rw-r--r--pkgs/servers/dns/powerdns/default.nix4
-rw-r--r--pkgs/servers/freeradius/default.nix6
-rw-r--r--pkgs/servers/games/ghost-one/default.nix55
-rw-r--r--pkgs/servers/http/lighttpd/default.nix2
-rw-r--r--pkgs/servers/mail/dovecot/default.nix4
-rw-r--r--pkgs/servers/mail/dspam/default.nix6
-rw-r--r--pkgs/servers/mail/opensmtpd/extras.nix10
-rw-r--r--pkgs/servers/mail/postfix/default.nix6
-rw-r--r--pkgs/servers/sql/mariadb/cmake-includedir.patch11
-rw-r--r--pkgs/servers/sql/mariadb/default.nix74
-rw-r--r--pkgs/servers/sql/mysql/5.5.x.nix12
-rw-r--r--pkgs/servers/sql/mysql/5.7.x.nix27
-rw-r--r--pkgs/servers/web-apps/frab/Gemfile.lock2
-rw-r--r--pkgs/servers/web-apps/frab/gemset.nix6
-rw-r--r--pkgs/servers/web-apps/searx/default.nix33
-rw-r--r--pkgs/servers/x11/xorg/builder.sh7
-rw-r--r--pkgs/servers/x11/xorg/default.nix6
-rw-r--r--pkgs/servers/x11/xorg/tarballs-7.7.list2
-rw-r--r--pkgs/shells/bash/4.4.nix4
-rw-r--r--pkgs/stdenv/adapters.nix11
-rw-r--r--pkgs/stdenv/darwin/default.nix20
-rw-r--r--pkgs/stdenv/generic/make-derivation.nix76
-rw-r--r--pkgs/stdenv/generic/setup.sh338
-rw-r--r--pkgs/stdenv/linux/make-bootstrap-tools-cross.nix1
-rw-r--r--pkgs/tools/admin/ansible/2.1.nix9
-rw-r--r--pkgs/tools/admin/ansible/2.2.nix9
-rw-r--r--pkgs/tools/admin/awscli/default.nix5
-rw-r--r--pkgs/tools/backup/bareos/default.nix8
-rw-r--r--pkgs/tools/backup/mydumper/default.nix4
-rw-r--r--pkgs/tools/inputmethods/ibus/default.nix179
-rw-r--r--pkgs/tools/misc/colord-kde/default.nix4
-rw-r--r--pkgs/tools/misc/coreutils/default.nix4
-rw-r--r--pkgs/tools/networking/kea/default.nix4
-rw-r--r--pkgs/tools/networking/mailutils/default.nix21
-rw-r--r--pkgs/tools/networking/mitmproxy/default.nix28
-rw-r--r--pkgs/tools/networking/snabb/default.nix4
-rw-r--r--pkgs/tools/security/gnupg/22.nix4
-rw-r--r--pkgs/tools/security/thc-hydra/default.nix4
-rw-r--r--pkgs/tools/system/collectd/default.nix5
-rw-r--r--pkgs/tools/system/rsyslog/default.nix9
-rw-r--r--pkgs/tools/text/diffutils/default.nix3
-rw-r--r--pkgs/tools/text/gawk/default.nix2
-rw-r--r--pkgs/tools/text/sgml/opensp/setup-hook.sh2
-rw-r--r--pkgs/tools/typesetting/tex/dblatex/default.nix4
-rw-r--r--pkgs/tools/typesetting/tex/tetex/setup-hook.sh2
-rw-r--r--pkgs/tools/typesetting/tex/texlive/setup-hook.sh2
-rw-r--r--pkgs/top-level/aliases.nix1
-rw-r--r--pkgs/top-level/all-packages.nix20
-rw-r--r--pkgs/top-level/lua-packages.nix7
-rw-r--r--pkgs/top-level/python-packages.nix645
-rw-r--r--pkgs/top-level/splice.nix69
401 files changed, 3013 insertions, 2323 deletions
diff --git a/pkgs/applications/audio/amarok/kf5.nix b/pkgs/applications/audio/amarok/kf5.nix
index a96aa3ed65d..a4ac2943bfb 100644
--- a/pkgs/applications/audio/amarok/kf5.nix
+++ b/pkgs/applications/audio/amarok/kf5.nix
@@ -3,7 +3,7 @@
 , qca-qt5, qjson, qtscript, qtwebkit
 , kcmutils, kconfig, kdelibs4support, kdnssd, kinit, knewstuff, knotifyconfig, ktexteditor
 , phonon, plasma-framework, threadweaver
-, curl, ffmpeg, gdk_pixbuf, libaio, libmtp, loudmouth, lzo, lz4, mariadb, pcre, snappy, taglib, taglib_extras
+, curl, ffmpeg, gdk_pixbuf, libaio, libmtp, loudmouth, lzo, lz4, mysql57, pcre, snappy, taglib, taglib_extras
 }:
 
 let
@@ -26,7 +26,8 @@ in mkDerivation {
     qca-qt5 qjson qtscript qtwebkit
     kcmutils kconfig kdelibs4support kdnssd kinit knewstuff knotifyconfig ktexteditor
     phonon plasma-framework threadweaver
-    curl ffmpeg gdk_pixbuf libaio libmtp loudmouth lz4 lzo mariadb pcre snappy taglib taglib_extras
+    curl ffmpeg gdk_pixbuf libaio libmtp loudmouth lz4 lzo mysql57.server mysql57.server.static
+    pcre snappy taglib taglib_extras
   ];
   enableParallelBuilding = true;
 
diff --git a/pkgs/applications/gis/grass/default.nix b/pkgs/applications/gis/grass/default.nix
index 3382bb3e56d..987b544c556 100644
--- a/pkgs/applications/gis/grass/default.nix
+++ b/pkgs/applications/gis/grass/default.nix
@@ -4,15 +4,15 @@
 }:
 
 stdenv.mkDerivation {
-  name = "grass-7.0.2";
+  name = "grass-7.2.2";
   src = fetchurl {
-    url = http://grass.osgeo.org/grass70/source/grass-7.0.2.tar.gz;
-    sha256 = "02qrdgn46gxr60amxwax4b8fkkmhmjxi6qh4yfvpbii6ai6diarf";
+    url = http://grass.osgeo.org/grass72/source/grass-7.2.2.tar.gz;
+    sha256 = "0yzljbrxlqp4wbw08n1dvmm4vmwkg8glf1ff4xyh589r5ryb7gxv";
   };
 
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ flex bison zlib proj gdal libtiff libpng fftw sqlite cairo
-  readline ffmpeg makeWrapper wxGTK30 netcdf geos postgresql mysql.client blas ]
+  readline ffmpeg makeWrapper wxGTK30 netcdf geos postgresql mysql.connector-c blas ]
     ++ (with python2Packages; [ python dateutil wxPython30 numpy ]);
 
   configureFlags = [
@@ -22,9 +22,12 @@ stdenv.mkDerivation {
     "--with-wxwidgets"
     "--with-netcdf"
     "--with-geos"
-    "--with-postgres" "--with-postgres-libs=${postgresql.lib}/lib/"
+    "--with-postgres"
+    "--with-postgres-libs=${postgresql.lib}/lib/"
     # it complains about missing libmysqld but doesn't really seem to need it
-    "--with-mysql" "--with-mysql-includes=${stdenv.lib.getDev mysql.client}/include/mysql"
+    "--with-mysql"
+    "--with-mysql-includes=${mysql.connector-c}/include/mysql"
+    "--with-mysql-libs=${mysql.connector-c}/lib/mysql"
     "--with-blas"
   ];
 
@@ -40,17 +43,20 @@ stdenv.mkDerivation {
       scripts/r.pack/r.pack.py \
       scripts/r.tileset/r.tileset.py \
       scripts/r.unpack/r.unpack.py \
-      scripts/v.krige/v.krige.py \
       scripts/v.rast.stats/v.rast.stats.py \
       scripts/v.to.lines/v.to.lines.py \
       scripts/v.what.strds/v.what.strds.py \
       scripts/v.unpack/v.unpack.py \
       scripts/wxpyimgview/*.py \
       gui/wxpython/animation/g.gui.animation.py \
+      gui/wxpython/datacatalog/g.gui.datacatalog.py \
       gui/wxpython/rlisetup/g.gui.rlisetup.py \
       gui/wxpython/vdigit/g.gui.vdigit.py \
       temporal/t.rast.accumulate/t.rast.accumulate.py \
       temporal/t.rast.accdetect/t.rast.accdetect.py \
+      temporal/t.rast.algebra/t.rast.algebra.py \
+      temporal/t.rast3d.algebra/t.rast3d.algebra.py \
+      temporal/t.vect.algebra/t.vect.algebra.py \
       temporal/t.select/t.select.py
     for d in gui lib scripts temporal tools; do
       patchShebangs $d
@@ -58,7 +64,7 @@ stdenv.mkDerivation {
   '';
 
   postInstall = ''
-    wrapProgram $out/bin/grass70 \
+    wrapProgram $out/bin/grass72 \
     --set PYTHONPATH $PYTHONPATH \
     --set GRASS_PYTHON ${python2Packages.python}/bin/${python2Packages.python.executable} \
     --suffix LD_LIBRARY_PATH ':' '${gdal}/lib'
@@ -72,6 +78,5 @@ stdenv.mkDerivation {
     description = "GIS software suite used for geospatial data management and analysis, image processing, graphics and maps production, spatial modeling, and visualization";
     license = stdenv.lib.licenses.gpl2Plus;
     platforms = stdenv.lib.platforms.all;
-    broken = true;
   };
 }
diff --git a/pkgs/applications/graphics/digikam/default.nix b/pkgs/applications/graphics/digikam/default.nix
index c955a61d369..9a26dcdaa6a 100644
--- a/pkgs/applications/graphics/digikam/default.nix
+++ b/pkgs/applications/graphics/digikam/default.nix
@@ -75,7 +75,6 @@ mkDerivation rec {
     libqtav
     libusb1
     mesa
-    mysql
     opencv3
     pcre
 
diff --git a/pkgs/applications/kde/kmime.nix b/pkgs/applications/kde/kmime.nix
index b18a3f7fdc1..4523a69fc1b 100644
--- a/pkgs/applications/kde/kmime.nix
+++ b/pkgs/applications/kde/kmime.nix
@@ -10,7 +10,7 @@ mkDerivation {
     license = [ lib.licenses.lgpl21 ];
     maintainers = kdepimTeam;
   };
-  nativeBuildInputs = [ extra-cmake-modules ki18n ];
-  buildInputs = [ kcodecs qtbase ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ kcodecs ki18n qtbase ];
   outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/applications/kde/libkcddb.nix b/pkgs/applications/kde/libkcddb.nix
index edd9732d051..3fd48605654 100644
--- a/pkgs/applications/kde/libkcddb.nix
+++ b/pkgs/applications/kde/libkcddb.nix
@@ -8,8 +8,8 @@ mkDerivation {
     license = with licenses; [ gpl2 lgpl21 bsd3 ];
     maintainers = with maintainers; [ peterhoeg ];
   };
-  nativeBuildInputs = [ extra-cmake-modules ];
-  buildInputs = [ qtbase kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ qtbase ];
   propagatedBuildInputs = [
     kcodecs ki18n kio kwidgetsaddons
     libmusicbrainz5
diff --git a/pkgs/applications/misc/deepin-terminal/default.nix b/pkgs/applications/misc/deepin-terminal/default.nix
index e08a2827b83..12ceb0958f0 100644
--- a/pkgs/applications/misc/deepin-terminal/default.nix
+++ b/pkgs/applications/misc/deepin-terminal/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchFromGitHub, pkgconfig, gtk3, vala, cmake, vte, libgee, wnck, zssh, gettext, librsvg, libsecret, json_glib }:
+{ stdenv, fetchurl, fetchFromGitHub, pkgconfig, gtk3, vala, cmake, vte, libgee, wnck, zssh, gettext, librsvg, libsecret, json_glib, gobjectIntrospection }:
 
 stdenv.mkDerivation rec {
   name = "deepin-terminal-${version}";
@@ -25,7 +25,11 @@ stdenv.mkDerivation rec {
     substituteInPlace ssh_login.sh --replace /usr/lib/deepin-terminal/zssh "${zssh}/bin/zssh"
   '';
 
-  nativeBuildInputs = [ pkgconfig vala cmake gettext ];
+  nativeBuildInputs = [
+    pkgconfig vala cmake gettext
+    # For setup hook
+    gobjectIntrospection
+  ];
   buildInputs = [ gtk3 vte libgee wnck librsvg libsecret json_glib ];
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/misc/font-manager/default.nix b/pkgs/applications/misc/font-manager/default.nix
index 6d67d3a340f..8c63c856578 100644
--- a/pkgs/applications/misc/font-manager/default.nix
+++ b/pkgs/applications/misc/font-manager/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchFromGitHub, makeWrapper, automake, autoconf, libtool,
+{ stdenv, fetchFromGitHub, automake, autoconf, libtool,
   pkgconfig, file, intltool, libxml2, json_glib , sqlite, itstool,
-  librsvg, vala_0_34, gnome3, wrapGAppsHook
+  librsvg, vala_0_34, gnome3, wrapGAppsHook, gobjectIntrospection
 }:
 
 stdenv.mkDerivation rec {
@@ -15,7 +15,6 @@ stdenv.mkDerivation rec {
     };
 
   nativeBuildInputs = [
-    makeWrapper
     pkgconfig
     automake autoconf libtool
     file
@@ -23,6 +22,8 @@ stdenv.mkDerivation rec {
     vala_0_34
     gnome3.yelp_tools
     wrapGAppsHook
+    # For setup hook
+    gobjectIntrospection
   ];
 
   buildInputs = [
diff --git a/pkgs/applications/misc/haxor-news/default.nix b/pkgs/applications/misc/haxor-news/default.nix
index dc771fc2d5e..c82e5026ff1 100644
--- a/pkgs/applications/misc/haxor-news/default.nix
+++ b/pkgs/applications/misc/haxor-news/default.nix
@@ -1,15 +1,17 @@
-{ stdenv, fetchurl, pythonPackages }:
+{ stdenv, fetchurl, python }:
 
-pythonPackages.buildPythonApplication rec {
-  version = "0.4.2";
-  name = "haxor-news-${version}";
+with python.pkgs;
 
-  src = fetchurl {
-    url = "https://github.com/donnemartin/haxor-news/archive/${version}.tar.gz";
-    sha256 = "0543k5ys044f2a1q8k36djnnq2h2dffnwbkva9snjjy30nlwwdgs";
+buildPythonApplication rec {
+  pname = "haxor-news";
+  version = "0.4.3";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "5b9af8338a0f8b95a8133b66ef106553823813ac171c0aefa3f3f2dbeb4d7f88";
   };
 
-  propagatedBuildInputs = with pythonPackages; [
+  propagatedBuildInputs = [
     click
     colorama
     requests
@@ -18,6 +20,12 @@ pythonPackages.buildPythonApplication rec {
     six
   ];
 
+  checkInputs = [ mock ];
+
+  checkPhase = ''
+    ${python.interpreter} -m unittest discover -s tests -v
+  '';
+
   meta = with stdenv.lib; {
     homepage = https://github.com/donnemartin/haxor-news;
     description = "Browse Hacker News like a haxor";
diff --git a/pkgs/applications/misc/kupfer/default.nix b/pkgs/applications/misc/kupfer/default.nix
index f3bb825cbf7..e2290105c92 100644
--- a/pkgs/applications/misc/kupfer/default.nix
+++ b/pkgs/applications/misc/kupfer/default.nix
@@ -3,6 +3,7 @@
 , fetchurl
 , intltool
 , python3Packages
+, gobjectIntrospection
 , gtk3
 , dbus
 , libwnck3
@@ -22,7 +23,11 @@ buildPythonApplication rec {
     sha256 = "0c9xjx13r8ckfr4az116bhxsd3pk78v04c3lz6lqhraak0rp4d92";
   };
 
-  nativeBuildInputs = [ wrapGAppsHook intltool ];
+  nativeBuildInputs = [
+    wrapGAppsHook intltool
+    # For setup hook
+    gobjectIntrospection
+  ];
   buildInputs = [ hicolor_icon_theme docutils libwnck3 keybinder3 ];
   propagatedBuildInputs = [ pygobject3 gtk3 pyxdg dbus-python pycairo ];
 
diff --git a/pkgs/applications/misc/pdfpc/default.nix b/pkgs/applications/misc/pdfpc/default.nix
index 8e0fc613721..9fc14d0cae7 100644
--- a/pkgs/applications/misc/pdfpc/default.nix
+++ b/pkgs/applications/misc/pdfpc/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchFromGitHub, cmake, makeWrapper, pkgconfig, vala, gtk3, libgee
-, poppler, libpthreadstubs, gstreamer, gst-plugins-base, librsvg, pcre }:
+, poppler, libpthreadstubs, gstreamer, gst-plugins-base, librsvg, pcre, gobjectIntrospection }:
 
 stdenv.mkDerivation rec {
   name = "${product}-${version}";
@@ -13,7 +13,11 @@ stdenv.mkDerivation rec {
     sha256 = "00qfmmk8h762p53z46g976z7j4fbxyi16w5axzsv1ymvdq95ds8c";
   };
 
-  nativeBuildInputs = [ cmake pkgconfig vala ];
+  nativeBuildInputs = [
+    cmake pkgconfig vala
+    # For setup hook
+    gobjectIntrospection
+  ];
   buildInputs = [ gstreamer gst-plugins-base gtk3 libgee poppler
     libpthreadstubs makeWrapper librsvg pcre ];
 
diff --git a/pkgs/applications/misc/synapse/default.nix b/pkgs/applications/misc/synapse/default.nix
index 04f38968142..13f3fa98d56 100644
--- a/pkgs/applications/misc/synapse/default.nix
+++ b/pkgs/applications/misc/synapse/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, intltool, pkgconfig, glib, libnotify, gtk3, libgee
-, keybinder3, json_glib, zeitgeist, vala_0_34, hicolor_icon_theme
+, keybinder3, json_glib, zeitgeist, vala_0_34, hicolor_icon_theme, gobjectIntrospection
 }:
 
 let
@@ -12,7 +12,11 @@ in stdenv.mkDerivation rec {
     sha256 = "04cnsmwf9xa52dh7rpb4ia715c0ls8jg1p7llc9yf3lbg1m0bvzv";
   };
 
-  nativeBuildInputs = [ pkgconfig intltool vala_0_34 ];
+  nativeBuildInputs = [
+    pkgconfig intltool vala_0_34
+    # For setup hook
+    gobjectIntrospection
+  ];
   buildInputs = [
     glib libnotify gtk3 libgee keybinder3 json_glib zeitgeist
     hicolor_icon_theme
diff --git a/pkgs/applications/misc/valauncher/default.nix b/pkgs/applications/misc/valauncher/default.nix
index f780e5469d0..38c4055a10b 100644
--- a/pkgs/applications/misc/valauncher/default.nix
+++ b/pkgs/applications/misc/valauncher/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, gtk3, vala, pkgconfig, gnome3 }:
+{ stdenv, fetchFromGitHub, cmake, gtk3, vala, pkgconfig, gnome3, gobjectIntrospection }:
 
 stdenv.mkDerivation rec {
   version = "1.3.1";
@@ -11,8 +11,12 @@ stdenv.mkDerivation rec {
     sha256 = "18969v870737jg1q0l3d05pb9mxsrcpdi0mnyz94rwkspszvxxqi";
   };
 
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ cmake gtk3 vala gnome3.libgee ];
+  nativeBuildInputs = [
+    cmake vala pkgconfig
+    # For setup hook
+    gobjectIntrospection
+  ];
+  buildInputs = [ gtk3 gnome3.libgee ];
 
   meta = with stdenv.lib; {
       description = "A fast dmenu-like gtk3 application launcher";
diff --git a/pkgs/applications/networking/browsers/lynx/default.nix b/pkgs/applications/networking/browsers/lynx/default.nix
index 0f6c4ed36d4..4e68d21be0c 100644
--- a/pkgs/applications/networking/browsers/lynx/default.nix
+++ b/pkgs/applications/networking/browsers/lynx/default.nix
@@ -22,9 +22,9 @@ stdenv.mkDerivation rec {
 
   configureFlags = [ "--enable-widec" ] ++ stdenv.lib.optional sslSupport "--with-ssl";
 
-  nativeBuildInputs = stdenv.lib.optional sslSupport pkgconfig
-    ++ stdenv.lib.optional (hostPlatform != buildPlatform) buildPackages.stdenv.cc
-    ++ [ nukeReferences ];
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ nukeReferences ]
+    ++ stdenv.lib.optional sslSupport pkgconfig;
 
   buildInputs = [ ncurses gzip ] ++ stdenv.lib.optional sslSupport openssl.dev;
 
diff --git a/pkgs/applications/office/kexi/default.nix b/pkgs/applications/office/kexi/default.nix
index 66aee6bd962..8463703c017 100644
--- a/pkgs/applications/office/kexi/default.nix
+++ b/pkgs/applications/office/kexi/default.nix
@@ -4,7 +4,7 @@
   breeze-icons, karchive, kcodecs, kcompletion, kconfig, kconfigwidgets, kcoreaddons,
   kcrash, kguiaddons, ki18n, kiconthemes, kitemviews, kio, ktexteditor, ktextwidgets,
   kwidgetsaddons, kxmlgui,
-  kdb, kproperty, kreport, lcms2, libmysql, marble, postgresql
+  kdb, kproperty, kreport, lcms2, mysql, marble, postgresql
 }:
 
 mkDerivation rec {
@@ -24,7 +24,7 @@ mkDerivation rec {
     breeze-icons karchive kcodecs kcompletion kconfig kconfigwidgets kcoreaddons
     kcrash kguiaddons ki18n kiconthemes kitemviews kio ktexteditor ktextwidgets
     kwidgetsaddons kxmlgui
-    kdb kproperty kreport lcms2 libmysql marble postgresql
+    kdb kproperty kreport lcms2 mysql.connector-c marble postgresql
   ];
 
   propagatedUserEnvPkgs = [ kproperty ];
diff --git a/pkgs/applications/office/skrooge/default.nix b/pkgs/applications/office/skrooge/default.nix
index f88cc147098..1aaf05a123e 100644
--- a/pkgs/applications/office/skrooge/default.nix
+++ b/pkgs/applications/office/skrooge/default.nix
@@ -14,9 +14,12 @@ mkDerivation rec {
     sha256 = "1dbvdrkdpgv39v8h7k3mri0nzlslfyd5kk410czj0jdn4qq400md";
   };
 
-  nativeBuildInputs = [ cmake extra-cmake-modules shared_mime_info ];
+  nativeBuildInputs = [
+    cmake extra-cmake-modules kdoctools shared_mime_info
+  ];
 
-  buildInputs = [ qtwebkit qtscript grantlee kxmlgui kwallet kparts kdoctools
+  buildInputs = [
+    qtwebkit qtscript grantlee kxmlgui kwallet kparts
     kjobwidgets kdesignerplugin kiconthemes knewstuff sqlcipher qca-qt5
     kactivities karchive kguiaddons knotifyconfig krunner kwindowsystem libofx
   ];
diff --git a/pkgs/applications/office/watson/default.nix b/pkgs/applications/office/watson/default.nix
index a1fcfd5de70..e0f0c58b450 100644
--- a/pkgs/applications/office/watson/default.nix
+++ b/pkgs/applications/office/watson/default.nix
@@ -1,13 +1,14 @@
-{ stdenv, pythonPackages }:
+{ stdenv, pythonPackages, fetchpatch }:
 
-pythonPackages.buildPythonApplication rec {
+with pythonPackages;
+
+buildPythonApplication rec {
   pname = "td-watson";
-  name = "${pname}-${version}";
-  version = "1.4.0";
+  version = "1.5.2";
 
-  src = pythonPackages.fetchPypi {
+  src = fetchPypi {
     inherit version pname;
-    sha256 = "1py0g4990jmvq0dn7jasda7f10kzr41bix46hnbyc1rshjzc17hq";
+    sha256 = "6e03d44a9278807fe5245e9ed0943f13ffb88e11249a02655c84cb86260b27c8";
   };
 
   # uses tox, test invocation fails
@@ -15,8 +16,16 @@ pythonPackages.buildPythonApplication rec {
   checkPhase = ''
     py.test -vs tests
  '';
-  checkInputs = with pythonPackages; [ py pytest pytest-datafiles mock pytest-mock pytestrunner ];
-  propagatedBuildInputs = with pythonPackages; [ requests click arrow ];
+
+  patches = [
+    (fetchpatch {
+      url = https://github.com/TailorDev/Watson/commit/f5760c71cbc22de4e12ede8f6f7257515a9064d3.patch;
+      sha256 = "0s9h26915ilpbd0qhmvk77r3gmrsdrl5l7dqxj0l5q66fp0z6b0g";
+    })
+  ];
+
+  checkInputs = [ py pytest pytest-datafiles mock pytest-mock pytestrunner ];
+  propagatedBuildInputs = [ requests click arrow ];
 
   meta = with stdenv.lib; {
     homepage = https://tailordev.github.io/Watson/;
@@ -24,4 +33,4 @@ pythonPackages.buildPythonApplication rec {
     license = licenses.mit;
     maintainers = with maintainers; [ mguentner ] ;
   };
-}
\ No newline at end of file
+}
diff --git a/pkgs/applications/science/logic/coq/8.4.nix b/pkgs/applications/science/logic/coq/8.4.nix
index 1f7ef571eaf..64b0f85aed2 100644
--- a/pkgs/applications/science/logic/coq/8.4.nix
+++ b/pkgs/applications/science/logic/coq/8.4.nix
@@ -60,7 +60,7 @@ stdenv.mkDerivation {
       fi
     }
 
-    envHooks=(''${envHooks[@]} addCoqPath)
+    addEnvHooks "$targetOffset" addCoqPath
   '';
 
   passthru = {
diff --git a/pkgs/applications/science/logic/coq/default.nix b/pkgs/applications/science/logic/coq/default.nix
index 4c67904b2b1..9ed535cfe63 100644
--- a/pkgs/applications/science/logic/coq/default.nix
+++ b/pkgs/applications/science/logic/coq/default.nix
@@ -110,7 +110,7 @@ self = stdenv.mkDerivation {
       fi
     }
 
-    envHooks=(''${envHooks[@]} addCoqPath)
+    addEnvHooks "$targetOffset" addCoqPath
   '';
 
   preConfigure = ''
diff --git a/pkgs/applications/science/math/R/setup-hook.sh b/pkgs/applications/science/math/R/setup-hook.sh
index 09a775db9bf..6951e2a4b61 100644
--- a/pkgs/applications/science/math/R/setup-hook.sh
+++ b/pkgs/applications/science/math/R/setup-hook.sh
@@ -1,5 +1,7 @@
 addRLibPath () {
-    addToSearchPath R_LIBS_SITE $1/library
+    if [[ -d "$1/library" ]]; then
+        addToSearchPath R_LIBS_SITE "$1/library"
+    fi
 }
 
-envHooks+=(addRLibPath)
+addEnvHooks "$targetOffset" addRLibPath
diff --git a/pkgs/applications/science/math/glsurf/default.nix b/pkgs/applications/science/math/glsurf/default.nix
index 3e4c8c70286..67dcfd8dc1d 100644
--- a/pkgs/applications/science/math/glsurf/default.nix
+++ b/pkgs/applications/science/math/glsurf/default.nix
@@ -10,7 +10,7 @@ stdenv.mkDerivation {
     sha256 = "0w8xxfnw2snflz8wdr2ca9f5g91w5vbyp1hwlx1v7vg83d4bwqs7";
   };
 
-  buildInputs = [ freeglut mesa mysql.lib mpfr gmp
+  buildInputs = [ freeglut mesa mysql.connector-c mpfr gmp
     libtiff libjpeg libpng giflib ]
   ++ (with ocamlPackages; [
     ocaml findlib ocaml_mysql lablgl camlimages_4_0 mlgmpidl
diff --git a/pkgs/applications/video/kodi/default.nix b/pkgs/applications/video/kodi/default.nix
index 125a6d492a3..28577a429bd 100644
--- a/pkgs/applications/video/kodi/default.nix
+++ b/pkgs/applications/video/kodi/default.nix
@@ -130,7 +130,7 @@ in stdenv.mkDerivation rec {
       libmpeg2 libsamplerate libmad
       libogg libvorbis flac libxslt systemd
       lzo libcdio libmodplug libass libbluray
-      sqlite mysql.lib avahi lame
+      sqlite mysql.connector-c avahi lame
       curl bzip2 zip unzip glxinfo xdpyinfo
       libcec libcec_platform dcadec libuuid
       libgcrypt libgpgerror libunistring
diff --git a/pkgs/applications/video/mplayer/default.nix b/pkgs/applications/video/mplayer/default.nix
index 24c5b4335c4..fe6090c3230 100644
--- a/pkgs/applications/video/mplayer/default.nix
+++ b/pkgs/applications/video/mplayer/default.nix
@@ -102,7 +102,8 @@ stdenv.mkDerivation rec {
     rm -rf ffmpeg
   '';
 
-  nativeBuildInputs = [ buildPackages.stdenv.cc pkgconfig yasm ];
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ pkgconfig yasm ];
   buildInputs = with stdenv.lib;
     [ freetype ffmpeg ]
     ++ optional aalibSupport aalib
diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix
index 0dcae204824..bb0e6b82aa5 100644
--- a/pkgs/build-support/bintools-wrapper/default.nix
+++ b/pkgs/build-support/bintools-wrapper/default.nix
@@ -164,7 +164,21 @@ stdenv.mkDerivation {
       set +u
     '';
 
-  propagatedBuildInputs = extraPackages;
+  emulation = let
+    fmt =
+      /**/ if targetPlatform.isDarwin  then "mach-o"
+      else if targetPlatform.isWindows then "pe"
+      else "elf" + toString targetPlatform.parsed.cpu.bits;
+    endianPrefix = if targetPlatform.isBigEndian then "big" else "little";
+    arch =
+      /**/ if targetPlatform.isAarch64 then endianPrefix + "aarch64"
+      else if targetPlatform.isArm     then endianPrefix + "arm"
+      else if targetPlatform.isx86_64  then "x86-64"
+      else if targetPlatform.isi686    then "i386"
+      else throw "unknown emulation for platform: " + targetPlatform.config;
+    in targetPlatform.platform.bfdEmulation or (fmt + "-" + arch);
+
+  depsTargetTargetPropagated = extraPackages;
 
   setupHook = ./setup-hook.sh;
 
diff --git a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh
index 136621d27af..991ed0fe263 100644
--- a/pkgs/build-support/bintools-wrapper/ld-wrapper.sh
+++ b/pkgs/build-support/bintools-wrapper/ld-wrapper.sh
@@ -67,6 +67,11 @@ fi
 
 extraAfter+=($NIX_@infixSalt@_LDFLAGS_AFTER)
 
+# Specify the target emulation if nothing is passed in ("-m" overrides this
+# environment variable). Ensures we never blindly fallback on targeting the host
+# platform.
+: ${LDEMULATION:=@emulation@}
+
 # Three tasks:
 #
 #   1. Find all -L... switches for rpath
diff --git a/pkgs/build-support/bintools-wrapper/setup-hook.sh b/pkgs/build-support/bintools-wrapper/setup-hook.sh
index 43f79ec5920..48a00b0b9b0 100644
--- a/pkgs/build-support/bintools-wrapper/setup-hook.sh
+++ b/pkgs/build-support/bintools-wrapper/setup-hook.sh
@@ -2,12 +2,20 @@
 #
 # See comments in cc-wrapper's setup hook. This works exactly the same way.
 
+set -u
+
+# Skip setup hook if we're neither a build-time dep, nor, temporarily, doing a
+# native compile.
+#
+# TODO(@Ericson2314): No native exception
+[[ -z ${crossConfig-} ]] || (( "$hostOffset" < 0 )) || return 0
+
 bintoolsWrapper_addLDVars () {
-    case $depOffset in
+    case $depHostOffset in
         -1) local role='BUILD_' ;;
         0)  local role='' ;;
         1)  local role='TARGET_' ;;
-        *)  echo "bintools-wrapper: Error: Cannot be used with $depOffset-offset deps, " >2;
+        *)  echo "bintools-wrapper: Error: Cannot be used with $depHostOffset-offset deps" >2;
             return 1 ;;
     esac
 
@@ -20,17 +28,29 @@ bintoolsWrapper_addLDVars () {
     fi
 }
 
-if [ -n "${crossConfig:-}" ]; then
-    export NIX_BINTOOLS_WRAPPER_@infixSalt@_TARGET_BUILD=1
-    role_pre='BUILD_'
-    role_post='_FOR_BUILD'
-else
-    export NIX_BINTOOLS_WRAPPER_@infixSalt@_TARGET_HOST=1
-    role_pre=""
-    role_post=''
-fi
+case $targetOffset in
+    -1)
+        export NIX_BINTOOLS_WRAPPER_@infixSalt@_TARGET_BUILD=1
+        role_pre='BUILD_'
+        role_post='_FOR_BUILD'
+        ;;
+    0)
+        export NIX_BINTOOLS_WRAPPER_@infixSalt@_TARGET_HOST=1
+        role_pre=''
+        role_post=''
+        ;;
+    1)
+        export NIX_BINTOOLS_WRAPPER_@infixSalt@_TARGET_TARGET=1
+        role_pre='TARGET_'
+        role_post='_FOR_TARGET'
+        ;;
+    *)
+        echo "cc-wrapper: used as improper sort of dependency" >2;
+        return 1
+        ;;
+esac
 
-envHooks+=(bintoolsWrapper_addLDVars)
+addEnvHooks "$targetOffset" bintoolsWrapper_addLDVars
 
 # shellcheck disable=SC2157
 if [ -n "@bintools_bin@" ]; then
@@ -65,3 +85,4 @@ done
 
 # No local scope in sourced file
 unset -v role_pre role_post cmd upper_case
+set +u
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix
index 73d6fb3e368..8de2366ff5f 100644
--- a/pkgs/build-support/cc-wrapper/default.nix
+++ b/pkgs/build-support/cc-wrapper/default.nix
@@ -201,7 +201,8 @@ stdenv.mkDerivation {
       ln -s $ccPath/${targetPrefix}ghdl $out/bin/${targetPrefix}ghdl
     '';
 
-  propagatedBuildInputs = [ bintools ] ++ extraPackages;
+  propagatedBuildInputs = [ bintools ];
+  depsTargetTargetPropagated = extraPackages;
 
   setupHook = ./setup-hook.sh;
 
diff --git a/pkgs/build-support/cc-wrapper/setup-hook.sh b/pkgs/build-support/cc-wrapper/setup-hook.sh
index a922193ad2e..29a7306b9b7 100644
--- a/pkgs/build-support/cc-wrapper/setup-hook.sh
+++ b/pkgs/build-support/cc-wrapper/setup-hook.sh
@@ -54,19 +54,26 @@
 # For more details, read the individual files where the mechanisms used to
 # accomplish this will be individually documented.
 
+set -u
+
+# Skip setup hook if we're neither a build-time dep, nor, temporarily, doing a
+# native compile.
+#
+# TODO(@Ericson2314): No native exception
+[[ -z ${crossConfig-} ]] || (( "$hostOffset" < 0 )) || return 0
 
 # It's fine that any other cc-wrapper will redefine this. Bash functions close
 # over no state, and there's no @-substitutions within, so any redefined
 # function is guaranteed to be exactly the same.
 ccWrapper_addCVars () {
-    # The `depOffset` describes how the platforms of the dependencies are slid
-    # relative to the depending package. It is brought into scope of the
-    # environment hook defined as the role of the dependency being applied.
-    case $depOffset in
+    # The `depHostOffset` describes how the host platform of the dependencies
+    # are slid relative to the depending package. It is brought into scope of
+    # the environment hook defined as the role of the dependency being applied.
+    case $depHostOffset in
         -1) local role='BUILD_' ;;
         0)  local role='' ;;
         1)  local role='TARGET_' ;;
-        *)  echo "cc-wrapper: Error: Cannot be used with $depOffset-offset deps, " >2;
+        *)  echo "cc-wrapper: Error: Cannot be used with $depHostOffset-offset deps" >2;
             return 1 ;;
     esac
 
@@ -87,20 +94,31 @@ ccWrapper_addCVars () {
 #
 # We also need to worry about what role is being added on *this* invocation of
 # setup-hook, which `role` tracks.
-if [ -n "${crossConfig:-}" ]; then
-    export NIX_CC_WRAPPER_@infixSalt@_TARGET_BUILD=1
-    role_pre='BUILD_'
-    role_post='_FOR_BUILD'
-else
-    export NIX_CC_WRAPPER_@infixSalt@_TARGET_HOST=1
-    role_pre=''
-    role_post=''
-fi
+case $targetOffset in
+    -1)
+        export NIX_CC_WRAPPER_@infixSalt@_TARGET_BUILD=1
+        role_pre='BUILD_'
+        role_post='_FOR_BUILD'
+        ;;
+    0)
+        export NIX_CC_WRAPPER_@infixSalt@_TARGET_HOST=1
+        role_pre=''
+        role_post=''
+        ;;
+    1)
+        export NIX_CC_WRAPPER_@infixSalt@_TARGET_TARGET=1
+        role_pre='TARGET_'
+        role_post='_FOR_TARGET'
+        ;;
+    *)
+        echo "cc-wrapper: used as improper sort of dependency" >2;
+        return 1
+        ;;
+esac
 
-# Eventually the exact sort of env-hook we create will depend on the role. This
-# is because based on what relative platform we are targeting, we use different
-# dependencies.
-envHooks+=(ccWrapper_addCVars)
+# We use the `targetOffset` to choose the right env hook to accumulate the right
+# sort of deps (those with that offset).
+addEnvHooks "$targetOffset" ccWrapper_addCVars
 
 # Note 1: these come *after* $out in the PATH (see setup.sh).
 # Note 2: phase separation makes this look useless to shellcheck.
@@ -131,3 +149,4 @@ export CXX${role_post}=@named_cxx@
 
 # No local scope in sourced file
 unset -v role_pre role_post
+set +u
diff --git a/pkgs/build-support/emacs/setup-hook.sh b/pkgs/build-support/emacs/setup-hook.sh
index defef45b55f..e1db3e828fd 100644
--- a/pkgs/build-support/emacs/setup-hook.sh
+++ b/pkgs/build-support/emacs/setup-hook.sh
@@ -4,4 +4,8 @@ addEmacsVars () {
   fi
 }
 
-envHooks+=(addEmacsVars)
+# If this is for a wrapper derivation, emacs and the dependencies are all
+# run-time dependencies. If this is for precompiling packages into bytecode,
+# emacs is a compile-time dependency of the package.
+addEnvHooks "$targetOffset" addEmacsVars
+addEnvHooks "$targetOffset" addEmacsVars
diff --git a/pkgs/build-support/gcc-wrapper-old/setup-hook.sh b/pkgs/build-support/gcc-wrapper-old/setup-hook.sh
index d8bdf858ae5..ad3ffeffbbb 100644
--- a/pkgs/build-support/gcc-wrapper-old/setup-hook.sh
+++ b/pkgs/build-support/gcc-wrapper-old/setup-hook.sh
@@ -1,4 +1,4 @@
-addCVars () {
+gccWrapperOld_addCVars () {
     if test -d $1/include; then
         export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem $1/include"
     fi
@@ -12,7 +12,7 @@ addCVars () {
     fi
 }
 
-envHooks=(${envHooks[@]} addCVars)
+envBuildBuildHooks+=(gccWrapperOld_addCVars)
 
 # Note: these come *after* $out in the PATH (see setup.sh).
 
diff --git a/pkgs/build-support/setup-hooks/find-xml-catalogs.sh b/pkgs/build-support/setup-hooks/find-xml-catalogs.sh
index b742d5a8ffd..85364a61f61 100644
--- a/pkgs/build-support/setup-hooks/find-xml-catalogs.sh
+++ b/pkgs/build-support/setup-hooks/find-xml-catalogs.sh
@@ -18,5 +18,5 @@ if [ -z "$libxmlHookDone" ]; then
     # xmllint and xsltproc from looking in /etc/xml/catalog.
     export XML_CATALOG_FILES
     if [ -z "$XML_CATALOG_FILES" ]; then XML_CATALOG_FILES=" "; fi
-    envHooks+=(addXMLCatalogs)
+    addEnvHooks "$hostOffset" addXMLCatalogs
 fi
diff --git a/pkgs/build-support/setup-hooks/set-java-classpath.sh b/pkgs/build-support/setup-hooks/set-java-classpath.sh
index 047da91bc97..5d3548dc2e8 100644
--- a/pkgs/build-support/setup-hooks/set-java-classpath.sh
+++ b/pkgs/build-support/setup-hooks/set-java-classpath.sh
@@ -10,4 +10,4 @@ addPkgToClassPath () {
     done
 }
 
-envHooks+=(addPkgToClassPath)
+addEnvHooks "$targetOffset" addPkgToClassPath
diff --git a/pkgs/build-support/setup-hooks/setup-debug-info-dirs.sh b/pkgs/build-support/setup-hooks/setup-debug-info-dirs.sh
index 2fd2a2d6da6..96bf48cf123 100644
--- a/pkgs/build-support/setup-hooks/setup-debug-info-dirs.sh
+++ b/pkgs/build-support/setup-hooks/setup-debug-info-dirs.sh
@@ -2,4 +2,4 @@ setupDebugInfoDirs () {
     addToSearchPath NIX_DEBUG_INFO_DIRS $1/lib/debug
 }
 
-envHooks+=(setupDebugInfoDirs)
+addEnvHooks "$targetOffset" setupDebugInfoDirs
diff --git a/pkgs/build-support/setup-hooks/strip.sh b/pkgs/build-support/setup-hooks/strip.sh
index a33968ca18d..fc4c7bfbaf9 100644
--- a/pkgs/build-support/setup-hooks/strip.sh
+++ b/pkgs/build-support/setup-hooks/strip.sh
@@ -3,24 +3,45 @@
 fixupOutputHooks+=(_doStrip)
 
 _doStrip() {
-    if [ -z "$dontStrip" ]; then
+    # We don't bother to strip build platform code because it shouldn't make it
+    # to $out anyways---if it does, that's a bigger problem that a lack of
+    # stripping will help catch.
+    local -ra flags=(dontStripHost dontStripTarget)
+    local -ra stripCmds=(STRIP TARGET_STRIP)
+
+    # Optimization
+    if [[ "$STRIP" == "$TARGET_STRIP" ]]; then
+        dontStripTarget+=1
+    fi
+
+    local i
+    for i in ${!stripCmds[@]}; do
+        local -n flag="${flags[$i]}"
+        local -n stripCmd="${stripCmds[$i]}"
+
+        # `dontStrip` disables them all
+        if [[ "$dontStrip" || "$flag" ]] || ! type -f "$stripCmd" 2>/dev/null
+        then continue; fi
+
         stripDebugList=${stripDebugList:-lib lib32 lib64 libexec bin sbin}
         if [ -n "$stripDebugList" ]; then
-            stripDirs "$stripDebugList" "${stripDebugFlags:--S}"
+            stripDirs "$stripCmd" "$stripDebugList" "${stripDebugFlags:--S}"
         fi
 
         stripAllList=${stripAllList:-}
         if [ -n "$stripAllList" ]; then
-            stripDirs "$stripAllList" "${stripAllFlags:--s}"
+            stripDirs "$stripCmd" "$stripAllList" "${stripAllFlags:--s}"
         fi
-    fi
+    done
 }
 
 stripDirs() {
-    local dirs="$1"
-    local stripFlags="$2"
+    local cmd="$1"
+    local dirs="$2"
+    local stripFlags="$3"
     local dirsNew=
 
+    local d
     for d in ${dirs}; do
         if [ -d "$prefix/$d" ]; then
             dirsNew="${dirsNew} $prefix/$d "
@@ -29,8 +50,8 @@ stripDirs() {
     dirs=${dirsNew}
 
     if [ -n "${dirs}" ]; then
-        header "stripping (with flags $stripFlags) in$dirs"
-        find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} $STRIP $commonStripFlags $stripFlags 2>/dev/null || true
+        header "stripping (with command $cmd and flags $stripFlags) in$dirs"
+        find $dirs -type f -print0 | xargs -0 ${xargsFlags:--r} $cmd $commonStripFlags $stripFlags 2>/dev/null || true
         stopNest
     fi
 }
diff --git a/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh b/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh
index 79b8d5b73fa..25ac12996cc 100644
--- a/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh
+++ b/pkgs/build-support/setup-hooks/wrap-gapps-hook.sh
@@ -6,7 +6,7 @@ find_gio_modules() {
     fi
 }
 
-envHooks+=(find_gio_modules)
+addEnvHooks "$targetOffset" find_gio_modules
 
 # Note: $gappsWrapperArgs still gets defined even if $dontWrapGApps is set.
 wrapGAppsHook() {
diff --git a/pkgs/data/icons/hicolor-icon-theme/setup-hook.sh b/pkgs/data/icons/hicolor-icon-theme/setup-hook.sh
index 05ab9b3d65d..29306cb316a 100644
--- a/pkgs/data/icons/hicolor-icon-theme/setup-hook.sh
+++ b/pkgs/data/icons/hicolor-icon-theme/setup-hook.sh
@@ -8,7 +8,8 @@ hicolorIconThemeHook() {
 	
 }
 
-envHooks+=(hicolorIconThemeHook)
+# I think this is meant to be a runtime dep
+addEnvHooks "$hostOffset" hicolorIconThemeHook
 
 # Remove icon cache
 hicolorPreFixupPhase() {
diff --git a/pkgs/desktops/gnome-3/apps/gnome-characters/default.nix b/pkgs/desktops/gnome-3/apps/gnome-characters/default.nix
index 15f1f58b558..a354c4f6316 100644
--- a/pkgs/desktops/gnome-3/apps/gnome-characters/default.nix
+++ b/pkgs/desktops/gnome-3/apps/gnome-characters/default.nix
@@ -1,12 +1,12 @@
 { stdenv, fetchurl, pkgconfig, gnome3, gtk3, wrapGAppsHook
-, intltool, gjs, gdk_pixbuf, librsvg }:
+, intltool, gobjectIntrospection, gjs, gdk_pixbuf, librsvg }:
 
 stdenv.mkDerivation rec {
   inherit (import ./src.nix fetchurl) name src;
 
-  nativeBuildInputs = [ pkgconfig ];
+  nativeBuildInputs = [ pkgconfig wrapGAppsHook intltool ];
   buildInputs = [
-    gtk3 wrapGAppsHook intltool gjs gdk_pixbuf
+    gtk3 gjs gdk_pixbuf gobjectIntrospection
     librsvg gnome3.gsettings_desktop_schemas gnome3.defaultIconTheme
   ];
 
diff --git a/pkgs/desktops/gnome-3/core/eog/default.nix b/pkgs/desktops/gnome-3/core/eog/default.nix
index 49ad25a8c5e..ae0abfd7150 100644
--- a/pkgs/desktops/gnome-3/core/eog/default.nix
+++ b/pkgs/desktops/gnome-3/core/eog/default.nix
@@ -1,10 +1,10 @@
 { fetchurl, stdenv, gettext, pkgconfig, itstool, libxml2, libjpeg, gnome3
-, shared_mime_info, wrapGAppsHook, librsvg, libexif }:
+, shared_mime_info, wrapGAppsHook, librsvg, libexif, gobjectIntrospection }:
 
 stdenv.mkDerivation rec {
   inherit (import ./src.nix fetchurl) name src;
 
-  nativeBuildInputs = [ pkgconfig gettext itstool wrapGAppsHook ];
+  nativeBuildInputs = [ pkgconfig gettext itstool wrapGAppsHook gobjectIntrospection ];
 
   buildInputs = with gnome3;
     [ libxml2 libjpeg gtk glib libpeas librsvg
diff --git a/pkgs/desktops/gnome-3/core/gconf/default.nix b/pkgs/desktops/gnome-3/core/gconf/default.nix
index 1729ec06623..99883c8a3f6 100644
--- a/pkgs/desktops/gnome-3/core/gconf/default.nix
+++ b/pkgs/desktops/gnome-3/core/gconf/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, pkgconfig, dbus_glib, gnome3 ? null, glib, libxml2
-, intltool, polkit, orbit, withGtk ? false }:
+, intltool, polkit, orbit, python, withGtk ? false }:
 
 assert withGtk -> (gnome3 != null);
 
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     sha256 = "0k3q9nh53yhc9qxf1zaicz4sk8p3kzq4ndjdsgpaa2db0ccbj4hr";
   };
 
-  buildInputs = [ libxml2 polkit orbit ] ++ stdenv.lib.optional withGtk gnome3.gtk;
+  buildInputs = [ libxml2 polkit orbit python ] ++ stdenv.lib.optional withGtk gnome3.gtk;
   propagatedBuildInputs = [ glib dbus_glib  ];
   nativeBuildInputs = [ pkgconfig intltool ];
 
diff --git a/pkgs/desktops/gnome-3/core/gnome-bluetooth/default.nix b/pkgs/desktops/gnome-3/core/gnome-bluetooth/default.nix
index 9eaad021d32..3dbb4e32654 100644
--- a/pkgs/desktops/gnome-3/core/gnome-bluetooth/default.nix
+++ b/pkgs/desktops/gnome-3/core/gnome-bluetooth/default.nix
@@ -1,10 +1,10 @@
 { stdenv, fetchurl, gnome3, meson, ninja, pkgconfig, gtk3, intltool, glib
-, udev, itstool, libxml2, wrapGAppsHook, libnotify, libcanberra_gtk3 }:
+, udev, itstool, libxml2, wrapGAppsHook, libnotify, libcanberra_gtk3, gobjectIntrospection }:
 
 stdenv.mkDerivation rec {
   inherit (import ./src.nix fetchurl) name src;
 
-  nativeBuildInputs = [ meson ninja intltool itstool pkgconfig libxml2 wrapGAppsHook ];
+  nativeBuildInputs = [ meson ninja intltool itstool pkgconfig libxml2 wrapGAppsHook gobjectIntrospection ];
   buildInputs = [ glib gtk3 udev libnotify libcanberra_gtk3
                   gnome3.defaultIconTheme gnome3.gsettings_desktop_schemas ];
 
diff --git a/pkgs/desktops/gnome-3/core/grilo/setup-hook.sh b/pkgs/desktops/gnome-3/core/grilo/setup-hook.sh
index 3291e38addb..9337c520a20 100644
--- a/pkgs/desktops/gnome-3/core/grilo/setup-hook.sh
+++ b/pkgs/desktops/gnome-3/core/grilo/setup-hook.sh
@@ -4,4 +4,4 @@ make_grilo_find_plugins() {
     fi
 }
 
-envHooks+=(make_grilo_find_plugins)
+addEnvHooks "$hostOffset" make_grilo_find_plugins
diff --git a/pkgs/desktops/gnome-3/core/gtksourceview/default.nix b/pkgs/desktops/gnome-3/core/gtksourceview/default.nix
index e3b92a4aeac..45001e55127 100644
--- a/pkgs/desktops/gnome-3/core/gtksourceview/default.nix
+++ b/pkgs/desktops/gnome-3/core/gtksourceview/default.nix
@@ -1,7 +1,9 @@
 { stdenv, fetchurl, pkgconfig, atk, cairo, glib, gtk3, pango
-, libxml2, perl, intltool, gettext, gnome3, dbus, xvfb_run, shared_mime_info }:
+, libxml2, perl, intltool, gettext, gnome3, gobjectIntrospection, dbus, xvfb_run, shared_mime_info }:
 
-stdenv.mkDerivation rec {
+let
+  checkInputs = [ xvfb_run dbus ];
+in stdenv.mkDerivation rec {
   inherit (import ./src.nix fetchurl) name src;
 
   propagatedBuildInputs = [
@@ -13,10 +15,10 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" ];
 
-  nativeBuildInputs = [ pkgconfig intltool gettext perl ]
-    ++ checkInputs;
+  nativeBuildInputs = [ pkgconfig intltool gettext perl gobjectIntrospection ]
+    ++ stdenv.lib.optionals doCheck checkInputs;
+
   buildInputs = [ atk cairo glib pango libxml2 ];
-  checkInputs = stdenv.lib.optionals doCheck [ xvfb_run dbus ];
 
   preBuild = ''
     substituteInPlace gtksourceview/gtksourceview-utils.c --replace "@NIX_SHARE_PATH@" "$out/share"
diff --git a/pkgs/desktops/gnome-3/core/gucharmap/default.nix b/pkgs/desktops/gnome-3/core/gucharmap/default.nix
index 58d9901ad01..731ff7e2688 100644
--- a/pkgs/desktops/gnome-3/core/gucharmap/default.nix
+++ b/pkgs/desktops/gnome-3/core/gucharmap/default.nix
@@ -1,7 +1,7 @@
 { stdenv, intltool, fetchurl, pkgconfig, gtk3
 , glib, desktop_file_utils, bash, appdata-tools
 , wrapGAppsHook, gnome3, itstool, libxml2
-, callPackage, unzip }:
+, callPackage, unzip, gobjectIntrospection }:
 
 # TODO: icons and theme still does not work
 # use packaged gnome3.adwaita-icon-theme
@@ -15,11 +15,12 @@ stdenv.mkDerivation rec {
 
   preConfigure = "patchShebangs gucharmap/gen-guch-unicode-tables.pl";
 
-  nativeBuildInputs = [ pkgconfig wrapGAppsHook unzip ];
+  nativeBuildInputs = [
+    pkgconfig wrapGAppsHook unzip intltool itstool appdata-tools
+    gnome3.yelp_tools libxml2 desktop_file_utils gobjectIntrospection
+  ];
 
-  buildInputs = [ gtk3 intltool itstool glib appdata-tools
-                  gnome3.yelp_tools libxml2 desktop_file_utils
-                  gnome3.gsettings_desktop_schemas ];
+  buildInputs = [ gtk3 glib gnome3.gsettings_desktop_schemas ];
 
   unicode-data = callPackage ./unicode-data.nix {};
 
diff --git a/pkgs/desktops/gnome-3/core/libpeas/default.nix b/pkgs/desktops/gnome-3/core/libpeas/default.nix
index 8fddd8f7d5a..998a1a02b3f 100644
--- a/pkgs/desktops/gnome-3/core/libpeas/default.nix
+++ b/pkgs/desktops/gnome-3/core/libpeas/default.nix
@@ -8,7 +8,11 @@ stdenv.mkDerivation rec {
   configureFlags = [ "--enable-python3" ];
 
   nativeBuildInputs = [ pkgconfig ];
-  buildInputs =  [ intltool glib gtk3 gnome3.defaultIconTheme ncurses python3Packages.python python3Packages.pygobject3 gobjectIntrospection ];
+  buildInputs =  [ intltool glib gtk3 gnome3.defaultIconTheme ncurses python3Packages.python python3Packages.pygobject3 ];
+  propagatedBuildInputs = [
+    # Required by libpeas-1.0.pc
+    gobjectIntrospection
+  ];
 
   meta = with stdenv.lib; {
     description = "A GObject-based plugins engine";
diff --git a/pkgs/desktops/gnome-3/core/simple-scan/default.nix b/pkgs/desktops/gnome-3/core/simple-scan/default.nix
index 27a1e4b0be5..a30467c1862 100644
--- a/pkgs/desktops/gnome-3/core/simple-scan/default.nix
+++ b/pkgs/desktops/gnome-3/core/simple-scan/default.nix
@@ -1,13 +1,17 @@
 { stdenv, fetchurl, meson, ninja, pkgconfig, gettext, itstool, wrapGAppsHook
 , cairo, gdk_pixbuf, colord, glib, gtk, gusb, packagekit, libwebp
-, libxml2, sane-backends, vala, gnome3 }:
+, libxml2, sane-backends, vala, gnome3, gobjectIntrospection }:
 
 stdenv.mkDerivation rec {
   inherit (import ./src.nix fetchurl) name src;
 
   buildInputs = [ cairo gdk_pixbuf colord glib gnome3.defaultIconTheme gusb
                 gtk libwebp packagekit sane-backends vala ];
-  nativeBuildInputs = [ meson ninja gettext itstool pkgconfig wrapGAppsHook libxml2 ];
+  nativeBuildInputs = [
+    meson ninja gettext itstool pkgconfig wrapGAppsHook libxml2
+    # For setup hook
+    gobjectIntrospection
+  ];
 
   postPatch = ''
     patchShebangs data/meson_compile_gschema.py
diff --git a/pkgs/desktops/gnome-3/misc/gspell/default.nix b/pkgs/desktops/gnome-3/misc/gspell/default.nix
index e8c299685f7..2bbf219e3f3 100644
--- a/pkgs/desktops/gnome-3/misc/gspell/default.nix
+++ b/pkgs/desktops/gnome-3/misc/gspell/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchurl, pkgconfig, glib, gtk3, enchant, isocodes, vala }:
+{ stdenv, fetchurl, pkgconfig, glib, gtk3, enchant, isocodes, vala, gobjectIntrospection }:
 
 stdenv.mkDerivation rec {
   inherit (import ./src.nix fetchurl) name src;
 
   propagatedBuildInputs = [ enchant ]; # required for pkgconfig
 
-  nativeBuildInputs = [ pkgconfig vala ];
+  nativeBuildInputs = [ pkgconfig vala gobjectIntrospection ];
   buildInputs = [ glib gtk3 isocodes ];
 
   meta = with stdenv.lib; {
diff --git a/pkgs/desktops/gnustep/make/setup-hook.sh b/pkgs/desktops/gnustep/make/setup-hook.sh
index 71618ef960f..53138901116 100644
--- a/pkgs/desktops/gnustep/make/setup-hook.sh
+++ b/pkgs/desktops/gnustep/make/setup-hook.sh
@@ -74,4 +74,4 @@ addEnvVars() {
 	addToSearchPath NIX_GNUSTEP_SYSTEM_DOC_INFO "$tmp"
     fi
 }
-envHooks=(${envHooks[@]} addEnvVars)
+addEnvHooks "$targetOffset" addEnvVars
diff --git a/pkgs/desktops/pantheon/apps/pantheon-terminal/default.nix b/pkgs/desktops/pantheon/apps/pantheon-terminal/default.nix
index b7c27ec3d0a..13a34f90fcd 100644
--- a/pkgs/desktops/pantheon/apps/pantheon-terminal/default.nix
+++ b/pkgs/desktops/pantheon/apps/pantheon-terminal/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, perl, cmake, vala_0_38, pkgconfig, glib, gtk3, granite, gnome3, libnotify, gettext, makeWrapper }:
+{ stdenv, fetchurl, perl, cmake, vala_0_38, pkgconfig, glib, gtk3, granite, gnome3, libnotify, gettext, makeWrapper, gobjectIntrospection }:
 
 stdenv.mkDerivation rec {
   majorVersion = "0.4";
@@ -20,7 +20,11 @@ stdenv.mkDerivation rec {
     done
   '';
 
-  nativeBuildInputs = [ perl cmake vala_0_38 pkgconfig makeWrapper ];
+  nativeBuildInputs = [
+    perl cmake vala_0_38 pkgconfig makeWrapper
+    # For setup hook
+    gobjectIntrospection
+  ];
   buildInputs = with gnome3; [
     glib gtk3 granite libnotify gettext vte_290 libgee
     gsettings_desktop_schemas defaultIconTheme
diff --git a/pkgs/development/compilers/chicken/setup-hook.sh b/pkgs/development/compilers/chicken/setup-hook.sh
index d7f28539dc6..b0d9b53b537 100644
--- a/pkgs/development/compilers/chicken/setup-hook.sh
+++ b/pkgs/development/compilers/chicken/setup-hook.sh
@@ -4,4 +4,4 @@ addChickenRepositoryPath() {
     export CHICKEN_INCLUDE_PATH="$1/share;$CHICKEN_INCLUDE_PATH"
 }
 
-envHooks=(${envHooks[@]} addChickenRepositoryPath)
+addEnvHooks "$targetOffset" addChickenRepositoryPath
diff --git a/pkgs/development/compilers/gcc/4.5/default.nix b/pkgs/development/compilers/gcc/4.5/default.nix
index a29f856a6cc..8f29d5f2cb1 100644
--- a/pkgs/development/compilers/gcc/4.5/default.nix
+++ b/pkgs/development/compilers/gcc/4.5/default.nix
@@ -229,11 +229,22 @@ stdenv.mkDerivation ({
   inherit noSysDirs profiledCompiler staticCompiler langJava
     libcCross crossMingw;
 
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
   nativeBuildInputs = [ texinfo which gettext ]
     ++ optional (perl != null) perl;
 
-  buildInputs = [ gmp mpfr libmpc libelf ]
-    ++ (optional (ppl != null) ppl)
+  # For building runtime libs
+  depsBuildTarget =
+    if hostPlatform == buildPlatform then [
+      targetPackages.stdenv.cc.bintools # newly-built gcc will be used
+    ] else assert targetPlatform == hostPlatform; [ # build != host == target
+      stdenv.cc
+    ];
+
+  buildInputs = [
+    gmp mpfr libmpc libelf
+    targetPackages.stdenv.cc.bintools # For linking code at run-time
+  ] ++ (optional (ppl != null) ppl)
     ++ (optional (cloogppl != null) cloogppl)
     ++ (optional (zlib != null) zlib)
     ++ (optional langJava boehmgc)
@@ -245,11 +256,7 @@ stdenv.mkDerivation ({
     ;
 
   # TODO(@Ericson2314): Always pass "--target" and always prefix.
-  configurePlatforms =
-    # TODO(@Ericson2314): Figure out what's going wrong with Arm
-    if hostPlatform == targetPlatform && targetPlatform.isArm
-    then []
-    else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
+  configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
 
   configureFlags =
     # Basic dependencies
@@ -314,56 +321,9 @@ stdenv.mkDerivation ({
 
   /* For cross-built gcc (build != host == target) */
   crossAttrs = {
-    AR_FOR_BUILD = "ar";
-    AS_FOR_BUILD = "as";
-    LD_FOR_BUILD = "ld";
-    NM_FOR_BUILD = "nm";
-    OBJCOPY_FOR_BUILD = "objcopy";
-    OBJDUMP_FOR_BUILD = "objdump";
-    RANLIB_FOR_BUILD = "ranlib";
-    SIZE_FOR_BUILD = "size";
-    STRINGS_FOR_BUILD = "strings";
-    STRIP_FOR_BUILD = "strip";
-    CC_FOR_BUILD = "gcc";
-    CXX_FOR_BUILD = "g++";
-
-    AR = "${targetPlatform.config}-ar";
-    AS = "${targetPlatform.config}-as";
-    LD = "${targetPlatform.config}-ld";
-    NM = "${targetPlatform.config}-nm";
-    OBJCOPY = "${targetPlatform.config}-objcopy";
-    OBJDUMP = "${targetPlatform.config}-objdump";
-    RANLIB = "${targetPlatform.config}-ranlib";
-    SIZE = "${targetPlatform.config}-size";
-    STRINGS = "${targetPlatform.config}-strings";
-    STRIP = "${targetPlatform.config}-strip";
-    CC = "${targetPlatform.config}-gcc";
-    CXX = "${targetPlatform.config}-g++";
-
-    AR_FOR_TARGET = "${targetPlatform.config}-ar";
-    AS_FOR_TARGET = "${targetPlatform.config}-as";
-    LD_FOR_TARGET = "${targetPlatform.config}-ld";
-    NM_FOR_TARGET = "${targetPlatform.config}-nm";
-    OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy";
-    OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump";
-    RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib";
-    SIZE_FOR_TARGET = "${targetPlatform.config}-size";
-    STRINGS_FOR_TARGET = "${targetPlatform.config}-strings";
-    STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
-    CC_FOR_TARGET = "${targetPlatform.config}-gcc";
-    CXX_FOR_TARGET = "${targetPlatform.config}-g++";
-
     dontStrip = true;
   };
 
-  NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools;
-  NIX_BUILD_CC = buildPackages.stdenv.cc;
-
-  # Needed for the cross compilation to work
-  AR = "ar";
-  LD = "ld";
-  CC = "gcc";
-
   # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
   # library headers and binaries, regarless of the language being compiled.
   #
diff --git a/pkgs/development/compilers/gcc/4.8/default.nix b/pkgs/development/compilers/gcc/4.8/default.nix
index 162da9e0613..a28ad871ead 100644
--- a/pkgs/development/compilers/gcc/4.8/default.nix
+++ b/pkgs/development/compilers/gcc/4.8/default.nix
@@ -267,6 +267,7 @@ stdenv.mkDerivation ({
   inherit noSysDirs staticCompiler langJava
     libcCross crossMingw;
 
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
   nativeBuildInputs = [ texinfo which gettext ]
     ++ (optional (perl != null) perl)
     ++ (optional javaAwtGtk pkgconfig);
@@ -297,11 +298,7 @@ stdenv.mkDerivation ({
   dontDisableStatic = true;
 
   # TODO(@Ericson2314): Always pass "--target" and always prefix.
-  configurePlatforms =
-    # TODO(@Ericson2314): Figure out what's going wrong with Arm
-    if hostPlatform == targetPlatform && targetPlatform.isArm
-    then []
-    else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
+  configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
 
   configureFlags =
     # Basic dependencies
@@ -397,57 +394,12 @@ stdenv.mkDerivation ({
 
   /* For cross-built gcc (build != host == target) */
   crossAttrs =  {
-    AR_FOR_BUILD = "ar";
-    AS_FOR_BUILD = "as";
-    LD_FOR_BUILD = "ld";
-    NM_FOR_BUILD = "nm";
-    OBJCOPY_FOR_BUILD = "objcopy";
-    OBJDUMP_FOR_BUILD = "objdump";
-    RANLIB_FOR_BUILD = "ranlib";
-    SIZE_FOR_BUILD = "size";
-    STRINGS_FOR_BUILD = "strings";
-    STRIP_FOR_BUILD = "strip";
-    CC_FOR_BUILD = "gcc";
-    CXX_FOR_BUILD = "g++";
-
-    AR = "${targetPlatform.config}-ar";
-    AS = "${targetPlatform.config}-as";
-    LD = "${targetPlatform.config}-ld";
-    NM = "${targetPlatform.config}-nm";
-    OBJCOPY = "${targetPlatform.config}-objcopy";
-    OBJDUMP = "${targetPlatform.config}-objdump";
-    RANLIB = "${targetPlatform.config}-ranlib";
-    SIZE = "${targetPlatform.config}-size";
-    STRINGS = "${targetPlatform.config}-strings";
-    STRIP = "${targetPlatform.config}-strip";
-    CC = "${targetPlatform.config}-gcc";
-    CXX = "${targetPlatform.config}-g++";
-
-    AR_FOR_TARGET = "${targetPlatform.config}-ar";
-    AS_FOR_TARGET = "${targetPlatform.config}-as";
-    LD_FOR_TARGET = "${targetPlatform.config}-ld";
-    NM_FOR_TARGET = "${targetPlatform.config}-nm";
-    OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy";
-    OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump";
-    RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib";
-    SIZE_FOR_TARGET = "${targetPlatform.config}-size";
-    STRINGS_FOR_TARGET = "${targetPlatform.config}-strings";
-    STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
-    CC_FOR_TARGET = "${targetPlatform.config}-gcc";
-    CXX_FOR_TARGET = "${targetPlatform.config}-g++";
-
     dontStrip = true;
     buildFlags = "";
   };
 
-  NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools;
-  NIX_BUILD_CC = buildPackages.stdenv.cc;
-
-  # Needed for the cross compilation to work
-  AR = "ar";
-  LD = "ld";
   # http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
-  CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
+  ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
 
   # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
   # library headers and binaries, regarless of the language being compiled.
diff --git a/pkgs/development/compilers/gcc/4.9/default.nix b/pkgs/development/compilers/gcc/4.9/default.nix
index 621c45cdff3..844e0a7bebf 100644
--- a/pkgs/development/compilers/gcc/4.9/default.nix
+++ b/pkgs/development/compilers/gcc/4.9/default.nix
@@ -262,12 +262,23 @@ stdenv.mkDerivation ({
   inherit noSysDirs staticCompiler langJava
     libcCross crossMingw;
 
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
   nativeBuildInputs = [ texinfo which gettext ]
     ++ (optional (perl != null) perl)
     ++ (optional javaAwtGtk pkgconfig);
 
-  buildInputs = [ gmp mpfr libmpc libelf ]
-    ++ (optional (cloog != null) cloog)
+  # For building runtime libs
+  depsBuildTarget =
+    if hostPlatform == buildPlatform then [
+      targetPackages.stdenv.cc.bintools # newly-built gcc will be used
+    ] else assert targetPlatform == hostPlatform; [ # build != host == target
+      stdenv.cc
+    ];
+
+  buildInputs = [
+    gmp mpfr libmpc libelf
+    targetPackages.stdenv.cc.bintools # For linking code at run-time
+  ] ++ (optional (cloog != null) cloog)
     ++ (optional (isl != null) isl)
     ++ (optional (zlib != null) zlib)
     ++ (optionals langJava [ boehmgc zip unzip ])
@@ -296,11 +307,7 @@ stdenv.mkDerivation ({
   dontDisableStatic = true;
 
   # TODO(@Ericson2314): Always pass "--target" and always prefix.
-  configurePlatforms =
-    # TODO(@Ericson2314): Figure out what's going wrong with Arm
-    if hostPlatform == targetPlatform && targetPlatform.isArm
-    then []
-    else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
+  configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
 
   configureFlags =
     # Basic dependencies
@@ -395,57 +402,12 @@ stdenv.mkDerivation ({
 
   /* For cross-built gcc (build != host == target) */
   crossAttrs = {
-    AR_FOR_BUILD = "ar";
-    AS_FOR_BUILD = "as";
-    LD_FOR_BUILD = "ld";
-    NM_FOR_BUILD = "nm";
-    OBJCOPY_FOR_BUILD = "objcopy";
-    OBJDUMP_FOR_BUILD = "objdump";
-    RANLIB_FOR_BUILD = "ranlib";
-    SIZE_FOR_BUILD = "size";
-    STRINGS_FOR_BUILD = "strings";
-    STRIP_FOR_BUILD = "strip";
-    CC_FOR_BUILD = "gcc";
-    CXX_FOR_BUILD = "g++";
-
-    AR = "${targetPlatform.config}-ar";
-    AS = "${targetPlatform.config}-as";
-    LD = "${targetPlatform.config}-ld";
-    NM = "${targetPlatform.config}-nm";
-    OBJCOPY = "${targetPlatform.config}-objcopy";
-    OBJDUMP = "${targetPlatform.config}-objdump";
-    RANLIB = "${targetPlatform.config}-ranlib";
-    SIZE = "${targetPlatform.config}-size";
-    STRINGS = "${targetPlatform.config}-strings";
-    STRIP = "${targetPlatform.config}-strip";
-    CC = "${targetPlatform.config}-gcc";
-    CXX = "${targetPlatform.config}-g++";
-
-    AR_FOR_TARGET = "${targetPlatform.config}-ar";
-    AS_FOR_TARGET = "${targetPlatform.config}-as";
-    LD_FOR_TARGET = "${targetPlatform.config}-ld";
-    NM_FOR_TARGET = "${targetPlatform.config}-nm";
-    OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy";
-    OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump";
-    RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib";
-    SIZE_FOR_TARGET = "${targetPlatform.config}-size";
-    STRINGS_FOR_TARGET = "${targetPlatform.config}-strings";
-    STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
-    CC_FOR_TARGET = "${targetPlatform.config}-gcc";
-    CXX_FOR_TARGET = "${targetPlatform.config}-g++";
-
     dontStrip = true;
     buildFlags = "";
   };
 
-  NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools;
-  NIX_BUILD_CC = buildPackages.stdenv.cc;
-
-  # Needed for the cross compilation to work
-  AR = "ar";
-  LD = "ld";
   # http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
-  CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
+  ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
 
   # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
   # library headers and binaries, regarless of the language being compiled.
diff --git a/pkgs/development/compilers/gcc/5/default.nix b/pkgs/development/compilers/gcc/5/default.nix
index 709e87c3445..148409bee9b 100644
--- a/pkgs/development/compilers/gcc/5/default.nix
+++ b/pkgs/development/compilers/gcc/5/default.nix
@@ -49,9 +49,6 @@ assert libelf != null -> zlib != null;
 # Make sure we get GNU sed.
 assert hostPlatform.isDarwin -> gnused != null;
 
-# Need c++filt on darwin
-assert hostPlatform.isDarwin -> targetPackages.stdenv.cc.bintools or null != null;
-
 # The go frontend is written in c++
 assert langGo -> langCC;
 
@@ -277,17 +274,27 @@ stdenv.mkDerivation ({
   inherit noSysDirs staticCompiler langJava
     libcCross crossMingw;
 
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
   nativeBuildInputs = [ texinfo which gettext ]
     ++ (optional (perl != null) perl)
     ++ (optional javaAwtGtk pkgconfig);
 
-  buildInputs = [ gmp mpfr libmpc libelf ]
-    ++ (optional (isl != null) isl)
+  # For building runtime libs
+  depsBuildTarget =
+    if hostPlatform == buildPlatform then [
+      targetPackages.stdenv.cc.bintools # newly-built gcc will be used
+    ] else assert targetPlatform == hostPlatform; [ # build != host == target
+      stdenv.cc
+    ];
+
+  buildInputs = [
+    gmp mpfr libmpc libelf
+    targetPackages.stdenv.cc.bintools # For linking code at run-time
+  ] ++ (optional (isl != null) isl)
     ++ (optional (zlib != null) zlib)
     ++ (optionals langJava [ boehmgc zip unzip ])
     ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
     ++ (optionals (targetPlatform != hostPlatform) [targetPackages.stdenv.cc.bintools])
-    ++ (optionals (buildPlatform != hostPlatform) [buildPackages.stdenv.cc])
     ++ (optionals langAda [gnatboot])
     ++ (optionals langVhdl [gnat])
 
@@ -309,11 +316,7 @@ stdenv.mkDerivation ({
   dontDisableStatic = true;
 
   # TODO(@Ericson2314): Always pass "--target" and always prefix.
-  configurePlatforms =
-    # TODO(@Ericson2314): Figure out what's going wrong with Arm
-    if hostPlatform == targetPlatform && targetPlatform.isArm
-    then []
-    else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
+  configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
 
   configureFlags =
     # Basic dependencies
@@ -404,57 +407,12 @@ stdenv.mkDerivation ({
 
   /* For cross-built gcc (build != host == target) */
   crossAttrs = {
-    AR_FOR_BUILD = "ar";
-    AS_FOR_BUILD = "as";
-    LD_FOR_BUILD = "ld";
-    NM_FOR_BUILD = "nm";
-    OBJCOPY_FOR_BUILD = "objcopy";
-    OBJDUMP_FOR_BUILD = "objdump";
-    RANLIB_FOR_BUILD = "ranlib";
-    SIZE_FOR_BUILD = "size";
-    STRINGS_FOR_BUILD = "strings";
-    STRIP_FOR_BUILD = "strip";
-    CC_FOR_BUILD = "gcc";
-    CXX_FOR_BUILD = "g++";
-
-    AR = "${targetPlatform.config}-ar";
-    AS = "${targetPlatform.config}-as";
-    LD = "${targetPlatform.config}-ld";
-    NM = "${targetPlatform.config}-nm";
-    OBJCOPY = "${targetPlatform.config}-objcopy";
-    OBJDUMP = "${targetPlatform.config}-objdump";
-    RANLIB = "${targetPlatform.config}-ranlib";
-    SIZE = "${targetPlatform.config}-size";
-    STRINGS = "${targetPlatform.config}-strings";
-    STRIP = "${targetPlatform.config}-strip";
-    CC = "${targetPlatform.config}-gcc";
-    CXX = "${targetPlatform.config}-g++";
-
-    AR_FOR_TARGET = "${targetPlatform.config}-ar";
-    AS_FOR_TARGET = "${targetPlatform.config}-as";
-    LD_FOR_TARGET = "${targetPlatform.config}-ld";
-    NM_FOR_TARGET = "${targetPlatform.config}-nm";
-    OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy";
-    OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump";
-    RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib";
-    SIZE_FOR_TARGET = "${targetPlatform.config}-size";
-    STRINGS_FOR_TARGET = "${targetPlatform.config}-strings";
-    STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
-    CC_FOR_TARGET = "${targetPlatform.config}-gcc";
-    CXX_FOR_TARGET = "${targetPlatform.config}-g++";
-
     dontStrip = true;
     buildFlags = "";
   };
 
-  NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools;
-  NIX_BUILD_CC = buildPackages.stdenv.cc;
-
-  # Needed for the cross compilation to work
-  AR = "ar";
-  LD = "ld";
   # http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
-  CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
+  ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
 
   # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
   # library headers and binaries, regarless of the language being compiled.
diff --git a/pkgs/development/compilers/gcc/6/default.nix b/pkgs/development/compilers/gcc/6/default.nix
index 33a034adf66..c6114b7e639 100644
--- a/pkgs/development/compilers/gcc/6/default.nix
+++ b/pkgs/development/compilers/gcc/6/default.nix
@@ -49,9 +49,6 @@ assert libelf != null -> zlib != null;
 # Make sure we get GNU sed.
 assert hostPlatform.isDarwin -> gnused != null;
 
-# Need c++filt on darwin
-assert hostPlatform.isDarwin -> targetPackages.stdenv.cc.bintools or null != null;
-
 # The go frontend is written in c++
 assert langGo -> langCC;
 
@@ -276,12 +273,23 @@ stdenv.mkDerivation ({
   inherit noSysDirs staticCompiler langJava
     libcCross crossMingw;
 
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
   nativeBuildInputs = [ texinfo which gettext ]
     ++ (optional (perl != null) perl)
     ++ (optional javaAwtGtk pkgconfig);
 
-  buildInputs = [ gmp mpfr libmpc libelf ]
-    ++ (optional (isl != null) isl)
+  # For building runtime libs
+  depsBuildTarget =
+    if hostPlatform == buildPlatform then [
+      targetPackages.stdenv.cc.bintools # newly-built gcc will be used
+    ] else assert targetPlatform == hostPlatform; [ # build != host == target
+      stdenv.cc
+    ];
+
+  buildInputs = [
+    gmp mpfr libmpc libelf
+    targetPackages.stdenv.cc.bintools # For linking code at run-time
+  ] ++ (optional (isl != null) isl)
     ++ (optional (zlib != null) zlib)
     ++ (optionals langJava [ boehmgc zip unzip ])
     ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
@@ -311,11 +319,7 @@ stdenv.mkDerivation ({
   dontDisableStatic = true;
 
   # TODO(@Ericson2314): Always pass "--target" and always prefix.
-  configurePlatforms =
-    # TODO(@Ericson2314): Figure out what's going wrong with Arm
-    if hostPlatform == targetPlatform && targetPlatform.isArm
-    then []
-    else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
+  configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
 
   configureFlags =
     # Basic dependencies
@@ -405,57 +409,12 @@ stdenv.mkDerivation ({
 
   /* For cross-built gcc (build != host == target) */
   crossAttrs = {
-    AR_FOR_BUILD = "ar";
-    AS_FOR_BUILD = "as";
-    LD_FOR_BUILD = "ld";
-    NM_FOR_BUILD = "nm";
-    OBJCOPY_FOR_BUILD = "objcopy";
-    OBJDUMP_FOR_BUILD = "objdump";
-    RANLIB_FOR_BUILD = "ranlib";
-    SIZE_FOR_BUILD = "size";
-    STRINGS_FOR_BUILD = "strings";
-    STRIP_FOR_BUILD = "strip";
-    CC_FOR_BUILD = "gcc";
-    CXX_FOR_BUILD = "g++";
-
-    AR = "${targetPlatform.config}-ar";
-    AS = "${targetPlatform.config}-as";
-    LD = "${targetPlatform.config}-ld";
-    NM = "${targetPlatform.config}-nm";
-    OBJCOPY = "${targetPlatform.config}-objcopy";
-    OBJDUMP = "${targetPlatform.config}-objdump";
-    RANLIB = "${targetPlatform.config}-ranlib";
-    SIZE = "${targetPlatform.config}-size";
-    STRINGS = "${targetPlatform.config}-strings";
-    STRIP = "${targetPlatform.config}-strip";
-    CC = "${targetPlatform.config}-gcc";
-    CXX = "${targetPlatform.config}-g++";
-
-    AR_FOR_TARGET = "${targetPlatform.config}-ar";
-    AS_FOR_TARGET = "${targetPlatform.config}-as";
-    LD_FOR_TARGET = "${targetPlatform.config}-ld";
-    NM_FOR_TARGET = "${targetPlatform.config}-nm";
-    OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy";
-    OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump";
-    RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib";
-    SIZE_FOR_TARGET = "${targetPlatform.config}-size";
-    STRINGS_FOR_TARGET = "${targetPlatform.config}-strings";
-    STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
-    CC_FOR_TARGET = "${targetPlatform.config}-gcc";
-    CXX_FOR_TARGET = "${targetPlatform.config}-g++";
-
     dontStrip = true;
     buildFlags = "";
   };
 
-  NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools;
-  NIX_BUILD_CC = buildPackages.stdenv.cc;
-
-  # Needed for the cross compilation to work
-  AR = "ar";
-  LD = "ld";
   # http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
-  CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
+  ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
 
   # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
   # library headers and binaries, regarless of the language being compiled.
diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix
index 291ec944b55..c20546b59e8 100644
--- a/pkgs/development/compilers/gcc/7/default.nix
+++ b/pkgs/development/compilers/gcc/7/default.nix
@@ -50,9 +50,6 @@ assert libelf != null -> zlib != null;
 # Make sure we get GNU sed.
 assert hostPlatform.isDarwin -> gnused != null;
 
-# Need c++filt on darwin
-assert hostPlatform.isDarwin -> targetPackages.stdenv.cc.bintools or null != null;
-
 # The go frontend is written in c++
 assert langGo -> langCC;
 
@@ -273,12 +270,23 @@ stdenv.mkDerivation ({
   inherit noSysDirs staticCompiler langJava
     libcCross crossMingw;
 
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
   nativeBuildInputs = [ texinfo which gettext ]
     ++ (optional (perl != null) perl)
     ++ (optional javaAwtGtk pkgconfig);
 
-  buildInputs = [ gmp mpfr libmpc libelf flex ]
-    ++ (optional (isl != null) isl)
+  # For building runtime libs
+  depsBuildTarget =
+    if hostPlatform == buildPlatform then [
+      targetPackages.stdenv.cc.bintools # newly-built gcc will be used
+    ] else assert targetPlatform == hostPlatform; [ # build != host == target
+      stdenv.cc
+    ];
+
+  buildInputs = [
+    gmp mpfr libmpc libelf flex
+    targetPackages.stdenv.cc.bintools # For linking code at run-time
+  ] ++ (optional (isl != null) isl)
     ++ (optional (zlib != null) zlib)
     ++ (optionals langJava [ boehmgc zip unzip ])
     ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
@@ -304,11 +312,7 @@ stdenv.mkDerivation ({
   dontDisableStatic = true;
 
   # TODO(@Ericson2314): Always pass "--target" and always prefix.
-  configurePlatforms =
-    # TODO(@Ericson2314): Figure out what's going wrong with Arm
-    if hostPlatform == targetPlatform && targetPlatform.isArm
-    then []
-    else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
+  configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
 
   configureFlags =
     # Basic dependencies
@@ -399,57 +403,12 @@ stdenv.mkDerivation ({
 
   /* For cross-built gcc (build != host == target) */
   crossAttrs = {
-    AR_FOR_BUILD = "ar";
-    AS_FOR_BUILD = "as";
-    LD_FOR_BUILD = "ld";
-    NM_FOR_BUILD = "nm";
-    OBJCOPY_FOR_BUILD = "objcopy";
-    OBJDUMP_FOR_BUILD = "objdump";
-    RANLIB_FOR_BUILD = "ranlib";
-    SIZE_FOR_BUILD = "size";
-    STRINGS_FOR_BUILD = "strings";
-    STRIP_FOR_BUILD = "strip";
-    CC_FOR_BUILD = "gcc";
-    CXX_FOR_BUILD = "g++";
-
-    AR = "${targetPlatform.config}-ar";
-    AS = "${targetPlatform.config}-as";
-    LD = "${targetPlatform.config}-ld";
-    NM = "${targetPlatform.config}-nm";
-    OBJCOPY = "${targetPlatform.config}-objcopy";
-    OBJDUMP = "${targetPlatform.config}-objdump";
-    RANLIB = "${targetPlatform.config}-ranlib";
-    SIZE = "${targetPlatform.config}-size";
-    STRINGS = "${targetPlatform.config}-strings";
-    STRIP = "${targetPlatform.config}-strip";
-    CC = "${targetPlatform.config}-gcc";
-    CXX = "${targetPlatform.config}-g++";
-
-    AR_FOR_TARGET = "${targetPlatform.config}-ar";
-    AS_FOR_TARGET = "${targetPlatform.config}-as";
-    LD_FOR_TARGET = "${targetPlatform.config}-ld";
-    NM_FOR_TARGET = "${targetPlatform.config}-nm";
-    OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy";
-    OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump";
-    RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib";
-    SIZE_FOR_TARGET = "${targetPlatform.config}-size";
-    STRINGS_FOR_TARGET = "${targetPlatform.config}-strings";
-    STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
-    CC_FOR_TARGET = "${targetPlatform.config}-gcc";
-    CXX_FOR_TARGET = "${targetPlatform.config}-g++";
-
     dontStrip = true;
     buildFlags = "";
   };
 
-  NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools;
-  NIX_BUILD_CC = buildPackages.stdenv.cc;
-
-  # Needed for the cross compilation to work
-  AR = "ar";
-  LD = "ld";
   # http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
-  CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
+  ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
 
   # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
   # library headers and binaries, regarless of the language being compiled.
diff --git a/pkgs/development/compilers/gcc/snapshot/default.nix b/pkgs/development/compilers/gcc/snapshot/default.nix
index e8668712e2e..c571487361b 100644
--- a/pkgs/development/compilers/gcc/snapshot/default.nix
+++ b/pkgs/development/compilers/gcc/snapshot/default.nix
@@ -50,9 +50,6 @@ assert libelf != null -> zlib != null;
 # Make sure we get GNU sed.
 assert hostPlatform.isDarwin -> gnused != null;
 
-# Need c++filt on darwin
-assert hostPlatform.isDarwin -> targetPackages.stdenv.cc.bintools or null != null;
-
 # The go frontend is written in c++
 assert langGo -> langCC;
 
@@ -260,12 +257,23 @@ stdenv.mkDerivation ({
   inherit noSysDirs staticCompiler langJava
     libcCross crossMingw;
 
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
   nativeBuildInputs = [ texinfo which gettext ]
     ++ (optional (perl != null) perl)
     ++ (optional javaAwtGtk pkgconfig);
 
-  buildInputs = [ gmp mpfr libmpc libelf flex ]
-    ++ (optional (isl != null) isl)
+  # For building runtime libs
+  depsBuildTarget =
+    if hostPlatform == buildPlatform then [
+      targetPackages.stdenv.cc.bintools # newly-built gcc will be used
+    ] else assert targetPlatform == hostPlatform; [ # build != host == target
+      stdenv.cc
+    ];
+
+  buildInputs = [
+    gmp mpfr libmpc libelf flex
+    targetPackages.stdenv.cc.bintools # For linking code at run-time
+  ] ++ (optional (isl != null) isl)
     ++ (optional (zlib != null) zlib)
     ++ (optionals langJava [ boehmgc zip unzip ])
     ++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
@@ -291,11 +299,7 @@ stdenv.mkDerivation ({
   dontDisableStatic = true;
 
   # TODO(@Ericson2314): Always pass "--target" and always prefix.
-  configurePlatforms =
-    # TODO(@Ericson2314): Figure out what's going wrong with Arm
-    if hostPlatform == targetPlatform && targetPlatform.isArm
-    then []
-    else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
+  configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
 
   configureFlags =
     # Basic dependencies
@@ -386,57 +390,12 @@ stdenv.mkDerivation ({
 
   /* For cross-built gcc (build != host == target) */
   crossAttrs = {
-    AR_FOR_BUILD = "ar";
-    AS_FOR_BUILD = "as";
-    LD_FOR_BUILD = "ld";
-    NM_FOR_BUILD = "nm";
-    OBJCOPY_FOR_BUILD = "objcopy";
-    OBJDUMP_FOR_BUILD = "objdump";
-    RANLIB_FOR_BUILD = "ranlib";
-    SIZE_FOR_BUILD = "size";
-    STRINGS_FOR_BUILD = "strings";
-    STRIP_FOR_BUILD = "strip";
-    CC_FOR_BUILD = "gcc";
-    CXX_FOR_BUILD = "g++";
-
-    AR = "${targetPlatform.config}-ar";
-    AS = "${targetPlatform.config}-as";
-    LD = "${targetPlatform.config}-ld";
-    NM = "${targetPlatform.config}-nm";
-    OBJCOPY = "${targetPlatform.config}-objcopy";
-    OBJDUMP = "${targetPlatform.config}-objdump";
-    RANLIB = "${targetPlatform.config}-ranlib";
-    SIZE = "${targetPlatform.config}-size";
-    STRINGS = "${targetPlatform.config}-strings";
-    STRIP = "${targetPlatform.config}-strip";
-    CC = "${targetPlatform.config}-gcc";
-    CXX = "${targetPlatform.config}-g++";
-
-    AR_FOR_TARGET = "${targetPlatform.config}-ar";
-    AS_FOR_TARGET = "${targetPlatform.config}-as";
-    LD_FOR_TARGET = "${targetPlatform.config}-ld";
-    NM_FOR_TARGET = "${targetPlatform.config}-nm";
-    OBJCOPY_FOR_TARGET = "${targetPlatform.config}-objcopy";
-    OBJDUMP_FOR_TARGET = "${targetPlatform.config}-objdump";
-    RANLIB_FOR_TARGET = "${targetPlatform.config}-ranlib";
-    SIZE_FOR_TARGET = "${targetPlatform.config}-size";
-    STRINGS_FOR_TARGET = "${targetPlatform.config}-strings";
-    STRIP_FOR_TARGET = "${targetPlatform.config}-strip";
-    CC_FOR_TARGET = "${targetPlatform.config}-gcc";
-    CXX_FOR_TARGET = "${targetPlatform.config}-g++";
-
     dontStrip = true;
     buildFlags = "";
   };
 
-  NIX_BUILD_BINTOOLS = buildPackages.stdenv.cc.bintools;
-  NIX_BUILD_CC = buildPackages.stdenv.cc;
-
-  # Needed for the cross compilation to work
-  AR = "ar";
-  LD = "ld";
   # http://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
-  CC = if stdenv.system == "x86_64-solaris" then "gcc -m64" else "gcc";
+  ${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
 
   # Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
   # library headers and binaries, regarless of the language being compiled.
diff --git a/pkgs/development/compilers/gerbil/default.nix b/pkgs/development/compilers/gerbil/default.nix
index 622107c7534..23089ddda4e 100644
--- a/pkgs/development/compilers/gerbil/default.nix
+++ b/pkgs/development/compilers/gerbil/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, fetchgit, gambit,
   coreutils, rsync, bash,
-  openssl, zlib, sqlite, libxml2, libyaml, libmysql, lmdb, leveldb }:
+  openssl, zlib, sqlite, libxml2, libyaml, mysql, lmdb, leveldb }:
 
 # TODO: distinct packages for gerbil-release and gerbil-devel
 
@@ -17,9 +17,11 @@ stdenv.mkDerivation rec {
   buildInputs = [
     gambit
     coreutils rsync bash
-    openssl zlib sqlite libxml2 libyaml libmysql lmdb leveldb
+    openssl zlib sqlite libxml2 libyaml mysql.connector-c lmdb leveldb
   ];
 
+  NIX_CFLAGS_COMPILE = [ "-I${mysql.connector-c}/include/mysql" "-L${mysql.connector-c}/lib/mysql" ];
+
   postPatch = ''
     echo '(define (gerbil-version-string) "v${version}")' > src/gerbil/runtime/gx-version.scm
 
diff --git a/pkgs/development/compilers/go/setup-hook.sh b/pkgs/development/compilers/go/setup-hook.sh
index 1b91c8312b8..7dce15eeb10 100644
--- a/pkgs/development/compilers/go/setup-hook.sh
+++ b/pkgs/development/compilers/go/setup-hook.sh
@@ -2,4 +2,4 @@ addToGoPath() {
     addToSearchPath GOPATH $1/share/go
 }
 
-envHooks=(${envHooks[@]} addToGoPath)
+addEnvHooks "$targetOffset" addToGoPath
diff --git a/pkgs/development/compilers/haxe/setup-hook.sh b/pkgs/development/compilers/haxe/setup-hook.sh
index 21cc0206859..e6496107a5e 100644
--- a/pkgs/development/compilers/haxe/setup-hook.sh
+++ b/pkgs/development/compilers/haxe/setup-hook.sh
@@ -4,4 +4,4 @@ addHaxeLibPath() {
   fi
 }
 
-envHooks+=(addHaxeLibPath)
+addEnvHooks "$targetOffset" addHaxeLibPath
diff --git a/pkgs/development/compilers/hhvm/default.nix b/pkgs/development/compilers/hhvm/default.nix
index 2f84387a888..a66b2264f07 100644
--- a/pkgs/development/compilers/hhvm/default.nix
+++ b/pkgs/development/compilers/hhvm/default.nix
@@ -2,7 +2,7 @@
 , pcre, libevent, gd, curl, libxml2, icu, flex, bison, openssl, zlib, php
 , expat, libcap, oniguruma, libdwarf, libmcrypt, tbb, gperftools, glog, libkrb5
 , bzip2, openldap, readline, libelf, uwimap, binutils, cyrus_sasl, pam, libpng
-, libxslt, freetype, gdb, git, perl, mariadb, gmp, libyaml, libedit
+, libxslt, freetype, gdb, git, perl, mysql, gmp, libyaml, libedit
 , libvpx, imagemagick, fribidi, gperf, which, ocamlPackages
 }:
 
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs =
-    [ cmake pkgconfig boost libunwind mariadb.client libmemcached pcre gdb git perl
+    [ cmake pkgconfig boost libunwind mysql.connector-c libmemcached pcre gdb git perl
       libevent gd curl libxml2 icu flex bison openssl zlib php expat libcap
       oniguruma libdwarf libmcrypt tbb gperftools bzip2 openldap readline
       libelf uwimap binutils cyrus_sasl pam glog libpng libxslt libkrb5
diff --git a/pkgs/development/compilers/llvm/3.7/default.nix b/pkgs/development/compilers/llvm/3.7/default.nix
index 35af978216c..5cac04c044d 100644
--- a/pkgs/development/compilers/llvm/3.7/default.nix
+++ b/pkgs/development/compilers/llvm/3.7/default.nix
@@ -44,15 +44,11 @@ let
     stdenv = stdenv.override (drv: {
       allowedRequisites = null;
       cc = self.clang;
-      # Don't include the libc++ and libc++abi from the original stdenv.
-      extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
     });
 
     libcxxStdenv = stdenv.override (drv: {
       allowedRequisites = null;
       cc = self.libcxxClang;
-      # Don't include the libc++ and libc++abi from the original stdenv.
-      extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
     });
 
     lldb = callPackage ./lldb.nix {};
diff --git a/pkgs/development/compilers/llvm/3.8/default.nix b/pkgs/development/compilers/llvm/3.8/default.nix
index bd79db012a6..a660d4aea5f 100644
--- a/pkgs/development/compilers/llvm/3.8/default.nix
+++ b/pkgs/development/compilers/llvm/3.8/default.nix
@@ -41,15 +41,11 @@ let
     stdenv = stdenv.override (drv: {
       allowedRequisites = null;
       cc = self.clang;
-      # Don't include the libc++ and libc++abi from the original stdenv.
-      extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
     });
 
     libcxxStdenv = stdenv.override (drv: {
       allowedRequisites = null;
       cc = self.libcxxClang;
-      # Don't include the libc++ and libc++abi from the original stdenv.
-      extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
     });
 
     lldb = callPackage ./lldb.nix {};
diff --git a/pkgs/development/compilers/llvm/3.9/default.nix b/pkgs/development/compilers/llvm/3.9/default.nix
index 5ce51bc9c12..c58adc3f92d 100644
--- a/pkgs/development/compilers/llvm/3.9/default.nix
+++ b/pkgs/development/compilers/llvm/3.9/default.nix
@@ -41,15 +41,11 @@ let
     stdenv = stdenv.override (drv: {
       allowedRequisites = null;
       cc = self.clang;
-      # Don't include the libc++ and libc++abi from the original stdenv.
-      extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
     });
 
     libcxxStdenv = stdenv.override (drv: {
       allowedRequisites = null;
       cc = self.libcxxClang;
-      # Don't include the libc++ and libc++abi from the original stdenv.
-      extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
     });
 
     lldb = callPackage ./lldb.nix {};
diff --git a/pkgs/development/compilers/llvm/4/default.nix b/pkgs/development/compilers/llvm/4/default.nix
index fa61a6c22e7..5a44cb86825 100644
--- a/pkgs/development/compilers/llvm/4/default.nix
+++ b/pkgs/development/compilers/llvm/4/default.nix
@@ -56,15 +56,11 @@ let
     stdenv = stdenv.override (drv: {
       allowedRequisites = null;
       cc = self.clang;
-      # Don't include the libc++ and libc++abi from the original stdenv.
-      extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
     });
 
     libcxxStdenv = stdenv.override (drv: {
       allowedRequisites = null;
       cc = self.libcxxClang;
-      # Don't include the libc++ and libc++abi from the original stdenv.
-      extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
     });
 
     lld = callPackage ./lld.nix {};
diff --git a/pkgs/development/compilers/llvm/5/clang/default.nix b/pkgs/development/compilers/llvm/5/clang/default.nix
index fa8502ebd67..b003d2f334a 100644
--- a/pkgs/development/compilers/llvm/5/clang/default.nix
+++ b/pkgs/development/compilers/llvm/5/clang/default.nix
@@ -9,7 +9,7 @@ let
     name = "clang-${version}";
 
     unpackPhase = ''
-      unpackFile ${fetch "cfe" "0w09s8fn3lkn6i04nj0cisgp821r815fk5b5fjn97xrd371277q1"}
+      unpackFile ${fetch "cfe" "1zyh4dggxd55lnfg73c8fybnkssqcaa6bq2h4bzimnnj1jdnqpqk"}
       mv cfe-${version}* clang
       sourceRoot=$PWD/clang
       unpackFile ${clang-tools-extra_src}
diff --git a/pkgs/development/compilers/llvm/5/default.nix b/pkgs/development/compilers/llvm/5/default.nix
index 9891f3090ac..a7e16c08ce9 100644
--- a/pkgs/development/compilers/llvm/5/default.nix
+++ b/pkgs/development/compilers/llvm/5/default.nix
@@ -6,7 +6,7 @@
 let
   callPackage = newScope (self // { inherit stdenv cmake libxml2 python2 isl release_version version fetch; });
 
-  release_version = "5.0.0";
+  release_version = "5.0.1";
   version = release_version; # differentiating these is important for rc's
 
   fetch = name: sha256: fetchurl {
@@ -14,8 +14,8 @@ let
     inherit sha256;
   };
 
-  compiler-rt_src = fetch "compiler-rt" "1cy0y389zxn7mk8vffqvfirk9bbcbc8ziwc1nf1a8d118rk55bfm";
-  clang-tools-extra_src = fetch "clang-tools-extra" "1ikkv6k8cfgpjqlm24iqz52i5nyafzsc4dyikzzyb9n4b6wpil47";
+  compiler-rt_src = fetch "compiler-rt" "1nlmm0b3wpdwxkldqp1klzv3rpqf94q2a248xgqb7aapyhbi9paf";
+  clang-tools-extra_src = fetch "clang-tools-extra" "09fjii7w43kvxvsxxs6gig9vz95vnvx1779rqd36h8kksvws3bcs";
 
   # Add man output without introducing extra dependencies.
   overrideManOutput = drv:
@@ -56,15 +56,11 @@ let
     stdenv = stdenv.override (drv: {
       allowedRequisites = null;
       cc = self.clang;
-      # Don't include the libc++ and libc++abi from the original stdenv.
-      extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
     });
 
     libcxxStdenv = stdenv.override (drv: {
       allowedRequisites = null;
       cc = self.libcxxClang;
-      # Don't include the libc++ and libc++abi from the original stdenv.
-      extraBuildInputs = stdenv.lib.optional stdenv.isDarwin darwin.CF;
     });
 
     lld = callPackage ./lld.nix {};
diff --git a/pkgs/development/compilers/llvm/5/libc++/default.nix b/pkgs/development/compilers/llvm/5/libc++/default.nix
index 036161f7b88..6f03e225ad6 100644
--- a/pkgs/development/compilers/llvm/5/libc++/default.nix
+++ b/pkgs/development/compilers/llvm/5/libc++/default.nix
@@ -3,7 +3,7 @@
 stdenv.mkDerivation rec {
   name = "libc++-${version}";
 
-  src = fetch "libcxx" "1cf953msb0vwgjjrapw06950dnsdb2ps305czkn0vvr1k8g9irga";
+  src = fetch "libcxx" "003wwniwlikgh38cbqbcshc5gkiv3a2jkmbn6am9s46y5gfrk3zs";
 
   postUnpack = ''
     unpackFile ${libcxxabi.src}
diff --git a/pkgs/development/compilers/llvm/5/libc++abi.nix b/pkgs/development/compilers/llvm/5/libc++abi.nix
index 5a2a269345d..166f4260291 100644
--- a/pkgs/development/compilers/llvm/5/libc++abi.nix
+++ b/pkgs/development/compilers/llvm/5/libc++abi.nix
@@ -3,7 +3,7 @@
 stdenv.mkDerivation {
   name = "libc++abi-${version}";
 
-  src = fetch "libcxxabi" "04c9dfmrr8diih73x0wq99dk9xb99mg0bvsnbhx5q912xg3ihs8p";
+  src = fetch "libcxxabi" "0m78yr4arlz2b9m96xcygk15m2pbz8i10snk78i3q7pjnwn1a9as";
 
   nativeBuildInputs = [ cmake ];
   buildInputs = stdenv.lib.optional (!stdenv.isDarwin && !stdenv.isFreeBSD) libunwind;
diff --git a/pkgs/development/compilers/llvm/5/lld.nix b/pkgs/development/compilers/llvm/5/lld.nix
index f19a9afc804..1d00b16cce1 100644
--- a/pkgs/development/compilers/llvm/5/lld.nix
+++ b/pkgs/development/compilers/llvm/5/lld.nix
@@ -10,7 +10,7 @@
 stdenv.mkDerivation {
   name = "lld-${version}";
 
-  src = fetch "lld" "15rqsmfw0jlsri7hszbs8l0j7v1030cy9xvvdb245397llh7k6ir";
+  src = fetch "lld" "15fq2zvkliyiw5qi7ig2r8bshgbz4kzvs5in16mhfkw20l06rcym";
 
   nativeBuildInputs = [ cmake ];
   buildInputs = [ llvm ];
diff --git a/pkgs/development/compilers/llvm/5/lldb.nix b/pkgs/development/compilers/llvm/5/lldb.nix
index fac23b290bc..03e65dde0e4 100644
--- a/pkgs/development/compilers/llvm/5/lldb.nix
+++ b/pkgs/development/compilers/llvm/5/lldb.nix
@@ -17,7 +17,7 @@
 stdenv.mkDerivation {
   name = "lldb-${version}";
 
-  src = fetch "lldb" "0zcbav39srf6awv9znvzr7nqdrj704i8da3wdgc8362y20rcm860";
+  src = fetch "lldb" "0sipv8k37ai44m7jcf6wsbm2q41dgk3sk9m3i6823jkmg7kckhdp";
 
   postPatch = ''
     # Fix up various paths that assume llvm and clang are installed in the same place
diff --git a/pkgs/development/compilers/llvm/5/llvm.nix b/pkgs/development/compilers/llvm/5/llvm.nix
index 8358b6b18c3..6c7fd9eb0a3 100644
--- a/pkgs/development/compilers/llvm/5/llvm.nix
+++ b/pkgs/development/compilers/llvm/5/llvm.nix
@@ -22,7 +22,7 @@
 }:
 
 let
-  src = fetch "llvm" "1nin64vz21hyng6jr19knxipvggaqlkl2l9jpd5czbc4c2pcnpg3";
+  src = fetch "llvm" "1c07i0b61j69m578lgjkyayg419sh7sn40xb3j112nr2q2gli9sz";
 
   # Used when creating a version-suffixed symlink of libLLVM.dylib
   shortVersion = with stdenv.lib;
diff --git a/pkgs/development/compilers/llvm/5/openmp.nix b/pkgs/development/compilers/llvm/5/openmp.nix
index 9ba42eed2e2..5a01c191b5a 100644
--- a/pkgs/development/compilers/llvm/5/openmp.nix
+++ b/pkgs/development/compilers/llvm/5/openmp.nix
@@ -10,7 +10,7 @@
 stdenv.mkDerivation {
   name = "openmp-${version}";
 
-  src = fetch "openmp" "1igplg89bl6k6r9q88hnpcznq3g9lb79w7bix025lwp00ldhivy0";
+  src = fetch "openmp" "0lr6r87xzg87w1q9rrh04nqpyr8c929dh4qy3csjiy7rsb6kbdmd";
 
   nativeBuildInputs = [ cmake perl ];
   buildInputs = [ llvm ];
diff --git a/pkgs/development/compilers/neko/default.nix b/pkgs/development/compilers/neko/default.nix
index 236273bf6be..4dce11f93b1 100644
--- a/pkgs/development/compilers/neko/default.nix
+++ b/pkgs/development/compilers/neko/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, boehmgc, zlib, sqlite, pcre, cmake, pkgconfig
-, git, apacheHttpd, apr, aprutil, mariadb, mbedtls, openssl, pkgs, gtk2, libpthreadstubs
+, git, apacheHttpd, apr, aprutil, mysql, mbedtls, openssl, pkgs, gtk2, libpthreadstubs
 }:
 
 stdenv.mkDerivation rec {
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake pkgconfig git ];
   buildInputs =
     [ boehmgc zlib sqlite pcre apacheHttpd apr aprutil
-      mariadb.client mbedtls openssl libpthreadstubs ]
+      mysql.connector-c mbedtls openssl libpthreadstubs ]
       ++ stdenv.lib.optional stdenv.isLinux gtk2
       ++ stdenv.lib.optionals stdenv.isDarwin [ pkgs.darwin.apple_sdk.frameworks.Security
                                                 pkgs.darwin.apple_sdk.frameworks.Carbon];
diff --git a/pkgs/development/compilers/sbcl/default.nix b/pkgs/development/compilers/sbcl/default.nix
index b800d71198a..cd3120ed831 100644
--- a/pkgs/development/compilers/sbcl/default.nix
+++ b/pkgs/development/compilers/sbcl/default.nix
@@ -91,7 +91,7 @@ stdenv.mkDerivation rec {
 
   # Specifying $SBCL_HOME is only truly needed with `purgeNixReferences = true`.
   setupHook = writeText "setupHook.sh" ''
-    envHooks+=(_setSbclHome)
+    addEnvHooks "$targetOffset" _setSbclHome
     _setSbclHome() {
       export SBCL_HOME='@out@/lib/sbcl/'
     }
diff --git a/pkgs/development/compilers/urweb/default.nix b/pkgs/development/compilers/urweb/default.nix
index 74ca5dc4c4b..f2b6016ceb7 100644
--- a/pkgs/development/compilers/urweb/default.nix
+++ b/pkgs/development/compilers/urweb/default.nix
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "17qh9mcmlhbv6r52yij8l9ik7j7x6x7c09lf6pznnbdh4sf8p5wb";
   };
 
-  buildInputs = [ openssl mlton mysql.client postgresql sqlite ];
+  buildInputs = [ openssl mlton mysql.connector-c postgresql sqlite ];
 
   prePatch = ''
     sed -e 's@/usr/bin/file@${file}/bin/file@g' -i configure
@@ -21,13 +21,13 @@ stdenv.mkDerivation rec {
 
   preConfigure = ''
     export PGHEADER="${postgresql}/include/libpq-fe.h";
-    export MSHEADER="${lib.getDev mysql.client}/include/mysql/mysql.h";
+    export MSHEADER="${mysql.connector-c}/include/mysql/mysql.h";
     export SQHEADER="${sqlite.dev}/include/sqlite3.h";
 
     export CC="${gcc}/bin/gcc";
     export CCARGS="-I$out/include \
                    -L${openssl.out}/lib \
-                   -L${lib.getLib mysql.client}/lib \
+                   -L${mysql.connector-c}/lib \
                    -L${postgresql.lib}/lib \
                    -L${sqlite.out}/lib";
   '';
diff --git a/pkgs/development/compilers/vala/default.nix b/pkgs/development/compilers/vala/default.nix
index 40af4c312cf..f42cdcabae3 100644
--- a/pkgs/development/compilers/vala/default.nix
+++ b/pkgs/development/compilers/vala/default.nix
@@ -29,6 +29,12 @@ let
 
 in rec {
 
+  vala_0_23 = generic {
+    major   = "0.23";
+    minor   = "3";
+    sha256  = "101xjbc818g4849n9a80c2aai13zakj7mpnd7470xnkvz5jwqq96";
+  };
+
   vala_0_26 = generic {
     major   = "0.26";
     minor   = "2";
@@ -37,8 +43,8 @@ in rec {
 
   vala_0_28 = generic {
     major   = "0.28";
-    minor   = "0";
-    sha256  = "0zwpzhkhfk3piya14m7p2hl2vaabahprphppfm46ci91z39kp7hd";
+    minor   = "1";
+    sha256  = "0isg327w6rfqqdjja6a8pc3xcdkj7pqrkdhw48bsyxab2fkaw3hw";
   };
 
   vala_0_32 = generic {
@@ -49,14 +55,20 @@ in rec {
 
   vala_0_34 = generic {
     major   = "0.34";
-    minor   = "1";
-    sha256  = "16cjybjw100qps6jg0jdyjh8hndz8a876zmxpybnf30a8vygrk7m";
+    minor   = "13";
+    sha256  = "0ahbnhgwhhjkndmbr1d039ws0g2bb324c60fk6wgx7py5wvmgcd2";
+  };
+
+  vala_0_36 = generic {
+    major   = "0.36";
+    minor   = "8";
+    sha256  = "1nz5a8kcb22ss9idb7k1higwpvghd617xwf40fi0a9ggws614lfz";
   };
 
   vala_0_38 = generic {
     major   = "0.38";
-    minor   = "1";
-    sha256  = "112hl3lkcyakrk8c3qgw12gzn3nxjkvx7bn0jhl5f2m57d7k8d8h";
+    minor   = "4";
+    sha256  = "1sg5gaq3jhgr9vzh2ypiw475167k150wmyglymr7wwqppmikmcrc";
     extraNativeBuildInputs = [ autoconf ] ++ stdenv.lib.optionals stdenv.isDarwin [ libtool expat ];
     extraBuildInputs = [ graphviz ];
   };
diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix
index 3502dc60c5f..52eecb709a8 100644
--- a/pkgs/development/haskell-modules/configuration-common.nix
+++ b/pkgs/development/haskell-modules/configuration-common.nix
@@ -70,7 +70,7 @@ self: super: {
 
   # Use the default version of mysql to build this package (which is actually mariadb).
   # test phase requires networking
-  mysql = dontCheck (super.mysql.override { mysql = pkgs.mysql.lib; });
+  mysql = dontCheck (super.mysql.override { mysql = pkgs.mysql.connector-c; });
 
   # check requires mysql server
   mysql-simple = dontCheck super.mysql-simple;
diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix
index 8a8c6a90a95..2320d6a8752 100644
--- a/pkgs/development/haskell-modules/configuration-nix.nix
+++ b/pkgs/development/haskell-modules/configuration-nix.nix
@@ -53,7 +53,7 @@ self: super: builtins.intersectAttrs super {
 
   # Use the default version of mysql to build this package (which is actually mariadb).
   # test phase requires networking
-  mysql = dontCheck (super.mysql.override { mysql = pkgs.mysql.lib; });
+  mysql = dontCheck (super.mysql.override { mysql = pkgs.mysql.connector-c; });
 
   # CUDA needs help finding the SDK headers and libraries.
   cuda = overrideCabal super.cuda (drv: {
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix
index e4ae24f74fa..4df554a6b39 100644
--- a/pkgs/development/haskell-modules/generic-builder.nix
+++ b/pkgs/development/haskell-modules/generic-builder.nix
@@ -222,8 +222,8 @@ stdenv.mkDerivation ({
     setupCompileFlags="${concatStringsSep " " setupCompileFlags}"
     configureFlags="${concatStringsSep " " defaultConfigureFlags} $configureFlags"
 
-    # nativePkgs defined in stdenv/setup.hs
-    for p in "''${nativePkgs[@]}"; do
+    # host.*Pkgs defined in stdenv/setup.hs
+    for p in "''${pkgsHostHost[@]}" "''${pkgsHostTarget[@]}"; do
       if [ -d "$p/lib/${ghc.name}/package.conf.d" ]; then
         cp -f "$p/lib/${ghc.name}/package.conf.d/"*.conf $packageConfDir/
         continue
diff --git a/pkgs/development/idris-modules/build-idris-package.nix b/pkgs/development/idris-modules/build-idris-package.nix
index 9dfa3430ed8..66eddd0e360 100644
--- a/pkgs/development/idris-modules/build-idris-package.nix
+++ b/pkgs/development/idris-modules/build-idris-package.nix
@@ -18,7 +18,8 @@
       fi
     }
 
-    envHooks+=(addIdrisLibs)
+    # All run-time deps
+    addEnvHooks 0 addIdrisLibs
   '';
 
   buildPhase = ''
diff --git a/pkgs/development/idris-modules/with-packages.nix b/pkgs/development/idris-modules/with-packages.nix
index d2b09808ec1..d4638670f69 100644
--- a/pkgs/development/idris-modules/with-packages.nix
+++ b/pkgs/development/idris-modules/with-packages.nix
@@ -14,7 +14,7 @@
       fi
     }
 
-    envHooks+=(installIdrisLib)
+    envHostTargetHooks+=(installIdrisLib)
   '';
 
   unpackPhase = ''
diff --git a/pkgs/development/interpreters/elixir/setup-hook.sh b/pkgs/development/interpreters/elixir/setup-hook.sh
index 2ed3b2e6454..501eca3cf02 100644
--- a/pkgs/development/interpreters/elixir/setup-hook.sh
+++ b/pkgs/development/interpreters/elixir/setup-hook.sh
@@ -2,4 +2,4 @@ addErlLibPath() {
     addToSearchPath ERL_LIBS $1/lib/elixir/lib
 }
 
-envHooks+=(addErlLibPath)
+addEnvHooks "$hostOffset" addErlLibPath
diff --git a/pkgs/development/interpreters/erlang/setup-hook.sh b/pkgs/development/interpreters/erlang/setup-hook.sh
index 68c0f762dfc..3962d154ba9 100644
--- a/pkgs/development/interpreters/erlang/setup-hook.sh
+++ b/pkgs/development/interpreters/erlang/setup-hook.sh
@@ -2,4 +2,4 @@ addErlangLibPath() {
     addToSearchPath ERL_LIBS $1/lib/erlang/lib
 }
 
-envHooks+=(addErlangLibPath)
+addEnvHooks "$hostOffset" addErlangLibPath
diff --git a/pkgs/development/interpreters/guile/setup-hook-2.0.sh b/pkgs/development/interpreters/guile/setup-hook-2.0.sh
index fd1dc944ed4..c7fb4f70fc6 100644
--- a/pkgs/development/interpreters/guile/setup-hook-2.0.sh
+++ b/pkgs/development/interpreters/guile/setup-hook-2.0.sh
@@ -10,4 +10,4 @@ addGuileLibPath () {
     fi
 }
 
-envHooks+=(addGuileLibPath)
+addEnvHooks "$hostOffset" addGuileLibPath
diff --git a/pkgs/development/interpreters/guile/setup-hook-2.2.sh b/pkgs/development/interpreters/guile/setup-hook-2.2.sh
index 86c1e0d3e4a..73e700bde02 100644
--- a/pkgs/development/interpreters/guile/setup-hook-2.2.sh
+++ b/pkgs/development/interpreters/guile/setup-hook-2.2.sh
@@ -10,4 +10,4 @@ addGuileLibPath () {
     fi
 }
 
-envHooks+=(addGuileLibPath)
+addEnvHooks "$hostOffset" addGuileLibPath
diff --git a/pkgs/development/interpreters/guile/setup-hook.sh b/pkgs/development/interpreters/guile/setup-hook.sh
index c1d19e579ed..bf04fee1e89 100644
--- a/pkgs/development/interpreters/guile/setup-hook.sh
+++ b/pkgs/development/interpreters/guile/setup-hook.sh
@@ -5,4 +5,4 @@ addGuileLibPath () {
     fi
 }
 
-envHooks+=(addGuileLibPath)
+addEnvHooks "$hostOffset" addGuileLibPath
diff --git a/pkgs/development/interpreters/jruby/default.nix b/pkgs/development/interpreters/jruby/default.nix
index ff192c07286..2224a13ba7c 100644
--- a/pkgs/development/interpreters/jruby/default.nix
+++ b/pkgs/development/interpreters/jruby/default.nix
@@ -36,7 +36,7 @@ jruby = stdenv.mkDerivation rec {
          addToSearchPath GEM_PATH \$1/${passthru.gemPath}
        }
 
-       envHooks+=(addGemPath)
+       addEnvHooks "$hostOffset" addGemPath
      EOF
   '';
 
diff --git a/pkgs/development/interpreters/perl/setup-hook.sh b/pkgs/development/interpreters/perl/setup-hook.sh
index a8656b8531d..7909412806c 100644
--- a/pkgs/development/interpreters/perl/setup-hook.sh
+++ b/pkgs/development/interpreters/perl/setup-hook.sh
@@ -2,4 +2,4 @@ addPerlLibPath () {
     addToSearchPath PERL5LIB $1/lib/perl5/site_perl
 }
 
-envHooks+=(addPerlLibPath)
+addEnvHooks "$hostOffset" addPerlLibPath
diff --git a/pkgs/development/interpreters/php/default.nix b/pkgs/development/interpreters/php/default.nix
index 8bfc01ba46c..40c01b15e5a 100644
--- a/pkgs/development/interpreters/php/default.nix
+++ b/pkgs/development/interpreters/php/default.nix
@@ -12,9 +12,8 @@ let
     { version, sha256 }:
 
     let php7 = lib.versionAtLeast version "7.0";
-        mysqlHeaders = mysql.lib.dev or mysql;
         mysqlndSupport = config.php.mysqlnd or false;
-        mysqlBuildInputs = lib.optional (!mysqlndSupport) mysqlHeaders;
+        mysqlBuildInputs = lib.optional (!mysqlndSupport) mysql.connector-c;
 
     in composableDerivation.composableDerivation {} (fixed: {
 
@@ -121,7 +120,7 @@ let
         };
 
         mysqli = {
-          configureFlags = ["--with-mysqli=${if mysqlndSupport then "mysqlnd" else "${mysqlHeaders}/bin/mysql_config"}"];
+          configureFlags = ["--with-mysqli=${if mysqlndSupport then "mysqlnd" else "${mysql.connector-c}/bin/mysql_config"}"];
           buildInputs = mysqlBuildInputs;
         };
 
@@ -132,7 +131,7 @@ let
         };
 
         pdo_mysql = {
-          configureFlags = ["--with-pdo-mysql=${if mysqlndSupport then "mysqlnd" else mysqlHeaders}"];
+          configureFlags = ["--with-pdo-mysql=${if mysqlndSupport then "mysqlnd" else mysql.connector-c}"];
           buildInputs = mysqlBuildInputs;
         };
 
diff --git a/pkgs/development/interpreters/python/mk-python-derivation.nix b/pkgs/development/interpreters/python/mk-python-derivation.nix
index 5f7348ac825..d9cff16f448 100644
--- a/pkgs/development/interpreters/python/mk-python-derivation.nix
+++ b/pkgs/development/interpreters/python/mk-python-derivation.nix
@@ -13,7 +13,10 @@
 
 { name ? "${attrs.pname}-${attrs.version}"
 
-# Dependencies for building the package
+# Build-time dependencies for the package
+, nativeBuildInputs ? []
+
+# Run-time dependencies for the package
 , buildInputs ? []
 
 # Dependencies needed for running the checkPhase.
@@ -66,13 +69,15 @@ toPythonModule (python.stdenv.mkDerivation (builtins.removeAttrs attrs [
 
   name = namePrefix + name;
 
-  buildInputs = ([ wrapPython (ensureNewerSourcesHook { year = "1980"; }) ]
-    ++ (lib.optional (lib.hasSuffix "zip" attrs.src.name or "") unzip)
+  nativeBuildInputs = [ (ensureNewerSourcesHook { year = "1980"; }) ]
+    ++ nativeBuildInputs;
+
+  buildInputs = [ wrapPython ]
+    ++ lib.optional (lib.hasSuffix "zip" (attrs.src.name or "")) unzip
     ++ lib.optionals doCheck checkInputs
-    ++ lib.optional catchConflicts setuptools # If we nog longer propagate setuptools
+    ++ lib.optional catchConflicts setuptools # If we no longer propagate setuptools
     ++ buildInputs
-    ++ pythonPath
-  );
+    ++ pythonPath;
 
   # Propagate python and setuptools. We should stop propagating setuptools.
   propagatedBuildInputs = propagatedBuildInputs ++ [ python setuptools ];
diff --git a/pkgs/development/interpreters/python/setup-hook.sh b/pkgs/development/interpreters/python/setup-hook.sh
index dda9bed39f8..77ec9e9ac0b 100644
--- a/pkgs/development/interpreters/python/setup-hook.sh
+++ b/pkgs/development/interpreters/python/setup-hook.sh
@@ -12,10 +12,13 @@ toPythonPath() {
     echo $result
 }
 
-envHooks+=(addPythonPath)
+addEnvHooks "$hostOffset" addPythonPath
 
 # Determinism: The interpreter is patched to write null timestamps when compiling python files.
 # This way python doesn't try to update them when we freeze timestamps in nix store.
 export DETERMINISTIC_BUILD=1;
 # Determinism: We fix the hashes of str, bytes and datetime objects.
 export PYTHONHASHSEED=0;
+# Determinism. Whenever Python is included, it should not check user site-packages.
+# This option is only relevant when the sandbox is disabled.
+export PYTHONNOUSERSITE=1;
diff --git a/pkgs/development/interpreters/ruby/default.nix b/pkgs/development/interpreters/ruby/default.nix
index 3d18d5650a8..6a49107361a 100644
--- a/pkgs/development/interpreters/ruby/default.nix
+++ b/pkgs/development/interpreters/ruby/default.nix
@@ -150,7 +150,7 @@ let
             addToSearchPath GEM_PATH \$1/${passthru.gemPath}
           }
 
-          envHooks+=(addGemPath)
+          addEnvHooks "$hostOffset" addGemPath
           EOF
         '' + opString useRailsExpress ''
           rbConfig=$(find $out/lib/ruby -name rbconfig.rb)
diff --git a/pkgs/development/libraries/SDL/setup-hook.sh b/pkgs/development/libraries/SDL/setup-hook.sh
index 3696e743a07..20382f18f52 100644
--- a/pkgs/development/libraries/SDL/setup-hook.sh
+++ b/pkgs/development/libraries/SDL/setup-hook.sh
@@ -4,8 +4,4 @@ addSDLPath () {
   fi
 }
 
-if test -n "$crossConfig"; then
-  crossEnvHooks+=(addSDLPath)
-else
-  envHooks+=(addSDLPath)
-fi
+addEnvHooks "$hostOffset" addSDLPath
diff --git a/pkgs/development/libraries/SDL2/setup-hook.sh b/pkgs/development/libraries/SDL2/setup-hook.sh
index 5a26440f37b..3acce9d473c 100644
--- a/pkgs/development/libraries/SDL2/setup-hook.sh
+++ b/pkgs/development/libraries/SDL2/setup-hook.sh
@@ -4,8 +4,4 @@ addSDL2Path () {
   fi
 }
 
-if test -n "$crossConfig"; then
-  crossEnvHooks+=(addSDL2Path)
-else
-  envHooks+=(addSDL2Path)
-fi
+addEnvHooks "$hostOffset" addSDL2Path
diff --git a/pkgs/development/libraries/atk/default.nix b/pkgs/development/libraries/atk/default.nix
index 61c18837782..f7d3887cc18 100644
--- a/pkgs/development/libraries/atk/default.nix
+++ b/pkgs/development/libraries/atk/default.nix
@@ -18,13 +18,11 @@ stdenv.mkDerivation rec {
 
   buildInputs = libintlOrEmpty;
 
-  nativeBuildInputs = [ pkgconfig perl ];
+  nativeBuildInputs = [ pkgconfig perl gobjectIntrospection ];
 
   propagatedBuildInputs = [
     # Required by atk.pc
     glib
-    # TODO: Why propagate?
-    gobjectIntrospection
   ];
 
   doCheck = true;
diff --git a/pkgs/development/libraries/boost/1.59.nix b/pkgs/development/libraries/boost/1.59.nix
index 2666b1d6c5d..603d7883c64 100644
--- a/pkgs/development/libraries/boost/1.59.nix
+++ b/pkgs/development/libraries/boost/1.59.nix
@@ -8,33 +8,33 @@ callPackage ./generic.nix (args // rec {
     sha256 = "1jj1aai5rdmd72g90a3pd8sw9vi32zad46xv5av8fhnr48ir6ykj";
   };
 
-  patches = if stdenv.isCygwin then [
-      ./cygwin-fedora-boost-1.50.0-fix-non-utf8-files.patch
-      ./cygwin-fedora-boost-1.50.0-pool.patch
-      ./cygwin-fedora-boost-1.57.0-mpl-print.patch
-      ./cygwin-fedora-boost-1.57.0-spirit-unused_typedef.patch
-      ./cygwin-fedora-boost-1.54.0-locale-unused_typedef.patch
-      ./cygwin-fedora-boost-1.54.0-python-unused_typedef.patch
-      ./cygwin-fedora-boost-1.57.0-pool-test_linking.patch
-      ./cygwin-fedora-boost-1.54.0-pool-max_chunks_shadow.patch
-      ./cygwin-fedora-boost-1.57.0-signals2-weak_ptr.patch
-      ./cygwin-fedora-boost-1.57.0-uuid-comparison.patch
-      ./cygwin-fedora-boost-1.57.0-move-is_class.patch
-      ./cygwin-1.40.0-cstdint-cygwin.patch
-      ./cygwin-1.57.0-asio-cygwin.patch
-      ./cygwin-1.55.0-asio-MSG_EOR.patch
-      ./cygwin-1.57.0-config-cygwin.patch
-      ./cygwin-1.57.0-context-cygwin.patch
-      ./cygwin-1.57.0-filesystem-cygwin.patch
-      ./cygwin-1.55.0-interlocked-cygwin.patch
-      ./cygwin-1.40.0-iostreams-cygwin.patch
-      ./cygwin-1.57.0-locale-cygwin.patch
-      ./cygwin-1.57.0-log-cygwin.patch
-      ./cygwin-1.40.0-python-cygwin.patch
-      ./cygwin-1.40.0-regex-cygwin.patch
-      ./cygwin-1.57.0-smart_ptr-cygwin.patch
-      ./cygwin-1.57.0-system-cygwin.patch
-      ./cygwin-1.45.0-jam-cygwin.patch
-      ./cygwin-1.50.0-jam-pep3149.patch
-    ] else null;
+  patches = stdenv.lib.optionals stdenv.isCygwin [
+    ./cygwin-fedora-boost-1.50.0-fix-non-utf8-files.patch
+    ./cygwin-fedora-boost-1.50.0-pool.patch
+    ./cygwin-fedora-boost-1.57.0-mpl-print.patch
+    ./cygwin-fedora-boost-1.57.0-spirit-unused_typedef.patch
+    ./cygwin-fedora-boost-1.54.0-locale-unused_typedef.patch
+    ./cygwin-fedora-boost-1.54.0-python-unused_typedef.patch
+    ./cygwin-fedora-boost-1.57.0-pool-test_linking.patch
+    ./cygwin-fedora-boost-1.54.0-pool-max_chunks_shadow.patch
+    ./cygwin-fedora-boost-1.57.0-signals2-weak_ptr.patch
+    ./cygwin-fedora-boost-1.57.0-uuid-comparison.patch
+    ./cygwin-fedora-boost-1.57.0-move-is_class.patch
+    ./cygwin-1.40.0-cstdint-cygwin.patch
+    ./cygwin-1.57.0-asio-cygwin.patch
+    ./cygwin-1.55.0-asio-MSG_EOR.patch
+    ./cygwin-1.57.0-config-cygwin.patch
+    ./cygwin-1.57.0-context-cygwin.patch
+    ./cygwin-1.57.0-filesystem-cygwin.patch
+    ./cygwin-1.55.0-interlocked-cygwin.patch
+    ./cygwin-1.40.0-iostreams-cygwin.patch
+    ./cygwin-1.57.0-locale-cygwin.patch
+    ./cygwin-1.57.0-log-cygwin.patch
+    ./cygwin-1.40.0-python-cygwin.patch
+    ./cygwin-1.40.0-regex-cygwin.patch
+    ./cygwin-1.57.0-smart_ptr-cygwin.patch
+    ./cygwin-1.57.0-system-cygwin.patch
+    ./cygwin-1.45.0-jam-cygwin.patch
+    ./cygwin-1.50.0-jam-pep3149.patch
+  ];
 })
diff --git a/pkgs/development/libraries/boost/1.65.nix b/pkgs/development/libraries/boost/1.65.nix
index 56b136cd99b..427ef072ffe 100644
--- a/pkgs/development/libraries/boost/1.65.nix
+++ b/pkgs/development/libraries/boost/1.65.nix
@@ -9,6 +9,6 @@ callPackage ./generic.nix (args // rec {
     sha256 = "9807a5d16566c57fd74fb522764e0b134a8bbe6b6e8967b83afefd30dcd3be81";
   };
 
-  enableNumpy = true;
+  enableNumpy = args.enableNumpy or true;
 
 })
diff --git a/pkgs/development/libraries/boost/1.66.nix b/pkgs/development/libraries/boost/1.66.nix
new file mode 100644
index 00000000000..a89ae84db38
--- /dev/null
+++ b/pkgs/development/libraries/boost/1.66.nix
@@ -0,0 +1,14 @@
+{ stdenv, callPackage, fetchurl, ... } @ args:
+
+callPackage ./generic.nix (args // rec {
+  version = "1.66_0";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/boost/boost_1_66_0.tar.bz2";
+    # SHA256 from http://www.boost.org/users/history/version_1_66_0.html
+    sha256 = "5721818253e6a0989583192f96782c4a98eb6204965316df9f5ad75819225ca9";
+  };
+
+  enableNumpy = args.enableNumpy or true;
+
+})
diff --git a/pkgs/development/libraries/boost/generic.nix b/pkgs/development/libraries/boost/generic.nix
index b2ec31ace17..adb7ca665cc 100644
--- a/pkgs/development/libraries/boost/generic.nix
+++ b/pkgs/development/libraries/boost/generic.nix
@@ -1,18 +1,19 @@
 { stdenv, fetchurl, icu, expat, zlib, bzip2, python, fixDarwinDylibNames, libiconv
-, buildPlatform, hostPlatform
-, toolset ? if stdenv.cc.isClang then "clang" else null
+, which
+, buildPackages, buildPlatform, hostPlatform
+, toolset ? /**/ if stdenv.cc.isClang                                then "clang"
+            else if stdenv.cc.isGNU && hostPlatform != buildPlatform then "gcc-cross"
+            else null
 , enableRelease ? true
 , enableDebug ? false
 , enableSingleThreaded ? false
 , enableMultiThreaded ? true
 , enableShared ? !(hostPlatform.libc == "msvcrt") # problems for now
 , enableStatic ? !enableShared
-, enablePIC ? false
-, enableExceptions ? false
 , enablePython ? hostPlatform == buildPlatform
 , enableNumpy ? false
 , taggedLayout ? ((enableRelease && enableDebug) || (enableSingleThreaded && enableMultiThreaded) || (enableShared && enableStatic))
-, patches ? null
+, patches ? []
 , mpi ? null
 
 # Attributes inherit from specific versions
@@ -21,8 +22,9 @@
 }:
 
 # We must build at least one type of libraries
-assert !enableShared -> enableStatic;
+assert enableShared || enableStatic;
 
+# Python isn't supported when cross-compiling
 assert enablePython -> hostPlatform == buildPlatform;
 assert enableNumpy -> enablePython;
 
@@ -46,86 +48,41 @@ let
   # To avoid library name collisions
   layout = if taggedLayout then "tagged" else "system";
 
-  cflags = if enablePIC && enableExceptions then
-             "cflags=\"-fPIC -fexceptions\" cxxflags=-fPIC linkflags=-fPIC"
-           else if enablePIC then
-             "cflags=-fPIC cxxflags=-fPIC linkflags=-fPIC"
-           else if enableExceptions then
-             "cflags=-fexceptions"
-           else
-             "";
-
-  withToolset = stdenv.lib.optionalString (toolset != null) "--with-toolset=${toolset}";
-
-  genericB2Flags = [
+  b2Args = concatStringsSep " " ([
     "--includedir=$dev/include"
     "--libdir=$out/lib"
     "-j$NIX_BUILD_CORES"
     "--layout=${layout}"
     "variant=${variant}"
     "threading=${threading}"
-  ] ++ optional (link != "static") "runtime-link=${runtime-link}" ++ [
+    "runtime-link=${runtime-link}"
     "link=${link}"
-    "${cflags}"
-  ] ++ optional (variant == "release") "debug-symbols=off"
-    ++ optional (!enablePython) "--without-python";
-
-  nativeB2Flags = [
     "-sEXPAT_INCLUDE=${expat.dev}/include"
     "-sEXPAT_LIBPATH=${expat.out}/lib"
-  ] ++ optional (toolset != null) "toolset=${toolset}"
-    ++ optional (mpi != null) "--user-config=user-config.jam";
-  nativeB2Args = concatStringsSep " " (genericB2Flags ++ nativeB2Flags);
-
-  crossB2Flags = [
-    "-sEXPAT_INCLUDE=${expat.crossDrv}/include"
-    "-sEXPAT_LIBPATH=${expat.crossDrv}/lib"
-    "--user-config=user-config.jam"
-    "toolset=gcc-cross"
-  ] ++ optionals (hostPlatform.libc == "msvcrt") [
+  ] ++ optional (variant == "release") "debug-symbols=off"
+    ++ optional (toolset != null) "toolset=${toolset}"
+    ++ optional (mpi != null || hostPlatform != buildPlatform) "--user-config=user-config.jam"
+    ++ optionals (hostPlatform.libc == "msvcrt") [
     "target-os=windows"
     "threadapi=win32"
     "binary-format=pe"
     "address-model=${toString hostPlatform.parsed.cpu.bits}"
     "architecture=x86"
-  ];
-  crossB2Args = concatStringsSep " " (genericB2Flags ++ crossB2Flags);
-
-  builder = b2Args: ''
-    ./b2 ${b2Args}
-  '';
-
-  installer = b2Args: ''
-    # boostbook is needed by some applications
-    mkdir -p $dev/share/boostbook
-    cp -a tools/boostbook/{xsl,dtd} $dev/share/boostbook/
-
-    # Let boost install everything else
-    ./b2 ${b2Args} install
-  '';
-
-  commonConfigureFlags = [
-    "--includedir=$(dev)/include"
-    "--libdir=$(out)/lib"
-  ];
-
-  fixup = ''
-    # Make boost header paths relative so that they are not runtime dependencies
-    (
-      cd "$dev"
-      find include \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \
-        -exec sed '1i#line 1 "{}"' -i '{}' \;
-    )
-  '' + optionalString (hostPlatform.libc == "msvcrt") ''
-    ${stdenv.cc.targetPrefix}ranlib "$out/lib/"*.a
-  '';
+  ]);
 
 in
 
 stdenv.mkDerivation {
   name = "boost-${version}";
 
-  inherit src patches version;
+  inherit src;
+
+  patchFlags = optionalString (hostPlatform.libc == "msvcrt") "-p0";
+  patches = patches ++ optional (hostPlatform.libc == "msvcrt") (fetchurl {
+    url = "https://svn.boost.org/trac/boost/raw-attachment/tickaet/7262/"
+        + "boost-mingw.patch";
+    sha256 = "0s32kwll66k50w6r5np1y5g907b7lcpsjhfgr7rsw7q5syhzddyj";
+  });
 
   meta = {
     homepage = http://boost.org/;
@@ -142,9 +99,13 @@ stdenv.mkDerivation {
           --replace '@rpath/$(<[1]:D=)' "$out/lib/\$(<[1]:D=)";
     fi;
   '' + optionalString (mpi != null) ''
-    cat << EOF > user-config.jam
+    cat << EOF >> user-config.jam
     using mpi : ${mpi}/bin/mpiCC ;
     EOF
+  '' + optionalString (hostPlatform != buildPlatform) ''
+    cat << EOF >> user-config.jam
+    using gcc : cross : ${stdenv.cc.targetPrefix}c++ ;
+    EOF
   '';
 
   NIX_CFLAGS_LINK = stdenv.lib.optionalString stdenv.isDarwin
@@ -152,6 +113,7 @@ stdenv.mkDerivation {
 
   enableParallelBuilding = true;
 
+  nativeBuildInputs = [ which buildPackages.stdenv.cc ];
   buildInputs = [ expat zlib bzip2 libiconv ]
     ++ optional (hostPlatform == buildPlatform) icu
     ++ optional stdenv.isDarwin fixDarwinDylibNames
@@ -159,39 +121,35 @@ stdenv.mkDerivation {
     ++ optional enableNumpy python.pkgs.numpy;
 
   configureScript = "./bootstrap.sh";
-  configureFlags = commonConfigureFlags
-    ++ [ "--with-python=${python.interpreter}" ]
-    ++ optional (hostPlatform == buildPlatform) "--with-icu=${icu.dev}"
-    ++ optional (toolset != null) "--with-toolset=${toolset}";
+  configurePlatforms = [];
+  configureFlags = [
+    "--includedir=$(dev)/include"
+    "--libdir=$(out)/lib"
+    (if enablePython then "--with-python=${python.interpreter}" else "--without-python")
+    (if hostPlatform == buildPlatform then "--with-icu=${icu.dev}" else  "--without-icu")
+  ] ++ optional (toolset != null) "--with-toolset=${toolset}";
 
-  buildPhase = builder nativeB2Args;
+  buildPhase = ''
+    ./b2 ${b2Args}
+  '';
+
+  installPhase = ''
+    # boostbook is needed by some applications
+    mkdir -p $dev/share/boostbook
+    cp -a tools/boostbook/{xsl,dtd} $dev/share/boostbook/
 
-  installPhase = installer nativeB2Args;
+    # Let boost install everything else
+    ./b2 ${b2Args} install
+  '';
 
-  postFixup = fixup;
+  postFixup = ''
+    # Make boost header paths relative so that they are not runtime dependencies
+    find "$dev/include" \( -name '*.hpp' -or -name '*.h' -or -name '*.ipp' \) \
+      -exec sed '1i#line 1 "{}"' -i '{}' \;
+  '' + optionalString (hostPlatform.libc == "msvcrt") ''
+    $RANLIB "$out/lib/"*.a
+  '';
 
   outputs = [ "out" "dev" ];
   setOutputFlags = false;
-
-  crossAttrs = rec {
-    # We want to substitute the contents of configureFlags, removing thus the
-    # usual --build and --host added on cross building.
-    preConfigure = ''
-      export configureFlags="--without-icu ${concatStringsSep " " commonConfigureFlags}"
-      cat << EOF > user-config.jam
-      using gcc : cross : $crossConfig-g++ ;
-      EOF
-    '';
-    buildPhase = builder crossB2Args;
-    installPhase = installer crossB2Args;
-    postFixup = fixup;
-  } // optionalAttrs (hostPlatform.libc == "msvcrt") {
-    patches = fetchurl {
-      url = "https://svn.boost.org/trac/boost/raw-attachment/ticket/7262/"
-          + "boost-mingw.patch";
-      sha256 = "0s32kwll66k50w6r5np1y5g907b7lcpsjhfgr7rsw7q5syhzddyj";
-    };
-
-    patchFlags = "-p0";
-  };
 }
diff --git a/pkgs/development/libraries/cppdb/default.nix b/pkgs/development/libraries/cppdb/default.nix
index 72fa309b721..07c6e1490e7 100644
--- a/pkgs/development/libraries/cppdb/default.nix
+++ b/pkgs/development/libraries/cppdb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, sqlite, libmysql, postgresql, unixODBC }:
+{ stdenv, fetchurl, cmake, sqlite, mysql, postgresql, unixODBC }:
 
 stdenv.mkDerivation rec {
   name = "cppdb";
@@ -11,9 +11,10 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  buildInputs = [ cmake sqlite libmysql postgresql unixODBC ];
+  buildInputs = [ cmake sqlite mysql.connector-c postgresql unixODBC ];
 
   cmakeFlags = [ "--no-warn-unused-cli" ];
+  NIX_CFLAGS_COMPILE = [ "-I${mysql.connector-c}/include/mysql" "-L${mysql.connector-c}/lib/mysql" ];
 
   meta = with stdenv.lib; {
     homepage = http://cppcms.com/sql/cppdb/;
@@ -23,4 +24,3 @@ stdenv.mkDerivation rec {
     maintainers = [ maintainers.juliendehos ];
   };
 }
-
diff --git a/pkgs/development/libraries/gdal/default.nix b/pkgs/development/libraries/gdal/default.nix
index 984d3da8119..0f1637a87e9 100644
--- a/pkgs/development/libraries/gdal/default.nix
+++ b/pkgs/development/libraries/gdal/default.nix
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     "--with-poppler=${poppler.dev}" # optional
     "--with-libz=${zlib.dev}"       # optional
     "--with-pg=${postgresql}/bin/pg_config"
-    "--with-mysql=${mysql.lib.dev}/bin/mysql_config"
+    "--with-mysql=${mysql.connector-c or mysql}/bin/mysql_config"
     "--with-geotiff=${libgeotiff}"
     "--with-sqlite3=${sqlite.dev}"
     "--with-spatialite=${libspatialite}"
diff --git a/pkgs/development/libraries/gdal/gdal-1_11.nix b/pkgs/development/libraries/gdal/gdal-1_11.nix
index c9f0c076101..7a80ce7fdb6 100644
--- a/pkgs/development/libraries/gdal/gdal-1_11.nix
+++ b/pkgs/development/libraries/gdal/gdal-1_11.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, unzip, libjpeg, libtiff, zlib
-, postgresql, mysql, libgeotiff, python, pythonPackages, proj, geos, openssl
+, postgresql, mysql57, libgeotiff, python, pythonPackages, proj, geos, openssl
 , libpng }:
 
 stdenv.mkDerivation rec {
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
     "--with-libz=${zlib.dev}"       # optional
 
     "--with-pg=${postgresql}/bin/pg_config"
-    "--with-mysql=${mysql.lib.dev}/bin/mysql_config"
+    "--with-mysql=${mysql57.connector-c}/bin/mysql_config"
     "--with-geotiff=${libgeotiff}"
     "--with-python"               # optional
     "--with-static-proj4=${proj}" # optional
diff --git a/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh b/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh
index ba7ab82f50b..5a7dcd79299 100644
--- a/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh
+++ b/pkgs/development/libraries/gdk-pixbuf/setup-hook.sh
@@ -14,4 +14,4 @@ findGdkPixbufLoaders() {
 
 }
 
-envHooks+=(findGdkPixbufLoaders)
+addEnvHooks "$hostOffset" findGdkPixbufLoaders
diff --git a/pkgs/development/libraries/glib/setup-hook.sh b/pkgs/development/libraries/glib/setup-hook.sh
index c5cf293902c..98341376fdf 100644
--- a/pkgs/development/libraries/glib/setup-hook.sh
+++ b/pkgs/development/libraries/glib/setup-hook.sh
@@ -5,7 +5,7 @@ make_glib_find_gsettings_schemas() {
         addToSearchPath GSETTINGS_SCHEMAS_PATH "$1/share/gsettings-schemas/"*
     fi
 }
-envHooks+=(make_glib_find_gsettings_schemas)
+addEnvHooks "$hostOffset" make_glib_find_gsettings_schemas
 
 # Install gschemas, if any, in a package-specific directory
 glibPreInstallPhase() {
diff --git a/pkgs/development/libraries/glibc/2.26-75to115.diff.gz b/pkgs/development/libraries/glibc/2.26-75to115.diff.gz
new file mode 100644
index 00000000000..9bf1a4f7d39
--- /dev/null
+++ b/pkgs/development/libraries/glibc/2.26-75to115.diff.gz
Binary files differdiff --git a/pkgs/development/libraries/glibc/allow-kernel-2.6.32.patch b/pkgs/development/libraries/glibc/allow-kernel-2.6.32.patch
new file mode 100644
index 00000000000..ce18b874c42
--- /dev/null
+++ b/pkgs/development/libraries/glibc/allow-kernel-2.6.32.patch
@@ -0,0 +1,39 @@
+diff --git a/sysdeps/unix/sysv/linux/configure b/sysdeps/unix/sysv/linux/configure
+index cace758c01..38fe7fe0b0 100644
+--- a/sysdeps/unix/sysv/linux/configure
++++ b/sysdeps/unix/sysv/linux/configure
+@@ -69,7 +69,7 @@ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kernel header at least $minimum_kernel" >&5
+ $as_echo_n "checking for kernel header at least $minimum_kernel... " >&6; }
+ decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`;
+-abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
++abinum=`echo "2.6.32.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+ #include <linux/version.h>
+diff --git a/sysdeps/unix/sysv/linux/configure.ac b/sysdeps/unix/sysv/linux/configure.ac
+index 13abda0a51..6abc12eaed 100644
+--- a/sysdeps/unix/sysv/linux/configure.ac
++++ b/sysdeps/unix/sysv/linux/configure.ac
+@@ -50,7 +50,7 @@ fi
+ AC_MSG_CHECKING(for kernel header at least $minimum_kernel)
+ changequote(,)dnl
+ decnum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/(\1 * 65536 + \2 * 256 + \3)/'`;
+-abinum=`echo "$minimum_kernel.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
++abinum=`echo "2.6.32.0.0.0" | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1,\2,\3/'`;
+ changequote([,])dnl
+ AC_TRY_COMPILE([#include <linux/version.h>
+ #if LINUX_VERSION_CODE < $decnum
+diff --git a/sysdeps/unix/sysv/linux/dl-osinfo.h b/sysdeps/unix/sysv/linux/dl-osinfo.h
+index 823cd8224d..482caaeeec 100644
+--- a/sysdeps/unix/sysv/linux/dl-osinfo.h
++++ b/sysdeps/unix/sysv/linux/dl-osinfo.h
+@@ -39,7 +39,7 @@
+ 	  GLRO(dl_osversion) = version;					      \
+ 									      \
+ 	/* Now we can test with the required version.  */		      \
+-	if (__LINUX_KERNEL_VERSION > 0 && version < __LINUX_KERNEL_VERSION)   \
++	if (__LINUX_KERNEL_VERSION > 0 && version < __LINUX_KERNEL_VERSION && version != 0x020620)   \
+ 	  /* Not sufficent.  */						      \
+ 	  FATAL ("FATAL: kernel too old\n");				      \
+       }									      \
diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix
index 86f3be15fea..cfec3209b98 100644
--- a/pkgs/development/libraries/glibc/common.nix
+++ b/pkgs/development/libraries/glibc/common.nix
@@ -20,7 +20,7 @@
 
 let
   version = "2.26";
-  patchSuffix = "-75";
+  patchSuffix = "-115";
   sha256 = "1ggnj1hzjym7sn93rbwydcqd562q73lsb7g7kd199g6j9j9hlkp5";
   cross = if buildPlatform != hostPlatform then hostPlatform else null;
 in
@@ -47,6 +47,7 @@ stdenv.mkDerivation ({
           $ git show --reverse glibc-2.25..release/2.25/master | gzip -n -9 --rsyncable - > 2.25-49.patch.gz
       */
       ./2.26-75.patch.gz
+      ./2.26-75to115.diff.gz
 
       /* Have rpcgen(1) look for cpp(1) in $PATH.  */
       ./rpcgen-path.patch
@@ -64,6 +65,25 @@ stdenv.mkDerivation ({
          "/bin:/usr/bin", which is inappropriate on NixOS machines. This
          patch extends the search path by "/run/current-system/sw/bin". */
       ./fix_path_attribute_in_getconf.patch
+
+      /* Allow running with RHEL 6 -like kernels.  The patch adds an exception
+        for glibc to accept 2.6.32 and to tag the ELFs as 2.6.32-compatible
+        (otherwise the loader would refuse libc).
+        Note that glibc will fully work only on their heavily patched kernels
+        and we lose early mismatch detection on 2.6.32.
+
+        On major glibc updates we should check that the patched kernel supports
+        all the required features.  ATM it's verified up to glibc-2.26-115.
+        # HOWTO: check glibc sources for changes in kernel requirements
+        git log -p glibc-2.25.. sysdeps/unix/sysv/linux/x86_64/kernel-features.h sysdeps/unix/sysv/linux/kernel-features.h
+        # get kernel sources (update the URL)
+        mkdir tmp && cd tmp
+        curl http://vault.centos.org/6.9/os/Source/SPackages/kernel-2.6.32-696.el6.src.rpm | rpm2cpio - | cpio -idmv
+        tar xf linux-*.bz2
+        # check syscall presence, for example
+        less linux-*?/arch/x86/kernel/syscall_table_32.S
+       */
+      ./allow-kernel-2.6.32.patch
     ]
     ++ lib.optional stdenv.isx86_64 ./fix-x64-abi.patch;
 
@@ -121,7 +141,7 @@ stdenv.mkDerivation ({
 
   outputs = [ "out" "bin" "dev" "static" ];
 
-  nativeBuildInputs = lib.optional (cross != null) buildPackages.stdenv.cc;
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
   buildInputs = lib.optionals withGd [ gd libpng ];
 
   # Needed to install share/zoneinfo/zone.tab.  Set to impure /bin/sh to
diff --git a/pkgs/development/libraries/gmp/6.x.nix b/pkgs/development/libraries/gmp/6.x.nix
index e3bacc86d58..dce052f8baa 100644
--- a/pkgs/development/libraries/gmp/6.x.nix
+++ b/pkgs/development/libraries/gmp/6.x.nix
@@ -19,8 +19,8 @@ let self = stdenv.mkDerivation rec {
   outputs = [ "out" "dev" "info" ];
   passthru.static = self.out;
 
-  nativeBuildInputs = [ m4 ]
-    ++ stdenv.lib.optional (buildPlatform != hostPlatform) buildPackages.stdenv.cc;
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ m4 ];
 
   configureFlags =
     # Build a "fat binary", with routines for several sub-architectures
diff --git a/pkgs/development/libraries/gobject-introspection/setup-hook.sh b/pkgs/development/libraries/gobject-introspection/setup-hook.sh
index 583d8475ec3..a79ce05a38d 100644
--- a/pkgs/development/libraries/gobject-introspection/setup-hook.sh
+++ b/pkgs/development/libraries/gobject-introspection/setup-hook.sh
@@ -1,5 +1,4 @@
 make_gobject_introspection_find_gir_files() {
-
     # required for .typelib files, eg mypaint git version
     if [ -d "$1/lib/girepository-1.0" ]; then
       addToSearchPath GI_TYPELIB_PATH $1/lib/girepository-1.0
@@ -11,11 +10,18 @@ make_gobject_introspection_find_gir_files() {
     fi
 }
 
-envHooks+=(make_gobject_introspection_find_gir_files)
+addEnvHooks "$hostOffset" make_gobject_introspection_find_gir_files
+
+giDiscoverSelf() {
+    if [ -d "$prefix/lib/girepository-1.0" ]; then
+      addToSearchPath GI_TYPELIB_PATH $prefix/lib/girepository-1.0
+    fi
+}
+
+preFixupHooks+=(giDiscoverSelf)
 
 _multioutMoveGlibGir() {
   moveToOutput share/gir-1.0 "${!outputDev}"
 }
 
 preFixupHooks+=(_multioutMoveGlibGir)
-
diff --git a/pkgs/development/libraries/grantlee/5/setup-hook.sh b/pkgs/development/libraries/grantlee/5/setup-hook.sh
index aaa64868dc9..b51cb4a3190 100644
--- a/pkgs/development/libraries/grantlee/5/setup-hook.sh
+++ b/pkgs/development/libraries/grantlee/5/setup-hook.sh
@@ -10,8 +10,4 @@ _grantleeEnvHook() {
         propagatedUserEnvPkgs+=" $1"
     fi
 }
-if [ "$crossEnv" ]; then
-    crossEnvHooks+=(_grantleeEnvHook)
-else
-    envHooks+=(_grantleeEnvHook)
-fi
+addEnvHooks "$hostOffset" _grantleeEnvHook
diff --git a/pkgs/development/libraries/gstreamer/core/setup-hook.sh b/pkgs/development/libraries/gstreamer/core/setup-hook.sh
index 3dd7812ece6..b8c741af578 100644
--- a/pkgs/development/libraries/gstreamer/core/setup-hook.sh
+++ b/pkgs/development/libraries/gstreamer/core/setup-hook.sh
@@ -5,5 +5,5 @@ addGstreamer1LibPath () {
     fi
 }
 
-envHooks+=(addGstreamer1LibPath)
+addEnvHooks "$hostOffset" addGstreamer1LibPath
 
diff --git a/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh b/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh
index e89aeda5bc1..65ce2611251 100644
--- a/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh
+++ b/pkgs/development/libraries/gstreamer/legacy/gstreamer/setup-hook.sh
@@ -5,4 +5,4 @@ addGstreamerLibPath () {
     fi
 }
 
-envHooks+=(addGstreamerLibPath)
+addEnvHooks "$hostOffset" addGstreamerLibPath
diff --git a/pkgs/development/libraries/gtk+/2.x.nix b/pkgs/development/libraries/gtk+/2.x.nix
index 45222b7d7fc..169fd119d51 100644
--- a/pkgs/development/libraries/gtk+/2.x.nix
+++ b/pkgs/development/libraries/gtk+/2.x.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, pkgconfig, gettext, glib, atk, pango, cairo, perl, xorg
-, gdk_pixbuf, libintlOrEmpty, xlibsWrapper
+, gdk_pixbuf, libintlOrEmpty, xlibsWrapper, gobjectIntrospection
 , xineramaSupport ? stdenv.isLinux
 , cupsSupport ? true, cups ? null
 , gdktarget ? "x11"
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
 
   setupHook = ./setup-hook.sh;
 
-  nativeBuildInputs = [ setupHook perl pkgconfig gettext ];
+  nativeBuildInputs = [ setupHook perl pkgconfig gettext gobjectIntrospection ];
 
   patches = [ ./2.0-immodules.cache.patch ./gtk2-theme-paths.patch ];
 
diff --git a/pkgs/development/libraries/kdb/default.nix b/pkgs/development/libraries/kdb/default.nix
index 399d5914c2d..e85190cdfce 100644
--- a/pkgs/development/libraries/kdb/default.nix
+++ b/pkgs/development/libraries/kdb/default.nix
@@ -1,7 +1,7 @@
 {
   mkDerivation, lib, fetchurl,
   extra-cmake-modules,
-  qtbase, qttranslations, kcoreaddons, python2, sqlite, postgresql, libmysql
+  qtbase, qttranslations, kcoreaddons, python2, sqlite, postgresql, mysql
 }:
 
 mkDerivation rec {
@@ -16,7 +16,7 @@ mkDerivation rec {
 
   nativeBuildInputs = [ extra-cmake-modules ];
 
-  buildInputs = [ qttranslations kcoreaddons python2 sqlite postgresql libmysql ];
+  buildInputs = [ qttranslations kcoreaddons python2 sqlite postgresql mysql.connector-c ];
 
   propagatedBuildInputs = [ qtbase ];
 
diff --git a/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh
index c1b1e21852c..88091e78a0c 100644
--- a/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh
+++ b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh
@@ -2,7 +2,7 @@ _ecmEnvHook() {
     addToSearchPath XDG_DATA_DIRS "$1/share"
     addToSearchPath XDG_CONFIG_DIRS "$1/etc/xdg"
 }
-envHooks+=(_ecmEnvHook)
+addEnvHooks "$targetOffset" _ecmEnvHook
 
 _ecmPreConfigureHook() {
     # Because we need to use absolute paths here, we must set *all* the paths.
diff --git a/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix b/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix
index 661e89e3078..0a600fe8d05 100644
--- a/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix
@@ -8,10 +8,18 @@
 mkDerivation {
   name = "kdoctools";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedNativeBuildInputs = [ perl perlPackages.URI ];
+  nativeBuildInputs = [
+    extra-cmake-modules
+    # The build system insists on having native Perl.
+    perl perlPackages.URI
+  ];
+  propagatedBuildInputs = [
+    # kdoctools at runtime actually needs Perl for the platform kdoctools is
+    # running on, not necessarily native perl.
+    perl perlPackages.URI
+    qtbase
+  ];
   buildInputs = [ karchive ki18n ];
-  propagatedBuildInputs = [ qtbase ];
   outputs = [ "out" "dev" ];
   patches = [ ./kdoctools-no-find-docbook-xml.patch ];
   cmakeFlags = [
diff --git a/pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh b/pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh
index 5cfffbd622d..2928d9b34db 100644
--- a/pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh
+++ b/pkgs/development/libraries/kde-frameworks/kdoctools/setup-hook.sh
@@ -2,4 +2,4 @@ addXdgData() {
     addToSearchPath XDG_DATA_DIRS "$1/share"
 }
 
-envHooks+=(addXdgData)
+addEnvHooks "$targetOffset" addXdgData
diff --git a/pkgs/development/libraries/libagar/default.nix b/pkgs/development/libraries/libagar/default.nix
index 1c9e8eca0d5..ee984a53b4c 100644
--- a/pkgs/development/libraries/libagar/default.nix
+++ b/pkgs/development/libraries/libagar/default.nix
@@ -20,15 +20,16 @@ stdenv.mkDerivation rec {
     "--with-gettext=${gettext}"
     "--with-jpeg=${libjpeg.dev}"
     "--with-gl=${mesa}"
-    "--with-mysql=yes"
+    "--with-mysql=${mysql.connector-c}"
     "--with-manpages=yes"
   ];
 
   outputs = [ "out" "devdoc" ];
 
   nativeBuildInputs = [ pkgconfig libtool gettext ];
+
   buildInputs = [
-    bsdbuild perl xlibsWrapper libXinerama SDL mesa  mysql.client mandoc
+    bsdbuild perl xlibsWrapper libXinerama SDL mesa mysql.connector-c mandoc
     freetype.dev libpng libjpeg.dev fontconfig portaudio libsndfile
   ];
 
diff --git a/pkgs/development/libraries/libassuan/default.nix b/pkgs/development/libraries/libassuan/default.nix
index bad2a060cdc..94369449ff3 100644
--- a/pkgs/development/libraries/libassuan/default.nix
+++ b/pkgs/development/libraries/libassuan/default.nix
@@ -1,11 +1,11 @@
 { fetchurl, stdenv, pth, libgpgerror }:
 
 stdenv.mkDerivation rec {
-  name = "libassuan-2.4.3";
+  name = "libassuan-2.5.1";
 
   src = fetchurl {
     url = "mirror://gnupg/libassuan/${name}.tar.bz2";
-    sha256 = "0w9bmasln4z8mn16s1is55a06w3nv8jbyal496z5jvr5vcxkm112";
+    sha256 = "0jb4nb4nrjr949gd3lw8lh4v5d6qigxaq6xwy24w5apjnhvnrya7";
   };
 
   outputs = [ "out" "dev" "info" ];
diff --git a/pkgs/development/libraries/libdbi-drivers/default.nix b/pkgs/development/libraries/libdbi-drivers/default.nix
index 77c09f3ed15..2a03efd632f 100644
--- a/pkgs/development/libraries/libdbi-drivers/default.nix
+++ b/pkgs/development/libraries/libdbi-drivers/default.nix
@@ -1,5 +1,7 @@
 { stdenv, fetchurl, libdbi
-, libmysql ? null, sqlite ? null, postgresql ? null
+, mysql ? null
+, sqlite ? null
+, postgresql ? null
 }:
 
 with stdenv.lib;
@@ -11,7 +13,7 @@ stdenv.mkDerivation rec {
     sha256 = "0m680h8cc4428xin4p733azysamzgzcmv4psjvraykrsaz6ymlj3";
   };
 
-  buildInputs = [ libdbi libmysql sqlite postgresql ];
+  buildInputs = [ libdbi sqlite postgresql ] ++ optional (mysql != null) mysql.connector-c;
 
   postPatch = ''
     sed -i '/SQLITE3_LIBS/ s/-lsqlite/-lsqlite3/' configure;
@@ -24,16 +26,18 @@ stdenv.mkDerivation rec {
     "--enable-libdbi"
     "--with-dbi-incdir=${libdbi}/include"
     "--with-dbi-libdir=${libdbi}/lib"
-  ] ++ optionals (libmysql != null) [
+  ] ++ optionals (mysql != null) [
     "--with-mysql"
-  ] ++ optionals (postgresql != null) [
-    "--with-pgsql"
-    "--with-pgsql_incdir=${postgresql}/include"
-    "--with-pgsql_libdir=${postgresql.lib}/lib"
+    "--with-mysql-incdir=${mysql.connector-c}/include/mysql"
+    "--with-mysql-libdir=${mysql.connector-c}/lib/mysql"
   ] ++ optionals (sqlite != null) [
     "--with-sqlite3"
     "--with-sqlite3-incdir=${sqlite.dev}/include/sqlite"
     "--with-sqlite3-libdir=${sqlite.out}/lib/sqlite"
+  ] ++ optionals (postgresql != null) [
+    "--with-pgsql"
+    "--with-pgsql_incdir=${postgresql}/include"
+    "--with-pgsql_libdir=${postgresql.lib}/lib"
   ];
 
   installFlags = [ "DESTDIR=\${out}" ];
diff --git a/pkgs/development/libraries/libdrm/default.nix b/pkgs/development/libraries/libdrm/default.nix
index 533d5d4cac8..e5e1e2e7a39 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.88";
+  name = "libdrm-2.4.89";
 
   src = fetchurl {
     url = "http://dri.freedesktop.org/libdrm/${name}.tar.bz2";
-    sha256 = "b5e55dbac2124e742e639f5b8553e8b7395863bf73dab4f77e99fe2fc25572b5";
+    sha256 = "629f9782aabbb4809166de5f24d26fe0766055255038f16935602d89f136a02e";
   };
 
   outputs = [ "out" "dev" "bin" ];
diff --git a/pkgs/development/libraries/libelf/default.nix b/pkgs/development/libraries/libelf/default.nix
index bd0d23bd0cd..bb1dbe51765 100644
--- a/pkgs/development/libraries/libelf/default.nix
+++ b/pkgs/development/libraries/libelf/default.nix
@@ -1,5 +1,5 @@
-{ stdenv, fetchurl
-, gettext, glibc
+{ stdenv
+, fetchurl, autoreconfHook, gettext
 , buildPlatform, hostPlatform
 }:
 
@@ -17,12 +17,20 @@ stdenv.mkDerivation rec {
 
   doCheck = true;
 
-  # Libelf's custom NLS macros fail to determine the catalog file extension on
-  # Darwin, so disable NLS for now.
-  # FIXME: Eventually make Gettext a build input on all platforms.
-  configureFlags = stdenv.lib.optional hostPlatform.isDarwin "--disable-nls";
-
-  nativeBuildInputs = [ gettext ];
+  configureFlags = []
+       # Configure check for dynamic lib support is broken, see
+       # http://lists.uclibc.org/pipermail/uclibc-cvs/2005-August/019383.html
+    ++ stdenv.lib.optional (hostPlatform != buildPlatform) "mr_cv_target_elf=yes"
+       # Libelf's custom NLS macros fail to determine the catalog file extension
+       # on Darwin, so disable NLS for now.
+    ++ stdenv.lib.optional hostPlatform.isDarwin "--disable-nls";
+
+  nativeBuildInputs = [ gettext ]
+       # Need to regenerate configure script with newer version in order to pass
+       # "mr_cv_target_elf=yes", but `autoreconfHook` brings in `makeWrapper`
+       # which doesn't work with the bootstrapTools bash, so can only do this
+       # for cross builds when `stdenv.shell` is a newer bash.
+    ++ stdenv.lib.optional (hostPlatform != buildPlatform) autoreconfHook;
 
   meta = {
     description = "ELF object file access library";
diff --git a/pkgs/development/libraries/libgcrypt/default.nix b/pkgs/development/libraries/libgcrypt/default.nix
index e32ba050c38..397000fc7d2 100644
--- a/pkgs/development/libraries/libgcrypt/default.nix
+++ b/pkgs/development/libraries/libgcrypt/default.nix
@@ -4,11 +4,11 @@ assert enableCapabilities -> stdenv.isLinux;
 
 stdenv.mkDerivation rec {
   name = "libgcrypt-${version}";
-  version = "1.8.1";
+  version = "1.8.2";
 
   src = fetchurl {
     url = "mirror://gnupg/libgcrypt/${name}.tar.bz2";
-    sha256 = "1cvqd9jk5qshbh48yh3ixw4zyr4n5k50r3475rrh20xfn7w7aa3s";
+    sha256 = "01sca9m8hm6b5v8hmqsfdjhyz013869p1f0fxw9ln52qfnp4q1n8";
   };
 
   outputs = [ "out" "dev" "info" ];
diff --git a/pkgs/development/libraries/libnftnl/default.nix b/pkgs/development/libraries/libnftnl/default.nix
index 074c1a9dfd2..060f5ba4934 100644
--- a/pkgs/development/libraries/libnftnl/default.nix
+++ b/pkgs/development/libraries/libnftnl/default.nix
@@ -1,11 +1,11 @@
 { stdenv, fetchurl, pkgconfig, libmnl }:
 
 stdenv.mkDerivation rec {
-  name = "libnftnl-1.0.7";
+  name = "libnftnl-1.0.8";
 
   src = fetchurl {
     url = "http://netfilter.org/projects/libnftnl/files/${name}.tar.bz2";
-    sha256 = "10irjrylcfkbp11617yr19vpfhgl54w0kw02jhj0i1abqv5nxdlv";
+    sha256 = "0f10cfiyl4c0f8k3brxfrw28x7a6qvrakaslg4jgqncwxycxggg6";
   };
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/development/libraries/libopcodes/default.nix b/pkgs/development/libraries/libopcodes/default.nix
index 7ffc40f1494..d6d6989761b 100644
--- a/pkgs/development/libraries/libopcodes/default.nix
+++ b/pkgs/development/libraries/libopcodes/default.nix
@@ -19,7 +19,8 @@ stdenv.mkDerivation rec {
     find . ../include/opcode -type f -exec sed {} -i -e 's/"bfd.h"/<bfd.h>/' \;
   '';
 
-  nativeBuildInputs = [ autoreconfHook264 bison buildPackages.stdenv.cc ];
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ autoreconfHook264 bison ];
   buildInputs = [ libiberty ];
   # dis-asm.h includes bfd.h
   propagatedBuildInputs = [ libbfd ];
diff --git a/pkgs/development/libraries/librdf/redland.nix b/pkgs/development/libraries/librdf/redland.nix
index 8e6fa005635..402af5d6f58 100644
--- a/pkgs/development/libraries/librdf/redland.nix
+++ b/pkgs/development/libraries/librdf/redland.nix
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ perl pkgconfig ];
 
   buildInputs = [ openssl libxslt curl pcre libxml2 ]
-    ++ stdenv.lib.optional withMysql mysql
+    ++ stdenv.lib.optional withMysql mysql.connector-c
     ++ stdenv.lib.optional withSqlite sqlite
     ++ stdenv.lib.optional withPostgresql postgresql
     ++ stdenv.lib.optional withBdb db;
diff --git a/pkgs/development/libraries/librep/setup-hook.sh b/pkgs/development/libraries/librep/setup-hook.sh
index 420d63d6c51..4d875b69330 100644
--- a/pkgs/development/libraries/librep/setup-hook.sh
+++ b/pkgs/development/libraries/librep/setup-hook.sh
@@ -2,4 +2,4 @@ addRepDLLoadPath () {
     addToSearchPath REP_DL_LOAD_PATH $1/lib/rep
 }
 
-envHooks+=(addRepDLLoadPath)
+addEnvHooks "$hostOffset" addRepDLLoadPath
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index fca99550a3c..4c00df4c17d 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -66,7 +66,7 @@ let
 in
 
 let
-  version = "17.2.7";
+  version = "17.2.8";
   branch  = head (splitString "." version);
   driverLink = "/run/opengl-driver" + optionalString stdenv.isi686 "-32";
 in
@@ -81,7 +81,7 @@ 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 = "0s3slgjxnx482yw0knn4a6alsy2cq28rah6hnjbmf12mvyldxksh";
+    sha256 = "0pq9kmmyllgd63d936f3x1zsg7sqaswx47khbn0gvbgari2h753f";
   };
 
   prePatch = "patchShebangs .";
diff --git a/pkgs/development/libraries/ncurses/default.nix b/pkgs/development/libraries/ncurses/default.nix
index 9aade8b9672..79414f016d3 100644
--- a/pkgs/development/libraries/ncurses/default.nix
+++ b/pkgs/development/libraries/ncurses/default.nix
@@ -37,10 +37,11 @@ stdenv.mkDerivation rec {
   # Only the C compiler, and explicitly not C++ compiler needs this flag on solaris:
   CFLAGS = lib.optionalString stdenv.isSunOS "-D_XOPEN_SOURCE_EXTENDED";
 
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
   nativeBuildInputs = [
     pkgconfig
   ] ++ lib.optionals (buildPlatform != hostPlatform) [
-    buildPackages.ncurses buildPackages.stdenv.cc
+    buildPackages.ncurses
   ];
   buildInputs = lib.optional (mouseSupport && stdenv.isLinux) gpm;
 
diff --git a/pkgs/development/libraries/opendbx/default.nix b/pkgs/development/libraries/opendbx/default.nix
index 37afa3fd507..48ec5141e34 100644
--- a/pkgs/development/libraries/opendbx/default.nix
+++ b/pkgs/development/libraries/opendbx/default.nix
@@ -12,10 +12,10 @@ stdenv.mkDerivation rec {
   };
 
   preConfigure = ''
-    export CPPFLAGS="-I${getDev mysql.client}/include/mysql"
-    export LDFLAGS="-L${getLib mysql.client}/lib/mysql -L${getLib postgresql}/lib"
+    export CPPFLAGS="-I${mysql.connector-c}/include/mysql"
+    export LDFLAGS="-L${mysql.connector-c}/lib/mysql -L${postgresql}/lib"
     configureFlagsArray=(--with-backends="mysql pgsql sqlite3")
   '';
 
-  buildInputs = [ readline mysql.client postgresql sqlite ];
+  buildInputs = [ readline mysql.connector-c postgresql sqlite ];
 }
diff --git a/pkgs/development/libraries/pcre/default.nix b/pkgs/development/libraries/pcre/default.nix
index e6055151301..b34c9ff31f2 100644
--- a/pkgs/development/libraries/pcre/default.nix
+++ b/pkgs/development/libraries/pcre/default.nix
@@ -33,6 +33,9 @@ in stdenv.mkDerivation rec {
 
   buildInputs = optional (hostPlatform.libc == "msvcrt") windows.mingw_w64_pthreads;
 
+  # https://bugs.exim.org/show_bug.cgi?id=2173
+  patches = [ ./stacksize-detection.patch ];
+
   doCheck = !(with hostPlatform; isCygwin || isFreeBSD) && hostPlatform == buildPlatform;
     # XXX: test failure on Cygwin
     # we are running out of stack on both freeBSDs on Hydra
diff --git a/pkgs/development/libraries/pcre/stacksize-detection.patch b/pkgs/development/libraries/pcre/stacksize-detection.patch
new file mode 100644
index 00000000000..4bc97069b1e
--- /dev/null
+++ b/pkgs/development/libraries/pcre/stacksize-detection.patch
@@ -0,0 +1,16 @@
+diff --git a/pcre_exec.c b/pcre_exec.c
+--- a/pcre_exec.c
++++ b/pcre_exec.c
+@@ -509,6 +509,12 @@
+                  (e.g. stopped by repeated call or recursion limit)
+ */
+ 
++#ifdef __GNUC__
++static int
++match(REGISTER PCRE_PUCHAR eptr, REGISTER const pcre_uchar *ecode,
++  PCRE_PUCHAR mstart, int offset_top, match_data *md, eptrblock *eptrb,
++  unsigned int rdepth) __attribute__((noinline,noclone));
++#endif
+ static int
+ match(REGISTER PCRE_PUCHAR eptr, REGISTER const pcre_uchar *ecode,
+   PCRE_PUCHAR mstart, int offset_top, match_data *md, eptrblock *eptrb,
diff --git a/pkgs/development/libraries/poco/default.nix b/pkgs/development/libraries/poco/default.nix
index 0f971cff64d..40755913737 100644
--- a/pkgs/development/libraries/poco/default.nix
+++ b/pkgs/development/libraries/poco/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, pkgconfig, zlib, pcre, expat, sqlite, openssl, unixODBC, libmysql }:
+{ stdenv, fetchurl, cmake, pkgconfig, zlib, pcre, expat, sqlite, openssl, unixODBC, mysql }:
 
 stdenv.mkDerivation rec {
   name = "poco-${version}";
@@ -12,10 +12,9 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkgconfig ];
 
-  buildInputs = [ zlib pcre expat sqlite openssl unixODBC libmysql ];
+  buildInputs = [ zlib pcre expat sqlite openssl unixODBC mysql.connector-c ];
 
   cmakeFlags = [
-    "-DMYSQL_INCLUDE_DIR=${libmysql.dev}/include/mysql"
     "-DPOCO_UNBUNDLED=ON"
   ];
 
diff --git a/pkgs/development/libraries/qt-3/default.nix b/pkgs/development/libraries/qt-3/default.nix
index 6d92de001cb..1bc4fd1085e 100644
--- a/pkgs/development/libraries/qt-3/default.nix
+++ b/pkgs/development/libraries/qt-3/default.nix
@@ -49,7 +49,7 @@ stdenv.mkDerivation {
       -I${randrproto}/include" else "-no-xrandr"}
     ${if xineramaSupport then "-xinerama -L${libXinerama.out}/lib -I${libXinerama.dev}/include" else "-no-xinerama"}
     ${if cursorSupport then "-L${libXcursor.out}/lib -I${libXcursor.dev}/include" else ""}
-    ${if mysqlSupport then "-qt-sql-mysql -L${stdenv.lib.getLib mysql.client}/lib/mysql -I${mysql.client}/include/mysql" else ""}
+    ${if mysqlSupport then "-qt-sql-mysql -L${mysql.connector-c}/lib/mysql -I${mysql.connector-c}/include/mysql" else ""}
     ${if xftSupport then "-xft
       -L${libXft.out}/lib -I${libXft.dev}/include
       -L${libXft.freetype.out}/lib -I${libXft.freetype.dev}/include
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 32691faa689..488306fc1ce 100644
--- a/pkgs/development/libraries/qt-4.x/4.8/default.nix
+++ b/pkgs/development/libraries/qt-4.x/4.8/default.nix
@@ -160,7 +160,7 @@ stdenv.mkDerivation rec {
   buildInputs =
     [ cups # Qt dlopen's libcups instead of linking to it
       postgresql sqlite libjpeg libmng libtiff icu ]
-    ++ optionals (mysql != null) [ mysql.lib ]
+    ++ optionals (mysql != null) [ mysql.connector-c ]
     ++ optionals gtkStyle [ gtk2 gdk_pixbuf ]
     ++ optionals stdenv.isDarwin [ cf-private ApplicationServices OpenGL Cocoa AGL libcxx libobjc ];
 
diff --git a/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh b/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh
index 8ec7eeda8ae..754a75cbef4 100644
--- a/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh
+++ b/pkgs/development/libraries/qt-5/hooks/qtbase-setup-hook.sh
@@ -42,11 +42,7 @@ qtEnvHook() {
         propagatedUserEnvPkgs+=" $1"
     fi
 }
-if [ "$crossConfig" ]; then
-   crossEnvHooks+=(qtEnvHook)
-else
-   envHooks+=(qtEnvHook)
-fi
+envHostTargetHooks+=(qtEnvHook)
 
 postPatchMkspecs() {
     local bin="${!outputBin}"
diff --git a/pkgs/development/libraries/qt-5/modules/qtbase.nix b/pkgs/development/libraries/qt-5/modules/qtbase.nix
index 172b20bc51b..5f65f71bbba 100644
--- a/pkgs/development/libraries/qt-5/modules/qtbase.nix
+++ b/pkgs/development/libraries/qt-5/modules/qtbase.nix
@@ -80,7 +80,7 @@ stdenv.mkDerivation {
     )
     ++ lib.optional developerBuild gdb
     ++ lib.optional (cups != null) cups
-    ++ lib.optional (mysql != null) mysql.lib
+    ++ lib.optional (mysql != null) mysql.connector-c
     ++ lib.optional (postgresql != null) postgresql;
 
   nativeBuildInputs =
diff --git a/pkgs/development/libraries/rep-gtk/setup-hook.sh b/pkgs/development/libraries/rep-gtk/setup-hook.sh
index 420d63d6c51..4d875b69330 100644
--- a/pkgs/development/libraries/rep-gtk/setup-hook.sh
+++ b/pkgs/development/libraries/rep-gtk/setup-hook.sh
@@ -2,4 +2,4 @@ addRepDLLoadPath () {
     addToSearchPath REP_DL_LOAD_PATH $1/lib/rep
 }
 
-envHooks+=(addRepDLLoadPath)
+addEnvHooks "$hostOffset" addRepDLLoadPath
diff --git a/pkgs/development/libraries/slib/setup-hook.sh b/pkgs/development/libraries/slib/setup-hook.sh
index 62b72d6dc0a..3c7e91e8188 100644
--- a/pkgs/development/libraries/slib/setup-hook.sh
+++ b/pkgs/development/libraries/slib/setup-hook.sh
@@ -10,4 +10,4 @@ addSlibPath () {
     fi
 }
 
-envHooks+=(addSlibPath)
+addEnvHooks "$hostOffset" addSlibPath
diff --git a/pkgs/development/libraries/tntdb/default.nix b/pkgs/development/libraries/tntdb/default.nix
index d11a5c344c9..75a494cfbde 100644
--- a/pkgs/development/libraries/tntdb/default.nix
+++ b/pkgs/development/libraries/tntdb/default.nix
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
     sha256 = "0js79dbvkic30bzw1pf26m64vs2ssw2sbj55w1dc0sy69dlv4fh9";
   };
 
-  buildInputs = [ cxxtools postgresql mysql sqlite zlib openssl ];
+  buildInputs = [ cxxtools postgresql mysql.connector-c sqlite zlib openssl ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/unixODBCDrivers/default.nix b/pkgs/development/libraries/unixODBCDrivers/default.nix
index 233fdd90254..badcb7e661b 100644
--- a/pkgs/development/libraries/unixODBCDrivers/default.nix
+++ b/pkgs/development/libraries/unixODBCDrivers/default.nix
@@ -37,19 +37,12 @@
     };
 
     nativeBuildInputs = [ cmake ];
-    buildInputs = [ unixODBC mariadb.lib ];
+    buildInputs = [ unixODBC mariadb.connector-c ];
 
     cmakeFlags = [
-      "-DMARIADB_INCLUDE_DIR=${mariadb.lib}/include/mysql"
+      "-DMARIADB_INCLUDE_DIR=${mariadb.connector-c}/include/mariadb"
     ];
 
-    preConfigure = ''
-      sed -i \
-        -e 's,mariadb_config,mysql_config,g' \
-        -e 's,libmariadbclient,libmysqlclient,g' \
-        cmake/FindMariaDB.cmake
-    '';
-
     passthru = {
       fancyName = "MariaDB";
       driver = "lib/libmyodbc3-3.51.12.so";
@@ -60,7 +53,6 @@
       homepage =  https://downloads.mariadb.org/connector-odbc/;
       license = licenses.gpl2;
       platforms = platforms.linux;
-      broken = true;
     };
   };
 
diff --git a/pkgs/development/libraries/wt/default.nix b/pkgs/development/libraries/wt/default.nix
index 3adf4f1497f..1d0bd20f66f 100644
--- a/pkgs/development/libraries/wt/default.nix
+++ b/pkgs/development/libraries/wt/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchFromGitHub, cmake, boost, pkgconfig, doxygen, qt48Full, libharu
-, pango, fcgi, firebird, libmysql, postgresql, graphicsmagick, glew, openssl
+, pango, fcgi, firebird, mysql, postgresql, graphicsmagick, glew, openssl
 , pcre
 }:
 
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [
     cmake boost doxygen qt48Full libharu
-    pango fcgi firebird libmysql postgresql graphicsmagick glew
+    pango fcgi firebird mysql.connector-c postgresql graphicsmagick glew
     openssl pcre
   ];
 
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
     "-DWT_WRASTERIMAGE_IMPLEMENTATION=GraphicsMagick"
     "-DWT_CPP_11_MODE=-std=c++11"
     "-DGM_PREFIX=${graphicsmagick}"
-    "-DMYSQL_PREFIX=${libmysql.dev}"
+    "-DMYSQL_PREFIX=${mysql.connector-c}"
     "--no-warn-unused-cli"
   ];
 
diff --git a/pkgs/development/libraries/xapian/default.nix b/pkgs/development/libraries/xapian/default.nix
index 23fee81e0a5..36a73bc6d2b 100644
--- a/pkgs/development/libraries/xapian/default.nix
+++ b/pkgs/development/libraries/xapian/default.nix
@@ -36,5 +36,5 @@ let
 in {
   # xapian-ruby needs 1.2.22 as of 2017-05-06
   xapian_1_2_22 = generic "1.2.22" "0zsji22n0s7cdnbgj0kpil05a6bgm5cfv0mvx12d8ydg7z58g6r6";
-  xapian_1_4_4 = generic "1.4.4" "1n9j2w2as0flih3hgim7gprfxsx6gimijs91rxsjsi8shjlqbad6";
+  xapian_1_4 = generic "1.4.5" "0axhqrj202hbll9mcx1qdm8gsqj19216w3z02gyjbycxvr9gkdc5";
 }
diff --git a/pkgs/development/libraries/xapian/tools/omega/default.nix b/pkgs/development/libraries/xapian/tools/omega/default.nix
index 2923bfc1fc6..09c2171945e 100644
--- a/pkgs/development/libraries/xapian/tools/omega/default.nix
+++ b/pkgs/development/libraries/xapian/tools/omega/default.nix
@@ -6,7 +6,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "http://oligarchy.co.uk/xapian/${version}/xapian-omega-${version}.tar.xz";
-    sha256 = "0pl9gs0sbavxykfgrkm8syswqnfynmmqhf8429bv8a5qjh5pkp8l";
+    sha256 = "0zji8ckp4h5xdy2wbir3lvk680w1g1l4h5swmaxsx7ah12lkrjcr";
   };
 
   buildInputs = [ xapian perl pcre zlib libmagic ];
diff --git a/pkgs/development/lisp-modules/clwrapper/setup-hook.sh b/pkgs/development/lisp-modules/clwrapper/setup-hook.sh
index 7ac8c70d59f..eb6052d58db 100644
--- a/pkgs/development/lisp-modules/clwrapper/setup-hook.sh
+++ b/pkgs/development/lisp-modules/clwrapper/setup-hook.sh
@@ -31,7 +31,7 @@ collectNixLispLDLP () {
 
 export NIX_LISP_COMMAND NIX_LISP CL_SOURCE_REGISTRY NIX_LISP_ASDF
 
-envHooks+=(addASDFPaths setLisp collectNixLispLDLP)
+addEnvHooks "$targetOffset" addASDFPaths setLisp collectNixLispLDLP
 
 mkdir -p "$HOME"/.cache/common-lisp || HOME="$TMP/.temp-$USER-home"
 mkdir -p "$HOME"/.cache/common-lisp
diff --git a/pkgs/development/lisp-modules/quicklisp-to-nix-overrides.nix b/pkgs/development/lisp-modules/quicklisp-to-nix-overrides.nix
index fae5818171b..09113bc30bb 100644
--- a/pkgs/development/lisp-modules/quicklisp-to-nix-overrides.nix
+++ b/pkgs/development/lisp-modules/quicklisp-to-nix-overrides.nix
@@ -53,11 +53,11 @@ in
   cl-async-ssl = addNativeLibs [pkgs.openssl];
   cl-async-test = addNativeLibs [pkgs.openssl];
   clsql = x: {
-    propagatedBuildInputs = with pkgs; [mysql postgresql sqlite zlib];
+    propagatedBuildInputs = with pkgs; [mysql.connector-c postgresql sqlite zlib];
     overrides = y: (x.overrides y) // {
       preConfigure = ((x.overrides y).preConfigure or "") + ''
-        export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${pkgs.lib.getDev pkgs.mysql.client}/include/mysql"
-        export NIX_LDFLAGS="$NIX_LDFLAGS -L${pkgs.lib.getLib pkgs.mysql.client}/lib/mysql"
+        export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${pkgs.mysql.connector-c}/include/mysql"
+        export NIX_LDFLAGS="$NIX_LDFLAGS -L${pkgs.mysql.connector-c}/lib/mysql"
       '';
     };
   };
diff --git a/pkgs/development/lisp-modules/shell.nix b/pkgs/development/lisp-modules/shell.nix
index b29ba53159e..d3cb7b36aee 100644
--- a/pkgs/development/lisp-modules/shell.nix
+++ b/pkgs/development/lisp-modules/shell.nix
@@ -5,11 +5,11 @@ self = rec {
   env = buildEnv { name = name; paths = buildInputs; };
   buildInputs = [
     gcc stdenv
-    openssl fuse libuv mariadb libfixposix libev sqlite
+    openssl fuse libuv mysql.connector-c libfixposix libev sqlite
     freetds
     lispPackages.quicklisp-to-nix lispPackages.quicklisp-to-nix-system-info
   ];
   CPATH = "${libfixposix}/include";
-  LD_LIBRARY_PATH = "${openssl.out}/lib:${fuse}/lib:${libuv}/lib:${libev}/lib:${mariadb}/lib:${postgresql.lib}/lib:${sqlite.out}/lib:${libfixposix}/lib:${freetds}/lib";
+  LD_LIBRARY_PATH = "${openssl.out}/lib:${fuse}/lib:${libuv}/lib:${libev}/lib:${mysql.connector-c}/lib:${postgresql.lib}/lib:${sqlite.out}/lib:${libfixposix}/lib:${freetds}/lib";
 };
 in stdenv.mkDerivation self
diff --git a/pkgs/development/ocaml-modules/eliom/setup-hook.sh b/pkgs/development/ocaml-modules/eliom/setup-hook.sh
index 096d8f8bf63..9868ab93f79 100644
--- a/pkgs/development/ocaml-modules/eliom/setup-hook.sh
+++ b/pkgs/development/ocaml-modules/eliom/setup-hook.sh
@@ -2,4 +2,4 @@ addOcsigenDistilleryTemplate() {
     addToSearchPathWithCustomDelimiter : ELIOM_DISTILLERY_PATH $1/eliom-distillery-templates
 }
 
-envHooks+=(addOcsigenDistilleryTemplate)
+addEnvHooks "$hostOffset" addOcsigenDistilleryTemplate
diff --git a/pkgs/development/ocaml-modules/mysql/default.nix b/pkgs/development/ocaml-modules/mysql/default.nix
index 3fa8e9d46b4..5482d7ac87c 100644
--- a/pkgs/development/ocaml-modules/mysql/default.nix
+++ b/pkgs/development/ocaml-modules/mysql/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, ocaml, findlib, mysql }:
+{ stdenv, fetchurl, fetchpatch, ocaml, findlib, mysql, openssl }:
 
 # TODO: la versione stabile da' un errore di compilazione dovuto a
 # qualche cambiamento negli header .h
@@ -26,7 +26,14 @@ stdenv.mkDerivation rec {
 
   createFindlibDestdir = true;
 
-  propagatedBuildInputs = [ mysql.client ];
+  propagatedBuildInputs = [ mysql.connector-c ];
+
+  patches = [
+    (fetchpatch {
+      url = "https://github.com/ygrek/ocaml-mysql/compare/v1.2.1...d6d1b3b262ae2cf493ef56f1dd7afcf663a70a26.patch";
+      sha256 = "0018s2wcrvbsw9yaqmwq500qmikwffrgdp5xg9b8v7ixhd4gi6hn";
+    })
+  ];
 
   meta = {
     homepage = http://ocaml-mysql.forge.ocamlcore.org;
diff --git a/pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh b/pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh
index a93a7250beb..6d950437016 100644
--- a/pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh
+++ b/pkgs/development/ocaml-modules/ocamlmake/setup-hook.sh
@@ -2,4 +2,4 @@ addOcamlMakefile () {
     export OCAMLMAKEFILE="@out@/include/OCamlMakefile"
 }
 
-envHooks+=(addOcamlMakefile)
+addEnvHooks "$targetOffset" addOcamlMakefile
diff --git a/pkgs/development/perl-modules/DBD-mysql/default.nix b/pkgs/development/perl-modules/DBD-mysql/default.nix
index 7302516d542..12ddcf166e2 100644
--- a/pkgs/development/perl-modules/DBD-mysql/default.nix
+++ b/pkgs/development/perl-modules/DBD-mysql/default.nix
@@ -8,7 +8,7 @@ buildPerlPackage rec {
     sha256 = "0h4h6zwzj8fwh9ljb8svnsa0a3ch4p10hp59kpdibdb4qh8xwxs7";
   };
 
-  buildInputs = [ mysql.lib ] ;
+  buildInputs = [ mysql.connector-c ] ;
   propagatedBuildInputs = [ DBI ];
 
   doCheck = false;
diff --git a/pkgs/development/pure-modules/glpk/default.nix b/pkgs/development/pure-modules/glpk/default.nix
index 4927ac445f4..e86f08b57ca 100644
--- a/pkgs/development/pure-modules/glpk/default.nix
+++ b/pkgs/development/pure-modules/glpk/default.nix
@@ -1,5 +1,5 @@
 { lib, stdenv, fetchurl,
-  pkgconfig, pure, glpk, gmp, libtool, libmysql, libiodbc, zlib }:
+  pkgconfig, pure, glpk, gmp, libtool, mysql, libiodbc, zlib }:
 
 stdenv.mkDerivation rec {
   baseName = "glpk";
@@ -12,13 +12,13 @@ stdenv.mkDerivation rec {
   };
 
   glpkWithExtras = lib.overrideDerivation glpk (attrs: {
-    propagatedBuildInputs = [ gmp libtool libmysql libiodbc ];
+    propagatedBuildInputs = [ gmp libtool mysql.connector-c libiodbc ];
 
     CPPFLAGS = "-I${gmp.dev}/include";
 
     preConfigure = ''
       substituteInPlace configure \
-        --replace /usr/include/mysql ${lib.getDev libmysql}/include/mysql
+        --replace /usr/include/mysql ${mysql.connector-c}/include/mysql
     '';
     configureFlags = [ "--enable-dl"
                        "--enable-odbc"
diff --git a/pkgs/development/python-modules/APScheduler/default.nix b/pkgs/development/python-modules/APScheduler/default.nix
index 5acb6cd5785..931239c0987 100644
--- a/pkgs/development/python-modules/APScheduler/default.nix
+++ b/pkgs/development/python-modules/APScheduler/default.nix
@@ -20,12 +20,12 @@
 
 buildPythonPackage rec {
   pname = "APScheduler";
-  version = "3.4.0";
+  version = "3.5.0";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "b51118a8ed014104f7e440456dcbd90f2015aea7bcc34c57e307fb34bc746316";
+    sha256 = "1ce44d5132b7951f4614067c88ca34cfee1ff97f6f0892581d79b636d83eab89";
   };
 
   buildInputs = [
diff --git a/pkgs/development/python-modules/Mako/default.nix b/pkgs/development/python-modules/Mako/default.nix
new file mode 100644
index 00000000000..f3f1eed265d
--- /dev/null
+++ b/pkgs/development/python-modules/Mako/default.nix
@@ -0,0 +1,32 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, markupsafe
+, nose
+, mock
+, pytest
+, isPyPy
+}:
+
+buildPythonPackage rec {
+  pname = "Mako";
+  version = "1.0.7";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "4e02fde57bd4abb5ec400181e4c314f56ac3e49ba4fb8b0d50bba18cb27d25ae";
+  };
+
+  checkInputs = [ markupsafe nose mock pytest ];
+  propagatedBuildInputs = [ markupsafe ];
+
+  doCheck = !isPyPy;  # https://bitbucket.org/zzzeek/mako/issue/238/2-tests-failed-on-pypy-24-25
+
+  meta = {
+    description = "Super-fast templating language";
+    homepage = http://www.makotemplates.org;
+    license = lib.licenses.mit;
+    platforms = lib.platforms.unix;
+    maintainers = with lib.maintainers; [ domenkozar ];
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/MechanicalSoup/default.nix b/pkgs/development/python-modules/MechanicalSoup/default.nix
index 56e2cf501ed..b5d202af50a 100644
--- a/pkgs/development/python-modules/MechanicalSoup/default.nix
+++ b/pkgs/development/python-modules/MechanicalSoup/default.nix
@@ -1,5 +1,5 @@
 { fetchPypi, buildPythonPackage, lib
-, requests, beautifulsoup4, six
+, requests, beautifulsoup4, six, lxml
 , pytestrunner, requests-mock, pytestcov, pytest
 }:
 
@@ -7,23 +7,23 @@
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "MechanicalSoup";
-  version = "0.8.0";
+  version = "0.9.0.post4";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "38a6ca35428196be94f87f8f036ee4a88b1418d1f77e5634ad92acfaa22c28da";
+    sha256 = "ce8f822afbc9bef1499be417e8d5deecd0cd32606420165700e89477955f03ab";
   };
 
   checkInputs = [ pytest pytestrunner requests-mock pytestcov ];
 
-  propagatedBuildInputs = [ requests beautifulsoup4 six ];
+  propagatedBuildInputs = [ lxml requests beautifulsoup4 six ];
 
   # Requires network
   doCheck = false;
 
   postPatch = ''
     # Is in setup_requires but not used in setup.py...
-    substituteInPlace setup.py --replace "'pytest-runner'," ""
+    substituteInPlace setup.py --replace "'pytest-runner'" ""
   '';
 
   meta = with lib; {
diff --git a/pkgs/development/python-modules/Nikola/default.nix b/pkgs/development/python-modules/Nikola/default.nix
index f281a02d49b..8f8d91c64d2 100644
--- a/pkgs/development/python-modules/Nikola/default.nix
+++ b/pkgs/development/python-modules/Nikola/default.nix
@@ -30,7 +30,7 @@
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "Nikola";
-  version = "7.8.10";
+  version = "7.8.11";
 
   # Nix contains only Python 3 supported version of doit, which is a dependency
   # of Nikola. Python 2 support would require older doit 0.29.0 (which on the
@@ -47,7 +47,7 @@ buildPythonPackage rec {
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "e242c3d0dd175d95a0baf5268b108081ba160b83ceafec8c9bc2ec0a24a56537";
+    sha256 = "10d95b3af84e61496ef729665eafa2235fd0fd4cc6c57644dd0f2c19a968dd0f";
   };
 
   meta = {
diff --git a/pkgs/development/python-modules/Theano/default.nix b/pkgs/development/python-modules/Theano/default.nix
index e0ff839ce1b..03dc825218e 100644
--- a/pkgs/development/python-modules/Theano/default.nix
+++ b/pkgs/development/python-modules/Theano/default.nix
@@ -35,13 +35,13 @@ let
 in buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "Theano";
-  version = "0.9.0";
+  version = "1.0.1";
 
   disabled = isPyPy || pythonOlder "2.6" || (isPy3k && pythonOlder "3.3");
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "05xwg00da8smkvkh6ywbywqzj8dw7x840jr74wqhdy9icmqncpbl";
+    sha256 = "88d8aba1fe2b6b75eacf455d01bc7e31e838c5a0fb8c13dde2d9472495ff4662";
   };
 
   postPatch = ''
diff --git a/pkgs/development/python-modules/absl-py/default.nix b/pkgs/development/python-modules/absl-py/default.nix
index 1c9fa3d786f..ca43e122a30 100644
--- a/pkgs/development/python-modules/absl-py/default.nix
+++ b/pkgs/development/python-modules/absl-py/default.nix
@@ -6,12 +6,12 @@
 
 buildPythonPackage rec {
   pname = "absl-py";
-  version = "0.1.5";
+  version = "0.1.7";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "94943ed0cd77077fe2d18e79b2f28d3e92f585f7d1c6edc75e640121f3c5d580";
+    sha256 = "4ea22ae860f3a556511291e7f1284942199c81377f47ec4248163defb1b9e6ee";
   };
 
   propagatedBuildInputs = [ six ];
diff --git a/pkgs/development/python-modules/aenum/default.nix b/pkgs/development/python-modules/aenum/default.nix
index 3aa03aaa599..45e7f8915ac 100644
--- a/pkgs/development/python-modules/aenum/default.nix
+++ b/pkgs/development/python-modules/aenum/default.nix
@@ -2,12 +2,12 @@
 
 buildPythonPackage rec {
   pname = "aenum";
-  version = "2.0.8";
+  version = "2.0.9";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "3209fa41b8c41345442e8d9b5158a57d3e96d84c3d5ebbe8e521e1e2eff1598d";
+    sha256 = "d98bc55136d696fcf323760c3db0de489da9e41fd51283fa6f90205deb85bf6a";
   };
 
   doCheck = !isPy3k;
diff --git a/pkgs/development/python-modules/aiohttp/default.nix b/pkgs/development/python-modules/aiohttp/default.nix
index 53443b3b32f..44e19072057 100644
--- a/pkgs/development/python-modules/aiohttp/default.nix
+++ b/pkgs/development/python-modules/aiohttp/default.nix
@@ -13,12 +13,12 @@
 
 buildPythonPackage rec {
   pname = "aiohttp";
-  version = "2.3.3";
+  version = "2.3.7";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0a2e33e90560dacb819b095b9d9611597925d75d1b93dd9490055d3826d98a82";
+    sha256 = "fe294df38e9c67374263d783a7a29c79372030f5962bd5734fa51c6f4bbfee3b";
   };
 
   disabled = pythonOlder "3.4";
diff --git a/pkgs/development/python-modules/arrow/default.nix b/pkgs/development/python-modules/arrow/default.nix
index a85987a95b1..72b88d3e557 100644
--- a/pkgs/development/python-modules/arrow/default.nix
+++ b/pkgs/development/python-modules/arrow/default.nix
@@ -1,23 +1,22 @@
 { stdenv, buildPythonPackage, fetchPypi
-, nose, chai, simplejson
+, nose, chai, simplejson, backports_functools_lru_cache
 , dateutil }:
 
 buildPythonPackage rec {
-  name = "${pname}-${version}";
   pname = "arrow";
-  version = "0.10.0";
+  version = "0.12.0";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "08n7q2l69hlainds1byd4lxhwrq7zsw7s640zkqc3bs5jkq0cnc0";
+    sha256 = "a15ecfddf334316e3ac8695e48c15d1be0d6038603b33043930dcf0e675c86ee";
   };
 
   checkPhase = ''
     nosetests --cover-package=arrow
   '';
 
-  buildInputs = [ nose chai simplejson ];
-  propagatedBuildInputs = [ dateutil ];
+  checkInputs = [ nose chai simplejson ];
+  propagatedBuildInputs = [ dateutil backports_functools_lru_cache ];
 
   meta = with stdenv.lib; {
     description = "Python library for date manipulation";
diff --git a/pkgs/development/python-modules/asgiref/default.nix b/pkgs/development/python-modules/asgiref/default.nix
index 1b5112fb335..fedd4b81a9d 100644
--- a/pkgs/development/python-modules/asgiref/default.nix
+++ b/pkgs/development/python-modules/asgiref/default.nix
@@ -1,12 +1,12 @@
 { stdenv, buildPythonPackage, fetchurl, six }:
 buildPythonPackage rec {
-  version = "1.1.2";
+  version = "2.0.1";
   pname = "asgiref";
   name = "${pname}-${version}";
 
   src = fetchurl {
     url = "mirror://pypi/a/asgiref/${name}.tar.gz";
-    sha256 = "8b46c3d6e2ad354d9da3cfb9873f9bd46fe1b768fbc11065275ba5430a46700c";
+    sha256 = "c3d70c473a2b7e525e18e68504630943e107f5b32f440c00c8543f94f565c855";
   };
 
   propagatedBuildInputs = [ six ];
diff --git a/pkgs/development/python-modules/asn1crypto/default.nix b/pkgs/development/python-modules/asn1crypto/default.nix
index eedaac50fac..5f512fcd6f8 100644
--- a/pkgs/development/python-modules/asn1crypto/default.nix
+++ b/pkgs/development/python-modules/asn1crypto/default.nix
@@ -5,12 +5,12 @@
 
 buildPythonPackage rec {
   pname = "asn1crypto";
-  version = "0.23.0";
+  version = "0.24.0";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0874981329cfebb366d6584c3d16e913f2a0eb026c9463efcc4aaf42a9d94d70";
+    sha256 = "9d5c20441baf0cb60a4ac34cc447c6c189024b6b4c6cd7877034f4965c464e49";
   };
 
   # No tests included
diff --git a/pkgs/development/python-modules/astor/default.nix b/pkgs/development/python-modules/astor/default.nix
index 965bf37d520..6f50b7157e5 100644
--- a/pkgs/development/python-modules/astor/default.nix
+++ b/pkgs/development/python-modules/astor/default.nix
@@ -2,12 +2,12 @@
 
 buildPythonPackage rec {
   pname = "astor";
-  version = "0.5";
+  version = "0.6.2";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1fdafq5hkis1fxqlmhw0sn44zp2ar46nxhbc22cvwg7hsd8z5gsa";
+    sha256 = "ff6d2e2962d834acb125cc4dcc80c54a8c17c253f4cc9d9c43b5102a560bb75d";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/python-modules/astroid/default.nix b/pkgs/development/python-modules/astroid/default.nix
index 86a0daa0456..862157f686a 100644
--- a/pkgs/development/python-modules/astroid/default.nix
+++ b/pkgs/development/python-modules/astroid/default.nix
@@ -6,11 +6,11 @@
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "astroid";
-  version = "1.5.3";
+  version = "1.6.0";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "492c2a2044adbf6a84a671b7522e9295ad2f6a7c781b899014308db25312dd35";
+    sha256 = "71dadba2110008e2c03f9fde662ddd2053db3c0489d0e03c94e828a0399edd4f";
   };
 
   propagatedBuildInputs = [ logilab_common six lazy-object-proxy wrapt ]
diff --git a/pkgs/development/python-modules/astropy/default.nix b/pkgs/development/python-modules/astropy/default.nix
index 12f00be0cb7..514762b7a37 100644
--- a/pkgs/development/python-modules/astropy/default.nix
+++ b/pkgs/development/python-modules/astropy/default.nix
@@ -7,13 +7,13 @@
 buildPythonPackage rec {
   
   pname = "astropy";
-  version = "2.0.2";
+  version = "2.0.3";
 
   name = "${pname}-${version}";
   doCheck = false; #Some tests are failing. More importantly setup.py hangs on completion. Needs fixing with a proper shellhook.
   src = fetchPypi {
     inherit pname version;
-    sha256 = "4544a422b1173d79b2d65ba74c627f04a5fd8530d97fb604752d657d754e103d";
+    sha256 = "fdfc0248f6250798ed6d1327be609cb901db89ae01fc768cfbc9e263bdf56f4f";
   };
 
   propagatedBuildInputs = [ pytest numpy ]; # yes it really has pytest in install_requires
diff --git a/pkgs/development/python-modules/attrs/default.nix b/pkgs/development/python-modules/attrs/default.nix
index e58bf3846dc..8ef2b5989f4 100644
--- a/pkgs/development/python-modules/attrs/default.nix
+++ b/pkgs/development/python-modules/attrs/default.nix
@@ -2,17 +2,16 @@
 , pympler, coverage, six, clang }:
 
 buildPythonPackage rec {
-  name = "${pname}-${version}";
   pname = "attrs";
-  version = "17.2.0";
+  version = "17.4.0";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "04gx08ikpk26wnq22f7l42gapcvk8iz1512r927k6sadz6cinkax";
+    sha256 = "1c7960ccfd6a005cd9f7ba884e6316b5e430a3f1a6c37c5f87d8b43f83b54ec9";
   };
 
   # macOS needs clang for testing
-  buildInputs = [
+  checkInputs = [
     pytest hypothesis zope_interface pympler coverage six
   ] ++ lib.optionals (stdenv.isDarwin) [ clang ];
 
@@ -20,6 +19,9 @@ buildPythonPackage rec {
     py.test
   '';
 
+  # To prevent infinite recursion with pytest
+  doCheck = false;
+
   meta = with lib; {
     description = "Python attributes without boilerplate";
     homepage = https://github.com/hynek/attrs;
diff --git a/pkgs/development/python-modules/aws-xray-sdk/default.nix b/pkgs/development/python-modules/aws-xray-sdk/default.nix
new file mode 100644
index 00000000000..dae88b34900
--- /dev/null
+++ b/pkgs/development/python-modules/aws-xray-sdk/default.nix
@@ -0,0 +1,29 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, jsonpickle
+, wrapt
+, requests
+}:
+
+buildPythonPackage rec {
+  pname = "aws-xray-sdk";
+  version = "0.95";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "9e7ba8dd08fd2939376c21423376206bff01d0deaea7d7721c6b35921fed1943";
+  };
+
+  propagatedBuildInputs = [
+    jsonpickle wrapt requests
+  ];
+
+  meta = {
+    description = "AWS X-Ray SDK for the Python programming language";
+    license = lib.licenses.asl20;
+    homepage = https://github.com/aws/aws-xray-sdk-python;
+  };
+
+  doCheck = false;
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/backports_abc/default.nix b/pkgs/development/python-modules/backports_abc/default.nix
new file mode 100644
index 00000000000..ab34d376de0
--- /dev/null
+++ b/pkgs/development/python-modules/backports_abc/default.nix
@@ -0,0 +1,25 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, python
+}:
+
+buildPythonPackage rec {
+  pname = "backports_abc";
+  version = "0.5";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "033be54514a03e255df75c5aee8f9e672f663f93abb723444caec8fe43437bde";
+  };
+
+  checkPhase = ''
+    ${python.interpreter} -m unittest discover
+  '';
+
+  meta = {
+    homepage = https://github.com/cython/backports_abc;
+    license = lib.licenses.psfl;
+    description = "A backport of recent additions to the 'collections.abc' module";
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/backports_functools_lru_cache/default.nix b/pkgs/development/python-modules/backports_functools_lru_cache/default.nix
new file mode 100644
index 00000000000..2442e132f1b
--- /dev/null
+++ b/pkgs/development/python-modules/backports_functools_lru_cache/default.nix
@@ -0,0 +1,24 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, setuptools_scm
+}:
+
+buildPythonPackage rec {
+  pname = "backports.functools_lru_cache";
+  version = "1.4";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "31f235852f88edc1558d428d890663c49eb4514ffec9f3650e7f3c9e4a12e36f";
+  };
+
+  buildInputs = [ setuptools_scm ];
+  doCheck = false; # No proper test
+
+  meta = {
+    description = "Backport of functools.lru_cache";
+    homepage = https://github.com/jaraco/backports.functools_lru_cache;
+    license = lib.licenses.mit;
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/backports_lzma/default.nix b/pkgs/development/python-modules/backports_lzma/default.nix
new file mode 100644
index 00000000000..9b622eb6b06
--- /dev/null
+++ b/pkgs/development/python-modules/backports_lzma/default.nix
@@ -0,0 +1,32 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, isPy3k
+, lzma
+, python
+}:
+
+buildPythonPackage rec {
+  pname = "backports.lzma";
+  version = "0.0.8";
+
+  disabled = isPy3k;
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "200584ad5079d8ca6b1bfe14890c7be58666ab0128d8ca26cfb2669b476085f3";
+  };
+
+  buildInputs = [ lzma ];
+
+  # Needs the compiled module in $out
+  checkPhase = ''
+    PYTHONPATH=$out/${python.sitePackages}:$PYTHONPATH ${python.interpreter} -m unittest discover -s test
+  '';
+
+  meta = {
+    description = "Backport of Python 3.3's 'lzma' module for XZ/LZMA compressed files";
+    homepage = https://github.com/peterjc/backports.lzma;
+    license = lib.licenses.bsd3;
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/biopython/default.nix b/pkgs/development/python-modules/biopython/default.nix
new file mode 100644
index 00000000000..ea09a003c66
--- /dev/null
+++ b/pkgs/development/python-modules/biopython/default.nix
@@ -0,0 +1,32 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, numpy
+}:
+
+buildPythonPackage rec {
+  pname = "biopython";
+  version = "1.70";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "4a7c5298f03d1a45523f32bae1fffcff323ea9dce007fb1241af092f5ab2e45b";
+  };
+
+  propagatedBuildInputs = [ numpy ];
+  # Checks try to write to $HOME, which does not work with nix
+  doCheck = false;
+  meta = {
+    description = "Python library for bioinformatics";
+    longDescription = ''
+      Biopython is a set of freely available tools for biological computation
+      written in Python by an international team of developers. It is a
+      distributed collaborative effort to develop Python libraries and
+      applications which address the needs of current and future work in
+      bioinformatics.
+    '';
+    homepage = http://biopython.org/wiki/Documentation;
+    maintainers = with lib.maintainers; [ luispedro ];
+    license = lib.licenses.bsd3;
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/blaze/default.nix b/pkgs/development/python-modules/blaze/default.nix
index 017b85cacc7..74e327fd342 100644
--- a/pkgs/development/python-modules/blaze/default.nix
+++ b/pkgs/development/python-modules/blaze/default.nix
@@ -25,12 +25,11 @@
 
 buildPythonPackage rec {
   pname = "blaze";
-  version = "0.11.0";
-  name = "${pname}-${version}";
+  version = "0.11.3";
 
   src = fetchurl {
     url = "https://github.com/blaze/blaze/archive/${version}.tar.gz";
-    sha256 = "07zrrxkmdqk84xvdmp29859zcfzlpx5pz6g62l28nqp6n6a7yq9a";
+    sha256 = "075gqc9d7g284z4nfwv5zbq99ln22w25l4lcndjg3v10kmsjadww";
   };
 
   checkInputs = [ pytest ];
@@ -56,13 +55,8 @@ buildPythonPackage rec {
     toolz
   ];
 
-  # Failing test
-  # ERROR collecting blaze/tests/test_interactive.py
-  # E   networkx.exception.NetworkXNoPath: node <class 'list'> not
-  # reachable from <class 'dask.array.core.Array'>
-  doCheck = false;
-
   checkPhase = ''
+    rm pytest.ini # Not interested in coverage
     py.test blaze/tests
   '';
 
diff --git a/pkgs/development/python-modules/bokeh/default.nix b/pkgs/development/python-modules/bokeh/default.nix
index 244ee43d0aa..e3c77fa65cf 100644
--- a/pkgs/development/python-modules/bokeh/default.nix
+++ b/pkgs/development/python-modules/bokeh/default.nix
@@ -34,11 +34,11 @@
 buildPythonPackage rec {
   pname = "bokeh";
   name = "${pname}${version}";
-  version = "0.12.10";
+  version = "0.12.13";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "6465fae82e94223f16584645b38d34a73d95712870f29c0244649c2cbf2c8393";
+    sha256 = "6e28cbfd88de0c459435278b75f9982591ec0aaa3d37a195052645e1c62e89e3";
   };
 
   disabled = isPyPy;
diff --git a/pkgs/development/python-modules/bootstrapped-pip/default.nix b/pkgs/development/python-modules/bootstrapped-pip/default.nix
index ef12e39f23b..1a20639c2de 100644
--- a/pkgs/development/python-modules/bootstrapped-pip/default.nix
+++ b/pkgs/development/python-modules/bootstrapped-pip/default.nix
@@ -9,9 +9,9 @@ let
   };
   setuptools_source = fetchPypi {
     pname = "setuptools";
-    version = "38.2.3";
+    version = "38.2.5";
     format = "wheel";
-    sha256 = "0c4j3jiiwc0h1bdv4xklinp90spgvgiv5fsxp119hif9934nfxfs";
+    sha256 = "bcf0d4f3e2f7890e658db11e218b8643afffb905a0e2f2a7d5a6a3e949bb87e6";
   };
 
   # TODO: Shouldn't be necessary anymore for pip > 9.0.1!
diff --git a/pkgs/development/python-modules/boto3/default.nix b/pkgs/development/python-modules/boto3/default.nix
new file mode 100644
index 00000000000..eaab0031205
--- /dev/null
+++ b/pkgs/development/python-modules/boto3/default.nix
@@ -0,0 +1,50 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, botocore
+, jmespath
+, s3transfer
+, futures
+, docutils
+, nose
+, mock
+, isPy3k
+}:
+
+buildPythonPackage rec {
+  pname =  "boto3";
+  version = "1.4.8";
+
+  src = fetchFromGitHub {
+    owner = "boto";
+    repo  = "boto3";
+    rev   = version;
+    sha256 = "11ysd7a9l5y98q7b7az56phsj2m7w90abf4jabwrknp2c43sq9bi";
+  };
+
+  propagatedBuildInputs = [ botocore jmespath s3transfer ] ++ lib.optionals (!isPy3k) [ futures ];
+  checkInputs = [ docutils nose mock ];
+
+  checkPhase = ''
+    runHook preCheck
+    # This method is not in mock. It might have appeared in some versions.
+    sed -i 's/action.assert_called_once()/self.assertEqual(action.call_count, 1)/' \
+      tests/unit/resources/test_factory.py
+    nosetests -d tests/unit --verbose
+    runHook postCheck
+  '';
+
+  # Network access
+  doCheck = false;
+
+  meta = {
+    homepage = https://github.com/boto/boto3;
+    license = lib.licenses.asl20;
+    description = "AWS SDK for Python";
+    longDescription = ''
+      Boto3 is the Amazon Web Services (AWS) Software Development Kit (SDK) for
+      Python, which allows Python developers to write software that makes use of
+      services like Amazon S3 and Amazon EC2.
+    '';
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/botocore/default.nix b/pkgs/development/python-modules/botocore/default.nix
index fe3fe06f4e7..f8dd1649949 100644
--- a/pkgs/development/python-modules/botocore/default.nix
+++ b/pkgs/development/python-modules/botocore/default.nix
@@ -12,11 +12,11 @@
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "botocore";
-  version = "1.8.10";
+  version = "1.8.21";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "16dznd0mxxs8imsl228vx5s9bz9v7ggajs496jy21n5a19cadkch";
+    sha256 = "e4513a02f68e7efd7494ee56db201d87620218ca879aae361abbb71bcde3aa5f";
   };
 
   propagatedBuildInputs = [
diff --git a/pkgs/development/python-modules/brotlipy/default.nix b/pkgs/development/python-modules/brotlipy/default.nix
new file mode 100644
index 00000000000..1dd2a070480
--- /dev/null
+++ b/pkgs/development/python-modules/brotlipy/default.nix
@@ -0,0 +1,36 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, cffi
+, enum34
+, construct
+, pytest
+, hypothesis
+}:
+
+buildPythonPackage rec {
+  pname = "brotlipy";
+  version = "0.7.0";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "36def0b859beaf21910157b4c33eb3b06d8ce459c942102f16988cca6ea164df";
+  };
+
+  propagatedBuildInputs = [ cffi enum34 construct ];
+
+  checkInputs = [ pytest hypothesis ];
+
+  checkPhase = ''
+    py.test
+  '';
+
+  # Missing test files
+  doCheck = false;
+
+  meta = {
+    description = "Python bindings for the reference Brotli encoder/decoder";
+    homepage = "https://github.com/python-hyper/brotlipy/";
+    license = lib.licenses.mit;
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/cached-property/default.nix b/pkgs/development/python-modules/cached-property/default.nix
new file mode 100644
index 00000000000..6ab5015a1e7
--- /dev/null
+++ b/pkgs/development/python-modules/cached-property/default.nix
@@ -0,0 +1,25 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, freezegun
+}:
+
+buildPythonPackage rec {
+  pname = "cached-property";
+  version = "1.3.1";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "6562f0be134957547421dda11640e8cadfa7c23238fc4e0821ab69efdb1095f3";
+  };
+
+  checkInputs = [ freezegun ];
+
+  meta = {
+    description = "A decorator for caching properties in classes";
+    homepage = https://github.com/pydanny/cached-property;
+    license = lib.licenses.bsd3;
+    platforms = lib.platforms.unix;
+    maintainers = with lib.maintainers; [ ericsagnes ];
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/credstash/default.nix b/pkgs/development/python-modules/credstash/default.nix
index 810a6a7bd8e..6a9e1240b86 100644
--- a/pkgs/development/python-modules/credstash/default.nix
+++ b/pkgs/development/python-modules/credstash/default.nix
@@ -2,12 +2,12 @@
 
 buildPythonPackage rec {
   pname    = "credstash";
-  version = "1.13.4";
+  version = "1.14.0";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "676cc03a6143dec260c78aeef09d08a64faf27c411f8a94f6d9338e985879f81";
+    sha256 = "718b337f7a6fa001e014386071f05c59900525d0507009126d2fe8d75fe0761d";
   };
 
   propagatedBuildInputs = [ cryptography boto3 pyyaml docutils ];
diff --git a/pkgs/development/python-modules/csscompressor/default.nix b/pkgs/development/python-modules/csscompressor/default.nix
index a9aad8d40e5..8d0e7a58e76 100644
--- a/pkgs/development/python-modules/csscompressor/default.nix
+++ b/pkgs/development/python-modules/csscompressor/default.nix
@@ -1,12 +1,12 @@
 { stdenv, buildPythonPackage, fetchPypi }:
 buildPythonPackage rec {
   pname = "csscompressor";
-  version = "0.9.4";
+  version = "0.9.5";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0e12f125b88379d7b680636d94a3c8fa14bed1de2358f7f9a9e6749e222cff3b";
+    sha256 = "afa22badbcf3120a4f392e4d22f9fff485c044a1feda4a950ecc5eba9dd31a05";
   };
 
   doCheck = false; # No tests
diff --git a/pkgs/development/python-modules/cx_freeze/default.nix b/pkgs/development/python-modules/cx_freeze/default.nix
index 3d937debe58..69a5e8c11d4 100644
--- a/pkgs/development/python-modules/cx_freeze/default.nix
+++ b/pkgs/development/python-modules/cx_freeze/default.nix
@@ -2,12 +2,12 @@
 
 buildPythonPackage rec {
   pname = "cx_Freeze";
-  version = "5.0.2";
+  version = "5.1.1";
   name  = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0zbx9j5z5l06bvwvlqvvn7h9dm7zjcjgxm7agbb625nymkq6cd15";
+    sha256 = "2eadddde670f5c5f6cf88638a0ac4e5d5fe181292a31063275fa56c7bf22426b";
   };
 
   propagatedBuildInputs = [ ncurses ];
diff --git a/pkgs/development/python-modules/cytoolz/default.nix b/pkgs/development/python-modules/cytoolz/default.nix
index dcb4e9474c3..83b1c893719 100644
--- a/pkgs/development/python-modules/cytoolz/default.nix
+++ b/pkgs/development/python-modules/cytoolz/default.nix
@@ -9,12 +9,12 @@
 
 buildPythonPackage rec {
   pname = "cytoolz";
-  version = "0.8.2";
+  version = "0.9.0";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "476a2ad176de5eaef80499b7b43d4f72ba6d23df33d349088dae315e9b31c552";
+    sha256 = "5ebb55855a8bb7800afa58e52408763935527e0305f35600c71b43c86013dec2";
   };
 
   # Extension types
diff --git a/pkgs/development/python-modules/dask/default.nix b/pkgs/development/python-modules/dask/default.nix
index 70647b6377f..c3b45dc3c86 100644
--- a/pkgs/development/python-modules/dask/default.nix
+++ b/pkgs/development/python-modules/dask/default.nix
@@ -12,12 +12,12 @@
 
 buildPythonPackage rec {
   pname = "dask";
-  version = "0.15.4";
+  version = "0.16.0";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "cb93b8260f5f854ccf26b52bdc700600a08e6b7527085c7b7d63c04238bab9ea";
+    sha256 = "40d150b73e3366c9521e9dde206046a66906330074f87be901b1e1013ce6cb73";
   };
 
   checkInputs = [ pytest ];
diff --git a/pkgs/development/python-modules/decorator/default.nix b/pkgs/development/python-modules/decorator/default.nix
new file mode 100644
index 00000000000..e3ee3117501
--- /dev/null
+++ b/pkgs/development/python-modules/decorator/default.nix
@@ -0,0 +1,20 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+}:
+
+buildPythonPackage rec {
+  pname = "decorator";
+  version = "4.1.2";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "7cb64d38cb8002971710c8899fbdfb859a23a364b7c99dab19d1f719c2ba16b5";
+  };
+
+  meta = {
+    homepage = https://pypi.python.org/pypi/decorator;
+    description = "Better living through Python with decorators";
+    license = lib.licenses.mit;
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/distro/default.nix b/pkgs/development/python-modules/distro/default.nix
index 49349839331..36264921f64 100644
--- a/pkgs/development/python-modules/distro/default.nix
+++ b/pkgs/development/python-modules/distro/default.nix
@@ -3,7 +3,7 @@
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "distro";
-  version = "1.0.4";
+  version = "1.2.0";
 
   buildInputs = [ pytest pytestcov tox];
 
@@ -14,7 +14,7 @@ buildPythonPackage rec {
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "9b000b0d637bb0cbd130a7a4835681e6993e309a85564dfea9d884825fe46954";
+    sha256 = "d94370e43b676ac44fbe1ab68ca903a6147eaba3a9e8eff85b2c05556a455b76";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/python-modules/django-jinja2/default.nix b/pkgs/development/python-modules/django-jinja2/default.nix
index aabfecfcacc..b8b632e1a18 100644
--- a/pkgs/development/python-modules/django-jinja2/default.nix
+++ b/pkgs/development/python-modules/django-jinja2/default.nix
@@ -5,7 +5,7 @@
 buildPythonPackage rec {
   pname = "django-jinja";
   name = "${pname}-${version}";
-  version = "2.2.2";
+  version = "2.4.1";
 
   meta = {
     description = "Simple and nonobstructive jinja2 integration with Django";
@@ -15,7 +15,7 @@ buildPythonPackage rec {
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "099b99iprkvlsndrjmw4v3i3i60i9gm1aq5r88z15r7vgmv6sigj";
+    sha256 = "8a49d73de616a12075eee14c6d3bbab936261a463457d40348d8b8e2995cfbed";
   };
 
   buildInputs = [ django pytz tox ];
diff --git a/pkgs/development/python-modules/djangorestframework/default.nix b/pkgs/development/python-modules/djangorestframework/default.nix
index e2c8acd1a0b..b11847beaa9 100644
--- a/pkgs/development/python-modules/djangorestframework/default.nix
+++ b/pkgs/development/python-modules/djangorestframework/default.nix
@@ -1,12 +1,12 @@
 { stdenv, buildPythonPackage, fetchurl, django }:
 buildPythonPackage rec {
-  version = "3.7.3";
+  version = "3.7.7";
   pname = "djangorestframework";
   name = "${pname}-${version}";
 
   src = fetchurl {
     url = "mirror://pypi/d/djangorestframework/${name}.tar.gz";
-    sha256 = "067960e5e9e5586d3b2d53a1d626c4800dc33cd8309487d404fc63355674556f";
+    sha256 = "9f9e94e8d22b100ed3a43cee8c47a7ff7b185e778a1f2da9ec5c73fc4e081b87";
   };
 
   # Test settings are missing
diff --git a/pkgs/development/python-modules/docker/default.nix b/pkgs/development/python-modules/docker/default.nix
index 88d85dad91a..4ce013ac797 100644
--- a/pkgs/development/python-modules/docker/default.nix
+++ b/pkgs/development/python-modules/docker/default.nix
@@ -3,13 +3,13 @@
 , ipaddress, backports_ssl_match_hostname, docker_pycreds
 }:
 buildPythonPackage rec {
-  version = "2.5.1";
+  version = "2.7.0";
   pname = "docker";
   name = "${pname}-${version}";
 
   src = fetchurl {
     url = "mirror://pypi/d/docker/${name}.tar.gz";
-    sha256 = "b876e6909d8d2360e0540364c3a952a62847137f4674f2439320ede16d6db880";
+    sha256 = "144248308e8ea31c4863c6d74e1b55daf97cc190b61d0fe7b7313ab920d6a76c";
   };
 
   propagatedBuildInputs = [
diff --git a/pkgs/development/python-modules/docker_compose/default.nix b/pkgs/development/python-modules/docker_compose/default.nix
index 78e733c1b9d..e6be57c8b52 100644
--- a/pkgs/development/python-modules/docker_compose/default.nix
+++ b/pkgs/development/python-modules/docker_compose/default.nix
@@ -3,21 +3,20 @@
 , pyyaml, backports_ssl_match_hostname, colorama, docopt
 , dockerpty, docker, ipaddress, jsonschema, requests
 , six, texttable, websocket_client, cached-property
-, enum34, functools32
+, enum34, functools32,
 }:
 buildPythonApplication rec {
-  version = "1.15.0";
+  version = "1.18.0";
   pname = "docker-compose";
-  name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0yg58m5kk22kihbra0h40miqnbdmkirjr9y47wns613sdikrymmg";
+    sha256 = "2930cbfe2685018fbb75377600ab6288861d9955717b3f14212f63950351d379";
   };
 
   # lots of networking and other fails
   doCheck = false;
-  buildInputs = [ mock pytest nose ];
+  checkInputs = [ mock pytest nose ];
   propagatedBuildInputs = [
     pyyaml backports_ssl_match_hostname colorama dockerpty docker
     ipaddress jsonschema requests six texttable websocket_client
@@ -26,7 +25,7 @@ buildPythonApplication rec {
     stdenv.lib.optional (pythonOlder "3.4") enum34 ++
     stdenv.lib.optional (pythonOlder "3.2") functools32;
 
-  patchPhase = ''
+  postPatch = ''
     # Remove upper bound on requires, see also
     # https://github.com/docker/compose/issues/4431
     sed -i "s/, < .*',$/',/" setup.py
diff --git a/pkgs/development/python-modules/easy-thumbnails/default.nix b/pkgs/development/python-modules/easy-thumbnails/default.nix
index 38e201849c1..fbe5c02771d 100644
--- a/pkgs/development/python-modules/easy-thumbnails/default.nix
+++ b/pkgs/development/python-modules/easy-thumbnails/default.nix
@@ -5,7 +5,7 @@
 buildPythonPackage rec {
   pname = "easy-thumbnails";
   name = "${pname}-${version}";
-  version = "2.4.2";
+  version = "2.5";
 
   meta = {
     description = "Easy thumbnails for Django";
@@ -15,7 +15,7 @@ buildPythonPackage rec {
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "8cad7ea4fb2b800284e842d8a44f685cbc1968535be04c24a4bbf6e6dbc550c4";
+    sha256 = "e244d1f26027fc32c6ca60ffb0169a39099446f614b0433e907a2588ae7d9b95";
   };
 
   propagatedBuildInputs = [ django pillow ];
diff --git a/pkgs/development/python-modules/eve/default.nix b/pkgs/development/python-modules/eve/default.nix
index 1a9b684a9f3..d77b912fe0d 100644
--- a/pkgs/development/python-modules/eve/default.nix
+++ b/pkgs/development/python-modules/eve/default.nix
@@ -3,12 +3,12 @@
 
 buildPythonPackage rec {
   pname = "Eve";
-  version = "0.7.4";
+  version = "0.7.5";
   name  = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0xihl5w2m4vkp0515qjibiy88pk380n5jmj8n9hh7q40b1vx1kwb";
+    sha256 = "dd4ffbc4725220ffdc8e32f8566c8870efaecdc238d0f96b18e1e83227eca55d";
   };
 
   patches = [
diff --git a/pkgs/development/python-modules/extras/default.nix b/pkgs/development/python-modules/extras/default.nix
new file mode 100644
index 00000000000..adcc43f2650
--- /dev/null
+++ b/pkgs/development/python-modules/extras/default.nix
@@ -0,0 +1,23 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+}:
+
+buildPythonPackage rec {
+  pname = "extras";
+  version = "1.0.0";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "132e36de10b9c91d5d4cc620160a476e0468a88f16c9431817a6729611a81b4e";
+  };
+
+  # error: invalid command 'test'
+  doCheck = false;
+
+  meta = {
+    description = "A module provides basic functions for parsing mime-type names and matching them against a list of media-ranges";
+    homepage = https://code.google.com/p/mimeparse/;
+    license = lib.licenses.mit;
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/faker/default.nix b/pkgs/development/python-modules/faker/default.nix
index 3c95a26881e..2d459d625d0 100644
--- a/pkgs/development/python-modules/faker/default.nix
+++ b/pkgs/development/python-modules/faker/default.nix
@@ -8,12 +8,12 @@ assert pythonOlder "3.3" -> ipaddress != null;
 
 buildPythonPackage rec {
   pname = "Faker";
-  version = "0.8.7";
+  version = "0.8.8";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "bf7dabcd6807c8829da28a4de491adf7998af506b8571db6a6eb58161157248a";
+    sha256 = "e928cf853ef69d7471421f2a3716a1239e43de0fa9855f4016ee0c9f1057328a";
   };
 
   checkInputs = [
diff --git a/pkgs/development/python-modules/fastimport/default.nix b/pkgs/development/python-modules/fastimport/default.nix
index ee1048ec5fa..44f7bcdab06 100644
--- a/pkgs/development/python-modules/fastimport/default.nix
+++ b/pkgs/development/python-modules/fastimport/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, buildPythonPackage, python, fetchurl }:
+{ stdenv, buildPythonPackage, python, fetchPypi}:
 
 buildPythonPackage rec {
-  name = "fastimport-${version}";
+  pname = "fastimport";
   version = "0.9.6";
 
-  src = fetchurl {
-    url = "mirror://pypi/f/fastimport/${name}.tar.gz";
+  src = fetchPypi {
+    inherit pname version;
     sha256 = "1aqjsin4rmqm7ln4j0p73fzxifws6c6ikgyhav7r137m2ixsxl43";
   };
 
diff --git a/pkgs/development/python-modules/faulthandler/default.nix b/pkgs/development/python-modules/faulthandler/default.nix
index f8d877f0655..ee2a65e981c 100644
--- a/pkgs/development/python-modules/faulthandler/default.nix
+++ b/pkgs/development/python-modules/faulthandler/default.nix
@@ -3,11 +3,11 @@
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "faulthandler";
-  version = "2.6";
+  version = "3.0";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0zywq3jaznddvqc3hnfrlv24wmpyq4xgajk9xhv6578qw1rpfj2r";
+    sha256 = "acc10e10909f0f956ba1b42b6c450ea0bdaaa27b3942899f65931396cfcdd36a";
   };
 
   meta = {
diff --git a/pkgs/development/python-modules/filelock/default.nix b/pkgs/development/python-modules/filelock/default.nix
index f1f07a99ad5..a22e1581b68 100644
--- a/pkgs/development/python-modules/filelock/default.nix
+++ b/pkgs/development/python-modules/filelock/default.nix
@@ -2,11 +2,11 @@
 
 buildPythonPackage rec {
   pname = "filelock";
-  version = "2.0.13";
+  version = "2.0.14";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1n67dw7np5gsy5whynyk8c46pjlr353d6j9735p5gryaszkpjl6h";
+    sha256 = "ee355eb66e4c2e5d95689e1253515aad5b3177c274abdd00a57d5ab1aa6d071a";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/python-modules/fiona/default.nix b/pkgs/development/python-modules/fiona/default.nix
index 5c150844c84..1fc7ae5aa58 100644
--- a/pkgs/development/python-modules/fiona/default.nix
+++ b/pkgs/development/python-modules/fiona/default.nix
@@ -5,12 +5,12 @@
 
 buildPythonPackage rec {
   pname = "Fiona";
-  version = "1.7.10.post1";
+  version = "1.7.11";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "fc4c8996be3131f36c791d66273317d38b72b19dc24c2afc332fd734752eb7a8";
+    sha256 = "5e9c68ea71e9d79fcfb68c9a101c0b133301e233c9bcca7b7c65f33cc7636ef5";
   };
 
   buildInputs = [
diff --git a/pkgs/development/python-modules/flake8-debugger/default.nix b/pkgs/development/python-modules/flake8-debugger/default.nix
index c00bf0c8551..aab91433088 100644
--- a/pkgs/development/python-modules/flake8-debugger/default.nix
+++ b/pkgs/development/python-modules/flake8-debugger/default.nix
@@ -3,10 +3,10 @@
 buildPythonPackage rec {
   pname = "flake8-debugger";
   name = "${pname}-${version}";
-  version = "1.4.0";
+  version = "3.0.0";
   src = fetchurl {
     url = "mirror://pypi/f/flake8-debugger/${name}.tar.gz";
-    sha256 = "0chjfa6wvnqjnx778qzahhwvjx1j0rc8ax0ipp5bn70gf47lj62r";
+    sha256 = "e5c8ac980d819db2f3fbb89fe0e43a2fe6c127edd6ce4984a3f7e0bbdac3d2d4";
   };
   buildInputs = [ nose ];
   propagatedBuildInputs = [ flake8 ];
diff --git a/pkgs/development/python-modules/flask-testing/default.nix b/pkgs/development/python-modules/flask-testing/default.nix
index 178e000a32e..5f843138eae 100644
--- a/pkgs/development/python-modules/flask-testing/default.nix
+++ b/pkgs/development/python-modules/flask-testing/default.nix
@@ -6,11 +6,11 @@ with stdenv.lib;
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "Flask-Testing";
-  version = "0.6.2";
+  version = "0.7.1";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1w0dpwvrcpffm8ychyxpm8s5blm7slik9kplh9jb3sgwcv9gyppj";
+    sha256 = "dc076623d7d850653a018cb64f500948334c8aeb6b10a5a842bf1bcfb98122bc";
   };
 
   postPatch = ''
diff --git a/pkgs/development/python-modules/flit/default.nix b/pkgs/development/python-modules/flit/default.nix
index 298da4a85bf..3a73b464a46 100644
--- a/pkgs/development/python-modules/flit/default.nix
+++ b/pkgs/development/python-modules/flit/default.nix
@@ -11,6 +11,7 @@
 , pytest
 , testpath
 , responses
+, pytoml
 }:
 
 # Flit is actually an application to build universal wheels.
@@ -20,25 +21,22 @@
 
 buildPythonPackage rec {
   pname = "flit";
-  version = "0.11.4";
-  name = "${pname}-${version}";
-
-#   format = "wheel";
+  version = "0.13";
 
   src = fetchPypi {
     inherit pname version;
-#     url = https://files.pythonhosted.org/packages/24/98/50a090112a04d9e29155c31a222637668b0a4dd778fefcd3132adc50e877/flit-0.10-py3-none-any.whl;
-    sha256 = "8ba7603cc3bf4149d81811d40fe331abc45ff37a207c63f5f712a0fdb69297bb";
+    sha256 = "8f558351bf4bb82b872d3bdbea7055cbb2e33ed2bdf809284bf927d4c78bf0ee";
   };
 
   disabled = !isPy3k;
-  propagatedBuildInputs = [ docutils requests requests_download ] ++ lib.optional (pythonOlder "3.6") zipfile36;
+  propagatedBuildInputs = [ docutils requests requests_download pytoml ] ++ lib.optional (pythonOlder "3.6") zipfile36;
 
   checkInputs = [ pytest testpath responses ];
 
   # Disable test that needs some ini file.
+  # Disable test that wants hg
   checkPhase = ''
-    py.test -k "not test_invalid_classifier"
+    py.test -k "not test_invalid_classifier and not test_build_sdist"
   '';
 
   meta = {
diff --git a/pkgs/development/python-modules/fonttools/default.nix b/pkgs/development/python-modules/fonttools/default.nix
index 1dfc22f769b..a567f7155f8 100644
--- a/pkgs/development/python-modules/fonttools/default.nix
+++ b/pkgs/development/python-modules/fonttools/default.nix
@@ -7,12 +7,12 @@
 
 buildPythonPackage rec {
   pname = "fonttools";
-  version = "3.17.0";
+  version = "3.21.0";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1c4f26bf32cd58d5881bfe1f42e5f0a1637a58452a60ae1623999f3ae7da0e24";
+    sha256 = "95b5c66d19dbffd57be1636d1f737c7644d280a48c28f933aeb4db73a7c83495";
     extension = "zip";
   };
 
diff --git a/pkgs/development/python-modules/ftfy/default.nix b/pkgs/development/python-modules/ftfy/default.nix
index b1ba77ab868..e54531017f4 100644
--- a/pkgs/development/python-modules/ftfy/default.nix
+++ b/pkgs/development/python-modules/ftfy/default.nix
@@ -11,11 +11,11 @@ buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "ftfy";
   # latest is 5.1.1, buy spaCy requires 4.4.3
-  version = "5.1.1";
+  version = "5.2.0";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "67a29a2fad5f72aec2d8a0a7084e4f499ed040455133ee96b1c458609fc29e78";
+    sha256 = "b9f84a1437f68ad0bb964fd9da9f6b88d090113ec9e78f290f6d6d0221468e38";
   };
 
   propagatedBuildInputs = [ html5lib wcwidth];
diff --git a/pkgs/development/python-modules/gensim/default.nix b/pkgs/development/python-modules/gensim/default.nix
index ea5fc12e432..4edd9ac3e55 100644
--- a/pkgs/development/python-modules/gensim/default.nix
+++ b/pkgs/development/python-modules/gensim/default.nix
@@ -13,10 +13,10 @@
 buildPythonPackage rec {
   pname = "gensim";
   name = "${pname}-${version}";
-  version = "3.0.1";
+  version = "3.2.0";
   src = fetchPypi {
     inherit pname version;
-    sha256 = "4827012f6f020ac4f4067c2a2a88542391917113faaa417505e1ee8a1e7e2650";
+    sha256 = "db00b68c6567ba0598d400b917c889e8801adf249170ce0a80ec38187d1b0797";
   };
 
   propagatedBuildInputs = [ smart_open numpy six scipy
diff --git a/pkgs/development/python-modules/gflags/default.nix b/pkgs/development/python-modules/gflags/default.nix
index 6fe4b7fcab8..9eb8e3b2d6c 100644
--- a/pkgs/development/python-modules/gflags/default.nix
+++ b/pkgs/development/python-modules/gflags/default.nix
@@ -2,16 +2,14 @@
 
 buildPythonPackage rec {
   version = "3.1.2";
-  pname = "gflags";
-  name = pname + "-" + version;
+  pname = "python-gflags";
 
   src = fetchPypi {
-    inherit version;
-    pname = "python-gflags";
+    inherit pname version;
     sha256 = "40ae131e899ef68e9e14aa53ca063839c34f6a168afe622217b5b875492a1ee2";
   };
 
-  buildInputs = [ pytest ];
+  checkInputs = [ pytest ];
 
   propagatedBuildInputs = [ six ];
 
diff --git a/pkgs/development/python-modules/google_api_core/default.nix b/pkgs/development/python-modules/google_api_core/default.nix
index 6aa43989aa3..c4275c47a42 100644
--- a/pkgs/development/python-modules/google_api_core/default.nix
+++ b/pkgs/development/python-modules/google_api_core/default.nix
@@ -3,11 +3,11 @@
 
 buildPythonPackage rec {
   pname = "google-api-core";
-  version = "0.1.2";
+  version = "0.1.3";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0qmjswj079w7q7zbnh8p4n2r3f831wymm9hfdlc7zfrini7184xv";
+    sha256 = "03bc4b1ab69c0e113af07e706edee50f583abe8219fe1e1d529dee191cb8e0bf";
   };
 
   propagatedBuildInputs = [ google_auth protobuf googleapis_common_protos requests grpcio ];
diff --git a/pkgs/development/python-modules/gpy/default.nix b/pkgs/development/python-modules/gpy/default.nix
index bc48a7490aa..bb39746d296 100644
--- a/pkgs/development/python-modules/gpy/default.nix
+++ b/pkgs/development/python-modules/gpy/default.nix
@@ -3,12 +3,12 @@
 
 buildPythonPackage rec {
   pname = "GPy";
-  version = "1.8.4";
+  version = "1.8.5";
   name  = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "38c1202f1790952b88c298224139ee5b14d4518e3ddc6186c60db2ece016d8c1";
+    sha256 = "1562e34629192f209273f454e41614a127c6ef04144cd0eb5992d484721d55d3";
   };
 
   # running tests produces "ImportError: cannot import name 'linalg_cython'"
diff --git a/pkgs/development/python-modules/grpcio/default.nix b/pkgs/development/python-modules/grpcio/default.nix
index c17e1bf7bf0..eeb51fb5843 100644
--- a/pkgs/development/python-modules/grpcio/default.nix
+++ b/pkgs/development/python-modules/grpcio/default.nix
@@ -3,11 +3,11 @@
 
 buildPythonPackage rec {
   pname = "grpcio";
-  version = "1.7.3";
+  version = "1.8.2";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1wkrxj1jmf2dyx207fc9ysyns9h27gls3drgg05mzdckjqr5lnl6";
+    sha256 = "1ea1336f0d1158c4e00e96a94df84b75f6bbff9816abb6cc68cbdc9442a9ac55";
   };
 
   propagatedBuildInputs = [ six protobuf ]
diff --git a/pkgs/development/python-modules/gssapi/default.nix b/pkgs/development/python-modules/gssapi/default.nix
index 3b13f8a2049..b075db5ae98 100644
--- a/pkgs/development/python-modules/gssapi/default.nix
+++ b/pkgs/development/python-modules/gssapi/default.nix
@@ -3,12 +3,12 @@ nose, shouldbe, gss, krb5Full, which, darwin }:
 
 buildPythonPackage rec {
   pname = "gssapi";
-  version = "1.2.0";
+  version = "1.3.0";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1q6ccpz6anl9vggwxdq32wp6xjh2lyfbf7av6jqnmvmyqdfwh3b9";
+    sha256 = "765205082a9490c8e8be88ac16a6249d124396a671665edeec9927a7f244d712";
   };
 
   # It's used to locate headers
diff --git a/pkgs/development/python-modules/html5lib/default.nix b/pkgs/development/python-modules/html5lib/default.nix
new file mode 100644
index 00000000000..97d2854ca22
--- /dev/null
+++ b/pkgs/development/python-modules/html5lib/default.nix
@@ -0,0 +1,42 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, flake8
+, pytest
+, pytest-expect
+, mock
+, six
+, webencodings
+}:
+
+buildPythonPackage rec {
+  pname = "html5lib";
+  version = "1.0.1";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "66cb0dcfdbbc4f9c3ba1a63fdb511ffdbd4f513b2b6d81b80cd26ce6b3fb3736";
+  };
+
+  checkInputs = [ flake8 pytest pytest-expect mock ];
+  propagatedBuildInputs = [
+    six webencodings
+  ];
+
+  checkPhase = ''
+    py.test
+  '';
+
+  meta = {
+    homepage = https://github.com/html5lib/html5lib-python;
+    downloadPage = https://github.com/html5lib/html5lib-python/releases;
+    description = "HTML parser based on WHAT-WG HTML5 specification";
+    longDescription = ''
+      html5lib is a pure-python library for parsing HTML. It is designed to
+      conform to the WHATWG HTML specification, as is implemented by all
+      major web browsers.
+    '';
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ domenkozar prikhi ];
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/htmlmin/default.nix b/pkgs/development/python-modules/htmlmin/default.nix
index 2206b3559ba..8df4b3813c4 100644
--- a/pkgs/development/python-modules/htmlmin/default.nix
+++ b/pkgs/development/python-modules/htmlmin/default.nix
@@ -1,11 +1,11 @@
 { stdenv, buildPythonPackage, fetchPypi }:
 buildPythonPackage rec {
   pname = "htmlmin";
-  version = "0.1.11";
+  version = "0.1.12";
   name = "${pname}-${version}";
   src = fetchPypi {
     inherit pname version;
-    sha256 = "f27fb96fdddeb1725ee077be532c7bea23288c69d0e996e7798f24fae7a14e5e";
+    sha256 = "50c1ef4630374a5d723900096a961cff426dff46b48f34d194a81bbe14eca178";
   };
 
   # Tests run fine in a normal source checkout, but not when being built by nix.
diff --git a/pkgs/development/python-modules/httpbin/default.nix b/pkgs/development/python-modules/httpbin/default.nix
index d11d6b3668f..2f24a1ab72b 100644
--- a/pkgs/development/python-modules/httpbin/default.nix
+++ b/pkgs/development/python-modules/httpbin/default.nix
@@ -10,12 +10,12 @@
 
 buildPythonPackage rec {
   pname = "httpbin";
-  version = "0.5.0";
+  version = "0.6.2";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "6b57f563900ecfe126015223a259463848daafbdc2687442317c0992773b9054";
+    sha256 = "0afa0486a76305cac441b5cc80d5d4ccd82b20875da7c5119ecfe616cefef45f";
   };
 
   propagatedBuildInputs = [ flask markupsafe decorator itsdangerous six ];
diff --git a/pkgs/development/python-modules/idna/default.nix b/pkgs/development/python-modules/idna/default.nix
new file mode 100644
index 00000000000..635f8b33d3c
--- /dev/null
+++ b/pkgs/development/python-modules/idna/default.nix
@@ -0,0 +1,20 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+}:
+
+buildPythonPackage rec {
+  pname = "idna";
+  version = "2.6";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f";
+  };
+
+  meta = {
+    homepage = "http://github.com/kjd/idna/";
+    description = "Internationalized Domain Names in Applications (IDNA)";
+    license = lib.licenses.bsd3;
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/ipykernel/default.nix b/pkgs/development/python-modules/ipykernel/default.nix
index a77f6ac9c2f..8547a3ef99e 100644
--- a/pkgs/development/python-modules/ipykernel/default.nix
+++ b/pkgs/development/python-modules/ipykernel/default.nix
@@ -13,12 +13,12 @@
 
 buildPythonPackage rec {
   pname = "ipykernel";
-  version = "4.6.1";
+  version = "4.7.0";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "2e1825aca4e2585b5adb7953ea16e53f53a62159ed49952a564b1e23507205db";
+    sha256 = "354986612a38f0555c43d5af2425e2a67506b63b313a0325e38904003b9d977b";
   };
 
   buildInputs = [ nose ] ++ lib.optional isPy27 mock;
diff --git a/pkgs/development/python-modules/ipywidgets/default.nix b/pkgs/development/python-modules/ipywidgets/default.nix
index 3d156323491..f77c3570c02 100644
--- a/pkgs/development/python-modules/ipywidgets/default.nix
+++ b/pkgs/development/python-modules/ipywidgets/default.nix
@@ -14,12 +14,12 @@
 
 buildPythonPackage rec {
   pname = "ipywidgets";
-  version = "7.0.5";
+  version = "7.1.0";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "321be3dc48193130ba16e8080172bb5cd052eb65e3ad0ea7b5f80ff73e24bc54";
+    sha256 = "3e2be7dea4f97c9a4df71ef065cad9f2e420dd901127bf7cb690fb56d2b34ea3";
   };
 
   # Tests are not distributed
diff --git a/pkgs/development/python-modules/iso8601/default.nix b/pkgs/development/python-modules/iso8601/default.nix
new file mode 100644
index 00000000000..4f9ff70556b
--- /dev/null
+++ b/pkgs/development/python-modules/iso8601/default.nix
@@ -0,0 +1,27 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, pytest
+}:
+
+buildPythonPackage rec {
+  pname = "iso8601";
+  version = "0.1.12";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "49c4b20e1f38aa5cf109ddcd39647ac419f928512c869dc01d5c7098eddede82";
+  };
+
+  checkInputs = [ pytest ];
+
+  checkPhase = ''
+    py.test iso8601
+  '';
+
+  meta = {
+    homepage = https://bitbucket.org/micktwomey/pyiso8601/;
+    description = "Simple module to parse ISO 8601 dates";
+    maintainers = with lib.maintainers; [ phreedom ];
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/jdcal/default.nix b/pkgs/development/python-modules/jdcal/default.nix
new file mode 100644
index 00000000000..d3ed32c0882
--- /dev/null
+++ b/pkgs/development/python-modules/jdcal/default.nix
@@ -0,0 +1,28 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, pytest
+}:
+
+buildPythonPackage rec {
+  pname = "jdcal";
+  version = "1.3";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "b760160f8dc8cc51d17875c6b663fafe64be699e10ce34b6a95184b5aa0fdc9e";
+  };
+
+  checkInputs = [ pytest ];
+
+  checkPhase = ''
+    py.test
+  '';
+
+  meta = {
+    description = "A module containing functions for converting between Julian dates and calendar dates";
+    homepage = "https://github.com/phn/jdcal";
+    license = lib.licenses.bsd2;
+    maintainers = with lib.maintainers; [ lihop ];
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/jedi/default.nix b/pkgs/development/python-modules/jedi/default.nix
index bf9f9f9c082..df8a287ea09 100644
--- a/pkgs/development/python-modules/jedi/default.nix
+++ b/pkgs/development/python-modules/jedi/default.nix
@@ -2,12 +2,12 @@
 
 buildPythonPackage rec {
   pname = "jedi";
-  version = "0.11.0";
+  version = "0.11.1";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "f6d5973573e76b1fd2ea75f6dcd6445d02d41ff3af5fc61b275b4e323d1dd396";
+    sha256 = "d6e799d04d1ade9459ed0f20de47c32f2285438956a677d083d3c98def59fa97";
   };
 
   postPatch = ''
diff --git a/pkgs/development/python-modules/jellyfish/default.nix b/pkgs/development/python-modules/jellyfish/default.nix
new file mode 100644
index 00000000000..db83e6cb299
--- /dev/null
+++ b/pkgs/development/python-modules/jellyfish/default.nix
@@ -0,0 +1,24 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, pytest
+, unicodecsv
+}:
+
+buildPythonPackage rec {
+  pname = "jellyfish";
+  version = "0.5.6";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "887a9a49d0caee913a883c3e7eb185f6260ebe2137562365be422d1316bd39c9";
+  };
+
+  checkInputs = [ pytest unicodecsv ];
+
+  meta = {
+    homepage = https://github.com/sunlightlabs/jellyfish;
+    description = "Approximate and phonetic matching of strings";
+    maintainers = with lib.maintainers; [ koral ];
+  };
+}
diff --git a/pkgs/development/python-modules/jinja2/default.nix b/pkgs/development/python-modules/jinja2/default.nix
index ca286ae06aa..cb0eb130a2f 100644
--- a/pkgs/development/python-modules/jinja2/default.nix
+++ b/pkgs/development/python-modules/jinja2/default.nix
@@ -1,20 +1,24 @@
-{ stdenv, buildPythonPackage, fetchPypi
-, markupsafe }:
+{ stdenv, buildPythonPackage, fetchFromGitHub
+, pytest, markupsafe }:
 
 buildPythonPackage rec {
   pname = "Jinja2";
   version = "2.9.6";
   name = "${pname}-${version}";
 
-  src = fetchPypi {
-    inherit pname version;
-    sha256 = "1zzrkywhziqffrzks14kzixz7nd4yh2vc0fb04a68vfd2ai03anx";
+  src = fetchFromGitHub {
+    owner = "pallets";
+    repo = "jinja";
+    rev = version;
+    sha256 = "1xxc5vdhz214aawmllv0fi4ak6d7zac662yb7gn1xfgqfz392pg5";
   };
 
+  checkInputs = [ pytest ];
   propagatedBuildInputs = [ markupsafe ];
 
-  # No tests included
-  doCheck = false;
+  checkPhase = ''
+    pytest -v
+  '';
 
   meta = with stdenv.lib; {
     homepage = http://jinja.pocoo.org/;
@@ -24,7 +28,7 @@ buildPythonPackage rec {
       Jinja2 is a template engine written in pure Python. It provides a
       Django inspired non-XML syntax but supports inline expressions and
       an optional sandboxed environment.
-      '';
+    '';
     platforms = platforms.all;
     maintainers = with maintainers; [ pierron garbas sjourdois ];
   };
diff --git a/pkgs/development/python-modules/jsbeautifier/default.nix b/pkgs/development/python-modules/jsbeautifier/default.nix
index a2278566c6d..19b1eeefa53 100644
--- a/pkgs/development/python-modules/jsbeautifier/default.nix
+++ b/pkgs/development/python-modules/jsbeautifier/default.nix
@@ -2,7 +2,7 @@
 
 buildPythonApplication rec {
   pname = "jsbeautifier";
-  version = "1.7.4";
+  version = "1.7.5";
   name = "${pname}-${version}";
 
   propagatedBuildInputs = [ six ];
@@ -11,7 +11,7 @@ buildPythonApplication rec {
 
   src = fetchurl {
     url = "mirror://pypi/j/jsbeautifier/${name}.tar.gz";
-    sha256 = "7fc14f279117a55a5e854602f6e8c1cb178c6d83f7cf75e2e9f50678fe11079e";
+    sha256 = "78eb1e5c8535484f0d0b588aca38da3fb5e0e34de2d1ab53c077e71c55757473";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/python-modules/jsondiff/default.nix b/pkgs/development/python-modules/jsondiff/default.nix
new file mode 100644
index 00000000000..9d4331c8ea8
--- /dev/null
+++ b/pkgs/development/python-modules/jsondiff/default.nix
@@ -0,0 +1,24 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+}:
+
+buildPythonPackage rec {
+  pname = "jsondiff";
+  version = "1.1.1";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "2d0437782de9418efa34e694aa59f43d7adb1899bd9a793f063867ddba8f7893";
+  };
+
+  # No tests
+  doCheck = false;
+
+  meta = {
+    description = "Diff JSON and JSON-like structures in Python";
+    homepage = https://github.com/ZoomerAnalytics/jsondiff;
+    license = lib.licenses.mit;
+  };
+
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/jsonpatch/default.nix b/pkgs/development/python-modules/jsonpatch/default.nix
index 39f36b1d949..8d238b4746d 100644
--- a/pkgs/development/python-modules/jsonpatch/default.nix
+++ b/pkgs/development/python-modules/jsonpatch/default.nix
@@ -6,12 +6,12 @@
 
 buildPythonPackage rec {
   pname = "jsonpatch";
-  version = "1.16";
+  version = "1.21";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "f025c28a08ce747429ee746bb21796c3b6417ec82288f8fe6514db7398f2af8a";
+    sha256 = "11f5ffdf543a83047a2f54ac28f8caad7f34724cb1ea26b27547fd974f1a2153";
   };
 
   # test files are missing
diff --git a/pkgs/development/python-modules/jsonpickle/default.nix b/pkgs/development/python-modules/jsonpickle/default.nix
new file mode 100644
index 00000000000..2d9f02a5aff
--- /dev/null
+++ b/pkgs/development/python-modules/jsonpickle/default.nix
@@ -0,0 +1,23 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+}:
+
+buildPythonPackage rec {
+  pname = "jsonpickle";
+  version = "0.9.5";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "cc25dc79571d4ad7db59d05ddb7de0d76a8d598cf6136e1dbeaa9361ebcfe749";
+  };
+
+  doCheck = false;
+
+  meta = {
+    description = "Python library for serializing any arbitrary object graph into JSON";
+    homepage = http://jsonpickle.github.io/;
+    license = lib.licenses.bsd3;
+  };
+
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/jupyter_client/default.nix b/pkgs/development/python-modules/jupyter_client/default.nix
index 3782d313df8..e88b7f937a5 100644
--- a/pkgs/development/python-modules/jupyter_client/default.nix
+++ b/pkgs/development/python-modules/jupyter_client/default.nix
@@ -1,32 +1,38 @@
 { lib
 , buildPythonPackage
 , fetchPypi
-, nose
 , traitlets
 , jupyter_core
 , pyzmq
 , dateutil
 , isPyPy
 , py
+, ipykernel
+, ipython
+, mock
+, pytest
 }:
 
 buildPythonPackage rec {
   pname = "jupyter_client";
-  version = "5.1.0";
-  name = "${pname}-${version}";
+  version = "5.2.0";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "08756b021765c97bc5665390700a4255c2df31666ead8bff116b368d09912aba";
+    sha256 = "ca30cf1786047925ebacd6f6faa3a993efaa004b584f7d83bc8b807f7cd3f6bb";
   };
 
-  buildInputs = [ nose ];
+  checkInputs = [ ipykernel ipython mock pytest ];
   propagatedBuildInputs = [traitlets jupyter_core pyzmq dateutil] ++ lib.optional isPyPy py;
 
   checkPhase = ''
-    nosetests -v
+    py.test
   '';
 
+  patches = [
+    ./wheel_workaround.patch
+  ];
+
   # Circular dependency with ipykernel
   doCheck = false;
 
diff --git a/pkgs/development/python-modules/jupyter_client/wheel_workaround.patch b/pkgs/development/python-modules/jupyter_client/wheel_workaround.patch
new file mode 100644
index 00000000000..926fcb26448
--- /dev/null
+++ b/pkgs/development/python-modules/jupyter_client/wheel_workaround.patch
@@ -0,0 +1,13 @@
+diff --git a/setup.py b/setup.py
+index 95d4774..ee72cbc 100644
+--- a/setup.py
++++ b/setup.py
+@@ -86,7 +86,7 @@ setup_args = dict(
+     extras_require   = {
+         'test': ['ipykernel', 'ipython', 'mock'],
+         'test:python_version == "3.3"': ['pytest<3.3.0'],
+-        'test:python_version >= "3.4" or python_version == "2.7"': ['pytest'],
++        'test:(python_version >= "3.4" or python_version == "2.7")': ['pytest'],
+     },
+     cmdclass         = {
+         'bdist_egg': bdist_egg if 'bdist_egg' in sys.argv else bdist_egg_disabled,
diff --git a/pkgs/development/python-modules/jupyter_core/default.nix b/pkgs/development/python-modules/jupyter_core/default.nix
index 4db36cf7b37..403f7c047d5 100644
--- a/pkgs/development/python-modules/jupyter_core/default.nix
+++ b/pkgs/development/python-modules/jupyter_core/default.nix
@@ -11,15 +11,15 @@
 
 buildPythonPackage rec {
   pname = "jupyter_core";
-  version = "4.3.0";
+  version = "4.4.0";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "a96b129e1641425bf057c3d46f4f44adce747a7d60107e8ad771045c36514d40";
+    sha256 = "ba70754aa680300306c699790128f6fbd8c306ee5927976cbe48adacf240c0b7";
   };
 
-  buildInputs = [ pytest mock glibcLocales ];
+  checkInputs = [ pytest mock glibcLocales ];
   propagatedBuildInputs = [ ipython traitlets ];
 
   patches = [ ./tests_respect_pythonpath.patch ];
diff --git a/pkgs/development/python-modules/jupyter_core/tests_respect_pythonpath.patch b/pkgs/development/python-modules/jupyter_core/tests_respect_pythonpath.patch
index 61415b756ab..7e7e9ae93a0 100644
--- a/pkgs/development/python-modules/jupyter_core/tests_respect_pythonpath.patch
+++ b/pkgs/development/python-modules/jupyter_core/tests_respect_pythonpath.patch
@@ -1,24 +1,20 @@
---- a/jupyter_core/tests/test_command.py	2016-09-13 15:22:49.000000000 +0200
-+++ b/jupyter_core/tests/test_command.py	2017-10-23 12:49:27.489527705 +0200
-@@ -113,7 +113,10 @@
-     witness = a.join(witness_cmd)
-     witness.write('#!%s\n%s\n' % (sys.executable, 'print("WITNESS ME")'))
-     witness.chmod(0o700)
--    out = check_output([sys.executable, str(jupyter), 'witness'], env={'PATH': ''})
-+    out = check_output(
-+        [sys.executable, str(jupyter), 'witness'],
-+        env={'PATH': '', 'PYTHONPATH': os.environ['PYTHONPATH']}
-+    )
-     assert b'WITNESS' in out
- 
- 
-@@ -136,5 +139,8 @@
-     witness_b.write('#!%s\n%s\n' % (sys.executable, 'print("WITNESS B")'))
-     witness_b.chmod(0o700)
- 
--    out = check_output([sys.executable, str(jupyter), 'witness'], env={'PATH': str(b)})
-+    out = check_output(
-+        [sys.executable, str(jupyter), 'witness'],
-+        env={'PATH': str(b), 'PYTHONPATH': os.environ['PYTHONPATH']}
-+    )
-     assert b'WITNESS A' in out
+--- a/jupyter_core/tests/test_command.py
++++ b/jupyter_core/tests/test_command.py
+@@ -131,7 +131,7 @@ def test_not_on_path(tmpdir):
+     witness_src = '#!%s\n%s\n' % (sys.executable, 'print("WITNESS ME")')
+     write_executable(witness, witness_src)
+
+-    env = {'PATH': ''}
++    env = {'PATH': '', 'PYTHONPATH': os.environ['PYTHONPATH']}
+     if 'SYSTEMROOT' in os.environ:  # Windows http://bugs.python.org/issue20614
+         env[str('SYSTEMROOT')] = os.environ['SYSTEMROOT']
+     if sys.platform == 'win32':
+@@ -157,7 +157,7 @@ def test_path_priority(tmpdir):
+     witness_b_src = '#!%s\n%s\n' % (sys.executable, 'print("WITNESS B")')
+     write_executable(witness_b, witness_b_src)
+
+-    env = {'PATH':  str(b)}
++    env = {'PATH':  str(b), 'PYTHONPATH': os.environ['PYTHONPATH']}
+     if 'SYSTEMROOT' in os.environ:  # Windows http://bugs.python.org/issue20614
+         env[str('SYSTEMROOT')] = os.environ['SYSTEMROOT']
+     if sys.platform == 'win32':
diff --git a/pkgs/development/python-modules/keras/default.nix b/pkgs/development/python-modules/keras/default.nix
index d88b6e4999b..b6c56cc8bc6 100644
--- a/pkgs/development/python-modules/keras/default.nix
+++ b/pkgs/development/python-modules/keras/default.nix
@@ -5,12 +5,12 @@
 
 buildPythonPackage rec {
   pname = "Keras";
-  version = "2.1.1";
+  version = "2.1.2";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "f0ca2458c60d9711edf4291230b31795307ad3781cb6232ff4792b53c8f55123";
+    sha256 = "3ee56fc129d9d00b1916046e50056047836f97ada59df029e5661fb34442d5e8";
   };
 
   checkInputs = [
diff --git a/pkgs/development/python-modules/keyring/default.nix b/pkgs/development/python-modules/keyring/default.nix
index ca7a518665c..f88bdb84e0c 100644
--- a/pkgs/development/python-modules/keyring/default.nix
+++ b/pkgs/development/python-modules/keyring/default.nix
@@ -6,11 +6,11 @@
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "keyring";
-  version = "10.4.0";
+  version = "10.5.1";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "09iv50c14mdmdk7sjd6bb47yg7347gymh6r8c0q4gfnzs173y6lh";
+    sha256 = "f10674bb6ecbf82e2b713627c48ad0e84178e1c9d3dc1f0373261a0765402fb2";
   };
 
   buildInputs = [
diff --git a/pkgs/development/python-modules/ldap/default.nix b/pkgs/development/python-modules/ldap/default.nix
index 635308f3760..32f25eeda42 100644
--- a/pkgs/development/python-modules/ldap/default.nix
+++ b/pkgs/development/python-modules/ldap/default.nix
@@ -1,18 +1,18 @@
 { lib, writeText, buildPythonPackage, isPy3k, fetchPypi
-, openldap, cyrus_sasl, openssl, pytest }:
+, openldap, cyrus_sasl, openssl, pytest, pyasn1 }:
 
 buildPythonPackage rec {
   pname = "python-ldap";
-  version = "2.4.45";
+  version = "2.5.2";
   name = "${pname}-${version}";
   disabled = isPy3k;
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "824fde180a53772e23edc031c4dd64ac1af4a3eade78f00d9d510937d562f64e";
+    sha256 = "b8c134dfedaef0e6ff4a4b94277708dcadb758b448905a83b8946df077356ed2";
   };
 
-  buildInputs = [ pytest ];
+  checkInputs = [ pytest pyasn1 ];
 
   checkPhase = ''
     # Needed by tests to setup a mockup ldap server.
diff --git a/pkgs/development/python-modules/ldap3/default.nix b/pkgs/development/python-modules/ldap3/default.nix
index 895272f351d..202bceafae3 100644
--- a/pkgs/development/python-modules/ldap3/default.nix
+++ b/pkgs/development/python-modules/ldap3/default.nix
@@ -1,13 +1,12 @@
 { stdenv, fetchPypi, buildPythonPackage, gssapi, pyasn1 }:
 
 buildPythonPackage rec {
-  version = "2.3";
+  version = "2.4";
   pname = "ldap3";
-  name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1b36lwil4iflk2ay8gi663abpnfm8id7qg4n3jkmmqbnc1sv6mn0";
+    sha256 = "888015f849eb33852583bbaf382f61593b03491cdac6098fd5d4d0252e0e7e66";
   };
 
   buildInputs = [ gssapi ];
diff --git a/pkgs/development/python-modules/libusb1/default.nix b/pkgs/development/python-modules/libusb1/default.nix
index adf1bc23618..f3b48eaa576 100644
--- a/pkgs/development/python-modules/libusb1/default.nix
+++ b/pkgs/development/python-modules/libusb1/default.nix
@@ -12,7 +12,7 @@ buildPythonPackage rec {
   postPatch = lib.optionalString stdenv.isLinux ''
     substituteInPlace usb1/libusb1.py --replace \
       "ctypes.util.find_library(base_name)" \
-      "'${libusb1}/lib/libusb${stdenv.hostPlatform.extensions.sharedLibrary}'"
+      "'${libusb1}/lib/libusb-1.0${stdenv.hostPlatform.extensions.sharedLibrary}'"
   '';
 
   buildInputs = [ libusb1 ];
diff --git a/pkgs/development/python-modules/line_profiler/default.nix b/pkgs/development/python-modules/line_profiler/default.nix
index 570bba2a8c4..26dfda613f7 100644
--- a/pkgs/development/python-modules/line_profiler/default.nix
+++ b/pkgs/development/python-modules/line_profiler/default.nix
@@ -9,12 +9,12 @@
 
 buildPythonPackage rec {
   pname = "line_profiler";
-  version = "2.0";
+  version = "2.1.2";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "739f8ad0e4bcd0cb82e99afc09e00a0351234f6b3f0b1f7f0090a8a2fbbf8381";
+    sha256 = "efa66e9e3045aa7cb1dd4bf0106e07dec9f80bc781a993fbaf8162a36c20af5c";
   };
 
   buildInputs = [ cython ];
diff --git a/pkgs/development/python-modules/llfuse/default.nix b/pkgs/development/python-modules/llfuse/default.nix
index 4c4c89d8f19..ef4d9fb5d02 100644
--- a/pkgs/development/python-modules/llfuse/default.nix
+++ b/pkgs/development/python-modules/llfuse/default.nix
@@ -4,12 +4,12 @@
 
 buildPythonPackage rec {
   pname = "llfuse";
-  version = "1.0";
+  version = "1.3.2";
   name = pname + "-" + version;
 
   src = fetchurl {
     url = "mirror://pypi/l/llfuse/${name}.tar.bz2";
-    sha256 = "1li7q04ljrvwharw4fblcbfhvk6s0l3lnv8yqb4c22lcgbkiqlps";
+    sha256 = "96252a286a2be25810904d969b330ef2a57c2b9c18c5b503bbfbae40feb2bb63";
   };
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/development/python-modules/llvmlite/default.nix b/pkgs/development/python-modules/llvmlite/default.nix
index 57deaf3caf3..d702d8f95b0 100644
--- a/pkgs/development/python-modules/llvmlite/default.nix
+++ b/pkgs/development/python-modules/llvmlite/default.nix
@@ -1,5 +1,5 @@
 { stdenv
-, fetchurl
+, fetchPypi
 , buildPythonPackage
 , python
 , llvm
@@ -10,21 +10,20 @@
 
 buildPythonPackage rec {
   pname = "llvmlite";
-  name = "${pname}-${version}";
-  version = "0.20.0";
+  version = "0.21.0";
 
   disabled = isPyPy;
 
-  src = fetchurl {
-    url = "mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${name}.tar.gz";
-    sha256 = "b2f174848df16bb9195a07fec102110a06d018da736bd9b3570a54d44c797c29";
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "3a5dd0695fdfb9fd47464cd71791b84935bf9642e11f4811d57aa1f2da8cdaa8";
   };
 
   propagatedBuildInputs = [ llvm ] ++ stdenv.lib.optional (pythonOlder "3.4") enum34;
 
   # Disable static linking
   # https://github.com/numba/llvmlite/issues/93
-  patchPhase = ''
+  postPatch = ''
     substituteInPlace ffi/Makefile.linux --replace "-static-libstdc++" ""
 
     substituteInPlace llvmlite/tests/test_binding.py --replace "test_linux" "nope"
diff --git a/pkgs/development/python-modules/lxml/default.nix b/pkgs/development/python-modules/lxml/default.nix
new file mode 100644
index 00000000000..bfd0c8227ee
--- /dev/null
+++ b/pkgs/development/python-modules/lxml/default.nix
@@ -0,0 +1,27 @@
+{ stdenv
+, buildPythonPackage
+, fetchPypi
+, libxml2
+, libxslt
+}:
+
+buildPythonPackage rec {
+  pname = "lxml";
+  version = "4.1.1";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "940caef1ec7c78e0c34b0f6b94fe42d0f2022915ffc78643d28538a5cfd0f40e";
+  };
+
+  buildInputs = [ libxml2 libxslt ];
+
+  hardeningDisable = stdenv.lib.optional stdenv.isDarwin "format";
+
+  meta = {
+    description = "Pythonic binding for the libxml2 and libxslt libraries";
+    homepage = http://lxml.de;
+    license = stdenv.lib.licenses.bsd3;
+    maintainers = with stdenv.lib.maintainers; [ sjourdois ];
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/marionette-harness/default.nix b/pkgs/development/python-modules/marionette-harness/default.nix
index fbdd13a7f38..f909974db6b 100644
--- a/pkgs/development/python-modules/marionette-harness/default.nix
+++ b/pkgs/development/python-modules/marionette-harness/default.nix
@@ -14,13 +14,13 @@
 
 buildPythonPackage rec {
   pname = "marionette-harness";
-  version = "4.1.0";
+  version = "4.3.0";
   name = "${pname}-${version}";
   disabled = isPy3k;
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "20c188791e28d586c58acf86ff28cb704c4195a4da6eb10db7b8c6771e3f2983";
+    sha256 = "a98bb65a0c63f60d9e3d7ef21dabc9c29676917dc2ec0d46851a3ed694c820cc";
   };
 
   propagatedBuildInputs = [ mozprofile mozversion browsermob-proxy moztest 
diff --git a/pkgs/development/python-modules/markdown/default.nix b/pkgs/development/python-modules/markdown/default.nix
new file mode 100644
index 00000000000..515dee0e766
--- /dev/null
+++ b/pkgs/development/python-modules/markdown/default.nix
@@ -0,0 +1,28 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, nose
+, pyyaml
+}:
+
+buildPythonPackage rec {
+  pname = "Markdown";
+  version = "2.6.10";
+
+  src = fetchPypi {
+    extension = "zip";
+    inherit pname version;
+    sha256 = "cfa536d1ee8984007fcecc5a38a493ff05c174cb74cb2341dafd175e6bc30851";
+  };
+
+  # error: invalid command 'test'
+#   doCheck = false;
+
+  checkInputs = [ nose pyyaml ];
+
+  meta = {
+    description = "A Python implementation of John Gruber’s Markdown with Extension support";
+    homepage = https://github.com/Python-Markdown/markdown;
+    license = lib.licenses.bsd3;
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/marshmallow/default.nix b/pkgs/development/python-modules/marshmallow/default.nix
index afb60801dc9..a9db6ef1e84 100644
--- a/pkgs/development/python-modules/marshmallow/default.nix
+++ b/pkgs/development/python-modules/marshmallow/default.nix
@@ -5,7 +5,7 @@
 buildPythonPackage rec {
   pname = "marshmallow";
   name = "${pname}-${version}";
-  version = "2.14.0";
+  version = "2.15.0";
 
   meta = {
     homepage = "https://github.com/marshmallow-code/marshmallow";
@@ -18,7 +18,7 @@ buildPythonPackage rec {
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "09943a460026b9a61c3f4cedd0e5ccfed7cfce3271debd19e3f97df561088718";
+    sha256 = "d3f31fe7be2106b1d783cbd0765ef4e1c6615505514695f33082805f929dd584";
   };
 
   propagatedBuildInputs = [ dateutil simplejson ];
diff --git a/pkgs/development/python-modules/matplotlib/default.nix b/pkgs/development/python-modules/matplotlib/default.nix
index 345a21ecddf..33505b5f618 100644
--- a/pkgs/development/python-modules/matplotlib/default.nix
+++ b/pkgs/development/python-modules/matplotlib/default.nix
@@ -20,13 +20,13 @@ assert enableTk -> (tcl != null)
 assert enableQt -> pyqt4 != null;
 
 buildPythonPackage rec {
-  version = "2.1.0";
+  version = "2.1.1";
   pname = "matplotlib";
   name = "${pname}-${version}";
 
   src = fetchurl {
     url = "mirror://pypi/m/matplotlib/${name}.tar.gz";
-    sha256 = "4b5f16c9cefde553ea79975305dcaa67c8e13d927b6e55aa14b4a8d867e25387";
+    sha256 = "659f5e1aa0e0f01488c61eff47560c43b8be511c6a29293d7f3896ae17bd8b23";
   };
 
   NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1";
diff --git a/pkgs/development/python-modules/mistune/default.nix b/pkgs/development/python-modules/mistune/default.nix
index 14aef5b00d1..7ab4a184263 100644
--- a/pkgs/development/python-modules/mistune/default.nix
+++ b/pkgs/development/python-modules/mistune/default.nix
@@ -6,12 +6,12 @@
 
 buildPythonPackage rec {
   pname = "mistune";
-  version = "0.7.4";
+  version = "0.8.3";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0byj9jg9ly7karf5sb1aqcw7avaim9sxl8ws7yw7p1fibjgsy5w5";
+    sha256 = "bc10c33bfdcaa4e749b779f62f60d6e12f8215c46a292d05e486b869ae306619";
   };
 
   buildInputs = [ nose ];
diff --git a/pkgs/development/python-modules/moto/default.nix b/pkgs/development/python-modules/moto/default.nix
index cf74e1dc134..d5c40c67b36 100644
--- a/pkgs/development/python-modules/moto/default.nix
+++ b/pkgs/development/python-modules/moto/default.nix
@@ -1,17 +1,20 @@
-{ stdenv, buildPythonPackage, fetchPypi, jinja2, werkzeug, flask, requests, pytz
-, six, boto, httpretty, xmltodict, nose, sure, boto3, freezegun, dateutil }:
+{ stdenv, buildPythonPackage, fetchPypi, jinja2, werkzeug, flask
+, requests, pytz, backports_tempfile, cookies, jsondiff, botocore, aws-xray-sdk, docker
+, six, boto, httpretty, xmltodict, nose, sure, boto3, freezegun, dateutil, mock, pyaml }:
 
 buildPythonPackage rec {
   pname = "moto";
-  version = "0.4.31";
-  name    = "moto-${version}";
+  version = "1.1.25";
+
   src = fetchPypi {
     inherit pname version;
-    sha256 = "19s8hfz4mzzzdksa0ddlvrga5mxdaqahk89p5l29a5id8127shr8";
+    sha256 = "d427d6e1a81e926c2b6a071453807b05f4736d65068493e1f3055ac7ee24ea21";
   };
 
   propagatedBuildInputs = [
+    aws-xray-sdk
     boto
+    boto3
     dateutil
     flask
     httpretty
@@ -21,6 +24,13 @@ buildPythonPackage rec {
     requests
     six
     xmltodict
+    mock
+    pyaml
+    backports_tempfile
+    cookies
+    jsondiff
+    botocore
+    docker
   ];
 
   checkInputs = [ boto3 nose sure freezegun ];
diff --git a/pkgs/development/python-modules/mygpoclient/default.nix b/pkgs/development/python-modules/mygpoclient/default.nix
index 14819b0b66e..097898a2d84 100644
--- a/pkgs/development/python-modules/mygpoclient/default.nix
+++ b/pkgs/development/python-modules/mygpoclient/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchFromGitHub, buildPythonPackage, nose, minimock }:
 
 buildPythonPackage rec {
-  name = "mygpoclient-${version}";
+  pname = "mypgoclient";
   version = "1.8";
 
   src = fetchFromGitHub {
@@ -11,7 +11,7 @@ buildPythonPackage rec {
     sha256 = "0aa28wc55x3rxa7clwfv5v5500ffyaq0vkxaa3v01y1r93dxkdvp";
   };
 
-  buildInputs = [ nose minimock ];
+  checkInputs = [ nose minimock ];
 
   checkPhase = ''
     nosetests
@@ -25,7 +25,6 @@ buildPythonPackage rec {
     '';
     homepage = https://github.com/gpodder/mygpoclient;
     license = with licenses; [ gpl3 ];
-    platforms = with platforms; linux ++ darwin;
     maintainers = with maintainers; [ skeidel ];
   };
 }
diff --git a/pkgs/development/python-modules/nbxmpp/default.nix b/pkgs/development/python-modules/nbxmpp/default.nix
index 964b42fe4ee..26525adb1c9 100644
--- a/pkgs/development/python-modules/nbxmpp/default.nix
+++ b/pkgs/development/python-modules/nbxmpp/default.nix
@@ -2,11 +2,11 @@
 
 buildPythonPackage rec {
   pname = "nbxmpp";
-  version = "0.6.0";
+  version = "0.6.2";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0x495yb0abkdspyziw7dyyjwxx6ivnv5zznk92wa3mcind5s9757";
+    sha256 = "10bfb12b083a7509779298c31b4b61e2ed7e78d1960cbcfb3de8d38f3b830991";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/python-modules/networkx/default.nix b/pkgs/development/python-modules/networkx/default.nix
new file mode 100644
index 00000000000..f6fc4139c85
--- /dev/null
+++ b/pkgs/development/python-modules/networkx/default.nix
@@ -0,0 +1,34 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, nose
+, decorator
+, isPy36
+, isPyPy
+}:
+
+buildPythonPackage rec {
+  pname = "networkx";
+  version = "1.11";
+
+  # Currently broken on PyPy.
+  # https://github.com/networkx/networkx/pull/1361
+  disabled = isPyPy;
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1f74s56xb4ggixiq0vxyfxsfk8p20c7a099lpcf60izv1php03hd";
+  };
+
+  checkInputs = [ nose ];
+  propagatedBuildInputs = [ decorator ];
+
+  # 17 failures with 3.6 https://github.com/networkx/networkx/issues/2396#issuecomment-304437299
+  doCheck = !(isPy36);
+
+  meta = {
+    homepage = "https://networkx.github.io/";
+    description = "Library for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks";
+    license = lib.licenses.bsd3;
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/nilearn/default.nix b/pkgs/development/python-modules/nilearn/default.nix
index 16036a69179..6133abac705 100644
--- a/pkgs/development/python-modules/nilearn/default.nix
+++ b/pkgs/development/python-modules/nilearn/default.nix
@@ -3,12 +3,12 @@
 
 buildPythonPackage rec {
   pname = "nilearn";
-  version = "0.3.1";
+  version = "0.4.0";
   name = pname + "-" + version;
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0kkarh5cdcd2czs0bf0s1g51qas84mfxfq0dzd7k5h5l0qr4zy06";
+    sha256 = "bb692254bde35d7e1d3d1534d9b3117810b35a744724625f150fbbc64d519c02";
   };
 
   checkPhase = "nosetests --exclude with_expand_user nilearn/tests";
diff --git a/pkgs/development/python-modules/notebook/default.nix b/pkgs/development/python-modules/notebook/default.nix
index 2a23ff4de78..71261fb1f40 100644
--- a/pkgs/development/python-modules/notebook/default.nix
+++ b/pkgs/development/python-modules/notebook/default.nix
@@ -22,12 +22,12 @@
 
 buildPythonPackage rec {
   pname = "notebook";
-  version = "5.2.1";
+  version = "5.2.2";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "4ae5b81dd39b37cdd99dcffe83a5182c849947b92d46ac4d2b5093af2bb9f224";
+    sha256 = "7bb54fb61b9c5426bc116f840541b973431198e00ea2896122d05fc122dbbd67";
   };
 
   LC_ALL = "en_US.utf8";
diff --git a/pkgs/development/python-modules/numba/default.nix b/pkgs/development/python-modules/numba/default.nix
index b0d7ae72c95..97aad8c0928 100644
--- a/pkgs/development/python-modules/numba/default.nix
+++ b/pkgs/development/python-modules/numba/default.nix
@@ -1,5 +1,5 @@
 { stdenv
-, fetchurl
+, fetchPypi
 , python
 , buildPythonPackage
 , isPy27
@@ -14,13 +14,12 @@
 }:
 
 buildPythonPackage rec {
-  version = "0.35.0";
+  version = "0.36.2";
   pname = "numba";
-  name = "${pname}-${version}";
 
-  src = fetchurl {
-    url = "mirror://pypi/n/numba/${name}.tar.gz";
-    sha256 = "11564937757605bee590c5758c73cfe9fd6d569726b56d970316a6228971ecc3";
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "d61597808ce511e81b64e32da664f52beb7d947bf834dde8b8b60b29d205e5c2";
   };
 
   NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-I${libcxx}/include/c++/v1";
@@ -29,7 +28,7 @@ buildPythonPackage rec {
 
   # Copy test script into $out and run the test suite.
   checkPhase = ''
-    python -m numba.runtests
+    ${python.interpreter} -m numba.runtests
   '';
   # ImportError: cannot import name '_typeconv'
   doCheck = false;
diff --git a/pkgs/development/python-modules/odfpy/default.nix b/pkgs/development/python-modules/odfpy/default.nix
index a80cd827c6d..39ed5edef0b 100644
--- a/pkgs/development/python-modules/odfpy/default.nix
+++ b/pkgs/development/python-modules/odfpy/default.nix
@@ -1,24 +1,21 @@
 { lib
 , buildPythonPackage
 , fetchPypi
+, python
 }:
 
 buildPythonPackage rec {
   pname = "odfpy";
-  version = "1.3.5";
+  version = "1.3.6";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "6f8163f8464868cff9421a058f25566e41d73c8f7e849c021b86630941b44366";
+    sha256 = "6bcaf3b23aa9e49ed8c8c177266539b211add4e02402748a994451482a10cb1b";
   };
 
   checkPhase = ''
-    pushd tests
-    rm runtests
-    for file in test*.py; do
-        python  $file
-    done
+    ${python.interpreter} -m unittest discover -s tests
   '';
 
   meta = {
diff --git a/pkgs/development/python-modules/pandas/default.nix b/pkgs/development/python-modules/pandas/default.nix
index e589e777f0d..3f9188a6322 100644
--- a/pkgs/development/python-modules/pandas/default.nix
+++ b/pkgs/development/python-modules/pandas/default.nix
@@ -28,12 +28,12 @@ let
   inherit (stdenv) isDarwin;
 in buildPythonPackage rec {
   pname = "pandas";
-  version = "0.21.1";
+  version = "0.22.0";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "c5f5cba88bf0659554c41c909e1f78139f6fce8fa9315a29a23692b38ff9788a";
+    sha256 = "44a94091dd71f05922eec661638ec1a35f26d573c119aa2fad964f10a2880e6c";
   };
 
   LC_ALL = "en_US.UTF-8";
diff --git a/pkgs/development/python-modules/parse-type/default.nix b/pkgs/development/python-modules/parse-type/default.nix
index 69a02c42b74..8c927e4aed0 100644
--- a/pkgs/development/python-modules/parse-type/default.nix
+++ b/pkgs/development/python-modules/parse-type/default.nix
@@ -3,14 +3,13 @@
 , pytest, pytestrunner
 , parse, six, enum34
 }:
+
 buildPythonPackage rec {
-  pname = "parse-type";
+  pname = "parse_type";
   version = "0.3.4";
-  name = "${pname}-${version}";
 
   src = fetchPypi {
-    inherit version;
-    pname = "parse_type";
+    inherit pname version;
     sha256 = "3dd0b323bafcb8c25e000ce5589042a1c99cba9c3bec77b9f591e46bc9606147";
   };
 
diff --git a/pkgs/development/python-modules/partd/default.nix b/pkgs/development/python-modules/partd/default.nix
new file mode 100644
index 00000000000..1098c550839
--- /dev/null
+++ b/pkgs/development/python-modules/partd/default.nix
@@ -0,0 +1,35 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, pytest
+, locket
+, numpy
+, pandas
+, pyzmq
+, toolz
+}:
+
+buildPythonPackage rec {
+  pname = "partd";
+  version = "0.3.8";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "67291f1c4827cde3e0148b3be5d69af64b6d6169feb9ba88f0a6cfe77089400f";
+  };
+
+  checkInputs = [ pytest ];
+
+  propagatedBuildInputs = [ locket numpy pandas pyzmq toolz ];
+
+  checkPhase = ''
+    rm partd/tests/test_zmq.py # requires network & fails
+    py.test
+  '';
+
+  meta = {
+    description = "Appendable key-value storage";
+    license = with lib.licenses; [ bsd3 ];
+    homepage = https://github.com/dask/partd/;
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/path.py/default.nix b/pkgs/development/python-modules/path.py/default.nix
index 6b4af3ffcd4..2830477d3cf 100644
--- a/pkgs/development/python-modules/path.py/default.nix
+++ b/pkgs/development/python-modules/path.py/default.nix
@@ -9,12 +9,12 @@
 
 buildPythonPackage rec {
   pname = "path.py";
-  version = "10.4";
+  version = "10.5";
   name = pname + "-" + version;
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "c63c75777c8a01f7b273c0065a8ea1e3ba0c9b369fa4a2601831e412b2c4881a";
+    sha256 = "63a7af08676668fd51750f111affbd38c1a13c61aba15c6665b16681771c79a8";
   };
 
   checkInputs = [ pytest pytestrunner ];
diff --git a/pkgs/development/python-modules/pathlib2/default.nix b/pkgs/development/python-modules/pathlib2/default.nix
index 62d5c43a4b3..18c083298e6 100644
--- a/pkgs/development/python-modules/pathlib2/default.nix
+++ b/pkgs/development/python-modules/pathlib2/default.nix
@@ -5,19 +5,20 @@
 , pythonOlder
 , scandir
 , glibcLocales
+, mock
 }:
 
 if !(pythonOlder "3.4") then null else buildPythonPackage rec {
   pname = "pathlib2";
-  version = "2.2.1";
+  version = "2.3.0";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "ce9007df617ef6b7bd8a31cd2089ed0c1fed1f7c23cf2bf1ba140b3dd563175d";
+    sha256 = "d32550b75a818b289bd4c1f96b60c89957811da205afcceab75bc8b4857ea5b3";
   };
 
   propagatedBuildInputs = [ six ] ++ lib.optional (pythonOlder "3.5") scandir;
-  checkInputs = [ glibcLocales ];
+  checkInputs = [ glibcLocales ] ++ lib.optional (pythonOlder "3.3") mock;
 
   preCheck = ''
     export LC_ALL="en_US.UTF-8"
diff --git a/pkgs/development/python-modules/pexpect/default.nix b/pkgs/development/python-modules/pexpect/default.nix
index c5d1e8ef3c4..da8d5db359b 100644
--- a/pkgs/development/python-modules/pexpect/default.nix
+++ b/pkgs/development/python-modules/pexpect/default.nix
@@ -6,12 +6,12 @@
 
 buildPythonPackage rec {
   pname = "pexpect";
-  version = "4.3.0";
+  version = "4.3.1";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1nfjmz81gsixv22dywidakm7pff3ly1i4yly950bfp8gz1r0iaq0";
+    sha256 = "8e287b171dbaf249d0b06b5f2e88cb7e694651d2d0b8c15bccb83170d3c55575";
   };
 
   # Wants to run pythonin a subprocess
diff --git a/pkgs/development/python-modules/phonenumbers/default.nix b/pkgs/development/python-modules/phonenumbers/default.nix
index d5c4eaa781b..69808a7bff3 100644
--- a/pkgs/development/python-modules/phonenumbers/default.nix
+++ b/pkgs/development/python-modules/phonenumbers/default.nix
@@ -2,12 +2,12 @@
 
 buildPythonPackage rec {
   pname = "phonenumbers";
-  version = "8.8.6";
+  version = "8.8.8";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "ab1fa853350dde91be672192b427169b29e3348c236e46ad7a757e4ac8163c8c";
+    sha256 = "ff2f492e49c212bb7185954efe09e68583a67daec586c02c49bc728c343d4eb0";
   };
 
   meta = {
diff --git a/pkgs/development/python-modules/pip-tools/default.nix b/pkgs/development/python-modules/pip-tools/default.nix
index d2b91eb435c..752047d04f7 100644
--- a/pkgs/development/python-modules/pip-tools/default.nix
+++ b/pkgs/development/python-modules/pip-tools/default.nix
@@ -3,12 +3,12 @@
 
 buildPythonPackage rec {
   pname = "pip-tools";
-  version = "1.10.2";
+  version = "1.11.0";
   name = pname + "-" + version;
 
   src = fetchurl {
     url = "mirror://pypi/p/pip-tools/${name}.tar.gz";
-    sha256 = "d381c7249eb48350cc49447cc106df3d90e9e806b13caaede602c1cd38f61b37";
+    sha256 = "ba427b68443466c389e3b0b0ef55f537ab39344190ea980dfebb333d0e6a50a3";
   };
 
   LC_ALL = "en_US.UTF-8";
@@ -21,9 +21,11 @@ buildPythonPackage rec {
     "test_generate_hashes_all_platforms"
     "test_generate_hashes_without_interfering_with_each_other"
     "test_realistic_complex_sub_dependencies"
+    "test_generate_hashes_with_editable"
     # Expect specific version of "six":
     "test_editable_package"
     "test_input_file_without_extension"
+    "test_locally_available_editable_package_is_not_archived_in_cache_dir"
   ];
 
   checkPhase = ''
diff --git a/pkgs/development/python-modules/plone-testing/default.nix b/pkgs/development/python-modules/plone-testing/default.nix
new file mode 100644
index 00000000000..910fc034e36
--- /dev/null
+++ b/pkgs/development/python-modules/plone-testing/default.nix
@@ -0,0 +1,27 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, zope_testing
+, setuptools
+}:
+
+buildPythonPackage rec {
+  pname = "plone.testing";
+  version = "5.1.1";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "2ca558a910b93355b760535b233518be3a06c58e46160487bf802b6f7cb1e511";
+  };
+
+  propagatedBuildInputs = [ setuptools zope_testing ];
+
+  # Huge amount of testing dependencies (including Zope2)
+  doCheck = false;
+
+  meta = {
+    description = "Testing infrastructure for Zope and Plone projects";
+    homepage = https://github.com/plone/plone.testing;
+    license = lib.licenses.bsd3;
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/plotly/default.nix b/pkgs/development/python-modules/plotly/default.nix
index 2744805a504..75f1b060077 100644
--- a/pkgs/development/python-modules/plotly/default.nix
+++ b/pkgs/development/python-modules/plotly/default.nix
@@ -10,12 +10,12 @@
 
 buildPythonPackage rec {
   pname = "plotly";
-  version = "2.1.0";
+  version = "2.2.3";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "ff6899dc11907b1efb944f79f9583b2e30ba2964bb009145f3580bf30b4d9ee4";
+    sha256 = "dadd2263f1c0449b248fd3742a077d9594935921a9597529be76d6a841237ab0";
   };
 
   propagatedBuildInputs = [
diff --git a/pkgs/development/python-modules/pluggy/default.nix b/pkgs/development/python-modules/pluggy/default.nix
new file mode 100644
index 00000000000..0fbfa5108c1
--- /dev/null
+++ b/pkgs/development/python-modules/pluggy/default.nix
@@ -0,0 +1,29 @@
+{ buildPythonPackage
+, lib
+, fetchPypi
+, pytest
+}:
+
+buildPythonPackage rec {
+  pname = "pluggy";
+  version = "0.6.0";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "7f8ae7f5bdf75671a718d2daf0a64b7885f74510bcd98b1a0bb420eb9a9d0cff";
+  };
+
+  checkPhase = ''
+    py.test
+  '';
+
+  # To prevent infinite recursion with pytest
+  doCheck = false;
+
+  meta = {
+    description = "Plugin and hook calling mechanisms for Python";
+    homepage = "https://pypi.python.org/pypi/pluggy";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ jgeerds ];
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/plumbum/default.nix b/pkgs/development/python-modules/plumbum/default.nix
index 216c163bc9d..a5881bb2e7c 100644
--- a/pkgs/development/python-modules/plumbum/default.nix
+++ b/pkgs/development/python-modules/plumbum/default.nix
@@ -6,7 +6,7 @@
 
 buildPythonPackage rec {
   pname = "plumbum";
-  version = "1.6.3";
+  version = "1.6.5";
   name = "${pname}-${version}";
 
   checkInputs = [ pytest ];
@@ -16,6 +16,6 @@ buildPythonPackage rec {
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0249e708459f1b05627a7ca8787622c234e4db495a532acbbd1f1f17f28c7320";
+    sha256 = "d8abb059bb62beb6c99db08d3598167abaeeab53eaf218f91e74bae471a24bee";
   };
 }
\ No newline at end of file
diff --git a/pkgs/development/python-modules/psutil/default.nix b/pkgs/development/python-modules/psutil/default.nix
index cf9b3ea267f..b9d07a3fa9b 100644
--- a/pkgs/development/python-modules/psutil/default.nix
+++ b/pkgs/development/python-modules/psutil/default.nix
@@ -7,12 +7,12 @@
 
 buildPythonPackage rec {
   pname = "psutil";
-  version = "5.4.1";
+  version = "5.4.2";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "42e2de159e3c987435cb3b47d6f37035db190a1499f3af714ba7af5c379b6ba2";
+    sha256 = "00a1f9ff8d1e035fba7bfdd6977fa8ea7937afdb4477339e5df3dba78194fe11";
   };
 
   # No tests in archive
diff --git a/pkgs/development/python-modules/py/default.nix b/pkgs/development/python-modules/py/default.nix
index 0dc3b679328..cd945f7bfc6 100644
--- a/pkgs/development/python-modules/py/default.nix
+++ b/pkgs/development/python-modules/py/default.nix
@@ -1,12 +1,12 @@
 { stdenv, buildPythonPackage, fetchPypi }:
 buildPythonPackage rec {
   pname = "py";
-  version = "1.4.34";
+  version = "1.5.2";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1qyd5z0hv8ymxy84v5vig3vps2fvhcf4bdlksb3r03h549fmhb8g";
+    sha256 = "ca18943e28235417756316bfada6cd96b23ce60dd532642690dcfdaba988a76d";
   };
 
   # Circular dependency on pytest
diff --git a/pkgs/development/python-modules/pyaml/default.nix b/pkgs/development/python-modules/pyaml/default.nix
new file mode 100644
index 00000000000..5fd1be7c15c
--- /dev/null
+++ b/pkgs/development/python-modules/pyaml/default.nix
@@ -0,0 +1,27 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, pyyaml
+, unidecode
+, python
+}:
+
+buildPythonPackage rec {
+  pname = "pyaml";
+  version = "17.12.1";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "66623c52f34d83a2c0fc963e08e8b9d0c13d88404e3b43b1852ef71eda19afa3";
+  };
+
+  propagatedBuildInputs = [ pyyaml ];
+
+  checkInputs = [ unidecode ];
+
+  meta = {
+    description = "PyYAML-based module to produce pretty and readable YAML-serialized data";
+    homepage = https://github.com/mk-fg/pretty-yaml;
+    license = lib.licenses.wtfpl;
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/pyasn1-modules/default.nix b/pkgs/development/python-modules/pyasn1-modules/default.nix
index a7ee15d6a18..b8dcae16da8 100644
--- a/pkgs/development/python-modules/pyasn1-modules/default.nix
+++ b/pkgs/development/python-modules/pyasn1-modules/default.nix
@@ -3,12 +3,12 @@
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "pyasn1-modules";
-  version = "0.1.5";
+  version = "0.2.1";
   disabled = isPyPy;
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1239h6h67vg0wazg2qgv6m3hdim2gs66pl89lbnayk55bbnkwc0x";
+    sha256 = "af00ea8f2022b6287dc375b2c70f31ab5af83989fc6fe9eacd4976ce26cd7ccc";
   };
 
   propagatedBuildInputs = [ pyasn1 ];
diff --git a/pkgs/development/python-modules/pyasn1/default.nix b/pkgs/development/python-modules/pyasn1/default.nix
index d0122a5b7e4..8037796713e 100644
--- a/pkgs/development/python-modules/pyasn1/default.nix
+++ b/pkgs/development/python-modules/pyasn1/default.nix
@@ -3,11 +3,11 @@
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "pyasn1";
-  version = "0.3.4";
+  version = "0.4.2";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "06hhy38jhwh95gpn8f03cr439273fsfsh4vhd5024r86nh5gyiir";
+    sha256 = "d258b0a71994f7770599835249cece1caef3c70def868c4915e6e5ca49b67d15";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/python-modules/pyblake2/default.nix b/pkgs/development/python-modules/pyblake2/default.nix
index 4e166dcb183..c2f4e7db43f 100644
--- a/pkgs/development/python-modules/pyblake2/default.nix
+++ b/pkgs/development/python-modules/pyblake2/default.nix
@@ -5,12 +5,12 @@
 
 buildPythonPackage rec {
   pname = "pyblake2";
-  version = "0.9.3";
+  version = "1.1.0";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "626448e1fe1cc01d2197118954bec9f158378577e12686d5b01979f7f0fa2212";
+    sha256 = "3a850036bf42053c74bfc52c063323ca78e40ba1f326b01777da5750a143631a";
   };
 
   # requires setting up sphinx doctest
diff --git a/pkgs/development/python-modules/pycangjie/default.nix b/pkgs/development/python-modules/pycangjie/default.nix
index 4995a714693..80b17034aa0 100644
--- a/pkgs/development/python-modules/pycangjie/default.nix
+++ b/pkgs/development/python-modules/pycangjie/default.nix
@@ -1,21 +1,22 @@
 { stdenv, fetchurl, bash, autoconf, automake, libtool, pkgconfig, libcangjie
-, sqlite, python, cython
+, sqlite, buildPythonPackage, cython
 }:
 
-stdenv.mkDerivation rec {
-  name = "${python.libPrefix}-pycangjie-${version}";
-  version = "1.3_rev_${rev}";
+let
   rev = "361bb413203fd43bab624d98edf6f7d20ce6bfd3";
+in buildPythonPackage rec {
+  pname = "pycangjie";
+  version = "1.3_rev_${rev}";
+  format = "other";
 
   src = fetchurl {
-    name = "${name}.tar.gz";
     url = "https://github.com/Cangjians/pycangjie/archive/${rev}.tar.gz";
     sha256 = "12yi09nyffmn4va7lzk4irw349qzlbxgsnb89dh15cnw0xmrin05";
   };
 
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [
-    autoconf automake libtool libcangjie sqlite python cython
+    autoconf automake libtool libcangjie sqlite cython
   ];
 
   preConfigure = ''
diff --git a/pkgs/development/python-modules/pychromecast/default.nix b/pkgs/development/python-modules/pychromecast/default.nix
index 01014170dc7..46d3272807e 100644
--- a/pkgs/development/python-modules/pychromecast/default.nix
+++ b/pkgs/development/python-modules/pychromecast/default.nix
@@ -2,12 +2,12 @@
 
 buildPythonPackage rec {
   pname = "PyChromecast";
-  version = "0.8.1";
+  version = "1.0.3";
   name = pname + "-" + version;
 
   src = fetchurl {
     url    = "mirror://pypi/p/pychromecast/${name}.tar.gz";
-    sha256 = "05rlr2hjng0xg2a9k9vwmrlvd7vy9sjhxxfl96kx25xynlkq6yq6";
+    sha256 = "714a9e03e6a258081e3b6296ed15592e015facbe38bbe60819cca6f04c599f25";
   };
 
   propagatedBuildInputs = [ requests six zeroconf protobuf ];
diff --git a/pkgs/development/python-modules/pycollada/default.nix b/pkgs/development/python-modules/pycollada/default.nix
index 948d9741bd8..35b10421f2c 100644
--- a/pkgs/development/python-modules/pycollada/default.nix
+++ b/pkgs/development/python-modules/pycollada/default.nix
@@ -2,15 +2,14 @@
 
 buildPythonPackage rec {
   pname = "pycollada";
-  version = "0.5";
-  name = "${pname}-${version}";
+  version = "0.6";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1g96maw2c25l4i3ks51784h33zf7s18vrn6iyz4ca34iy4sl7yq9";
+    sha256 = "fcd6f38fd981e350f9ec754d9671834017accd600e967d6d299a6cfdae5ba4f4";
   };
 
-  buildInputs = [ numpy ] ++ (if isPy3k then [dateutil] else [dateutil_1_5]);
+  propagatedBuildInputs = [ numpy dateutil ];
 
   # Some tests fail because they refer to test data files that don't exist
   # (upstream packaging issue)
diff --git a/pkgs/development/python-modules/pydot/default.nix b/pkgs/development/python-modules/pydot/default.nix
index be0b4eabfa8..98d4b33939a 100644
--- a/pkgs/development/python-modules/pydot/default.nix
+++ b/pkgs/development/python-modules/pydot/default.nix
@@ -8,12 +8,12 @@
 
 buildPythonPackage rec {
   pname = "pydot";
-  version = "1.2.3";
+  version = "1.2.4";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "edb5d3f249f97fbd9c4bb16959e61bc32ecf40eee1a9f6d27abe8d01c0a73502";
+    sha256 = "92d2e2d15531d00710f2d6fb5540d2acabc5399d464f2f20d5d21073af241eb6";
   };
   checkInputs = [ chardet ];
   # No tests in archive
diff --git a/pkgs/development/python-modules/pygit2/default.nix b/pkgs/development/python-modules/pygit2/default.nix
index 90bfe978391..d8eb05cf348 100644
--- a/pkgs/development/python-modules/pygit2/default.nix
+++ b/pkgs/development/python-modules/pygit2/default.nix
@@ -3,11 +3,11 @@
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "pygit2";
-  version = "0.26.0";
+  version = "0.26.3";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1cbc488ra3kg7r3qky17ms0szi3cda2d96qfkv1l9djsy9hnvw57";
+    sha256 = "29baa530d6fcbf7cca6a75cf9c78fb88613ca81afb39c62fe492f226f6b61800";
   };
 
   preConfigure = lib.optionalString stdenv.isDarwin ''
diff --git a/pkgs/development/python-modules/pyglet/default.nix b/pkgs/development/python-modules/pyglet/default.nix
index 8d5dd53f80a..51243154b1a 100644
--- a/pkgs/development/python-modules/pyglet/default.nix
+++ b/pkgs/development/python-modules/pyglet/default.nix
@@ -1,23 +1,24 @@
 { stdenv, buildPythonPackage, fetchPypi
-, mesa, xorg, freetype, fontconfig}:
+, mesa, xorg, freetype, fontconfig, future}:
 
 buildPythonPackage rec {
-  version = "1.2.4";
+  version = "1.3.0";
   pname = "pyglet";
-  name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "9f62ffbbcf2b202d084bf158685e77d28b8f4f5f2738f4c5e63a947a07503445";
+    sha256 = "640a8f8e3d7bf8dbb551fa707f14021f619932990ab1401c48ba9dbcc6c2242c";
   };
 
-  patchPhase = let
+  postPatch = let
     libs = [ mesa xorg.libX11 freetype fontconfig ];
     paths = builtins.concatStringsSep "," (map (l: "\"${l}/lib\"") libs);
   in "sed -i -e 's|directories\.extend.*lib[^]]*|&,${paths}|' pyglet/lib.py";
 
   doCheck = false;
 
+  propagatedBuildInputs = [ future ];
+
   meta = with stdenv.lib; {
     homepage = "http://www.pyglet.org/";
     description = "A cross-platform windowing and multimedia library";
diff --git a/pkgs/development/python-modules/pylast/default.nix b/pkgs/development/python-modules/pylast/default.nix
index 99bcb9357dc..1fcc7211504 100644
--- a/pkgs/development/python-modules/pylast/default.nix
+++ b/pkgs/development/python-modules/pylast/default.nix
@@ -2,12 +2,12 @@
 
 buildPythonPackage rec {
   pname = "pylast";
-  version = "1.9.0";
+  version = "2.0.0";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "ae1c4105cbe704d9ac10ba57ac4c26bc576cc33978f1b578101b20c6a2360ca4";
+    sha256 = "8e4d4962aa12d67bd357e1aa596a146b2e97afd943b5c9257e555014d13b3065";
   };
 
   propagatedBuildInputs = [ certifi six ];
diff --git a/pkgs/development/python-modules/pylint/default.nix b/pkgs/development/python-modules/pylint/default.nix
index afe3bf8e503..79337663c62 100644
--- a/pkgs/development/python-modules/pylint/default.nix
+++ b/pkgs/development/python-modules/pylint/default.nix
@@ -4,11 +4,11 @@
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "pylint";
-  version = "1.7.4";
+  version = "1.8.1";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1f65b3815c3bf7524b845711d54c4242e4057dd93826586620239ecdfe591fb1";
+    sha256 = "3035e44e37cd09919e9edad5573af01d7c6b9c52a0ebb4781185ae7ab690458b";
   };
 
   buildInputs = [ pytest pytestrunner mccabe configparser backports_functools_lru_cache ];
diff --git a/pkgs/development/python-modules/pymongo/default.nix b/pkgs/development/python-modules/pymongo/default.nix
index 5b400e1521e..577cd9142f9 100644
--- a/pkgs/development/python-modules/pymongo/default.nix
+++ b/pkgs/development/python-modules/pymongo/default.nix
@@ -2,12 +2,12 @@
 
 buildPythonPackage rec {
   pname = "pymongo";
-  version = "3.5.1";
+  version = "3.6.0";
   name  = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0939bl3brrklvccicck62gs3zd7i9aysz13c8pxc3gpk2hsdj878";
+    sha256 = "c6de26d1e171cdc449745b82f1addbc873d105b8e7335097da991c0fc664a4a8";
   };
 
   doCheck = false;
diff --git a/pkgs/development/python-modules/pyobjc/default.nix b/pkgs/development/python-modules/pyobjc/default.nix
index 0cf08319645..874e0d47fc9 100644
--- a/pkgs/development/python-modules/pyobjc/default.nix
+++ b/pkgs/development/python-modules/pyobjc/default.nix
@@ -3,7 +3,7 @@
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "pyobjc";
-  version = "4.0b1";
+  version = "4.1";
 
   # Gives "No matching distribution found for
   # pyobjc-framework-Collaboration==4.0b1 (from pyobjc==4.0b1)"
@@ -11,7 +11,7 @@ buildPythonPackage rec {
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "16bng6960c1m57nnh1l09ycnyimrqzw9mx9pnyjxn5zzm5kalr37";
+    sha256 = "287db11f912ac7d05c4907dbf6e74abaa475e36368f7c92e05aca2886a94562c";
   };
 
   meta = {
diff --git a/pkgs/development/python-modules/pyopencl/default.nix b/pkgs/development/python-modules/pyopencl/default.nix
index 9d5661f4d58..07ff8735b52 100644
--- a/pkgs/development/python-modules/pyopencl/default.nix
+++ b/pkgs/development/python-modules/pyopencl/default.nix
@@ -15,18 +15,23 @@
 
 buildPythonPackage rec {
   pname = "pyopencl";
-  version = "2017.2";
-  name = "${pname}-${version}";
+  version = "2017.2.2";
 
-  buildInputs = [ pytest opencl-headers ocl-icd ];
+  checkInputs = [ pytest ];
+  buildInputs = [ opencl-headers ocl-icd ];
 
   propagatedBuildInputs = [ numpy cffi pytools decorator appdirs six Mako ];
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "039b689a58eb98e27a577ac086210deae959f40d657487f3199d2d217c270ff9";
+    sha256 = "d2f7b04d2e819c6e90d6366b7712a7452a39fba218e51b11b02c85ab07fd2983";
   };
 
+  # py.test is not needed during runtime, so remove it from `install_requires`
+  postPatch = ''
+    substituteInPlace setup.py --replace "pytest>=2" ""
+  '';
+
   # gcc: error: pygpu_language_opencl.cpp: No such file or directory
   doCheck = false;
 
diff --git a/pkgs/development/python-modules/pysc2/default.nix b/pkgs/development/python-modules/pysc2/default.nix
index a2dfd53b795..89799988fa1 100644
--- a/pkgs/development/python-modules/pysc2/default.nix
+++ b/pkgs/development/python-modules/pysc2/default.nix
@@ -18,8 +18,8 @@
 }:
 
 buildPythonPackage rec {
+  pname = "PySC2";
   version = "1.2";
-  name = "PySC2-${version}";
 
   src = fetchFromGitHub {
     owner = "deepmind";
diff --git a/pkgs/development/python-modules/pysoundfile/default.nix b/pkgs/development/python-modules/pysoundfile/default.nix
index ef67ed85cc0..aa7d23c5fcb 100644
--- a/pkgs/development/python-modules/pysoundfile/default.nix
+++ b/pkgs/development/python-modules/pysoundfile/default.nix
@@ -11,12 +11,12 @@
 
 buildPythonPackage rec {
   pname = "PySoundFile";
-  version = "0.8.1";
+  version = "0.9.0.post1";
   name = pname + "-" + version;
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "72c3e23b7c9998460ec78176084ea101e3439596ab29df476bc8508708df84df";
+    sha256 = "43dd46a2afc0484c26930a7e59eef9365cee81bce7a4aadc5699f788f60d32c3";
   };
 
     checkInputs = [ pytest ];
diff --git a/pkgs/development/python-modules/pytest-localserver/default.nix b/pkgs/development/python-modules/pytest-localserver/default.nix
index fdd1986c04f..c98370ed938 100644
--- a/pkgs/development/python-modules/pytest-localserver/default.nix
+++ b/pkgs/development/python-modules/pytest-localserver/default.nix
@@ -10,11 +10,11 @@
 buildPythonPackage rec {
   pname = "pytest-localserver";
   name = "${pname}-${version}";
-  version = "0.3.7";
+  version = "0.4.1";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1c11hn61n06ms0wmw6536vs5k4k9hlndxsb3p170nva56a9dfa6q";
+    sha256 = "a72af60a1ec8f73668a7884c86baf1fbe48394573cb4fa36709887217736c021";
   };
 
   propagatedBuildInputs = [ werkzeug ];
diff --git a/pkgs/development/python-modules/pytest-xdist/default.nix b/pkgs/development/python-modules/pytest-xdist/default.nix
index e993a67c49f..2e2975e6596 100644
--- a/pkgs/development/python-modules/pytest-xdist/default.nix
+++ b/pkgs/development/python-modules/pytest-xdist/default.nix
@@ -3,11 +3,11 @@
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "pytest-xdist";
-  version = "1.20.1";
+  version = "1.21.0";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "433e82f9b34986a4e4b2be38c60e82cca3ac64b7e1b38f4d8e3e118292939712";
+    sha256 = "0b8622435e3c0650a8d5a07b73a7f9c4f79b52d7ed060536a6041f0da423ba8e";
   };
 
   buildInputs = [ pytest setuptools_scm pytest-forked];
diff --git a/pkgs/development/python-modules/pytest/3_2.nix b/pkgs/development/python-modules/pytest/3_2.nix
new file mode 100644
index 00000000000..d7a0b1bdad3
--- /dev/null
+++ b/pkgs/development/python-modules/pytest/3_2.nix
@@ -0,0 +1,27 @@
+{ stdenv, buildPythonPackage, fetchPypi, isPy26, argparse, hypothesis, py
+, setuptools_scm, setuptools
+}:
+buildPythonPackage rec {
+  version = "3.2.5";
+  pname = "pytest";
+
+  preCheck = ''
+    # don't test bash builtins
+    rm testing/test_argcomplete.py
+  '';
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "6d5bd4f7113b444c55a3bbb5c738a3dd80d43563d063fc42dcb0aaefbdd78b81";
+  };
+
+  checkInputs = [ hypothesis ];
+  buildInputs = [ setuptools_scm ];
+  propagatedBuildInputs = [ py setuptools ]
+    ++ (stdenv.lib.optional isPy26 argparse);
+
+  meta = with stdenv.lib; {
+    maintainers = with maintainers; [ domenkozar lovek323 madjar lsix ];
+    platforms = platforms.unix;
+  };
+}
\ 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 8e280b8fd0d..d45fe7deb12 100644
--- a/pkgs/development/python-modules/pytest/default.nix
+++ b/pkgs/development/python-modules/pytest/default.nix
@@ -1,8 +1,8 @@
-{ stdenv, buildPythonPackage, fetchPypi, isPy26, argparse, hypothesis, py
-, setuptools_scm, setuptools
+{ stdenv, buildPythonPackage, fetchPypi, isPy26, argparse, attrs, hypothesis, py
+, setuptools_scm, setuptools, six, pluggy, funcsigs, isPy3k
 }:
 buildPythonPackage rec {
-  version = "3.2.5";
+  version = "3.3.1";
   pname = "pytest";
 
   preCheck = ''
@@ -12,16 +12,18 @@ buildPythonPackage rec {
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "6d5bd4f7113b444c55a3bbb5c738a3dd80d43563d063fc42dcb0aaefbdd78b81";
+    sha256 = "cf8436dc59d8695346fcd3ab296de46425ecab00d64096cebe79fb51ecb2eb93";
   };
 
   checkInputs = [ hypothesis ];
   buildInputs = [ setuptools_scm ];
-  propagatedBuildInputs = [ py setuptools ]
+  propagatedBuildInputs = [ attrs py setuptools six pluggy ]
+    ++ (stdenv.lib.optional (!isPy3k) funcsigs)
     ++ (stdenv.lib.optional isPy26 argparse);
 
   meta = with stdenv.lib; {
     maintainers = with maintainers; [ domenkozar lovek323 madjar lsix ];
     platforms = platforms.unix;
+    description = "Framework for writing tests";
   };
 }
diff --git a/pkgs/development/python-modules/python-fuse/default.nix b/pkgs/development/python-modules/python-fuse/default.nix
index d9debce6aec..02b86b3b33a 100644
--- a/pkgs/development/python-modules/python-fuse/default.nix
+++ b/pkgs/development/python-modules/python-fuse/default.nix
@@ -7,21 +7,21 @@
 }:
 
 buildPythonPackage rec {
-    baseName = "fuse";
-    version = "0.2.1";
-    name = "${baseName}-${version}";
-    disabled = isPy3k;
+  pname = "fuse";
+  version = "0.2.1";
 
-    src = fetchurl {
-      url = "mirror://sourceforge/fuse/fuse-python-${version}.tar.gz";
-      sha256 = "06rmp1ap6flh64m81j0n3a357ij2vj9zwcvvw0p31y6hz1id9shi";
-    };
+  disabled = isPy3k;
 
-    nativeBuildInputs = [ pkgconfig ];
-    buildInputs = [ fuse ];
+  src = fetchurl {
+    url = "mirror://sourceforge/fuse/fuse-python-${version}.tar.gz";
+    sha256 = "06rmp1ap6flh64m81j0n3a357ij2vj9zwcvvw0p31y6hz1id9shi";
+  };
 
-    meta = {
-      description = "Python bindings for FUSE";
-      license = lib.licenses.lgpl21;
-    };
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ fuse ];
+
+  meta = {
+    description = "Python bindings for FUSE";
+    license = lib.licenses.lgpl21;
+  };
 }
diff --git a/pkgs/development/python-modules/pytoml/default.nix b/pkgs/development/python-modules/pytoml/default.nix
index 55479e76daf..91661a1fb51 100644
--- a/pkgs/development/python-modules/pytoml/default.nix
+++ b/pkgs/development/python-modules/pytoml/default.nix
@@ -1,18 +1,22 @@
-{ stdenv, buildPythonPackage, fetchgit
-, python }:
+{ stdenv
+, buildPythonPackage
+, fetchgit
+, python
+}:
 
 buildPythonPackage rec {
   pname = "pytoml";
-  version = "0.1.11";
-  name = "${pname}-${version}";
+  version = "0.1.14";
 
-  checkPhase = "${python.interpreter} test/test.py";
+  checkPhase = ''
+    ${python.interpreter} test/test.py
+  '';
 
   # fetchgit used to ensure test submodule is available
   src = fetchgit {
     url = "${meta.homepage}.git";
     rev = "refs/tags/v${version}";
-    sha256 = "1jiw04zk9ccynr8kb1vqh9r1p2kh0al7g7b1f94911iazg7dgs9j";
+    sha256 = "1ip71yqxnyi4jhw5x1q7a0za61ndhpfh0vbx08jfv0w4ayng6rgv";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/python-modules/pytools/default.nix b/pkgs/development/python-modules/pytools/default.nix
new file mode 100644
index 00000000000..2bf7413c600
--- /dev/null
+++ b/pkgs/development/python-modules/pytools/default.nix
@@ -0,0 +1,39 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, decorator
+, appdirs
+, six
+, numpy
+, pytest
+}:
+
+buildPythonPackage rec {
+  pname = "pytools";
+  version = "2017.6";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "80f1bba4469d473c1b3969bc8e188c03bcc94d35807a889ceebbfc78e3208115";
+  };
+
+  checkInputs = [ pytest ];
+
+  propagatedBuildInputs = [
+    decorator
+    appdirs
+    six
+    numpy
+  ];
+
+  checkPhase = ''
+    py.test -k 'not test_persistent_dict'
+  '';
+
+  meta = {
+    homepage = https://github.com/inducer/pytools/;
+    description = "Miscellaneous Python lifesavers.";
+    license = lib.licenses.mit;
+    maintainers = with lib.maintainers; [ artuuge ];
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/pywbem/default.nix b/pkgs/development/python-modules/pywbem/default.nix
index 8e10fbb2258..d09a9bbd6d8 100644
--- a/pkgs/development/python-modules/pywbem/default.nix
+++ b/pkgs/development/python-modules/pywbem/default.nix
@@ -4,7 +4,7 @@
 }:
 
 buildPythonPackage rec {
-  name  = "pywbem-${version}";
+  pname = "pywbem";
   version = "0.10.0";
 
   src = fetchFromGitHub {
diff --git a/pkgs/development/python-modules/pywinrm/default.nix b/pkgs/development/python-modules/pywinrm/default.nix
index ecd46bb1ff5..10150259ef5 100644
--- a/pkgs/development/python-modules/pywinrm/default.nix
+++ b/pkgs/development/python-modules/pywinrm/default.nix
@@ -11,12 +11,12 @@
 
 buildPythonPackage rec {
   pname = "pywinrm";
-  version = "0.2.2";
+  version = "0.3.0";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "06xc0mbqf718vmsp0fq0rb64nql66l5w2x23bmqnzl6nzc0gfc1h";
+    sha256 = "799fc3e33fec8684443adf5778860388289102ea4fa1458f1bf307d167855573";
   };
 
   checkInputs = [ mock pytest ];
diff --git a/pkgs/development/python-modules/regex/default.nix b/pkgs/development/python-modules/regex/default.nix
new file mode 100644
index 00000000000..a1349ae5c36
--- /dev/null
+++ b/pkgs/development/python-modules/regex/default.nix
@@ -0,0 +1,23 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+}:
+
+
+buildPythonPackage rec {
+  pname = "regex";
+  version = "2017.12.12";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "ee069308c2757e565cc2b6f417ba5288e76cfe4c1764b6826063f4fbd53219d7";
+  };
+
+  meta = {
+    description = "Alternative regular expression module, to replace re";
+    homepage = "https://bitbucket.org/mrabarnett/mrab-regex";
+    license = lib.licenses.psfl;
+    platforms = lib.platforms.linux;
+    maintainers = with lib.maintainers; [ abbradar ];
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/relatorio/default.nix b/pkgs/development/python-modules/relatorio/default.nix
index 5e1ea8b4642..5c5f2578fbf 100644
--- a/pkgs/development/python-modules/relatorio/default.nix
+++ b/pkgs/development/python-modules/relatorio/default.nix
@@ -3,10 +3,10 @@
 buildPythonPackage rec {
   pname = "relatorio";
   name = "${pname}-${version}";
-  version = "0.7.1";
+  version = "0.8.0";
   src = fetchurl {
     url = "mirror://pypi/r/relatorio/${name}.tar.gz";
-    sha256 = "744f1e39313f037a0ab52a154338ece151d83e5442a9278db1f8ce450ce6c2cd";
+    sha256 = "bddf85d029c5c85a0f976d73907e14e4c3093065fe8527170c91abf0218546d9";
   };
   propagatedBuildInputs = [
     genshi
diff --git a/pkgs/development/python-modules/restview/default.nix b/pkgs/development/python-modules/restview/default.nix
index 0f2ce45c885..3c61ea4ded2 100644
--- a/pkgs/development/python-modules/restview/default.nix
+++ b/pkgs/development/python-modules/restview/default.nix
@@ -10,11 +10,11 @@
 buildPythonPackage rec {
   pname = "restview";
   name = "${pname}-${version}";
-  version = "2.7.0";
+  version = "2.8.0";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "e7842100f3de179c68cfe7c2cf56c61509cd6068bc6dd58ab42c0ade5d5f97ec";
+    sha256 = "5f6f1523228eab3269f59dd03ac560f7d370cd81df6fdbcb4914b5e6bd896a11";
   };
 
   propagatedBuildInputs = [ docutils readme_renderer pygments ];
diff --git a/pkgs/development/python-modules/robomachine/default.nix b/pkgs/development/python-modules/robomachine/default.nix
index 8f71bab9c25..72407131cb1 100644
--- a/pkgs/development/python-modules/robomachine/default.nix
+++ b/pkgs/development/python-modules/robomachine/default.nix
@@ -2,12 +2,12 @@
 
 buildPythonPackage rec {
   pname = "robomachine";
-  version = "0.6";
+  version = "0.8.0";
   name = pname + "-" + version;
 
   src = fetchurl {
     url = "mirror://pypi/R/RoboMachine/RoboMachine-0.6.tar.gz";
-    sha256 = "6c9a9bae7bffa272b2a09b05df06c29a3a776542c70cae8041a8975a061d2e54";
+    sha256 = "242cfd9be0f7591138eaeba03c9c190f894ce045e1767ab7b90eca330259fc45";
   };
 
   propagatedBuildInputs = [ pyparsing argparse robotframework ];
diff --git a/pkgs/development/python-modules/ropper/default.nix b/pkgs/development/python-modules/ropper/default.nix
index f7ef16b02bb..62ef3f8db19 100644
--- a/pkgs/development/python-modules/ropper/default.nix
+++ b/pkgs/development/python-modules/ropper/default.nix
@@ -3,23 +3,25 @@
 , fetchPypi
 , capstone
 , filebytes
-, pytest }:
+, pytest
+}:
 
 buildPythonApplication rec {
-  name = "${pname}-${version}";
   pname = "ropper";
-  version = "1.10.10";
+  version = "1.11.2";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1676e07947a19df9d17002307a7555c2647a4224d6f2869949e8fc4bd18f2e87";
+    sha256 = "2183feedfe8b01a27301eee07383b481ece01b2319bdba3afebe33e19ca14aa3";
   };
   # XXX tests rely on user-writeable /dev/shm to obtain process locks and return PermissionError otherwise
   # workaround: sudo chmod 777 /dev/shm
   checkPhase = ''
     py.test testcases
   '';
-  buildInputs = [pytest];
+  doCheck = false; # Tests not included in archive
+
+  checkInputs = [pytest];
   propagatedBuildInputs = [ capstone filebytes ];
   meta = with stdenv.lib; {
     homepage = https://scoding.de/ropper/;
diff --git a/pkgs/development/python-modules/scrapy/default.nix b/pkgs/development/python-modules/scrapy/default.nix
index 5b40c74a181..005d02e6047 100644
--- a/pkgs/development/python-modules/scrapy/default.nix
+++ b/pkgs/development/python-modules/scrapy/default.nix
@@ -2,7 +2,7 @@
   testfixtures, pillow, six, twisted, w3lib, lxml, queuelib, pyopenssl,
   service-identity, parsel, pydispatcher, cssselect, lib }:
 buildPythonPackage rec {
-    version = "1.4.0";
+    version = "1.5.0";
     pname = "Scrapy";
     name = "${pname}-${version}";
 
@@ -26,7 +26,7 @@ buildPythonPackage rec {
 
     src = fetchurl {
       url = "mirror://pypi/S/Scrapy/${name}.tar.gz";
-      sha256 = "04a08f027eef5d271342a016439533c81ba46f14bfcf230fecf602e99beaf233";
+      sha256 = "31a0bf05d43198afaf3acfb9b4fb0c09c1d7d7ff641e58c66e36117f26c4b755";
     };
 
     meta = with lib; {
diff --git a/pkgs/development/python-modules/seaborn/default.nix b/pkgs/development/python-modules/seaborn/default.nix
index 1647e6cfc14..20ad32b3261 100644
--- a/pkgs/development/python-modules/seaborn/default.nix
+++ b/pkgs/development/python-modules/seaborn/default.nix
@@ -8,11 +8,11 @@
 
 buildPythonPackage rec {
   pname = "seaborn";
-  version = "0.7.1";
+  version = "0.8.1";
   name = "${pname}-${version}";
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0pawrqc3mxpwd5g9pvi9gba02637bh5c8ldpp8izfwpfn52469zs";
+    sha256 = "6702978b903d0284446e935916b980dfebae4063c18ad8eb6e8f9e76d0257eae";
   };
 
   checkInputs = [ nose ];
diff --git a/pkgs/development/python-modules/serpy/default.nix b/pkgs/development/python-modules/serpy/default.nix
index 2414b97e94a..610a75fa317 100644
--- a/pkgs/development/python-modules/serpy/default.nix
+++ b/pkgs/development/python-modules/serpy/default.nix
@@ -5,7 +5,7 @@
 buildPythonPackage rec {
   pname = "serpy";
   name = "${pname}-${version}";
-  version = "0.2.0";
+  version = "0.3.1";
 
   meta = {
     description = "ridiculously fast object serialization";
@@ -15,7 +15,7 @@ buildPythonPackage rec {
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "7e62e242321b208362966d5ab32b45df93b1cb88da4ce6260277da060b4f7475";
+    sha256 = "3772b2a9923fbf674000ff51abebf6ea8f0fca0a2cfcbfa0d63ff118193d1ec5";
   };
 
   buildInputs = [ flake8 py pyflakes tox ];
diff --git a/pkgs/development/python-modules/setuptools/default.nix b/pkgs/development/python-modules/setuptools/default.nix
index 1c53f3cd437..b185be62a69 100644
--- a/pkgs/development/python-modules/setuptools/default.nix
+++ b/pkgs/development/python-modules/setuptools/default.nix
@@ -8,13 +8,13 @@
 # Should use buildPythonPackage here somehow
 stdenv.mkDerivation rec {
   pname = "setuptools";
-  version = "38.2.3";
+  version = "38.2.5";
   name = "${python.libPrefix}-${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
     extension = "zip";
-    sha256 = "124jlg72bbk2xxv5wqbwcl4h5cdslslzk92rxjxiplg79l499hv3";
+    sha256 = "b080f276cc868670540b2c03cee06cc14d2faf9da7bec0f15058d1b402c94507";
   };
 
   buildInputs = [ python wrapPython unzip ];
diff --git a/pkgs/development/python-modules/shapely/default.nix b/pkgs/development/python-modules/shapely/default.nix
index e8e92818ecf..dab3542b809 100644
--- a/pkgs/development/python-modules/shapely/default.nix
+++ b/pkgs/development/python-modules/shapely/default.nix
@@ -6,11 +6,11 @@
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "Shapely";
-  version = "1.6.2.post1";
+  version = "1.6.3";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "07fba518e76b3276558f62a5829bdfa476f790cdef752383ccdc8c66b04b0899";
+    sha256 = "14152f111c7711fc6756fd538ec12fc8cdde7419f869b244922f71f61b2a6c6b";
   };
 
   buildInputs = [ geos glibcLocales cython ];
diff --git a/pkgs/development/python-modules/simplejson/default.nix b/pkgs/development/python-modules/simplejson/default.nix
index 846e8dc21a1..25dbecac949 100644
--- a/pkgs/development/python-modules/simplejson/default.nix
+++ b/pkgs/development/python-modules/simplejson/default.nix
@@ -6,13 +6,13 @@
 
 buildPythonPackage rec {
   pname = "simplejson";
-  version = "3.11.1";
+  version = "3.13.2";
   name = "${pname}-${version}";
   doCheck = !stdenv.isDarwin;
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "01a22d49ddd9a168b136f26cac87d9a335660ce07aa5c630b8e3607d6f4325e7";
+    sha256 = "4c4ecf20e054716cc1e5a81cadc44d3f4027108d8dd0861d8b1e3bd7a32d4f0a";
   };
 
   meta = {
diff --git a/pkgs/development/python-modules/six/default.nix b/pkgs/development/python-modules/six/default.nix
index 00fbbbc01eb..6921b3590e4 100644
--- a/pkgs/development/python-modules/six/default.nix
+++ b/pkgs/development/python-modules/six/default.nix
@@ -19,6 +19,9 @@ buildPythonPackage rec {
     py.test test_six.py
   '';
 
+  # To prevent infinite recursion with pytest
+  doCheck = false;
+
   meta = {
     description = "A Python 2 and 3 compatibility library";
     homepage = https://pypi.python.org/pypi/six/;
diff --git a/pkgs/development/python-modules/smart_open/default.nix b/pkgs/development/python-modules/smart_open/default.nix
index 436d85102d8..2e2020f61f0 100644
--- a/pkgs/development/python-modules/smart_open/default.nix
+++ b/pkgs/development/python-modules/smart_open/default.nix
@@ -12,11 +12,11 @@
 buildPythonPackage rec {
   pname = "smart_open";
   name = "${pname}-${version}";
-  version = "1.5.3";
+  version = "1.5.6";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0m5j71f7f36s17v4mwv0bxg4azknvcy82rbjp28b4vifrjd6dm7s";
+    sha256 = "8fd2de1c359bd0074bd6d334a5b9820ae1c5b6ba563970b95052bace4b71baeb";
   };
 
   propagatedBuildInputs = [ boto bz2file requests responses moto ];
diff --git a/pkgs/development/python-modules/spacy/default.nix b/pkgs/development/python-modules/spacy/default.nix
index 40df45616e9..6c7c3c8400c 100644
--- a/pkgs/development/python-modules/spacy/default.nix
+++ b/pkgs/development/python-modules/spacy/default.nix
@@ -19,23 +19,12 @@
 , ftfy
 , thinc
 , pip
+, regex
 }:
-let
-  enableDebugging = true;
-  regexLocked = buildPythonPackage rec {
-    name = "${pname}-${version}";
-    pname = "regex";
-    version = "2017.04.05";
 
-    src = fetchPypi {
-      inherit pname version;
-      sha256 = "0c95gf3jzz8mv52lkgq0h7sbasjwvdhghm4s0phmy5k9sr78f4fq";
-    };
-  };
-in buildPythonPackage rec {
+buildPythonPackage rec {
   pname = "spacy";
   version = "1.8.2";
-  name = pname + "-" + version;
 
   src = fetchFromGitHub {
     owner = "explosion";
@@ -56,7 +45,7 @@ in buildPythonPackage rec {
    ujson
    dill
    requests
-   regexLocked
+   regex
    ftfy
    thinc
    pytest
diff --git a/pkgs/development/python-modules/splinter/default.nix b/pkgs/development/python-modules/splinter/default.nix
new file mode 100644
index 00000000000..abd9bd230d4
--- /dev/null
+++ b/pkgs/development/python-modules/splinter/default.nix
@@ -0,0 +1,30 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, selenium
+, flask
+, coverage
+}:
+
+buildPythonPackage rec {
+  pname = "splinter";
+  version = "0.7.7";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "f97119f84d339067169451d56043f37f6b0a504a17a7ac6e48c91c012be72af6";
+  };
+
+  propagatedBuildInputs = [ selenium ];
+
+  checkInputs = [ flask coverage ];
+
+  # No tests included
+  doCheck = false;
+
+  meta = {
+    description = "Browser abstraction for web acceptance testing";
+    homepage = https://github.com/cobrateam/splinter;
+    license = lib.licenses.bsd3;
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/sqlalchemy/default.nix b/pkgs/development/python-modules/sqlalchemy/default.nix
index 9b3a5fa2039..488e78cb4ee 100644
--- a/pkgs/development/python-modules/sqlalchemy/default.nix
+++ b/pkgs/development/python-modules/sqlalchemy/default.nix
@@ -11,11 +11,11 @@
 buildPythonPackage rec {
   pname = "SQLAlchemy";
   name = "${pname}-${version}";
-  version = "1.1.15";
+  version = "1.2.0";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "8b79a5ed91cdcb5abe97b0045664c55c140aec09e5dd5c01303e23de5fe7a95a";
+    sha256 = "7dda3e0b1b12215e3bb05368d1abbf7d747112a43738e0a4e6deb466b83fd88e";
   };
 
   checkInputs = [
diff --git a/pkgs/development/python-modules/sqlmap/default.nix b/pkgs/development/python-modules/sqlmap/default.nix
index 2c85bdbe3d1..e89abbd595a 100644
--- a/pkgs/development/python-modules/sqlmap/default.nix
+++ b/pkgs/development/python-modules/sqlmap/default.nix
@@ -5,12 +5,12 @@
 
 buildPythonPackage rec {
   pname = "sqlmap";
-  version = "1.1.11";
+  version = "1.1.12";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "bb5297df9cd97316b3c7ca64f8e31cae5cc6b94c015afd84c546877f1f77d6e4";
+    sha256 = "86a1078ceb1e79f891633c7e4c7b07949fd9135a0e4c0738abd5111e2e6b96c0";
   };
 
   # No tests in archive
diff --git a/pkgs/development/python-modules/stevedore/default.nix b/pkgs/development/python-modules/stevedore/default.nix
index 326282a39c3..9639ce96194 100644
--- a/pkgs/development/python-modules/stevedore/default.nix
+++ b/pkgs/development/python-modules/stevedore/default.nix
@@ -2,12 +2,12 @@
 
 buildPythonPackage rec {
   pname = "stevedore";
-  version = "1.27.1";
+  version = "1.28.0";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "236468dae36707069e8b3bdb455e9f1be090b1e6b937f4ac0c56a538d6f50be0";
+    sha256 = "f1c7518e7b160336040fee272174f1f7b29a46febb3632502a8f2055f973d60b";
   };
 
   doCheck = false;
diff --git a/pkgs/development/python-modules/stripe/default.nix b/pkgs/development/python-modules/stripe/default.nix
index 7edfb9c4f0e..e2a88a9f10b 100644
--- a/pkgs/development/python-modules/stripe/default.nix
+++ b/pkgs/development/python-modules/stripe/default.nix
@@ -3,7 +3,7 @@
 
 buildPythonPackage rec {
   pname = "stripe";
-  version = "1.70.0";
+  version = "1.77.0";
   name = "${pname}-${version}";
 
   # Tests require network connectivity and there's no easy way to disable
@@ -12,7 +12,7 @@ buildPythonPackage rec {
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "ee77103d2d18fe6369f23c40c93067425c5ed67e08b1a7678e681217e8fa8062";
+    sha256 = "6503851d2309dd9c1307e3f0a1cb33ac1427fee25d38ecba1f8bf73a0d74defc";
   };
 
   buildInputs = [ unittest2 mock ];
diff --git a/pkgs/development/python-modules/structlog/default.nix b/pkgs/development/python-modules/structlog/default.nix
new file mode 100644
index 00000000000..2aab5b16aef
--- /dev/null
+++ b/pkgs/development/python-modules/structlog/default.nix
@@ -0,0 +1,32 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, pytest
+, pretend
+, freezegun
+, simplejson
+}:
+
+buildPythonPackage rec {
+  pname = "structlog";
+  version = "17.2.0";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "6980001045abd235fa12582222627c19b89109e58b85eb77d5a5abc778df6e20";
+  };
+
+  checkInputs = [ pytest pretend freezegun ];
+  propagatedBuildInputs = [ simplejson ];
+
+  checkPhase = ''
+    rm tests/test_twisted.py*
+    py.test
+  '';
+
+  meta = {
+    description = "Painless structural logging";
+    homepage = http://www.structlog.org/;
+    license = lib.licenses.asl20;
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/supervise_api/default.nix b/pkgs/development/python-modules/supervise_api/default.nix
index 5b98aa3415b..85f0106db65 100644
--- a/pkgs/development/python-modules/supervise_api/default.nix
+++ b/pkgs/development/python-modules/supervise_api/default.nix
@@ -6,13 +6,13 @@
 
 buildPythonPackage rec {
   pname = "supervise_api";
-  version = "0.1.5";
+  version = "0.2.0";
 
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1pqqlw80cjdgrlpvdmydkyhsrr4s531mn6bfkshm68j9gk4kq6px";
+    sha256 = "e6982633a924cb5192d2291d25b366ff311876a31b0f5961471b39d87397ef5b";
   };
 
   propagatedBuildInputs = [ supervise ];
diff --git a/pkgs/development/python-modules/sybil/default.nix b/pkgs/development/python-modules/sybil/default.nix
index b1fe22df476..1370c59ace8 100644
--- a/pkgs/development/python-modules/sybil/default.nix
+++ b/pkgs/development/python-modules/sybil/default.nix
@@ -3,11 +3,11 @@
 
 buildPythonApplication rec {
   pname   = "sybil";
-  version = "1.0.5";
+  version = "1.0.6";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0x8qd5p5qliv8wmdglda2iy3f70i4jg8zqyk8yhklm5hrxm8jdl6";
+    sha256 = "5bd7dd09eff68cbec9062e6950124fadfaaccbc0f50b23c1037f4d70ae86f0f1";
   };
 
   checkInputs = [ pytest nose ];
diff --git a/pkgs/development/python-modules/tabulate/default.nix b/pkgs/development/python-modules/tabulate/default.nix
index 9ddc2a0e08b..db7f43c1ea4 100644
--- a/pkgs/development/python-modules/tabulate/default.nix
+++ b/pkgs/development/python-modules/tabulate/default.nix
@@ -5,13 +5,13 @@
 }:
 
 buildPythonPackage rec {
-  version = "0.7.7";
+  version = "0.8.2";
   pname = "tabulate";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "83a0b8e17c09f012090a50e1e97ae897300a72b35e0c86c0b53d3bd2ae86d8c6";
+    sha256 = "e4ca13f26d0a6be2a2915428dc21e732f1e44dad7f76d7030b2ef1ec251cf7f2";
   };
 
   checkInputs = [ nose ];
diff --git a/pkgs/development/python-modules/testtools/default.nix b/pkgs/development/python-modules/testtools/default.nix
index e786cb84329..eb6a6694b05 100644
--- a/pkgs/development/python-modules/testtools/default.nix
+++ b/pkgs/development/python-modules/testtools/default.nix
@@ -12,19 +12,18 @@
 , pyrsistent
 }:
 
-# testtools 2.0.0 and up has a circular run-time dependency on futures
+
 
 buildPythonPackage rec {
   pname = "testtools";
-  version = "1.9.0";
-  name = "${pname}-${version}";
+  version = "2.3.0";
 
   # Python 2 only judging from SyntaxError
 #   disabled = isPy3k;
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "b46eec2ad3da6e83d53f2b0eca9a8debb687b4f71343a074f83a16bbdb3c0644";
+    sha256 = "5827ec6cf8233e0f29f51025addd713ca010061204fdea77484a2934690a0559";
   };
 
   propagatedBuildInputs = [ pbr python_mimeparse extras lxml unittest2 pyrsistent ];
@@ -33,6 +32,11 @@ buildPythonPackage rec {
   # No tests in archive
   doCheck = false;
 
+  # testtools 2.0.0 and up has a circular run-time dependency on futures
+  postPatch = ''
+    substituteInPlace requirements.txt --replace "fixtures>=1.3.0" ""
+  '';
+
   meta = {
     description = "A set of extensions to the Python standard library's unit testing framework";
     homepage = https://pypi.python.org/pypi/testtools;
diff --git a/pkgs/development/python-modules/textacy/default.nix b/pkgs/development/python-modules/textacy/default.nix
index 1647b837d97..333c4825f0f 100644
--- a/pkgs/development/python-modules/textacy/default.nix
+++ b/pkgs/development/python-modules/textacy/default.nix
@@ -25,11 +25,11 @@
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "textacy";
-  version = "0.4.1";
+  version = "0.5.0";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "04wf3a7zgzz83nmgkh488wkl50zm9yfdpv3sl12sm2zj685plqcz";
+    sha256 = "6fc4603fd52c386081b063ef7aa15ca77e5e937a3064b197359659fccfdeb406";
   };
 
   disabled = isPy27; # 2.7 requires backports.csv
diff --git a/pkgs/development/python-modules/texttable/default.nix b/pkgs/development/python-modules/texttable/default.nix
new file mode 100644
index 00000000000..38cffcee296
--- /dev/null
+++ b/pkgs/development/python-modules/texttable/default.nix
@@ -0,0 +1,20 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+}:
+
+buildPythonPackage rec {
+  pname = "texttable";
+  version = "1.1.1";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "44674d1d470a9fc264c4d1eba44b74463ca0066d7b954453dd5a4f8057779c9c";
+  };
+
+  meta = {
+    description = "A module to generate a formatted text table, using ASCII characters";
+    homepage = http://foutaise.org/code/;
+    license = lib.licenses.lgpl2;
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/thespian/default.nix b/pkgs/development/python-modules/thespian/default.nix
index 7a6ff3cc53d..df118470e92 100644
--- a/pkgs/development/python-modules/thespian/default.nix
+++ b/pkgs/development/python-modules/thespian/default.nix
@@ -1,14 +1,14 @@
 { stdenv, fetchPypi, buildPythonPackage, lib }:
 
 buildPythonPackage rec {
-  version = "3.8.3";
+  version = "3.9.0";
   pname = "thespian";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
     extension = "zip";
-    sha256 = "0vvwsh3waxd5ldrayr86kdcshv07bp361fl7p16g9i044vklwly4";
+    sha256 = "e698e3c5369d7b06de5c4ce7b877ea65991c99f7b0fabd09f29e91bc981c7d22";
   };
 
   # Do not run the test suite: it takes a long type and uses
diff --git a/pkgs/development/python-modules/toolz/default.nix b/pkgs/development/python-modules/toolz/default.nix
index 36b85bce3ac..0fc14024903 100644
--- a/pkgs/development/python-modules/toolz/default.nix
+++ b/pkgs/development/python-modules/toolz/default.nix
@@ -6,12 +6,12 @@
 
 buildPythonPackage rec{
   pname = "toolz";
-  version = "0.8.2";
+  version = "0.9.0";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0l3czks4xy37i8099waxk2fdz5g0k1dwys2mkhlxc0b0886cj4sa";
+    sha256 = "929f0a7ea7f61c178bd951bdae93920515d3fbdbafc8e6caf82d752b9b3b31c9";
   };
 
   checkInputs = [ nose ];
diff --git a/pkgs/development/python-modules/tox/default.nix b/pkgs/development/python-modules/tox/default.nix
new file mode 100644
index 00000000000..bc70d65cc1f
--- /dev/null
+++ b/pkgs/development/python-modules/tox/default.nix
@@ -0,0 +1,24 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, py
+, virtualenv
+, pluggy
+, setuptools_scm
+, six
+}:
+
+buildPythonPackage rec {
+  pname = "tox";
+  version = "2.9.1";
+
+  buildInputs = [ setuptools_scm ];
+  propagatedBuildInputs = [ py virtualenv pluggy six ];
+
+  doCheck = false;
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "752f5ec561c6c08c5ecb167d3b20f4f4ffc158c0ab78855701a75f5cef05f4b8";
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/python-modules/tqdm/default.nix b/pkgs/development/python-modules/tqdm/default.nix
index 2392a4a9968..209ee8ccd6b 100644
--- a/pkgs/development/python-modules/tqdm/default.nix
+++ b/pkgs/development/python-modules/tqdm/default.nix
@@ -11,12 +11,12 @@
 
 buildPythonPackage rec {
   pname = "tqdm";
-  version = "4.19.4";
+  version = "4.19.5";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "7ca803c2ea268c6bdb541e2dac74a3af23cf4bf7b4132a6a78926d255f8c8df1";
+    sha256 = "df32e6f127dc0ccbc675eadb33f749abbcb8f174c5cb9ec49c0cdb73aa737377";
   };
 
   buildInputs = [ nose coverage glibcLocales flake8 ];
diff --git a/pkgs/development/python-modules/tzlocal/default.nix b/pkgs/development/python-modules/tzlocal/default.nix
index 2277cb7c4ca..1c61d0afab3 100644
--- a/pkgs/development/python-modules/tzlocal/default.nix
+++ b/pkgs/development/python-modules/tzlocal/default.nix
@@ -4,13 +4,13 @@
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "tzlocal";
-  version = "1.4";
+  version = "1.5.1";
 
   propagatedBuildInputs = [ pytz ];
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0n9hw4kqblyc0avzwi26rqmvyk9impb608rvy11qifmigy7r18h5";
+    sha256 = "4ebeb848845ac898da6519b9b31879cf13b6626f7184c496037b818e238f2c4e";
   };
 
   # test fail (timezone test fail)
diff --git a/pkgs/development/python-modules/vowpalwabbit/default.nix b/pkgs/development/python-modules/vowpalwabbit/default.nix
index 8c980cf2b2c..f2b5e06baaa 100644
--- a/pkgs/development/python-modules/vowpalwabbit/default.nix
+++ b/pkgs/development/python-modules/vowpalwabbit/default.nix
@@ -3,11 +3,11 @@
 pythonPackages.buildPythonPackage rec {
   pname = "vowpalwabbit";
   name = "${pname}-${version}";
-  version = "8.3.2";
+  version = "8.4.0";
 
   src = fetchurl{
     url = "mirror://pypi/v/vowpalwabbit/${name}.tar.gz";
-    sha256 = "0qm8rlrs2gfgamqnpx4lapxakpzgh0yh3kp1lbd7lhb0r748m3k7";
+    sha256 = "abd22bfae99fb102cf8a6aec49e8c278cb7317d3a7eb60f70cd102be9c336fd5";
   };
   # vw tries to write some explicit things to home
   # python installed: The directory '/homeless-shelter/.cache/pip/http'
diff --git a/pkgs/development/python-modules/websockets/default.nix b/pkgs/development/python-modules/websockets/default.nix
index 48803655258..f24f10675f8 100644
--- a/pkgs/development/python-modules/websockets/default.nix
+++ b/pkgs/development/python-modules/websockets/default.nix
@@ -6,13 +6,13 @@
 
 let
   pname = "websockets";
-  version = "3.4";
+  version = "4.0.1";
 in buildPythonPackage rec {
   name = "${pname}-${version}";
 
   src = fetchurl {
     url = "mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${name}.tar.gz";
-    sha256 = "43e5b9f51dd0000a4c6f646e2ade0c886bd14a784ffac08b9e079bd17a63bcc5";
+    sha256 = "da4d4fbe059b0453e726d6d993760065d69b823a27efc3040402a6fcfe6a1ed9";
   };
 
   disabled = pythonOlder "3.3";
diff --git a/pkgs/development/python-modules/werkzeug/default.nix b/pkgs/development/python-modules/werkzeug/default.nix
index 5979d895a74..78380900416 100644
--- a/pkgs/development/python-modules/werkzeug/default.nix
+++ b/pkgs/development/python-modules/werkzeug/default.nix
@@ -1,21 +1,23 @@
 { stdenv, buildPythonPackage, fetchPypi
-, itsdangerous
+, itsdangerous, hypothesis
 , pytest, requests, glibcLocales }:
 
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "Werkzeug";
-  version = "0.12.2";
+  version = "0.14.1";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "09mv4cya3lywkn4mi3qrqmjgwiw99kdk03dk912j8da6ny3pnflh";
+    sha256 = "c3fd7a7d41976d9f44db327260e263132466836cef6f91512889ed60ad26557c";
   };
 
-  LC_ALL = "en_US.UTF-8";
-
   propagatedBuildInputs = [ itsdangerous ];
-  buildInputs = [ pytest requests glibcLocales ];
+  checkInputs = [ pytest requests glibcLocales hypothesis ];
+
+  checkPhase = ''
+    LC_ALL="en_US.UTF-8" py.test
+  '';
 
   meta = with stdenv.lib; {
     homepage = http://werkzeug.pocoo.org/;
diff --git a/pkgs/development/python-modules/widgetsnbextension/default.nix b/pkgs/development/python-modules/widgetsnbextension/default.nix
index b9ab1dfbc1d..ab63b444af6 100644
--- a/pkgs/development/python-modules/widgetsnbextension/default.nix
+++ b/pkgs/development/python-modules/widgetsnbextension/default.nix
@@ -8,11 +8,11 @@
 buildPythonPackage rec {
   pname = "widgetsnbextension";
   name = "${pname}-${version}";
-  version = "3.0.8";
+  version = "3.1.0";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "a57e29e733b989e68fdd0f3d6927a3691763b39792591d573b95a89a5a12ec15";
+    sha256 = "67fc28c3b9fede955d69bccbd92784e3f0c6d0dee3a71532cd3367c257feb178";
   };
 
   propagatedBuildInputs = [ notebook ];
diff --git a/pkgs/development/python-modules/ws4py/default.nix b/pkgs/development/python-modules/ws4py/default.nix
index 648ab1cff08..5e65940e846 100644
--- a/pkgs/development/python-modules/ws4py/default.nix
+++ b/pkgs/development/python-modules/ws4py/default.nix
@@ -4,11 +4,11 @@
 buildPythonPackage rec {
   name = "${pname}-${version}";
   pname = "ws4py";
-  version = "0.4.2";
+  version = "0.4.3";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "0zr3254ky6r7q15l3dhdczfa8i723055zdkqssjifsgcwvirriks";
+    sha256 = "ee12b58384bab8bfdcd1c76dcd6852047aec163af17175fc0f73e255d107dd7a";
   };
 
   checkInputs = [ pytest mock git ];
diff --git a/pkgs/development/python-modules/xarray/default.nix b/pkgs/development/python-modules/xarray/default.nix
index 1215e613f6f..afde3f3b45b 100644
--- a/pkgs/development/python-modules/xarray/default.nix
+++ b/pkgs/development/python-modules/xarray/default.nix
@@ -10,30 +10,23 @@
 
 buildPythonPackage rec {
   pname = "xarray";
-  version = "0.9.6";
-  name = "${pname}-${version}";
+  version = "0.10.0";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "f649a41d43b5a6c64bdcbd57e994932656b689f9593a86dd0be95778a2b47494";
+    sha256 = "af1449e8df84a6eb09eb1d56c1dc5ac7f24a9563d4f2b9391ff364dc0c62344c";
   };
 
-  # Temporary patch until next release (later than 0.9.6) to fix
-  # a broken test case.
-  patches = [
-    (fetchurl {
-      url = "https://github.com/pydata/xarray/commit/726c6a3638ecf95889c541d84e892a106c2f2f92.patch";
-      sha256 = "1i2hsj5v5qlvqfj48vyn9931yndsf4k4wrk3qpqpywh32s7r007b";
-    })
-  ];
-
-  buildInputs = [ pytest ];
+  checkInputs = [ pytest ];
   propagatedBuildInputs = [numpy pandas];
 
   checkPhase = ''
     py.test $out/${python.sitePackages}
   '';
 
+  # There always seem to be broken tests...
+  doCheck = false;
+
   meta = {
     description = "N-D labeled arrays and datasets in Python";
     homepage = https://github.com/pydata/xarray;
diff --git a/pkgs/development/python-modules/yapf/default.nix b/pkgs/development/python-modules/yapf/default.nix
index 2ded73d5250..d7617ae1551 100644
--- a/pkgs/development/python-modules/yapf/default.nix
+++ b/pkgs/development/python-modules/yapf/default.nix
@@ -2,12 +2,12 @@
 
 buildPythonPackage rec {
   pname = "yapf";
-  version = "0.19.0";
+  version = "0.20.0";
   name = "${pname}-${version}";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "701b076a4916e3cfbba345e0297dcd54a02fd0fdcae1f43346f8a043c3bbd052";
+    sha256 = "ff28f8839a9a105854a099026a33f4cbec8bd933554bfed658aec359bfc88ae8";
   };
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/python-modules/yarl/default.nix b/pkgs/development/python-modules/yarl/default.nix
index 1275178d5d0..cf95803d5af 100644
--- a/pkgs/development/python-modules/yarl/default.nix
+++ b/pkgs/development/python-modules/yarl/default.nix
@@ -1,24 +1,23 @@
 { lib
-, fetchurl
+, fetchPypi
 , buildPythonPackage
 , multidict
 , pytestrunner
 , pytest
+, idna
 }:
 
-let
+buildPythonPackage rec {
   pname = "yarl";
-  version = "0.13.0";
-in buildPythonPackage rec {
+  version = "0.17.0";
   name = "${pname}-${version}";
-  src = fetchurl {
-    url = "mirror://pypi/${builtins.substring 0 1 pname}/${pname}/${name}.tar.gz";
-    sha256 = "25fe681a982f2cec567df8abac7cbd2ac27016e4aec89193945cab0643bfdb42";
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "2e4e1aec650ad80e73e7063941cd8aadb48e72487ec680a093ad364cc61efe64";
   };
 
-  buildInputs = [ pytest pytestrunner ];
-  propagatedBuildInputs = [ multidict ];
-
+  checkInputs = [ pytest pytestrunner ];
+  propagatedBuildInputs = [ multidict idna ];
 
   meta = {
     description = "Yet another URL library";
diff --git a/pkgs/development/python-modules/zope_copy/default.nix b/pkgs/development/python-modules/zope_copy/default.nix
new file mode 100644
index 00000000000..305928c1846
--- /dev/null
+++ b/pkgs/development/python-modules/zope_copy/default.nix
@@ -0,0 +1,27 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, zope_interface
+, zope_location
+, zope_schema
+}:
+
+
+buildPythonPackage rec {
+  pname = "zope_copy";
+  version = "4.0.2";
+
+  src = fetchPypi {
+    inherit pname version;
+    extension = "zip";
+    sha256 = "eb2a95866df1377741876a3ee62d8600e80089e6246e1a235e86791b29534457";
+  };
+
+  propagatedBuildInputs = [ zope_interface ];
+
+  checkInputs = [ zope_location zope_schema ];
+
+  meta = {
+    maintainers = with lib.maintainers; [ domenkozar ];
+  };
+}
\ No newline at end of file
diff --git a/pkgs/development/r-modules/default.nix b/pkgs/development/r-modules/default.nix
index 76c0e522777..a435ee65e52 100644
--- a/pkgs/development/r-modules/default.nix
+++ b/pkgs/development/r-modules/default.nix
@@ -320,7 +320,7 @@ let
     rmatio = [ pkgs.zlib.dev ];
     Rmpfr = [ pkgs.gmp pkgs.mpfr.dev ];
     Rmpi = [ pkgs.openmpi ];
-    RMySQL = [ pkgs.zlib pkgs.mysql.lib pkgs.mariadb pkgs.openssl.dev ];
+    RMySQL = [ pkgs.zlib pkgs.mysql.connector-c pkgs.openssl.dev ];
     RNetCDF = [ pkgs.netcdf pkgs.udunits ];
     RODBCext = [ pkgs.libiodbc ];
     RODBC = [ pkgs.libiodbc ];
@@ -798,10 +798,10 @@ let
     });
 
     RMySQL = old.RMySQL.overrideDerivation (attrs: {
-      MYSQL_DIR="${pkgs.mysql.lib}";
+      MYSQL_DIR="${pkgs.mysql.connector-c}";
       preConfigure = ''
         patchShebangs configure
-        '';
+      '';
     });
 
     devEMF = old.devEMF.overrideDerivation (attrs: {
diff --git a/pkgs/development/ruby-modules/gem-config/default.nix b/pkgs/development/ruby-modules/gem-config/default.nix
index 05415b88968..e434a863c0e 100644
--- a/pkgs/development/ruby-modules/gem-config/default.nix
+++ b/pkgs/development/ruby-modules/gem-config/default.nix
@@ -109,7 +109,7 @@ in
 
   gio2 = attrs: {
     nativeBuildInputs = [ pkgconfig ];
-    buildInputs = [ gtk2 pcre ];
+    buildInputs = [ gtk2 pcre gobjectIntrospection ];
   };
 
   gitlab-markup = attrs: { meta.priority = 1; };
@@ -167,11 +167,11 @@ in
   };
 
   mysql = attrs: {
-    buildInputs = [ mysql.lib zlib openssl ];
+    buildInputs = [ mysql.connector-c zlib openssl ];
   };
 
   mysql2 = attrs: {
-    buildInputs = [ mysql.lib zlib openssl ];
+    buildInputs = [ mysql.connector-c zlib openssl ];
   };
 
   ncursesw = attrs: {
diff --git a/pkgs/development/tools/build-managers/cmake/setup-hook.sh b/pkgs/development/tools/build-managers/cmake/setup-hook.sh
index 614e0031421..a92d54b3f14 100755
--- a/pkgs/development/tools/build-managers/cmake/setup-hook.sh
+++ b/pkgs/development/tools/build-managers/cmake/setup-hook.sh
@@ -72,11 +72,7 @@ if [ -z "$dontUseCmakeConfigure" -a -z "$configurePhase" ]; then
     configurePhase=cmakeConfigurePhase
 fi
 
-if [ -n "$crossConfig" ]; then
-    crossEnvHooks+=(addCMakeParams)
-else
-    envHooks+=(addCMakeParams)
-fi
+addEnvHooks "$targetOffset" addCMakeParams
 
 makeCmakeFindLibs(){
   isystem_seen=
diff --git a/pkgs/development/tools/database/shmig/default.nix b/pkgs/development/tools/database/shmig/default.nix
index a397ba69697..49e90ce64c8 100644
--- a/pkgs/development/tools/database/shmig/default.nix
+++ b/pkgs/development/tools/database/shmig/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchFromGitHub
 , withMySQL ? false, withPSQL ? false, withSQLite ? false
-, mariadb, postgresql, sqlite, gawk, which
+, mysql, postgresql, sqlite, gawk, which
 , lib
 }:
 
@@ -20,7 +20,7 @@ stdenv.mkDerivation {
     patchShebangs .
 
     substituteInPlace shmig \
-      --replace "\`which mysql\`" "${lib.optionalString withMySQL "${mariadb}/bin/mysql"}" \
+      --replace "\`which mysql\`" "${lib.optionalString withMySQL "${mysql.client}/bin/mysql"}" \
       --replace "\`which psql\`" "${lib.optionalString withPSQL "${postgresql}/bin/psql"}" \
       --replace "\`which sqlite3\`" "${lib.optionalString withSQLite "${sqlite}/bin/sqlite3"}" \
       --replace "awk" "${gawk}/bin/awk" \
diff --git a/pkgs/development/tools/misc/automake/setup-hook.sh b/pkgs/development/tools/misc/automake/setup-hook.sh
index 5cd8c6229f6..292632b7cbc 100644
--- a/pkgs/development/tools/misc/automake/setup-hook.sh
+++ b/pkgs/development/tools/misc/automake/setup-hook.sh
@@ -2,4 +2,4 @@ addAclocals () {
     addToSearchPathWithCustomDelimiter : ACLOCAL_PATH $1/share/aclocal
 }
 
-envHooks+=(addAclocals)
+addEnvHooks "$hostOffset" addAclocals
diff --git a/pkgs/development/tools/misc/binutils/always-search-rpath.patch b/pkgs/development/tools/misc/binutils/always-search-rpath.patch
new file mode 100644
index 00000000000..2e9956e6b6e
--- /dev/null
+++ b/pkgs/development/tools/misc/binutils/always-search-rpath.patch
@@ -0,0 +1,14 @@
+diff --git a/ld/genscripts.sh b/ld/genscripts.sh
+index b6940d376d..0feb1adfd0 100755
+--- a/ld/genscripts.sh
++++ b/ld/genscripts.sh
+@@ -125,6 +125,9 @@ if test "x$NATIVE" = "xyes" ; then
+   USE_LIBPATH=yes
+ fi
+ 
++# TODO: why is this needed?
++USE_LIBPATH=yes
++
+ # Set the library search path, for libraries named by -lfoo.
+ # If LIB_PATH is defined (e.g., by Makefile) and non-empty, it is used.
+ # Otherwise, the default is set here.
diff --git a/pkgs/development/tools/misc/binutils/default.nix b/pkgs/development/tools/misc/binutils/default.nix
index 7628e37ae1c..31c86c785c2 100644
--- a/pkgs/development/tools/misc/binutils/default.nix
+++ b/pkgs/development/tools/misc/binutils/default.nix
@@ -53,11 +53,20 @@ stdenv.mkDerivation rec {
     # elf32-littlearm-vxworks in favor of the first.
     # https://github.com/NixOS/nixpkgs/pull/30484#issuecomment-345472766
     ./disambiguate-arm-targets.patch
+
+    # For some reason bfd ld doesn't search DT_RPATH when cross-compiling. It's
+    # not clear why this behavior was decided upon but it has the unfortunate
+    # consequence that the linker will fail to find transitive dependencies of
+    # shared objects when cross-compiling. Consequently, we are forced to
+    # override this behavior, forcing ld to search DT_RPATH even when
+    # cross-compiling.
+    ./always-search-rpath.patch
   ];
 
   outputs = [ "out" "info" "man" ];
 
-  nativeBuildInputs = [ bison buildPackages.stdenv.cc ];
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ bison ];
   buildInputs = [ zlib ];
 
   inherit noSysDirs;
@@ -82,11 +91,7 @@ stdenv.mkDerivation rec {
     else "-static-libgcc";
 
   # TODO(@Ericson2314): Always pass "--target" and always targetPrefix.
-  configurePlatforms =
-    # TODO(@Ericson2314): Figure out what's going wrong with Arm
-    if hostPlatform == targetPlatform && targetPlatform.isArm
-    then []
-    else [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
+  configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
 
   configureFlags = [
     "--enable-targets=all" "--enable-64-bit-bfd"
diff --git a/pkgs/development/tools/misc/d-feet/default.nix b/pkgs/development/tools/misc/d-feet/default.nix
index 6006c83c0cd..b20f63e2625 100644
--- a/pkgs/development/tools/misc/d-feet/default.nix
+++ b/pkgs/development/tools/misc/d-feet/default.nix
@@ -1,5 +1,5 @@
 { stdenv, pkgconfig, fetchurl, itstool, intltool, libxml2, glib, gtk3
-, python3Packages, wrapGAppsHook, gnome3, libwnck3 }:
+, python3Packages, wrapGAppsHook, gnome3, libwnck3, gobjectIntrospection }:
 
 let
   version = "${major}.13";
@@ -14,7 +14,7 @@ in python3Packages.buildPythonApplication rec {
   };
 
   nativeBuildInputs = [ pkgconfig itstool intltool wrapGAppsHook libxml2 ];
-  buildInputs = [ glib gtk3 gnome3.defaultIconTheme libwnck3 ];
+  buildInputs = [ glib gtk3 gnome3.defaultIconTheme libwnck3 gobjectIntrospection ];
 
   propagatedBuildInputs = with python3Packages; [ pygobject3 pep8 ];
 
diff --git a/pkgs/development/tools/misc/pkgconfig/setup-hook.sh b/pkgs/development/tools/misc/pkgconfig/setup-hook.sh
index 1c153976a34..34a9b9f1173 100644
--- a/pkgs/development/tools/misc/pkgconfig/setup-hook.sh
+++ b/pkgs/development/tools/misc/pkgconfig/setup-hook.sh
@@ -3,8 +3,4 @@ addPkgConfigPath () {
     addToSearchPath PKG_CONFIG_PATH $1/share/pkgconfig
 }
 
-if test -n "$crossConfig"; then
-    crossEnvHooks+=(addPkgConfigPath)
-else
-    envHooks+=(addPkgConfigPath)
-fi
+addEnvHooks "$targetOffset" addPkgConfigPath
diff --git a/pkgs/development/tools/misc/sysbench/default.nix b/pkgs/development/tools/misc/sysbench/default.nix
index 45a31ad66f2..612df55471b 100644
--- a/pkgs/development/tools/misc/sysbench/default.nix
+++ b/pkgs/development/tools/misc/sysbench/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, vim, libmysql,
-  libaio }:
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig, vim, mysql
+, libaio }:
 
 stdenv.mkDerivation rec {
   name = "sysbench-1.0.6";
 
   nativeBuildInputs = [ autoreconfHook pkgconfig ];
-  buildInputs = [ vim libmysql libaio ];
+  buildInputs = [ vim mysql.connector-c libaio ];
 
   src = fetchFromGitHub {
     owner = "akopytov";
diff --git a/pkgs/development/tools/ocaml/findlib/default.nix b/pkgs/development/tools/ocaml/findlib/default.nix
index 846546ae769..186b78ce3f3 100644
--- a/pkgs/development/tools/ocaml/findlib/default.nix
+++ b/pkgs/development/tools/ocaml/findlib/default.nix
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
         fi
     }
 
-    envHooks+=(addOCamlPath)
+    addEnvHooks "$targetOffset" addOCamlPath
   '';
 
   meta = {
diff --git a/pkgs/development/tools/tora/default.nix b/pkgs/development/tools/tora/default.nix
index 578e759548a..5b46b975cf7 100644
--- a/pkgs/development/tools/tora/default.nix
+++ b/pkgs/development/tools/tora/default.nix
@@ -17,7 +17,7 @@ in mkDerivation rec {
 
   nativeBuildInputs = [ cmake extra-cmake-modules makeWrapper ];
   buildInputs = [
-    boost doxygen graphviz loki mysql openssl postgresql qscintillaLib qtbase
+    boost doxygen graphviz loki mysql.connector-c openssl postgresql qscintillaLib qtbase
   ];
 
   preConfigure = ''
@@ -51,6 +51,8 @@ in mkDerivation rec {
     "-lssl"
   ];
 
+  NIX_CFLAGS_COMPILE = [ "-L${mysql.connector-c}/lib/mysql" "-I${mysql.connector-c}/include/mysql" ];
+
   postFixup = ''
     wrapProgram $out/bin/tora \
       --prefix PATH : ${lib.getBin graphviz}/bin
diff --git a/pkgs/development/web/nodejs/setup-hook.sh b/pkgs/development/web/nodejs/setup-hook.sh
index e1f4d9089f3..18368588c2a 100644
--- a/pkgs/development/web/nodejs/setup-hook.sh
+++ b/pkgs/development/web/nodejs/setup-hook.sh
@@ -2,4 +2,4 @@ addNodePath () {
     addToSearchPath NODE_PATH $1/lib/node_modules
 }
 
-envHooks+=(addNodePath)
+addEnvHooks "$hostOffset" addNodePath
diff --git a/pkgs/games/zod/default.nix b/pkgs/games/zod/default.nix
index f795a2ea3a2..da2f256aeb7 100644
--- a/pkgs/games/zod/default.nix
+++ b/pkgs/games/zod/default.nix
@@ -1,5 +1,5 @@
 { fetchurl, stdenv, unrar, unzip, SDL, SDL_image, SDL_ttf, SDL_mixer
-, libmysql, makeWrapper }:
+, mysql, makeWrapper }:
 
 stdenv.mkDerivation rec {
   name = "zod-engine-2011-03-18";
@@ -24,9 +24,9 @@ stdenv.mkDerivation rec {
     sourceRoot=`pwd`/src
   '';
 
-  buildInputs = [ unrar unzip SDL SDL_image SDL_ttf SDL_mixer libmysql makeWrapper ];
+  buildInputs = [ unrar unzip SDL SDL_image SDL_ttf SDL_mixer mysql.connector-c makeWrapper ];
 
-  NIX_LDFLAGS = "-L${stdenv.lib.getLib libmysql}/lib/mysql";
+  NIX_LDFLAGS = "-L${mysql.connector-c}/lib/mysql";
 
   installPhase = ''
     mkdir -p $out/bin $out/share/zod
diff --git a/pkgs/os-specific/darwin/apple-sdk/framework-setup-hook.sh b/pkgs/os-specific/darwin/apple-sdk/framework-setup-hook.sh
index 04d8e878f4f..b0d5915fc1f 100644
--- a/pkgs/os-specific/darwin/apple-sdk/framework-setup-hook.sh
+++ b/pkgs/os-specific/darwin/apple-sdk/framework-setup-hook.sh
@@ -39,4 +39,4 @@ useSystemCoreFoundationFramework () {
   export NIX_COREFOUNDATION_RPATH=/System/Library/Frameworks
 }
 
-envHooks+=(useSystemCoreFoundationFramework)
+addEnvHooks "$hostOffset" useSystemCoreFoundationFramework
diff --git a/pkgs/os-specific/darwin/apple-sdk/security-setup-hook.sh b/pkgs/os-specific/darwin/apple-sdk/security-setup-hook.sh
index f31adaa0d74..ed9bdbd912d 100644
--- a/pkgs/os-specific/darwin/apple-sdk/security-setup-hook.sh
+++ b/pkgs/os-specific/darwin/apple-sdk/security-setup-hook.sh
@@ -7,4 +7,4 @@ noDeprecatedDeclarations() {
   fi
 }
 
-envHooks+=(noDeprecatedDeclarations)
+addEnvHooks "$hostOffset" noDeprecatedDeclarations
diff --git a/pkgs/os-specific/darwin/apple-source-releases/libresolv/default.nix b/pkgs/os-specific/darwin/apple-source-releases/libresolv/default.nix
index a74198e8ddd..a565971a6fa 100644
--- a/pkgs/os-specific/darwin/apple-source-releases/libresolv/default.nix
+++ b/pkgs/os-specific/darwin/apple-source-releases/libresolv/default.nix
@@ -33,7 +33,7 @@ appleDerivation {
     cc -I. -c res_send.c
     cc -I. -c res_sendsigned.c
     cc -I. -c res_update.c
-    cc -dynamiclib -install_name $out/lib/libresolv.9.dylib -o libresolv.9.dylib *.o
+    cc -dynamiclib -install_name $out/lib/libresolv.9.dylib -current_version 1.0.0 -compatibility_version 1.0.0 -o libresolv.9.dylib *.o
   '';
 
   installPhase = ''
diff --git a/pkgs/os-specific/linux/busybox/default.nix b/pkgs/os-specific/linux/busybox/default.nix
index bcb24d127cc..73c945fa0ba 100644
--- a/pkgs/os-specific/linux/busybox/default.nix
+++ b/pkgs/os-specific/linux/busybox/default.nix
@@ -95,7 +95,7 @@ stdenv.mkDerivation rec {
     makeFlagsArray+=("CC=${stdenv.cc.targetPrefix}gcc -isystem ${musl}/include -B${musl}/lib -L${musl}/lib")
   '';
 
-  nativeBuildInputs = lib.optional (hostPlatform != buildPlatform) buildPackages.stdenv.cc;
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
 
   buildInputs = lib.optionals (enableStatic && !useMusl) [ stdenv.cc.libc stdenv.cc.libc.static ];
 
diff --git a/pkgs/os-specific/linux/kernel-headers/4.4.nix b/pkgs/os-specific/linux/kernel-headers/4.4.nix
index 0ef5280d13b..e8e041f48eb 100644
--- a/pkgs/os-specific/linux/kernel-headers/4.4.nix
+++ b/pkgs/os-specific/linux/kernel-headers/4.4.nix
@@ -24,7 +24,8 @@ stdenvNoCC.mkDerivation {
 
   # It may look odd that we use `stdenvNoCC`, and yet explicit depend on a cc.
   # We do this so we have a build->build, not build->host, C compiler.
-  nativeBuildInputs = [ buildPackages.stdenv.cc perl ];
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ perl ];
 
   extraIncludeDirs = lib.optional hostPlatform.isPowerPC ["ppc"];
 
diff --git a/pkgs/servers/clickhouse/default.nix b/pkgs/servers/clickhouse/default.nix
index f9b7a24273f..f4a6b47a45a 100644
--- a/pkgs/servers/clickhouse/default.nix
+++ b/pkgs/servers/clickhouse/default.nix
@@ -1,4 +1,6 @@
-{ stdenv, fetchFromGitHub, cmake, libtool, boost, double-conversion, gperftools, icu, libmysql, lz4, openssl, poco, re2, rdkafka, readline, sparsehash, unixODBC, zookeeper_mt, zstd }:
+{ stdenv, fetchFromGitHub, cmake, libtool, boost, double-conversion, gperftools
+, icu, mysql, lz4, openssl, poco, re2, rdkafka, readline, sparsehash, unixODBC
+, zookeeper_mt, zstd }:
 
 stdenv.mkDerivation rec {
   name = "clickhouse-${version}";
@@ -16,7 +18,10 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake libtool ];
 
-  buildInputs = [ boost double-conversion gperftools icu libmysql lz4 openssl poco re2 rdkafka readline sparsehash unixODBC zookeeper_mt zstd ];
+  buildInputs = [
+    boost double-conversion gperftools icu mysql.connector-c lz4 openssl poco
+    re2 rdkafka readline sparsehash unixODBC zookeeper_mt zstd
+  ];
 
   cmakeFlags = [ "-DENABLE_TESTS=OFF" "-DUNBUNDLED=ON" "-DUSE_STATIC_LIBRARIES=OFF" ];
 
diff --git a/pkgs/servers/computing/slurm/default.nix b/pkgs/servers/computing/slurm/default.nix
index 3b695c46e77..59d62790113 100644
--- a/pkgs/servers/computing/slurm/default.nix
+++ b/pkgs/servers/computing/slurm/default.nix
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkgconfig libtool ];
   buildInputs = [
-    curl python munge perl pam openssl mysql.lib ncurses gtk2 lua hwloc numactl
+    curl python munge perl pam openssl mysql.connector-c ncurses gtk2 lua hwloc numactl
   ];
 
   configureFlags =
diff --git a/pkgs/servers/dns/powerdns/default.nix b/pkgs/servers/dns/powerdns/default.nix
index d7556a39ee9..79fff80b0b8 100644
--- a/pkgs/servers/dns/powerdns/default.nix
+++ b/pkgs/servers/dns/powerdns/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, pkgconfig,
   boost, libyamlcpp, libsodium, sqlite, protobuf,
-  libmysql, postgresql, lua, openldap, geoip, curl
+  mysql57, postgresql, lua, openldap, geoip, curl
 }:
 
 stdenv.mkDerivation rec {
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ boost libmysql postgresql lua openldap sqlite protobuf geoip libyamlcpp libsodium curl ];
+  buildInputs = [ boost mysql57.connector-c postgresql lua openldap sqlite protobuf geoip libyamlcpp libsodium curl ];
 
   # nix destroy with-modules arguments, when using configureFlags
   preConfigure = ''
diff --git a/pkgs/servers/freeradius/default.nix b/pkgs/servers/freeradius/default.nix
index db9d1121992..bf74ca81ced 100644
--- a/pkgs/servers/freeradius/default.nix
+++ b/pkgs/servers/freeradius/default.nix
@@ -13,7 +13,7 @@
 , withMemcached ? false
 , hiredis
 , withRedis ? false
-, libmysql
+, mysql
 , withMysql ? false
 , json_c
 , withJson ? false
@@ -29,7 +29,7 @@ assert withPcap -> libpcap != null;
 assert withCap -> libcap != null;
 assert withMemcached -> libmemcached != null;
 assert withRedis -> hiredis != null;
-assert withMysql -> libmysql != null;
+assert withMysql -> mysql != null;
 assert withYubikey -> libyubikey != null;
 assert withCollectd -> collectd != null;
 
@@ -56,7 +56,7 @@ stdenv.mkDerivation rec {
     ++ optional withCap libcap
     ++ optional withMemcached libmemcached
     ++ optional withRedis hiredis
-    ++ optional withMysql libmysql
+    ++ optional withMysql mysql.connector-c
     ++ optional withJson json_c
     ++ optional withYubikey libyubikey
     ++ optional withCollectd collectd;
diff --git a/pkgs/servers/games/ghost-one/default.nix b/pkgs/servers/games/ghost-one/default.nix
deleted file mode 100644
index 63a71633923..00000000000
--- a/pkgs/servers/games/ghost-one/default.nix
+++ /dev/null
@@ -1,55 +0,0 @@
-{ stdenv, fetchurl, unzip, gmp, zlib, bzip2, boost, mysql }:
-stdenv.mkDerivation rec {
-
-  name = "ghost-one-${version}";
-  version = "1.7.265";
-
-  src = fetchurl {
-    url = "http://www.maxdevlon.com/ghost/ghostone${version}.zip";
-    sha256 = "1sm2ca3lcdr4vjg7v94d8zhqz8cdp44rg8yinzzwkgsr0hj74fv2";
-  };
-
-  buildInputs = [ unzip gmp zlib bzip2 boost mysql.client ];
-
-  patchPhase = ''
-    substituteInPlace ghost/Makefile --replace "/usr/local/lib/mysql" \
-      "${stdenv.lib.getLib mysql.client}/lib/mysql"
-  '';
-
-  buildPhase = ''
-    cd bncsutil/src/bncsutil
-    make
-    cd ../../../StormLib/stormlib/
-    make
-    mkdir -p $out/lib
-    cd ../..
-#    cp bncsutil/src/bncsutil/libbncutil.so $out/lib
-#    cp StormLib/stormlib/libStorm.so $out/lib
-    cd ghost
-    make
-    cd ..
-  '';
-
-  installPhase = ''
-    mkdir -p $out/lib
-    cp bncsutil/src/bncsutil/libbncsutil.so $out/lib
-    cp StormLib/stormlib/libStorm.so $out/lib
-
-    mkdir -p $out/bin
-    cp ghost/ghost++ $out/bin
-
-    mkdir -p $out/share/ghost-one/languages
-    cp -r mapcfgs $out/share/ghost-one
-    cp Languages/*.cfg $out/share/ghost-one/languages
-    cp language.cfg $out/share/ghost-one/languages/English.cfg
-    cp ip-to-country.csv $out/share/ghost-one/
-  '';
-
-  meta = with stdenv.lib; {
-    homepage = http://www.codelain.com/forum/;
-    description = "A Warcraft III: Reign of Chaos and Warcraft III: The Frozen Throne game hosting bot";
-    license = licenses.asl20;
-    maintainers = [ maintainers.phreedom ];
-    broken = true; # can't even get downloaded
-  };
-}
diff --git a/pkgs/servers/http/lighttpd/default.nix b/pkgs/servers/http/lighttpd/default.nix
index 05722f141ed..181e3bf134f 100644
--- a/pkgs/servers/http/lighttpd/default.nix
+++ b/pkgs/servers/http/lighttpd/default.nix
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ pcre libxml2 zlib attr bzip2 which file openssl ]
              ++ stdenv.lib.optional enableMagnet lua5_1
-             ++ stdenv.lib.optional enableMysql mysql.lib
+             ++ stdenv.lib.optional enableMysql mysql.connector-c
              ++ stdenv.lib.optional enableLdap openldap;
 
   configureFlags = [ "--with-openssl" ]
diff --git a/pkgs/servers/mail/dovecot/default.nix b/pkgs/servers/mail/dovecot/default.nix
index ab1808c0647..e2d1f448b32 100644
--- a/pkgs/servers/mail/dovecot/default.nix
+++ b/pkgs/servers/mail/dovecot/default.nix
@@ -2,7 +2,7 @@
 , bzip2, zlib, inotify-tools, pam, libcap
 , clucene_core_2, icu, openldap
 # Auth modules
-, withMySQL ? false, libmysql
+, withMySQL ? false, mysql
 , withPgSQL ? false, postgresql
 , withSQLite ? true, sqlite
 }:
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ perl pkgconfig ];
   buildInputs = [ openssl bzip2 zlib clucene_core_2 icu openldap ]
     ++ lib.optionals (stdenv.isLinux) [ systemd pam libcap inotify-tools ]
-    ++ lib.optional withMySQL libmysql
+    ++ lib.optional withMySQL mysql.connector-c
     ++ lib.optional withPgSQL postgresql
     ++ lib.optional withSQLite sqlite;
 
diff --git a/pkgs/servers/mail/dspam/default.nix b/pkgs/servers/mail/dspam/default.nix
index 623f0a2b0e2..b63390bb247 100644
--- a/pkgs/servers/mail/dspam/default.nix
+++ b/pkgs/servers/mail/dspam/default.nix
@@ -1,7 +1,7 @@
 { stdenv, lib, fetchurl, makeWrapper
 , gawk, gnused, gnugrep, coreutils, which
 , perl, NetSMTP
-, withMySQL ? false, zlib, libmysql
+, withMySQL ? false, zlib, mysql57
 , withPgSQL ? false, postgresql
 , withSQLite ? false, sqlite
 , withDB ? false, db
@@ -26,7 +26,7 @@ in stdenv.mkDerivation rec {
   };
 
   buildInputs = [ perl ]
-                ++ lib.optionals withMySQL [ zlib libmysql ]
+                ++ lib.optionals withMySQL [ zlib mysql57.connector-c ]
                 ++ lib.optional withPgSQL postgresql
                 ++ lib.optional withSQLite sqlite
                 ++ lib.optional withDB db;
@@ -49,7 +49,7 @@ in stdenv.mkDerivation rec {
     "--enable-preferences-extension"
     "--enable-long-usernames"
     "--enable-external-lookup"
-  ] ++ lib.optional withMySQL "--with-mysql-includes=${lib.getDev libmysql}/include/mysql"
+  ] ++ lib.optional withMySQL "--with-mysql-includes=${mysql57.connector-c}/include/mysql"
     ++ lib.optional withPgSQL "--with-pgsql-libraries=${postgresql.lib}/lib";
 
   # Lots of things are hardwired to paths like sysconfdir. That's why we install with both "prefix" and "DESTDIR"
diff --git a/pkgs/servers/mail/opensmtpd/extras.nix b/pkgs/servers/mail/opensmtpd/extras.nix
index 5e5170afbc7..5e87a1fb099 100644
--- a/pkgs/servers/mail/opensmtpd/extras.nix
+++ b/pkgs/servers/mail/opensmtpd/extras.nix
@@ -1,5 +1,6 @@
 { stdenv, fetchurl, openssl, libevent, libasr,
-  python2, pkgconfig, lua5, perl, mariadb, postgresql, sqlite, hiredis }:
+  python2, pkgconfig, lua5, perl, mysql, postgresql, sqlite, hiredis }:
+
 stdenv.mkDerivation rec {
   name = "opensmtpd-extras-${version}";
   version = "5.7.1";
@@ -11,7 +12,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [ openssl libevent
-    libasr python2 lua5 perl mariadb.client postgresql sqlite hiredis ];
+    libasr python2 lua5 perl mysql.connector-c postgresql sqlite hiredis ];
 
   configureFlags = [
     "--sysconfdir=/etc"
@@ -54,7 +55,7 @@ stdenv.mkDerivation rec {
     "--with-perl=${perl}"
     "--with-filter-perl"
 
-  ] ++ stdenv.lib.optional (mariadb != null) [
+  ] ++ stdenv.lib.optional (mysql != null) [
     "--with-table-mysql"
 
   ] ++ stdenv.lib.optional (postgresql != null) [
@@ -67,7 +68,8 @@ stdenv.mkDerivation rec {
     "--with-table-redis"
   ];
 
-  NIX_CFLAGS_COMPILE = stdenv.lib.optional (hiredis != null) [ "-I${hiredis}/include/hiredis" ];
+  NIX_CFLAGS_COMPILE = stdenv.lib.optional (hiredis != null) "-I${hiredis}/include/hiredis" ++
+    stdenv.lib.optional (mysql != null) "-L${mysql.connector-c}/lib/mysql";
 
   meta = with stdenv.lib; {
     homepage = https://www.opensmtpd.org/;
diff --git a/pkgs/servers/mail/postfix/default.nix b/pkgs/servers/mail/postfix/default.nix
index c92507b4167..bf1a1e782a5 100644
--- a/pkgs/servers/mail/postfix/default.nix
+++ b/pkgs/servers/mail/postfix/default.nix
@@ -1,7 +1,7 @@
 { stdenv, lib, fetchurl, makeWrapper, gnused, db, openssl, cyrus_sasl, libnsl
 , coreutils, findutils, gnugrep, gawk, icu, pcre
 , withPgSQL ? false, postgresql
-, withMySQL ? false, libmysql
+, withMySQL ? false, mysql
 , withSQLite ? false, sqlite
 , withLDAP ? false, openldap
 }:
@@ -11,7 +11,7 @@ let
     "-DUSE_TLS" "-DUSE_SASL_AUTH" "-DUSE_CYRUS_SASL" "-I${cyrus_sasl.dev}/include/sasl"
     "-DHAS_DB_BYPASS_MAKEDEFS_CHECK"
    ] ++ lib.optional withPgSQL "-DHAS_PGSQL"
-     ++ lib.optionals withMySQL [ "-DHAS_MYSQL" "-I${lib.getDev libmysql}/include/mysql" ]
+     ++ lib.optionals withMySQL [ "-DHAS_MYSQL" "-I${mysql.connector-c}/include/mysql" "-L${mysql.connector-c}/lib/mysql" ]
      ++ lib.optional withSQLite "-DHAS_SQLITE"
      ++ lib.optional withLDAP "-DHAS_LDAP");
    auxlibs = lib.concatStringsSep " " ([
@@ -35,7 +35,7 @@ in stdenv.mkDerivation rec {
   nativeBuildInputs = [ makeWrapper ];
   buildInputs = [ db openssl cyrus_sasl icu libnsl pcre ]
                 ++ lib.optional withPgSQL postgresql
-                ++ lib.optional withMySQL libmysql
+                ++ lib.optional withMySQL mysql.connector-c
                 ++ lib.optional withSQLite sqlite
                 ++ lib.optional withLDAP openldap;
 
diff --git a/pkgs/servers/sql/mariadb/cmake-includedir.patch b/pkgs/servers/sql/mariadb/cmake-includedir.patch
new file mode 100644
index 00000000000..0c4fe7d321e
--- /dev/null
+++ b/pkgs/servers/sql/mariadb/cmake-includedir.patch
@@ -0,0 +1,11 @@
+--- a/include/CMakeLists.txt	2017-12-25 05:59:07.204144374 +0100
++++ b/include/CMakeLists.txt	2017-12-25 05:59:26.339552817 +0100
+@@ -94,7 +94,7 @@
+ ENDIF()
+ 
+ MACRO(INSTALL_COMPAT_HEADER file footer)
+-  INSTALL(CODE "FILE(WRITE \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDEDIR}/${file}
++  INSTALL(CODE "FILE(WRITE ${INSTALL_INCLUDEDIR}/${file}
+ \"/* Do not edit this file directly, it was auto-generated by cmake */
+ 
+ #warning This file should not be included by clients, include only <mysql.h>
diff --git a/pkgs/servers/sql/mariadb/default.nix b/pkgs/servers/sql/mariadb/default.nix
index d6731a5b7dc..66125b35378 100644
--- a/pkgs/servers/sql/mariadb/default.nix
+++ b/pkgs/servers/sql/mariadb/default.nix
@@ -11,24 +11,18 @@ let # in mariadb # spans the whole file
 mariadb = everything // {
   inherit client; # libmysqlclient.so in .out, necessary headers in .dev and utils in .bin
   server = everything; # a full single-output build, including everything in `client` again
-  lib = client; # compat. with the old mariadb split
+  inherit connector-c; # libmysqlclient.so
 };
 
 common = rec { # attributes common to both builds
-  version = "10.1.28";
+  version = "10.2.11";
 
   src = fetchurl {
     url    = "https://downloads.mariadb.org/f/mariadb-${version}/source/mariadb-${version}.tar.gz/from/http%3A//ftp.hosteurope.de/mirror/archive.mariadb.org/?serve";
-    sha256 = "1g9b0c04qhgcgw6xw29bvdjjjacr7kn82crc7apvvi10ykzwhb99";
+    sha256 = "1s53ravbrxcc8ixvkm56rwgs3cfifzngc56pidd1f1dr1n0mlmb3";
     name   = "mariadb-${version}.tar.gz";
   };
 
-  prePatch = ''
-    substituteInPlace cmake/libutils.cmake \
-      --replace /usr/bin/libtool libtool
-    sed -i 's,[^"]*/var/log,/var/log,g' storage/mroonga/vendor/groonga/CMakeLists.txt
-  '';
-
   nativeBuildInputs = [ cmake pkgconfig ];
 
   buildInputs = [
@@ -36,6 +30,12 @@ common = rec { # attributes common to both builds
   ] ++ stdenv.lib.optionals stdenv.isLinux [ libaio systemd ]
     ++ stdenv.lib.optionals stdenv.isDarwin [ perl fixDarwinDylibNames cctools CoreServices ];
 
+  prePatch = ''
+    sed -i 's,[^"]*/var/log,/var/log,g' storage/mroonga/vendor/groonga/CMakeLists.txt
+  '';
+
+  patches = [ ./cmake-includedir.patch ];
+
   cmakeFlags = [
     "-DBUILD_CONFIG=mysql_release"
     "-DMANUFACTURER=NixOS.org"
@@ -72,7 +72,7 @@ common = rec { # attributes common to both builds
     find "''${!outputBin}/bin" -name '*test*' -delete
   '';
 
-  passthru.mysqlVersion = "5.6";
+  passthru.mysqlVersion = "5.7";
 
   meta = with stdenv.lib; {
     description = "An enhanced, drop-in replacement for MySQL";
@@ -83,7 +83,6 @@ common = rec { # attributes common to both builds
   };
 };
 
-
 client = stdenv.mkDerivation (common // {
   name = "mariadb-client-${common.version}";
 
@@ -97,21 +96,23 @@ client = stdenv.mkDerivation (common // {
 
   preConfigure = common.preConfigure + ''
     cmakeFlags="$cmakeFlags \
-      -DINSTALL_BINDIR=$bin/bin -DINSTALL_SCRIPTDIR=$bin/bin \
+      -DINSTALL_BINDIR=$bin/bin \
+      -DINSTALL_SCRIPTDIR=$bin/bin \
       -DINSTALL_SUPPORTFILESDIR=$bin/share/mysql \
-      -DINSTALL_DOCDIR=$bin/share/doc/mysql -DINSTALL_DOCREADMEDIR=$bin/share/doc/mysql \
+      -DINSTALL_DOCDIR=$bin/share/doc/mysql \
+      -DINSTALL_DOCREADMEDIR=$bin/share/doc/mysql \
       "
   '';
 
   # prevent cycle; it needs to reference $dev
   postInstall = common.postInstall + ''
     moveToOutput bin/mysql_config "$dev"
+    moveToOutput bin/mariadb_config "$dev"
   '';
 
   enableParallelBuilding = true; # the client should be OK
 });
 
-
 everything = stdenv.mkDerivation (common // {
   name = "mariadb-${common.version}";
 
@@ -120,9 +121,7 @@ everything = stdenv.mkDerivation (common // {
   buildInputs = common.buildInputs ++ [
     xz lzo lz4 bzip2 snappy
     libxml2 boost judy libevent cracklib
-  ]
-    ++ optionals (stdenv.isLinux && !stdenv.isArm) [ numactl ]
-    ;
+  ] ++ optionals (stdenv.isLinux && !stdenv.isArm) [ numactl ];
 
   cmakeFlags = common.cmakeFlags ++ [
     "-DMYSQL_DATADIR=/var/lib/mysql"
@@ -155,10 +154,45 @@ everything = stdenv.mkDerivation (common // {
   postInstall = common.postInstall + ''
     rm -r "$out"/{mysql-test,sql-bench,data} # Don't need testing data
     rm "$out"/share/man/man1/mysql-test-run.pl.1
-
-    # Don't install mysqlbug to prevent a dependency on gcc.
-    rm $out/bin/mysqlbug
+    rm "$out"/bin/rcmysql
   '';
+
+  CXXFLAGS = optionalString stdenv.isi686 "-fpermissive";
 });
 
+connector-c = stdenv.mkDerivation rec {
+  name = "mariadb-connector-c-${version}";
+  version = "2.3.4";
+
+  src = fetchurl {
+    url = "https://downloads.mariadb.org/interstitial/connector-c-${version}/mariadb-connector-c-${version}-src.tar.gz/from/http%3A//ftp.hosteurope.de/mirror/archive.mariadb.org/?serve";
+    sha256 = "1g1sq5knarxkfhpkcczr6qxmq12pid65cdkqnhnfs94av89hbswb";
+    name   = "mariadb-connector-c-${version}-src.tar.gz";
+  };
+
+  # outputs = [ "dev" "out" ]; FIXME: cmake variables don't allow that < 3.0
+  cmakeFlags = [
+    "-DWITH_EXTERNAL_ZLIB=ON"
+    "-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock"
+  ];
+
+  nativeBuildInputs = [ cmake ];
+  propagatedBuildInputs = [ openssl zlib ];
+
+  enableParallelBuilding = true;
+
+  postFixup = ''
+    ln -sv mariadb_config $out/bin/mysql_config
+    ln -sv mariadb $out/lib/mysql
+    ln -sv mariadb $out/include/mysql
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Client library that can be used to connect to MySQL or MariaDB";
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ globin ];
+    platforms = platforms.all;
+  };
+};
+
 in mariadb
diff --git a/pkgs/servers/sql/mysql/5.5.x.nix b/pkgs/servers/sql/mysql/5.5.x.nix
index 28e7824cd42..8f6ccd8c0d5 100644
--- a/pkgs/servers/sql/mysql/5.5.x.nix
+++ b/pkgs/servers/sql/mysql/5.5.x.nix
@@ -3,7 +3,8 @@
 
 # Note: zlib is not required; MySQL can use an internal zlib.
 
-stdenv.mkDerivation rec {
+let
+self = stdenv.mkDerivation rec {
   name = "mysql-${version}";
   version = "5.5.58";
 
@@ -59,11 +60,16 @@ stdenv.mkDerivation rec {
     rm $out/share/man/man1/mysql-test-run.pl.1
   '';
 
-  passthru.mysqlVersion = "5.5";
+  passthru = {
+    client = self;
+    connector-c = self;
+    server = self;
+    mysqlVersion = "5.5";
+  };
 
   meta = {
     homepage = http://www.mysql.com/;
     description = "The world's most popular open source database";
     platforms = stdenv.lib.platforms.unix;
   };
-}
+}; in self
diff --git a/pkgs/servers/sql/mysql/5.7.x.nix b/pkgs/servers/sql/mysql/5.7.x.nix
index 687993e0dc5..0b277821876 100644
--- a/pkgs/servers/sql/mysql/5.7.x.nix
+++ b/pkgs/servers/sql/mysql/5.7.x.nix
@@ -3,7 +3,8 @@
 
 # Note: zlib is not required; MySQL can use an internal zlib.
 
-stdenv.mkDerivation rec {
+let
+self = stdenv.mkDerivation rec {
   name = "mysql-${version}";
   version = "5.7.20";
 
@@ -22,15 +23,20 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
+  outputs = [ "out" "static" ];
+
   cmakeFlags = [
     "-DWITH_SSL=yes"
-    "-DWITH_READLINE=yes"
     "-DWITH_EMBEDDED_SERVER=yes"
+    "-DWITH_UNITTEST=no"
     "-DWITH_ZLIB=yes"
+    "-DWITH_ARCHIVE_STORAGE_ENGINE=yes"
+    "-DWITH_BLACKHOLE_STORAGE_ENGINE=yes"
+    "-DWITH_FEDERATED_STORAGE_ENGINE=yes"
+    "-DCMAKE_VERBOSE_MAKEFILE=yes"
     "-DHAVE_IPV6=yes"
     "-DMYSQL_UNIX_ADDR=/run/mysqld/mysqld.sock"
     "-DMYSQL_DATADIR=/var/lib/mysql"
-    "-DINSTALL_SYSCONFDIR=etc/mysql"
     "-DINSTALL_INFODIR=share/mysql/docs"
     "-DINSTALL_MANDIR=share/man"
     "-DINSTALL_PLUGINDIR=lib/mysql/plugin"
@@ -50,15 +56,22 @@ stdenv.mkDerivation rec {
   '';
   postInstall = ''
     sed -i -e "s|basedir=\"\"|basedir=\"$out\"|" $out/bin/mysql_install_db
-    rm -r $out/mysql-test "$out"/lib/*.a
-    rm $out/share/man/man1/mysql-test-run.pl.1
+    install -vD $out/lib/*.a -t $static/lib
+    rm -r $out/mysql-test
+    rm $out/share/man/man1/mysql-test-run.pl.1 $out/lib/*.a
+    ln -s libmysqlclient.so $out/lib/libmysqlclient_r.so
   '';
 
-  passthru.mysqlVersion = "5.7";
+  passthru = {
+    client = self;
+    connector-c = self;
+    server = self;
+    mysqlVersion = "5.7";
+  };
 
   meta = {
     homepage = http://www.mysql.com/;
     description = "The world's most popular open source database";
     platforms = stdenv.lib.platforms.unix;
   };
-}
+}; in self
diff --git a/pkgs/servers/web-apps/frab/Gemfile.lock b/pkgs/servers/web-apps/frab/Gemfile.lock
index 530c54ebd89..06502ef59ad 100644
--- a/pkgs/servers/web-apps/frab/Gemfile.lock
+++ b/pkgs/servers/web-apps/frab/Gemfile.lock
@@ -180,7 +180,7 @@ GEM
       pry (~> 0.10)
     pry-rails (0.3.4)
       pry (>= 0.9.10)
-    puma (3.6.0)
+    puma (3.9.1)
     rack (1.6.4)
     rack-test (0.6.3)
       rack (>= 1.0)
diff --git a/pkgs/servers/web-apps/frab/gemset.nix b/pkgs/servers/web-apps/frab/gemset.nix
index 9f881579f42..449fbf1a5b6 100644
--- a/pkgs/servers/web-apps/frab/gemset.nix
+++ b/pkgs/servers/web-apps/frab/gemset.nix
@@ -628,10 +628,10 @@
   puma = {
     source = {
       remotes = ["https://rubygems.org"];
-      sha256 = "1rmcny3jr1jj01f9fqijwmikj212a5iql7ghifklm77x4a8pp399";
+      sha256 = "1k13n500r7v480rcbxm7k09hip0zi7p8zvy3vajj8g9hb7gdcwnp";
       type = "gem";
     };
-    version = "3.6.0";
+    version = "3.9.1";
   };
   rack = {
     source = {
@@ -929,4 +929,4 @@
     };
     version = "0.9.5";
   };
-}
\ No newline at end of file
+}
diff --git a/pkgs/servers/web-apps/searx/default.nix b/pkgs/servers/web-apps/searx/default.nix
index 1c5f52d4938..28eeeb11259 100644
--- a/pkgs/servers/web-apps/searx/default.nix
+++ b/pkgs/servers/web-apps/searx/default.nix
@@ -1,34 +1,43 @@
 { lib, pythonPackages, fetchFromGitHub }:
 
-pythonPackages.buildPythonApplication rec {
-  name = "searx-${version}";
-  version = "0.12.0";
-  namePrefix = "";
+with pythonPackages;
 
+buildPythonApplication rec {
+  pname = "searx";
+  version = "0.13.1";
+
+  # Can not use PyPI because certain test files are missing.
   src = fetchFromGitHub {
     owner = "asciimoo";
     repo = "searx";
     rev = "v${version}";
-    sha256 = "196lk8dpv8fsjgmwlqik6j6rabvfid41fir6lzqy03hv7ydcw1k0";
+    sha256 = "0nizxq9ggf9g8f8pxn2hfm0kn20356v65h4cj9s73n742nkv6ani";
   };
 
   postPatch = ''
     substituteInPlace requirements.txt \
-      --replace 'certifi==2017.1.23' 'certifi' \
-      --replace 'lxml==3.7.3' 'lxml' \
-      --replace 'pyopenssl==16.2.0' 'pyopenssl' \
+      --replace 'certifi==2017.11.5' 'certifi' \
+      --replace 'flask==0.12.2' 'flask==0.12.*' \
+      --replace 'flask-babel==0.11.2' 'flask-babel==0.11.*' \
+      --replace 'lxml==4.1.1' 'lxml==4.1.*' \
+      --replace 'idna==2.5' 'idna' \
       --replace 'pygments==2.1.3' 'pygments>=2.1,<3.0' \
-      --replace 'flask==0.12' 'flask==0.12.*' \
-      --replace 'requests[socks]==2.13.0' 'requests[socks]==2.*' \
-      --replace 'python-dateutil==2.6.0' 'python-dateutil==2.6.*'
+      --replace 'pyopenssl==17.4.0' 'pyopenssl' \
+      --replace 'python-dateutil==2.6.1' 'python-dateutil==2.6.*'
   '';
 
-  propagatedBuildInputs = with pythonPackages; [
+  propagatedBuildInputs = [
     pyyaml lxml grequests flaskbabel flask requests
     gevent speaklater Babel pytz dateutil pygments
     pyasn1 pyasn1-modules ndg-httpsclient certifi pysocks
   ];
 
+  checkInputs = [ splinter mock plone-testing robotsuite unittest2 ];
+
+  preCheck = ''
+    rm tests/test_robot.py # A variable that is imported is commented out
+  '';
+
   meta = with lib; {
     homepage = https://github.com/asciimoo/searx;
     description = "A privacy-respecting, hackable metasearch engine";
diff --git a/pkgs/servers/x11/xorg/builder.sh b/pkgs/servers/x11/xorg/builder.sh
index bb3e5ac4283..5a832cb14d5 100644
--- a/pkgs/servers/x11/xorg/builder.sh
+++ b/pkgs/servers/x11/xorg/builder.sh
@@ -16,13 +16,8 @@ postInstall() {
 
     echo "propagating requisites $requires"
 
-    if test -n "$crossConfig"; then
-        local pkgs=("${crossPkgs[@]}")
-    else
-        local pkgs=("${nativePkgs[@]}")
-    fi
     for r in $requires; do
-        for p in "${pkgs[@]}"; do
+        for p in "${pkgsHostHost[@]}" "${pkgsHostTarget[@]}"; do
             if test -e $p/lib/pkgconfig/$r.pc; then
                 echo "  found requisite $r in $p"
                 propagatedBuildInputs+=" $p"
diff --git a/pkgs/servers/x11/xorg/default.nix b/pkgs/servers/x11/xorg/default.nix
index d1c7c81c101..cc2cade8ba1 100644
--- a/pkgs/servers/x11/xorg/default.nix
+++ b/pkgs/servers/x11/xorg/default.nix
@@ -2588,11 +2588,11 @@ let
   }) // {inherit ;};
 
   xorgserver = (mkDerivation "xorgserver" {
-    name = "xorg-server-1.19.5";
+    name = "xorg-server-1.19.6";
     builder = ./builder.sh;
     src = fetchurl {
-      url = mirror://xorg/individual/xserver/xorg-server-1.19.5.tar.bz2;
-      sha256 = "0iql4pgsgpyqcrd3256pv227cdadvz01ych61n0d41ixp67gmzqq";
+      url = mirror://xorg/individual/xserver/xorg-server-1.19.6.tar.bz2;
+      sha256 = "15y13ihgkggmly5s07vzvpn35gzx1w0hrkbnlcvcy05h3lpm0cm7";
     };
     nativeBuildInputs = [ pkgconfig ];
     buildInputs = [ dri2proto dri3proto renderproto openssl libX11 libXau libXaw libxcb xcbutil xcbutilwm xcbutilimage xcbutilkeysyms xcbutilrenderutil libXdmcp libXfixes libxkbfile libXmu libXpm libXrender libXres libXt ];
diff --git a/pkgs/servers/x11/xorg/tarballs-7.7.list b/pkgs/servers/x11/xorg/tarballs-7.7.list
index 4ea77fee443..dd48748dceb 100644
--- a/pkgs/servers/x11/xorg/tarballs-7.7.list
+++ b/pkgs/servers/x11/xorg/tarballs-7.7.list
@@ -186,7 +186,7 @@ mirror://xorg/individual/app/xlsfonts-1.0.5.tar.bz2
 mirror://xorg/individual/app/xmag-1.0.6.tar.bz2
 mirror://xorg/individual/app/xmodmap-1.0.9.tar.bz2
 mirror://xorg/individual/doc/xorg-docs-1.7.1.tar.bz2
-mirror://xorg/individual/xserver/xorg-server-1.19.5.tar.bz2
+mirror://xorg/individual/xserver/xorg-server-1.19.6.tar.bz2
 mirror://xorg/X11R7.7/src/everything/xorg-sgml-doctools-1.11.tar.bz2
 mirror://xorg/X11R7.7/src/everything/xpr-1.0.4.tar.bz2
 mirror://xorg/individual/app/xprop-1.2.2.tar.bz2
diff --git a/pkgs/shells/bash/4.4.nix b/pkgs/shells/bash/4.4.nix
index b4a2ba55388..5635c6a73be 100644
--- a/pkgs/shells/bash/4.4.nix
+++ b/pkgs/shells/bash/4.4.nix
@@ -68,10 +68,10 @@ stdenv.mkDerivation rec {
   ];
 
   # Note: Bison is needed because the patches above modify parse.y.
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
   nativeBuildInputs = [bison]
     ++ optional (texinfo != null) texinfo
-    ++ optional hostPlatform.isDarwin binutils
-    ++ optional (hostPlatform != buildPlatform) buildPackages.stdenv.cc;
+    ++ optional hostPlatform.isDarwin binutils;
 
   buildInputs = optional interactive readline70;
 
diff --git a/pkgs/stdenv/adapters.nix b/pkgs/stdenv/adapters.nix
index 1a55b06ef36..f7d2c49a66d 100644
--- a/pkgs/stdenv/adapters.nix
+++ b/pkgs/stdenv/adapters.nix
@@ -74,8 +74,7 @@ rec {
     };
   in stdenv // {
     mkDerivation =
-      { buildInputs ? [], nativeBuildInputs ? []
-      , propagatedBuildInputs ? [], propagatedNativeBuildInputs ? []
+      { nativeBuildInputs ? []
       , selfNativeBuildInput ? args.crossAttrs.selfNativeBuildInput or false
       , ...
       } @ args:
@@ -98,14 +97,6 @@ rec {
             ++ stdenv.lib.optional hostPlatform.isAarch64 pkgs.updateAutotoolsGnuConfigScriptsHook
             ;
 
-          # Cross-linking dynamic libraries, every buildInput should
-          # be propagated because ld needs the -rpath-link to find
-          # any library needed to link the program dynamically at
-          # loader time. ld(1) explains it.
-          buildInputs = [];
-          propagatedBuildInputs = propagatedBuildInputs ++ buildInputs;
-          propagatedNativeBuildInputs = propagatedNativeBuildInputs;
-
           crossConfig = hostPlatform.config;
         } // args.crossAttrs or {});
   };
diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix
index d202186c29b..2542d242885 100644
--- a/pkgs/stdenv/darwin/default.nix
+++ b/pkgs/stdenv/darwin/default.nix
@@ -58,6 +58,7 @@ in rec {
                           extraPreHook      ? "",
                           extraNativeBuildInputs,
                           extraBuildInputs,
+                          libcxx,
                           allowedRequisites ? null}:
     let
       buildPackages = lib.optionalAttrs (last ? stdenv) {
@@ -82,6 +83,8 @@ in rec {
         inherit shell;
         inherit (last) stdenvNoCC;
 
+        extraPackages = lib.optional (libcxx != null) libcxx;
+
         nativeTools  = false;
         nativeLibc   = false;
         inherit buildPackages coreutils gnugrep bintools;
@@ -176,6 +179,7 @@ in rec {
 
     extraNativeBuildInputs = [];
     extraBuildInputs = [];
+    libcxx = null;
   };
 
   stage1 = prevStage: let
@@ -183,7 +187,8 @@ in rec {
   in with prevStage; stageFun 1 prevStage {
     extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${bootstrapTools}/Library/Frameworks\"";
     extraNativeBuildInputs = [];
-    extraBuildInputs = [ pkgs.libcxx ];
+    extraBuildInputs = [ ];
+    libcxx = pkgs.libcxx;
 
     allowedRequisites =
       [ bootstrapTools ] ++ (with pkgs; [ libcxx libcxxabi ]) ++ [ pkgs.darwin.Libsystem ];
@@ -210,7 +215,8 @@ in rec {
     '';
 
     extraNativeBuildInputs = [ pkgs.xz ];
-    extraBuildInputs = with pkgs; [ darwin.CF libcxx ];
+    extraBuildInputs = [ pkgs.darwin.CF ];
+    libcxx = pkgs.libcxx;
 
     allowedRequisites =
       [ bootstrapTools ] ++
@@ -242,7 +248,8 @@ in rec {
     # and instead goes by $PATH, which happens to contain bootstrapTools. So it goes and
     # patches our shebangs back to point at bootstrapTools. This makes sure bash comes first.
     extraNativeBuildInputs = with pkgs; [ xz pkgs.bash ];
-    extraBuildInputs = with pkgs; [ darwin.CF libcxx ];
+    extraBuildInputs = [ pkgs.darwin.CF ];
+    libcxx = pkgs.libcxx;
 
     extraPreHook = ''
       export PATH=${pkgs.bash}/bin:$PATH
@@ -277,7 +284,9 @@ in rec {
   in with prevStage; stageFun 4 prevStage {
     shell = "${pkgs.bash}/bin/bash";
     extraNativeBuildInputs = with pkgs; [ xz pkgs.bash ];
-    extraBuildInputs = with pkgs; [ darwin.CF libcxx ];
+    extraBuildInputs = [ pkgs.darwin.CF ];
+    libcxx = pkgs.libcxx;
+
     extraPreHook = ''
       export PATH_LOCALE=${pkgs.darwin.locale}/share/locale
     '';
@@ -347,10 +356,11 @@ in rec {
       cc       = pkgs.llvmPackages.clang-unwrapped;
       bintools = pkgs.darwin.binutils;
       libc     = pkgs.darwin.Libsystem;
+      extraPackages = [ pkgs.libcxx ];
     };
 
     extraNativeBuildInputs = [];
-    extraBuildInputs = with pkgs; [ darwin.CF libcxx ];
+    extraBuildInputs = [ pkgs.darwin.CF ];
 
     extraAttrs = {
       inherit platform bootstrapTools;
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index eb8545c6999..2d702ab389e 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -14,11 +14,27 @@ rec {
   mkDerivation =
     { name ? ""
 
-    , nativeBuildInputs ? []
-    , buildInputs ? []
+    # These types of dependencies are all exhaustively documented in
+    # the "Specifying Dependencies" section of the "Standard
+    # Environment" chapter of the Nixpkgs manual.
 
-    , propagatedNativeBuildInputs ? []
-    , propagatedBuildInputs ? []
+    # TODO(@Ericson2314): Stop using legacy dep attribute names
+
+    #                           host offset -> target offset
+    , depsBuildBuild              ? [] # -1 -> -1
+    , depsBuildBuildPropagated    ? [] # -1 -> -1
+    , nativeBuildInputs           ? [] # -1 ->  0  N.B. Legacy name
+    , propagatedNativeBuildInputs ? [] # -1 ->  0  N.B. Legacy name
+    , depsBuildTarget             ? [] # -1 ->  1
+    , depsBuildTargetPropagated   ? [] # -1 ->  1
+
+    , depsHostHost                ? [] #  0 ->  0
+    , depsHostHostPropagated      ? [] #  0 ->  0
+    , buildInputs                 ? [] #  0 ->  1  N.B. Legacy name
+    , propagatedBuildInputs       ? [] #  0 ->  1  N.B. Legacy name
+
+    , depsTargetTarget            ? [] #  1 ->  1
+    , depsTargetTargetPropagated  ? [] #  1 ->  1
 
     , configureFlags ? []
     , # Target is not included by default because most programs don't care.
@@ -56,15 +72,35 @@ rec {
       inherit erroneousHardeningFlags hardeningDisable hardeningEnable supportedHardeningFlags;
     })
     else let
-      dependencies = map lib.chooseDevOutputs [
-        (map (drv: drv.nativeDrv or drv) nativeBuildInputs
-           ++ lib.optional separateDebugInfo ../../build-support/setup-hooks/separate-debug-info.sh
-           ++ lib.optional stdenv.hostPlatform.isWindows ../../build-support/setup-hooks/win-dll-link.sh)
-        (map (drv: drv.crossDrv or drv) buildInputs)
+      dependencies = map (map lib.chooseDevOutputs) [
+        [
+          (map (drv: drv.__spliced.buildBuild or drv) depsBuildBuild)
+          (map (drv: drv.nativeDrv or drv) nativeBuildInputs
+             ++ lib.optional separateDebugInfo ../../build-support/setup-hooks/separate-debug-info.sh
+             ++ lib.optional stdenv.hostPlatform.isWindows ../../build-support/setup-hooks/win-dll-link.sh)
+          (map (drv: drv.__spliced.buildTarget or drv) depsBuildTarget)
+        ]
+        [
+          (map (drv: drv.__spliced.hostHost or drv) depsHostHost)
+          (map (drv: drv.crossDrv or drv) buildInputs)
+        ]
+        [
+          (map (drv: drv.__spliced.targetTarget or drv) depsTargetTarget)
+        ]
       ];
-      propagatedDependencies = map lib.chooseDevOutputs [
-        (map (drv: drv.nativeDrv or drv) propagatedNativeBuildInputs)
-        (map (drv: drv.crossDrv or drv) propagatedBuildInputs)
+      propagatedDependencies = map (map lib.chooseDevOutputs) [
+        [
+          (map (drv: drv.__spliced.buildBuild or drv) depsBuildBuildPropagated)
+          (map (drv: drv.nativeDrv or drv) propagatedNativeBuildInputs)
+          (map (drv: drv.__spliced.buildTarget or drv) depsBuildTargetPropagated)
+        ]
+        [
+          (map (drv: drv.__spliced.hostHost or drv) depsHostHostPropagated)
+          (map (drv: drv.crossDrv or drv) propagatedBuildInputs)
+        ]
+        [
+          (map (drv: drv.__spliced.targetTarget or drv) depsTargetTargetPropagated)
+        ]
       ];
 
       outputs' =
@@ -105,11 +141,19 @@ rec {
           userHook = config.stdenv.userHook or null;
           __ignoreNulls = true;
 
-          nativeBuildInputs = lib.elemAt dependencies 0;
-          buildInputs = lib.elemAt dependencies 1;
+          depsBuildBuild              = lib.elemAt (lib.elemAt dependencies 0) 0;
+          nativeBuildInputs           = lib.elemAt (lib.elemAt dependencies 0) 1;
+          depsBuildTarget             = lib.elemAt (lib.elemAt dependencies 0) 2;
+          depsHostBuild               = lib.elemAt (lib.elemAt dependencies 1) 0;
+          buildInputs                 = lib.elemAt (lib.elemAt dependencies 1) 1;
+          depsTargetTarget            = lib.elemAt (lib.elemAt dependencies 2) 0;
 
-          propagatedNativeBuildInputs = lib.elemAt propagatedDependencies 0;
-          propagatedBuildInputs = lib.elemAt propagatedDependencies 1;
+          depsBuildBuildPropagated    = lib.elemAt (lib.elemAt propagatedDependencies 0) 0;
+          propagatedNativeBuildInputs = lib.elemAt (lib.elemAt propagatedDependencies 0) 1;
+          depsBuildTargetPropagated   = lib.elemAt (lib.elemAt propagatedDependencies 0) 2;
+          depsHostBuildPropagated     = lib.elemAt (lib.elemAt propagatedDependencies 1) 0;
+          propagatedBuildInputs       = lib.elemAt (lib.elemAt propagatedDependencies 1) 1;
+          depsTargetTargetPropagated  = lib.elemAt (lib.elemAt propagatedDependencies 2) 0;
 
           # This parameter is sometimes a string, sometimes null, and sometimes a list, yuck
           configureFlags = let inherit (lib) optional elem; in
diff --git a/pkgs/stdenv/generic/setup.sh b/pkgs/stdenv/generic/setup.sh
index 686ed68cede..d2c67cce81a 100644
--- a/pkgs/stdenv/generic/setup.sh
+++ b/pkgs/stdenv/generic/setup.sh
@@ -300,11 +300,83 @@ runHook preHook
 runHook addInputsHook
 
 
-# Recursively find all build inputs.
+# Package accumulators
+
+# shellcheck disable=SC2034
+declare -a pkgsBuildBuild pkgsBuildHost pkgsBuildTarget
+declare -a pkgsHostHost pkgsHostTarget
+declare -a pkgsTargetTarget
+
+declare -ra pkgBuildAccumVars=(pkgsBuildBuild pkgsBuildHost pkgsBuildTarget)
+declare -ra pkgHostAccumVars=(pkgsHostHost pkgsHostTarget)
+declare -ra pkgTargetAccumVars=(pkgsTargetTarget)
+
+declare -ra pkgAccumVarVars=(pkgBuildAccumVars pkgHostAccumVars pkgTargetAccumVars)
+
+
+# Hooks
+
+declare -a envBuildBuildHooks envBuildHostHooks envBuildTargetHooks
+declare -a envHostHostHooks envHostTargetHooks
+declare -a envTargetTargetHooks
+
+declare -ra pkgBuildHookVars=(envBuildBuildHook envBuildHostHook envBuildTargetHook)
+declare -ra pkgHostHookVars=(envHostHostHook envHostTargetHook)
+declare -ra pkgTargetHookVars=(envTargetTargetHook)
+
+declare -ra pkgHookVarVars=(pkgBuildHookVars pkgHostHookVars pkgTargetHookVars)
+
+# Add env hooks for all sorts of deps with the specified host offset.
+addEnvHooks() {
+    local depHostOffset="$1"
+    shift
+    local pkgHookVarsSlice="${pkgHookVarVars[$depHostOffset + 1]}[@]"
+    local pkgHookVar
+    for pkgHookVar in "${!pkgHookVarsSlice}"; do
+        eval "${pkgHookVar}s"'+=("$@")'
+    done
+}
+
+
+# Propagated dep files
+
+declare -ra propagatedBuildDepFiles=(
+    propagated-build-build-deps
+    propagated-native-build-inputs # Legacy name for back-compat
+    propagated-build-target-deps
+)
+declare -ra propagatedHostDepFiles=(
+    propagated-host-host-deps
+    propagated-build-inputs # Legacy name for back-compat
+)
+declare -ra propagatedTargetDepFiles=(
+    propagated-target-target-deps
+)
+declare -ra propagatedDepFilesVars=(
+    propagatedBuildDepFiles
+    propagatedHostDepFiles
+    propagatedTargetDepFiles
+)
+
+# Platform offsets: build = -1, host = 0, target = 1
+declare -ra allPlatOffsets=(-1 0 1)
+
+
+# Mutually-recursively find all build inputs. See the dependency section of the
+# stdenv chapter of the Nixpkgs manual for the specification this algorithm
+# implements.
 findInputs() {
-    local pkg="$1"; shift
-    local var="$1"; shift
-    local propagatedBuildInputsFiles=("$@")
+    local -r pkg="$1"
+    local -ri hostOffset="$2"
+    local -ri targetOffset="$3"
+
+    # Sanity check
+    (( "$hostOffset" <= "$targetOffset" )) || exit -1
+
+    local varVar="${pkgAccumVarVars[$hostOffset + 1]}"
+    local varRef="$varVar[\$targetOffset - \$hostOffset]"
+    local var="${!varRef}"
+    unset -v varVar varRef
 
     # TODO(@Ericson2314): Restore using associative array once Darwin
     # nix-shell doesn't use impure bash. This should replace the O(n)
@@ -324,21 +396,106 @@ findInputs() {
         exit 1
     fi
 
-    local file
-    for file in "${propagatedBuildInputsFiles[@]}"; do
-        file="$pkg/nix-support/$file"
-        [[ -f "$file" ]] || continue
-
-        local pkgNext
-        for pkgNext in $(< "$file"); do
-            findInputs "$pkgNext" "$var" "${propagatedBuildInputsFiles[@]}"
+    # The current package's host and target offset together
+    # provide a <=-preserving homomorphism from the relative
+    # offsets to current offset
+    function mapOffset() {
+        local -ri inputOffset="$1"
+        if (( "$inputOffset" <= 0 )); then
+            local -ri outputOffset="$inputOffset + $hostOffset"
+        else
+            local -ri outputOffset="$inputOffset - 1 + $targetOffset"
+        fi
+        echo "$outputOffset"
+    }
+
+    # Host offset relative to that of the package whose immediate
+    # dependencies we are currently exploring.
+    local -i relHostOffset
+    for relHostOffset in "${allPlatOffsets[@]}"; do
+        # `+ 1` so we start at 0 for valid index
+        local files="${propagatedDepFilesVars[$relHostOffset + 1]}"
+
+        # Host offset relative to the package currently being
+        # built---as absolute an offset as will be used.
+        local -i hostOffsetNext
+        hostOffsetNext="$(mapOffset relHostOffset)"
+
+        # Ensure we're in bounds relative to the package currently
+        # being built.
+        [[ "${allPlatOffsets[*]}" = *"$hostOffsetNext"*  ]] || continue
+
+        # Target offset relative to the *host* offset of the package
+        # whose immediate dependencies we are currently exploring.
+        local -i relTargetOffset
+        for relTargetOffset in "${allPlatOffsets[@]}"; do
+            (( "$relHostOffset" <= "$relTargetOffset" )) || continue
+
+            local fileRef="${files}[$relTargetOffset - $relHostOffset]"
+            local file="${!fileRef}"
+            unset -v fileRef
+
+            # Target offset relative to the package currently being
+            # built.
+            local -i targetOffsetNext
+            targetOffsetNext="$(mapOffset relTargetOffset)"
+
+            # Once again, ensure we're in bounds relative to the
+            # package currently being built.
+            [[ "${allPlatOffsets[*]}" = *"$targetOffsetNext"* ]] || continue
+
+            [[ -f "$pkg/nix-support/$file" ]] || continue
+
+            local pkgNext
+            for pkgNext in $(< "$pkg/nix-support/$file"); do
+                findInputs "$pkgNext" "$hostOffsetNext" "$targetOffsetNext"
+            done
         done
     done
 }
 
+# Make sure all are at least defined as empty
+: ${depsBuildBuild=} ${depsBuildBuildPropagated=}
+: ${nativeBuildInputs=} ${propagatedNativeBuildInputs=} ${defaultNativeBuildInputs=}
+: ${depsBuildTarget=} ${depsBuildTargetPropagated=}
+: ${depsHostHost=} ${depsHostHostPropagated=}
+: ${buildInputs=} ${propagatedBuildInputs=} ${defaultBuildInputs=}
+: ${depsTargetTarget=} ${depsTargetTargetPropagated=}
+
+for pkg in $depsBuildBuild $depsBuildBuildPropagated; do
+    findInputs "$pkg" -1 -1
+done
+for pkg in $nativeBuildInputs $propagatedNativeBuildInputs; do
+    findInputs "$pkg" -1  0
+done
+for pkg in $depsBuildTarget $depsBuildTargetPropagated; do
+    findInputs "$pkg" -1  1
+done
+for pkg in $depsHostHost $depsHostHostPropagated; do
+    findInputs "$pkg"  0  0
+done
+for pkg in $buildInputs $propagatedBuildInputs ; do
+    findInputs "$pkg"  0  1
+done
+for pkg in $depsTargetTarget $depsTargetTargetPropagated; do
+    findInputs "$pkg"  1  1
+done
+# Default inputs must be processed last
+for pkg in $defaultNativeBuildInputs; do
+    findInputs "$pkg" -1  0
+done
+for pkg in $defaultBuildInputs; do
+    findInputs "$pkg"  0  1
+done
+
 # Add package to the future PATH and run setup hooks
 activatePackage() {
     local pkg="$1"
+    local -ri hostOffset="$2"
+    local -ri targetOffset="$3"
+
+    # Sanity check
+    (( "$hostOffset" <= "$targetOffset" )) || exit -1
 
     if [ -f "$pkg" ]; then
         local oldOpts="$(shopt -po nounset)"
@@ -347,11 +504,18 @@ activatePackage() {
         eval "$oldOpts"
     fi
 
-    if [ -d "$pkg/bin" ]; then
+    # Only dependencies whose host platform is guaranteed to match the
+    # build platform are included here. That would be `depsBuild*`,
+    # and legacy `nativeBuildInputs`, in general. If we aren't cross
+    # compiling, however, everything can be put on the PATH. To ease
+    # the transition, we do include everything in thatcase.
+    #
+    # TODO(@Ericson2314): Don't special-case native compilation
+    if [[ ( -z "${crossConfig-}" ||  "$hostOffset" -le -1 ) && -d "$pkg/bin" ]]; then
         addToSearchPath _PATH "$pkg/bin"
     fi
 
-    if [ -f "$pkg/nix-support/setup-hook" ]; then
+    if [[ -f "$pkg/nix-support/setup-hook" ]]; then
         local oldOpts="$(shopt -po nounset)"
         set +u
         source "$pkg/nix-support/setup-hook"
@@ -359,67 +523,72 @@ activatePackage() {
     fi
 }
 
-declare -a nativePkgs crossPkgs
-if [ -z "${crossConfig:-}" ]; then
-    # Not cross-compiling - both buildInputs (and variants like propagatedBuildInputs)
-    # are handled identically to nativeBuildInputs
-    for i in ${nativeBuildInputs:-} ${buildInputs:-} \
-             ${defaultNativeBuildInputs:-} ${defaultBuildInputs:-} \
-             ${propagatedNativeBuildInputs:-} ${propagatedBuildInputs:-}; do
-        findInputs "$i" nativePkgs propagated-native-build-inputs propagated-build-inputs
-    done
-else
-    for i in ${nativeBuildInputs:-} ${defaultNativeBuildInputs:-} ${propagatedNativeBuildInputs:-}; do
-        findInputs "$i" nativePkgs propagated-native-build-inputs
-    done
-    for i in ${buildInputs:-} ${defaultBuildInputs:-} ${propagatedBuildInputs:-}; do
-        findInputs "$i" crossPkgs propagated-build-inputs
+_activatePkgs() {
+    local -i hostOffset targetOffset
+    local pkg
+
+    for hostOffset in "${allPlatOffsets[@]}"; do
+        local pkgsVar="${pkgAccumVarVars[$hostOffset + 1]}"
+        for targetOffset in "${allPlatOffsets[@]}"; do
+            (( "$hostOffset" <= "$targetOffset" )) || continue
+            local pkgsRef="${pkgsVar}[$targetOffset - $hostOffset]"
+            local pkgsSlice="${!pkgsRef}[@]"
+            for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; do
+                activatePackage "$pkg" "$hostOffset" "$targetOffset"
+            done
+        done
     done
-fi
-
-for i in ${nativePkgs+"${nativePkgs[@]}"} ${crossPkgs+"${crossPkgs[@]}"}; do
-    activatePackage "$i"
-done
+}
 
+# Run the package setup hooks and build _PATH
+_activatePkgs
 
 # Set the relevant environment variables to point to the build inputs
 # found above.
 #
-# These `depOffset`s tell the env hook what sort of dependency
-# (ignoring propagatedness) is being passed to the env hook. In a real
-# language, we'd append a closure with this information to the
-# relevant env hook array, but bash doesn't have closures, so it's
-# easier to just pass this in.
-
-_addToNativeEnv() {
-    local pkg="$1"
-    if [[ -n "${crossConfig:-}" ]]; then
-        local -i depOffset=-1
-    else
-        local -i depOffset=0
-    fi
-
-    # Run the package-specific hooks set by the setup-hook scripts.
-    runHook envHook "$pkg"
-}
-
-# Old bash empty array hack
-for i in ${nativePkgs+"${nativePkgs[@]}"}; do
-    _addToNativeEnv "$i"
-done
-
-_addToCrossEnv() {
-    local pkg="$1"
-    local -i depOffset=0
-
-    # Run the package-specific hooks set by the setup-hook scripts.
-    runHook crossEnvHook "$pkg"
+# These `depOffset`s, beyond indexing the arrays, also tell the env
+# hook what sort of dependency (ignoring propagatedness) is being
+# passed to the env hook. In a real language, we'd append a closure
+# with this information to the relevant env hook array, but bash
+# doesn't have closures, so it's easier to just pass this in.
+_addToEnv() {
+    local -i depHostOffset depTargetOffset
+    local pkg
+
+    for depHostOffset in "${allPlatOffsets[@]}"; do
+        local hookVar="${pkgHookVarVars[$depHostOffset + 1]}"
+        local pkgsVar="${pkgAccumVarVars[$depHostOffset + 1]}"
+        for depTargetOffset in "${allPlatOffsets[@]}"; do
+            (( "$depHostOffset" <= "$depTargetOffset" )) || continue
+            local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]"
+            if [[ -z "${crossConfig-}" ]]; then
+                # Apply environment hooks to all packages during native
+                # compilation to ease the transition.
+                #
+                # TODO(@Ericson2314): Don't special-case native compilation
+                for pkg in \
+                    ${pkgsBuildBuild+"${pkgsBuildBuild[@]}"} \
+                    ${pkgsBuildHost+"${pkgsBuildHost[@]}"} \
+                    ${pkgsBuildTarget+"${pkgsBuildTarget[@]}"} \
+                    ${pkgsHostHost+"${pkgsHostHost[@]}"} \
+                    ${pkgsHostTarget+"${pkgsHostTarget[@]}"} \
+                    ${pkgsTargetTarget+"${pkgsTargetTarget[@]}"}
+                do
+                    runHook "${!hookRef}" "$pkg"
+                done
+            else
+                local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]"
+                local pkgsSlice="${!pkgsRef}[@]"
+                for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; do
+                    runHook "${!hookRef}" "$pkg"
+                done
+            fi
+        done
+    done
 }
 
-# Old bash empty array hack
-for i in ${crossPkgs+"${crossPkgs[@]}"}; do
-    _addToCrossEnv "$i"
-done
+# Run the package-specific hooks set by the setup-hook scripts.
+_addToEnv
 
 
 _addRpathPrefix "$out"
@@ -882,6 +1051,7 @@ installPhase() {
 # propagated-build-inputs.
 fixupPhase() {
     # Make sure everything is writable so "strip" et al. work.
+    local output
     for output in $outputs; do
         if [ -e "${!output}" ]; then chmod -R u+w "${!output}"; fi
     done
@@ -895,19 +1065,35 @@ fixupPhase() {
     done
 
 
-    # Propagate build inputs and setup hook into the development output.
+    # Propagate dependencies & setup hook into the development output.
+    declare -ra flatVars=(
+        # Build
+        depsBuildBuildPropagated
+        propagatedNativeBuildInputs
+        depsBuildTargetPropagated
+        # Host
+        depsHostHostPropagated
+        propagatedBuildInputs
+        # Target
+        depsTargetTargetPropagated
+    )
+    declare -ra flatFiles=(
+        "${propagatedBuildDepFiles[@]}"
+        "${propagatedHostDepFiles[@]}"
+        "${propagatedTargetDepFiles[@]}"
+    )
 
-    if [ -n "${propagatedBuildInputs:-}" ]; then
-        mkdir -p "${!outputDev}/nix-support"
-        # shellcheck disable=SC2086
-        printWords $propagatedBuildInputs > "${!outputDev}/nix-support/propagated-build-inputs"
-    fi
+    local propagatedInputsIndex
+    for propagatedInputsIndex in "${!flatVars[@]}"; do
+        local propagatedInputsSlice="${flatVars[$propagatedInputsIndex]}[@]"
+        local propagatedInputsFile="${flatFiles[$propagatedInputsIndex]}"
+
+        [[ "${!propagatedInputsSlice}" ]] || continue
 
-    if [ -n "${propagatedNativeBuildInputs:-}" ]; then
         mkdir -p "${!outputDev}/nix-support"
         # shellcheck disable=SC2086
-        printWords $propagatedNativeBuildInputs > "${!outputDev}/nix-support/propagated-native-build-inputs"
-    fi
+        printWords ${!propagatedInputsSlice} > "${!outputDev}/nix-support/$propagatedInputsFile"
+    done
 
 
     if [ -n "${setupHook:-}" ]; then
diff --git a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
index 8aaf4993108..02cbac0f278 100644
--- a/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
+++ b/pkgs/stdenv/linux/make-bootstrap-tools-cross.nix
@@ -193,6 +193,7 @@ rec {
         nuke-refs $out/bin/*
         nuke-refs $out/lib/*
         nuke-refs $out/libexec/gcc/*/*/*
+        nuke-refs $out/lib/gcc/*/*/*
 
         mkdir $out/.pack
         mv $out/* $out/.pack
diff --git a/pkgs/tools/admin/ansible/2.1.nix b/pkgs/tools/admin/ansible/2.1.nix
index d4a349c5e47..b8b335bd618 100644
--- a/pkgs/tools/admin/ansible/2.1.nix
+++ b/pkgs/tools/admin/ansible/2.1.nix
@@ -1,5 +1,6 @@
 { stdenv
 , fetchurl
+, fetchFromGitHub
 , pythonPackages
 , windowsSupport ? false
 }:
@@ -10,9 +11,11 @@ let
   jinja = jinja2.overridePythonAttrs (old: rec {
     version = "2.8.1";
     name = "${old.pname}-${version}";
-    src = old.src.override {
-      inherit version;
-      sha256 = "35341f3a97b46327b3ef1eb624aadea87a535b8f50863036e085e7c426ac5891";
+    src = fetchFromGitHub {
+      owner = "pallets";
+      repo = "jinja";
+      rev = version;
+      sha256 = "0m6g6fx6flxb6hrkw757mbx1gxyrmj50w27m2afdsvmvz0zpdi2a";
     };
   });
 in buildPythonPackage rec {
diff --git a/pkgs/tools/admin/ansible/2.2.nix b/pkgs/tools/admin/ansible/2.2.nix
index 4ef35fa5d9e..ccca64b86b6 100644
--- a/pkgs/tools/admin/ansible/2.2.nix
+++ b/pkgs/tools/admin/ansible/2.2.nix
@@ -1,5 +1,6 @@
 { stdenv
 , fetchurl
+, fetchFromGitHub
 , pythonPackages
 , windowsSupport ? false
 }:
@@ -12,9 +13,11 @@ let
   jinja = jinja2.overridePythonAttrs (old: rec {
     version = "2.8.1";
     name = "${old.pname}-${version}";
-    src = old.src.override {
-      inherit version;
-      sha256 = "35341f3a97b46327b3ef1eb624aadea87a535b8f50863036e085e7c426ac5891";
+    src = fetchFromGitHub {
+      owner = "pallets";
+      repo = "jinja";
+      rev = version;
+      sha256 = "0m6g6fx6flxb6hrkw757mbx1gxyrmj50w27m2afdsvmvz0zpdi2a";
     };
   });
 in buildPythonPackage rec {
diff --git a/pkgs/tools/admin/awscli/default.nix b/pkgs/tools/admin/awscli/default.nix
index b0e142a6d1d..b6c7270a425 100644
--- a/pkgs/tools/admin/awscli/default.nix
+++ b/pkgs/tools/admin/awscli/default.nix
@@ -25,14 +25,13 @@ let
   });
 
 in buildPythonPackage rec {
-  name = "${pname}-${version}";
   pname = "awscli";
-  version = "1.14.6";
+  version = "1.14.17";
   namePrefix = "";
 
   src = fetchPypi {
     inherit pname version;
-    sha256 = "1lhv8vb3bkjfjg4jm3hgfjssxgqy50gb6vbkh4lxiy8cn3y2dxp1";
+    sha256 = "456499acc41ab67671062a08e218a22aa1a1ff64ae531e694163d0371e8a1dd0";
   };
 
   # No tests included
diff --git a/pkgs/tools/backup/bareos/default.nix b/pkgs/tools/backup/bareos/default.nix
index c3256713832..4af20f76449 100644
--- a/pkgs/tools/backup/bareos/default.nix
+++ b/pkgs/tools/backup/bareos/default.nix
@@ -1,10 +1,10 @@
 { stdenv, fetchFromGitHub, pkgconfig, nettools, gettext, libtool, flex
 , readline ? null, openssl ? null, python2 ? null, ncurses ? null, rocksdb
-, sqlite ? null, postgresql ? null, libmysql ? null, zlib ? null, lzo ? null
+, sqlite ? null, postgresql ? null, mysql ? null, zlib ? null, lzo ? null
 , jansson ? null, acl ? null, glusterfs ? null, libceph ? null, libcap ? null
 }:
 
-assert sqlite != null || postgresql != null || libmysql != null;
+assert sqlite != null || postgresql != null || mysql != null;
 
 with stdenv.lib;
 let
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig ];
   buildInputs = [
     nettools gettext readline openssl python2 flex ncurses sqlite postgresql
-    libmysql zlib lzo jansson acl glusterfs libceph libcap rocksdb
+    mysql.connector-c zlib lzo jansson acl glusterfs libceph libcap rocksdb
   ];
 
   postPatch = ''
@@ -55,7 +55,7 @@ stdenv.mkDerivation rec {
     ++ optional (openssl != null) "--with-openssl=${openssl.dev}"
     ++ optional (sqlite != null) "--with-sqlite3=${sqlite.dev}"
     ++ optional (postgresql != null) "--with-postgresql=${postgresql}"
-    ++ optional (libmysql != null) "--with-mysql=${libmysql.dev}"
+    ++ optional (mysql != null) "--with-mysql=${mysql.connector-c}"
     ++ optional (zlib != null) "--with-zlib=${zlib.dev}"
     ++ optional (lzo != null) "--with-lzo=${lzo}"
     ++ optional (jansson != null) "--with-jansson=${jansson}"
diff --git a/pkgs/tools/backup/mydumper/default.nix b/pkgs/tools/backup/mydumper/default.nix
index 5b1f8f3fd5c..da8805bc226 100644
--- a/pkgs/tools/backup/mydumper/default.nix
+++ b/pkgs/tools/backup/mydumper/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchFromGitHub, cmake, pkgconfig
-, glib, zlib, pcre, mariadb, libressl, }:
+, glib, zlib, pcre, mysql, libressl }:
 
 stdenv.mkDerivation rec {
   version = "0.9.3";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ cmake pkgconfig ];
 
-  buildInputs = [ glib zlib pcre mariadb.client.dev libressl ];
+  buildInputs = [ glib zlib pcre mysql.connector-c libressl ];
 
   meta = with stdenv.lib; {
     description = ''High-perfomance MySQL backup tool'';
diff --git a/pkgs/tools/inputmethods/ibus/default.nix b/pkgs/tools/inputmethods/ibus/default.nix
index 3fd29d65f36..f71a21b914f 100644
--- a/pkgs/tools/inputmethods/ibus/default.nix
+++ b/pkgs/tools/inputmethods/ibus/default.nix
@@ -1,129 +1,138 @@
-{ stdenv, fetchurl, wrapGAppsHook
-, intltool, isocodes, pkgconfig
-, python3
-, gtk2, gtk3, atk, dconf, glib, json_glib
-, dbus, libnotify, gobjectIntrospection, wayland
-}:
+{ stdenv, fetchurl, fetchFromGitHub, autoreconfHook, gconf, intltool, makeWrapper, pkgconfig
+, vala, wrapGAppsHook, atk, dbus, dconf ? null, glib, gdk_pixbuf, gobjectIntrospection, gtk2
+, gtk3, gtk_doc, isocodes, python3, json_glib, libnotify ? null, enablePythonLibrary ? true
+, enableUI ? true, withWayland ? false, libxkbcommon ? null, wayland ? null }:
+
+assert withWayland -> wayland != null && libxkbcommon != null;
+
+with stdenv.lib;
 
 let
-  emojiData = let
-    srcs = {
-      data = fetchurl {
-        url = "http://unicode.org/Public/emoji/5.0/emoji-data.txt";
-        sha256 = "11jfz5rrvyc2ixliqfcjgmch4cn9mfy0x96qnpfcyz5fy1jvfyxf";
-      };
-      sequences = fetchurl {
-        url = "http://unicode.org/Public/emoji/5.0/emoji-sequences.txt";
-        sha256 = "09bii7f5mmladg0kl3n80fa9qaix6bv5ylm92x52j7wygzv0szb1";
-      };
-      variation-sequences = fetchurl {
-        url = "http://unicode.org/Public/emoji/5.0/emoji-variation-sequences.txt";
-        sha256 = "1wlg4gbq7spmpppjfy5zdl82sj0hc836p8gljgfrjmwsjgybq286";
-      };
-      zwj-sequences = fetchurl {
-        url = "http://unicode.org/Public/emoji/5.0/emoji-zwj-sequences.txt";
-        sha256 = "16gvzv76mjv9g81lm1m6cr3rpfqyn2k4hb9a62xd329252dhl25q";
-      };
-      test = fetchurl {
-        url = "http://unicode.org/Public/emoji/5.0/emoji-test.txt";
-        sha256 = "031qk2v8xdnba7hfinmgrmpglc9l8ll2hds6mw885p0hngdb3dgw";
-      };
+  emojiSrcs = {
+    data = fetchurl {
+      url = "http://unicode.org/Public/emoji/5.0/emoji-data.txt";
+      sha256 = "11jfz5rrvyc2ixliqfcjgmch4cn9mfy0x96qnpfcyz5fy1jvfyxf";
+    };
+    sequences = fetchurl {
+      url = "http://unicode.org/Public/emoji/5.0/emoji-sequences.txt";
+      sha256 = "09bii7f5mmladg0kl3n80fa9qaix6bv5ylm92x52j7wygzv0szb1";
+    };
+    variation-sequences = fetchurl {
+      url = "http://unicode.org/Public/emoji/5.0/emoji-variation-sequences.txt";
+      sha256 = "1wlg4gbq7spmpppjfy5zdl82sj0hc836p8gljgfrjmwsjgybq286";
+    };
+    zwj-sequences = fetchurl {
+      url = "http://unicode.org/Public/emoji/5.0/emoji-zwj-sequences.txt";
+      sha256 = "16gvzv76mjv9g81lm1m6cr3rpfqyn2k4hb9a62xd329252dhl25q";
+    };
+    test = fetchurl {
+      url = "http://unicode.org/Public/emoji/5.0/emoji-test.txt";
+      sha256 = "031qk2v8xdnba7hfinmgrmpglc9l8ll2hds6mw885p0hngdb3dgw";
     };
-  in stdenv.mkDerivation {
+  };
+  emojiData = stdenv.mkDerivation {
     name = "emoji-data-5.0";
     unpackPhase = ":";
-    dontBuild = true;
-    installPhase = with stdenv.lib; ''
+    installPhase = ''
       mkdir $out
-      ${builtins.toString (flip mapAttrsToList srcs (k: v: ''
-        cp ${v} $out/emoji-${k}.txt
-      ''))}
+      ${builtins.toString (flip mapAttrsToList emojiSrcs (k: v: "cp ${v} $out/emoji-${k}.txt;"))}
     '';
   };
   cldrEmojiAnnotation = stdenv.mkDerivation rec {
     name = "cldr-emoji-annotation-${version}";
-    version = "31.0.1_1";
-    src = fetchurl {
-      url = "https://github.com/fujiwarat/cldr-emoji-annotation/releases/download/${version}/${name}.tar.gz";
-      sha256 = "1a3qzsab7vzjqpdialp1g8ppr21x05v0ph8ngyq9pyjkx4vzcdi7";
+    version = "31.90.0_1";
+    src = fetchFromGitHub {
+      owner = "fujiwarat";
+      repo = "cldr-emoji-annotation";
+      rev = version;
+      sha256 = "1vsj32bg8ab4d80rz0fxy6sj2lv31inzyjnddjm079bnvlaf2kih";
     };
+    nativeBuildInputs = [ autoreconfHook ];
   };
-  pyEnv = python3.buildEnv.override {
-    extraLibs = [ python3.pkgs.pygobject3 ];
-
+  python3Runtime = python3.withPackages (ps: with ps; [ pygobject3 ]);
+  python3BuildEnv = python3.buildEnv.override {
     # ImportError: No module named site
     postBuild = ''
-      makeWrapper '${glib.dev}/bin/glib-genmarshal' "$out"/bin/glib-genmarshal \
-        --unset PYTHONPATH
+      makeWrapper ${glib.dev}/bin/gdbus-codegen $out/bin/gdbus-codegen --unset PYTHONPATH
+      makeWrapper ${glib.dev}/bin/glib-genmarshal $out/bin/glib-genmarshal --unset PYTHONPATH
+      makeWrapper ${glib.dev}/bin/glib-mkenums $out/bin/glib-mkenums --unset PYTHONPATH
     '';
   };
-in stdenv.mkDerivation rec {
+in
+
+stdenv.mkDerivation rec {
   name = "ibus-${version}";
-  version = "1.5.16";
+  version = "1.5.17";
 
-  src = fetchurl {
-    url = "https://github.com/ibus/ibus/releases/download/${version}/${name}.tar.gz";
-    sha256 = "07py16jb81kd7vkqhcia9cb2avsbg5jswp2kzf0k4bprwkxppd9n";
+  src = fetchFromGitHub {
+    owner = "ibus";
+    repo = "ibus";
+    rev = version;
+    sha256 = "09mrj9d8qpl9cbylg1zx8c3ymc5gdy4jrf6zs125wjz0b574g5av";
   };
 
   postPatch = ''
-    # These paths will be set in the wrapper.
-    sed -e "/export IBUS_DATAROOTDIR/ s/^.*$//" \
-        -e "/export IBUS_LIBEXECDIR/ s/^.*$//" \
-        -e "/export IBUS_LOCALEDIR/ s/^.*$//" \
-        -e "/export IBUS_PREFIX/ s/^.*$//" \
-        -i "setup/ibus-setup.in"
+    substituteInPlace setup/ibus-setup.in --subst-var-by PYTHON ${python3Runtime.interpreter}
+    substituteInPlace data/dconf/Makefile.am --replace "dconf update" true
+    substituteInPlace configure.ac --replace '$python2dir/ibus' $out/${python3.sitePackages}/ibus
+    echo \#!${stdenv.shell} > data/dconf/make-dconf-override-db.sh
+    cp ${gtk_doc}/share/gtk-doc/data/gtk-doc.make .
   '';
 
+  preAutoreconf = "touch ChangeLog";
+  preConfigure = "intltoolize";
+
   configureFlags = [
     "--disable-gconf"
-    "--enable-dconf"
     "--disable-memconf"
-    "--enable-ui"
-    "--enable-python-library"
+    (enableFeature (dconf != null) "dconf")
+    (enableFeature (libnotify != null) "libnotify")
+    (enableFeature withWayland "wayland")
+    (enableFeature enablePythonLibrary "python-library")
+    (enableFeature enableUI "ui")
     "--with-unicode-emoji-dir=${emojiData}"
     "--with-emoji-annotation-dir=${cldrEmojiAnnotation}/share/unicode/cldr/common/annotations"
   ];
 
-  buildInputs = [
-    pyEnv
-    intltool isocodes pkgconfig
-    gtk2 gtk3 dconf
-    json_glib
-    dbus libnotify gobjectIntrospection wayland
+  nativeBuildInputs = [
+    autoreconfHook
+    gconf
+    gtk_doc
+    intltool
+    makeWrapper
+    pkgconfig
+    python3BuildEnv
+    vala
+    wrapGAppsHook
   ];
 
   propagatedBuildInputs = [ glib ];
 
-  nativeBuildInputs = [ wrapGAppsHook ];
-
-  outputs = [ "out" "dev" ];
+  buildInputs = [
+    dbus
+    dconf
+    gdk_pixbuf
+    gobjectIntrospection
+    gtk2
+    gtk3
+    isocodes
+    json_glib
+    libnotify
+  ] ++ optionals withWayland [
+    libxkbcommon
+    wayland
+  ];
 
   enableParallelBuilding = true;
 
-  preConfigure = ''
-    # Fix hard-coded installation paths, so make does not try to overwrite our
-    # Python installation.
-    sed -e "/py2overridesdir=/ s|=.*$|=$out/lib/${python3.libPrefix}|" \
-        -e "/pyoverridesdir=/ s|=.*$|=$out/lib/${python3.libPrefix}|" \
-        -e "/PYTHON2_LIBDIR/ s|=.*|=$out/lib/${python3.libPrefix}|" \
-        -i configure
-
-    # Don't try to generate a system-wide dconf database; it wouldn't work.
-    substituteInPlace data/dconf/Makefile.in --replace "dconf update" "echo"
-  '';
-
   doInstallCheck = true;
   installCheckPhase = "$out/bin/ibus version";
 
-  postInstall = ''
-    moveToOutput "bin/ibus-setup" "$dev"
-  '';
-
-  meta = with stdenv.lib; {
+  meta = {
     homepage = https://github.com/ibus/ibus;
-    description = "Intelligent Input Bus for Linux / Unix OS";
+    description = "Intelligent Input Bus, input method framework";
+    license = licenses.lgpl21Plus;
     platforms = platforms.linux;
-    maintainers = [ maintainers.ttuegel ];
+    maintainers = with maintainers; [ ttuegel yegortimoshenko ];
   };
 }
diff --git a/pkgs/tools/misc/colord-kde/default.nix b/pkgs/tools/misc/colord-kde/default.nix
index a91cd627bda..12821cf864c 100644
--- a/pkgs/tools/misc/colord-kde/default.nix
+++ b/pkgs/tools/misc/colord-kde/default.nix
@@ -14,11 +14,11 @@ stdenv.mkDerivation rec {
     sha256 = "0brdnpflm95vf4l41clrqxwvjrdwhs859n7401wxcykkmw4m0m3c";
   };
 
-  nativeBuildInputs = [ extra-cmake-modules ki18n ];
+  nativeBuildInputs = [ extra-cmake-modules ];
 
   buildInputs = [
     kconfig kconfigwidgets kcoreaddons kdbusaddons kiconthemes
-    kcmutils kio knotifications plasma-framework kwidgetsaddons
+    kcmutils ki18n kio knotifications plasma-framework kwidgetsaddons
     kwindowsystem kitemviews lcms2 libXrandr qtx11extras
   ];
 
diff --git a/pkgs/tools/misc/coreutils/default.nix b/pkgs/tools/misc/coreutils/default.nix
index 9a422a96d70..589c58d0acc 100644
--- a/pkgs/tools/misc/coreutils/default.nix
+++ b/pkgs/tools/misc/coreutils/default.nix
@@ -14,11 +14,11 @@ assert selinuxSupport -> libselinux != null && libsepol != null;
 with lib;
 
 stdenv.mkDerivation rec {
-  name = "coreutils-8.28";
+  name = "coreutils-8.29";
 
   src = fetchurl {
     url = "mirror://gnu/coreutils/${name}.tar.xz";
-    sha256 = "0r8c1bgm68kl70j1lgd0rv12iykw6143k4m9a56xip9rc2hv25qi";
+    sha256 = "0plm1zs9il6bb5mk881qvbghq4glc8ybbgakk2lfzb0w64fgml4j";
   };
 
   patches = optional hostPlatform.isCygwin ./coreutils-8.23-4.cygwin.patch;
diff --git a/pkgs/tools/networking/kea/default.nix b/pkgs/tools/networking/kea/default.nix
index 68fb72ff7d9..f33fe7a7105 100644
--- a/pkgs/tools/networking/kea/default.nix
+++ b/pkgs/tools/networking/kea/default.nix
@@ -21,12 +21,12 @@ stdenv.mkDerivation rec {
   configureFlags = [
     "--localstatedir=/var"
     "--with-dhcp-pgsql=${postgresql}/bin/pg_config"
-    "--with-dhcp-mysql=${mysql.client.dev}/bin/mysql_config"
+    "--with-dhcp-mysql=${mysql.connector-c}/bin/mysql_config"
   ];
 
   nativeBuildInputs = [ autoreconfHook pkgconfig ];
   buildInputs = [
-    openssl log4cplus boost python3 mysql.client
+    openssl log4cplus boost python3 mysql.connector-c
     botan2 gmp bzip2
   ];
 
diff --git a/pkgs/tools/networking/mailutils/default.nix b/pkgs/tools/networking/mailutils/default.nix
index aee5302405a..6f47b4b5576 100644
--- a/pkgs/tools/networking/mailutils/default.nix
+++ b/pkgs/tools/networking/mailutils/default.nix
@@ -1,11 +1,10 @@
-{ stdenv, fetchurl, fetchpatch, autoreconfHook, dejagnu, gettext, libtool, pkgconfig
+{ stdenv, fetchurl, fetchpatch, autoreconfHook, dejagnu, gettext, pkgconfig
 , gdbm, pam, readline, ncurses, gnutls, guile, texinfo, gnum4, sasl, fribidi, nettools
-, gss, mysql }:
+, python, gss, mysql }:
 
 let
   p = "https://raw.githubusercontent.com/gentoo/gentoo/9c921e89d51876fd876f250324893fd90c019326/net-mail/mailutils/files";
-in
-stdenv.mkDerivation rec {
+in stdenv.mkDerivation rec {
   name = "${project}-${version}";
   project = "mailutils";
   version = "3.2";
@@ -16,11 +15,11 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [
-    autoreconfHook gettext libtool pkgconfig
+    autoreconfHook gettext pkgconfig
   ] ++ stdenv.lib.optional doCheck dejagnu;
   buildInputs = [
     gdbm pam readline ncurses gnutls guile texinfo gnum4 sasl fribidi nettools
-    gss mysql.lib
+    gss mysql.connector-c python
   ];
 
   patches = [
@@ -52,14 +51,20 @@ stdenv.mkDerivation rec {
   ];
 
   postPatch = ''
-    sed -e '/AM_GNU_GETTEXT_VERSION/s/0.18/0.19/' -i configure.ac
     sed -i -e '/chown root:mail/d' \
            -e 's/chmod [24]755/chmod 0755/' \
       */Makefile{.in,.am}
+    sed -i 's:/usr/lib/mysql:${mysql.connector-c}/lib/mysql:' configure.ac
+    sed -i 's/0\.18/0.19/' configure.ac
+    sed -i -e 's:mysql/mysql.h:mysql.h:' \
+           -e 's:mysql/errmsg.h:errmsg.h:' \
+      sql/mysql.c
   '';
 
+  NIX_CFLAGS_COMPILE = "-L${mysql.connector-c}/lib/mysql -I${mysql.connector-c}/include/mysql";
+
   preCheck = ''
-    # Add missing files.
+    # Add missing test files
     cp ${builtins.toString readmsg-tests} readmsg/tests/
     for f in hdr.at nohdr.at twomsg.at weed.at; do
       mv readmsg/tests/*-$f readmsg/tests/$f
diff --git a/pkgs/tools/networking/mitmproxy/default.nix b/pkgs/tools/networking/mitmproxy/default.nix
index f96987a1300..36874a81281 100644
--- a/pkgs/tools/networking/mitmproxy/default.nix
+++ b/pkgs/tools/networking/mitmproxy/default.nix
@@ -1,6 +1,28 @@
 { stdenv, fetchpatch, fetchFromGitHub, fetchurl, python3, glibcLocales }:
 
-python3.pkgs.buildPythonPackage rec {
+let
+  # When overrides are not needed, then only remove the contents of this set.
+  packageOverrides = self: super: {
+    ldap3 = super.ldap3.overridePythonAttrs (oldAttrs: rec {
+      version = "2.3";
+      src = oldAttrs.src.override {
+        inherit version;
+        sha256 = "c056b3756076e15aa71c963c7c5a44d5d9bbd430263ee49598d4454223a766ac";
+      };
+    });
+    pyasn1 = super.pyasn1.overridePythonAttrs (oldAttrs: rec {
+      version = "0.3.7";
+      src = oldAttrs.src.override {
+        inherit version;
+        sha256 = "187f2a66d617683f8e82d5c00033b7c8a0287e1da88a9d577aebec321cad4965";
+      };
+    });
+  };
+
+  pythonPackages = (python3.override {inherit packageOverrides; }).pkgs;
+in with pythonPackages;
+
+buildPythonPackage rec {
   baseName = "mitmproxy";
   name = "${baseName}-unstable-2017-10-31";
 
@@ -17,7 +39,7 @@ python3.pkgs.buildPythonPackage rec {
     LC_CTYPE=en_US.UTF-8 pytest -k 'not test_echo and not test_find_unclaimed_URLs '
   '';
 
-  propagatedBuildInputs = with python3.pkgs; [
+  propagatedBuildInputs = [
     blinker click certifi cryptography
     h2 hyperframe
     kaitaistruct passlib pyasn1 pyopenssl
@@ -25,7 +47,7 @@ python3.pkgs.buildPythonPackage rec {
     urwid brotlipy sortedcontainers ldap3
   ];
 
-  buildInputs = with python3.pkgs; [
+  buildInputs = [
     beautifulsoup4 flask pytest pytestrunner glibcLocales
   ];
 
diff --git a/pkgs/tools/networking/snabb/default.nix b/pkgs/tools/networking/snabb/default.nix
index f3baddd2653..46580c0b802 100644
--- a/pkgs/tools/networking/snabb/default.nix
+++ b/pkgs/tools/networking/snabb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchFromGitHub, bash, makeWrapper, git, mariadb, diffutils, which, coreutils, procps, nettools }:
+{ stdenv, lib, fetchFromGitHub, bash, makeWrapper, git, mysql, diffutils, which, coreutils, procps, nettools }:
 
 stdenv.mkDerivation rec {
   name = "snabb-${version}";
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
     done
 
     # We need a way to pass $PATH to the scripts
-    sed -i '2iexport PATH=${stdenv.lib.makeBinPath [ git mariadb which procps coreutils ]}' src/program/snabbnfv/neutron_sync_master/neutron_sync_master.sh.inc
+    sed -i '2iexport PATH=${stdenv.lib.makeBinPath [ git mysql.client which procps coreutils ]}' src/program/snabbnfv/neutron_sync_master/neutron_sync_master.sh.inc
     sed -i '2iexport PATH=${stdenv.lib.makeBinPath [ git coreutils diffutils nettools ]}' src/program/snabbnfv/neutron_sync_agent/neutron_sync_agent.sh.inc
   '';
 
diff --git a/pkgs/tools/security/gnupg/22.nix b/pkgs/tools/security/gnupg/22.nix
index 0519902308a..89fee90364e 100644
--- a/pkgs/tools/security/gnupg/22.nix
+++ b/pkgs/tools/security/gnupg/22.nix
@@ -15,11 +15,11 @@ assert guiSupport -> pinentry != null;
 stdenv.mkDerivation rec {
   name = "gnupg-${version}";
 
-  version = "2.2.3";
+  version = "2.2.4";
 
   src = fetchurl {
     url = "mirror://gnupg/gnupg/${name}.tar.bz2";
-    sha256 = "1d4482c4pbi0p1k8cc0f9c4q51k56v8navrbz5samxrrs42p3lyb";
+    sha256 = "1v7j8v2ww1knknbrhw3svfrqkmf9ll58iq0dczbsdpqgg1j3w6j0";
   };
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/tools/security/thc-hydra/default.nix b/pkgs/tools/security/thc-hydra/default.nix
index e8eb3aacd3e..9a7a245b813 100644
--- a/pkgs/tools/security/thc-hydra/default.nix
+++ b/pkgs/tools/security/thc-hydra/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, zlib, openssl, ncurses, libidn, pcre, libssh, libmysql, postgresql
+{ stdenv, lib, fetchurl, zlib, openssl, ncurses, libidn, pcre, libssh, mysql, postgresql
 , withGUI ? false, makeWrapper, pkgconfig, gtk2 }:
 
 let
@@ -23,7 +23,7 @@ in stdenv.mkDerivation rec {
   '';
 
   nativeBuildInputs = lib.optionals withGUI [ pkgconfig makeWrapper ];
-  buildInputs = [ zlib openssl ncurses libidn pcre libssh libmysql postgresql ]
+  buildInputs = [ zlib openssl ncurses libidn pcre libssh mysql.connector-c postgresql ]
                 ++ lib.optional withGUI gtk2;
 
   postInstall = lib.optionalString withGUI ''
diff --git a/pkgs/tools/system/collectd/default.nix b/pkgs/tools/system/collectd/default.nix
index b1c5778ed4c..e9ce2913a6c 100644
--- a/pkgs/tools/system/collectd/default.nix
+++ b/pkgs/tools/system/collectd/default.nix
@@ -20,7 +20,7 @@
 , libtool ? null
 , lm_sensors ? null
 , lvm2 ? null
-, libmysql ? null
+, mysql ? null
 , postgresql ? null
 , protobufc ? null
 , python ? null
@@ -53,9 +53,10 @@ stdenv.mkDerivation rec {
   buildInputs = [
     curl libdbi libgcrypt libmemcached
     cyrus_sasl libnotify gdk_pixbuf liboping libpcap libvirt
-    libxml2 libmysql postgresql protobufc rrdtool
+    libxml2 postgresql protobufc rrdtool
     varnish yajl jdk libtool python hiredis libmicrohttpd
     riemann_c_client mosquitto rdkafka mongoc
+  ] ++ stdenv.lib.optionals (mysql != null) [ mysql.connector-c
   ] ++ stdenv.lib.optionals stdenv.isLinux [
     iptables libatasmart libcredis libmodbus libsigrok
     lm_sensors lvm2 rabbitmq-c udev net_snmp libmnl
diff --git a/pkgs/tools/system/rsyslog/default.nix b/pkgs/tools/system/rsyslog/default.nix
index e642b91c3d9..a6999942e0c 100644
--- a/pkgs/tools/system/rsyslog/default.nix
+++ b/pkgs/tools/system/rsyslog/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, pkgconfig, autoreconfHook, libestr, json_c, zlib, pythonPackages, fastJson
-, libkrb5 ? null, systemd ? null, jemalloc ? null, libmysql ? null, postgresql ? null
+, libkrb5 ? null, systemd ? null, jemalloc ? null, mysql ? null, postgresql ? null
 , libdbi ? null, net_snmp ? null, libuuid ? null, curl ? null, gnutls ? null
 , libgcrypt ? null, liblognorm ? null, openssl ? null, librelp ? null, libksi ? null
 , libgt ? null, liblogging ? null, libnet ? null, hadoop ? null, rdkafka ? null
@@ -22,11 +22,12 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [ pkgconfig autoreconfHook ];
   buildInputs = [
-    fastJson libestr json_c zlib pythonPackages.docutils libkrb5 jemalloc libmysql
+    fastJson libestr json_c zlib pythonPackages.docutils libkrb5 jemalloc 
     postgresql libdbi net_snmp libuuid curl gnutls libgcrypt liblognorm openssl
     librelp libgt libksi liblogging libnet hadoop rdkafka libmongo-client czmq
     rabbitmq-c hiredis
-  ] ++ stdenv.lib.optional stdenv.isLinux systemd;
+  ] ++ stdenv.lib.optional (mysql != null) mysql.connector-c
+    ++ stdenv.lib.optional stdenv.isLinux systemd;
 
   hardeningDisable = [ "format" ];
 
@@ -49,7 +50,7 @@ stdenv.mkDerivation rec {
     (mkFlag false                     "valgrind")
     (mkFlag false                     "diagtools")
     (mkFlag true                      "usertools")
-    (mkFlag (libmysql != null)        "mysql")
+    (mkFlag (mysql != null)           "mysql")
     (mkFlag (postgresql != null)      "pgsql")
     (mkFlag (libdbi != null)          "libdbi")
     (mkFlag (net_snmp != null)        "snmp")
diff --git a/pkgs/tools/text/diffutils/default.nix b/pkgs/tools/text/diffutils/default.nix
index cd64bd1566b..60628e2139c 100644
--- a/pkgs/tools/text/diffutils/default.nix
+++ b/pkgs/tools/text/diffutils/default.nix
@@ -17,7 +17,8 @@ stdenv.mkDerivation rec {
   configureFlags =
     # "pr" need not be on the PATH as a run-time dep, so we need to tell
     # configure where it is. Covers the cross and native case alike.
-    stdenv.lib.optional (coreutils != null) "PR_PROGRAM=${coreutils}/bin/pr";
+    stdenv.lib.optional (coreutils != null) "PR_PROGRAM=${coreutils}/bin/pr"
+    ++ stdenv.lib.optional (stdenv.buildPlatform != stdenv.hostPlatform) "gl_cv_func_getopt_gnu=yes";
 
   meta = {
     homepage = http://www.gnu.org/software/diffutils/diffutils.html;
diff --git a/pkgs/tools/text/gawk/default.nix b/pkgs/tools/text/gawk/default.nix
index 65d0a1e4c00..6783158ca77 100644
--- a/pkgs/tools/text/gawk/default.nix
+++ b/pkgs/tools/text/gawk/default.nix
@@ -41,6 +41,8 @@ stdenv.mkDerivation rec {
     (if interactive then "--with-readline=${readline.dev}" else "--without-readline")
   ];
 
+  makeFlags = "AR=${stdenv.cc.targetPrefix}ar";
+
   inherit doCheck;
 
   postInstall = ''
diff --git a/pkgs/tools/text/sgml/opensp/setup-hook.sh b/pkgs/tools/text/sgml/opensp/setup-hook.sh
index 52da517a8cb..753a3ea6428 100644
--- a/pkgs/tools/text/sgml/opensp/setup-hook.sh
+++ b/pkgs/tools/text/sgml/opensp/setup-hook.sh
@@ -18,5 +18,5 @@ if test -z "$sgmlHookDone"; then
     export ftp_proxy=http://nodtd.invalid/
 
     export SGML_CATALOG_FILES
-    envHooks+=(addSGMLCatalogs)
+    addEnvHooks "$targetOffset" addSGMLCatalogs
 fi
diff --git a/pkgs/tools/typesetting/tex/dblatex/default.nix b/pkgs/tools/typesetting/tex/dblatex/default.nix
index 7ffccde2c03..c4eaf4e1df4 100644
--- a/pkgs/tools/typesetting/tex/dblatex/default.nix
+++ b/pkgs/tools/typesetting/tex/dblatex/default.nix
@@ -21,11 +21,11 @@ assert enableAllFeatures ->
   ghostscript != null;
 
 stdenv.mkDerivation rec {
-  name = "dblatex-0.3.7";
+  name = "dblatex-0.3.10";
 
   src = fetchurl {
     url = "mirror://sourceforge/dblatex/${name}.tar.bz2";
-    sha256 = "0bkjgrn03dy5c7438s429wnv6z5ynxkr4pbhp2z49kynskgkzkjr";
+    sha256 = "1yicd861rqz78i2khl35j7nvc0ccv4jx4hzqrbhll17082vrdmkg";
   };
 
   buildInputs = [ python2 libxslt tex ]
diff --git a/pkgs/tools/typesetting/tex/tetex/setup-hook.sh b/pkgs/tools/typesetting/tex/tetex/setup-hook.sh
index 9c5424e881e..5faef7fe5df 100644
--- a/pkgs/tools/typesetting/tex/tetex/setup-hook.sh
+++ b/pkgs/tools/typesetting/tex/tetex/setup-hook.sh
@@ -4,4 +4,4 @@ addTeXMFPath () {
     fi
 }
 
-envHooks+=(addTeXMFPath)
+addEnvHooks "$targetOffset" addTeXMFPath
diff --git a/pkgs/tools/typesetting/tex/texlive/setup-hook.sh b/pkgs/tools/typesetting/tex/texlive/setup-hook.sh
index 9c5424e881e..5faef7fe5df 100644
--- a/pkgs/tools/typesetting/tex/texlive/setup-hook.sh
+++ b/pkgs/tools/typesetting/tex/texlive/setup-hook.sh
@@ -4,4 +4,4 @@ addTeXMFPath () {
     fi
 }
 
-envHooks+=(addTeXMFPath)
+addEnvHooks "$targetOffset" addTeXMFPath
diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix
index 6eb826c073f..2c249f73d6c 100644
--- a/pkgs/top-level/aliases.nix
+++ b/pkgs/top-level/aliases.nix
@@ -95,6 +95,7 @@ mapAliases (rec {
   libcap_pam = if stdenv.isLinux then libcap.pam else null; # added 2016-04-29
   libcap_progs = libcap.out; # added 2016-04-29
   libjson_rpc_cpp = libjson-rpc-cpp; # added 2017-02-28
+  libmysql = mysql.connector-c; # added # 2017-12-28, this was a misnomer refering to libmysqlclient
   libtidy = html-tidy;  # added 2014-12-21
   links = links2; # added 2016-01-31
   lttngTools = lttng-tools;  # added 2014-07-31
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 47834e94855..c19d9a8afc1 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -1256,7 +1256,7 @@ with pkgs;
     libkrb5 = null;
     systemd = null;
     jemalloc = null;
-    libmysql = null;
+    mysql = null;
     postgresql = null;
     libdbi = null;
     net_snmp = null;
@@ -1514,7 +1514,6 @@ with pkgs;
   convertlit = callPackage ../tools/text/convertlit { };
 
   collectd = callPackage ../tools/system/collectd {
-    libmysql = mysql.lib;
     libsigrok = libsigrok-0-3-0; # not compatible with >= 0.4.0 yet
   };
 
@@ -1553,7 +1552,7 @@ with pkgs;
   skk-dicts = callPackage ../tools/inputmethods/skk/skk-dicts { };
 
   ibus = callPackage ../tools/inputmethods/ibus {
-    inherit (gnome3) dconf glib;
+    inherit (gnome3) dconf gconf glib;
   };
 
   ibus-qt = callPackage ../tools/inputmethods/ibus/ibus-qt.nix { };
@@ -6500,6 +6499,7 @@ with pkgs;
     vala_0_28
     vala_0_32
     vala_0_34
+    vala_0_36
     vala_0_38
     vala;
 
@@ -8065,7 +8065,8 @@ with pkgs;
   boost163 = callPackage ../development/libraries/boost/1.63.nix { };
   boost164 = callPackage ../development/libraries/boost/1.64.nix { };
   boost165 = callPackage ../development/libraries/boost/1.65.nix { };
-  boost16x = boost165;
+  boost166 = callPackage ../development/libraries/boost/1.66.nix { };
+  boost16x = boost166;
   boost = boost16x;
 
   boost_process = callPackage ../development/libraries/boost-process { };
@@ -9216,12 +9217,12 @@ with pkgs;
   libdbi = callPackage ../development/libraries/libdbi { };
 
   libdbiDriversBase = callPackage ../development/libraries/libdbi-drivers {
-    libmysql = null;
+    mysql = null;
     sqlite = null;
   };
 
   libdbiDrivers = libdbiDriversBase.override {
-    inherit sqlite libmysql;
+    inherit sqlite mysql;
   };
 
   libdbusmenu-glib = callPackage ../development/libraries/libdbusmenu { };
@@ -11298,8 +11299,8 @@ with pkgs;
   x265 = callPackage ../development/libraries/x265 { };
 
   inherit (callPackages ../development/libraries/xapian { })
-    xapian_1_2_22 xapian_1_4_4;
-  xapian = xapian_1_4_4;
+    xapian_1_2_22 xapian_1_4;
+  xapian = xapian_1_4;
 
   xapian-omega = callPackage ../development/libraries/xapian/tools/omega {
     libmagic = file;
@@ -12038,7 +12039,6 @@ with pkgs;
   };
 
   mysql = mariadb;
-  libmysql = mysql.client; # `libmysql` is a slight misnomer ATM
 
   mysql_jdbc = callPackage ../servers/sql/mysql/jdbc { };
 
@@ -18135,8 +18135,6 @@ with pkgs;
 
   gemrb = callPackage ../games/gemrb { };
 
-  ghostOne = callPackage ../servers/games/ghost-one { };
-
   gl117 = callPackage ../games/gl-117 {};
 
   globulation2 = callPackage ../games/globulation {
diff --git a/pkgs/top-level/lua-packages.nix b/pkgs/top-level/lua-packages.nix
index c83e62fd89a..4c05f96caf7 100644
--- a/pkgs/top-level/lua-packages.nix
+++ b/pkgs/top-level/lua-packages.nix
@@ -8,7 +8,7 @@
 { fetchurl, fetchzip, stdenv, lua, callPackage, unzip, zziplib, pkgconfig, libtool
 , pcre, oniguruma, gnulib, tre, glibc, sqlite, openssl, expat, cairo
 , perl, gtk2, python, glib, gobjectIntrospection, libevent, zlib, autoreconfHook
-, libmysql, postgresql, cyrus_sasl
+, mysql, postgresql, cyrus_sasl
 , fetchFromGitHub, libmpack, which
 }:
 
@@ -210,7 +210,7 @@ let
     };
     sourceRoot = ".";
 
-    buildInputs = [ libmysql postgresql sqlite ];
+    buildInputs = [ mysql.connector-c postgresql sqlite ];
 
     preConfigure = ''
       substituteInPlace Makefile --replace CC=gcc CC=cc
@@ -220,7 +220,8 @@ let
     '';
 
     NIX_CFLAGS_COMPILE = [
-      "-I${libmysql.dev}/include/mysql"
+      "-I${mysql.connector-c}/include/mysql"
+      "-L${mysql.connector-c}/lib/mysql"
       "-I${postgresql}/include/server"
     ];
 
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index e723518b12a..f2f43163c8e 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -173,6 +173,8 @@ in {
 
   automat = callPackage ../development/python-modules/automat { };
 
+  aws-xray-sdk = callPackage ../development/python-modules/aws-xray-sdk { };
+
   # packages defined elsewhere
 
   backports_csv = callPackage ../development/python-modules/backports_csv {};
@@ -482,25 +484,6 @@ in {
     };
   };
 
-  amqp_1 = buildPythonPackage rec {
-    name = "amqp-${version}";
-    version = "1.4.9";
-    disabled = pythonOlder "2.6";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/a/amqp/${name}.tar.gz";
-      sha256 = "06n6q0kxhjnbfz3vn8x9yz09lwmn1xi9d6wxp31h5jbks0b4vsid";
-    };
-
-    buildInputs = with self; [ mock coverage nose-cover3 unittest2 ];
-
-    meta = {
-      homepage = https://github.com/celery/py-amqp;
-      description = "Python client for the Advanced Message Queuing Procotol (AMQP). This is a fork of amqplib which is maintained by the Celery project";
-      license = licenses.lgpl21;
-    };
-  };
-
   amqp = buildPythonPackage rec {
     name = "amqp-${version}";
     version = "2.1.4";
@@ -1020,44 +1003,9 @@ in {
     };
   };
 
-  backports_abc = buildPythonPackage rec {
-    name = "backports_abc-${version}";
-    version = "0.4";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/b/backports_abc/${name}.tar.gz";
-      sha256 = "8b3e4092ba3d541c7a2f9b7d0d9c0275b21c6a01c53a61c731eba6686939d0a5";
-    };
+  backports_abc = callPackage ../development/python-modules/backports_abc { };
 
-    checkPhase = ''
-      ${python.interpreter} -m unittest discover
-    '';
-
-    meta = {
-      homepage = https://github.com/cython/backports_abc;
-      license = licenses.psfl;
-      description = "A backport of recent additions to the 'collections.abc' module";
-    };
-  };
-
-  backports_functools_lru_cache = buildPythonPackage rec {
-    name = "backports.functools_lru_cache-${version}";
-    version = "1.3";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/b/backports_functools_lru_cache/${name}.tar.gz";
-      sha256 = "444a21bcec4ae177da554321f81a78dc879eaa8f6ea9920cb904830585d31e95";
-    };
-
-    buildInputs = with self; [ setuptools_scm ];
-    doCheck = false; # No proper test
-
-    meta = {
-      description = "Backport of functools.lru_cache";
-      homepage = https://github.com/jaraco/backports.functools_lru_cache;
-      license = licenses.mit;
-    };
-  };
+  backports_functools_lru_cache = callPackage ../development/python-modules/backports_functools_lru_cache { };
 
   backports_shutil_get_terminal_size = callPackage ../development/python-modules/backports_shutil_get_terminal_size { };
 
@@ -1090,23 +1038,7 @@ in {
     };
   };
 
-  backports_lzma = self.buildPythonPackage rec {
-    name = "backports.lzma-0.0.3";
-    disabled = isPy3k;
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/b/backports.lzma/${name}.tar.gz";
-      sha256 = "bac58aec8d39ac3d22250840fb24830d0e4a0ef05ad8f3f09172dc0cc80cdbca";
-    };
-
-    buildInputs = [ pkgs.lzma ];
-
-    meta = {
-      description = "Backport of Python 3.3's 'lzma' module for XZ/LZMA compressed files";
-      homepage = https://github.com/peterjc/backports.lzma;
-      license = licenses.bsd3;
-    };
-  };
+  backports_lzma = callPackage ../development/python-modules/backports_lzma { };
 
   backports_tempfile = callPackage ../development/python-modules/backports_tempfile { };
 
@@ -1307,33 +1239,7 @@ in {
     };
   };
 
-  biopython = buildPythonPackage rec {
-    name = "biopython-${version}";
-    version = "1.68";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/b/biopython/${name}.tar.gz";
-      sha256 = "07qc7nz0k77y8hf8s18rscvibvm91zw0kkq7ylrhisf8vp8hkp6i";
-    };
-
-    propagatedBuildInputs = with self; [ numpy ];
-    # Checks try to write to $HOME, which does not work with nix
-    doCheck = false;
-    meta = {
-      description = "Python library for bioinformatics";
-
-      longDescription = ''
-        Biopython is a set of freely available tools for biological computation
-        written in Python by an international team of developers. It is a
-        distributed collaborative effort to develop Python libraries and
-        applications which address the needs of current and future work in
-        bioinformatics.
-      '';
-
-      homepage = http://biopython.org/wiki/Documentation;
-      maintainers = with maintainers; [ luispedro ];
-    };
-  };
+  biopython = callPackage ../development/python-modules/biopython { };
 
   bedup = buildPythonPackage rec {
     version = "0.10.1";
@@ -1406,25 +1312,7 @@ in {
     propagatedBuildInputs = with self; [ boto crcmod psutil ];
   };
 
-  cached-property = buildPythonPackage rec {
-    version = "1.3.0";
-    name = "cached-property-${version}";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/c/cached-property/${name}.tar.gz";
-      sha256 = "10dwi3s6f154ag9dvqy5jiwp31fs57lbxjcjgn4cwvi8qyqpi3j5";
-    };
-
-    buildInputs = with self; [ freezegun ];
-
-    meta = {
-      description = "A decorator for caching properties in classes";
-      homepage = https://github.com/pydanny/cached-property;
-      license = licenses.bsd3;
-      platforms = platforms.unix;
-      maintainers = with maintainers; [ ericsagnes ];
-    };
-  };
+  cached-property = callPackage ../development/python-modules/cached-property { };
 
   caffe = pkgs.caffe.override {
     python = self.python;
@@ -1994,43 +1882,7 @@ in {
     };
   };
 
-  boto3 = buildPythonPackage rec {
-    name = "boto3-${version}";
-    version = "1.4.8";
-
-    src = pkgs.fetchFromGitHub {
-      owner = "boto";
-      repo  = "boto3";
-      rev   = version;
-      sha256 = "11ysd7a9l5y98q7b7az56phsj2m7w90abf4jabwrknp2c43sq9bi";
-    };
-
-    propagatedBuildInputs = [ self.botocore self.jmespath self.s3transfer ] ++
-                            (if isPy3k then [] else [self.futures]);
-    buildInputs = [ self.docutils self.nose self.mock ];
-    checkPhase = ''
-      runHook preCheck
-      # This method is not in mock. It might have appeared in some versions.
-      sed -i 's/action.assert_called_once()/self.assertEqual(action.call_count, 1)/' \
-        tests/unit/resources/test_factory.py
-      nosetests -d tests/unit --verbose
-      runHook postCheck
-    '';
-
-    # Network access
-    doCheck = false;
-
-    meta = {
-      homepage = https://github.com/boto/boto3;
-      license = stdenv.lib.licenses.asl20;
-      description = "AWS SDK for Python";
-      longDescription = ''
-        Boto3 is the Amazon Web Services (AWS) Software Development Kit (SDK) for
-        Python, which allows Python developers to write software that makes use of
-        services like Amazon S3 and Amazon EC2.
-      '';
-    };
-  };
+  boto3 = callPackage ../development/python-modules/boto3 { };
 
   botocore = callPackage ../development/python-modules/botocore { };
 
@@ -3125,22 +2977,7 @@ in {
   openidc-client = callPackage ../development/python-modules/openidc-client/default.nix {};
 
 
-  idna = buildPythonPackage rec {
-    pname = "idna";
-    version = "2.5";
-    name = "${pname}-${version}";
-
-    src = fetchPypi {
-      inherit pname version;
-      sha256 = "3cb5ce08046c4e3a560fc02f138d0ac63e00f8ce5901a56b32ec8b7994082aab";
-    };
-
-    meta = {
-      homepage = "http://github.com/kjd/idna/";
-      description = "Internationalized Domain Names in Applications (IDNA)";
-      license = "licenses.bsd3";
-    };
-  };
+  idna = callPackage ../development/python-modules/idna { };
 
   mahotas = buildPythonPackage rec {
     name = "python-mahotas-${version}";
@@ -3437,7 +3274,7 @@ in {
     };
   };
 
-  pytest = self.pytest_32;
+  pytest = self.pytest_33;
 
   pytest_27 = callPackage ../development/python-modules/pytest/2_7.nix {};
 
@@ -3452,7 +3289,16 @@ in {
       pytest = null;
     };
   };
-  pytest_32 = callPackage ../development/python-modules/pytest{
+
+  pytest_32 = callPackage ../development/python-modules/pytest/3_2.nix{
+    hypothesis = self.hypothesis.override {
+      # hypothesis requires pytest that causes dependency cycle
+      doCheck = false;
+      pytest = null;
+    };
+  };
+
+  pytest_33 = callPackage ../development/python-modules/pytest/default.nix{
     hypothesis = self.hypothesis.override {
       # hypothesis requires pytest that causes dependency cycle
       doCheck = false;
@@ -4256,21 +4102,7 @@ in {
     };
   };
 
-  decorator = buildPythonPackage rec {
-    name = "decorator-${version}";
-    version = "4.0.11";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/d/decorator/${name}.tar.gz";
-      sha256 = "953d6bf082b100f43229cf547f4f97f97e970f5ad645ee7601d55ff87afdfe76";
-    };
-
-    meta = {
-      homepage = https://pypi.python.org/pypi/decorator;
-      description = "Better living through Python with decorators";
-      license = licenses.mit;
-    };
-  };
+  decorator = callPackage ../development/python-modules/decorator { };
 
   deform = buildPythonPackage rec {
     name = "deform-2.0a2";
@@ -5710,25 +5542,7 @@ in {
     };
   };
 
-  jdcal = buildPythonPackage rec {
-    version = "1.0";
-    name = "jdcal-${version}";
-
-    src = pkgs.fetchFromGitHub {
-      owner = "phn";
-      repo = "jdcal";
-      rev = "v${version}";
-      sha256 = "0jjgrrylraqzk3n97hay4gj00ky6vlvkfaapfgqlbcxyq30j24vq";
-    };
-
-    meta = {
-      description = "A module containing functions for converting between Julian dates and calendar dates";
-      homepage = "https://github.com/phn/jdcal";
-      license = licenses.bsd2;
-      maintainers = with maintainers; [ lihop ];
-      platforms = platforms.all;
-    };
-  };
+  jdcal = callPackage ../development/python-modules/jdcal { };
 
   internetarchive = callPackage ../development/python-modules/internetarchive {};
 
@@ -5740,6 +5554,8 @@ in {
 
   jsonpatch = callPackage ../development/python-modules/jsonpatch { };
 
+  jsonpickle = callPackage ../development/python-modules/jsonpickle { };
+
   jsonpointer = buildPythonPackage rec {
     name = "jsonpointer-1.9";
 
@@ -6845,37 +6661,7 @@ in {
 
   pysrt = callPackage ../development/python-modules/pysrt { };
 
-  pytools = buildPythonPackage rec {
-    name = "pytools-${version}";
-    version = "2017.4";
-
-    src = pkgs.fetchFromGitHub {
-      owner = "inducer";
-      repo = "pytools";
-      rev = "8078e74265bb5a3c9676c698595ab5450cd2bfe7";
-      sha256 = "17q61l79fcxkj5jxg3fnymi652sdjp5s6kpsabgxp22kma9crr28";
-    };
-
-    buildInputs = with self; [
-      decorator
-      appdirs
-      six
-      numpy
-      pytest
-    ];
-
-    checkPhase = ''
-      py.test -k 'not test_persistent_dict'
-    '';
-
-    meta = {
-      homepage = https://github.com/inducer/pytools/;
-      description = "Miscellaneous Python lifesavers.";
-      license = licenses.mit;
-      maintainers = with maintainers; [ artuuge ];
-    };
-
-  };
+  pytools = callPackage ../development/python-modules/pytools { };
 
   pytun = buildPythonPackage rec {
     name = "pytun-${version}";
@@ -7029,21 +6815,7 @@ in {
 
   hyperlink = callPackage ../development/python-modules/hyperlink {};
 
-  zope_copy = buildPythonPackage rec {
-    name = "zope.copy-4.0.2";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/z/zope.copy/${name}.zip";
-      sha256 = "eb2a95866df1377741876a3ee62d8600e80089e6246e1a235e86791b29534457";
-    };
-
-    buildInputs = with self; [ zope_interface zope_location zope_schema ];
-
-    meta = {
-      maintainers = with maintainers; [ domenkozar ];
-    };
-  };
-
+  zope_copy = callPackage ../development/python-modules/zope_copy {};
 
   ssdeep = buildPythonPackage rec {
     name = "ssdeep-3.1.1";
@@ -7229,23 +7001,7 @@ in {
     };
   };
 
-  regex = buildPythonPackage rec {
-    name = "regex-${version}";
-    version = "2016.11.18";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/r/regex/${name}.tar.gz";
-      sha256 = "126ds2b355n3pgl7brshhscpxn14ycs0yznzl8k4akj4sps1i6c6";
-    };
-
-    meta = {
-      description = "Alternative regular expression module, to replace re";
-      homepage = "https://bitbucket.org/mrabarnett/mrab-regex";
-      license = licenses.psfl;
-      platforms = platforms.linux;
-      maintainers = with maintainers; [ abbradar ];
-    };
-  };
+  regex = callPackage ../development/python-modules/regex { };
 
   repoze_lru = buildPythonPackage rec {
     name = "repoze.lru-0.6";
@@ -7261,8 +7017,6 @@ in {
     };
   };
 
-
-
   repoze_sphinx_autointerface = buildPythonPackage rec {
     name = "repoze.sphinx.autointerface-0.7.1";
 
@@ -9282,37 +9036,7 @@ in {
   };
 
 
-  html5lib = buildPythonPackage (rec {
-    version = "0.999999999";
-    name = "html5lib-${version}";
-
-    src = pkgs.fetchurl {
-      url = "http://github.com/html5lib/html5lib-python/archive/${version}.tar.gz";
-      sha256 = "09j6194f5mlnd5xwbavwvnndwl1x91jw74shxl6hcxjp4fxg3h05";
-    };
-
-    buildInputs = with self; [ flake8 pytest pytest-expect mock ];
-    propagatedBuildInputs = with self; [
-      six webencodings
-    ] ++ optionals isPy26 [ ordereddict ];
-
-    checkPhase = ''
-      py.test
-    '';
-
-    meta = {
-      homepage = https://github.com/html5lib/html5lib-python;
-      downloadPage = https://github.com/html5lib/html5lib-python/releases;
-      description = "HTML parser based on WHAT-WG HTML5 specification";
-      longDescription = ''
-        html5lib is a pure-python library for parsing HTML. It is designed to
-        conform to the WHATWG HTML specification, as is implemented by all
-        major web browsers.
-      '';
-      license = licenses.mit;
-      maintainers = with maintainers; [ domenkozar prikhi ];
-    };
-  });
+  html5lib = callPackage ../development/python-modules/html5lib { };
 
   http_signature = buildPythonPackage (rec {
     name = "http_signature-0.1.4";
@@ -9751,26 +9475,7 @@ in {
 
   iso3166 = callPackage ../development/python-modules/iso3166 {};
 
-  iso8601 = buildPythonPackage rec {
-    name = "iso8601-${version}";
-    version = "0.1.11";
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/i/iso8601/${name}.tar.gz";
-      sha256 = "e8fb52f78880ae063336c94eb5b87b181e6a0cc33a6c008511bac9a6e980ef30";
-    };
-
-    buildInputs = [ self.pytest ];
-
-    checkPhase = ''
-      py.test iso8601
-    '';
-
-    meta = {
-      homepage = https://bitbucket.org/micktwomey/pyiso8601/;
-      description = "Simple module to parse ISO 8601 dates";
-      maintainers = with maintainers; [ phreedom ];
-    };
-  };
+  iso8601 = callPackage ../development/python-modules/iso8601 { };
 
   isort = buildPythonPackage rec {
     name = "${pname}-${version}";
@@ -9795,23 +9500,7 @@ in {
 
   jedi = callPackage ../development/python-modules/jedi { };
 
-  jellyfish = buildPythonPackage rec {
-    version = "0.5.2";
-    name = "jellyfish-${version}";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/j/jellyfish/${name}.tar.gz";
-      sha256 = "15xk0kbr1gig9r1mp22lk9mk3jyi886h8ywn9diixhnyl4q6dacn";
-    };
-
-    buildInputs = with self; [ pytest unicodecsv ];
-
-    meta = {
-      homepage = https://github.com/sunlightlabs/jellyfish;
-      description = "Approximate and phonetic matching of strings";
-      maintainers = with maintainers; [ koral ];
-    };
-  };
+  jellyfish = callPackage ../development/python-modules/jellyfish { };
 
   j2cli = buildPythonPackage rec {
     name = "j2cli-${version}";
@@ -9885,6 +9574,8 @@ in {
 
   jsondate = callPackage ../development/python-modules/jsondate { };
 
+  jsondiff = callPackage ../development/python-modules/jsondiff { };
+
   jsonnet = buildPythonPackage {
     inherit (pkgs.jsonnet) name src;
   };
@@ -9981,33 +9672,6 @@ in {
 
   koji = callPackage ../development/python-modules/koji { };
 
-  kombu_3 = buildPythonPackage rec {
-    name = "kombu-${version}";
-    version = "3.0.35";
-
-    disabled = pythonOlder "2.6";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/k/kombu/${name}.tar.gz";
-      sha256 = "09xpxpjz9nk8d14dj361dqdwyjwda3jlf1a7v6jif9wn2xm37ar2";
-    };
-
-    # most of these are simply to allow the test suite to do its job
-    buildInputs = with self; optionals isPy27 [ mock unittest2 nose redis qpid-python pymongo sqlalchemy pyyaml msgpack boto ];
-
-    propagatedBuildInputs = with self; [ amqp_1 anyjson ] ++
-      (optionals (pythonOlder "2.7") [ importlib ordereddict ]);
-
-    # tests broken on python 2.6? https://github.com/nose-devs/nose/issues/806
-    doCheck = isPy27;
-
-    meta = {
-      description = "Messaging library for Python";
-      homepage    = "http://github.com/celery/kombu";
-      license     = licenses.bsd3;
-    };
-  };
-
   kombu = buildPythonPackage rec {
     name = "kombu-${version}";
     version = "4.0.2";
@@ -10294,7 +9958,7 @@ in {
 
   locustio = callPackage ../development/python-modules/locustio { };
 
-  llvmlite = callPackage ../development/python-modules/llvmlite {llvm=pkgs.llvm_4;};
+  llvmlite = callPackage ../development/python-modules/llvmlite {llvm=pkgs.llvm_5;};
 
   lockfile = buildPythonPackage rec {
     pname = "lockfile";
@@ -10324,25 +9988,7 @@ in {
 
   logilab-constraint = callPackage ../development/python-modules/logilab/constraint.nix {};
 
-  lxml = buildPythonPackage ( rec {
-    name = "lxml-3.8.0";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/l/lxml/${name}.tar.gz";
-      sha256 = "15nvf6n285n282682qyw3wihsncb0x5amdhyi4b83bfa2nz74vvk";
-    };
-
-    buildInputs = with self; [ pkgs.libxml2 pkgs.libxslt ];
-
-    hardeningDisable = stdenv.lib.optional stdenv.isDarwin "format";
-
-    meta = {
-      description = "Pythonic binding for the libxml2 and libxslt libraries";
-      homepage = http://lxml.de;
-      license = licenses.bsd3;
-      maintainers = with maintainers; [ sjourdois ];
-    };
-  });
+  lxml = callPackage ../development/python-modules/lxml {inherit (pkgs) libxml2 libxslt;};
 
   lxc = buildPythonPackage (rec {
     name = "python-lxc-unstable-2016-08-25";
@@ -10439,28 +10085,7 @@ in {
     };
   };
 
-
-  Mako = buildPythonPackage rec {
-    name = "Mako-1.0.4";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/M/Mako/${name}.tar.gz";
-      sha256 = "0nchpw6akfcsg8w6irjlx0gyzadc123hv4g47sijgnqd9nz9vngy";
-    };
-
-    buildInputs = with self; [ markupsafe nose mock pytest ];
-    propagatedBuildInputs = with self; [ markupsafe ];
-
-    doCheck = !isPyPy;  # https://bitbucket.org/zzzeek/mako/issue/238/2-tests-failed-on-pypy-24-25
-
-    meta = {
-      description = "Super-fast templating language";
-      homepage = http://www.makotemplates.org;
-      license = licenses.mit;
-      platforms = platforms.unix;
-      maintainers = with maintainers; [ domenkozar ];
-    };
-  };
+  Mako = callPackage ../development/python-modules/Mako { };
 
   manifestparser = callPackage ../development/python-modules/marionette-harness/manifestparser.nix {};
   marionette_driver = callPackage ../development/python-modules/marionette-harness/marionette_driver.nix {};
@@ -10517,22 +10142,7 @@ in {
     };
   };
 
-  markdown = buildPythonPackage rec {
-    version = "2.6.8";
-    name = "markdown-${version}";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/M/Markdown/Markdown-${version}.tar.gz";
-      sha256 = "0cqfhr1km2s5d8jm6hbwgkrrj9hvkjf2gab3s2axlrw1clgaij0a";
-    };
-
-    # error: invalid command 'test'
-    doCheck = false;
-
-    meta = {
-      homepage = http://www.freewisdom.org/projects/python-markdown;
-    };
-  };
+  markdown = callPackage ../development/python-modules/markdown { };
 
   markdownsuperscript = callPackage ../development/python-modules/markdownsuperscript {};
 
@@ -10890,23 +10500,7 @@ in {
 
   mistune = callPackage ../development/python-modules/mistune { };
 
-  brotlipy = buildPythonPackage rec {
-    name = "brotlipy-${version}";
-    version = "0.6.0";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/b/brotlipy/${name}.tar.gz";
-      sha256 = "10s2y19zywfkf3sksrw81czhva759aki0clld2pnnlgf64sz7016";
-    };
-
-    propagatedBuildInputs = with self; [ cffi enum34 construct ];
-
-    meta = {
-      description = "Python bindings for the reference Brotli encoder/decoder";
-      homepage = "https://github.com/python-hyper/brotlipy/";
-      license = licenses.mit;
-    };
-  };
+  brotlipy = callPackage ../development/python-modules/brotlipy { };
 
   sortedcontainers = buildPythonPackage rec {
     name = "sortedcontainers-${version}";
@@ -11545,9 +11139,9 @@ in {
       sha256 = "0x0c2jg0bb3pp84njaqiic050qkyd7ymwhfvhipnimg58yv40441";
     };
 
-    buildInputs = with self; [ nose pkgs.openssl ];
+    buildInputs = with self; [ nose ];
 
-    propagatedBuildInputs = with self; [ pkgs.mysql.lib pkgs.zlib ];
+    propagatedBuildInputs = with self; [ pkgs.mysql.connector-c ];
 
     meta = {
       description = "MySQL database binding for Python";
@@ -12446,6 +12040,8 @@ in {
     };
   };
 
+  plone-testing = callPackage ../development/python-modules/plone-testing { };
+
   ply = buildPythonPackage (rec {
     name = "ply-3.8";
 
@@ -13043,30 +12639,7 @@ in {
 
   parso = callPackage ../development/python-modules/parso { };
 
-  partd = buildPythonPackage rec {
-    name = "partd-${version}";
-    version = "0.3.7";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/p/partd/${name}.tar.gz";
-      sha256 = "066d254d2dh9xcanffgkjgwxpz5v0059b063bij10fvzl2y49hzx";
-    };
-
-    buildInputs = with self; [ pytest ];
-
-    propagatedBuildInputs = with self; [ locket numpy pandas pyzmq toolz ];
-
-    checkPhase = ''
-      rm partd/tests/test_zmq.py # requires network & fails
-      py.test
-    '';
-
-    meta = {
-      description = "Appendable key-value storage";
-      license = with licenses; [ bsd3 ];
-      homepage = https://github.com/dask/partd/;
-    };
-  };
+  partd = callPackage ../development/python-modules/partd { };
 
   patch = buildPythonPackage rec {
     name = "${pname}-${version}";
@@ -15675,23 +15248,7 @@ in {
 
   pyxattr = callPackage ../development/python-modules/pyxattr { };
 
-  pyaml = buildPythonPackage (rec {
-    name = "pyaml-15.02.1";
-    disabled = !isPy27;
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/p/pyaml/${name}.tar.gz";
-      sha256 = "8dfe1b295116115695752acc84d15ecf5c1c469975fbed7672bf41a6bc6d6d51";
-    };
-
-    buildInputs = with self; [ pyyaml ];
-
-    meta = {
-      description = "PyYAML-based module to produce pretty and readable YAML-serialized data";
-      homepage = https://github.com/mk-fg/pretty-yaml;
-    };
-  });
-
+  pyaml = callPackage ../development/python-modules/pyaml { };
 
   pyyaml = buildPythonPackage (rec {
     name = "PyYAML-3.12";
@@ -17759,6 +17316,8 @@ in {
     };
   });
 
+  splinter = callPackage ../development/python-modules/splinter { };
+
   spotipy = callPackage ../development/python-modules/spotipy { };
 
   Pweave = buildPythonPackage (rec {
@@ -17991,28 +17550,7 @@ in {
     };
   };
 
-  structlog = buildPythonPackage rec {
-    name = "structlog-16.1.0";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/s/structlog/${name}.tar.gz";
-      sha256 = "00dywyg3bqlkrmbrfrql21hpjjjkc4zjd6xxjyxyd15brfnzlkdl";
-    };
-
-    buildInputs = with self; [ pytest pretend freezegun ];
-    propagatedBuildInputs = with self; [ simplejson ];
-
-    checkPhase = ''
-      rm tests/test_twisted.py*
-      py.test
-    '';
-
-    meta = {
-      description = "Painless structural logging";
-      homepage = http://www.structlog.org/;
-      license = licenses.asl20;
-    };
-  };
+  structlog = callPackage ../development/python-modules/structlog { };
 
   svgwrite = buildPythonPackage rec {
     name = "svgwrite-${version}";
@@ -18296,39 +17834,9 @@ in {
   };
 
 
-  extras = buildPythonPackage rec {
-    name = "extras-${version}";
-    version = "0.0.3";
+  extras = callPackage ../development/python-modules/extras { };
 
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/e/extras/extras-${version}.tar.gz";
-      sha256 = "1h7zx4dfyclalg0fqnfjijpn0f793a9mx8sy3b27gd31nr6dhq3s";
-    };
-
-    # error: invalid command 'test'
-    doCheck = false;
-
-    meta = {
-      description = "A module provides basic functions for parsing mime-type names and matching them against a list of media-ranges";
-      homepage = https://code.google.com/p/mimeparse/;
-      license = licenses.mit;
-    };
-  };
-
-  texttable = self.buildPythonPackage rec {
-    name = "texttable-0.8.4";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/t/texttable/${name}.tar.gz";
-      sha256 = "0bkhs4dx9s6g7fpb969hygq56hyz4ncfamlynw72s0n6nqfbd1w5";
-    };
-
-    meta = {
-      description = "A module to generate a formatted text table, using ASCII characters";
-      homepage = http://foutaise.org/code/;
-      license = licenses.lgpl2;
-    };
-  };
+  texttable = callPackage ../development/python-modules/texttable { };
 
   tiros = callPackage ../development/python-modules/tiros { };
 
@@ -18411,19 +17919,7 @@ in {
 
   toolz = callPackage ../development/python-modules/toolz { };
 
-  tox = buildPythonPackage rec {
-    name = "tox-${version}";
-    version = "2.4.1";
-
-    propagatedBuildInputs = with self; [ py virtualenv pluggy ];
-
-    doCheck = false;
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/t/tox/${name}.tar.gz";
-      sha256 = "1nwn4jz8ns53n17bm1xkzlz4zyyxbgjwrcg2cjsn25ab7hd5fwv6";
-    };
-  };
+  tox = callPackage ../development/python-modules/tox { };
 
   tqdm = callPackage ../development/python-modules/tqdm { };
 
@@ -21385,31 +20881,7 @@ EOF
     };
   };
 
-  networkx = buildPythonPackage rec {
-    version = "1.11";
-    name = "networkx-${version}";
-
-    # Currently broken on PyPy.
-    # https://github.com/networkx/networkx/pull/1361
-    disabled = isPyPy;
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/n/networkx/${name}.tar.gz";
-      sha256 = "1f74s56xb4ggixiq0vxyfxsfk8p20c7a099lpcf60izv1php03hd";
-    };
-
-    buildInputs = with self; [ nose ];
-    propagatedBuildInputs = with self; [ decorator ];
-
-    # 17 failures with 3.6 https://github.com/networkx/networkx/issues/2396#issuecomment-304437299
-    doCheck = !(isPy36);
-
-    meta = {
-      homepage = "https://networkx.github.io/";
-      description = "Library for the creation, manipulation, and study of the structure, dynamics, and functions of complex networks";
-      license = licenses.bsd3;
-    };
-  };
+  networkx = callPackage ../development/python-modules/networkx { };
 
   ofxclient = callPackage ../development/python-modules/ofxclient {};
 
@@ -21886,22 +21358,7 @@ EOF
     };
   };
 
-  pluggy = buildPythonPackage rec {
-    name = "pluggy-${version}";
-    version = "0.3.1";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/p/pluggy/${name}.tar.gz";
-      sha256 = "18qfzfm40bgx672lkg8q9x5hdh76n7vax99aank7vh2nw21wg70m";
-    };
-
-    meta = {
-      description = "Plugin and hook calling mechanisms for Python";
-      homepage = "https://pypi.python.org/pypi/pluggy";
-      license = licenses.mit;
-      maintainers = with maintainers; [ jgeerds ];
-    };
-  };
+  pluggy = callPackage ../development/python-modules/pluggy {};
 
   xcffib = buildPythonPackage rec {
     version = "0.3.2";
diff --git a/pkgs/top-level/splice.nix b/pkgs/top-level/splice.nix
index ea81b110080..1fde08d1d48 100644
--- a/pkgs/top-level/splice.nix
+++ b/pkgs/top-level/splice.nix
@@ -24,25 +24,52 @@
 lib: pkgs: actuallySplice:
 
 let
-  defaultBuildScope = pkgs.buildPackages // pkgs.buildPackages.xorg;
+  defaultBuildBuildScope = pkgs.buildPackages.buildPackages // pkgs.buildPackages.buildPackages.xorg;
+  defaultBuildHostScope = pkgs.buildPackages // pkgs.buildPackages.xorg;
+  defaultBuildTargetScope =
+    if pkgs.targetPlatform == pkgs.hostPlatform
+    then defaultBuildHostScope
+    else assert pkgs.hostPlatform == pkgs.buildPlatform; defaultHostTargetScope;
+  defaultHostHostScope = {}; # unimplemented
   # TODO(@Ericson2314): we shouldn't preclude run-time fetching by removing
   # these attributes. We should have a more general solution for selecting
   # whether `nativeDrv` or `crossDrv` is the default in `defaultScope`.
   pkgsWithoutFetchers = lib.filterAttrs (n: _: !lib.hasPrefix "fetch" n) pkgs;
-  defaultRunScope = pkgsWithoutFetchers // pkgs.xorg;
+  targetPkgsWithoutFetchers = lib.filterAttrs (n: _: !lib.hasPrefix "fetch" n) pkgs.targetPackages;
+  defaultHostTargetScope = pkgsWithoutFetchers // pkgs.xorg;
+  defaultTargetTargetScope = targetPkgsWithoutFetchers // targetPkgsWithoutFetchers.xorg or {};
 
-  splicer = buildPkgs: runPkgs: let
-    mash = buildPkgs // runPkgs;
+  splicer = pkgsBuildBuild: pkgsBuildHost: pkgsBuildTarget:
+            pkgsHostHost: pkgsHostTarget:
+            pkgsTargetTarget: let
+    mash =
+      # Other pkgs sets
+      pkgsBuildBuild // pkgsBuildTarget // pkgsHostHost // pkgsTargetTarget
+      # The same pkgs sets one probably intends
+      // pkgsBuildHost // pkgsHostTarget;
     merge = name: {
       inherit name;
       value = let
         defaultValue = mash.${name};
         # `or {}` is for the non-derivation attsert splicing case, where `{}` is the identity.
-        buildValue = buildPkgs.${name} or {};
-        runValue = runPkgs.${name} or {};
+        valueBuildBuild = pkgsBuildBuild.${name} or {};
+        valueBuildHost = pkgsBuildHost.${name} or {};
+        valueBuildTarget = pkgsBuildTarget.${name} or {};
+        valueHostHost = throw "`valueHostHost` unimplemented: pass manually rather than relying on splicer.";
+        valueHostTarget = pkgsHostTarget.${name} or {};
+        valueTargetTarget = pkgsTargetTarget.${name} or {};
         augmentedValue = defaultValue
-          // (lib.optionalAttrs (buildPkgs ? ${name}) { nativeDrv = buildValue; })
-          // (lib.optionalAttrs (runPkgs ? ${name}) { crossDrv = runValue; });
+          # TODO(@Ericson2314): Stop using old names after transition period
+          // (lib.optionalAttrs (pkgsBuildHost ? ${name}) { nativeDrv = valueBuildHost; })
+          // (lib.optionalAttrs (pkgsHostTarget ? ${name}) { crossDrv = valueHostTarget; })
+          // {
+            __spliced =
+                 (lib.optionalAttrs (pkgsBuildBuild ? ${name}) { buildBuild = valueBuildBuild; })
+              // (lib.optionalAttrs (pkgsBuildTarget ? ${name}) { buildTarget = valueBuildTarget; })
+              // { hostHost = valueHostHost; }
+              // (lib.optionalAttrs (pkgsTargetTarget ? ${name}) { targetTarget = valueTargetTarget;
+          });
+        };
         # Get the set of outputs of a derivation. If one derivation fails to
         # evaluate we don't want to diverge the entire splice, so we fall back
         # on {}
@@ -55,10 +82,15 @@ let
       in
         # The derivation along with its outputs, which we recur
         # on to splice them together.
-        if lib.isDerivation defaultValue then augmentedValue
-          // splicer (tryGetOutputs buildValue) (getOutputs runValue)
+        if lib.isDerivation defaultValue then augmentedValue // splicer
+          (tryGetOutputs valueBuildBuild) (tryGetOutputs valueBuildHost) (tryGetOutputs valueBuildTarget)
+          (tryGetOutputs valueHostHost) (getOutputs valueHostTarget)
+          (tryGetOutputs valueTargetTarget)
         # Just recur on plain attrsets
-        else if lib.isAttrs defaultValue then splicer buildValue runValue
+        else if lib.isAttrs defaultValue then splicer
+          valueBuildBuild valueBuildHost valueBuildTarget
+          {} valueHostTarget
+          valueTargetTarget
         # Don't be fancy about non-derivations. But we could have used used
         # `__functor__` for functions instead.
         else defaultValue;
@@ -67,11 +99,16 @@ let
 
   splicedPackages =
     if actuallySplice
-    then splicer defaultBuildScope defaultRunScope // {
-      # These should never be spliced under any circumstances
-      inherit (pkgs) pkgs buildPackages targetPackages
-        buildPlatform targetPlatform hostPlatform;
-    }
+    then
+      splicer
+        defaultBuildBuildScope defaultBuildHostScope defaultBuildTargetScope
+        defaultHostHostScope defaultHostTargetScope
+        defaultTargetTargetScope
+      // {
+        # These should never be spliced under any circumstances
+        inherit (pkgs) pkgs buildPackages targetPackages
+          buildPlatform targetPlatform hostPlatform;
+      }
     else pkgs // pkgs.xorg;
 
 in