summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/languages-frameworks/qt.xml68
-rw-r--r--nixos/doc/manual/configuration/x-windows.xml7
-rw-r--r--nixos/modules/programs/gnupg.nix83
-rw-r--r--nixos/modules/security/wrappers/default.nix4
-rw-r--r--nixos/modules/services/continuous-integration/jenkins/default.nix11
-rw-r--r--nixos/modules/services/networking/bind.nix17
-rw-r--r--nixos/modules/services/networking/nsd.nix1
-rw-r--r--nixos/modules/services/x11/desktop-managers/plasma5.nix34
-rw-r--r--nixos/modules/services/x11/display-managers/sddm.nix28
-rw-r--r--nixos/modules/tasks/network-interfaces.nix4
-rw-r--r--pkgs/applications/altcoins/bitcoin-classic.nix10
-rw-r--r--pkgs/applications/altcoins/freicoin.nix6
-rw-r--r--pkgs/applications/altcoins/memorycoin.nix8
-rw-r--r--pkgs/applications/altcoins/primecoin.nix8
-rw-r--r--pkgs/applications/audio/ardour/default.nix6
-rw-r--r--pkgs/applications/audio/artyFX/default.nix15
-rw-r--r--pkgs/applications/audio/audacious/qt-5.nix18
-rw-r--r--pkgs/applications/audio/cantata/default.nix8
-rw-r--r--pkgs/applications/audio/dfasma/default.nix10
-rw-r--r--pkgs/applications/audio/eq10q/default.nix4
-rw-r--r--pkgs/applications/audio/fmit/default.nix4
-rw-r--r--pkgs/applications/audio/iannix/default.nix5
-rw-r--r--pkgs/applications/audio/jalv/default.nix4
-rw-r--r--pkgs/applications/audio/keyfinder/default.nix5
-rw-r--r--pkgs/applications/audio/lv2bm/default.nix8
-rw-r--r--pkgs/applications/audio/magnetophonDSP/faustCompressors/default.nix7
-rw-r--r--pkgs/applications/audio/qjackctl/default.nix4
-rw-r--r--pkgs/applications/audio/qmidinet/default.nix4
-rw-r--r--pkgs/applications/audio/sonic-visualiser/default.nix10
-rw-r--r--pkgs/applications/audio/sorcer/default.nix12
-rw-r--r--pkgs/applications/audio/x42-plugins/default.nix4
-rw-r--r--pkgs/applications/audio/zynaddsubfx/default.nix10
-rw-r--r--pkgs/applications/display-managers/sddm/default.nix159
-rw-r--r--pkgs/applications/display-managers/sddm/sddm-ignore-config-mtime.patch (renamed from pkgs/applications/display-managers/sddm/0001-ignore-config-mtime.patch)0
-rw-r--r--pkgs/applications/display-managers/sddm/series1
-rw-r--r--pkgs/applications/editors/atom/default.nix6
-rw-r--r--pkgs/applications/editors/kdevelop5/kdevelop.nix22
-rw-r--r--pkgs/applications/editors/kdevelop5/kdevplatform.nix7
-rw-r--r--pkgs/applications/editors/kile/default.nix79
-rw-r--r--pkgs/applications/editors/neovim/qt.nix8
-rw-r--r--pkgs/applications/editors/rstudio/default.nix5
-rw-r--r--pkgs/applications/editors/tiled/default.nix4
-rw-r--r--pkgs/applications/graphics/ImageMagick/7.0.nix4
-rw-r--r--pkgs/applications/graphics/ImageMagick/default.nix4
-rw-r--r--pkgs/applications/graphics/awesomebump/default.nix5
-rw-r--r--pkgs/applications/graphics/digikam/default.nix57
-rw-r--r--pkgs/applications/graphics/feh/default.nix17
-rw-r--r--pkgs/applications/graphics/ipe/default.nix9
-rw-r--r--pkgs/applications/graphics/krita/default.nix16
-rw-r--r--pkgs/applications/graphics/photoqt/default.nix9
-rw-r--r--pkgs/applications/graphics/phototonic/default.nix4
-rw-r--r--pkgs/applications/graphics/rapcad/default.nix4
-rw-r--r--pkgs/applications/graphics/renderdoc/default.nix8
-rw-r--r--pkgs/applications/graphics/shotwell/default.nix10
-rw-r--r--pkgs/applications/kde/akonadi-contacts.nix12
-rw-r--r--pkgs/applications/kde/akonadi-mime.nix9
-rw-r--r--pkgs/applications/kde/akonadi.nix20
-rw-r--r--pkgs/applications/kde/akonadi/akonadi-paths.patch191
-rw-r--r--pkgs/applications/kde/akonadi/akonadi-timestamps.patch14
-rw-r--r--pkgs/applications/kde/akonadi/default.nix36
-rw-r--r--pkgs/applications/kde/akonadi/series2
-rw-r--r--pkgs/applications/kde/ark/default.nix60
-rw-r--r--pkgs/applications/kde/baloo-widgets.nix5
-rw-r--r--pkgs/applications/kde/build-support/application.nix9
-rw-r--r--pkgs/applications/kde/default.nix13
-rw-r--r--pkgs/applications/kde/dolphin-plugins.nix6
-rw-r--r--pkgs/applications/kde/dolphin.nix40
-rw-r--r--pkgs/applications/kde/ffmpegthumbs.nix4
-rw-r--r--pkgs/applications/kde/filelight.nix29
-rw-r--r--pkgs/applications/kde/gwenview.nix38
-rw-r--r--pkgs/applications/kde/k3b.nix66
-rw-r--r--pkgs/applications/kde/kate.nix39
-rw-r--r--pkgs/applications/kde/kcachegrind.nix29
-rw-r--r--pkgs/applications/kde/kcalc.nix30
-rw-r--r--pkgs/applications/kde/kcolorchooser.nix29
-rw-r--r--pkgs/applications/kde/kcontacts.nix12
-rw-r--r--pkgs/applications/kde/kde-locale-4.nix4
-rw-r--r--pkgs/applications/kde/kde-locale-5.nix4
-rw-r--r--pkgs/applications/kde/kdegraphics-mobipocket.nix4
-rw-r--r--pkgs/applications/kde/kdegraphics-thumbnailers.nix4
-rw-r--r--pkgs/applications/kde/kdelibs/default.nix4
-rw-r--r--pkgs/applications/kde/kdenetwork-filesharing.nix4
-rw-r--r--pkgs/applications/kde/kdenlive.nix38
-rw-r--r--pkgs/applications/kde/kdf.nix27
-rw-r--r--pkgs/applications/kde/kgpg.nix23
-rw-r--r--pkgs/applications/kde/khelpcenter.nix24
-rw-r--r--pkgs/applications/kde/kig.nix35
-rw-r--r--pkgs/applications/kde/kio-extras.nix4
-rw-r--r--pkgs/applications/kde/kmime.nix8
-rw-r--r--pkgs/applications/kde/kmix.nix39
-rw-r--r--pkgs/applications/kde/kolourpaint.nix31
-rw-r--r--pkgs/applications/kde/kompare.nix23
-rw-r--r--pkgs/applications/kde/konsole.nix35
-rw-r--r--pkgs/applications/kde/krfb.nix26
-rw-r--r--pkgs/applications/kde/kwalletmanager.nix34
-rw-r--r--pkgs/applications/kde/libkcddb.nix5
-rw-r--r--pkgs/applications/kde/libkdcraw.nix4
-rw-r--r--pkgs/applications/kde/libkexiv2.nix4
-rw-r--r--pkgs/applications/kde/libkipi.nix4
-rw-r--r--pkgs/applications/kde/libkomparediff2.nix4
-rw-r--r--pkgs/applications/kde/marble.nix30
-rw-r--r--pkgs/applications/kde/okteta.nix30
-rw-r--r--pkgs/applications/kde/okular.nix38
-rw-r--r--pkgs/applications/kde/print-manager.nix14
-rw-r--r--pkgs/applications/kde/spectacle.nix33
-rw-r--r--pkgs/applications/misc/albert/default.nix12
-rw-r--r--pkgs/applications/misc/calibre/default.nix4
-rw-r--r--pkgs/applications/misc/cool-retro-term/default.nix8
-rw-r--r--pkgs/applications/misc/cura/default.nix10
-rw-r--r--pkgs/applications/misc/golden-cheetah/default.nix10
-rw-r--r--pkgs/applications/misc/goldendict/default.nix9
-rw-r--r--pkgs/applications/misc/gpxsee/default.nix5
-rw-r--r--pkgs/applications/misc/hugo/default.nix6
-rw-r--r--pkgs/applications/misc/hugo/deps.nix8
-rw-r--r--pkgs/applications/misc/kdeconnect/default.nix10
-rw-r--r--pkgs/applications/misc/krename/default.nix45
-rw-r--r--pkgs/applications/misc/krusader/default.nix36
-rw-r--r--pkgs/applications/misc/latte-dock/default.nix45
-rw-r--r--pkgs/applications/misc/openbrf/default.nix6
-rw-r--r--pkgs/applications/misc/qsyncthingtray/default.nix12
-rw-r--r--pkgs/applications/misc/qtpass/default.nix8
-rw-r--r--pkgs/applications/misc/redis-desktop-manager/default.nix5
-rw-r--r--pkgs/applications/misc/tint2/default.nix7
-rw-r--r--pkgs/applications/misc/twmn/default.nix5
-rw-r--r--pkgs/applications/misc/udevil/default.nix7
-rw-r--r--pkgs/applications/misc/xca/default.nix17
-rw-r--r--pkgs/applications/misc/yakuake/default.nix49
-rw-r--r--pkgs/applications/networking/browsers/chromium/common.nix6
-rw-r--r--pkgs/applications/networking/browsers/chromium/default.nix25
-rw-r--r--pkgs/applications/networking/browsers/chromium/patches/fix_network_api_crash.patch77
-rw-r--r--pkgs/applications/networking/browsers/chromium/plugins.nix4
-rw-r--r--pkgs/applications/networking/browsers/firefox-bin/default.nix4
-rw-r--r--pkgs/applications/networking/browsers/firefox-bin/update.nix7
-rw-r--r--pkgs/applications/networking/browsers/google-chrome/default.nix19
-rw-r--r--pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/default.nix10
-rw-r--r--pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix6
-rw-r--r--pkgs/applications/networking/browsers/qutebrowser/default.nix9
-rw-r--r--pkgs/applications/networking/browsers/vivaldi/default.nix45
-rw-r--r--pkgs/applications/networking/dropbox/default.nix13
-rw-r--r--pkgs/applications/networking/feedreaders/rssguard/default.nix4
-rw-r--r--pkgs/applications/networking/instant-messengers/dino/default.nix6
-rw-r--r--pkgs/applications/networking/instant-messengers/qtox/default.nix13
-rw-r--r--pkgs/applications/networking/instant-messengers/quaternion/default.nix12
-rw-r--r--pkgs/applications/networking/instant-messengers/ricochet/default.nix7
-rw-r--r--pkgs/applications/networking/instant-messengers/telegram/cutegram/default.nix6
-rw-r--r--pkgs/applications/networking/instant-messengers/telegram/libqtelegram-aseman-edition/default.nix4
-rw-r--r--pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix11
-rw-r--r--pkgs/applications/networking/instant-messengers/telegram/telegram-qml/default.nix4
-rw-r--r--pkgs/applications/networking/instant-messengers/tensor/default.nix6
-rw-r--r--pkgs/applications/networking/irc/communi/default.nix7
-rw-r--r--pkgs/applications/networking/irc/konversation/default.nix92
-rw-r--r--pkgs/applications/networking/linssid/default.nix5
-rw-r--r--pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix3
-rw-r--r--pkgs/applications/networking/mailreaders/thunderbird-bin/release_sources.nix595
-rw-r--r--pkgs/applications/networking/mailreaders/thunderbird-bin/sources.nix595
-rw-r--r--pkgs/applications/networking/mailreaders/thunderbird/default.nix4
-rw-r--r--pkgs/applications/networking/mailreaders/trojita/default.nix18
-rw-r--r--pkgs/applications/networking/mumble/default.nix8
-rw-r--r--pkgs/applications/networking/newsreaders/quiterss/default.nix13
-rw-r--r--pkgs/applications/networking/p2p/eiskaltdcpp/default.nix1
-rw-r--r--pkgs/applications/networking/p2p/qbittorrent/default.nix6
-rw-r--r--pkgs/applications/networking/syncthing/inotify-deps.nix23
-rw-r--r--pkgs/applications/networking/syncthing/inotify.nix4
-rw-r--r--pkgs/applications/office/cb2bib/default.nix4
-rw-r--r--pkgs/applications/office/libreoffice/default.nix2
-rw-r--r--pkgs/applications/office/libreoffice/still.nix13
-rw-r--r--pkgs/applications/office/libreoffice/xdg-open.patch25
-rw-r--r--pkgs/applications/office/mendeley/default.nix5
-rw-r--r--pkgs/applications/office/mytetra/default.nix7
-rw-r--r--pkgs/applications/office/skrooge/default.nix16
-rw-r--r--pkgs/applications/office/zim/default.nix13
-rw-r--r--pkgs/applications/science/astronomy/stellarium/default.nix27
-rw-r--r--pkgs/applications/science/electronics/fritzing/default.nix10
-rw-r--r--pkgs/applications/science/logic/lean/default.nix4
-rw-r--r--pkgs/applications/science/math/speedcrunch/default.nix14
-rw-r--r--pkgs/applications/science/programming/fdr/default.nix2
-rw-r--r--pkgs/applications/science/robotics/qgroundcontrol/default.nix28
-rw-r--r--pkgs/applications/video/bomi/default.nix10
-rw-r--r--pkgs/applications/video/openshot-qt/default.nix2
-rw-r--r--pkgs/applications/video/qstopmotion/default.nix36
-rw-r--r--pkgs/applications/video/shotcut/default.nix12
-rw-r--r--pkgs/applications/video/smplayer/default.nix4
-rw-r--r--pkgs/applications/video/smtube/default.nix5
-rw-r--r--pkgs/applications/video/vokoscreen/default.nix5
-rw-r--r--pkgs/applications/virtualization/virt-manager/qt.nix18
-rw-r--r--pkgs/applications/virtualization/virtualbox/default.nix8
-rw-r--r--pkgs/build-support/kde/derivation.nix17
-rw-r--r--pkgs/build-support/kde/wrapper.nix68
-rw-r--r--pkgs/data/documentation/zeal/default.nix5
-rw-r--r--pkgs/desktops/lumina/default.nix4
-rw-r--r--pkgs/desktops/lxqt/default.nix2
-rw-r--r--pkgs/desktops/mate/atril/default.nix37
-rw-r--r--pkgs/desktops/mate/default.nix1
-rw-r--r--pkgs/desktops/plasma-5/bluedevil.nix7
-rw-r--r--pkgs/desktops/plasma-5/breeze-grub.nix5
-rw-r--r--pkgs/desktops/plasma-5/breeze-gtk.nix15
-rw-r--r--pkgs/desktops/plasma-5/breeze-plymouth/default.nix5
-rw-r--r--pkgs/desktops/plasma-5/breeze-qt4.nix5
-rw-r--r--pkgs/desktops/plasma-5/breeze-qt5.nix11
-rw-r--r--pkgs/desktops/plasma-5/build-support/package.nix27
-rw-r--r--pkgs/desktops/plasma-5/default.nix60
-rw-r--r--pkgs/desktops/plasma-5/kactivitymanagerd.nix13
-rw-r--r--pkgs/desktops/plasma-5/kde-cli-tools.nix12
-rw-r--r--pkgs/desktops/plasma-5/kde-gtk-config/default.nix23
-rw-r--r--pkgs/desktops/plasma-5/kdecoration.nix5
-rw-r--r--pkgs/desktops/plasma-5/kdeplasma-addons.nix23
-rw-r--r--pkgs/desktops/plasma-5/kgamma5.nix10
-rw-r--r--pkgs/desktops/plasma-5/khotkeys.nix18
-rw-r--r--pkgs/desktops/plasma-5/kinfocenter.nix6
-rw-r--r--pkgs/desktops/plasma-5/kmenuedit.nix6
-rw-r--r--pkgs/desktops/plasma-5/kscreen.nix16
-rw-r--r--pkgs/desktops/plasma-5/kscreenlocker.nix12
-rw-r--r--pkgs/desktops/plasma-5/ksshaskpass.nix10
-rw-r--r--pkgs/desktops/plasma-5/ksysguard.nix9
-rw-r--r--pkgs/desktops/plasma-5/kwallet-pam.nix13
-rw-r--r--pkgs/desktops/plasma-5/kwayland-integration.nix19
-rw-r--r--pkgs/desktops/plasma-5/kwin/default.nix56
-rw-r--r--pkgs/desktops/plasma-5/kwin/xwayland.patch2
-rw-r--r--pkgs/desktops/plasma-5/kwrited.nix10
-rw-r--r--pkgs/desktops/plasma-5/libkscreen/default.nix21
-rw-r--r--pkgs/desktops/plasma-5/libkscreen/libkscreen-backends-path.patch2
-rw-r--r--pkgs/desktops/plasma-5/libksysguard/default.nix7
-rw-r--r--pkgs/desktops/plasma-5/milou.nix20
-rw-r--r--pkgs/desktops/plasma-5/oxygen.nix27
-rw-r--r--pkgs/desktops/plasma-5/plasma-desktop/default.nix55
-rw-r--r--pkgs/desktops/plasma-5/plasma-desktop/hwclock-path.patch2
-rw-r--r--pkgs/desktops/plasma-5/plasma-integration.nix16
-rw-r--r--pkgs/desktops/plasma-5/plasma-nm/default.nix34
-rw-r--r--pkgs/desktops/plasma-5/plasma-pa.nix20
-rw-r--r--pkgs/desktops/plasma-5/plasma-workspace-wallpapers.nix11
-rw-r--r--pkgs/desktops/plasma-5/plasma-workspace/default.nix39
-rw-r--r--pkgs/desktops/plasma-5/polkit-kde-agent.nix4
-rw-r--r--pkgs/desktops/plasma-5/powerdevil.nix14
-rw-r--r--pkgs/desktops/plasma-5/startkde/default.nix75
-rwxr-xr-xpkgs/desktops/plasma-5/startkde/startkde.sh74
-rw-r--r--pkgs/desktops/plasma-5/systemsettings.nix9
-rw-r--r--pkgs/development/compilers/gerbil/default.nix6
-rw-r--r--pkgs/development/compilers/ghc/8.2.1.nix117
-rw-r--r--pkgs/development/compilers/ghc/head.nix3
-rw-r--r--pkgs/development/compilers/kotlin/default.nix4
-rw-r--r--pkgs/development/compilers/llvm/3.7/fix-llvm-config.patch13
-rw-r--r--pkgs/development/compilers/llvm/3.7/llvm.nix5
-rw-r--r--pkgs/development/compilers/rust/bootstrap.nix15
-rw-r--r--pkgs/development/compilers/rust/rustc.nix5
-rw-r--r--pkgs/development/haskell-modules/configuration-common.nix11
-rw-r--r--pkgs/development/haskell-modules/configuration-ghc-8.2.x.nix60
-rw-r--r--pkgs/development/haskell-modules/configuration-hackage2nix.yaml73
-rw-r--r--pkgs/development/haskell-modules/generic-builder.nix16
-rw-r--r--pkgs/development/haskell-modules/hackage-packages.nix3048
-rw-r--r--pkgs/development/interpreters/clojure/clooj.nix3
-rw-r--r--pkgs/development/libraries/accounts-qt/default.nix4
-rw-r--r--pkgs/development/libraries/accountsservice/default.nix9
-rw-r--r--pkgs/development/libraries/audio/lilv/default.nix4
-rw-r--r--pkgs/development/libraries/audio/ntk/default.nix6
-rw-r--r--pkgs/development/libraries/aws-sdk-cpp/default.nix6
-rw-r--r--pkgs/development/libraries/catch/default.nix8
-rw-r--r--pkgs/development/libraries/gpgme/default.nix19
-rw-r--r--pkgs/development/libraries/gpgme/gpgme_libsuffix.patch12
-rw-r--r--pkgs/development/libraries/gtk+/3.x.nix2
-rw-r--r--pkgs/development/libraries/kde-frameworks/attica.nix5
-rw-r--r--pkgs/development/libraries/kde-frameworks/baloo.nix17
-rw-r--r--pkgs/development/libraries/kde-frameworks/bluez-qt.nix9
-rw-r--r--pkgs/development/libraries/kde-frameworks/breeze-icons.nix7
-rw-r--r--pkgs/development/libraries/kde-frameworks/build-support/framework.nix24
-rw-r--r--pkgs/development/libraries/kde-frameworks/default.nix162
-rw-r--r--pkgs/development/libraries/kde-frameworks/extra-cmake-modules/default.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh27
-rw-r--r--pkgs/development/libraries/kde-frameworks/frameworkintegration.nix11
-rw-r--r--pkgs/development/libraries/kde-frameworks/kactivities-stats.nix12
-rw-r--r--pkgs/development/libraries/kde-frameworks/kactivities.nix15
-rw-r--r--pkgs/development/libraries/kde-frameworks/kapidox.nix7
-rw-r--r--pkgs/development/libraries/kde-frameworks/karchive.nix12
-rw-r--r--pkgs/development/libraries/kde-frameworks/kauth/default.nix16
-rw-r--r--pkgs/development/libraries/kde-frameworks/kbookmarks.nix14
-rw-r--r--pkgs/development/libraries/kde-frameworks/kcmutils/default.nix19
-rw-r--r--pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-debug-module-loader.patch13
-rw-r--r--pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-fix-plugin-path.patch13
-rw-r--r--pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-follow-symlinks.patch (renamed from pkgs/development/libraries/kde-frameworks/kcmutils/0001-qdiriterator-follow-symlinks.patch)22
-rw-r--r--pkgs/development/libraries/kde-frameworks/kcmutils/series3
-rw-r--r--pkgs/development/libraries/kde-frameworks/kcodecs.nix10
-rw-r--r--pkgs/development/libraries/kde-frameworks/kcompletion.nix15
-rw-r--r--pkgs/development/libraries/kde-frameworks/kconfig.nix9
-rw-r--r--pkgs/development/libraries/kde-frameworks/kconfigwidgets/default.nix17
-rw-r--r--pkgs/development/libraries/kde-frameworks/kcoreaddons.nix14
-rw-r--r--pkgs/development/libraries/kde-frameworks/kcrash.nix12
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdbusaddons.nix13
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdeclarative.nix11
-rw-r--r--pkgs/development/libraries/kde-frameworks/kded.nix13
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdelibs4support/default.nix36
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdesignerplugin.nix28
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdesu.nix12
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdnssd.nix16
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdoctools/default.nix22
-rw-r--r--pkgs/development/libraries/kde-frameworks/kemoticons.nix15
-rw-r--r--pkgs/development/libraries/kde-frameworks/kfilemetadata/default.nix15
-rw-r--r--pkgs/development/libraries/kde-frameworks/kglobalaccel.nix18
-rw-r--r--pkgs/development/libraries/kde-frameworks/kguiaddons.nix8
-rw-r--r--pkgs/development/libraries/kde-frameworks/khtml.nix21
-rw-r--r--pkgs/development/libraries/kde-frameworks/ki18n.nix6
-rw-r--r--pkgs/development/libraries/kde-frameworks/kiconthemes/default.nix15
-rw-r--r--pkgs/development/libraries/kde-frameworks/kidletime.nix13
-rw-r--r--pkgs/development/libraries/kde-frameworks/kimageformats.nix14
-rw-r--r--pkgs/development/libraries/kde-frameworks/kinit/default.nix25
-rw-r--r--pkgs/development/libraries/kde-frameworks/kio/default.nix26
-rw-r--r--pkgs/development/libraries/kde-frameworks/kio/kio-debug-module-loader.patch13
-rw-r--r--pkgs/development/libraries/kde-frameworks/kio/series1
-rw-r--r--pkgs/development/libraries/kde-frameworks/kitemmodels.nix11
-rw-r--r--pkgs/development/libraries/kde-frameworks/kitemviews.nix14
-rw-r--r--pkgs/development/libraries/kde-frameworks/kjobwidgets.nix13
-rw-r--r--pkgs/development/libraries/kde-frameworks/kjs.nix10
-rw-r--r--pkgs/development/libraries/kde-frameworks/kjsembed.nix13
-rw-r--r--pkgs/development/libraries/kde-frameworks/kmediaplayer.nix6
-rw-r--r--pkgs/development/libraries/kde-frameworks/knewstuff.nix18
-rw-r--r--pkgs/development/libraries/kde-frameworks/knotifications.nix6
-rw-r--r--pkgs/development/libraries/kde-frameworks/knotifyconfig.nix12
-rw-r--r--pkgs/development/libraries/kde-frameworks/kpackage/default.nix8
-rw-r--r--pkgs/development/libraries/kde-frameworks/kparts.nix17
-rw-r--r--pkgs/development/libraries/kde-frameworks/kpeople.nix12
-rw-r--r--pkgs/development/libraries/kde-frameworks/kplotting.nix7
-rw-r--r--pkgs/development/libraries/kde-frameworks/kpty.nix7
-rw-r--r--pkgs/development/libraries/kde-frameworks/kross.nix10
-rw-r--r--pkgs/development/libraries/kde-frameworks/krunner.nix15
-rw-r--r--pkgs/development/libraries/kde-frameworks/kservice/default.nix17
-rw-r--r--pkgs/development/libraries/kde-frameworks/ktexteditor.nix18
-rw-r--r--pkgs/development/libraries/kde-frameworks/ktextwidgets.nix16
-rw-r--r--pkgs/development/libraries/kde-frameworks/kunitconversion.nix7
-rw-r--r--pkgs/development/libraries/kde-frameworks/kwallet.nix16
-rw-r--r--pkgs/development/libraries/kde-frameworks/kwayland.nix9
-rw-r--r--pkgs/development/libraries/kde-frameworks/kwidgetsaddons.nix14
-rw-r--r--pkgs/development/libraries/kde-frameworks/kwindowsystem/default.nix12
-rw-r--r--pkgs/development/libraries/kde-frameworks/kwindowsystem/platform-plugins-path.patch2
-rw-r--r--pkgs/development/libraries/kde-frameworks/kxmlgui.nix17
-rw-r--r--pkgs/development/libraries/kde-frameworks/kxmlrpcclient.nix8
-rw-r--r--pkgs/development/libraries/kde-frameworks/modemmanager-qt.nix13
-rw-r--r--pkgs/development/libraries/kde-frameworks/networkmanager-qt.nix13
-rw-r--r--pkgs/development/libraries/kde-frameworks/oxygen-icons5.nix6
-rw-r--r--pkgs/development/libraries/kde-frameworks/plasma-framework.nix19
-rw-r--r--pkgs/development/libraries/kde-frameworks/prison.nix14
-rw-r--r--pkgs/development/libraries/kde-frameworks/solid.nix12
-rw-r--r--pkgs/development/libraries/kde-frameworks/sonnet.nix9
-rw-r--r--pkgs/development/libraries/kde-frameworks/syntax-highlighting.nix9
-rw-r--r--pkgs/development/libraries/kde-frameworks/threadweaver.nix11
-rw-r--r--pkgs/development/libraries/libcommuni/default.nix4
-rw-r--r--pkgs/development/libraries/libkeyfinder/default.nix5
-rw-r--r--pkgs/development/libraries/libqtav/default.nix14
-rw-r--r--pkgs/development/libraries/opencv/3.x.nix10
-rw-r--r--pkgs/development/libraries/qmltermwidget/default.nix6
-rw-r--r--pkgs/development/libraries/qscintilla/default.nix4
-rw-r--r--pkgs/development/libraries/qt-5/5.6/default.nix57
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtbase/default.nix22
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtbase/dlopen-resolv.patch14
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtbase/library-paths.patch (renamed from pkgs/development/libraries/qt-5/5.6/qtbase/nix-profiles-library-paths.patch)12
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtbase/series3
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtbase/tzdir.patch10
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtdeclarative/default.nix4
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtdeclarative/import-paths.patch20
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtdeclarative/nix-profiles-import-paths.patch20
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtdeclarative/series2
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtserialport/0001-dlopen-serialport-udev.patch6
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtserialport/default.nix14
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtserialport/qtserialport-dlopen-udev.patch22
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtserialport/series1
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtwebengine/default.nix7
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtwebkit/0003-dlopen-webkit-udev.patch6
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtwebkit/default.nix41
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtwebkit/qtwebkit-dlopen-gtk.patch64
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtwebkit/qtwebkit-dlopen-udev.patch0
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtwebkit/qtwebkit-icucore-darwin.patch (renamed from pkgs/development/libraries/qt-5/5.8/qtwebkit/0004-icucore-darwin.patch)4
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtwebkit/series3
-rw-r--r--pkgs/development/libraries/qt-5/5.8/default.nix59
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtbase/cmake-paths.patch4
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtbase/compose-search-path.patch2
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtbase/default.nix67
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtbase/library-paths.patch (renamed from pkgs/development/libraries/qt-5/5.8/qtbase/nix-profiles-library-paths.patch)12
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtbase/qgtk-env.patch36
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtbase/qpa-platform-plugin-path.patch43
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtbase/series4
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtconnectivity.nix4
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtdeclarative/default.nix16
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtdeclarative/import-paths.patch20
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtdeclarative/nix-profiles-import-paths.patch20
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtdeclarative/series2
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtdoc.nix1
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtlocation.nix5
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtmultimedia.nix5
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtquickcontrols2.nix4
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtsensors.nix5
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtserialport/0001-dlopen-serialport-udev.patch28
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtserialport/default.nix14
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtserialport/qtserialport-dlopen-udev.patch22
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtserialport/series1
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtsvg.nix4
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qttools/default.nix23
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtwayland.nix5
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtwebchannel.nix4
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtwebengine/default.nix3
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtwebkit/0001-dlopen-webkit-nsplugin.patch53
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtwebkit/0002-dlopen-webkit-gtk.patch25
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtwebkit/0003-dlopen-webkit-udev.patch31
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtwebkit/default.nix31
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtwebkit/qtwebkit-dlopen-gtk.patch64
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtwebkit/qtwebkit-dlopen-udev.patch0
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtwebkit/qtwebkit-icucore-darwin.patch13
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtwebkit/series3
-rw-r--r--pkgs/development/libraries/qt-5/5.8/qtwebsockets.nix4
-rw-r--r--pkgs/development/libraries/qt-5/make-qt-wrapper-darwin.sh38
-rw-r--r--pkgs/development/libraries/qt-5/make-qt-wrapper.sh46
-rw-r--r--pkgs/development/libraries/qt-5/qmake-hook-darwin.sh42
-rw-r--r--pkgs/development/libraries/qt-5/qmake-hook.sh7
-rw-r--r--pkgs/development/libraries/qt-5/qt-env.nix7
-rw-r--r--pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh25
-rw-r--r--pkgs/development/libraries/qt-5/qtbase-setup-hook.sh190
-rw-r--r--pkgs/development/libraries/qtinstaller/default.nix6
-rw-r--r--pkgs/development/libraries/qtstyleplugins/default.nix5
-rw-r--r--pkgs/development/libraries/qtwebkit-plugins/default.nix6
-rw-r--r--pkgs/development/libraries/quazip/default.nix4
-rw-r--r--pkgs/development/libraries/qwt/6.nix4
-rw-r--r--pkgs/development/node-packages/node-packages-v4.nix27
-rw-r--r--pkgs/development/node-packages/node-packages-v6.json1
-rw-r--r--pkgs/development/node-packages/node-packages-v6.nix515
-rw-r--r--pkgs/development/ocaml-modules/containers/default.nix7
-rw-r--r--pkgs/development/python-modules/keystoneauth1/default.nix27
-rw-r--r--pkgs/development/python-modules/oslo-config/default.nix22
-rw-r--r--pkgs/development/python-modules/pyqt/5.x.nix7
-rw-r--r--pkgs/development/python-modules/rebulk/default.nix23
-rw-r--r--pkgs/development/qtcreator/default.nix29
-rw-r--r--pkgs/development/tools/analysis/flow/default.nix4
-rw-r--r--pkgs/development/tools/analysis/qcachegrind/default.nix6
-rw-r--r--pkgs/development/tools/build-managers/gradle/default.nix10
-rw-r--r--pkgs/development/tools/build-managers/sbt/scala-native.nix14
-rw-r--r--pkgs/development/tools/database/sqlitebrowser/default.nix18
-rw-r--r--pkgs/development/tools/ocaml/camlidl/default.nix8
-rw-r--r--pkgs/development/tools/ocaml/utop/default.nix4
-rw-r--r--pkgs/development/tools/rust/rustfmt/default.nix6
-rw-r--r--pkgs/development/tools/tora/default.nix12
-rw-r--r--pkgs/development/tools/vogl/default.nix20
-rw-r--r--pkgs/games/chessx/default.nix6
-rw-r--r--pkgs/games/dwarf-fortress/dwarf-therapist/default.nix4
-rw-r--r--pkgs/games/ltris/default.nix22
-rw-r--r--pkgs/games/ltris/gcc5_compliance.diff299
-rw-r--r--pkgs/games/mudlet/default.nix7
-rw-r--r--pkgs/games/unnethack/default.nix2
-rw-r--r--pkgs/games/xconq/default.nix2
-rw-r--r--pkgs/games/xsokoban/default.nix6
-rw-r--r--pkgs/misc/vim-plugins/default.nix7
-rw-r--r--pkgs/misc/vim-plugins/vim2nix/additional-nix-code/command-t3
-rw-r--r--pkgs/os-specific/linux/kernel/linux-4.11.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-4.4.nix4
-rw-r--r--pkgs/os-specific/linux/kernel/linux-4.9.nix4
-rw-r--r--pkgs/os-specific/linux/ply/default.nix33
-rw-r--r--pkgs/os-specific/linux/rewritefs/default.nix5
-rw-r--r--pkgs/os-specific/linux/spl/default.nix4
-rw-r--r--pkgs/os-specific/linux/v4l-utils/default.nix8
-rw-r--r--pkgs/os-specific/linux/wpa_supplicant/gui.nix4
-rw-r--r--pkgs/os-specific/linux/zfs/default.nix6
-rw-r--r--pkgs/servers/atlassian/confluence.nix4
-rw-r--r--pkgs/servers/atlassian/crowd.nix4
-rw-r--r--pkgs/servers/atlassian/jira.nix4
-rw-r--r--pkgs/servers/computing/torque/default.nix3
-rw-r--r--pkgs/servers/http/hiawatha/default.nix4
-rw-r--r--pkgs/servers/sql/cockroachdb/default.nix37
-rw-r--r--pkgs/servers/sql/cockroachdb/deps.nix471
-rw-r--r--pkgs/shells/rssh/default.nix6
-rw-r--r--pkgs/tools/admin/cli53/default.nix34
-rw-r--r--pkgs/tools/admin/cli53/deps.nix3
-rw-r--r--pkgs/tools/audio/qastools/default.nix11
-rw-r--r--pkgs/tools/backup/amazon-glacier-cmd-interface/default.nix6
-rw-r--r--pkgs/tools/filesystems/glusterfs/default.nix4
-rw-r--r--pkgs/tools/misc/antimicro/default.nix13
-rw-r--r--pkgs/tools/misc/ckb/default.nix4
-rw-r--r--pkgs/tools/misc/clipster/default.nix8
-rw-r--r--pkgs/tools/misc/ddcutil/default.nix28
-rw-r--r--pkgs/tools/misc/kronometer/default.nix32
-rw-r--r--pkgs/tools/misc/parallel/default.nix4
-rw-r--r--pkgs/tools/misc/partition-manager/default.nix40
-rw-r--r--pkgs/tools/misc/peruse/default.nix41
-rw-r--r--pkgs/tools/misc/qt5ct/default.nix11
-rw-r--r--pkgs/tools/misc/radeon-profile/default.nix5
-rw-r--r--pkgs/tools/misc/rockbox-utility/default.nix6
-rw-r--r--pkgs/tools/misc/rrdtool/default.nix4
-rw-r--r--pkgs/tools/misc/tmuxinator/default.nix8
-rw-r--r--pkgs/tools/misc/ultrastar-creator/default.nix4
-rw-r--r--pkgs/tools/misc/ultrastar-manager/default.nix4
-rw-r--r--pkgs/tools/misc/uucp/default.nix7
-rw-r--r--pkgs/tools/misc/youtube-dl/default.nix4
-rw-r--r--pkgs/tools/networking/cmst/default.nix4
-rw-r--r--pkgs/tools/security/kwalletcli/default.nix78
-rw-r--r--pkgs/tools/security/logkeys/default.nix1
-rw-r--r--pkgs/tools/security/nmap/default.nix4
-rw-r--r--pkgs/tools/security/sudo/default.nix5
-rw-r--r--pkgs/tools/security/super/default.nix7
-rw-r--r--pkgs/tools/security/vulnix/requirements.nix1
-rw-r--r--pkgs/tools/system/at/install.patch2
-rw-r--r--pkgs/tools/system/cron/default.nix3
-rw-r--r--pkgs/tools/system/fakeroot/default.nix5
-rw-r--r--pkgs/tools/system/fakeroot/einval.patch47
-rw-r--r--pkgs/tools/system/logcheck/default.nix5
-rw-r--r--pkgs/tools/system/ps_mem/default.nix23
-rw-r--r--pkgs/tools/text/kdiff3/default.nix83
-rw-r--r--pkgs/top-level/all-packages.nix56
-rw-r--r--pkgs/top-level/haskell-packages.nix15
-rw-r--r--pkgs/top-level/python-packages.nix64
-rw-r--r--pkgs/top-level/rust-packages.nix6
503 files changed, 7832 insertions, 5996 deletions
diff --git a/doc/languages-frameworks/qt.xml b/doc/languages-frameworks/qt.xml
index b6c8f0e899e6..1dbbb5341ba3 100644
--- a/doc/languages-frameworks/qt.xml
+++ b/doc/languages-frameworks/qt.xml
@@ -2,31 +2,55 @@
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xml:id="sec-language-qt">
 
-<title>Qt and KDE</title>
-
-<para>Qt is a comprehensive desktop and mobile application development toolkit for C++. Legacy support is available for Qt 3 and Qt 4, but all current development uses Qt 5. The Qt 5 packages in Nixpkgs are updated frequently to take advantage of new features, but older versions are typically retained to support packages that may not be compatible with the latest version. When packaging applications and libraries for Nixpkgs, it is important to ensure that compatible versions of Qt 5 are used throughout; this consideration motivates the tools described below.</para>
-
-<section xml:id="ssec-qt-libraries"><title>Libraries</title>
-
-<para>Libraries that depend on Qt 5 should be built with each available version to avoid linking a dependent package against incompatible versions of Qt 5. (Although Qt 5 maintains backward ABI compatibility, linking against multiple versions at once is generally not possible; at best it will lead to runtime faults.) Packages that provide libraries should be added to the top-level function <varname>mkLibsForQt5</varname>, which is used to build a set of libraries for every Qt 5 version. The <varname>callPackage</varname> provided in this scope will ensure that only one Qt version will be used throughout the dependency tree. Dependencies should be imported unqualified, i.e. <literal>qtbase</literal> not <literal>qt5.qtbase</literal>, so that <varname>callPackage</varname> can do its work. <emphasis>Do not</emphasis> import a package set such as <literal>qt5</literal> or <literal>libsForQt5</literal> into your package; although it may work fine in the moment, it could well break at the next Qt update.</para>
-
-<para>If a library does not support a particular version of Qt 5, it is best to mark it as broken by setting its <literal>meta.broken</literal> attribute. A package may be marked broken for certain versions by testing the <literal>qtbase.version</literal> attribute, which will always give the current Qt 5 version.</para>
+<title>Qt</title>
+
+<para>
+Qt is a comprehensive desktop and mobile application development toolkit for C++.
+Legacy support is available for Qt 3 and Qt 4, but all current development uses Qt 5.
+The Qt 5 packages in Nixpkgs are updated frequently to take advantage of new features,
+but older versions are typically retained until their support window ends.
+The most important consideration in packaging Qt-based software is ensuring that each package and all its dependencies use the same version of Qt 5;
+this consideration motivates most of the tools described below.
+</para>
+
+<section xml:id="ssec-qt-libraries"><title>Packaging Libraries for Nixpkgs</title>
+
+<para>
+Whenever possible, libraries that use Qt 5 should be built with each available version.
+Packages providing libraries should be added to the top-level function <varname>mkLibsForQt5</varname>,
+which is used to build a set of libraries for every Qt 5 version.
+A special <varname>callPackage</varname> function is used in this scope to ensure that the entire dependency tree uses the same Qt 5 version.
+Import dependencies unqualified, i.e., <literal>qtbase</literal> not <literal>qt5.qtbase</literal>.
+<emphasis>Do not</emphasis> import a package set such as <literal>qt5</literal> or <literal>libsForQt5</literal>.
+</para>
+
+<para>
+If a library does not support a particular version of Qt 5, it is best to mark it as broken by setting its <literal>meta.broken</literal> attribute.
+A package may be marked broken for certain versions by testing the <literal>qtbase.version</literal> attribute, which will always give the current Qt 5 version.
+</para>
 
 </section>
 
-<section xml:id="ssec-qt-applications"><title>Applications</title>
-
-<para>Applications generally do not need to be built with every Qt version because they do not provide any libraries for dependent packages to link against. The primary consideration is merely ensuring that the application itself and its dependencies are linked against only one version of Qt. To call your application expression, use <literal>libsForQt5.callPackage</literal> instead of <literal>callPackage</literal>. Dependencies should be imported unqualified, i.e. <literal>qtbase</literal> not <literal>qt5.qtbase</literal>. <emphasis>Do not</emphasis> import a package set such as <literal>qt5</literal> or <literal>libsForQt5</literal> into your package; although it may work fine in the moment, it could well break at the next Qt update.</para>
-
-<para>It is generally best to build an application package against the <varname>libsForQt5</varname> library set. In case a package does not build with the latest Qt version, it is possible to pick a set pinned to a particular version, e.g. <varname>libsForQt55</varname> for Qt 5.5, if that is the latest version the package supports.</para>
-
-<para>Qt-based applications require that several paths be set at runtime. This is accomplished by wrapping the provided executables in a package with <literal>wrapQtProgram</literal> or <literal>makeQtWrapper</literal> during the <literal>postFixup</literal> phase. To use the wrapper generators, add <literal>makeQtWrapper</literal> to <literal>nativeBuildInputs</literal>. The wrapper generators support the same options as <literal>wrapProgram</literal> and <literal>makeWrapper</literal> respectively. It is usually only necessary to generate wrappers for programs intended to be invoked by the user.</para>
-
-</section>
-
-<section xml:id="ssec-qt-kde"><title>KDE</title>
-
-<para>The KDE Frameworks are a set of libraries for Qt 5 which form the basis of the Plasma desktop environment and the KDE Applications suite. Packaging a Frameworks-based library does not require any steps beyond those described above for general Qt-based libraries. Frameworks-based applications should not use <literal>makeQtWrapper</literal>; instead, use <literal>kdeWrapper</literal> to create the necessary wrappers: <literal>kdeWrapper { unwrapped = <replaceable>expr</replaceable>; targets = <replaceable>exes</replaceable>; }</literal>, where <replaceable>expr</replaceable> is the un-wrapped package expression and <replaceable>exes</replaceable> is a list of strings giving the relative paths to programs in the package which should be wrapped.</para>
+<section xml:id="ssec-qt-applications"><title>Packaging Applications for Nixpkgs</title>
+
+<para>
+Call your application expression using <literal>libsForQt5.callPackage</literal> instead of <literal>callPackage</literal>.
+Import dependencies unqualified, i.e., <literal>qtbase</literal> not <literal>qt5.qtbase</literal>.
+<emphasis>Do not</emphasis> import a package set such as <literal>qt5</literal> or <literal>libsForQt5</literal>.
+</para>
+
+<para>
+Qt 5 maintains strict backward compatibility, so it is generally best to build an application package against the latest version using the <varname>libsForQt5</varname> library set.
+In case a package does not build with the latest Qt version, it is possible to pick a set pinned to a particular version, e.g. <varname>libsForQt55</varname> for Qt 5.5, if that is the latest version the package supports.
+If a package must be pinned to an older Qt version, be sure to file a bug upstream;
+because Qt is strictly backwards-compatible, any incompatibility is by definition a bug in the application.
+</para>
+
+<para>
+When testing applications in Nixpkgs, it is a common practice to build the package with <literal>nix-build</literal> and run it using the created symbolic link.
+This will not work with Qt applications, however, because they have many hard runtime requirements that can only be guaranteed if the package is actually installed.
+To test a Qt application, install it with <literal>nix-env</literal> or run it inside <literal>nix-shell</literal>.
+</para>
 
 </section>
 
diff --git a/nixos/doc/manual/configuration/x-windows.xml b/nixos/doc/manual/configuration/x-windows.xml
index 4a73695e0942..fc6082ce3afd 100644
--- a/nixos/doc/manual/configuration/x-windows.xml
+++ b/nixos/doc/manual/configuration/x-windows.xml
@@ -45,6 +45,13 @@ services.xserver.displayManager.lightdm.enable = true;
 </programlisting>
 </para>
 
+<para>You can set the keyboard layout (and optionally the layout variant):
+<programlisting>
+services.xserver.layout = "de";
+services.xserver.xkbVariant = "neo";
+</programlisting>
+</para>
+
 <para>The X server is started automatically at boot time.  If you
 don’t want this to happen, you can set:
 <programlisting>
diff --git a/nixos/modules/programs/gnupg.nix b/nixos/modules/programs/gnupg.nix
index c5277f40d260..68adee94f79e 100644
--- a/nixos/modules/programs/gnupg.nix
+++ b/nixos/modules/programs/gnupg.nix
@@ -21,13 +21,37 @@ in
 
     agent.enableSSHSupport = mkOption {
       type = types.bool;
-      default = true;
+      default = false;
       description = ''
         Enable SSH agent support in GnuPG agent. Also sets SSH_AUTH_SOCK
         environment variable correctly. This will disable socket-activation
         and thus always start a GnuPG agent per user session.
       '';
     };
+
+    agent.enableExtraSocket = mkOption {
+      type = types.bool;
+      default = false;
+      description = ''
+        Enable extra socket for GnuPG agent.
+      '';
+    };
+
+    agent.enableBrowserSocket = mkOption {
+      type = types.bool;
+      default = false;
+      description = ''
+        Enable browser socket for GnuPG agent.
+      '';
+    };
+
+    dirmngr.enable = mkOption {
+      type = types.bool;
+      default = false;
+      description = ''
+        Enables GnuPG network certificate management daemon with socket-activation for every user session.
+      '';
+    };
   };
 
   config = mkIf cfg.agent.enable {
@@ -38,15 +62,72 @@ in
           ("${pkgs.gnupg}/bin/gpg-agent --supervised "
             + optionalString cfg.agent.enableSSHSupport "--enable-ssh-support")
         ];
+        ExecReload = "${pkgs.gnupg}/bin/gpgconf --reload gpg-agent";
       };
     };
 
     systemd.user.sockets.gpg-agent = {
       wantedBy = [ "sockets.target" ];
+      listenStreams = [ "%t/gnupg/S.gpg-agent" ];
+      socketConfig = {
+        FileDescriptorName = "std";
+        SocketMode = "0600";
+        DirectoryMode = "0700";
+      };
     };
 
     systemd.user.sockets.gpg-agent-ssh = mkIf cfg.agent.enableSSHSupport {
       wantedBy = [ "sockets.target" ];
+      listenStreams = [ "%t/gnupg/S.gpg-agent.ssh" ];
+      socketConfig = {
+        FileDescriptorName = "ssh";
+        Service = "gpg-agent.service";
+        SocketMode = "0600";
+        DirectoryMode = "0700";
+      };
+    };
+
+    systemd.user.sockets.gpg-agent-extra = mkIf cfg.agent.enableExtraSocket {
+      wantedBy = [ "sockets.target" ];
+      listenStreams = [ "%t/gnupg/S.gpg-agent.extra" ];
+      socketConfig = {
+        FileDescriptorName = "extra";
+        Service = "gpg-agent.service";
+        SocketMode = "0600";
+        DirectoryMode = "0700";
+      };
+    };
+
+    systemd.user.sockets.gpg-agent-browser = mkIf cfg.agent.enableBrowserSocket {
+      wantedBy = [ "sockets.target" ];
+      listenStreams = [ "%t/gnupg/S.gpg-agent.browser" ];
+      socketConfig = {
+        FileDescriptorName = "browser";
+        Service = "gpg-agent.service";
+        SocketMode = "0600";
+        DirectoryMode = "0700";
+      };
+    };
+
+    systemd.user.services.dirmngr = {
+      requires = [ "dirmngr.socket" ];
+      after = [ "dirmngr.socket" ];
+      unitConfig = {
+        RefuseManualStart = "true";
+      };
+      serviceConfig = {
+        ExecStart = "${pkgs.gnupg}/bin/dirmngr --supervised";
+        ExecReload = "${pkgs.gnupg}/bin/gpgconf --reload dirmngr";
+      };
+    };
+
+    systemd.user.sockets.dirmngr = {
+      wantedBy = [ "sockets.target" ];
+      listenStreams = [ "%t/gnupg/S.dirmngr" ];
+      socketConfig = {
+        SocketMode = "0600";
+        DirectoryMode = "0700";
+      };
     };
 
     systemd.packages = [ pkgs.gnupg ];
diff --git a/nixos/modules/security/wrappers/default.nix b/nixos/modules/security/wrappers/default.nix
index c051b7d49e3f..dc1227c5628d 100644
--- a/nixos/modules/security/wrappers/default.nix
+++ b/nixos/modules/security/wrappers/default.nix
@@ -80,8 +80,8 @@ let
                     group = "root";
                   } // s)
           else if 
-             (s ? "setuid"  && s.setuid  == true) ||
-             (s ? "setguid" && s.setguid == true) ||
+             (s ? "setuid" && s.setuid) ||
+             (s ? "setgid" && s.setgid) ||
              (s ? "permissions")
           then mkSetuidProgram s
           else mkSetuidProgram
diff --git a/nixos/modules/services/continuous-integration/jenkins/default.nix b/nixos/modules/services/continuous-integration/jenkins/default.nix
index 11adf74b9ed5..c14aa4167231 100644
--- a/nixos/modules/services/continuous-integration/jenkins/default.nix
+++ b/nixos/modules/services/continuous-integration/jenkins/default.nix
@@ -125,6 +125,15 @@ in {
           Additional command line arguments to pass to Jenkins.
         '';
       };
+
+      extraJavaOptions = mkOption {
+        type = types.listOf types.str;
+        default = [ ];
+        example = [ "-Xmx80m" ];
+        description = ''
+          Additional command line arguments to pass to the Java run time (as opposed to Jenkins).
+        '';
+      };
     };
   };
 
@@ -185,7 +194,7 @@ in {
         '';
 
       script = ''
-        ${pkgs.jdk}/bin/java -jar ${pkgs.jenkins}/webapps/jenkins.war --httpListenAddress=${cfg.listenAddress} \
+        ${pkgs.jdk}/bin/java ${concatStringsSep " " cfg.extraJavaOptions} -jar ${pkgs.jenkins}/webapps/jenkins.war --httpListenAddress=${cfg.listenAddress} \
                                                   --httpPort=${toString cfg.port} \
                                                   --prefix=${cfg.prefix} \
                                                   ${concatStringsSep " " cfg.extraOptions}
diff --git a/nixos/modules/services/networking/bind.nix b/nixos/modules/services/networking/bind.nix
index ca375c935e83..763283dfe7a2 100644
--- a/nixos/modules/services/networking/bind.nix
+++ b/nixos/modules/services/networking/bind.nix
@@ -10,6 +10,11 @@ let
 
   confFile = pkgs.writeText "named.conf"
     ''
+      include "/etc/bind/rndc.key";
+      controls {
+        inet 127.0.0.1 allow {localhost;} keys {"rndc-key";};
+      };
+
       acl cachenetworks { ${concatMapStrings (entry: " ${entry}; ") cfg.cacheNetworks} };
       acl badnetworks { ${concatMapStrings (entry: " ${entry}; ") cfg.blockedNetworks} };
 
@@ -167,11 +172,21 @@ in
       wantedBy = [ "multi-user.target" ];
 
       preStart = ''
+        mkdir -m 0755 -p /etc/bind
+        if ! [ -f "/etc/bind/rndc.key" ]; then
+          ${pkgs.bind.out}/sbin/rndc-confgen -r /dev/urandom -c /etc/bind/rndc.key -u ${bindUser} -a -A hmac-sha256 2>/dev/null
+        fi
+
         ${pkgs.coreutils}/bin/mkdir -p /var/run/named
         chown ${bindUser} /var/run/named
       '';
 
-      script = "${pkgs.bind.out}/sbin/named -u ${bindUser} ${optionalString cfg.ipv4Only "-4"} -c ${cfg.configFile} -f";
+      serviceConfig = {
+        ExecStart  = "${pkgs.bind.out}/sbin/named -u ${bindUser} ${optionalString cfg.ipv4Only "-4"} -c ${cfg.configFile} -f";
+        ExecReload = "${pkgs.bind.out}/sbin/rndc -k '/etc/bind/rndc.key' reload";
+        ExecStop   = "${pkgs.bind.out}/sbin/rndc -k '/etc/bind/rndc.key' stop";
+      };
+
       unitConfig.Documentation = "man:named(8)";
     };
   };
diff --git a/nixos/modules/services/networking/nsd.nix b/nixos/modules/services/networking/nsd.nix
index 0f01b9d4af04..c8b8ed547ebb 100644
--- a/nixos/modules/services/networking/nsd.nix
+++ b/nixos/modules/services/networking/nsd.nix
@@ -811,6 +811,7 @@ in
 
       serviceConfig = {
         ExecStart = "${nsdPkg}/sbin/nsd -d -c ${nsdEnv}/nsd.conf";
+        StandardError = "null";
         PIDFile = pidFile;
         Restart = "always";
         RestartSec = "4s";
diff --git a/nixos/modules/services/x11/desktop-managers/plasma5.nix b/nixos/modules/services/x11/desktop-managers/plasma5.nix
index 2216104be31a..f099117f4777 100644
--- a/nixos/modules/services/x11/desktop-managers/plasma5.nix
+++ b/nixos/modules/services/x11/desktop-managers/plasma5.nix
@@ -7,7 +7,7 @@ let
   xcfg = config.services.xserver;
   cfg = xcfg.desktopManager.plasma5;
 
-  inherit (pkgs) kdeWrapper kdeApplications plasma5 libsForQt5 qt5 xorg;
+  inherit (pkgs) kdeApplications plasma5 libsForQt5 qt5 xorg;
 
 in
 
@@ -30,24 +30,12 @@ in
         '';
       };
 
-      extraPackages = mkOption {
-        type = types.listOf types.package;
-        default = [];
-        description = ''
-          KDE packages that need to be installed system-wide.
-        '';
-      };
-
     };
 
   };
 
 
   config = mkMerge [
-    (mkIf (cfg.extraPackages != []) {
-      environment.systemPackages = [ (kdeWrapper cfg.extraPackages) ];
-    })
-
     (mkIf (xcfg.enable && cfg.enable) {
       services.xserver.desktopManager.session = singleton {
         name = "plasma5";
@@ -64,8 +52,8 @@ in
       };
 
       security.wrappers = {
-        kcheckpass.source = "${plasma5.plasma-workspace.out}/lib/libexec/kcheckpass";
-        "start_kdeinit".source = "${pkgs.kinit.out}/lib/libexec/kf5/start_kdeinit";
+        kcheckpass.source = "${lib.getBin plasma5.plasma-workspace}/lib/libexec/kcheckpass";
+        "start_kdeinit".source = "${lib.getBin pkgs.kinit}/lib/libexec/kf5/start_kdeinit";
       };
 
       environment.systemPackages = with pkgs; with qt5; with libsForQt5; with plasma5; with kdeApplications;
@@ -139,10 +127,14 @@ in
           plasma-workspace
           plasma-workspace-wallpapers
 
+          dolphin
           dolphin-plugins
           ffmpegthumbs
           kdegraphics-thumbnailers
+          khelpcenter
           kio-extras
+          konsole
+          oxygen
           print-manager
 
           breeze-icons
@@ -163,16 +155,6 @@ in
         ++ lib.optional config.services.colord.enable colord-kde
         ++ lib.optionals config.services.samba.enable [ kdenetwork-filesharing pkgs.samba ];
 
-      services.xserver.desktopManager.plasma5.extraPackages =
-        with kdeApplications; with plasma5;
-        [
-          khelpcenter
-          oxygen
-
-          dolphin
-          konsole
-        ];
-
       environment.pathsToLink = [ "/share" ];
 
       environment.etc = singleton {
@@ -183,7 +165,6 @@ in
       environment.variables = {
         # Enable GTK applications to load SVG icons
         GDK_PIXBUF_MODULE_FILE = "${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache";
-        QT_PLUGIN_PATH = "/run/current-system/sw/lib/qt5/plugins";
       };
 
       fonts.fonts = with pkgs; [ noto-fonts hack-font ];
@@ -209,7 +190,6 @@ in
 
       services.xserver.displayManager.sddm = {
         theme = "breeze";
-        package = pkgs.sddmPlasma5;
       };
 
       security.pam.services.kde = { allowNullPassword = true; };
diff --git a/nixos/modules/services/x11/display-managers/sddm.nix b/nixos/modules/services/x11/display-managers/sddm.nix
index 2eb7ddcb1ec0..e6cc02e4d491 100644
--- a/nixos/modules/services/x11/display-managers/sddm.nix
+++ b/nixos/modules/services/x11/display-managers/sddm.nix
@@ -9,7 +9,7 @@ let
   cfg = dmcfg.sddm;
   xEnv = config.systemd.services."display-manager".environment;
 
-  sddm = cfg.package;
+  inherit (pkgs) sddm;
 
   xserverWrapper = pkgs.writeScript "xserver-wrapper" ''
     #!/bin/sh
@@ -37,8 +37,8 @@ let
 
     [Theme]
     Current=${cfg.theme}
-    ThemeDir=${sddm}/share/sddm/themes
-    FacesDir=${sddm}/share/sddm/faces
+    ThemeDir=/run/current-system/sw/share/sddm/themes
+    FacesDir=/run/current-system/sw/share/sddm/faces
 
     [Users]
     MaximumUid=${toString config.ids.uids.nixbld}
@@ -105,15 +105,6 @@ in
         '';
       };
 
-      package = mkOption {
-        type = types.package;
-        default = pkgs.sddm;
-        description = ''
-          The SDDM package to install.
-          The default package can be overridden to provide extra themes.
-        '';
-      };
-
       autoNumlock = mkOption {
         type = types.bool;
         default = false;
@@ -205,7 +196,15 @@ in
     services.xserver.displayManager.job = {
       logsXsession = true;
 
-      execCmd = "exec ${sddm}/bin/sddm";
+      environment = {
+        # Load themes from system environment
+        QT_PLUGIN_PATH = "/run/current-system/sw/" + pkgs.qt5.qtbase.qtPluginPrefix;
+        QML2_IMPORT_PATH = "/run/current-system/sw/" + pkgs.qt5.qtbase.qtQmlPrefix;
+
+        XDG_DATA_DIRS = "/run/current-system/sw/share";
+      };
+
+      execCmd = "exec /run/current-system/sw/bin/sddm";
     };
 
     security.pam.services = {
@@ -254,7 +253,8 @@ in
 
     users.extraGroups.sddm.gid = config.ids.gids.sddm;
 
-    services.dbus.packages = [ sddm.unwrapped ];
+    environment.systemPackages = [ sddm ];
+    services.dbus.packages = [ sddm ];
 
     # To enable user switching, allow sddm to allocate TTYs/displays dynamically.
     services.xserver.tty = null;
diff --git a/nixos/modules/tasks/network-interfaces.nix b/nixos/modules/tasks/network-interfaces.nix
index e9a3dca6418a..8ce7b2d2cf36 100644
--- a/nixos/modules/tasks/network-interfaces.nix
+++ b/nixos/modules/tasks/network-interfaces.nix
@@ -1110,7 +1110,7 @@ in
             '';
 
             # Udev script to execute for a new WLAN interface. The script configures the new WLAN interface.
-            newInterfaceScript = new: pkgs.writeScript "udev-run-script-wlan-interfaces-${new._iName}.sh" ''
+            newInterfaceScript = device: new: pkgs.writeScript "udev-run-script-wlan-interfaces-${new._iName}.sh" ''
               #!${pkgs.stdenv.shell}
               # Configure the new interface
               ${pkgs.iw}/bin/iw dev ${new._iName} set type ${new.type}
@@ -1132,7 +1132,7 @@ in
             # It is important to have that rule first as overwriting the NAME attribute also prevents the
             # next rules from matching.
             ${flip (concatMapStringsSep "\n") (wlanListDeviceFirst device wlanDeviceInterfaces."${device}") (interface:
-            ''ACTION=="add", SUBSYSTEM=="net", ENV{DEVTYPE}=="wlan", ENV{INTERFACE}=="${interface._iName}", ${systemdAttrs interface._iName}, RUN+="${newInterfaceScript interface}"'')}
+            ''ACTION=="add", SUBSYSTEM=="net", ENV{DEVTYPE}=="wlan", ENV{INTERFACE}=="${interface._iName}", ${systemdAttrs interface._iName}, RUN+="${newInterfaceScript device interface}"'')}
 
             # Add the required, new WLAN interfaces to the default WLAN interface with the
             # persistent, default name as assigned by udev.
diff --git a/pkgs/applications/altcoins/bitcoin-classic.nix b/pkgs/applications/altcoins/bitcoin-classic.nix
index 1cb9a77785e4..5f17eb3a1cf6 100644
--- a/pkgs/applications/altcoins/bitcoin-classic.nix
+++ b/pkgs/applications/altcoins/bitcoin-classic.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
     owner = "bitcoinclassic";
     repo = "bitcoinclassic";
     rev = "v${version}";
-    sha256 = "1z6g930csvx49krl34207yqwlr8dkxpi72k3msh15p1kjvv90nvz";
+    sha256 = "00spils0gv8krx2nyxrf6j1dl81wmxk8xjkqc22cv7nsdnakzrvm";
   };
 
   nativeBuildInputs = [ pkgconfig autoreconfHook ];
@@ -32,12 +32,12 @@ stdenv.mkDerivation rec {
       parties. Users hold the crypto keys to their own money and transact directly
       with each other, with the help of a P2P network to check for double-spending.
 
-      Bitcoin Classic stands for the original Bitcoin as Satoshi described it, 
-      "A Peer-to-Peer Electronic Cash System". We are writing the software that 
+      Bitcoin Classic stands for the original Bitcoin as Satoshi described it,
+      "A Peer-to-Peer Electronic Cash System". We are writing the software that
       miners and users say they want. We will make sure it solves their needs, help
-      them deploy it, and gracefully upgrade the bitcoin network's capacity 
+      them deploy it, and gracefully upgrade the bitcoin network's capacity
       together. The data shows that Bitcoin can grow, on-chain, to welcome many
-      more users onto our coin in a safe and distributed manner. In the future we 
+      more users onto our coin in a safe and distributed manner. In the future we
       will continue to release updates that are in line with Satoshi’s whitepaper &
       vision, and are agreed upon by the community.
     '';
diff --git a/pkgs/applications/altcoins/freicoin.nix b/pkgs/applications/altcoins/freicoin.nix
index f7cd04f1be4e..e8a26365361d 100644
--- a/pkgs/applications/altcoins/freicoin.nix
+++ b/pkgs/applications/altcoins/freicoin.nix
@@ -11,16 +11,18 @@ stdenv.mkDerivation rec {
     sha256 = "1m5pcnfhwhcj7q00p2sy3h73rkdm3w6grmljgiq53gshcj08cq1z";
   };
 
+  qmakeFlags = ["USE_UPNP=-"];
+
   # I think that openssl and zlib are required, but come through other
   # packages
 
   installPhase = ''
     mkdir -p $out/bin
     cp freicoin-qt $out/bin
-    '';
+  '';
 
   nativeBuildInputs = [ qmake4Hook ];
-  buildInputs = [ db boost gmp mpfr miniupnpc qt4 ];
+  buildInputs = [ db boost gmp mpfr qt4 ];
 
   meta = with stdenv.lib; {
     description = "Peer-to-peer currency with demurrage fee";
diff --git a/pkgs/applications/altcoins/memorycoin.nix b/pkgs/applications/altcoins/memorycoin.nix
index d30133fa5511..2723bf9dabdb 100644
--- a/pkgs/applications/altcoins/memorycoin.nix
+++ b/pkgs/applications/altcoins/memorycoin.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, pkgconfig, openssl, db48, boost
-, zlib, miniupnpc, qt4, qmake4Hook, utillinux, protobuf, qrencode
+, zlib, qt4, qmake4Hook, utillinux, protobuf, qrencode
 , withGui }:
 
 with stdenv.lib;
@@ -13,10 +13,12 @@ stdenv.mkDerivation rec{
     sha256 = "1iyh6dqrg0mirwci5br5n5qw3ghp2cs23wd8ygr56bh9ml4dr1m8";
   };
 
-  buildInputs = [ pkgconfig openssl db48 boost zlib
-                  miniupnpc utillinux protobuf ]
+  buildInputs = [ pkgconfig openssl db48 boost zlib utillinux protobuf ]
                   ++ optionals withGui [ qt4 qmake4Hook qrencode ];
 
+  qmakeFlags = ["USE_UPNP=-"];
+  makeFlags = ["USE_UPNP=-"];
+
   configureFlags = [ "--with-boost-libdir=${boost.out}/lib" ]
                      ++ optionals withGui [ "--with-gui=qt4" ];
 
diff --git a/pkgs/applications/altcoins/primecoin.nix b/pkgs/applications/altcoins/primecoin.nix
index 7d25a26fba25..311836702122 100644
--- a/pkgs/applications/altcoins/primecoin.nix
+++ b/pkgs/applications/altcoins/primecoin.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, pkgconfig, openssl, db48, boost
-, zlib, miniupnpc, qt4, qmake4Hook, utillinux, protobuf, qrencode
+, zlib, qt4, qmake4Hook, utillinux, protobuf, qrencode
 , withGui }:
 
 with stdenv.lib;
@@ -13,8 +13,10 @@ stdenv.mkDerivation rec{
     sha256 = "0cixnkici74204s9d5iqj5sccib5a8dig2p2fp1axdjifpg787i3";
   };
 
-  buildInputs = [ pkgconfig openssl db48 boost zlib
-                  miniupnpc utillinux protobuf ]
+  qmakeFlags = ["USE_UPNP=-"];
+  makeFlags = ["USE_UPNP=-"];
+
+  buildInputs = [ pkgconfig openssl db48 boost zlib utillinux protobuf ]
                   ++ optionals withGui [ qt4 qmake4Hook qrencode ];
 
   configureFlags = [ "--with-boost-libdir=${boost.out}/lib" ]
diff --git a/pkgs/applications/audio/ardour/default.nix b/pkgs/applications/audio/ardour/default.nix
index 57864f863e3b..c447863e1497 100644
--- a/pkgs/applications/audio/ardour/default.nix
+++ b/pkgs/applications/audio/ardour/default.nix
@@ -16,7 +16,7 @@ let
   # "git describe" when _not_ on an annotated tag(!): MAJOR.MINOR-REV-HASH.
 
   # Version to build.
-  tag = "5.8";
+  tag = "5.10";
 
 in
 
@@ -25,8 +25,8 @@ stdenv.mkDerivation rec {
 
   src = fetchgit {
     url = "git://git.ardour.org/ardour/ardour.git";
-    rev = "e5c6f16126e0901654b09ecce990554b1ff73833";
-    sha256 = "1lcvslrcw6g4kp9w0h1jx46x6ilz4nzz0k2yrw4gd545k1rwx0c1";
+    rev = "9c629c0c76808cc3e8f05e43bc760f849566dce6";
+    sha256 = "062igiaaj18kbismrpzbafyq1ryyqj3lh0ajqqs2s8ms675x33sl";
   };
 
   buildInputs =
diff --git a/pkgs/applications/audio/artyFX/default.nix b/pkgs/applications/audio/artyFX/default.nix
index 39edf18b0565..568195c1dba7 100644
--- a/pkgs/applications/audio/artyFX/default.nix
+++ b/pkgs/applications/audio/artyFX/default.nix
@@ -1,13 +1,14 @@
-{ stdenv, fetchgit, cairomm, cmake, libjack2, libpthreadstubs, libXdmcp, libxshmfence, libsndfile, lv2, ntk, pkgconfig }:
+{ stdenv, fetchFromGitHub , cairomm, cmake, libjack2, libpthreadstubs, libXdmcp, libxshmfence, libsndfile, lv2, ntk, pkgconfig }:
 
 stdenv.mkDerivation rec {
-  name = "artyFX-git-${version}";
-  version = "2015-05-07";
+  name = "artyFX-${version}";
+  version = "1.3";
 
-  src = fetchgit {
-    url = "https://github.com/harryhaaren/openAV-ArtyFX.git";
-    rev = "3a8cb9a5e4ffaf27a497a31cc9cd6f2e79622d5b";
-    sha256 = "0nsmycm64a686ysfnmdvnaazijvfj90z5wyp96kyr81nsrbcv2ij";
+  src = fetchFromGitHub {
+    owner = "openAVproductions";
+    repo = "openAV-ArtyFX";
+    rev = "release-${version}";
+    sha256 = "012hcy1mxl7gs2lipfcqp5x0xv1azb9hjrwf0h59yyxnzx96h7c9";
   };
 
   buildInputs = [ cairomm cmake libjack2 libpthreadstubs libXdmcp libxshmfence libsndfile lv2 ntk pkgconfig   ];
diff --git a/pkgs/applications/audio/audacious/qt-5.nix b/pkgs/applications/audio/audacious/qt-5.nix
index 663e0eb0cc8c..da143c7d946a 100644
--- a/pkgs/applications/audio/audacious/qt-5.nix
+++ b/pkgs/applications/audio/audacious/qt-5.nix
@@ -1,6 +1,6 @@
 {
-  stdenv, lib, fetchurl,
-  gettext, makeQtWrapper, pkgconfig,
+  mkDerivation, lib, fetchurl,
+  gettext, pkgconfig,
   qtbase,
   alsaLib, curl, faad2, ffmpeg, flac, fluidsynth, gdk_pixbuf, lame, libbs2b,
   libcddb, libcdio082, libcue, libjack2, libmad, libmcs, libmms, libmodplug,
@@ -24,16 +24,14 @@ let
   };
 in
 
-stdenv.mkDerivation {
+mkDerivation {
   inherit version;
   name = "audacious-qt5-${version}";
 
   sourceFiles = lib.attrValues sources;
   sourceRoots = lib.attrNames sources;
 
-  nativeBuildInputs = [
-    gettext makeQtWrapper pkgconfig
-  ];
+  nativeBuildInputs = [ gettext pkgconfig ];
 
   buildInputs = [
     # Core dependencies
@@ -68,15 +66,9 @@ stdenv.mkDerivation {
       fi
 
     done
-
-    source $stdenv/setup
-    wrapQtProgram $out/bin/audacious
-    wrapQtProgram $out/bin/audtool
   '';
 
-  enableParallelBuilding = true;
-
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Audio player";
     homepage = http://audacious-media-player.org/;
     maintainers = with maintainers; [ ttuegel ];
diff --git a/pkgs/applications/audio/cantata/default.nix b/pkgs/applications/audio/cantata/default.nix
index 3231e3e53017..82a6d44f6436 100644
--- a/pkgs/applications/audio/cantata/default.nix
+++ b/pkgs/applications/audio/cantata/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchFromGitHub, cmake, vlc
 , withQt4 ? false, qt4
-, withQt5 ? true, qtbase, qtsvg, qttools, makeQtWrapper
+, withQt5 ? true, qtbase, qtsvg, qttools
 
 # Cantata doesn't build with cdparanoia enabled so we disable that
 # default for now until I (or someone else) figure it out.
@@ -63,8 +63,6 @@ stdenv.mkDerivation rec {
     ++ stdenv.lib.optional withMusicbrainz libmusicbrainz5
     ++ stdenv.lib.optional (withTaglib && withDevices) udisks2;
 
-  nativeBuildInputs = stdenv.lib.optional withQt5 makeQtWrapper;
-
   cmakeFlags = stdenv.lib.flatten [
     (fstat withQt5 "QT5")
     (fstats withTaglib [ "TAGLIB" "TAGLIB_EXTRAS" ])
@@ -88,10 +86,6 @@ stdenv.mkDerivation rec {
     sed -i -e 's/STRLESS/VERSION_LESS/g' cmake/FindTaglib.cmake
   '';
 
-  postInstall = stdenv.lib.optionalString withQt5 ''
-    wrapQtProgram "$out/bin/cantata"
-  '';
-
   meta = with stdenv.lib; {
     homepage = https://github.com/cdrummond/cantata;
     description = "A graphical client for MPD";
diff --git a/pkgs/applications/audio/dfasma/default.nix b/pkgs/applications/audio/dfasma/default.nix
index d006f2c01781..918accb4e167 100644
--- a/pkgs/applications/audio/dfasma/default.nix
+++ b/pkgs/applications/audio/dfasma/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fftw, libsndfile, qtbase, qtmultimedia, qmakeHook, makeQtWrapper }:
+{ stdenv, fetchFromGitHub, fftw, libsndfile, qtbase, qtmultimedia, qmake }:
 
 let
 
@@ -37,9 +37,9 @@ in stdenv.mkDerivation rec {
     owner = "gillesdegottex";
   };
 
-  buildInputs = [ fftw libsndfile qtbase qtmultimedia qmakeHook ];
+  buildInputs = [ fftw libsndfile qtbase qtmultimedia ];
 
-  nativeBuildInputs = [ makeQtWrapper ];
+  nativeBuildInputs = [ qmake ];
 
   postPatch = ''
     substituteInPlace dfasma.pro --replace '$$DFASMAVERSIONGITPRO' '${version}'
@@ -53,10 +53,6 @@ in stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  postInstall = ''
-    wrapQtProgram "$out/bin/dfasma"
-  '';
-
   meta = with stdenv.lib; {
     description = "Analyse and compare audio files in time and frequency";
     longDescription = ''
diff --git a/pkgs/applications/audio/eq10q/default.nix b/pkgs/applications/audio/eq10q/default.nix
index a546441996ea..35079ea27385 100644
--- a/pkgs/applications/audio/eq10q/default.nix
+++ b/pkgs/applications/audio/eq10q/default.nix
@@ -1,10 +1,10 @@
 { stdenv, fetchurl, cmake, fftw, gtkmm2, libxcb, lv2, pkgconfig, xorg }:
 stdenv.mkDerivation rec {
   name = "eq10q-${version}";
-  version = "2.1";
+  version = "2.2";
   src = fetchurl {
     url = "mirror://sourceforge/project/eq10q/${name}.tar.gz";
-    sha256 = "0brrr6ydsppi4zzn3vcgl0zgq5r8jmlcap1hpr3k43yvlwggb880";
+    sha256 = "16mhcav8gwkp29k9ki4dlkajlcgh1i2wvldabxb046d37dq4qzrk";
   };
 
   buildInputs = [ cmake fftw gtkmm2 libxcb lv2 pkgconfig xorg.libpthreadstubs xorg.libXdmcp xorg.libxshmfence ];
diff --git a/pkgs/applications/audio/fmit/default.nix b/pkgs/applications/audio/fmit/default.nix
index bb4df5ea1db5..e4c6c658efd7 100644
--- a/pkgs/applications/audio/fmit/default.nix
+++ b/pkgs/applications/audio/fmit/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fftw, freeglut, mesa_glu, qtbase, qtmultimedia, qmakeHook
+{ stdenv, fetchFromGitHub, fftw, freeglut, mesa_glu, qtbase, qtmultimedia, qmake
 , alsaSupport ? true, alsaLib ? null
 , jackSupport ? false, libjack2 ? null
 , portaudioSupport ? false, portaudio ? null }:
@@ -20,7 +20,7 @@ stdenv.mkDerivation rec {
     owner = "gillesdegottex";
   };
 
-  nativeBuildInputs = [ qmakeHook ];
+  nativeBuildInputs = [ qmake ];
   buildInputs = [ fftw qtbase qtmultimedia ]
     ++ optionals alsaSupport [ alsaLib ]
     ++ optionals jackSupport [ libjack2 ]
diff --git a/pkgs/applications/audio/iannix/default.nix b/pkgs/applications/audio/iannix/default.nix
index 83fd2b14ed2e..d72a2b13c42d 100644
--- a/pkgs/applications/audio/iannix/default.nix
+++ b/pkgs/applications/audio/iannix/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, alsaLib, pkgconfig, qtbase, qtscript, qmakeHook
+{ stdenv, fetchFromGitHub, alsaLib, pkgconfig, qtbase, qtscript, qmake
 }:
 
 stdenv.mkDerivation rec {
@@ -11,7 +11,8 @@ stdenv.mkDerivation rec {
     sha256 = "184ydb9f1303v332k5k3f1ki7cb6nkxhh6ij0yn72v7dp7figrgj";
   };
 
-  buildInputs = [ alsaLib pkgconfig qtbase qtscript qmakeHook ];
+  nativeBuildInputs = [ qmake ];
+  buildInputs = [ alsaLib pkgconfig qtbase qtscript ];
 
   qmakeFlags = [ "PREFIX=/" ];
 
diff --git a/pkgs/applications/audio/jalv/default.nix b/pkgs/applications/audio/jalv/default.nix
index bcec085887a5..e2c86256ce64 100644
--- a/pkgs/applications/audio/jalv/default.nix
+++ b/pkgs/applications/audio/jalv/default.nix
@@ -3,11 +3,11 @@
 
 stdenv.mkDerivation  rec {
   name = "jalv-${version}";
-  version = "1.4.6";
+  version = "1.6.0";
 
   src = fetchurl {
     url = "http://download.drobilla.net/${name}.tar.bz2";
-    sha256 = "1f1hcq74n3ziw8bk97mn5a1vgw028dxikv3fchaxd430pbbhqgl9";
+    sha256 = "1x2wpzzx2cgvz3dgdcgsj8dr0w3zsasy62mvl199bsdj5fbjaili";
   };
 
   buildInputs = [
diff --git a/pkgs/applications/audio/keyfinder/default.nix b/pkgs/applications/audio/keyfinder/default.nix
index 0cacd7724939..6aaf14a5763a 100644
--- a/pkgs/applications/audio/keyfinder/default.nix
+++ b/pkgs/applications/audio/keyfinder/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, libav_0_8, libkeyfinder, qtbase, qtxmlpatterns, qmakeHook, taglib }:
+{ stdenv, fetchFromGitHub, libav_0_8, libkeyfinder, qtbase, qtxmlpatterns, qmake, taglib }:
 
 stdenv.mkDerivation rec {
   name = "keyfinder-${version}";
@@ -11,7 +11,8 @@ stdenv.mkDerivation rec {
     owner = "ibsh";
   };
 
-  buildInputs = [ libav_0_8 libkeyfinder qtbase qtxmlpatterns qmakeHook taglib ];
+  nativeBuildInputs = [ qmake ];
+  buildInputs = [ libav_0_8 libkeyfinder qtbase qtxmlpatterns taglib ];
 
   postPatch = ''
     substituteInPlace is_KeyFinder.pro \
diff --git a/pkgs/applications/audio/lv2bm/default.nix b/pkgs/applications/audio/lv2bm/default.nix
index 32a4f255abee..a7c8098dd79a 100644
--- a/pkgs/applications/audio/lv2bm/default.nix
+++ b/pkgs/applications/audio/lv2bm/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   name = "lv2bm-${version}";
-  version = "git-2015-04-10";
+  version = "git-2015-11-29";
 
   src = fetchFromGitHub {
-    owner = "portalmod";
+    owner = "moddevices";
     repo = "lv2bm";
-    rev = "08681624fc13eb700ec2b5cabedbffdf095e28b3";
-    sha256 = "11pi97jy4f4c3vsaizc8a6sw9hnhnanj6y1fil33yd9x7f8f0kbj";
+    rev = "e844931503b7597f45da6d61ff506bb9fca2e9ca";
+    sha256 = "1rrz5sp04zjal6v34ldkl6fjj9xqidb8xm1iscjyljf6z4l516cx";
   };
 
   buildInputs = [ glib lilv lv2 pkgconfig serd sord sratom ];
diff --git a/pkgs/applications/audio/magnetophonDSP/faustCompressors/default.nix b/pkgs/applications/audio/magnetophonDSP/faustCompressors/default.nix
index 05e2b335f820..e526e40a1e36 100644
--- a/pkgs/applications/audio/magnetophonDSP/faustCompressors/default.nix
+++ b/pkgs/applications/audio/magnetophonDSP/faustCompressors/default.nix
@@ -1,13 +1,13 @@
 { stdenv, fetchFromGitHub, faust2jaqt, faust2lv2 }:
 stdenv.mkDerivation rec {
   name = "faustCompressors-v${version}";
-  version = "1.1.1";
+  version = "1.2";
 
   src = fetchFromGitHub {
     owner = "magnetophon";
     repo = "faustCompressors";
     rev = "v${version}";
-    sha256 = "0mkram2hm7i5za7pfn5crh2arbajk8praksxzgjx90rrxwl1y3d1";
+    sha256 = "144f6g17q4m50kxzdncsfzdyycdfprnpwdaxcwgxj4jky1xsha1d";
   };
 
   buildInputs = [ faust2jaqt faust2lv2 ];
@@ -15,6 +15,7 @@ stdenv.mkDerivation rec {
   buildPhase = ''
     for f in *.dsp;
     do
+      echo "compiling standalone from" $f
       faust2jaqt -time -double -t 99999 $f
     done
 
@@ -22,6 +23,7 @@ stdenv.mkDerivation rec {
 
     for f in *.dsp;
     do
+      echo "compiling plugin from" $f
       faust2lv2  -time -double -gui -t 99999 $f
     done
   '';
@@ -30,6 +32,7 @@ stdenv.mkDerivation rec {
     mkdir -p $out/lib/lv2
     mv *.lv2/ $out/lib/lv2
     mkdir -p $out/bin
+    rm newlib.sh
     for f in $(find . -executable -type f);
     do
       cp $f $out/bin/
diff --git a/pkgs/applications/audio/qjackctl/default.nix b/pkgs/applications/audio/qjackctl/default.nix
index 857f77bbdaf3..c5a977d741a7 100644
--- a/pkgs/applications/audio/qjackctl/default.nix
+++ b/pkgs/applications/audio/qjackctl/default.nix
@@ -1,14 +1,14 @@
 { stdenv, fetchurl, pkgconfig, alsaLib, libjack2, dbus, qtbase, qttools, qtx11extras }:
 
 stdenv.mkDerivation rec {
-  version = "0.4.4";
+  version = "0.4.5";
   name = "qjackctl-${version}";
 
   # some dependencies such as killall have to be installed additionally
 
   src = fetchurl {
     url = "mirror://sourceforge/qjackctl/${name}.tar.gz";
-    sha256 = "19bbljb3iz5ss4s5fmra1dxabg2fnp61sa51d63zsm56xkvv47ak";
+    sha256 = "1dsavjfzz5bpzc80mvfs940w9f9f47cf4r9cqxnaqrl4xilsa3f5";
   };
 
   buildInputs = [
diff --git a/pkgs/applications/audio/qmidinet/default.nix b/pkgs/applications/audio/qmidinet/default.nix
index 89f1682592aa..132e4a0fca28 100644
--- a/pkgs/applications/audio/qmidinet/default.nix
+++ b/pkgs/applications/audio/qmidinet/default.nix
@@ -1,12 +1,12 @@
 { stdenv, fetchurl, pkgconfig, qt5, alsaLib, libjack2 }:
 
 stdenv.mkDerivation rec {
-  version = "0.4.2";
+  version = "0.4.3";
   name = "qmidinet-${version}";
 
   src = fetchurl {
     url = "mirror://sourceforge/qmidinet/${name}.tar.gz";
-    sha256 = "1sdnd189db44xhl9p8pd8h4bsy8s0bn1y64lrdq7nb21mwg8ymcs";
+    sha256 = "1qhxhlvi6bj2a06i48pw81zf5vd36idxbq04g30794yhqcimh6vw";
   };
 
   hardeningDisable = [ "format" ];
diff --git a/pkgs/applications/audio/sonic-visualiser/default.nix b/pkgs/applications/audio/sonic-visualiser/default.nix
index d48f1eb851b7..bdb9911d3650 100644
--- a/pkgs/applications/audio/sonic-visualiser/default.nix
+++ b/pkgs/applications/audio/sonic-visualiser/default.nix
@@ -2,8 +2,8 @@
 
 { stdenv, fetchurl, alsaLib, bzip2, fftw, libjack2, libX11, liblo
 , libmad, libogg, librdf, librdf_raptor, librdf_rasqal, libsamplerate
-, libsndfile, pkgconfig, libpulseaudio, makeQtWrapper, qtbase, redland
-, qmakeHook, rubberband, serd, sord, vampSDK, fftwFloat
+, libsndfile, pkgconfig, libpulseaudio, qtbase, redland
+, qmake, rubberband, serd, sord, vampSDK, fftwFloat
 }:
 
 stdenv.mkDerivation rec {
@@ -16,11 +16,10 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs =
-    [ libsndfile qtbase qmakeHook fftw fftwFloat bzip2 librdf rubberband
+    [ libsndfile qtbase fftw fftwFloat bzip2 librdf rubberband
       libsamplerate vampSDK alsaLib librdf_raptor librdf_rasqal redland
       serd
       sord
-      pkgconfig
       # optional
       libjack2
       # portaudio
@@ -32,7 +31,7 @@ stdenv.mkDerivation rec {
       libX11
     ];
 
-  nativeBuildInputs = [ makeQtWrapper qmakeHook ];
+  nativeBuildInputs = [ pkgconfig qmake ];
 
   configurePhase = ''
     for i in sonic-visualiser svapp svcore svgui;
@@ -44,7 +43,6 @@ stdenv.mkDerivation rec {
     mkdir -p $out/{bin,share/sonic-visualiser}
     cp sonic-visualiser $out/bin/
     cp -r samples $out/share/sonic-visualiser/
-    wrapQtProgram "$out/bin/sonic-visualiser"
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/audio/sorcer/default.nix b/pkgs/applications/audio/sorcer/default.nix
index ef28180cc3b2..979f15d4006b 100644
--- a/pkgs/applications/audio/sorcer/default.nix
+++ b/pkgs/applications/audio/sorcer/default.nix
@@ -1,12 +1,14 @@
-{ stdenv, fetchurl, boost, cairomm, cmake, libsndfile, lv2, ntk, pkgconfig, python }:
+{ stdenv, fetchFromGitHub , boost, cairomm, cmake, libsndfile, lv2, ntk, pkgconfig, python }:
 
 stdenv.mkDerivation rec {
   name = "sorcer-${version}";
-  version = "1.1.1";
+  version = "1.1.3";
 
-  src = fetchurl {
-    url = "https://github.com/harryhaaren/openAV-Sorcer/archive/release-${version}.tar.gz";
-    sha256 = "1jkhs2rhn4givac7rlbj8067r7qq6jnj3ixabb346nw7pd6gn1wn";
+  src = fetchFromGitHub {
+    owner = "openAVproductions";
+    repo = "openAV-Sorcer";
+    rev = "release-${version}";
+    sha256 = "1x7pi77nal10717l02qpnhrx6d7w5nqrljkn9zx5w7gpb8fpb3vp";
   };
 
   buildInputs = [ boost cairomm cmake libsndfile lv2 ntk pkgconfig python ];
diff --git a/pkgs/applications/audio/x42-plugins/default.nix b/pkgs/applications/audio/x42-plugins/default.nix
index a0fcfe811024..75368c6633be 100644
--- a/pkgs/applications/audio/x42-plugins/default.nix
+++ b/pkgs/applications/audio/x42-plugins/default.nix
@@ -3,12 +3,12 @@
 , mesa_glu, lv2, gtk2, cairo, pango, fftwFloat, zita-convolver }:
 
 stdenv.mkDerivation rec {
-  version = "20161230";
+  version = "20170428";
   name = "x42-plugins-${version}";
 
   src = fetchurl {
     url = "http://gareus.org/misc/x42-plugins/${name}.tar.xz";
-    sha256 = "1yni9c17kl2pi9lqxip07b6g6lyfii1pch5czp183113gk54fwj5";
+    sha256 = "0yi82rak2277x4nzzr5zwbsnha5pi61w975c8src2iwar2b6m0xg";
   };
 
   buildInputs = [ mesa_glu ftgl freefont_ttf libjack2 libltc libsndfile libsamplerate lv2 gtk2 cairo pango fftwFloat pkgconfig  zita-convolver];
diff --git a/pkgs/applications/audio/zynaddsubfx/default.nix b/pkgs/applications/audio/zynaddsubfx/default.nix
index ec803f2a9c52..42fe3e34cd42 100644
--- a/pkgs/applications/audio/zynaddsubfx/default.nix
+++ b/pkgs/applications/audio/zynaddsubfx/default.nix
@@ -1,17 +1,17 @@
-{ stdenv, fetchurl, alsaLib, cmake, libjack2, fftw, fltk13, libjpeg
-, minixml, pkgconfig, zlib, liblo
+{ stdenv, fetchurl, alsaLib, cairo, cmake, libjack2, fftw, fltk13, lash,  libjpeg
+, libXpm, minixml, ntk, pkgconfig, zlib, liblo
 }:
 
 stdenv.mkDerivation  rec {
   name = "zynaddsubfx-${version}";
-  version = "2.5.4";
+  version = "3.0.1";
 
   src = fetchurl {
     url = "mirror://sourceforge/zynaddsubfx/zynaddsubfx-${version}.tar.bz2";
-    sha256 = "16llaa2wg2gbgjhwp3632b2vx9jvanj4csv7d41k233ms6d1sjq1";
+    sha256 = "1qijvlbv41lnqaqbp6gh1i42xzf1syviyxz8wr39xbz55cw7y0d8";
   };
 
-  buildInputs = [ alsaLib libjack2 fftw fltk13 libjpeg minixml zlib liblo ];
+  buildInputs = [ alsaLib cairo libjack2 fftw fltk13 lash libjpeg libXpm minixml ntk zlib liblo ];
   nativeBuildInputs = [ cmake pkgconfig ];
 
   hardeningDisable = [ "format" ];
diff --git a/pkgs/applications/display-managers/sddm/default.nix b/pkgs/applications/display-managers/sddm/default.nix
index d1f487b37acf..d54fb455fcb1 100644
--- a/pkgs/applications/display-managers/sddm/default.nix
+++ b/pkgs/applications/display-managers/sddm/default.nix
@@ -1,121 +1,72 @@
-{ stdenv, lib, makeQtWrapper, fetchFromGitHub, fetchpatch
+{ mkDerivation, lib, copyPathsToStore, fetchFromGitHub, fetchpatch
 , cmake, extra-cmake-modules, pkgconfig, libxcb, libpthreadstubs, lndir
 , libXdmcp, libXau, qtbase, qtdeclarative, qttools, pam, systemd
-, themes
 }:
 
 let
-  version = "0.14.0";
-
-  unwrapped = stdenv.mkDerivation rec {
-    name = "sddm-unwrapped-${version}";
-
-    src = fetchFromGitHub {
-      owner = "sddm";
-      repo = "sddm";
-      rev = "v${version}";
-      sha256 = "0wwid23kw0725zpw67zchalg9mmharr7sn4yzhijq7wqpsczjfxj";
-    };
-
-    patches = [
-      ./0001-ignore-config-mtime.patch
-      (fetchpatch { /* Fix display of user avatars. */
-        url = https://github.com/sddm/sddm/commit/ecb903e48822bd90650bdd64fe80754e3e9664cb.patch;
-        sha256 = "0zm88944pwdad8grmv0xwnxl23xml85ryc71x2xac233jxdyx6ms";
-      })
-    ];
-
-    postPatch =
-      # Module Qt5::Test must be included in `find_package` before it is used.
-      ''
-        sed -i CMakeLists.txt -e '/find_package(Qt5/ s|)| Test)|'
-      '';
-
-    nativeBuildInputs = [ cmake extra-cmake-modules pkgconfig qttools ];
-
-    buildInputs = [
-      libxcb libpthreadstubs libXdmcp libXau pam systemd
-    ];
-
-    propagatedBuildInputs = [
-      qtbase qtdeclarative
-    ];
-
-    cmakeFlags = [
-      "-DCONFIG_FILE=/etc/sddm.conf"
-      # Set UID_MIN and UID_MAX so that the build script won't try
-      # to read them from /etc/login.defs (fails in chroot).
-      # The values come from NixOS; they may not be appropriate
-      # for running SDDM outside NixOS, but that configuration is
-      # not supported anyway.
-      "-DUID_MIN=1000"
-      "-DUID_MAX=29999"
-    ];
-
-    preConfigure = ''
-      export cmakeFlags="$cmakeFlags -DQT_IMPORTS_DIR=$out/lib/qt5/qml -DCMAKE_INSTALL_SYSCONFDIR=$out/etc -DSYSTEMD_SYSTEM_UNIT_DIR=$out/lib/systemd/system"
-    '';
 
-    enableParallelBuilding = true;
-
-    postInstall = ''
-      # remove empty scripts
-      rm "$out/share/sddm/scripts/Xsetup" "$out/share/sddm/scripts/Xstop"
-    '';
+  version = "0.14.0";
 
-    meta = with stdenv.lib; {
-      description = "QML based X11 display manager";
-      homepage = "https://github.com/sddm/sddm";
-      platforms = platforms.linux;
-      maintainers = with maintainers; [ abbradar ttuegel ];
-    };
+  /* Fix display of user avatars. */
+  patchFixUserAvatars = fetchpatch {
+    url = https://github.com/sddm/sddm/commit/ecb903e48822bd90650bdd64fe80754e3e9664cb.patch;
+    sha256 = "0zm88944pwdad8grmv0xwnxl23xml85ryc71x2xac233jxdyx6ms";
   };
 
-in
-
-stdenv.mkDerivation {
-  name = "sddm-${version}";
-
-  nativeBuildInputs = [ lndir makeQtWrapper ];
-  buildInputs = [ unwrapped ] ++ themes;
-  themes = map (pkg: pkg.out or pkg) themes;
-  inherit unwrapped;
-
-  unpackPhase = "true";
-  configurePhase = "runHook preConfigure; runHook postConfigure";
-  buildPhase = "runHook preBuild; runHook postBuild";
+in mkDerivation rec {
+  name = "sddm-unwrapped-${version}";
 
-  installPhase = ''
-    runHook preInstall
-
-    propagated=
-    for i in $unwrapped $themes; do
-      findInputs $i propagated propagated-user-env-packages
-      if [ -z "$crossConfig" ]; then
-          findInputs $i propagated propagated-native-build-inputs
-      else
-          findInputs $i propagated propagated-build-inputs
-      fi
-    done
+  src = fetchFromGitHub {
+    owner = "sddm";
+    repo = "sddm";
+    rev = "v${version}";
+    sha256 = "0wwid23kw0725zpw67zchalg9mmharr7sn4yzhijq7wqpsczjfxj";
+  };
 
-    for pkg in $propagated; do
-      addToSearchPath RUNTIME_XDG_DATA_DIRS "$pkg/share"
-      addToSearchPath RUNTIME_XDG_CONFIG_DIRS "$pkg/etc/xdg"
-    done
+  patches =
+    copyPathsToStore (lib.readPathsFromFile ./. ./series)
+    ++ [ patchFixUserAvatars ];
 
-    mkdir -p "$out/bin"
-    makeQtWrapper "$unwrapped/bin/sddm" "$out/bin/sddm"
+  postPatch =
+    # Module Qt5::Test must be included in `find_package` before it is used.
+    ''
+      sed -i CMakeLists.txt -e '/find_package(Qt5/ s|)| Test)|'
+    '';
 
-    mkdir -p "$out/share/sddm"
-    for pkg in $unwrapped $themes; do
-        local sddmDir="$pkg/share/sddm"
-        if [ -d "$sddmDir" ]; then
-            lndir -silent "$sddmDir" "$out/share/sddm"
-        fi
-    done
+  nativeBuildInputs = [ cmake extra-cmake-modules pkgconfig qttools ];
+
+  buildInputs = [
+    libxcb libpthreadstubs libXdmcp libXau pam systemd
+  ];
+
+  propagatedBuildInputs = [
+    qtbase qtdeclarative
+  ];
+
+  cmakeFlags = [
+    "-DCONFIG_FILE=/etc/sddm.conf"
+    # Set UID_MIN and UID_MAX so that the build script won't try
+    # to read them from /etc/login.defs (fails in chroot).
+    # The values come from NixOS; they may not be appropriate
+    # for running SDDM outside NixOS, but that configuration is
+    # not supported anyway.
+    "-DUID_MIN=1000"
+    "-DUID_MAX=29999"
+  ];
+
+  preConfigure = ''
+    export cmakeFlags="$cmakeFlags -DQT_IMPORTS_DIR=$out/$qtQmlPrefix -DCMAKE_INSTALL_SYSCONFDIR=$out/etc -DSYSTEMD_SYSTEM_UNIT_DIR=$out/lib/systemd/system"
+  '';
 
-    runHook postInstall
+  postInstall = ''
+    # remove empty scripts
+    rm "$out/share/sddm/scripts/Xsetup" "$out/share/sddm/scripts/Xstop"
   '';
 
-  inherit (unwrapped) meta;
+  meta = with lib; {
+    description = "QML based X11 display manager";
+    homepage = "https://github.com/sddm/sddm";
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ abbradar ttuegel ];
+  };
 }
diff --git a/pkgs/applications/display-managers/sddm/0001-ignore-config-mtime.patch b/pkgs/applications/display-managers/sddm/sddm-ignore-config-mtime.patch
index 836df2de292d..836df2de292d 100644
--- a/pkgs/applications/display-managers/sddm/0001-ignore-config-mtime.patch
+++ b/pkgs/applications/display-managers/sddm/sddm-ignore-config-mtime.patch
diff --git a/pkgs/applications/display-managers/sddm/series b/pkgs/applications/display-managers/sddm/series
new file mode 100644
index 000000000000..cb6ea65fedb1
--- /dev/null
+++ b/pkgs/applications/display-managers/sddm/series
@@ -0,0 +1 @@
+sddm-ignore-config-mtime.patch
\ No newline at end of file
diff --git a/pkgs/applications/editors/atom/default.nix b/pkgs/applications/editors/atom/default.nix
index e936c8a5a7c6..39fe8fcb77e6 100644
--- a/pkgs/applications/editors/atom/default.nix
+++ b/pkgs/applications/editors/atom/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "atom-${version}";
-  version = "1.17.2";
+  version = "1.18.0";
 
   src = fetchurl {
     url = "https://github.com/atom/atom/releases/download/v${version}/atom-amd64.deb";
-    sha256 = "05lf9f5c9l111prx7d76cr5h8h340vm7vb8hra5rdrqhjpdvwhhn";
+    sha256 = "07hssch8sfyp5sji91lx4v62m8zmy9j971i968p747dwfp6g0my6";
     name = "${name}.deb";
   };
 
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
 
   buildCommand = ''
     mkdir -p $out/usr/
-    ar p $src data.tar.gz | tar -C $out -xz ./usr
+    ar p $src data.tar.xz | tar -C $out -xJ ./usr
     substituteInPlace $out/usr/share/applications/atom.desktop \
       --replace /usr/share/atom $out/bin
     mv $out/usr/* $out/
diff --git a/pkgs/applications/editors/kdevelop5/kdevelop.nix b/pkgs/applications/editors/kdevelop5/kdevelop.nix
index c599666f4d52..bbd9be220744 100644
--- a/pkgs/applications/editors/kdevelop5/kdevelop.nix
+++ b/pkgs/applications/editors/kdevelop5/kdevelop.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, gettext, pkgconfig, extra-cmake-modules, makeQtWrapper
+{ mkDerivation, lib, fetchurl, cmake, gettext, pkgconfig, extra-cmake-modules
 , qtquickcontrols, qtwebkit, qttools, kde-cli-tools
 , kconfig, kdeclarative, kdoctools, kiconthemes, ki18n, kitemmodels, kitemviews
 , kjobwidgets, kcmutils, kio, knewstuff, knotifyconfig, kparts, ktexteditor
@@ -12,7 +12,7 @@ let
   version = "5.1.1";
 
 in
-stdenv.mkDerivation rec {
+mkDerivation rec {
   name = "${pname}-${version}";
 
   src = fetchurl {
@@ -21,24 +21,26 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [
-    cmake gettext pkgconfig extra-cmake-modules makeWrapper makeQtWrapper
+    cmake gettext pkgconfig extra-cmake-modules makeWrapper
   ];
 
   buildInputs = [
+    kdevelop-pg-qt
+    llvmPackages.llvm llvmPackages.clang-unwrapped
+  ];
+
+  propagatedBuildInputs = [
     qtquickcontrols qtwebkit
     kconfig kdeclarative kdoctools kiconthemes ki18n kitemmodels kitemviews
     kjobwidgets kcmutils kio knewstuff knotifyconfig kparts ktexteditor
     threadweaver kxmlgui kwindowsystem grantlee plasma-framework krunner
-    kdevplatform kdevelop-pg-qt shared_mime_info libksysguard konsole.unwrapped
-    llvmPackages.llvm llvmPackages.clang-unwrapped
+    kdevplatform shared_mime_info libksysguard konsole
   ];
 
   postInstall = ''
-    wrapQtProgram "$out/bin/kdevelop"
-    
     # The kdevelop! script (shell environment) needs qdbus and kioclient5 in PATH.
     wrapProgram "$out/bin/kdevelop!" --prefix PATH ":" "${qttools}/bin:${kde-cli-tools}/bin"
-    
+
     # Fix the (now wrapped) kdevelop! to find things in right places:
     # - Make KDEV_BASEDIR point to bin directory of kdevplatform.
     kdev_fixup_sed="s|^export KDEV_BASEDIR=.*$|export KDEV_BASEDIR=${kdevplatform}/bin|"
@@ -47,7 +49,7 @@ stdenv.mkDerivation rec {
     sed -E -i "$kdev_fixup_sed" "$out/bin/.kdevelop!-wrapped"
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     maintainers = [ maintainers.ambrop72 ];
     platforms = platforms.linux;
     description = "KDE official IDE";
@@ -60,6 +62,6 @@ stdenv.mkDerivation rec {
         libraries and is under development since 1998.
       '';
     homepage = https://www.kdevelop.org;
-    license = with stdenv.lib.licenses; [ gpl2Plus lgpl2Plus ];
+    license = with licenses; [ gpl2Plus lgpl2Plus ];
   };
 }
diff --git a/pkgs/applications/editors/kdevelop5/kdevplatform.nix b/pkgs/applications/editors/kdevelop5/kdevplatform.nix
index d3680aff3d85..3efc1335c075 100644
--- a/pkgs/applications/editors/kdevelop5/kdevplatform.nix
+++ b/pkgs/applications/editors/kdevelop5/kdevplatform.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, fetchpatch, cmake, gettext, pkgconfig, extra-cmake-modules, makeQtWrapper
+{ stdenv, fetchurl, fetchpatch, cmake, gettext, pkgconfig, extra-cmake-modules
 , boost, subversion, apr, aprutil
 , qtscript, qtwebkit, grantlee, karchive, kconfig, kcoreaddons, kguiaddons, kiconthemes, ki18n
 , kitemmodels, kitemviews, kio, kparts, sonnet, kcmutils, knewstuff, knotifications
@@ -11,7 +11,7 @@ let
 in
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
-  
+
   src = fetchurl {
     url = "mirror://kde/stable/kdevelop/${version}/src/${name}.tar.xz";
     sha256 = "3159440512b1373c1a4b35f401ba1f81217de9578372b45137af141eeda6e726";
@@ -25,9 +25,8 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  nativeBuildInputs = [ cmake gettext pkgconfig extra-cmake-modules makeQtWrapper ];
+  nativeBuildInputs = [ cmake gettext pkgconfig extra-cmake-modules ];
 
-  propagatedBuildInputs = [ ];
   buildInputs = [
     boost subversion apr aprutil
     qtscript qtwebkit grantlee karchive kconfig kcoreaddons kguiaddons kiconthemes
diff --git a/pkgs/applications/editors/kile/default.nix b/pkgs/applications/editors/kile/default.nix
index fa8d4d8313ea..259c319c70ff 100644
--- a/pkgs/applications/editors/kile/default.nix
+++ b/pkgs/applications/editors/kile/default.nix
@@ -1,9 +1,9 @@
-{ kdeDerivation
+{ mkDerivation
 , lib
 , fetchgit
 , extra-cmake-modules
 , kdoctools
-, kdeWrapper
+, wrapGAppsHook
 , qtscript
 , kconfig
 , kcrash
@@ -21,50 +21,43 @@
 , poppler
 }:
 
-let
-  unwrapped =
-    kdeDerivation rec {
-      name = "kile-${version}";
-      version = "2017-02-09";
+mkDerivation rec {
+  name = "kile-${version}";
+  version = "2017-02-09";
 
-      src = fetchgit {
-        url = git://anongit.kde.org/kile.git;
-        rev = "f77f6e627487c152f111e307ad6dc71699ade746";
-        sha256 = "0wpqaix9ssa28cm7qqjj0zfrscjgk8s3kmi5b4kk8h583gsrikib";
+  src = fetchgit {
+    url = git://anongit.kde.org/kile.git;
+    rev = "f77f6e627487c152f111e307ad6dc71699ade746";
+    sha256 = "0wpqaix9ssa28cm7qqjj0zfrscjgk8s3kmi5b4kk8h583gsrikib";
 
-      };
+  };
 
-      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules wrapGAppsHook ];
 
-      buildInputs = [
-        kconfig
-        kcrash
-        kdbusaddons
-        kdelibs4support
-        kdoctools
-        kguiaddons
-        kiconthemes
-        kinit
-        khtml
-        kparts
-        ktexteditor
-        kwindowsystem
-        okular.unwrapped
-        poppler
-        qtscript
-      ];
+  propagatedBuildInputs = [
+    kconfig
+    kcrash
+    kdbusaddons
+    kdelibs4support
+    kdoctools
+    kguiaddons
+    kiconthemes
+    kinit
+    khtml
+    kparts
+    ktexteditor
+    kwindowsystem
+    okular
+    poppler
+    qtscript
+  ];
 
-      meta = {
-        description = "Kile is a user friendly TeX/LaTeX authoring tool for the KDE desktop environment";
-        homepage = https://www.kde.org/applications/office/kile/;
-        maintainers = with lib.maintainers; [ fridh ];
-        license = lib.licenses.gpl2Plus;
-      };
-    };
-in
-kdeWrapper
-{
-  inherit unwrapped;
-  targets = [ "bin/kile" ];
-  paths = [ konsole.unwrapped okular.unwrapped ];
+  propagatedUserEnvPkgs = [ konsole ];
+
+  meta = {
+    description = "Kile is a user friendly TeX/LaTeX authoring tool for the KDE desktop environment";
+    homepage = https://www.kde.org/applications/office/kile/;
+    maintainers = with lib.maintainers; [ fridh ];
+    license = lib.licenses.gpl2Plus;
+  };
 }
diff --git a/pkgs/applications/editors/neovim/qt.nix b/pkgs/applications/editors/neovim/qt.nix
index 57f52f0e5fcf..e24ca50a0247 100644
--- a/pkgs/applications/editors/neovim/qt.nix
+++ b/pkgs/applications/editors/neovim/qt.nix
@@ -1,5 +1,5 @@
-{ stdenv, fetchFromGitHub, cmake, doxygen
-, libmsgpack, makeQtWrapper, neovim, pythonPackages, qtbase }:
+{ stdenv, fetchFromGitHub, cmake, doxygen, makeWrapper
+, libmsgpack, neovim, pythonPackages, qtbase }:
 
 stdenv.mkDerivation rec {
   name = "neovim-qt-${version}";
@@ -31,7 +31,7 @@ stdenv.mkDerivation rec {
     jinja2 msgpack python
   ]);
 
-  nativeBuildInputs = [ cmake doxygen makeQtWrapper ];
+  nativeBuildInputs = [ cmake doxygen makeWrapper ];
 
   enableParallelBuilding = true;
 
@@ -43,7 +43,7 @@ stdenv.mkDerivation rec {
   '';
 
   postInstall = ''
-    wrapQtProgram "$out/bin/nvim-qt" \
+    wrapProgram "$out/bin/nvim-qt" \
       --prefix PATH : "${neovim}/bin"
   '';
 
diff --git a/pkgs/applications/editors/rstudio/default.nix b/pkgs/applications/editors/rstudio/default.nix
index eab1228da1ac..9ac91e7086ab 100644
--- a/pkgs/applications/editors/rstudio/default.nix
+++ b/pkgs/applications/editors/rstudio/default.nix
@@ -10,7 +10,8 @@ in
 stdenv.mkDerivation rec {
   name = "RStudio-${version}";
 
-  buildInputs = [ cmake boost163 zlib openssl R qt5.full qt5.qtwebkit qt5.qmakeHook libuuid unzip ant jdk makeWrapper pandoc ];
+  buildInputs = [ cmake boost163 zlib openssl R qt5.full qt5.qtwebkit libuuid unzip ant jdk makeWrapper pandoc ];
+  nativeBuildInputs = [ qt5.qmake ];
 
   src = fetchurl {
     url = "https://github.com/rstudio/rstudio/archive/v${version}.tar.gz";
@@ -90,7 +91,7 @@ stdenv.mkDerivation rec {
       cp ${pandoc}/bin/pandoc dependencies/common/pandoc/
     '';
 
-  cmakeFlags = [ "-DRSTUDIO_TARGET=Desktop" "-DQT_QMAKE_EXECUTABLE=${qt5.qmakeHook}/bin/qmake" ];
+  cmakeFlags = [ "-DRSTUDIO_TARGET=Desktop" "-DQT_QMAKE_EXECUTABLE=${qt5.qmake}/bin/qmake" ];
 
   desktopItem = makeDesktopItem {
     name = name;
diff --git a/pkgs/applications/editors/tiled/default.nix b/pkgs/applications/editors/tiled/default.nix
index be518b9336a8..9bfa3998926f 100644
--- a/pkgs/applications/editors/tiled/default.nix
+++ b/pkgs/applications/editors/tiled/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkgconfig, qmakeHook
+{ stdenv, fetchFromGitHub, pkgconfig, qmake
 , python, qtbase, qttools, zlib }:
 
 let
@@ -14,7 +14,7 @@ in stdenv.mkDerivation rec {
     sha256 = "087jl36g6w2g5l70gz573iwyvx3r7i8fijl3y4mmmf8pyqdyq1n2";
   };
 
-  nativeBuildInputs = [ pkgconfig qmakeHook ];
+  nativeBuildInputs = [ pkgconfig qmake ];
   buildInputs = [ python qtbase qttools ];
 
   enableParallelBuilding = true;
diff --git a/pkgs/applications/graphics/ImageMagick/7.0.nix b/pkgs/applications/graphics/ImageMagick/7.0.nix
index 7455736ed024..bcad077b38c9 100644
--- a/pkgs/applications/graphics/ImageMagick/7.0.nix
+++ b/pkgs/applications/graphics/ImageMagick/7.0.nix
@@ -12,8 +12,8 @@ let
     else throw "ImageMagick is not supported on this platform.";
 
   cfg = {
-    version = "7.0.5-7";
-    sha256 = "11k53193az0bvdhp4gz2g9p8fb6r5fr1h74dnfx6ijfnfj80hbgp";
+    version = "7.0.6-0";
+    sha256 = "1vl9mkdp5pskl4lxd1p79ayv1k3gxpa8iz992d302qyllhm7wn1i";
     patches = [];
   };
 in
diff --git a/pkgs/applications/graphics/ImageMagick/default.nix b/pkgs/applications/graphics/ImageMagick/default.nix
index 052d424376d3..8f4d44932f59 100644
--- a/pkgs/applications/graphics/ImageMagick/default.nix
+++ b/pkgs/applications/graphics/ImageMagick/default.nix
@@ -12,8 +12,8 @@ let
     else throw "ImageMagick is not supported on this platform.";
 
   cfg = {
-    version = "6.9.8-9";
-    sha256 = "0wr6wcmvaw62f6pkgnpqnjmp331wfwmds9wmqzr4zv53s9k1lkzn";
+    version = "6.9.8-10";
+    sha256 = "040qs7nwcm84bjd9wryvd58zqfykbmn3y3qfc90lnldww7v6ihlg";
     patches = [];
   }
     # Freeze version on mingw so we don't need to port the patch too often.
diff --git a/pkgs/applications/graphics/awesomebump/default.nix b/pkgs/applications/graphics/awesomebump/default.nix
index b89e18ed148c..9e0916bab9cf 100644
--- a/pkgs/applications/graphics/awesomebump/default.nix
+++ b/pkgs/applications/graphics/awesomebump/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, qtbase, qmakeHook, makeWrapper }:
+{ lib, stdenv, fetchurl, qtbase, qmake, makeWrapper }:
 
 stdenv.mkDerivation {
   name = "awesomebump-4.0";
@@ -10,7 +10,8 @@ stdenv.mkDerivation {
 
   setSourceRoot = "sourceRoot=$(echo */Sources)";
 
-  buildInputs = [ qtbase qmakeHook makeWrapper ];
+  nativeBuildInputs = [ makeWrapper qmake ];
+  buildInputs = [ qtbase ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/applications/graphics/digikam/default.nix b/pkgs/applications/graphics/digikam/default.nix
index f11791016923..96b1ca54d558 100644
--- a/pkgs/applications/graphics/digikam/default.nix
+++ b/pkgs/applications/graphics/digikam/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, extra-cmake-modules, makeQtWrapper
+{ mkDerivation, lib, fetchurl, cmake, extra-cmake-modules, wrapGAppsHook
 
 # For `digitaglinktree`
 , perl, sqlite
@@ -44,7 +44,7 @@
 , oxygen
 }:
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   name    = "digikam-${version}";
   version = "5.4.0";
 
@@ -53,26 +53,11 @@ stdenv.mkDerivation rec {
     sha256 = "0dgsgji14l5zvxny36hrfsp889fsfrsbbn9bg57m18404xp903kg";
   };
 
-  nativeBuildInputs = [ cmake extra-cmake-modules makeQtWrapper ];
+  nativeBuildInputs = [ cmake extra-cmake-modules kdoctools wrapGAppsHook ];
 
   patches = [ ./0001-Disable-fno-operator-names.patch ];
 
   buildInputs = [
-    qtbase
-    qtxmlpatterns
-    qtsvg
-    qtwebkit
-
-    kconfigwidgets
-    kcoreaddons
-    kdoctools
-    kfilemetadata
-    knotifications
-    knotifyconfig
-    ktextwidgets
-    kwidgetsaddons
-    kxmlgui
-
     bison
     boost
     eigen
@@ -86,12 +71,28 @@ stdenv.mkDerivation rec {
     liblqr1
     libqtav
     libusb1
-    marble.unwrapped
     mysql
     opencv
-    threadweaver
+  ];
 
+  propagatedBuildInputs = [
+    qtbase
+    qtxmlpatterns
+    qtsvg
+    qtwebkit
+
+    kconfigwidgets
+    kcoreaddons
+    kfilemetadata
+    knotifications
+    knotifyconfig
+    ktextwidgets
+    kwidgetsaddons
+    kxmlgui
+
+    marble
     oxygen
+    threadweaver
   ];
 
   enableParallelBuilding = true;
@@ -104,22 +105,18 @@ stdenv.mkDerivation rec {
     "-DENABLE_MEDIAPLAYER=1"
   ];
 
-  fixupPhase = ''
+  preFixup = ''
+    gappsWrapperArgs+=(--prefix PATH : ${lib.makeBinPath [ gnumake hugin enblend-enfuse ]})
     substituteInPlace $out/bin/digitaglinktree \
       --replace "/usr/bin/perl" "${perl}/bin/perl" \
       --replace "/usr/bin/sqlite3" "${sqlite}/bin/sqlite3"
-
-    wrapQtProgram $out/bin/digikam \
-      --prefix PATH : "${gnumake}/bin:${hugin}/bin:${enblend-enfuse}/bin"
-
-    wrapQtProgram $out/bin/showfoto
   '';
 
-  meta = {
+  meta = with lib; {
     description = "Photo Management Program";
-    license = stdenv.lib.licenses.gpl2;
+    license = licenses.gpl2;
     homepage = http://www.digikam.org;
-    maintainers = with stdenv.lib.maintainers; [ the-kenny ];
-    platforms = stdenv.lib.platforms.linux;
+    maintainers = with maintainers; [ the-kenny ];
+    platforms = platforms.linux;
   };
 }
diff --git a/pkgs/applications/graphics/feh/default.nix b/pkgs/applications/graphics/feh/default.nix
index 035a275618cf..b7949b4d4f97 100644
--- a/pkgs/applications/graphics/feh/default.nix
+++ b/pkgs/applications/graphics/feh/default.nix
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
     sha256 = "09f5rfzls4h5jcrp7ylwbiljp5qzc2nbw9p2csv0pnlaixj69gil";
   };
 
-  outputs = [ "out" "doc" ];
+  outputs = [ "out" "man" "doc" ];
 
   nativeBuildInputs = [ makeWrapper xorg.libXt ]
     ++ optionals doCheck [ perlPackages.TestCommand perlPackages.TestHarness ];
@@ -22,13 +22,20 @@ stdenv.mkDerivation rec {
 
   preBuild = ''
     makeFlags="PREFIX=$out exif=1"
-      '';
+  '';
+
+  postBuild = ''
+    pushd man
+    make
+    popd
+  '';
 
   postInstall = ''
     wrapProgram "$out/bin/feh" --prefix PATH : "${libjpeg.bin}/bin" \
-                               --add-flags '--theme=feh' 
-        '';
-  
+                               --add-flags '--theme=feh'
+    install -D -m 644 man/*.1 $out/share/man/man1
+  '';
+
   checkPhase = ''
     PERL5LIB="${perlPackages.TestCommand}/lib/perl5/site_perl" make test
   '';
diff --git a/pkgs/applications/graphics/ipe/default.nix b/pkgs/applications/graphics/ipe/default.nix
index 4a99d0ea4a17..2b1b1f8da8a6 100644
--- a/pkgs/applications/graphics/ipe/default.nix
+++ b/pkgs/applications/graphics/ipe/default.nix
@@ -1,6 +1,5 @@
-{ stdenv, fetchurl, pkgconfig, zlib, freetype, cairo, lua5, texlive, ghostscript
+{ stdenv, fetchurl, makeWrapper, pkgconfig, zlib, freetype, cairo, lua5, texlive, ghostscript
 , libjpeg, qtbase
-, makeQtWrapper
 }:
 
 stdenv.mkDerivation rec {
@@ -28,14 +27,14 @@ stdenv.mkDerivation rec {
   LUA_PACKAGE = "lua";
 
   buildInputs = [
-    libjpeg pkgconfig zlib qtbase freetype cairo lua5 texlive ghostscript
+    libjpeg zlib qtbase freetype cairo lua5 texlive ghostscript
   ];
 
-  nativeBuildInputs = [ makeQtWrapper ];
+  nativeBuildInputs = [ makeWrapper pkgconfig ];
 
   postFixup = ''
     for prog in $out/bin/*; do
-      wrapQtProgram "$prog" --prefix PATH : "${texlive}/bin"
+      wrapProgram "$prog" --prefix PATH : "${texlive}/bin"
     done
   '';
 
diff --git a/pkgs/applications/graphics/krita/default.nix b/pkgs/applications/graphics/krita/default.nix
index c82d1565a550..121afdf2084b 100644
--- a/pkgs/applications/graphics/krita/default.nix
+++ b/pkgs/applications/graphics/krita/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, cmake, extra-cmake-modules, makeQtWrapper
+{ mkDerivation, lib, fetchurl, cmake, extra-cmake-modules
 , karchive, kconfig, kwidgetsaddons, kcompletion, kcoreaddons
 , kguiaddons, ki18n, kitemmodels, kitemviews, kwindowsystem
 , kio, kcrash
@@ -6,7 +6,7 @@
 , openjpeg, opencolorio, vc, poppler_qt5, curl, ilmbase
 }:
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   name = "krita-${version}";
   ver_min = "3.1.3";
   version = "${ver_min}";
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
     sha256 = "125js6c8aw4bqhs28pwnl3rbgqx5yx4zsklw7bfdhy3vf6lrysw1";
   };
 
-  nativeBuildInputs = [ cmake extra-cmake-modules makeQtWrapper ];
+  nativeBuildInputs = [ cmake extra-cmake-modules ];
 
   buildInputs = [
     karchive kconfig kwidgetsaddons kcompletion kcoreaddons kguiaddons
@@ -27,15 +27,7 @@ stdenv.mkDerivation rec {
 
   NIX_CFLAGS_COMPILE = [ "-I${ilmbase.dev}/include/OpenEXR" ];
 
-  enableParallelBuilding = true;
-
-  postInstall = ''
-    for i in $out/bin/*; do
-      wrapQtProgram "$i"
-    done
-  '';
-
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A free an open source painting application";
     homepage = "https://krita.org/";
     maintainers = with maintainers; [ abbradar ];
diff --git a/pkgs/applications/graphics/photoqt/default.nix b/pkgs/applications/graphics/photoqt/default.nix
index f9b24581929a..d6bcdee41375 100644
--- a/pkgs/applications/graphics/photoqt/default.nix
+++ b/pkgs/applications/graphics/photoqt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, makeQtWrapper, exiv2, graphicsmagick
+{ stdenv, fetchurl, cmake, exiv2, graphicsmagick
 , qtbase, qtdeclarative, qtmultimedia, qtquickcontrols, qttools
 }:
 
@@ -12,8 +12,9 @@ stdenv.mkDerivation rec {
     sha256 = "0j2kvxfb5pd9abciv161nkcsyam6n8kfqs8ymwj2mxiqflwbmfl1";
   };
 
+  nativeBuildInputs = [ cmake ];
   buildInputs = [
-    cmake makeQtWrapper qtbase qtquickcontrols qttools exiv2 graphicsmagick
+    qtbase qtquickcontrols qttools exiv2 graphicsmagick
     qtmultimedia qtdeclarative
   ];
 
@@ -21,10 +22,6 @@ stdenv.mkDerivation rec {
     export MAGICK_LOCATION="${graphicsmagick}/include/GraphicsMagick"
   '';
 
-  postInstall = ''
-    wrapQtProgram $out/bin/photoqt
-  '';
-
   meta = {
     homepage = "http://photoqt.org/";
     description = "Simple, yet powerful and good looking image viewer";
diff --git a/pkgs/applications/graphics/phototonic/default.nix b/pkgs/applications/graphics/phototonic/default.nix
index 4782376d1e0b..8ce9d407aade 100644
--- a/pkgs/applications/graphics/phototonic/default.nix
+++ b/pkgs/applications/graphics/phototonic/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, qtbase, qmakeHook, exiv2 }:
+{ stdenv, fetchFromGitHub, qtbase, qmake, exiv2 }:
 
 stdenv.mkDerivation rec {
   name = "phototonic-${version}";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ qtbase exiv2 ];
-  nativeBuildInputs = [ qmakeHook ];
+  nativeBuildInputs = [ qmake ];
 
   preConfigure = ''
     sed -i 's;/usr;$$PREFIX/;g' phototonic.pro
diff --git a/pkgs/applications/graphics/rapcad/default.nix b/pkgs/applications/graphics/rapcad/default.nix
index b7672a39d0df..451eaae79b2e 100644
--- a/pkgs/applications/graphics/rapcad/default.nix
+++ b/pkgs/applications/graphics/rapcad/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchFromGitHub, fetchurl, cgal, boost, gmp, mpfr, flex, bison, dxflib, readline
-, qtbase, qmakeHook, mesa_glu
+, qtbase, qmake, mesa_glu
 }:
 
 stdenv.mkDerivation rec {
@@ -21,7 +21,7 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  nativeBuildInputs = [ qmakeHook ];
+  nativeBuildInputs = [ qmake ];
   buildInputs = [ qtbase cgal boost gmp mpfr flex bison dxflib readline mesa_glu ];
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/graphics/renderdoc/default.nix b/pkgs/applications/graphics/renderdoc/default.nix
index be4457c932fa..d69f9a676c1b 100644
--- a/pkgs/applications/graphics/renderdoc/default.nix
+++ b/pkgs/applications/graphics/renderdoc/default.nix
@@ -1,5 +1,5 @@
-{ stdenv, fetchFromGitHub, cmake, qtbase, qtx11extras
-, pkgconfig, xorg, makeQtWrapper, vulkan-loader
+{ stdenv, fetchFromGitHub, cmake, makeWrapper, pkgconfig
+, qtbase, qtx11extras, vulkan-loader, xorg
 }:
 
 stdenv.mkDerivation rec {
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
   buildInputs = [
     qtbase xorg.libpthreadstubs xorg.libXdmcp qtx11extras vulkan-loader
   ];
-  nativeBuildInputs = [ cmake makeQtWrapper pkgconfig ];
+  nativeBuildInputs = [ cmake makeWrapper pkgconfig ];
 
   cmakeFlags = [
     "-DBUILD_VERSION_HASH=${src.rev}-distro-nix"
@@ -30,7 +30,7 @@ stdenv.mkDerivation rec {
     mkdir $out/bin/.bin
     mv $out/bin/qrenderdoc $out/bin/.bin/qrenderdoc
     ln -s $out/bin/.bin/qrenderdoc $out/bin/qrenderdoc
-    wrapQtProgram $out/bin/qrenderdoc --suffix LD_LIBRARY_PATH : $out/lib --suffix LD_LIBRARY_PATH : ${vulkan-loader}/lib
+    wrapProgram $out/bin/qrenderdoc --suffix LD_LIBRARY_PATH : $out/lib --suffix LD_LIBRARY_PATH : ${vulkan-loader}/lib
     mv $out/bin/renderdoccmd $out/bin/.bin/renderdoccmd
     ln -s $out/bin/.bin/renderdoccmd $out/bin/renderdoccmd
     wrapProgram $out/bin/renderdoccmd --suffix LD_LIBRARY_PATH : $out/lib --suffix LD_LIBRARY_PATH : ${vulkan-loader}/lib
diff --git a/pkgs/applications/graphics/shotwell/default.nix b/pkgs/applications/graphics/shotwell/default.nix
index c020f7fc6ca7..3f31b86fe492 100644
--- a/pkgs/applications/graphics/shotwell/default.nix
+++ b/pkgs/applications/graphics/shotwell/default.nix
@@ -8,12 +8,12 @@
 stdenv.mkDerivation rec {
   version = "${major}.${minor}";
   major = "0.26";
-  minor = "1";
+  minor = "2";
   name = "shotwell-${version}";
 
   src = fetchurl {
     url = "mirror://gnome/sources/shotwell/${major}/${name}.tar.xz";
-    sha256 = "0xak1f69lp1yx3p8jgmr9c0z3jypi8zjpy3kiknn5n9g2f5cqq0a";
+    sha256 = "0frjqa6nmh025clwnb74z2rzbdq65wjcp2lf9csgcbkpahyjhrag";
   };
 
   NIX_CFLAGS_COMPILE = "-I${glib.dev}/include/glib-2.0 -I${glib.out}/lib/glib-2.0/include";
@@ -24,11 +24,13 @@ stdenv.mkDerivation rec {
     patchShebangs .
   '';
 
+  nativeBuildInputs = [ pkgconfig wrapGAppsHook ];
+
   buildInputs = [ m4 glibc gtk3 libexif libgphoto2 libsoup libxml2 vala_0_28 sqlite webkitgtk
-                  pkgconfig gst_all_1.gstreamer gst_all_1.gst-plugins-base gnome3.libgee
+                  gst_all_1.gstreamer gst_all_1.gst-plugins-base gnome3.libgee
                   which udev libgudev gnome3.gexiv2 hicolor_icon_theme
                   libraw json_glib gettext desktop_file_utils glib lcms2 gdk_pixbuf librsvg
-                  wrapGAppsHook gnome_doc_utils gnome3.rest gnome3.gcr
+                  gnome_doc_utils gnome3.rest gnome3.gcr
                   gnome3.defaultIconTheme itstool libgdata ];
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/kde/akonadi-contacts.nix b/pkgs/applications/kde/akonadi-contacts.nix
index 830c9e6899ea..3f410b7b8b91 100644
--- a/pkgs/applications/kde/akonadi-contacts.nix
+++ b/pkgs/applications/kde/akonadi-contacts.nix
@@ -1,11 +1,11 @@
 {
-  kdeApp, lib,
+  mkDerivation, lib,
   extra-cmake-modules,
-  akonadi-mime, grantlee, kcontacts, kio, kitemmodels, kmime, qtwebengine,
-  akonadi
+  akonadi, akonadi-mime, grantlee, kcontacts, kdbusaddons, ki18n, kiconthemes,
+  kio, kitemmodels, kmime, ktextwidgets, qtwebengine,
 }:
 
-kdeApp {
+mkDerivation {
   name = "akonadi-contacts";
   meta = {
     license = with lib.licenses; [ gpl2 lgpl21 ];
@@ -13,7 +13,9 @@ kdeApp {
   };
   nativeBuildInputs = [ extra-cmake-modules ];
   buildInputs = [
-    akonadi-mime grantlee kcontacts kio kitemmodels kmime qtwebengine
+    akonadi-mime grantlee kcontacts kdbusaddons ki18n kiconthemes kio
+    kitemmodels kmime ktextwidgets qtwebengine
   ];
   propagatedBuildInputs = [ akonadi ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/applications/kde/akonadi-mime.nix b/pkgs/applications/kde/akonadi-mime.nix
index ba4b4b50242c..1fb50756665e 100644
--- a/pkgs/applications/kde/akonadi-mime.nix
+++ b/pkgs/applications/kde/akonadi-mime.nix
@@ -1,15 +1,16 @@
 {
-  kdeApp, lib,
+  mkDerivation, lib,
   extra-cmake-modules,
-  akonadi, kdbusaddons, kio, kitemmodels, kmime
+  akonadi, kdbusaddons, ki18n, kio, kitemmodels, kmime
 }:
 
-kdeApp {
+mkDerivation {
   name = "akonadi-mime";
   meta = {
     license = with lib.licenses; [ gpl2 lgpl21 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
   nativeBuildInputs = [ extra-cmake-modules ];
-  buildInputs = [ akonadi kdbusaddons kio kitemmodels kmime ];
+  buildInputs = [ akonadi kdbusaddons ki18n kio kitemmodels kmime ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/applications/kde/akonadi.nix b/pkgs/applications/kde/akonadi.nix
deleted file mode 100644
index 284ed60a9cbd..000000000000
--- a/pkgs/applications/kde/akonadi.nix
+++ /dev/null
@@ -1,20 +0,0 @@
-{
-  kdeApp, lib,
-  extra-cmake-modules,
-  kcompletion, kconfigwidgets, kdbusaddons, kdesignerplugin, kiconthemes,
-  kio,
-  boost, kitemmodels
-}:
-
-kdeApp {
-  name = "akonadi";
-  meta = {
-    license = [ lib.licenses.lgpl21 ];
-    maintainers = [ lib.maintainers.ttuegel ];
-  };
-  nativeBuildInputs = [ extra-cmake-modules ];
-  buildInputs = [
-    kcompletion kconfigwidgets kdbusaddons kdesignerplugin kiconthemes kio
-  ];
-  propagatedBuildInputs = [ boost kitemmodels ];
-}
diff --git a/pkgs/applications/kde/akonadi/akonadi-paths.patch b/pkgs/applications/kde/akonadi/akonadi-paths.patch
new file mode 100644
index 000000000000..f1ae1f23cc95
--- /dev/null
+++ b/pkgs/applications/kde/akonadi/akonadi-paths.patch
@@ -0,0 +1,191 @@
+Index: akonadi-17.04.0/src/server/storage/dbconfigmysql.cpp
+===================================================================
+--- akonadi-17.04.0.orig/src/server/storage/dbconfigmysql.cpp
++++ akonadi-17.04.0/src/server/storage/dbconfigmysql.cpp
+@@ -63,7 +63,6 @@ bool DbConfigMysql::init(QSettings &sett
+     // determine default settings depending on the driver
+     QString defaultHostName;
+     QString defaultOptions;
+-    QString defaultServerPath;
+     QString defaultCleanShutdownCommand;
+ 
+ #ifndef Q_OS_WIN
+@@ -71,25 +70,8 @@ bool DbConfigMysql::init(QSettings &sett
+ #endif
+ 
+     const bool defaultInternalServer = true;
+-#ifdef MYSQLD_EXECUTABLE
+-    if (QFile::exists(QStringLiteral(MYSQLD_EXECUTABLE))) {
+-        defaultServerPath = QStringLiteral(MYSQLD_EXECUTABLE);
+-    }
+-#endif
+-    const QStringList mysqldSearchPath = QStringList()
+-                                         << QStringLiteral("/usr/bin")
+-                                         << QStringLiteral("/usr/sbin")
+-                                         << QStringLiteral("/usr/local/sbin")
+-                                         << QStringLiteral("/usr/local/libexec")
+-                                         << QStringLiteral("/usr/libexec")
+-                                         << QStringLiteral("/opt/mysql/libexec")
+-                                         << QStringLiteral("/opt/local/lib/mysql5/bin")
+-                                         << QStringLiteral("/opt/mysql/sbin");
+-    if (defaultServerPath.isEmpty()) {
+-        defaultServerPath = XdgBaseDirs::findExecutableFile(QStringLiteral("mysqld"), mysqldSearchPath);
+-    }
+ 
+-    const QString mysqladminPath = XdgBaseDirs::findExecutableFile(QStringLiteral("mysqladmin"), mysqldSearchPath);
++    const QString mysqladminPath = QStringLiteral(NIXPKGS_MYSQL_MYSQLADMIN);
+     if (!mysqladminPath.isEmpty()) {
+ #ifndef Q_OS_WIN
+         defaultCleanShutdownCommand = QStringLiteral("%1 --defaults-file=%2/mysql.conf --socket=%3/mysql.socket shutdown")
+@@ -99,10 +81,10 @@ bool DbConfigMysql::init(QSettings &sett
+ #endif
+     }
+ 
+-    mMysqlInstallDbPath = XdgBaseDirs::findExecutableFile(QStringLiteral("mysql_install_db"), mysqldSearchPath);
++    mMysqlInstallDbPath = QStringLiteral(NIXPKGS_MYSQL_MYSQL_INSTALL_DB);
+     qCDebug(AKONADISERVER_LOG) << "Found mysql_install_db: " << mMysqlInstallDbPath;
+ 
+-    mMysqlCheckPath = XdgBaseDirs::findExecutableFile(QStringLiteral("mysqlcheck"), mysqldSearchPath);
++    mMysqlCheckPath = QStringLiteral(NIXPKGS_MYSQL_MYSQLCHECK);
+     qCDebug(AKONADISERVER_LOG) << "Found mysqlcheck: " << mMysqlCheckPath;
+ 
+     mInternalServer = settings.value(QStringLiteral("QMYSQL/StartServer"), defaultInternalServer).toBool();
+@@ -119,7 +101,7 @@ bool DbConfigMysql::init(QSettings &sett
+     mUserName = settings.value(QStringLiteral("User")).toString();
+     mPassword = settings.value(QStringLiteral("Password")).toString();
+     mConnectionOptions = settings.value(QStringLiteral("Options"), defaultOptions).toString();
+-    mMysqldPath = settings.value(QStringLiteral("ServerPath"), defaultServerPath).toString();
++    mMysqldPath = QStringLiteral(NIXPKGS_MYSQL_MYSQLD);
+     mCleanServerShutdownCommand = settings.value(QStringLiteral("CleanServerShutdownCommand"), defaultCleanShutdownCommand).toString();
+     settings.endGroup();
+ 
+@@ -129,9 +111,6 @@ bool DbConfigMysql::init(QSettings &sett
+         // intentionally not namespaced as we are the only one in this db instance when using internal mode
+         mDatabaseName = QStringLiteral("akonadi");
+     }
+-    if (mInternalServer && (mMysqldPath.isEmpty() || !QFile::exists(mMysqldPath))) {
+-        mMysqldPath = defaultServerPath;
+-    }
+ 
+     qCDebug(AKONADISERVER_LOG) << "Using mysqld:" << mMysqldPath;
+ 
+@@ -140,9 +119,6 @@ bool DbConfigMysql::init(QSettings &sett
+     settings.setValue(QStringLiteral("Name"), mDatabaseName);
+     settings.setValue(QStringLiteral("Host"), mHostName);
+     settings.setValue(QStringLiteral("Options"), mConnectionOptions);
+-    if (!mMysqldPath.isEmpty()) {
+-        settings.setValue(QStringLiteral("ServerPath"), mMysqldPath);
+-    }
+     settings.setValue(QStringLiteral("StartServer"), mInternalServer);
+     settings.endGroup();
+     settings.sync();
+@@ -196,7 +172,7 @@ bool DbConfigMysql::startInternalServer(
+ #endif
+ 
+     // generate config file
+-    const QString globalConfig = XdgBaseDirs::findResourceFile("config", QStringLiteral("akonadi/mysql-global.conf"));
++    const QString globalConfig = QStringLiteral(NIX_OUT "/etc/xdg/akonadi/mysql-global.conf");
+     const QString localConfig  = XdgBaseDirs::findResourceFile("config", QStringLiteral("akonadi/mysql-local.conf"));
+     const QString actualConfig = StandardDirs::saveDir("data") + QLatin1String("/mysql.conf");
+     if (globalConfig.isEmpty()) {
+Index: akonadi-17.04.0/src/server/storage/dbconfigpostgresql.cpp
+===================================================================
+--- akonadi-17.04.0.orig/src/server/storage/dbconfigpostgresql.cpp
++++ akonadi-17.04.0/src/server/storage/dbconfigpostgresql.cpp
+@@ -58,7 +58,6 @@ bool DbConfigPostgresql::init(QSettings
+     // determine default settings depending on the driver
+     QString defaultHostName;
+     QString defaultOptions;
+-    QString defaultServerPath;
+     QString defaultInitDbPath;
+     QString defaultPgData;
+ 
+@@ -70,35 +69,7 @@ bool DbConfigPostgresql::init(QSettings
+ 
+     mInternalServer = settings.value(QStringLiteral("QPSQL/StartServer"), defaultInternalServer).toBool();
+     if (mInternalServer) {
+-        QStringList postgresSearchPath;
+-
+-#ifdef POSTGRES_PATH
+-        const QString dir(QStringLiteral(POSTGRES_PATH));
+-        if (QDir(dir).exists()) {
+-            postgresSearchPath << QStringLiteral(POSTGRES_PATH);
+-        }
+-#endif
+-        postgresSearchPath << QStringLiteral("/usr/sbin")
+-                           << QStringLiteral("/usr/local/sbin");
+-        // Locale all versions in /usr/lib/postgresql (i.e. /usr/lib/postgresql/X.Y) in reversed
+-        // sorted order, so we search from the newest one to the oldest.
+-        QStringList postgresVersionedSearchPaths;
+-        QDir versionedDir(QStringLiteral("/usr/lib/postgresql"));
+-        if (versionedDir.exists()) {
+-            const auto versionedDirs = versionedDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name | QDir::Reversed);
+-            for (const auto &path : versionedDirs) {
+-                // Don't break once PostgreSQL 10 is released, but something more future-proof will be needed
+-                if (path.fileName().startsWith(QLatin1String("10."))) {
+-                    postgresVersionedSearchPaths.prepend(path.absoluteFilePath() + QStringLiteral("/bin"));
+-                } else {
+-                    postgresVersionedSearchPaths.append(path.absoluteFilePath() + QStringLiteral("/bin"));
+-                }
+-            }
+-        }
+-        postgresSearchPath.append(postgresVersionedSearchPaths);
+-
+-        defaultServerPath = XdgBaseDirs::findExecutableFile(QStringLiteral("pg_ctl"), postgresSearchPath);
+-        defaultInitDbPath = XdgBaseDirs::findExecutableFile(QStringLiteral("initdb"), postgresSearchPath);
++        defaultInitDbPath = QStringLiteral(NIXPKGS_POSTGRES_INITDB);
+         defaultHostName = Utils::preferredSocketDirectory(StandardDirs::saveDir("data", QStringLiteral("db_misc")));
+         defaultPgData = StandardDirs::saveDir("data", QStringLiteral("db_data"));
+     }
+@@ -118,10 +89,7 @@ bool DbConfigPostgresql::init(QSettings
+     mUserName = settings.value(QStringLiteral("User")).toString();
+     mPassword = settings.value(QStringLiteral("Password")).toString();
+     mConnectionOptions = settings.value(QStringLiteral("Options"), defaultOptions).toString();
+-    mServerPath = settings.value(QStringLiteral("ServerPath"), defaultServerPath).toString();
+-    if (mInternalServer && mServerPath.isEmpty()) {
+-        mServerPath = defaultServerPath;
+-    }
++    mServerPath = QStringLiteral(NIXPKGS_POSTGRES_PG_CTL);
+     qCDebug(AKONADISERVER_LOG) << "Found pg_ctl:" << mServerPath;
+     mInitDbPath = settings.value(QStringLiteral("InitDbPath"), defaultInitDbPath).toString();
+     if (mInternalServer && mInitDbPath.isEmpty()) {
+@@ -142,7 +110,6 @@ bool DbConfigPostgresql::init(QSettings
+         settings.setValue(QStringLiteral("Port"), mHostPort);
+     }
+     settings.setValue(QStringLiteral("Options"), mConnectionOptions);
+-    settings.setValue(QStringLiteral("ServerPath"), mServerPath);
+     settings.setValue(QStringLiteral("InitDbPath"), mInitDbPath);
+     settings.setValue(QStringLiteral("StartServer"), mInternalServer);
+     settings.endGroup();
+Index: akonadi-17.04.0/src/akonadicontrol/agentprocessinstance.cpp
+===================================================================
+--- akonadi-17.04.0.orig/src/akonadicontrol/agentprocessinstance.cpp
++++ akonadi-17.04.0/src/akonadicontrol/agentprocessinstance.cpp
+@@ -62,7 +62,7 @@ bool AgentProcessInstance::start(const A
+     } else {
+         Q_ASSERT(agentInfo.launchMethod == AgentType::Launcher);
+         const QStringList arguments = QStringList() << executable << identifier();
+-        const QString agentLauncherExec = XdgBaseDirs::findExecutableFile(QStringLiteral("akonadi_agent_launcher"));
++        const QString agentLauncherExec = QStringLiteral(NIX_OUT "/bin/akonadi_agent_launcher");
+         mController->start(agentLauncherExec, arguments);
+     }
+     return true;
+Index: akonadi-17.04.0/src/akonadicontrol/agentmanager.cpp
+===================================================================
+--- akonadi-17.04.0.orig/src/akonadicontrol/agentmanager.cpp
++++ akonadi-17.04.0/src/akonadicontrol/agentmanager.cpp
+@@ -102,12 +102,12 @@ AgentManager::AgentManager(bool verbose,
+     mStorageController = new Akonadi::ProcessControl;
+     mStorageController->setShutdownTimeout(15 * 1000);   // the server needs more time for shutdown if we are using an internal mysqld
+     connect(mStorageController, &Akonadi::ProcessControl::unableToStart, this, &AgentManager::serverFailure);
+-    mStorageController->start(QStringLiteral("akonadiserver"), serviceArgs, Akonadi::ProcessControl::RestartOnCrash);
++    mStorageController->start(QStringLiteral(NIX_OUT "/bin/akonadiserver"), serviceArgs, Akonadi::ProcessControl::RestartOnCrash);
+ 
+     if (mAgentServerEnabled) {
+         mAgentServer = new Akonadi::ProcessControl;
+         connect(mAgentServer, &Akonadi::ProcessControl::unableToStart, this, &AgentManager::agentServerFailure);
+-        mAgentServer->start(QStringLiteral("akonadi_agent_server"), serviceArgs, Akonadi::ProcessControl::RestartOnCrash);
++        mAgentServer->start(QStringLiteral(NIX_OUT "/bin/akonadi_agent_server"), serviceArgs, Akonadi::ProcessControl::RestartOnCrash);
+     }
+ 
+ #ifndef QT_NO_DEBUG
diff --git a/pkgs/applications/kde/akonadi/akonadi-timestamps.patch b/pkgs/applications/kde/akonadi/akonadi-timestamps.patch
new file mode 100644
index 000000000000..25a835f5ba24
--- /dev/null
+++ b/pkgs/applications/kde/akonadi/akonadi-timestamps.patch
@@ -0,0 +1,14 @@
+Index: akonadi-17.04.0/src/server/storage/dbconfigmysql.cpp
+===================================================================
+--- akonadi-17.04.0.orig/src/server/storage/dbconfigmysql.cpp
++++ akonadi-17.04.0/src/server/storage/dbconfigmysql.cpp
+@@ -229,8 +229,7 @@ bool DbConfigMysql::startInternalServer(
+     bool confUpdate = false;
+     QFile actualFile(actualConfig);
+     // update conf only if either global (or local) is newer than actual
+-    if ((QFileInfo(globalConfig).lastModified() > QFileInfo(actualFile).lastModified()) ||
+-            (QFileInfo(localConfig).lastModified()  > QFileInfo(actualFile).lastModified())) {
++    if (true) {
+         QFile globalFile(globalConfig);
+         QFile localFile(localConfig);
+         if (globalFile.open(QFile::ReadOnly) && actualFile.open(QFile::WriteOnly)) {
diff --git a/pkgs/applications/kde/akonadi/default.nix b/pkgs/applications/kde/akonadi/default.nix
new file mode 100644
index 000000000000..a264ebc9f098
--- /dev/null
+++ b/pkgs/applications/kde/akonadi/default.nix
@@ -0,0 +1,36 @@
+{
+  mkDerivation, copyPathsToStore, lib,
+  extra-cmake-modules,
+  kcompletion, kconfigwidgets, kdbusaddons, kdesignerplugin, kiconthemes,
+  kio,
+  boost, kitemmodels,
+  mysql
+}:
+
+mkDerivation {
+  name = "akonadi";
+  meta = {
+    license = [ lib.licenses.lgpl21 ];
+    maintainers = [ lib.maintainers.ttuegel ];
+  };
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    kcompletion kconfigwidgets kdbusaddons kdesignerplugin kiconthemes kio
+  ];
+  propagatedBuildInputs = [ boost kitemmodels ];
+  cmakeFlags = [
+    "-DMYSQLD_EXECUTABLE=${lib.getBin mysql}/bin/mysqld"
+  ];
+  NIX_CFLAGS_COMPILE = [
+    ''-DNIXPKGS_MYSQL_MYSQLD="${lib.getBin mysql}/bin/mysqld"''
+    ''-DNIXPKGS_MYSQL_MYSQLADMIN="${lib.getBin mysql}/bin/mysqladmin"''
+    ''-DNIXPKGS_MYSQL_MYSQL_INSTALL_DB="${lib.getBin mysql}/bin/mysql_install_db"''
+    ''-DNIXPKGS_MYSQL_MYSQLCHECK="${lib.getBin mysql}/bin/mysqlcheck"''
+    ''-DNIXPKGS_POSTGRES_PG_CTL=""''
+    ''-DNIXPKGS_POSTGRES_INITDB=""''
+  ];
+  preConfigure = ''
+    NIX_CFLAGS_COMPILE+=" -DNIX_OUT=\"$out\""
+  '';
+}
diff --git a/pkgs/applications/kde/akonadi/series b/pkgs/applications/kde/akonadi/series
new file mode 100644
index 000000000000..9e067f0a0008
--- /dev/null
+++ b/pkgs/applications/kde/akonadi/series
@@ -0,0 +1,2 @@
+akonadi-paths.patch
+akonadi-timestamps.patch
diff --git a/pkgs/applications/kde/ark/default.nix b/pkgs/applications/kde/ark/default.nix
index 52cb403f2022..df15f6b0f188 100644
--- a/pkgs/applications/kde/ark/default.nix
+++ b/pkgs/applications/kde/ark/default.nix
@@ -1,10 +1,10 @@
 {
-  kdeApp, lib, config, kdeWrapper,
+  mkDerivation, lib, config, makeWrapper,
 
-  extra-cmake-modules, kdoctools, makeWrapper,
+  extra-cmake-modules, kdoctools,
 
-  karchive, kconfig, kcrash, kdbusaddons, ki18n, kiconthemes, khtml, kio,
-  kservice, kpty, kwidgetsaddons, libarchive, kitemmodels,
+  karchive, kconfig, kcrash, kdbusaddons, ki18n, kiconthemes, kitemmodels,
+  khtml, kio, kparts, kpty, kservice, kwidgetsaddons, libarchive,
 
   # Archive tools
   p7zip, unzipNLS, zip,
@@ -13,35 +13,25 @@
   unfreeEnableUnrar ? false, unrar,
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "ark";
-      nativeBuildInputs = [
-        extra-cmake-modules kdoctools makeWrapper
-      ];
-      propagatedBuildInputs = [
-        khtml ki18n kio karchive kconfig kcrash kdbusaddons kiconthemes kservice
-        kpty kwidgetsaddons libarchive kitemmodels
-      ];
-      postInstall =
-        let
-          PATH =
-            lib.makeBinPath
-            ([ p7zip unzipNLS zip ] ++ lib.optional unfreeEnableUnrar unrar);
-        in ''
-          wrapProgram "$out/bin/ark" \
-              --prefix PATH : "${PATH}"
-        '';
-      meta = {
-        license = with lib.licenses;
-          [ gpl2 lgpl3 ] ++ lib.optional unfreeEnableUnrar unfree;
-        maintainers = [ lib.maintainers.ttuegel ];
-      };
-    };
-in
-kdeWrapper
-{
-  inherit unwrapped;
-  targets = [ "bin/ark" ];
+mkDerivation {
+  name = "ark";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools makeWrapper ];
+  propagatedBuildInputs = [
+    karchive kconfig kcrash kdbusaddons khtml ki18n kiconthemes kio kitemmodels
+    kparts kpty kservice kwidgetsaddons libarchive
+  ];
+  outputs = [ "out" "dev" ];
+  postFixup =
+    let
+      PATH =
+        lib.makeBinPath
+        ([ p7zip unzipNLS zip ] ++ lib.optional unfreeEnableUnrar unrar);
+    in ''
+      wrapProgram "$out/bin/ark" --prefix PATH: "${PATH}"
+    '';
+  meta = {
+    license = with lib.licenses;
+      [ gpl2 lgpl3 ] ++ lib.optional unfreeEnableUnrar unfree;
+    maintainers = [ lib.maintainers.ttuegel ];
+  };
 }
diff --git a/pkgs/applications/kde/baloo-widgets.nix b/pkgs/applications/kde/baloo-widgets.nix
index bb6803057096..3479b6600fc9 100644
--- a/pkgs/applications/kde/baloo-widgets.nix
+++ b/pkgs/applications/kde/baloo-widgets.nix
@@ -1,10 +1,10 @@
 {
-  kdeApp, lib,
+  mkDerivation, lib,
   extra-cmake-modules, kdoctools,
   baloo, kconfig, kdelibs4support, kfilemetadata, ki18n, kio, kservice
 }:
 
-kdeApp {
+mkDerivation {
   name = "baloo-widgets";
   meta = {
     license = [ lib.licenses.lgpl21 ];
@@ -14,4 +14,5 @@ kdeApp {
   propagatedBuildInputs = [
     baloo kconfig kdelibs4support kfilemetadata ki18n kio kservice
   ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/applications/kde/build-support/application.nix b/pkgs/applications/kde/build-support/application.nix
index 92fdb439330d..892d82fb51e8 100644
--- a/pkgs/applications/kde/build-support/application.nix
+++ b/pkgs/applications/kde/build-support/application.nix
@@ -1,4 +1,4 @@
-{ kdeDerivation, lib, debug, srcs }:
+{ mkDerivation, lib, srcs }:
 
 args:
 
@@ -7,14 +7,11 @@ let
   sname = args.sname or name;
   inherit (srcs."${sname}") src version;
 in
-kdeDerivation (args // {
+mkDerivation (args // {
   name = "${name}-${version}";
   inherit src;
 
-  cmakeFlags =
-    (args.cmakeFlags or [])
-    ++ [ "-DBUILD_TESTING=OFF" ]
-    ++ lib.optional debug "-DCMAKE_BUILD_TYPE=Debug";
+  outputs = args.outputs or [ "out" "dev" ];
 
   meta = {
     platforms = lib.platforms.linux;
diff --git a/pkgs/applications/kde/default.nix b/pkgs/applications/kde/default.nix
index 81c50147cb68..d8b8c4242cb8 100644
--- a/pkgs/applications/kde/default.nix
+++ b/pkgs/applications/kde/default.nix
@@ -27,9 +27,7 @@ still shows most of the available features is in `./gwenview.nix`.
 
 {
   stdenv, lib, libsForQt5, fetchurl, recurseIntoAttrs,
-  kdeDerivation, plasma5,
-  attica, phonon,
-  debug ? false,
+  plasma5, attica, phonon,
 }:
 
 let
@@ -42,14 +40,15 @@ let
   packages = self: with self;
     let
       callPackage = self.newScope {
-        kdeApp = import ./build-support/application.nix {
-          inherit lib kdeDerivation;
-          inherit debug srcs;
+        mkDerivation = import ./build-support/application.nix {
+          inherit lib;
+          inherit srcs;
+          mkDerivation = libsForQt5.callPackage ({ mkDerivation }: mkDerivation) {};
         };
       };
     in {
       kdelibs = callPackage ./kdelibs { inherit attica phonon; };
-      akonadi = callPackage ./akonadi.nix {};
+      akonadi = callPackage ./akonadi {};
       akonadi-contacts = callPackage ./akonadi-contacts.nix {};
       akonadi-mime = callPackage ./akonadi-mime.nix {};
       ark = callPackage ./ark/default.nix {};
diff --git a/pkgs/applications/kde/dolphin-plugins.nix b/pkgs/applications/kde/dolphin-plugins.nix
index 7f436c7a55a9..eb823641ae44 100644
--- a/pkgs/applications/kde/dolphin-plugins.nix
+++ b/pkgs/applications/kde/dolphin-plugins.nix
@@ -1,10 +1,10 @@
 {
-  kdeApp, lib,
+  mkDerivation, lib,
   extra-cmake-modules, kdoctools,
   dolphin, kdelibs4support, ki18n, kio, kxmlgui
 }:
 
-kdeApp {
+mkDerivation {
   name = "dolphin-plugins";
   meta = {
     license = [ lib.licenses.gpl2 ];
@@ -12,6 +12,6 @@ kdeApp {
   };
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
-    dolphin.unwrapped kdelibs4support ki18n kio kxmlgui
+    dolphin kdelibs4support ki18n kio kxmlgui
   ];
 }
diff --git a/pkgs/applications/kde/dolphin.nix b/pkgs/applications/kde/dolphin.nix
index 6515c230c284..2570e37bf2c9 100644
--- a/pkgs/applications/kde/dolphin.nix
+++ b/pkgs/applications/kde/dolphin.nix
@@ -1,32 +1,24 @@
 {
-  kdeApp, lib, kdeWrapper,
-  extra-cmake-modules, kdoctools, makeQtWrapper,
+  mkDerivation, lib,
+  extra-cmake-modules, kdoctools,
   baloo, baloo-widgets, dolphin-plugins, kactivities, kbookmarks, kcmutils,
   kcompletion, kconfig, kcoreaddons, kdelibs4support, kdbusaddons,
   kfilemetadata, ki18n, kiconthemes, kinit, kio, knewstuff, knotifications,
   konsole, kparts, ktexteditor, kwindowsystem, phonon, solid
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "dolphin";
-      meta = {
-        license = with lib.licenses; [ gpl2 fdl12 ];
-        maintainers = [ lib.maintainers.ttuegel ];
-      };
-      nativeBuildInputs = [ extra-cmake-modules kdoctools makeQtWrapper ];
-      propagatedBuildInputs = [
-        baloo baloo-widgets kactivities kbookmarks kcmutils kcompletion kconfig
-        kcoreaddons kdelibs4support kdbusaddons kfilemetadata ki18n kiconthemes
-        kinit kio knewstuff knotifications kparts ktexteditor kwindowsystem
-        phonon solid
-      ];
-    };
-in
-kdeWrapper
-{
-  inherit unwrapped;
-  targets = [ "bin/dolphin" ];
-  paths = [ dolphin-plugins konsole.unwrapped ];
+mkDerivation {
+  name = "dolphin";
+  meta = {
+    license = with lib.licenses; [ gpl2 fdl12 ];
+    maintainers = [ lib.maintainers.ttuegel ];
+  };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  propagatedBuildInputs = [
+    baloo baloo-widgets kactivities kbookmarks kcmutils kcompletion kconfig
+    kcoreaddons kdelibs4support kdbusaddons kfilemetadata ki18n kiconthemes
+    kinit kio knewstuff knotifications kparts ktexteditor kwindowsystem
+    phonon solid
+  ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/applications/kde/ffmpegthumbs.nix b/pkgs/applications/kde/ffmpegthumbs.nix
index 5dde6d8a64ea..4e915422d147 100644
--- a/pkgs/applications/kde/ffmpegthumbs.nix
+++ b/pkgs/applications/kde/ffmpegthumbs.nix
@@ -1,10 +1,10 @@
 {
-  kdeApp, lib,
+  mkDerivation, lib,
   extra-cmake-modules,
   ffmpeg, kio
 }:
 
-kdeApp {
+mkDerivation {
   name = "ffmpegthumbs";
   meta = {
     license = with lib.licenses; [ gpl2 bsd3 ];
diff --git a/pkgs/applications/kde/filelight.nix b/pkgs/applications/kde/filelight.nix
index 71ab51320ab1..6eb219d8da96 100644
--- a/pkgs/applications/kde/filelight.nix
+++ b/pkgs/applications/kde/filelight.nix
@@ -1,24 +1,17 @@
 {
-  kdeApp, lib, kdeWrapper,
+  mkDerivation, lib,
   extra-cmake-modules, kdoctools,
   kio, kparts, kxmlgui, qtscript, solid
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "filelight";
-      meta = {
-        license = with lib.licenses; [ gpl2 ];
-        maintainers = with lib.maintainers; [ fridh vcunat ];
-      };
-      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-      propagatedBuildInputs = [
-        kio kparts kxmlgui qtscript solid
-      ];
-    };
-in
-kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/filelight" ];
+mkDerivation {
+  name = "filelight";
+  meta = {
+    license = with lib.licenses; [ gpl2 ];
+    maintainers = with lib.maintainers; [ fridh vcunat ];
+  };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  propagatedBuildInputs = [
+    kio kparts kxmlgui qtscript solid
+  ];
 }
diff --git a/pkgs/applications/kde/gwenview.nix b/pkgs/applications/kde/gwenview.nix
index 0fa06ed0fbe2..233566c1bdaf 100644
--- a/pkgs/applications/kde/gwenview.nix
+++ b/pkgs/applications/kde/gwenview.nix
@@ -1,27 +1,21 @@
 {
-  kdeApp, lib, kdeWrapper,
+  mkDerivation, lib,
   extra-cmake-modules, kdoctools,
-  baloo, exiv2, kactivities, kdelibs4support, kio, kipi-plugins, lcms2,
-  libkdcraw, libkipi, phonon, qtimageformats, qtsvg, qtx11extras
+  exiv2, lcms2,
+  baloo, kactivities, kdelibs4support, kio, kipi-plugins, libkdcraw, libkipi,
+  phonon, qtimageformats, qtsvg, qtx11extras
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "gwenview";
-      meta = {
-        license = with lib.licenses; [ gpl2 fdl12 ];
-        maintainers = [ lib.maintainers.ttuegel ];
-      };
-      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-      propagatedBuildInputs = [
-        baloo kactivities kdelibs4support kio exiv2 lcms2 libkdcraw
-        libkipi phonon qtimageformats qtsvg qtx11extras
-      ];
-    };
-in
-kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/gwenview" ];
-  paths = [ kipi-plugins ];
+mkDerivation {
+  name = "gwenview";
+  meta = {
+    license = with lib.licenses; [ gpl2 fdl12 ];
+    maintainers = [ lib.maintainers.ttuegel ];
+  };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    baloo exiv2 kactivities kdelibs4support kio libkdcraw lcms2 libkipi phonon
+    qtimageformats qtsvg qtx11extras
+  ];
+  propagatedUserEnvPkgs = [ kipi-plugins ];
 }
diff --git a/pkgs/applications/kde/k3b.nix b/pkgs/applications/kde/k3b.nix
index d1cd33a52089..e1f1132a08f3 100644
--- a/pkgs/applications/kde/k3b.nix
+++ b/pkgs/applications/kde/k3b.nix
@@ -1,41 +1,41 @@
-{ kdeApp, lib, kdeWrapper, extra-cmake-modules
+{ mkDerivation, lib
+, extra-cmake-modules, kdoctools, makeWrapper
 , qtwebkit
-, libkcddb, kcmutils, kdoctools, kfilemetadata, knewstuff, knotifyconfig, solid, kxmlgui
+, libkcddb, kcmutils, kfilemetadata, knewstuff, knotifyconfig, solid, kxmlgui
 , flac, lame, libmad, libmpcdec, libvorbis
 , libsamplerate, libsndfile, taglib
 , cdparanoia, cdrdao, cdrtools, dvdplusrwtools, libburn, libdvdcss, libdvdread, vcdimager
 , ffmpeg, libmusicbrainz2, normalize, sox, transcode
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "k3b";
-      meta = with lib; {
-        license = with licenses; [ gpl2Plus ];
-        maintainers = with maintainers; [ sander phreedom ];
-        platforms = platforms.linux;
-      };
-      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-      propagatedBuildInputs = [
-        # qt
-        qtwebkit
-        # kde
-        libkcddb kcmutils kfilemetadata knewstuff knotifyconfig solid kxmlgui
-        # formats
-        flac lame libmad libmpcdec libvorbis
-        # sound utilities
-        libsamplerate libsndfile taglib
-        # cd/dvd
-        cdparanoia libdvdcss libdvdread
-        # others
-        ffmpeg libmusicbrainz2
-      ];
-      enableParallelBuilding = true;
-    };
-
-in kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/k3b" ];
-  paths = [ cdrdao cdrtools dvdplusrwtools libburn normalize sox transcode vcdimager ];
+mkDerivation {
+  name = "k3b";
+  meta = with lib; {
+    license = with licenses; [ gpl2Plus ];
+    maintainers = with maintainers; [ sander phreedom ];
+    platforms = platforms.linux;
+  };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools makeWrapper ];
+  propagatedBuildInputs = [
+    # qt
+    qtwebkit
+    # kde
+    libkcddb kcmutils kfilemetadata knewstuff knotifyconfig solid kxmlgui
+    # formats
+    flac lame libmad libmpcdec libvorbis
+    # sound utilities
+    libsamplerate libsndfile taglib
+    # cd/dvd
+    cdparanoia libdvdcss libdvdread
+    # others
+    ffmpeg libmusicbrainz2
+  ];
+  postFixup =
+    let k3bPath = lib.makeBinPath [
+          cdrdao cdrtools dvdplusrwtools libburn normalize sox transcode
+          vcdimager
+        ];
+    in ''
+      wrapProgram "$out/bin/k3b" --prefix PATH : "${k3bPath}"
+    '';
 }
diff --git a/pkgs/applications/kde/kate.nix b/pkgs/applications/kde/kate.nix
index cd320afd8d3b..e6b4f6b6bdd4 100644
--- a/pkgs/applications/kde/kate.nix
+++ b/pkgs/applications/kde/kate.nix
@@ -1,5 +1,5 @@
 {
-  kdeApp, lib, kdeWrapper,
+  mkDerivation, lib,
   extra-cmake-modules, kdoctools,
   kactivities, kconfig, kcrash, kdbusaddons, kguiaddons, kiconthemes, ki18n,
   kinit, kio, kitemmodels, kjobwidgets, knewstuff, knotifications, konsole,
@@ -7,26 +7,19 @@
   plasma-framework, qtscript, threadweaver
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "kate";
-      meta = {
-        license = with lib.licenses; [ gpl3 lgpl3 lgpl2 ];
-        maintainers = [ lib.maintainers.ttuegel ];
-      };
-      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-      propagatedBuildInputs = [
-        kactivities ki18n kio ktexteditor kwindowsystem plasma-framework
-        qtscript kconfig kcrash kguiaddons kiconthemes kinit kjobwidgets kparts
-        kxmlgui kdbusaddons kwallet kitemmodels knotifications threadweaver
-        knewstuff libgit2
-      ];
-    };
-in
-kdeWrapper
-{
-  inherit unwrapped;
-  targets = [ "bin/kate" "bin/kwrite" ];
-  paths = [ konsole.unwrapped ];
+mkDerivation {
+  name = "kate";
+  meta = {
+    license = with lib.licenses; [ gpl3 lgpl3 lgpl2 ];
+    maintainers = [ lib.maintainers.ttuegel ];
+  };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ libgit2 ];
+  propagatedBuildInputs = [
+    kactivities ki18n kio ktexteditor kwindowsystem plasma-framework
+    qtscript kconfig kcrash kguiaddons kiconthemes kinit kjobwidgets kparts
+    kxmlgui kdbusaddons kwallet kitemmodels knotifications threadweaver
+    knewstuff
+  ];
+  propagatedUserEnvPkgs = [ konsole ];
 }
diff --git a/pkgs/applications/kde/kcachegrind.nix b/pkgs/applications/kde/kcachegrind.nix
index d43de1fdc366..a8833cfbf592 100644
--- a/pkgs/applications/kde/kcachegrind.nix
+++ b/pkgs/applications/kde/kcachegrind.nix
@@ -1,28 +1,17 @@
 {
-  kdeApp, lib, kdeWrapper,
+  mkDerivation, lib,
   extra-cmake-modules, kdoctools,
   kio, ki18n,
   perl, python, php
 }:
 
-kdeWrapper {
-  unwrapped = kdeApp {
-    name = "kcachegrind";
-    meta = {
-      license = with lib.licenses; [ gpl2 ];
-      maintainers = with lib.maintainers; [ orivej ];
-    };
-    nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-    buildInputs = [ perl python php kio ki18n ];
-    enableParallelBuilding = true;
+mkDerivation {
+  name = "kcachegrind";
+  meta = {
+    license = with lib.licenses; [ gpl2 ];
+    maintainers = with lib.maintainers; [ orivej ];
   };
-
-  targets = [
-    "bin/kcachegrind"
-    "bin/dprof2calltree"    # perl
-    "bin/hotshot2calltree"  # python
-    "bin/memprof2calltree"  # perl
-    "bin/op2calltree"       # perl
-    "bin/pprof2calltree"    # php
-  ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  propagatedBuildInputs = [ kio ];
+  buildInputs = [ perl python php ki18n ];
 }
diff --git a/pkgs/applications/kde/kcalc.nix b/pkgs/applications/kde/kcalc.nix
index 8ec7591460e7..856da42c835a 100644
--- a/pkgs/applications/kde/kcalc.nix
+++ b/pkgs/applications/kde/kcalc.nix
@@ -1,24 +1,18 @@
 {
-  kdeApp, lib, kdeWrapper,
+  mkDerivation, lib,
   extra-cmake-modules, kdoctools,
   kconfig, kconfigwidgets, kguiaddons, kinit, knotifications, gmp
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "kcalc";
-      meta = {
-        license = with lib.licenses; [ gpl2 ];
-        maintainers = [ lib.maintainers.fridh ];
-      };
-      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-      propagatedBuildInputs = [
-        gmp kconfig kconfigwidgets kguiaddons kinit knotifications
-      ];
-    };
-in
-kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/kcalc" ];
+mkDerivation {
+  name = "kcalc";
+  meta = {
+    license = with lib.licenses; [ gpl2 ];
+    maintainers = [ lib.maintainers.fridh ];
+  };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ gmp ];
+  propagatedBuildInputs = [
+    kconfig kconfigwidgets kguiaddons kinit knotifications
+  ];
 }
diff --git a/pkgs/applications/kde/kcolorchooser.nix b/pkgs/applications/kde/kcolorchooser.nix
index c1266009b686..186505a050c3 100644
--- a/pkgs/applications/kde/kcolorchooser.nix
+++ b/pkgs/applications/kde/kcolorchooser.nix
@@ -1,21 +1,16 @@
 {
-  kdeApp, lib, kdeWrapper,
-  extra-cmake-modules, ki18n, kwidgetsaddons, kxmlgui
+  mkDerivation, lib,
+  extra-cmake-modules,
+  ki18n, kwidgetsaddons, kxmlgui
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "kcolorchooser";
-      meta = {
-        license = with lib.licenses; [ mit ];
-        maintainers = [ lib.maintainers.ttuegel ];
-      };
-      nativeBuildInputs = [ extra-cmake-modules ];
-      propagatedBuildInputs = [ ki18n kwidgetsaddons kxmlgui ];
-    };
-in
-kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/kcolorchooser" ];
+mkDerivation {
+  name = "kcolorchooser";
+  meta = {
+    license = with lib.licenses; [ mit ];
+    maintainers = [ lib.maintainers.ttuegel ];
+  };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ ki18n ];
+  propagatedBuildInputs = [ kwidgetsaddons kxmlgui ];
 }
diff --git a/pkgs/applications/kde/kcontacts.nix b/pkgs/applications/kde/kcontacts.nix
index 5143df60ef44..96828af9d170 100644
--- a/pkgs/applications/kde/kcontacts.nix
+++ b/pkgs/applications/kde/kcontacts.nix
@@ -1,15 +1,15 @@
 {
-  kdeApp, lib,
-  extra-cmake-modules, ki18n,
-  kcoreaddons, kconfig, kcodecs
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kcoreaddons, kconfig, kcodecs, ki18n, qtbase,
 }:
 
-kdeApp {
+mkDerivation {
   name = "kcontacts";
   meta = {
     license = [ lib.licenses.lgpl21 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  nativeBuildInputs = [ extra-cmake-modules ki18n ];
-  buildInputs = [ kcoreaddons kconfig kcodecs ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ kcoreaddons kconfig kcodecs ki18n qtbase ];
 }
diff --git a/pkgs/applications/kde/kde-locale-4.nix b/pkgs/applications/kde/kde-locale-4.nix
index e83794c60d81..daf0a55b19e5 100644
--- a/pkgs/applications/kde/kde-locale-4.nix
+++ b/pkgs/applications/kde/kde-locale-4.nix
@@ -1,8 +1,8 @@
 name: args:
 
-{ kdeApp, automoc4, cmake, gettext, kdelibs, perl }:
+{ mkDerivation, automoc4, cmake, gettext, kdelibs, perl }:
 
-kdeApp (args // {
+mkDerivation (args // {
   sname = "kde-l10n-${name}";
   name = "kde-l10n-${name}-qt4";
 
diff --git a/pkgs/applications/kde/kde-locale-5.nix b/pkgs/applications/kde/kde-locale-5.nix
index 772ebe37e44f..76d601cbdc0f 100644
--- a/pkgs/applications/kde/kde-locale-5.nix
+++ b/pkgs/applications/kde/kde-locale-5.nix
@@ -1,8 +1,8 @@
 name: args:
 
-{ kdeApp, cmake, extra-cmake-modules, gettext, kdoctools }:
+{ mkDerivation, cmake, extra-cmake-modules, gettext, kdoctools }:
 
-kdeApp (args // {
+mkDerivation (args // {
   sname = "kde-l10n-${name}";
   name = "kde-l10n-${name}-qt5";
 
diff --git a/pkgs/applications/kde/kdegraphics-mobipocket.nix b/pkgs/applications/kde/kdegraphics-mobipocket.nix
index e50c92f88848..09f761df8517 100644
--- a/pkgs/applications/kde/kdegraphics-mobipocket.nix
+++ b/pkgs/applications/kde/kdegraphics-mobipocket.nix
@@ -1,10 +1,10 @@
 {
-  kdeApp, lib,
+  mkDerivation, lib,
   extra-cmake-modules,
   kio
 }:
 
-kdeApp {
+mkDerivation {
   name = "kdegraphics-mobipocket";
   meta = {
     license = [ lib.licenses.gpl2Plus ];
diff --git a/pkgs/applications/kde/kdegraphics-thumbnailers.nix b/pkgs/applications/kde/kdegraphics-thumbnailers.nix
index 5aa974a9c960..3302681bd852 100644
--- a/pkgs/applications/kde/kdegraphics-thumbnailers.nix
+++ b/pkgs/applications/kde/kdegraphics-thumbnailers.nix
@@ -1,9 +1,9 @@
 {
-  kdeApp, lib,
+  mkDerivation, lib,
   extra-cmake-modules, kio, libkexiv2, libkdcraw
 }:
 
-kdeApp {
+mkDerivation {
   name = "kdegraphics-thumbnailers";
   meta = {
     license = [ lib.licenses.lgpl21 ];
diff --git a/pkgs/applications/kde/kdelibs/default.nix b/pkgs/applications/kde/kdelibs/default.nix
index cae1b9b7e7f7..e3abe89eaded 100644
--- a/pkgs/applications/kde/kdelibs/default.nix
+++ b/pkgs/applications/kde/kdelibs/default.nix
@@ -1,12 +1,12 @@
 {
-  kdeApp, lib,
+  mkDerivation, lib,
   automoc4, bison, cmake, flex, libxslt, perl, pkgconfig, shared_mime_info,
   attica, attr, avahi, docbook_xml_dtd_42, docbook_xsl, giflib, ilmbase,
   libdbusmenu_qt, libjpeg, libxml2, phonon, polkit_qt4, qca2, qt4,
   shared_desktop_ontologies, soprano, strigi, udev, xz, pcre, fetchpatch
 }:
 
-kdeApp {
+mkDerivation {
   name = "kdelibs";
 
   outputs = [ "out" "dev" ];
diff --git a/pkgs/applications/kde/kdenetwork-filesharing.nix b/pkgs/applications/kde/kdenetwork-filesharing.nix
index 20f81563c3b4..62176f3f3bbd 100644
--- a/pkgs/applications/kde/kdenetwork-filesharing.nix
+++ b/pkgs/applications/kde/kdenetwork-filesharing.nix
@@ -1,10 +1,10 @@
 {
-  kdeApp, lib,
+  mkDerivation, lib,
   extra-cmake-modules, kdoctools,
   kcoreaddons, ki18n, kio, kwidgetsaddons, samba
 }:
 
-kdeApp {
+mkDerivation {
   name = "kdenetwork-filesharing";
   meta = {
     license = [ lib.licenses.gpl2 lib.licenses.lgpl21 ];
diff --git a/pkgs/applications/kde/kdenlive.nix b/pkgs/applications/kde/kdenlive.nix
index e543a3d84bf3..854e346e2909 100644
--- a/pkgs/applications/kde/kdenlive.nix
+++ b/pkgs/applications/kde/kdenlive.nix
@@ -1,5 +1,4 @@
-{ kdeApp
-, kdeWrapper
+{ mkDerivation
 , lib
 , extra-cmake-modules
 , kdoctools
@@ -31,8 +30,7 @@
 , qtquickcontrols
 }:
 
-let
-unwrapped = kdeApp {
+mkDerivation {
   name = "kdenlive";
   patches = [
     ./kdenlive-cmake-concurrent-module.patch
@@ -42,13 +40,14 @@ unwrapped = kdeApp {
     kdoctools
   ];
   buildInputs = [
-    qtscript
     kconfig
     kcrash
+    kdbusaddons
+    kfilemetadata
     kguiaddons
+    ki18n
     kiconthemes
     kinit
-    kdbusaddons
     knotifications
     knewstuff
     karchive
@@ -56,30 +55,19 @@ unwrapped = kdeApp {
     kplotting
     ktextwidgets
     mlt
+    phonon-backend-gstreamer
+    qtquickcontrols
+    qtscript
     shared_mime_info
     libv4l
     ffmpeg
   ];
-  propagatedBuildInputs = [
-    kactivities
-    ki18n
-    kio
-    kio-extras
-    kwindowsystem
-    kfilemetadata
-    plasma-framework
-    phonon-backend-gstreamer
-    qtquickcontrols
-  ];
-  enableParallelBuilding = true;
+  postPatch =
+    # Module Qt5::Concurrent must be included in `find_package` before it is used.
+    ''
+      sed -i CMakeLists.txt -e '/find_package(Qt5 REQUIRED/ s|)| Concurrent)|'
+    '';
   meta = {
     license = with lib.licenses; [ gpl2Plus ];
   };
-};
-in
-kdeWrapper
-{
-  inherit unwrapped;
-  targets = [ "bin/kdenlive" ];
-  paths = [ kinit ];
 }
diff --git a/pkgs/applications/kde/kdf.nix b/pkgs/applications/kde/kdf.nix
index 97e74eb2e125..333fea3df53e 100644
--- a/pkgs/applications/kde/kdf.nix
+++ b/pkgs/applications/kde/kdf.nix
@@ -1,24 +1,15 @@
 {
-  kdeApp, lib, kdeWrapper,
+  mkDerivation, lib,
   extra-cmake-modules, kdoctools,
   kcmutils
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "kdf";
-      meta = {
-        license = with lib.licenses; [ gpl2 ];
-        maintainers = [ lib.maintainers.peterhoeg ];
-      };
-      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-      propagatedBuildInputs = [
-        kcmutils
-      ];
-    };
-in
-kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/kdf" ];
+mkDerivation {
+  name = "kdf";
+  meta = {
+    license = with lib.licenses; [ gpl2 ];
+    maintainers = [ lib.maintainers.peterhoeg ];
+  };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  propagatedBuildInputs = [ kcmutils ];
 }
diff --git a/pkgs/applications/kde/kgpg.nix b/pkgs/applications/kde/kgpg.nix
index 58e9cb0d1e9b..ca495a1ae269 100644
--- a/pkgs/applications/kde/kgpg.nix
+++ b/pkgs/applications/kde/kgpg.nix
@@ -1,21 +1,22 @@
 {
-  kdeApp, lib, makeQtWrapper,
-  extra-cmake-modules, kdoctools, ki18n,
-  akonadi-contacts, gnupg1, gpgme, karchive, kcodecs, kcontacts, kcoreaddons, kcrash,
-  kdbusaddons, kiconthemes, kjobwidgets, kio, knotifications, kservice,
+  mkDerivation, lib,
+  extra-cmake-modules, kdoctools, ki18n, makeWrapper,
+  akonadi-contacts, gnupg1, gpgme, karchive, kcodecs, kcontacts, kcoreaddons,
+  kcrash, kdbusaddons, kiconthemes, kjobwidgets, kio, knotifications, kservice,
   ktextwidgets, kxmlgui, kwidgetsaddons, kwindowsystem
 }:
 
-kdeApp {
+mkDerivation {
   name = "kgpg";
-  nativeBuildInputs = [ extra-cmake-modules kdoctools ki18n ];
-  buildInputs = [
-    akonadi-contacts gnupg1 gpgme karchive kcodecs kcontacts kcoreaddons kcrash kdbusaddons
+  nativeBuildInputs = [ extra-cmake-modules kdoctools makeWrapper ];
+  buildInputs = [ gnupg1 gpgme ki18n ];
+  propagatedBuildInputs = [
+    akonadi-contacts karchive kcodecs kcontacts kcoreaddons kcrash kdbusaddons
     kiconthemes kjobwidgets kio knotifications kservice ktextwidgets kxmlgui
-    kwidgetsaddons kwindowsystem makeQtWrapper
+    kwidgetsaddons kwindowsystem
   ];
-  postInstall = ''
-    wrapQtProgram $out/bin/kgpg --suffix PATH : ${lib.makeBinPath [ gnupg1 ]}
+  postFixup = ''
+    wrapProgram "$out/bin/kgpg" --prefix PATH : "${lib.makeBinPath [ gnupg1 ]}"
   '';
   meta = {
     license = [ lib.licenses.gpl2 ];
diff --git a/pkgs/applications/kde/khelpcenter.nix b/pkgs/applications/kde/khelpcenter.nix
index 0579faa72a01..db68cec976e3 100644
--- a/pkgs/applications/kde/khelpcenter.nix
+++ b/pkgs/applications/kde/khelpcenter.nix
@@ -1,22 +1,16 @@
 {
-  kdeApp, kdeWrapper,
+  mkDerivation,
   extra-cmake-modules, kdoctools,
   grantlee, kconfig, kcoreaddons, kdbusaddons, ki18n, kinit, kcmutils,
   kdelibs4support, khtml, kservice, xapian
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "khelpcenter";
-      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-      buildInputs = [
-        grantlee kdelibs4support khtml ki18n kconfig kcoreaddons kdbusaddons
-        kinit kcmutils kservice xapian
-      ];
-    };
-in
-kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/khelpcenter" ];
+mkDerivation {
+  name = "khelpcenter";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ ki18n xapian ];
+  propagatedBuildInputs = [
+    grantlee kdelibs4support khtml kconfig kcoreaddons kdbusaddons
+    kinit kcmutils kservice
+  ];
 }
diff --git a/pkgs/applications/kde/kig.nix b/pkgs/applications/kde/kig.nix
index 9f38079316fa..f2a1d275f6e5 100644
--- a/pkgs/applications/kde/kig.nix
+++ b/pkgs/applications/kde/kig.nix
@@ -1,26 +1,19 @@
 {
-  kdeApp, lib, kdeWrapper
-  , extra-cmake-modules, kdoctools, kparts
-  , qtsvg, qtxmlpatterns, ktexteditor, boost
+  mkDerivation, lib,
+  extra-cmake-modules, kdoctools,
+  kparts, qtsvg, qtxmlpatterns, ktexteditor, boost
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "kig";
-      meta = {
-        license = with lib.licenses; [ gpl2 ];
-        maintainers = with lib.maintainers; [ raskin ];
-      };
-      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-      buildInputs = [
-        kparts qtsvg qtxmlpatterns ktexteditor boost
-      ];
-    };
-in
-kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/kig" ];
+mkDerivation {
+  name = "kig";
+  meta = {
+    license = with lib.licenses; [ gpl2 ];
+    maintainers = with lib.maintainers; [ raskin ];
+  };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ boost ];
+  propagatedBuildInputs = [
+    kparts qtsvg qtxmlpatterns ktexteditor
+  ];
 }
 
-
diff --git a/pkgs/applications/kde/kio-extras.nix b/pkgs/applications/kde/kio-extras.nix
index 77f795167fc0..50709a7ddef7 100644
--- a/pkgs/applications/kde/kio-extras.nix
+++ b/pkgs/applications/kde/kio-extras.nix
@@ -1,12 +1,12 @@
 {
-  kdeApp, lib, extra-cmake-modules, kdoctools, shared_mime_info,
+  mkDerivation, lib, extra-cmake-modules, kdoctools, shared_mime_info,
   exiv2, kactivities, karchive, kbookmarks, kconfig, kconfigwidgets,
   kcoreaddons, kdbusaddons, kguiaddons, kdnssd, kiconthemes, ki18n, kio, khtml,
   kdelibs4support, kpty, libmtp, libssh, openexr, ilmbase, openslp, phonon,
   qtsvg, samba, solid
 }:
 
-kdeApp {
+mkDerivation {
   name = "kio-extras";
   meta = {
     license = with lib.licenses; [ gpl2 lgpl21 ];
diff --git a/pkgs/applications/kde/kmime.nix b/pkgs/applications/kde/kmime.nix
index c17b3fdcd8e9..b14e0abcc3f1 100644
--- a/pkgs/applications/kde/kmime.nix
+++ b/pkgs/applications/kde/kmime.nix
@@ -1,15 +1,15 @@
 {
-  kdeApp, lib,
+  mkDerivation, lib,
   extra-cmake-modules, ki18n,
-  kcodecs
+  kcodecs, qtbase,
 }:
 
-kdeApp {
+mkDerivation {
   name = "kmime";
   meta = {
     license = [ lib.licenses.lgpl21 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
   nativeBuildInputs = [ extra-cmake-modules ki18n ];
-  buildInputs = [ kcodecs ];
+  buildInputs = [ kcodecs qtbase ];
 }
diff --git a/pkgs/applications/kde/kmix.nix b/pkgs/applications/kde/kmix.nix
index 6ab653cfce06..058fd8178c4a 100644
--- a/pkgs/applications/kde/kmix.nix
+++ b/pkgs/applications/kde/kmix.nix
@@ -1,30 +1,23 @@
 {
-  kdeApp, lib, kdeWrapper,
+  mkDerivation, lib,
   extra-cmake-modules, kdoctools,
   kglobalaccel, kxmlgui, kcoreaddons, kdelibs4support,
   plasma-framework, libpulseaudio, alsaLib, libcanberra_kde
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "kmix";
-      meta = {
-        license = with lib.licenses; [ gpl2 lgpl21 fdl12 ];
-        maintainers = [ lib.maintainers.rongcuid ];
-      };
-      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-      buildInputs = [ libpulseaudio alsaLib libcanberra_kde ];
-      propagatedBuildInputs = [
-        kglobalaccel kxmlgui kcoreaddons kdelibs4support
-        plasma-framework
-      ];
-      cmakeFlags = [
-        "-DKMIX_KF5_BUILD=1"
-      ];
-    };
-in
-kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/kmix" ];
+mkDerivation {
+  name = "kmix";
+  meta = {
+    license = with lib.licenses; [ gpl2 lgpl21 fdl12 ];
+    maintainers = [ lib.maintainers.rongcuid ];
+  };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ libpulseaudio alsaLib libcanberra_kde ];
+  propagatedBuildInputs = [
+    kglobalaccel kxmlgui kcoreaddons kdelibs4support
+    plasma-framework
+  ];
+  cmakeFlags = [
+    "-DKMIX_KF5_BUILD=1"
+  ];
 }
diff --git a/pkgs/applications/kde/kolourpaint.nix b/pkgs/applications/kde/kolourpaint.nix
index 75d5b6fca659..db4cb75cc35c 100644
--- a/pkgs/applications/kde/kolourpaint.nix
+++ b/pkgs/applications/kde/kolourpaint.nix
@@ -1,28 +1,17 @@
 { lib
-, kdeApp
-, kdeWrapper
+, mkDerivation
 , extra-cmake-modules
 , kdoctools
 , kdelibs4support
 , libkexiv2
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "kolourpaint";
-      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-      propagatedBuildInputs = [
-        kdelibs4support
-        libkexiv2
-      ];
-
-      meta = {
-        maintainers = [ lib.maintainers.fridh ];
-        license = with lib.licenses; [ gpl2 ];
-      };
-    };
-in kdeWrapper {
-  inherit unwrapped;
-  targets = ["bin/kolourpaint"];
-}
\ No newline at end of file
+mkDerivation {
+  name = "kolourpaint";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  propagatedBuildInputs = [ kdelibs4support libkexiv2 ];
+  meta = {
+    maintainers = [ lib.maintainers.fridh ];
+    license = with lib.licenses; [ gpl2 ];
+  };
+}
diff --git a/pkgs/applications/kde/kompare.nix b/pkgs/applications/kde/kompare.nix
index 660090dc84ae..cf2fa2e6a10f 100644
--- a/pkgs/applications/kde/kompare.nix
+++ b/pkgs/applications/kde/kompare.nix
@@ -1,21 +1,14 @@
 {
-  kdeApp, lib, kdeWrapper,
+  mkDerivation, lib,
   extra-cmake-modules, kdoctools,
   kparts, ktexteditor, kwidgetsaddons, libkomparediff2
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "kompare";
-      meta = { license = with lib.licenses; [ gpl2 ]; };
-      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-      propagatedBuildInputs = [
-        kparts ktexteditor kwidgetsaddons libkomparediff2
-      ];
-    };
-in
-kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/kompare" ];
+mkDerivation {
+  name = "kompare";
+  meta = { license = with lib.licenses; [ gpl2 ]; };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  propagatedBuildInputs = [
+    kparts ktexteditor kwidgetsaddons libkomparediff2
+  ];
 }
diff --git a/pkgs/applications/kde/konsole.nix b/pkgs/applications/kde/konsole.nix
index 15b6373bdb02..bd026c6f0395 100644
--- a/pkgs/applications/kde/konsole.nix
+++ b/pkgs/applications/kde/konsole.nix
@@ -1,5 +1,5 @@
 {
-  kdeApp, lib, kdeWrapper,
+  mkDerivation, lib,
   extra-cmake-modules, kdoctools,
   kbookmarks, kcompletion, kconfig, kconfigwidgets, kcoreaddons, kguiaddons,
   ki18n, kiconthemes, kinit, kdelibs4support, kio, knotifications,
@@ -7,24 +7,17 @@
   kwindowsystem, kxmlgui, qtscript
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "konsole";
-      meta = {
-        license = with lib.licenses; [ gpl2 lgpl21 fdl12 ];
-        maintainers = [ lib.maintainers.ttuegel ];
-      };
-      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-      propagatedBuildInputs = [
-        kdelibs4support ki18n kwindowsystem qtscript kbookmarks kcompletion
-        kconfig kconfigwidgets kcoreaddons kguiaddons kiconthemes kinit kio
-        knotifications knotifyconfig kparts kpty kservice ktextwidgets
-        kwidgetsaddons kxmlgui
-      ];
-    };
-in
-kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/konsole" ];
+mkDerivation {
+  name = "konsole";
+  meta = {
+    license = with lib.licenses; [ gpl2 lgpl21 fdl12 ];
+    maintainers = [ lib.maintainers.ttuegel ];
+  };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ ki18n ];
+  propagatedBuildInputs = [
+    kbookmarks kcompletion kconfig kconfigwidgets kcoreaddons kdelibs4support
+    kguiaddons kiconthemes kinit kio knotifications knotifyconfig kparts kpty
+    kservice ktextwidgets kwidgetsaddons kwindowsystem kxmlgui qtscript
+  ];
 }
diff --git a/pkgs/applications/kde/krfb.nix b/pkgs/applications/kde/krfb.nix
index ef5530be6fa6..0f4aecb83d41 100644
--- a/pkgs/applications/kde/krfb.nix
+++ b/pkgs/applications/kde/krfb.nix
@@ -1,22 +1,16 @@
 {
-  kdeApp, lib, kdeWrapper,
+  mkDerivation, lib,
   extra-cmake-modules, kdoctools,
   kdelibs4support, kdnssd, libvncserver, libXtst
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "krfb";
-      meta = {
-        license = with lib.licenses; [ gpl2 fdl12 ];
-        maintainers = with lib.maintainers; [ jerith666 ];
-      };
-      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-      propagatedBuildInputs = [ kdelibs4support kdnssd libvncserver libXtst ];
-    };
-in
-kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/krfb" ];
+mkDerivation {
+  name = "krfb";
+  meta = {
+    license = with lib.licenses; [ gpl2 fdl12 ];
+    maintainers = with lib.maintainers; [ jerith666 ];
+  };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ libvncserver libXtst ];
+  propagatedBuildInputs = [ kdelibs4support kdnssd ];
 }
diff --git a/pkgs/applications/kde/kwalletmanager.nix b/pkgs/applications/kde/kwalletmanager.nix
index afa870d90a54..e39e7e5157d2 100644
--- a/pkgs/applications/kde/kwalletmanager.nix
+++ b/pkgs/applications/kde/kwalletmanager.nix
@@ -1,6 +1,5 @@
 { lib
-, kdeApp
-, kdeWrapper
+, mkDerivation
 , extra-cmake-modules
 , kdoctools
 , kauth
@@ -9,28 +8,19 @@
 , kcoreaddons
 , kdbusaddons
 , kdelibs4support
+, kwallet
 , kxmlgui
 }:
 
-let
-  unwrapped = kdeApp {
-    name = "kwalletmanager";
-    meta = {
-      license = with lib.licenses; [ gpl2 ];
-      maintainers = with lib.maintainers; [ fridh ];
-    };
-    nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-    propagatedBuildInputs = [
-      kauth
-      kcmutils
-      kconfigwidgets
-      kcoreaddons
-      kdbusaddons
-      kdelibs4support
-      kxmlgui
-    ];
+mkDerivation {
+  name = "kwalletmanager";
+  meta = {
+    license = with lib.licenses; [ gpl2 ];
+    maintainers = with lib.maintainers; [ fridh ];
   };
-in kdeWrapper {
-  inherit unwrapped;
-  targets = ["bin/kwalletmanager5"];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    kauth kcmutils kconfigwidgets kcoreaddons kdbusaddons kdelibs4support
+    kwallet kxmlgui
+  ];
 }
diff --git a/pkgs/applications/kde/libkcddb.nix b/pkgs/applications/kde/libkcddb.nix
index 3d05714e8248..edd9732d051b 100644
--- a/pkgs/applications/kde/libkcddb.nix
+++ b/pkgs/applications/kde/libkcddb.nix
@@ -1,8 +1,8 @@
-{ kdeApp, lib, extra-cmake-modules, qtbase, kdoctools
+{ mkDerivation, lib, extra-cmake-modules, qtbase, kdoctools
 , kcodecs, ki18n, kio, kwidgetsaddons
 , libmusicbrainz5 }:
 
-kdeApp {
+mkDerivation {
   name = "libkcddb";
   meta = with lib; {
     license = with licenses; [ gpl2 lgpl21 bsd3 ];
@@ -14,5 +14,4 @@ kdeApp {
     kcodecs ki18n kio kwidgetsaddons
     libmusicbrainz5
   ];
-  enableParallelBuilding = true;
 }
diff --git a/pkgs/applications/kde/libkdcraw.nix b/pkgs/applications/kde/libkdcraw.nix
index 179e9f414dc3..383bd3b67037 100644
--- a/pkgs/applications/kde/libkdcraw.nix
+++ b/pkgs/applications/kde/libkdcraw.nix
@@ -1,6 +1,6 @@
-{ kdeApp, lib, extra-cmake-modules, libraw, qtbase }:
+{ mkDerivation, lib, extra-cmake-modules, libraw, qtbase }:
 
-kdeApp {
+mkDerivation {
   name = "libkdcraw";
   meta = {
     license = with lib.licenses; [ gpl2 lgpl21 bsd3 ];
diff --git a/pkgs/applications/kde/libkexiv2.nix b/pkgs/applications/kde/libkexiv2.nix
index 0991c5df5ab4..816d4168967c 100644
--- a/pkgs/applications/kde/libkexiv2.nix
+++ b/pkgs/applications/kde/libkexiv2.nix
@@ -1,6 +1,6 @@
-{ kdeApp, lib, exiv2, extra-cmake-modules, qtbase }:
+{ mkDerivation, lib, exiv2, extra-cmake-modules, qtbase }:
 
-kdeApp {
+mkDerivation {
   name = "libkexiv2";
   meta = {
     license = with lib.licenses; [ gpl2 lgpl21 bsd3 ];
diff --git a/pkgs/applications/kde/libkipi.nix b/pkgs/applications/kde/libkipi.nix
index 32eeb171ff89..3a28d8c2e8c3 100644
--- a/pkgs/applications/kde/libkipi.nix
+++ b/pkgs/applications/kde/libkipi.nix
@@ -1,6 +1,6 @@
-{ kdeApp, lib, extra-cmake-modules, kconfig, ki18n, kservice, kxmlgui }:
+{ mkDerivation, lib, extra-cmake-modules, kconfig, ki18n, kservice, kxmlgui }:
 
-kdeApp {
+mkDerivation {
   name = "libkipi";
   meta = {
     license = with lib.licenses; [ gpl2 lgpl21 bsd3 ];
diff --git a/pkgs/applications/kde/libkomparediff2.nix b/pkgs/applications/kde/libkomparediff2.nix
index aacc89a0efe3..52aa2b10e241 100644
--- a/pkgs/applications/kde/libkomparediff2.nix
+++ b/pkgs/applications/kde/libkomparediff2.nix
@@ -1,6 +1,6 @@
-{ kdeApp, lib, extra-cmake-modules, ki18n, kxmlgui, kcodecs, kio }:
+{ mkDerivation, lib, extra-cmake-modules, ki18n, kxmlgui, kcodecs, kio }:
 
-kdeApp {
+mkDerivation {
   name = "libkomparediff2";
   nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ kcodecs ki18n kxmlgui kio ];
diff --git a/pkgs/applications/kde/marble.nix b/pkgs/applications/kde/marble.nix
index 5322c66b01d1..1217c29032b4 100644
--- a/pkgs/applications/kde/marble.nix
+++ b/pkgs/applications/kde/marble.nix
@@ -1,28 +1,16 @@
-{ kdeApp, lib, kdeWrapper
+{ mkDerivation, lib
 , extra-cmake-modules, kdoctools
 , qtscript, qtsvg, qtquickcontrols, qtwebkit
 , krunner, shared_mime_info, kparts, knewstuff
 , gpsd, perl
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "marble";
-      meta.license = with lib.licenses; [ lgpl21 gpl3 ];
-
-      nativeBuildInputs = [ extra-cmake-modules kdoctools perl ];
-      propagatedBuildInputs = [
-        qtscript qtsvg qtquickcontrols qtwebkit shared_mime_info
-        krunner kparts knewstuff
-        gpsd
-      ];
-
-      enableParallelBuilding = true;
-    };
-in
-kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/marble-qt" "bin/marble" ];
-  paths = [ unwrapped ];
+mkDerivation {
+  name = "marble";
+  meta.license = with lib.licenses; [ lgpl21 gpl3 ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools perl ];
+  propagatedBuildInputs = [
+    qtscript qtsvg qtquickcontrols qtwebkit shared_mime_info krunner kparts
+    knewstuff gpsd
+  ];
 }
diff --git a/pkgs/applications/kde/okteta.nix b/pkgs/applications/kde/okteta.nix
index 59520e285327..deeffa3207b8 100644
--- a/pkgs/applications/kde/okteta.nix
+++ b/pkgs/applications/kde/okteta.nix
@@ -1,26 +1,18 @@
 {
-  kdeApp, lib, kdeWrapper,
+  mkDerivation, lib,
   extra-cmake-modules, kdoctools,
   kconfig, kinit,
   kcmutils, kconfigwidgets, knewstuff, kparts, qca-qt5
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "okteta";
-      meta = {
-        license = with lib.licenses; [ gpl2 ];
-        maintainers = with lib.maintainers; [ peterhoeg ];
-      };
-      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-      propagatedBuildInputs = [
-        kconfig kinit
-        kcmutils kconfigwidgets knewstuff kparts qca-qt5
-      ];
-    };
-
-in kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/okteta" ];
+mkDerivation {
+  name = "okteta";
+  meta = {
+    license = with lib.licenses; [ gpl2 ];
+    maintainers = with lib.maintainers; [ peterhoeg ];
+  };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  propagatedBuildInputs = [
+    kconfig kinit kcmutils kconfigwidgets knewstuff kparts qca-qt5
+  ];
 }
diff --git a/pkgs/applications/kde/okular.nix b/pkgs/applications/kde/okular.nix
index f5b3e38ca7c7..99b69f45e1eb 100644
--- a/pkgs/applications/kde/okular.nix
+++ b/pkgs/applications/kde/okular.nix
@@ -1,31 +1,25 @@
 {
-  kdeApp, lib, kdeWrapper,
+  mkDerivation, lib,
   extra-cmake-modules, kdoctools,
   djvulibre, ebook_tools, kactivities, karchive, kbookmarks, kcompletion,
   kconfig, kconfigwidgets, kcoreaddons, kdbusaddons, kdegraphics-mobipocket,
   kiconthemes, kjs, khtml, kio, kparts, kpty, kwallet, kwindowsystem, libkexiv2,
-  libspectre, poppler, qca-qt5, qtdeclarative, qtsvg, threadweaver
+  libspectre, phonon, poppler, qca-qt5, qtdeclarative, qtsvg, threadweaver
 }:
 
-let
-  unwrapped = kdeApp {
-    name = "okular";
-    nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-    propagatedBuildInputs = [
-      djvulibre ebook_tools kactivities karchive kbookmarks kcompletion kconfig
-      kconfigwidgets kcoreaddons kdbusaddons kdegraphics-mobipocket kiconthemes
-      kjs khtml kio kparts kpty kwallet kwindowsystem libkexiv2 libspectre poppler
-      qca-qt5 qtdeclarative qtsvg threadweaver
-    ];
-    meta = {
-      platforms = lib.platforms.linux;
-      homepage = "http://www.kde.org";
-      license = with lib.licenses; [ gpl2 lgpl21 fdl12 bsd3 ];
-      maintainers = [ lib.maintainers.ttuegel ];
-    };
+mkDerivation {
+  name = "okular";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    djvulibre ebook_tools kactivities karchive kbookmarks kcompletion kconfig kconfigwidgets
+    kcoreaddons kdbusaddons kdegraphics-mobipocket kiconthemes kjs khtml kio
+    kparts kpty kwallet kwindowsystem libkexiv2 libspectre phonon poppler
+    qca-qt5 qtdeclarative qtsvg threadweaver
+  ];
+  meta = {
+    platforms = lib.platforms.linux;
+    homepage = "http://www.kde.org";
+    license = with lib.licenses; [ gpl2 lgpl21 fdl12 bsd3 ];
+    maintainers = [ lib.maintainers.ttuegel ];
   };
-in
-kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/okular" ];
 }
diff --git a/pkgs/applications/kde/print-manager.nix b/pkgs/applications/kde/print-manager.nix
index 0a3d311eb27a..085b53de0f39 100644
--- a/pkgs/applications/kde/print-manager.nix
+++ b/pkgs/applications/kde/print-manager.nix
@@ -1,20 +1,22 @@
 {
-  kdeApp, lib, extra-cmake-modules,
-  cups, kconfig, kconfigwidgets, kdbusaddons, kiconthemes, ki18n, kcmutils, kio,
+  mkDerivation, lib,
+  extra-cmake-modules,
+  cups, ki18n,
+  kconfig, kconfigwidgets, kdbusaddons, kiconthemes, kcmutils, kio,
   knotifications, kwidgetsaddons, kwindowsystem, kitemviews, plasma-framework,
   qtdeclarative
 }:
 
-kdeApp {
+mkDerivation {
   name = "print-manager";
   meta = {
     license = [ lib.licenses.gpl2 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
   nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ cups ki18n ];
   propagatedBuildInputs = [
-    cups kconfig kconfigwidgets kdbusaddons kiconthemes kcmutils knotifications
-    kwidgetsaddons kitemviews ki18n kio kwindowsystem plasma-framework
-    qtdeclarative
+    kconfig kconfigwidgets kdbusaddons kiconthemes kcmutils knotifications
+    kwidgetsaddons kitemviews kio kwindowsystem plasma-framework qtdeclarative
   ];
 }
diff --git a/pkgs/applications/kde/spectacle.nix b/pkgs/applications/kde/spectacle.nix
index 30abfc23e834..db1bf2aee659 100644
--- a/pkgs/applications/kde/spectacle.nix
+++ b/pkgs/applications/kde/spectacle.nix
@@ -1,25 +1,20 @@
 {
-  kdeApp, lib, kdeWrapper,
+  mkDerivation, lib,
   extra-cmake-modules, kdoctools,
-  kconfig, kcoreaddons, kdbusaddons, kdeclarative, ki18n, kio, kipi-plugins,
+  ki18n, xcb-util-cursor,
+  kconfig, kcoreaddons, kdbusaddons, kdeclarative, kio, kipi-plugins,
   knotifications, kscreen, kwidgetsaddons, kwindowsystem, kxmlgui, libkipi,
-  xcb-util-cursor
+  qtx11extras
 }:
 
-let
-  unwrapped =
-    kdeApp {
-      name = "spectacle";
-      meta = with lib; { maintainers = with maintainers; [ ttuegel ]; };
-      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-      propagatedBuildInputs = [
-        kconfig kcoreaddons kdbusaddons kdeclarative ki18n kio knotifications
-        kscreen kwidgetsaddons kwindowsystem kxmlgui libkipi xcb-util-cursor
-      ];
-    };
-in
-kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/spectacle" ];
-  paths = [ kipi-plugins ];
+mkDerivation {
+  name = "spectacle";
+  meta = with lib; { maintainers = with maintainers; [ ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ ki18n xcb-util-cursor ];
+  propagatedBuildInputs = [
+    kconfig kcoreaddons kdbusaddons kdeclarative kio knotifications
+    kscreen kwidgetsaddons kwindowsystem kxmlgui libkipi qtx11extras
+  ];
+  propagatedUserEnvPkgs = [ kipi-plugins ];
 }
diff --git a/pkgs/applications/misc/albert/default.nix b/pkgs/applications/misc/albert/default.nix
index f3c011e33335..854408e6e3e6 100644
--- a/pkgs/applications/misc/albert/default.nix
+++ b/pkgs/applications/misc/albert/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchFromGitHub, qtbase, qtsvg, qtx11extras, makeQtWrapper, muparser, cmake }:
+{ mkDerivation, lib, fetchFromGitHub, qtbase, qtsvg, qtx11extras, muparser, cmake }:
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   name    = "albert-${version}";
   version = "0.11.3";
 
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "0ddz6h1334b9kqy1lfi7qa21znm3l0b9h0d4s62llxdasv103jh5";
   };
 
-  nativeBuildInputs = [ cmake makeQtWrapper ];
+  nativeBuildInputs = [ cmake ];
 
   buildInputs = [ qtbase qtsvg qtx11extras muparser ];
 
@@ -31,11 +31,7 @@ stdenv.mkDerivation rec {
     rm "$out/lib"
   '';
 
-  fixupPhase = ''
-    wrapQtProgram $out/bin/albert
-  '';
-
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage    = https://albertlauncher.github.io/;
     description = "Desktop agnostic launcher";
     license     = licenses.gpl3Plus;
diff --git a/pkgs/applications/misc/calibre/default.nix b/pkgs/applications/misc/calibre/default.nix
index 49c005cf739d..5845fe85ccb5 100644
--- a/pkgs/applications/misc/calibre/default.nix
+++ b/pkgs/applications/misc/calibre/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, fetchpatch, poppler_utils, pkgconfig, libpng
-, imagemagick, libjpeg, fontconfig, podofo, qtbase, qmakeHook, icu, sqlite
+, imagemagick, libjpeg, fontconfig, podofo, qtbase, qmake, icu, sqlite
 , makeWrapper, unrarSupport ? false, chmlib, python2Packages, xz, libusb1, libmtp
 , xdg_utils, makeDesktopItem, wrapGAppsHook
 }:
@@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  nativeBuildInputs = [ makeWrapper pkgconfig qmakeHook ];
+  nativeBuildInputs = [ makeWrapper pkgconfig qmake ];
 
   buildInputs = [
     poppler_utils libpng imagemagick libjpeg
diff --git a/pkgs/applications/misc/cool-retro-term/default.nix b/pkgs/applications/misc/cool-retro-term/default.nix
index 9ff27c747091..48e08be54748 100644
--- a/pkgs/applications/misc/cool-retro-term/default.nix
+++ b/pkgs/applications/misc/cool-retro-term/default.nix
@@ -1,5 +1,5 @@
-{ stdenv, fetchgit, makeQtWrapper, qtbase, qtquick1, qmltermwidget,
-qtquickcontrols, qtgraphicaleffects, qmakeHook }:
+{ stdenv, fetchgit, qtbase, qtquick1, qmltermwidget,
+qtquickcontrols, qtgraphicaleffects, qmake }:
 
 stdenv.mkDerivation rec {
   version = "1.0.0";
@@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
   '';
 
   buildInputs = [ qtbase qtquick1 qmltermwidget qtquickcontrols qtgraphicaleffects ];
-  nativeBuildInputs = [ makeQtWrapper qmakeHook ];
+  nativeBuildInputs = [ qmake ];
 
   installFlags = [ "INSTALL_ROOT=$(out)" ];
 
@@ -25,8 +25,6 @@ stdenv.mkDerivation rec {
     mv $out/usr/share $out/share
     mv $out/usr/bin $out/bin
     rmdir $out/usr
-
-    wrapQtProgram $out/bin/cool-retro-term
   '';
 
   enableParallelBuilding = true;
diff --git a/pkgs/applications/misc/cura/default.nix b/pkgs/applications/misc/cura/default.nix
index ff18796e39d6..e33edfb0a440 100644
--- a/pkgs/applications/misc/cura/default.nix
+++ b/pkgs/applications/misc/cura/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, lib, fetchFromGitHub, cmake, python3, qtbase, makeQtWrapper, curaengine }:
+{ mkDerivation, lib, fetchFromGitHub, cmake, python3, qtbase, curaengine }:
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   name = "cura-${version}";
   version = "2.4.0";
 
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ qtbase ];
   propagatedBuildInputs = with python3.pkgs; [ uranium zeroconf pyserial ];
-  nativeBuildInputs = [ cmake python3.pkgs.wrapPython makeQtWrapper ];
+  nativeBuildInputs = [ cmake python3.pkgs.wrapPython ];
 
   cmakeFlags = [ "-DCMAKE_MODULE_PATH=${python3.pkgs.uranium}/share/cmake-${cmake.majorVersion}/Modules" ];
 
@@ -24,11 +24,9 @@ stdenv.mkDerivation rec {
 
   postFixup = ''
     wrapPythonPrograms
-    mv $out/bin/cura $out/bin/.cura-noqtpath
-    makeQtWrapper $out/bin/.cura-noqtpath $out/bin/cura
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "3D printer / slicing GUI built on top of the Uranium framework";
     homepage = "https://github.com/Ultimaker/Cura";
     license = licenses.agpl3;
diff --git a/pkgs/applications/misc/golden-cheetah/default.nix b/pkgs/applications/misc/golden-cheetah/default.nix
index d6da900656cc..358d9dff44a6 100644
--- a/pkgs/applications/misc/golden-cheetah/default.nix
+++ b/pkgs/applications/misc/golden-cheetah/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl
 , qtbase, qtsvg, qtserialport, qtwebkit, qtmultimedia, qttools, qtconnectivity
-, yacc, flex, zlib, config, qmakeHook, makeQtWrapper
+, yacc, flex, zlib, config, qmake, makeWrapper
 }:
 stdenv.mkDerivation rec {
   name = "golden-cheetah-${version}";
@@ -10,11 +10,11 @@ stdenv.mkDerivation rec {
     url = "https://github.com/GoldenCheetah/GoldenCheetah/archive/V${version}.tar.gz";
     sha256 = "0fiz2pj155cd357kph50lc6rjyzwp045glfv4y68qls9j7m9ayaf";
   };
-  qtInputs = [
-    qtbase qtsvg qtserialport qtwebkit qtmultimedia qttools yacc flex zlib
+  buildInputs = [
+    qtbase qtsvg qtserialport qtwebkit qtmultimedia qttools zlib
     qtconnectivity
   ];
-  nativeBuildInputs = [ makeQtWrapper qmakeHook ] ++ qtInputs;
+  nativeBuildInputs = [ flex makeWrapper qmake yacc ];
   preConfigure = ''
     cp src/gcconfig.pri.in src/gcconfig.pri
     cp qwt/qwtconfig.pri.in qwt/qwtconfig.pri
@@ -26,7 +26,7 @@ stdenv.mkDerivation rec {
 
     mkdir -p $out/bin
     cp src/GoldenCheetah $out/bin
-    wrapQtProgram $out/bin/GoldenCheetah --set LD_LIBRARY_PATH "${zlib.out}/lib"
+    wrapProgram $out/bin/GoldenCheetah --set LD_LIBRARY_PATH "${zlib.out}/lib"
 
     runHook postInstall
   '';
diff --git a/pkgs/applications/misc/goldendict/default.nix b/pkgs/applications/misc/goldendict/default.nix
index be36eeceb6b6..278c685b7cf7 100644
--- a/pkgs/applications/misc/goldendict/default.nix
+++ b/pkgs/applications/misc/goldendict/default.nix
@@ -1,7 +1,8 @@
 { stdenv, fetchurl, pkgconfig, libXtst, libvorbis, hunspell
 , libao, ffmpeg, libeb, lzo, xz, libtiff
-, qtbase, qtsvg, qtwebkit, qtx11extras, qttools, qmakeHook }:
+, qtbase, qtsvg, qtwebkit, qtx11extras, qttools, qmake }:
 stdenv.mkDerivation rec {
+
   name = "goldendict-1.5.0.rc2";
   src = fetchurl {
     url = "https://github.com/goldendict/goldendict/archive/1.5.0-RC2.tar.gz";
@@ -9,10 +10,12 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [
-    pkgconfig qtbase qtsvg qtwebkit qtx11extras qttools libXtst libvorbis hunspell libao ffmpeg libeb
-    lzo xz libtiff qmakeHook
+    pkgconfig qtbase qtsvg qtwebkit qtx11extras qttools
+    libXtst libvorbis hunspell libao ffmpeg libeb lzo xz libtiff
   ];
 
+  nativeBuildInputs = [ qmake ];
+
   qmakeFlags = [ "CONFIG+=zim_support" ];
 
   meta = {
diff --git a/pkgs/applications/misc/gpxsee/default.nix b/pkgs/applications/misc/gpxsee/default.nix
index 42fc1e46e33f..16147715705e 100644
--- a/pkgs/applications/misc/gpxsee/default.nix
+++ b/pkgs/applications/misc/gpxsee/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, qmakeHook, qtbase, qttools, makeQtWrapper }:
+{ stdenv, fetchFromGitHub, qmake, qtbase, qttools }:
 
 stdenv.mkDerivation rec {
   name = "gpxsee-${version}";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "17s1v6b1j7pi0yj554bd0cg14bl854gssp5gj2pl51rxji6zr0wp";
   };
 
-  nativeBuildInputs = [ qmakeHook qttools makeQtWrapper ];
+  nativeBuildInputs = [ qmake qttools ];
 
   preConfigure = ''
     substituteInPlace src/config.h --replace /usr/share/gpxsee $out/share/gpxsee
@@ -20,7 +20,6 @@ stdenv.mkDerivation rec {
 
   preFixup = ''
     install -Dm755 GPXSee $out/bin/GPXSee
-    wrapQtProgram $out/bin/GPXSee
 
     mkdir -p $out/share/gpxsee
     cp pkg/maps.txt $out/share/gpxsee
diff --git a/pkgs/applications/misc/hugo/default.nix b/pkgs/applications/misc/hugo/default.nix
index 8d14db09c3fb..4fe62179b250 100644
--- a/pkgs/applications/misc/hugo/default.nix
+++ b/pkgs/applications/misc/hugo/default.nix
@@ -2,15 +2,15 @@
 
 buildGoPackage rec {
   name = "hugo-${version}";
-  version = "0.22.1";
+  version = "0.23";
 
-  goPackagePath = "github.com/spf13/hugo";
+  goPackagePath = "github.com/gohugoio/hugo";
 
   src = fetchFromGitHub {
     owner = "spf13";
     repo = "hugo";
     rev = "v${version}";
-    sha256 = "0m459np11izsflwdja6k0znaxvd8zpgivvswnq9501m49h8m4x7q";
+    sha256 = "0phw5pcmrmryxb83jzifhqh3vx20qiwh4dkk802v38fw07z1hvki";
   };
 
   goDeps = ./deps.nix;
diff --git a/pkgs/applications/misc/hugo/deps.nix b/pkgs/applications/misc/hugo/deps.nix
index 1daab7854d89..2b8449438654 100644
--- a/pkgs/applications/misc/hugo/deps.nix
+++ b/pkgs/applications/misc/hugo/deps.nix
@@ -31,8 +31,8 @@
     fetch = {
       type = "git";
       url = "https://github.com/bep/gitmap";
-      rev = "dcb907b39a0690430d435eb8f63cd8811961231f";
-      sha256 = "0bw4spyiidrvd8rls9g57mwxykfmv57qi9mcnjadbqrpv92br856";
+      rev = "de8030ebafb76c6e84d50ee6d143382637c00598";
+      sha256 = "0adkv2ghi0zd104akksa9wjzj7s849wpa1rij03mycgxp4si9ami";
     };
   }
   {
@@ -247,8 +247,8 @@
     fetch = {
       type = "git";
       url = "https://github.com/russross/blackfriday";
-      rev = "0ba0f2b6ed7c475a92e4df8641825cb7a11d1fa3";
-      sha256 = "0jj9zkk64sxs8vpfhz95y9li30q6qnxm7sncsfjn2ykcdgs252f7";
+      rev = "067529f716f4c3f5e37c8c95ddd59df1007290ae";
+      sha256 = "1l61ib6r6mg587p58li5zhafjkkmrzacachcjg1cvw0k4zza9137";
     };
   }
   {
diff --git a/pkgs/applications/misc/kdeconnect/default.nix b/pkgs/applications/misc/kdeconnect/default.nix
index 22c9cfc7e986..743a20b6bfc5 100644
--- a/pkgs/applications/misc/kdeconnect/default.nix
+++ b/pkgs/applications/misc/kdeconnect/default.nix
@@ -2,7 +2,6 @@
 , lib
 , fetchurl
 , extra-cmake-modules
-, makeQtWrapper
 , kcmutils
 , kconfigwidgets
 , kdbusaddons
@@ -35,14 +34,7 @@ stdenv.mkDerivation rec {
     libXtst
   ];
 
-  nativeBuildInputs = [
-    extra-cmake-modules
-    makeQtWrapper
-  ];
-
-  postInstall = ''
-    wrapQtProgram "$out/bin/kdeconnect-cli"
-  '';
+  nativeBuildInputs = [ extra-cmake-modules ];
 
   meta = {
     description = "KDE Connect provides several features to integrate your phone and your computer";
diff --git a/pkgs/applications/misc/krename/default.nix b/pkgs/applications/misc/krename/default.nix
index 1137d6c07f6a..22cd14c19525 100644
--- a/pkgs/applications/misc/krename/default.nix
+++ b/pkgs/applications/misc/krename/default.nix
@@ -1,35 +1,30 @@
 {
-  kdeDerivation, kdeWrapper, fetchFromGitHub, lib,
-  extra-cmake-modules, kdoctools, kconfig, kinit, kjsembed,
-  taglib, exiv2, podofo
+  mkDerivation, fetchFromGitHub, lib,
+  extra-cmake-modules, kdoctools, wrapGAppsHook,
+  kconfig, kinit, kjsembed, taglib, exiv2, podofo
 }:
 
 let
   pname = "krename";
-  version = "20161228";
-  unwrapped = kdeDerivation rec {
-    name = "${pname}-${version}";
+  version = "20170610";
+in mkDerivation rec {
+  name = "${pname}-${version}";
 
-    src = fetchFromGitHub {
-      owner  = "KDE";
-      repo   = "krename";
-      rev    = "4e55c2bef50898eb4a6485ce068379b166121895";
-      sha256 = "09yz3sxy2l6radfybkj2f7224ggf315vnvyksk0aq8f03gan6cbp";
-    };
-
-    meta = with lib; {
-      homepage = http://www.krename.net;
-      description = "A powerful batch renamer for KDE";
-      inherit (kconfig.meta) platforms;
-      maintainers = with maintainers; [ peterhoeg ];
-    };
+  src = fetchFromGitHub {
+    owner  = "KDE";
+    repo   = "krename";
+    rev    = "18000edfec52de0b417d575e14eb078b4bd7b2f3";
+    sha256 = "0hsrlfrbi42jqqnkcz682c6yrfi3xpl299672knj22074wr6sv0j";
+  };
 
-    buildInputs = [ taglib exiv2 podofo ];
-    nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-    propagatedBuildInputs = [ kconfig kinit kjsembed ];
+  meta = with lib; {
+    homepage = http://www.krename.net;
+    description = "A powerful batch renamer for KDE";
+    inherit (kconfig.meta) platforms;
+    maintainers = with maintainers; [ peterhoeg ];
   };
 
-in kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/krename" ];
+  buildInputs = [ taglib exiv2 podofo ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools wrapGAppsHook ];
+  propagatedBuildInputs = [ kconfig kinit kjsembed ];
 }
diff --git a/pkgs/applications/misc/krusader/default.nix b/pkgs/applications/misc/krusader/default.nix
index c085d916d86c..7f5dad62d264 100644
--- a/pkgs/applications/misc/krusader/default.nix
+++ b/pkgs/applications/misc/krusader/default.nix
@@ -1,33 +1,27 @@
 {
-  kdeDerivation, kdeWrapper, fetchurl, lib,
-  extra-cmake-modules, kdoctools,
+  mkDerivation, fetchurl, lib,
+  extra-cmake-modules, kdoctools, wrapGAppsHook,
   kconfig, kinit, kparts
 }:
 
 let
   pname = "krusader";
   version = "2.6.0";
-  unwrapped = kdeDerivation rec {
-    name = "krusader-${version}";
+in mkDerivation rec {
+  name = "krusader-${version}";
 
-    src = fetchurl {
-      url = "mirror://kde/stable/${pname}/${version}/${name}.tar.xz";
-      sha256 = "0f9skfvp0hdml8qq6v22z9293ndijd8kwbpdj7wpvgd6mlya8qbh";
-    };
-
-    meta = with lib; {
-      description = "Norton/Total Commander clone for KDE";
-      license = licenses.gpl2;
-      homepage = http://www.krusader.org;
-      maintainers = with maintainers; [ sander ];
-    };
+  src = fetchurl {
+    url = "mirror://kde/stable/${pname}/${version}/${name}.tar.xz";
+    sha256 = "0f9skfvp0hdml8qq6v22z9293ndijd8kwbpdj7wpvgd6mlya8qbh";
+  };
 
-    nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-    propagatedBuildInputs = [ kconfig kinit kparts ];
-    enableParallelBuilding = true;
+  meta = with lib; {
+    description = "Norton/Total Commander clone for KDE";
+    license = licenses.gpl2;
+    homepage = http://www.krusader.org;
+    maintainers = with maintainers; [ sander ];
   };
 
-in kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/krusader" ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools wrapGAppsHook ];
+  propagatedBuildInputs = [ kconfig kinit kparts ];
 }
diff --git a/pkgs/applications/misc/latte-dock/default.nix b/pkgs/applications/misc/latte-dock/default.nix
index cdde0beb8270..1b2cf94d173d 100644
--- a/pkgs/applications/misc/latte-dock/default.nix
+++ b/pkgs/applications/misc/latte-dock/default.nix
@@ -1,33 +1,26 @@
-{ stdenv, lib, cmake, xorg, plasma-framework, fetchFromGitHub, kdeWrapper }:
+{ mkDerivation, lib, cmake, xorg, plasma-framework, fetchFromGitHub }:
 
-let version = "0.6.0";
+let version = "0.6.0"; in
 
-    unwrapped = stdenv.mkDerivation {
-      name = "latte-dock-${version}";
+mkDerivation {
+  name = "latte-dock-${version}";
 
-      src = fetchFromGitHub {
-        owner = "psifidotos";
-        repo = "Latte-Dock";
-        rev = "v${version}";
-        sha256 = "1967hx4lavy96vvik8d5m2c6ycd2mlf9cmhrv40zr0784ni0ikyv";
-      };
+  src = fetchFromGitHub {
+    owner = "psifidotos";
+    repo = "Latte-Dock";
+    rev = "v${version}";
+    sha256 = "1967hx4lavy96vvik8d5m2c6ycd2mlf9cmhrv40zr0784ni0ikyv";
+  };
 
-      buildInputs = [ plasma-framework xorg.libpthreadstubs xorg.libXdmcp ];
+  buildInputs = [ plasma-framework xorg.libpthreadstubs xorg.libXdmcp ];
 
-      nativeBuildInputs = [ cmake ];
+  nativeBuildInputs = [ cmake ];
 
-      enableParallelBuilding = true;
-
-      meta = with stdenv.lib; {
-        description = "Dock-style app launcher based on Plasma frameworks";
-        homepage = https://github.com/psifidotos/Latte-Dock;
-        license = licenses.gpl2;
-        platforms = platforms.unix;
-        maintainers = [ maintainers.benley ];
-      };
-    };
-
-in kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/latte-dock" ];
+  meta = with lib; {
+    description = "Dock-style app launcher based on Plasma frameworks";
+    homepage = https://github.com/psifidotos/Latte-Dock;
+    license = licenses.gpl2;
+    platforms = platforms.unix;
+    maintainers = [ maintainers.benley ];
+  };
 }
diff --git a/pkgs/applications/misc/openbrf/default.nix b/pkgs/applications/misc/openbrf/default.nix
index 50c8fc7bcecd..5016acfff124 100644
--- a/pkgs/applications/misc/openbrf/default.nix
+++ b/pkgs/applications/misc/openbrf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, qtbase, vcg, glew, qmakeHook, makeQtWrapper, mesa }:
+{ stdenv, fetchFromGitHub, qtbase, vcg, glew, qmake, mesa }:
 
 
 stdenv.mkDerivation {
@@ -12,9 +12,9 @@ stdenv.mkDerivation {
   };
 
   buildInputs = [ qtbase vcg glew ];
-  nativeBuildInputs = [ qmakeHook makeQtWrapper ];
 
   enableParallelBuilding = true;
+  nativeBuildInputs = [ qmake ];
 
   qmakeFlags = [ "openBrf.pro" ];
 
@@ -31,7 +31,7 @@ stdenv.mkDerivation {
       --set-rpath "${stdenv.lib.makeLibraryPath [ qtbase glew stdenv.cc.cc mesa ]}" \
       $out/share/openBrf/openBrf
 
-    makeQtWrapper "$out/share/openBrf/openBrf" "$out/bin/openBrf"
+    ln -s "$out/share/openBrf/openBrf" "$out/bin/openBrf"
   '';
 
   dontPatchELF = true;
diff --git a/pkgs/applications/misc/qsyncthingtray/default.nix b/pkgs/applications/misc/qsyncthingtray/default.nix
index d6aea74d9972..671370252a79 100644
--- a/pkgs/applications/misc/qsyncthingtray/default.nix
+++ b/pkgs/applications/misc/qsyncthingtray/default.nix
@@ -1,10 +1,10 @@
-{ stdenv, lib, fetchFromGitHub, procps ? null
+{ mkDerivation, stdenv, lib, fetchFromGitHub, procps ? null
 , qtbase, qtwebengine, qtwebkit
-, cmake, makeQtWrapper
+, cmake
 , syncthing, syncthing-inotify ? null
 , preferQWebView ? false }:
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   version = "0.5.7";
   name = "qsyncthingtray-${version}";
 
@@ -16,8 +16,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ qtbase qtwebengine ] ++ lib.optional preferQWebView qtwebkit;
-  nativeBuildInputs = [ cmake makeQtWrapper ];
-  enableParallelBuilding = true;
+  nativeBuildInputs = [ cmake ];
 
   cmakeFlags = lib.optional preferQWebView "-DQST_BUILD_WEBKIT=1";
 
@@ -41,12 +40,11 @@ stdenv.mkDerivation rec {
     mkdir -p $out/bin
     install -m755 QSyncthingTray $out/bin/${qst}
     ln -s $out/bin/${qst} $out/bin/QSyncthingTray
-    wrapQtProgram $out/bin/qsyncthingtray
 
     runHook postInstall
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = https://github.com/sieren/QSyncthingTray/;
     description = "A Traybar Application for Syncthing written in C++";
     longDescription = ''
diff --git a/pkgs/applications/misc/qtpass/default.nix b/pkgs/applications/misc/qtpass/default.nix
index 4cdb6591465e..d300e411c942 100644
--- a/pkgs/applications/misc/qtpass/default.nix
+++ b/pkgs/applications/misc/qtpass/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, git, gnupg, makeQtWrapper, pass, qtbase, qtsvg, qttools, qmakeHook }:
+{ stdenv, fetchFromGitHub, git, gnupg, pass, qtbase, qtsvg, qttools, qmake, makeWrapper }:
 
 stdenv.mkDerivation rec {
   name = "qtpass-${version}";
@@ -13,10 +13,10 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ git gnupg pass qtbase qtsvg qttools ];
 
-  nativeBuildInputs = [ makeQtWrapper qmakeHook ];
+  nativeBuildInputs = [ makeWrapper qmake ];
 
   preConfigure = ''
-    qmakeFlags="$qmakeFlags CONFIG+=release DESTDIR=$out"
+    qmakeFlags="$qmakeFlags DESTDIR=$out"
   '';
 
   installPhase = ''
@@ -28,7 +28,7 @@ stdenv.mkDerivation rec {
   '';
 
   postInstall = ''
-    wrapQtProgram $out/bin/qtpass \
+    wrapProgram $out/bin/qtpass \
       --suffix PATH : ${git}/bin \
       --suffix PATH : ${gnupg}/bin \
       --suffix PATH : ${pass}/bin
diff --git a/pkgs/applications/misc/redis-desktop-manager/default.nix b/pkgs/applications/misc/redis-desktop-manager/default.nix
index 9d333da01cb6..0ba850a34607 100644
--- a/pkgs/applications/misc/redis-desktop-manager/default.nix
+++ b/pkgs/applications/misc/redis-desktop-manager/default.nix
@@ -1,7 +1,7 @@
 { stdenv, lib, fetchgit, pkgconfig , libssh2
 , qtbase, qtdeclarative, qtgraphicaleffects, qtimageformats, qtquickcontrols
 , qtsvg, qttools, qtquick1
-, makeQtWrapper, qmakeHook
+, qmake
 }:
 
 let
@@ -24,7 +24,7 @@ stdenv.mkDerivation rec {
     sha256 = "0a7xa39qp1q32zkypw32mm3wi8wbhxhvrm6l3xsa3k1jzih7hzxr";
   };
 
-  nativeBuildInputs = [ makeQtWrapper qmakeHook ];
+  nativeBuildInputs = [ qmake ];
 
   buildInputs = [
     pkgconfig libssh2 qtbase qtdeclarative qtgraphicaleffects qtimageformats
@@ -68,7 +68,6 @@ EOF
     mkdir -p $out/bin
     instdir="$srcdir/bin/linux/release"
     cp $instdir/rdm $out/bin
-    wrapQtProgram $out/bin/rdm
   '';
 
   meta = with lib; {
diff --git a/pkgs/applications/misc/tint2/default.nix b/pkgs/applications/misc/tint2/default.nix
index 4b6f286351c1..3edc9b73bb54 100644
--- a/pkgs/applications/misc/tint2/default.nix
+++ b/pkgs/applications/misc/tint2/default.nix
@@ -6,13 +6,13 @@
 
 stdenv.mkDerivation rec {
   name = "tint2-${version}";
-  version = "0.14.5";
+  version = "0.14.6";
 
   src = fetchFromGitLab {
     owner = "o9000";
     repo = "tint2";
     rev = version;
-    sha256 = "1nfvcw95wggih7pxh53cx4nlamny73nh88ggfh6a0ajjhafrd2j2";
+    sha256 = "0v7i8araj85cbl45icinvmsz5741cx2ybjgkx72m3xfcb9fqg69l";
   };
 
   enableParallelBuilding = true;
@@ -28,8 +28,7 @@ stdenv.mkDerivation rec {
   '';
 
   prePatch = ''
-    for f in ./src/tint2conf/properties.c \
-             ./src/launcher/apps-common.c \
+    for f in ./src/launcher/apps-common.c \
              ./src/launcher/icon-theme-common.c \
              ./themes/*tint2rc
     do
diff --git a/pkgs/applications/misc/twmn/default.nix b/pkgs/applications/misc/twmn/default.nix
index c38b97b0e980..7ec3d66f31cf 100644
--- a/pkgs/applications/misc/twmn/default.nix
+++ b/pkgs/applications/misc/twmn/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, fetchgit, qtbase, qtx11extras, qmakeHook, pkgconfig, boost }:
+{ fetchurl, stdenv, fetchgit, qtbase, qtx11extras, qmake, pkgconfig, boost }:
 
 stdenv.mkDerivation rec {
   name = "twmn-git-2014-09-23";
@@ -9,7 +9,8 @@ stdenv.mkDerivation rec {
     sha256 = "1a68gka9gyxyzhc9rn8df59rzcdwkjw90cxp1kk0rdfp6svhxhsa";
   };
 
-  buildInputs = [ qtbase qtx11extras pkgconfig boost qmakeHook ];
+  nativeBuildInputs = [ pkgconfig qmake ];
+  buildInputs = [ qtbase qtx11extras boost ];
 
   postPatch = ''
     sed -i s/-Werror// twmnd/twmnd.pro
diff --git a/pkgs/applications/misc/udevil/default.nix b/pkgs/applications/misc/udevil/default.nix
index 8ce683ec9088..9a4b795061b5 100644
--- a/pkgs/applications/misc/udevil/default.nix
+++ b/pkgs/applications/misc/udevil/default.nix
@@ -7,8 +7,9 @@ stdenv.mkDerivation {
   };
   buildInputs = [ intltool glib pkgconfig udev ];
   configurePhase = ''
-    substituteInPlace src/Makefile.am --replace "-o root -g root" ""
     substituteInPlace src/Makefile.in --replace "-o root -g root" ""
+    # do not set setuid bit in nix store
+    substituteInPlace src/Makefile.in --replace 4755 0755
     ./configure \
       --prefix=$out \
       --with-mount-prog=${utillinux}/bin/mount \
@@ -17,10 +18,6 @@ stdenv.mkDerivation {
       --with-setfacl-prog=${acl.bin}/bin/setfacl \
       --sysconfdir=$prefix/etc
   '';
-  preConfigure = ''
-    cat src/Makefile.am
-    exit 2
-  '';
   patches = [ ./device-info-sys-stat.patch ];
   meta = {
     description = "A command line Linux program which mounts and unmounts removable devices without a password, shows device info, and monitors device changes";
diff --git a/pkgs/applications/misc/xca/default.nix b/pkgs/applications/misc/xca/default.nix
index 09da875e2360..80ecbdeba77f 100644
--- a/pkgs/applications/misc/xca/default.nix
+++ b/pkgs/applications/misc/xca/default.nix
@@ -1,9 +1,9 @@
-{ stdenv, fetchurl, pkgconfig, which, makeQtWrapper,
-  libtool, openssl, qtbase, qttools }:
+{ mkDerivation, lib, fetchurl, pkgconfig, which
+, libtool, openssl, qtbase, qttools }:
 
-with stdenv.lib;
+with lib;
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   name = "xca-${version}";
   version = "1.3.2";
 
@@ -16,7 +16,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ libtool openssl qtbase qttools ];
 
-  nativeBuildInputs = [ makeQtWrapper pkgconfig which ];
+  nativeBuildInputs = [ pkgconfig which ];
 
   configureFlags = [ "CXXFLAGS=-std=c++11" ];
 
@@ -26,12 +26,7 @@ stdenv.mkDerivation rec {
       --replace ${qtbase}/bin/uic ${qtbase.dev}/bin/uic
   '';
 
-  postInstall = ''
-    wrapQtProgram "$out/bin/xca"
-    wrapQtProgram "$out/bin/xca_db_stat"
-  '';
-
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Interface for managing asymetric keys like RSA or DSA";
     homepage = http://xca.sourceforge.net/;
     platforms = platforms.all;
diff --git a/pkgs/applications/misc/yakuake/default.nix b/pkgs/applications/misc/yakuake/default.nix
index a70b4be287c5..4a25f88ac75b 100644
--- a/pkgs/applications/misc/yakuake/default.nix
+++ b/pkgs/applications/misc/yakuake/default.nix
@@ -1,8 +1,8 @@
-{ kdeDerivation
+{ mkDerivation
 , lib
 , fetchurl
 , kdoctools
-, kdeWrapper
+, wrapGAppsHook
 , extra-cmake-modules
 , karchive
 , kcrash
@@ -18,11 +18,10 @@
 }:
 
 let
-  unwrapped = let
-    pname = "yakuake";
-    version = "3.0.3";
-  in kdeDerivation rec {
-    name = "${pname}-${version}";
+  pname = "yakuake";
+  version = "3.0.3";
+in mkDerivation rec {
+  name = "${pname}-${version}";
 
     src = fetchurl {
       url = "http://download.kde.org/stable/${pname}/${version}/src/${name}.tar.xz";
@@ -42,22 +41,28 @@ let
       kwindowsystem
     ];
 
-    nativeBuildInputs = [
-      extra-cmake-modules kdoctools
-    ];
+  propagatedBuildInputs = [
+    karchive
+    kcrash
+    kdbusaddons
+    ki18n
+    kiconthemes
+    knewstuff
+    knotifications
+    knotifyconfig
+    kparts
+    kwindowsystem
+  ];
 
-    meta = {
-      homepage = https://yakuake.kde.org;
-      description = "Quad-style terminal emulator for KDE";
-      maintainers = with lib.maintainers; [ fridh ];
-    };
-  };
+  propagatedUserEnvPkgs = [ konsole ];
 
+  nativeBuildInputs = [
+    extra-cmake-modules kdoctools wrapGAppsHook
+  ];
 
-in
-kdeWrapper
-{
-  inherit unwrapped;
-  targets = [ "bin/yakuake" ];
-  paths = [ konsole.unwrapped ];
+  meta = {
+    homepage = https://yakuake.kde.org;
+    description = "Quad-style terminal emulator for KDE";
+    maintainers = with lib.maintainers; [ fridh ];
+  };
 }
diff --git a/pkgs/applications/networking/browsers/chromium/common.nix b/pkgs/applications/networking/browsers/chromium/common.nix
index e747db6a8b7b..43b6da6bf34e 100644
--- a/pkgs/applications/networking/browsers/chromium/common.nix
+++ b/pkgs/applications/networking/browsers/chromium/common.nix
@@ -105,6 +105,9 @@ let
 
     patches = [
       ./patches/nix_plugin_paths_52.patch
+      # To enable ChromeCast, go to chrome://flags and set "Load Media Router Component Extension" to Enabled
+      # Fixes Chromecast: https://bugs.chromium.org/p/chromium/issues/detail?id=734325
+      ./patches/fix_network_api_crash.patch
     ] ++ optional (versionOlder version "57.0") ./patches/glibc-2.24.patch
       ++ optional enableWideVine ./patches/widevine.patch;
 
@@ -129,6 +132,9 @@ let
         :l; n; bl
       }' gpu/config/gpu_control_list.cc
 
+      # Allow to put extensions into the system-path.
+      sed -i -e 's,/usr,/run/current-system/sw,' chrome/common/chrome_paths.cc
+
       patchShebangs .
       # use our own nodejs
       mkdir -p third_party/node/linux/node-linux-x64/bin
diff --git a/pkgs/applications/networking/browsers/chromium/default.nix b/pkgs/applications/networking/browsers/chromium/default.nix
index cfc8951eef10..30a16d824d01 100644
--- a/pkgs/applications/networking/browsers/chromium/default.nix
+++ b/pkgs/applications/networking/browsers/chromium/default.nix
@@ -1,4 +1,5 @@
 { newScope, stdenv, makeWrapper, makeDesktopItem, ed
+, glib, gtk2, gtk3, gnome2, gnome3, gsettings_desktop_schemas
 
 # package customization
 , channel ? "stable"
@@ -62,10 +63,26 @@ let
 
   sandboxExecutableName = chromium.browser.passthru.sandboxExecutableName;
 
+  version = chromium.browser.version;
+
+  inherit (stdenv.lib) versionAtLeast;
+
+  gtk = if (versionAtLeast version "59.0.0.0") then gtk3 else gtk2;
+  gnome = if (versionAtLeast version "59.0.0.0") then gnome3 else gnome2;
+
 in stdenv.mkDerivation {
-  name = "chromium${suffix}-${chromium.browser.version}";
+  name = "chromium${suffix}-${version}";
+  inherit version;
 
-  buildInputs = [ makeWrapper ed ];
+  buildInputs = [
+    makeWrapper ed
+
+    # needed for GSETTINGS_SCHEMAS_PATH
+    gsettings_desktop_schemas glib gtk
+
+    # needed for XDG_ICON_DIRS
+    gnome.defaultIconTheme
+  ];
 
   outputs = ["out" "sandbox"];
 
@@ -92,6 +109,8 @@ in stdenv.mkDerivation {
     # libredirect causes chromium to deadlock on startup
     export LD_PRELOAD="\$(echo -n "\$LD_PRELOAD" | tr ':' '\n' | grep -v /lib/libredirect\\\\.so$ | tr '\n' ':')"
 
+    export XDG_DATA_DIRS=$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH\''${XDG_DATA_DIRS:+:}\$XDG_DATA_DIRS
+
     .
     w
     EOF
@@ -107,7 +126,7 @@ in stdenv.mkDerivation {
     cp -v "${desktopItem}/share/applications/"* "$out/share/applications"
   '';
 
-  inherit (chromium.browser) meta packageName version;
+  inherit (chromium.browser) meta packageName;
 
   passthru = {
     inherit (chromium) upstream-info browser;
diff --git a/pkgs/applications/networking/browsers/chromium/patches/fix_network_api_crash.patch b/pkgs/applications/networking/browsers/chromium/patches/fix_network_api_crash.patch
new file mode 100644
index 000000000000..093598465c47
--- /dev/null
+++ b/pkgs/applications/networking/browsers/chromium/patches/fix_network_api_crash.patch
@@ -0,0 +1,77 @@
+Index: extensions/browser/api/networking_private/networking_private_linux.cc
+===================================================================
+--- a/extensions/browser/api/networking_private/networking_private_linux.cc.orig	2016-05-05 03:01:50.000000000 +0200
++++ b/extensions/browser/api/networking_private/networking_private_linux.cc	2016-05-10 16:16:42.431052917 +0200
+@@ -215,12 +215,14 @@ void NetworkingPrivateLinux::GetState(
+   std::unique_ptr<base::DictionaryValue> network_properties(
+       new base::DictionaryValue);
+ 
++  std::string* erp = error.get();
++  base::DictionaryValue* npp = network_properties.get();
+   // Runs GetCachedNetworkProperties on |dbus_thread|.
+   dbus_thread_.task_runner()->PostTaskAndReply(
+       FROM_HERE, base::Bind(&NetworkingPrivateLinux::GetCachedNetworkProperties,
+                             base::Unretained(this), guid,
+-                            base::Unretained(network_properties.get()),
+-                            base::Unretained(error.get())),
++                            base::Unretained(npp),
++                            base::Unretained(erp)),
+       base::Bind(&GetCachedNetworkPropertiesCallback, base::Passed(&error),
+                  base::Passed(&network_properties), success_callback,
+                  failure_callback));
+@@ -301,11 +303,12 @@ void NetworkingPrivateLinux::GetNetworks
+ 
+   // Runs GetAllWiFiAccessPoints on the dbus_thread and returns the
+   // results back to OnAccessPointsFound where the callback is fired.
++  NetworkMap* nmp = network_map.get();
+   dbus_thread_.task_runner()->PostTaskAndReply(
+       FROM_HERE,
+       base::Bind(&NetworkingPrivateLinux::GetAllWiFiAccessPoints,
+                  base::Unretained(this), configured_only, visible_only, limit,
+-                 base::Unretained(network_map.get())),
++                 base::Unretained(nmp)),
+       base::Bind(&NetworkingPrivateLinux::OnAccessPointsFound,
+                  base::Unretained(this), base::Passed(&network_map),
+                  success_callback, failure_callback));
+@@ -321,11 +324,12 @@ bool NetworkingPrivateLinux::GetNetworks
+   // Runs GetAllWiFiAccessPoints on the dbus_thread and returns the
+   // results back to SendNetworkListChangedEvent to fire the event. No
+   // callbacks are used in this case.
++  NetworkMap* nmp = network_map.get();
+   dbus_thread_.task_runner()->PostTaskAndReply(
+       FROM_HERE, base::Bind(&NetworkingPrivateLinux::GetAllWiFiAccessPoints,
+                             base::Unretained(this), false /* configured_only */,
+                             false /* visible_only */, 0 /* limit */,
+-                            base::Unretained(network_map.get())),
++                            base::Unretained(nmp)),
+       base::Bind(&NetworkingPrivateLinux::OnAccessPointsFoundViaScan,
+                  base::Unretained(this), base::Passed(&network_map)));
+ 
+@@ -506,11 +510,12 @@ void NetworkingPrivateLinux::StartConnec
+ 
+   std::unique_ptr<std::string> error(new std::string);
+ 
++  std::string* erp = error.get();
+   // Runs ConnectToNetwork on |dbus_thread|.
+   dbus_thread_.task_runner()->PostTaskAndReply(
+       FROM_HERE,
+       base::Bind(&NetworkingPrivateLinux::ConnectToNetwork,
+-                 base::Unretained(this), guid, base::Unretained(error.get())),
++                 base::Unretained(this), guid, base::Unretained(erp)),
+       base::Bind(&OnNetworkConnectOperationCompleted, base::Passed(&error),
+                  success_callback, failure_callback));
+ }
+@@ -524,11 +529,12 @@ void NetworkingPrivateLinux::StartDiscon
+ 
+   std::unique_ptr<std::string> error(new std::string);
+ 
++  std::string* erp = error.get();
+   // Runs DisconnectFromNetwork on |dbus_thread|.
+   dbus_thread_.task_runner()->PostTaskAndReply(
+       FROM_HERE,
+       base::Bind(&NetworkingPrivateLinux::DisconnectFromNetwork,
+-                 base::Unretained(this), guid, base::Unretained(error.get())),
++                 base::Unretained(this), guid, base::Unretained(erp)),
+       base::Bind(&OnNetworkConnectOperationCompleted, base::Passed(&error),
+                  success_callback, failure_callback));
+ }
diff --git a/pkgs/applications/networking/browsers/chromium/plugins.nix b/pkgs/applications/networking/browsers/chromium/plugins.nix
index 01f4b03e4ca3..4e2a2f84b968 100644
--- a/pkgs/applications/networking/browsers/chromium/plugins.nix
+++ b/pkgs/applications/networking/browsers/chromium/plugins.nix
@@ -94,12 +94,12 @@ let
 
   flash = stdenv.mkDerivation rec {
     name = "flashplayer-ppapi-${version}";
-    version = "26.0.0.126";
+    version = "26.0.0.131";
 
     src = fetchzip {
       url = "https://fpdownload.adobe.com/pub/flashplayer/pdc/"
           + "${version}/flash_player_ppapi_linux.x86_64.tar.gz";
-      sha256 =  "17ivhkdkbnzxr10ln1ix30k1hmaak5p9zzcchdyrjxdpzfk5qq7s";
+      sha256 = "1cw5pmzfyaaxxd3kf90nz8zn5r06qmkh8l793j3db4n0ffxg5c1s";
       stripRoot = false;
     };
 
diff --git a/pkgs/applications/networking/browsers/firefox-bin/default.nix b/pkgs/applications/networking/browsers/firefox-bin/default.nix
index dcb25dc1343a..f59cb402720d 100644
--- a/pkgs/applications/networking/browsers/firefox-bin/default.nix
+++ b/pkgs/applications/networking/browsers/firefox-bin/default.nix
@@ -170,6 +170,10 @@ stdenv.mkDerivation {
   passthru.ffmpegSupport = true;
   passthru.updateScript = import ./update.nix {
     inherit name channel writeScript xidel coreutils gnused gnugrep gnupg curl;
+    baseUrl =
+      if channel == "devedition"
+        then "http://archive.mozilla.org/pub/devedition/releases/"
+        else "http://archive.mozilla.org/pub/firefox/releases/";
   };
   meta = with stdenv.lib; {
     description = "Mozilla Firefox, free web browser (binary package)";
diff --git a/pkgs/applications/networking/browsers/firefox-bin/update.nix b/pkgs/applications/networking/browsers/firefox-bin/update.nix
index 9c29d1288d15..3bcc2ab003c1 100644
--- a/pkgs/applications/networking/browsers/firefox-bin/update.nix
+++ b/pkgs/applications/networking/browsers/firefox-bin/update.nix
@@ -9,15 +9,10 @@
 , gnupg
 , baseName ? "firefox"
 , basePath ? "pkgs/applications/networking/browsers/firefox-bin"
+, baseUrl
 }:
 
 let
-
-  baseUrl =
-    if channel == "devedition"
-      then "http://archive.mozilla.org/pub/devedition/releases/"
-      else "http://archive.mozilla.org/pub/firefox/releases/";
-
   isBeta =
     channel != "release";
 
diff --git a/pkgs/applications/networking/browsers/google-chrome/default.nix b/pkgs/applications/networking/browsers/google-chrome/default.nix
index e7b74562bd5b..9a4d90701b28 100644
--- a/pkgs/applications/networking/browsers/google-chrome/default.nix
+++ b/pkgs/applications/networking/browsers/google-chrome/default.nix
@@ -31,6 +31,9 @@
 
 # Only needed for getting information about upstream binaries
 , chromium
+
+, gsettings_desktop_schemas
+, gnome2, gnome3
 }:
 
 with stdenv.lib;
@@ -42,6 +45,9 @@ let
     withCustomModes = true;
   };
 
+  gtk = if (versionAtLeast version "59.0.0.0") then gtk3 else gtk2;
+  gnome = if (versionAtLeast version "59.0.0.0") then gnome3 else gnome2;
+
   deps = [
     glib fontconfig freetype pango cairo libX11 libXi atk gconf nss nspr
     libXcursor libXext libXfixes libXrender libXScrnSaver libXcomposite libxcb
@@ -53,7 +59,7 @@ let
     flac harfbuzz icu libpng opusWithCustomModes snappy speechd
     bzip2 libcap
   ] ++ optional pulseSupport libpulseaudio
-    ++ (if (versionAtLeast version "59.0.0.0") then [gtk3] else [gtk2]);
+    ++ [ gtk ];
 
   suffix = if channel != "stable" then "-" + channel else "";
 
@@ -64,7 +70,15 @@ in stdenv.mkDerivation rec {
 
   src = binary;
 
-  buildInputs = [ patchelf ];
+  buildInputs = [
+    patchelf
+
+    # needed for GSETTINGS_SCHEMAS_PATH
+    gsettings_desktop_schemas glib gtk
+
+    # needed for XDG_ICON_DIRS
+    gnome.defaultIconTheme
+  ];
 
   unpackPhase = ''
     ar x $src
@@ -109,6 +123,7 @@ in stdenv.mkDerivation rec {
     #!${bash}/bin/sh
     export LD_LIBRARY_PATH=$rpath\''${LD_LIBRARY_PATH:+:\$LD_LIBRARY_PATH}
     export PATH=$binpath\''${PATH:+:\$PATH}
+    export XDG_DATA_DIRS=$XDG_ICON_DIRS:$GSETTINGS_SCHEMAS_PATH\''${XDG_DATA_DIRS:+:}\$XDG_DATA_DIRS
     $out/share/google/$appname/google-$appname ${commandLineArgs} "\$@"
     EOF
     chmod +x $exe
diff --git a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/default.nix b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/default.nix
index 5936c86c1ccc..e7893d22717c 100644
--- a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/default.nix
+++ b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/default.nix
@@ -73,7 +73,7 @@ let
 in
 stdenv.mkDerivation rec {
   name = "flashplayer-${version}";
-  version = "26.0.0.126";
+  version = "26.0.0.131";
 
   src = fetchurl {
     url =
@@ -84,14 +84,14 @@ stdenv.mkDerivation rec {
     sha256 =
       if debug then
         if arch == "x86_64" then
-          "0i5rr8bymbdzwqpns854i2r9390av89v1ikh8msincczq5vpj012"
+          "0yqrw2gl9i0z33kcv5dpp3x3jyq9ksqfaqjgkk7xcy127ahric8s"
         else
-          "1mzq3wvq6rxqfdlapd0b1ymw7389414jxwhkd6wk3677qdhr1y42"
+          "0cmjqm5asqqcqavpkldm6wgjb49m9n018rixi7cj9zcwhfakm7zr"
       else
         if arch == "x86_64" then
-          "0684kizzfwfzaj0i54cdlkx3fqb3kyhb9jw88n031bjrzv7ddiz7"
+          "0agz4k5319m5bd0nqzkzvy8r28nr6c5j9b0jr6a8yh9s844aga8w"
         else
-          "1pn15wnldabacmahlqdsl8nd60982j77bghjlf2cdc7drysby3ns";
+          "0jzvhyi1qgfjp9l85ffgcxqa87ymi899q2j68b9hfsn9hlw1sc5f";
   };
 
   nativeBuildInputs = [ unzip ];
diff --git a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix
index e29af0eaf4e1..b290caaee3ed 100644
--- a/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix
+++ b/pkgs/applications/networking/browsers/mozilla-plugins/flashplayer/standalone.nix
@@ -55,7 +55,7 @@ let
 in
 stdenv.mkDerivation rec {
   name = "flashplayer-standalone-${version}";
-  version = "26.0.0.126";
+  version = "26.0.0.131";
 
   src = fetchurl {
     url =
@@ -65,9 +65,9 @@ stdenv.mkDerivation rec {
         "https://fpdownload.macromedia.com/pub/flashplayer/updaters/26/flash_player_sa_linux.x86_64.tar.gz";
     sha256 =
       if debug then
-        "17s55b1ncjj0hnldjmxm133z0i4jf49wbh4sn1cfwrw6xrhgbkiw"
+        "000a019x15yk6qkx8yg7l496lc5knvw0kqgzial491d73zw8qjhn"
       else
-        "02j98ji2jw2sxrs9hhlkkdrhpf2c4hc336cfvqzdf1iajza5was8";
+        "0rmsfi70hvp5vvdvcr8w7knz8bzf70r3ysnsgz3yv3b9p5dvsbjk";
   };
 
   nativeBuildInputs = [ unzip ];
diff --git a/pkgs/applications/networking/browsers/qutebrowser/default.nix b/pkgs/applications/networking/browsers/qutebrowser/default.nix
index a8c49b9fd4ad..614473d39eec 100644
--- a/pkgs/applications/networking/browsers/qutebrowser/default.nix
+++ b/pkgs/applications/networking/browsers/qutebrowser/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, unzip, buildPythonApplication, makeQtWrapper, wrapGAppsHook
+{ stdenv, lib, fetchurl, unzip, buildPythonApplication, makeWrapper, wrapGAppsHook
 , qtbase, pyqt5, jinja2, pygments, pyyaml, pypeg2, cssutils, glib_networking
 , asciidoc, docbook_xml_dtd_45, docbook_xsl, libxml2, libxslt
 , gst-plugins-base, gst-plugins-good, gst-plugins-bad, gst-plugins-ugly, gst-libav
@@ -44,7 +44,7 @@ in buildPythonApplication rec {
   ];
 
   nativeBuildInputs = [
-    makeQtWrapper wrapGAppsHook asciidoc docbook_xml_dtd_45 docbook_xsl libxml2 libxslt
+    makeWrapper wrapGAppsHook asciidoc docbook_xml_dtd_45 docbook_xsl libxml2 libxslt
   ];
 
   propagatedBuildInputs = [
@@ -73,9 +73,8 @@ in buildPythonApplication rec {
     install -Dm755 -t "$out/share/qutebrowser/userscripts/" misc/userscripts/*
   '';
 
-  postFixup = ''
-    wrapQtProgram $out/bin/qutebrowser \
-      ${lib.optionalString withWebEngineDefault ''--add-flags "--backend webengine"''}
+  postFixup = lib.optionalString withWebEngineDefault ''
+    wrapProgram $out/bin/qutebrowser --add-flags "--backend webengine"
   '';
 
   meta = {
diff --git a/pkgs/applications/networking/browsers/vivaldi/default.nix b/pkgs/applications/networking/browsers/vivaldi/default.nix
index da9f6472821a..749fc8557881 100644
--- a/pkgs/applications/networking/browsers/vivaldi/default.nix
+++ b/pkgs/applications/networking/browsers/vivaldi/default.nix
@@ -4,31 +4,19 @@
 , freetype, fontconfig, libXft, libXrender, libxcb, expat, libXau, libXdmcp
 , libuuid, xz
 , gstreamer, gst-plugins-base, libxml2
-, glib, gtk2, pango, gdk_pixbuf, cairo, atk, gnome3
+, glib, gtk3, pango, gdk_pixbuf, cairo, atk, gnome3
 , nss, nspr
 , patchelf
 }:
 
-let
-  version = "1.9";
-  build = "818.44-1";
-  fullVersion = "stable_${version}.${build}";
-
-  info = if stdenv.is64bit then {
-      arch = "amd64";
-      sha256 = "0apkwgd98ld5k77nplzmk67nz6mb5pi8jyrnkp96m93mr41b08bq";
-    } else {
-      arch = "i386";
-      sha256 = "0xyf0z1cnzmb3pv6rgsbd7jdjf1v137priz4kkymr8jgmpq0mmfx ";
-    };
-
-in stdenv.mkDerivation rec {
-  product    = "vivaldi";
-  name       = "${product}-${version}";
+stdenv.mkDerivation rec {
+  name = "${product}-${version}";
+  product = "vivaldi";
+  version = "1.10.867.38-1";
 
   src = fetchurl {
-    inherit (info) sha256;
-    url = "https://downloads.vivaldi.com/stable/${product}-${fullVersion}_${info.arch}.deb";
+    url = "https://downloads.vivaldi.com/stable/${product}-stable_${version}_amd64.deb";
+    sha256 = "1h3iygzvw3rb5kmn0pam6gqy9baq6l630yllff1vnvychdg8d9vi";
   };
 
   unpackPhase = ''
@@ -36,14 +24,15 @@ in stdenv.mkDerivation rec {
     tar -xvf data.tar.xz
   '';
 
-  buildInputs =
-    [ stdenv.cc.cc stdenv.cc.libc zlib libX11 libXt libXext libSM libICE libxcb
-      libXi libXft libXcursor libXfixes libXScrnSaver libXcomposite libXdamage libXtst libXrandr
-      atk alsaLib dbus_libs cups gtk2 gdk_pixbuf libexif ffmpeg systemd
-      freetype fontconfig libXrender libuuid expat glib nss nspr
-      gstreamer libxml2 gst-plugins-base pango cairo gnome3.gconf
-      patchelf
-    ];
+  nativeBuildInputs = [ patchelf ];
+
+  buildInputs = [
+    stdenv.cc.cc stdenv.cc.libc zlib libX11 libXt libXext libSM libICE libxcb
+    libXi libXft libXcursor libXfixes libXScrnSaver libXcomposite libXdamage libXtst libXrandr
+    atk alsaLib dbus_libs cups gtk3 gdk_pixbuf libexif ffmpeg systemd
+    freetype fontconfig libXrender libuuid expat glib nss nspr
+    gstreamer libxml2 gst-plugins-base pango cairo gnome3.gconf
+  ];
 
   libPath = stdenv.lib.makeLibraryPath buildInputs
     + stdenv.lib.optionalString (stdenv.is64bit)
@@ -85,6 +74,6 @@ in stdenv.mkDerivation rec {
     homepage    = "https://vivaldi.com";
     license     = licenses.unfree;
     maintainers = with maintainers; [ otwieracz nequissimus ];
-    platforms   = platforms.linux;
+    platforms   = [ "x86_64-linux" ];
   };
 }
diff --git a/pkgs/applications/networking/dropbox/default.nix b/pkgs/applications/networking/dropbox/default.nix
index 12ed28979d29..cda86d2e6524 100644
--- a/pkgs/applications/networking/dropbox/default.nix
+++ b/pkgs/applications/networking/dropbox/default.nix
@@ -1,4 +1,5 @@
-{ stdenv, fetchurl, makeDesktopItem, patchelf, makeWrapper, makeQtWrapper
+{ mkDerivation, stdenv, lib, fetchurl, makeDesktopItem
+, makeWrapper, patchelf
 , dbus_libs, fontconfig, freetype, gcc, glib
 , libdrm, libffi, libICE, libSM
 , libX11, libXcomposite, libXext, libXmu, libXrender, libxcb
@@ -58,7 +59,7 @@ let
     startupNotify = "false";
   };
 
-in stdenv.mkDerivation {
+in mkDerivation {
   name = "dropbox-${version}";
   src = fetchurl {
     name = "dropbox-${version}.tar.gz";
@@ -68,7 +69,7 @@ in stdenv.mkDerivation {
 
   sourceRoot = ".dropbox-dist";
 
-  nativeBuildInputs = [ makeQtWrapper patchelf ];
+  nativeBuildInputs = [ makeWrapper patchelf ];
   dontStrip = true; # already done
 
   installPhase = ''
@@ -94,7 +95,7 @@ in stdenv.mkDerivation {
 
     mkdir -p "$out/bin"
     RPATH="${ldpath}:$out/${appdir}"
-    makeQtWrapper "$out/${appdir}/dropbox" "$out/bin/dropbox" \
+    makeWrapper "$out/${appdir}/dropbox" "$out/bin/dropbox" \
       --prefix LD_LIBRARY_PATH : "$RPATH"
 
     chmod 755 $out/${appdir}/dropbox
@@ -137,8 +138,8 @@ in stdenv.mkDerivation {
   meta = {
     homepage = "http://www.dropbox.com";
     description = "Online stored folders (daemon version)";
-    maintainers = with stdenv.lib.maintainers; [ ttuegel ];
+    maintainers = with lib.maintainers; [ ttuegel ];
     platforms = [ "i686-linux" "x86_64-linux" ];
-    license = stdenv.lib.licenses.unfree;
+    license = lib.licenses.unfree;
   };
 }
diff --git a/pkgs/applications/networking/feedreaders/rssguard/default.nix b/pkgs/applications/networking/feedreaders/rssguard/default.nix
index a9e3c1d74e26..d1c272fc3831 100644
--- a/pkgs/applications/networking/feedreaders/rssguard/default.nix
+++ b/pkgs/applications/networking/feedreaders/rssguard/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, qmakeHook, qtwebengine, qttools, wrapGAppsHook }:
+{ stdenv, fetchgit, qmake, qtwebengine, qttools, wrapGAppsHook }:
 
 stdenv.mkDerivation rec {
   name = "rssguard-${version}";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs =  [ qtwebengine qttools ];
-  nativeBuildInputs = [ qmakeHook wrapGAppsHook ];
+  nativeBuildInputs = [ qmake wrapGAppsHook ];
   qmakeFlags = [ "CONFIG+=release" ];
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/networking/instant-messengers/dino/default.nix b/pkgs/applications/networking/instant-messengers/dino/default.nix
index 94adef2dda89..611146080bd0 100644
--- a/pkgs/applications/networking/instant-messengers/dino/default.nix
+++ b/pkgs/applications/networking/instant-messengers/dino/default.nix
@@ -13,13 +13,13 @@
  }:
 
 stdenv.mkDerivation rec {
-  name = "dino-unstable-2017-05-31";
+  name = "dino-unstable-2017-06-13";
 
   src = fetchFromGitHub {
     owner = "dino";
     repo = "dino";
-    rev = "2480c1ec26a8e0ccef3ea76e3c29566221405ffb";
-    sha256 = "0wdjj38gbr2j6yklna3pd8nsfpdfp1j936dy8s49pzayw4pxs2g2";
+    rev = "7bbbb738fdb233f4ad91ffdd7d9247b28849d715";
+    sha256 = "09w26c6b5rkrrz7wvm629cncpdmd5n0d0805h8hw69bbzirpjjh2";
     fetchSubmodules = true;
   };
 
diff --git a/pkgs/applications/networking/instant-messengers/qtox/default.nix b/pkgs/applications/networking/instant-messengers/qtox/default.nix
index d1773456df2e..2c6cf473f1c4 100644
--- a/pkgs/applications/networking/instant-messengers/qtox/default.nix
+++ b/pkgs/applications/networking/instant-messengers/qtox/default.nix
@@ -1,10 +1,10 @@
-{ stdenv, fetchFromGitHub, cmake, pkgconfig, openal, opencv,
+{ mkDerivation, lib, fetchFromGitHub, cmake, pkgconfig, openal, opencv,
   libtoxcore, libsodium, libXScrnSaver, glib, gdk_pixbuf, gtk2, cairo, xorg,
-  pango, atk, qrencode, ffmpeg, filter-audio, makeQtWrapper,
+  pango, atk, qrencode, ffmpeg, filter-audio,
   qtbase, qtsvg, qttools, qttranslations, sqlcipher,
   libvpx, libopus }:
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   name = "qtox-${version}";
   version = "1.10.2";
 
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     libpthreadstubs libXdmcp
   ]);
 
-  nativeBuildInputs = [ cmake makeQtWrapper pkgconfig ];
+  nativeBuildInputs = [ cmake pkgconfig ];
 
   cmakeFlags = [
     "-DGIT_DESCRIBE=${version}"
@@ -35,14 +35,11 @@ stdenv.mkDerivation rec {
     runHook preInstall
 
     install -Dm755 qtox $out/bin/qtox
-    wrapQtProgram $out/bin/qtox
 
     runHook postInstall
   '';
 
-  enableParallelBuilding = true;
-
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Qt Tox client";
     license = licenses.gpl3;
     maintainers = with maintainers; [ viric jgeerds akaWolf peterhoeg ];
diff --git a/pkgs/applications/networking/instant-messengers/quaternion/default.nix b/pkgs/applications/networking/instant-messengers/quaternion/default.nix
index 781a4a18b9cc..03fc0d85292a 100644
--- a/pkgs/applications/networking/instant-messengers/quaternion/default.nix
+++ b/pkgs/applications/networking/instant-messengers/quaternion/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchgit, qtbase, qtquickcontrols, cmake, makeQtWrapper }:
+{ mkDerivation, lib, fetchgit, qtbase, qtquickcontrols, cmake }:
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   name = "quaternion-git-${version}";
   version = "2017-04-15";
 
@@ -18,25 +18,21 @@ stdenv.mkDerivation rec {
     fetchSubmodules = true;
   };
 
-  enableParallelBuilding = true;
-
   buildInputs = [ qtbase qtquickcontrols ];
-  nativeBuildInputs = [ cmake makeQtWrapper ];
+  nativeBuildInputs = [ cmake ];
 
   cmakeFlags = [
     "-Wno-dev"
   ];
 
   postInstall = ''
-    wrapQtProgram $out/bin/quaternion
-
     substituteInPlace $out/share/applications/quaternion.desktop \
       --replace 'Exec=quaternion' "Exec=$out/bin/quaternion"
 
     rm $out/share/icons/hicolor/icon-theme.cache
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = https://matrix.org/docs/projects/client/quaternion.html;
     description = "Cross-platform desktop IM client for the Matrix protocol";
     license = licenses.gpl3;
diff --git a/pkgs/applications/networking/instant-messengers/ricochet/default.nix b/pkgs/applications/networking/instant-messengers/ricochet/default.nix
index d1af2ad70d19..b1dd7a4c90f3 100644
--- a/pkgs/applications/networking/instant-messengers/ricochet/default.nix
+++ b/pkgs/applications/networking/instant-messengers/ricochet/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, pkgconfig, makeDesktopItem, unzip
-, qtbase, qttools, makeQtWrapper, qtmultimedia, qtquick1, qtquickcontrols
-, openssl, protobuf, qmakeHook
+, qtbase, qttools, qtmultimedia, qtquick1, qtquickcontrols
+, openssl, protobuf, qmake
 }:
 
 stdenv.mkDerivation rec {
@@ -27,7 +27,7 @@ stdenv.mkDerivation rec {
     openssl protobuf
   ];
 
-  nativeBuildInputs = [ pkgconfig makeQtWrapper qmakeHook ];
+  nativeBuildInputs = [ pkgconfig qmake ];
 
   preConfigure = ''
     export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE $(pkg-config --cflags openssl)"
@@ -38,7 +38,6 @@ stdenv.mkDerivation rec {
   installPhase = ''
     mkdir -p $out/bin
     cp ricochet $out/bin
-    wrapQtProgram $out/bin/ricochet
 
     mkdir -p $out/share/applications
     cp $desktopItem/share/applications"/"* $out/share/applications
diff --git a/pkgs/applications/networking/instant-messengers/telegram/cutegram/default.nix b/pkgs/applications/networking/instant-messengers/telegram/cutegram/default.nix
index a20119e0d731..67d1f55f2fe0 100644
--- a/pkgs/applications/networking/instant-messengers/telegram/cutegram/default.nix
+++ b/pkgs/applications/networking/instant-messengers/telegram/cutegram/default.nix
@@ -3,7 +3,7 @@
 , qtimageformats, qtgraphicaleffects, qtwebkit
 , telegram-qml, libqtelegram-aseman-edition
 , gst_all_1
-, makeQtWrapper, qmakeHook }:
+, makeWrapper, qmake }:
 
 stdenv.mkDerivation rec {
   name = "cutegram-${meta.version}";
@@ -20,12 +20,12 @@ stdenv.mkDerivation rec {
     telegram-qml libqtelegram-aseman-edition
   ] ++ (with gst_all_1; [ gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly ]);
 
-  nativeBuildInputs = [ makeQtWrapper qmakeHook ];
 
   enableParallelBuilding = true;
+  nativeBuildInputs = [ makeWrapper qmake ];
 
   fixupPhase = ''
-    wrapQtProgram $out/bin/cutegram \
+    wrapProgram $out/bin/cutegram \
       --prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0"
   '';
 
diff --git a/pkgs/applications/networking/instant-messengers/telegram/libqtelegram-aseman-edition/default.nix b/pkgs/applications/networking/instant-messengers/telegram/libqtelegram-aseman-edition/default.nix
index 322c40afc7dc..ec2e65dc4997 100644
--- a/pkgs/applications/networking/instant-messengers/telegram/libqtelegram-aseman-edition/default.nix
+++ b/pkgs/applications/networking/instant-messengers/telegram/libqtelegram-aseman-edition/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchFromGitHub
-, qtbase, qtmultimedia, qtquick1, qmakeHook }:
+, qtbase, qtmultimedia, qtquick1, qmake }:
 
 stdenv.mkDerivation rec {
   name = "libqtelegram-aseman-edition-${meta.version}";
@@ -12,8 +12,8 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ qtbase qtmultimedia qtquick1 ];
-  nativeBuildInputs = [ qmakeHook ];
   enableParallelBuilding = true;
+  nativeBuildInputs = [ qmake ];
 
   patchPhase = ''
     substituteInPlace libqtelegram-ae.pro --replace "/libqtelegram-ae" ""
diff --git a/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix b/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix
index d64b5be816aa..0af0c0b1d1ba 100644
--- a/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix
+++ b/pkgs/applications/networking/instant-messengers/telegram/tdesktop/default.nix
@@ -1,10 +1,10 @@
-{ stdenv, lib, fetchFromGitHub, fetchgit, pkgconfig, gyp, cmake
-, qtbase, qtimageformats, makeQtWrapper
+{ mkDerivation, lib, fetchFromGitHub, fetchgit, pkgconfig, gyp, cmake
+, qtbase, qtimageformats
 , breakpad, gtk3, libappindicator-gtk3, dee
 , ffmpeg, openalSoft, minizip
 }:
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   name = "telegram-desktop-${version}";
   version = "1.0.27";
 
@@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
     gtk3 libappindicator-gtk3 dee qtbase qtimageformats ffmpeg openalSoft minizip
   ];
 
-  nativeBuildInputs = [ pkgconfig gyp cmake makeQtWrapper ];
+  nativeBuildInputs = [ pkgconfig gyp cmake ];
 
   patches = [ "${tgaur}/aur-build-fixes.patch" ];
 
@@ -86,10 +86,9 @@ stdenv.mkDerivation rec {
     for icon_size in 16 32 48 64 128 256 512; do
       install -Dm644 "../../../Telegram/Resources/art/icon''${icon_size}.png" "$out/share/icons/hicolor/''${icon_size}x''${icon_size}/apps/telegram-desktop.png"
     done
-    wrapQtProgram $out/bin/telegram-desktop
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Telegram Desktop messaging app";
     license = licenses.gpl3;
     platforms = platforms.linux;
diff --git a/pkgs/applications/networking/instant-messengers/telegram/telegram-qml/default.nix b/pkgs/applications/networking/instant-messengers/telegram/telegram-qml/default.nix
index 854648d97862..c8d24c9b28c1 100644
--- a/pkgs/applications/networking/instant-messengers/telegram/telegram-qml/default.nix
+++ b/pkgs/applications/networking/instant-messengers/telegram/telegram-qml/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchFromGitHub
-, qtbase, qtmultimedia, qtquick1, qmakeHook
+, qtbase, qtmultimedia, qtquick1, qmake
 , libqtelegram-aseman-edition }:
 
 stdenv.mkDerivation rec {
@@ -13,8 +13,8 @@ stdenv.mkDerivation rec {
   };
 
   propagatedBuildInputs = [ qtbase qtmultimedia qtquick1 libqtelegram-aseman-edition ];
-  nativeBuildInputs = [ qmakeHook ];
   enableParallelBuilding = true;
+  nativeBuildInputs = [ qmake ];
 
   patchPhase = ''
     substituteInPlace telegramqml.pro --replace "/\$\$LIB_PATH" ""
diff --git a/pkgs/applications/networking/instant-messengers/tensor/default.nix b/pkgs/applications/networking/instant-messengers/tensor/default.nix
index 0dfda79e767c..0571946061bc 100644
--- a/pkgs/applications/networking/instant-messengers/tensor/default.nix
+++ b/pkgs/applications/networking/instant-messengers/tensor/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, qtbase, qtquickcontrols, qmakeHook, makeQtWrapper, makeDesktopItem }:
+{ stdenv, fetchgit, qtbase, qtquickcontrols, qmake, makeDesktopItem }:
 
 stdenv.mkDerivation rec {
   name = "tensor-git-${version}";
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   enableParallelBuilding = true;
 
   buildInputs = [ qtbase qtquickcontrols ];
-  nativeBuildInputs = [ qmakeHook makeQtWrapper ];
+  nativeBuildInputs = [ qmake ];
 
   desktopItem = makeDesktopItem {
     name        = "tensor";
@@ -36,8 +36,6 @@ stdenv.mkDerivation rec {
     install -Dm644 ${desktopItem}/share/applications/tensor.desktop \
                    $out/share/applications/tensor.desktop
 
-    wrapQtProgram $out/bin/tensor
-
     substituteInPlace $out/share/applications/tensor.desktop \
       --subst-var-by bin $out/bin/tensor
 
diff --git a/pkgs/applications/networking/irc/communi/default.nix b/pkgs/applications/networking/irc/communi/default.nix
index b292dd8f68eb..9bfdd8408dac 100644
--- a/pkgs/applications/networking/irc/communi/default.nix
+++ b/pkgs/applications/networking/irc/communi/default.nix
@@ -1,4 +1,4 @@
-{ fetchgit, libcommuni, makeQtWrapper, qtbase, qmakeHook, stdenv }:
+{ fetchgit, libcommuni, qtbase, qmake, stdenv }:
 
 stdenv.mkDerivation rec {
   name = "communi-${version}";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     fetchSubmodules = true;
   };
 
-  nativeBuildInputs = [ makeQtWrapper qmakeHook ];
+  nativeBuildInputs = [ qmake ];
 
   buildInputs = [ libcommuni qtbase ];
 
@@ -30,12 +30,11 @@ stdenv.mkDerivation rec {
   '';
 
   postInstall = ''
-    wrapQtProgram "$out/bin/communi"
     substituteInPlace "$out/share/applications/communi.desktop" \
       --replace "/usr/bin" "$out/bin"
   '';
 
-  postFixup = ''
+  preFixup = ''
     patchelf --set-rpath "$out/lib:$(patchelf --print-rpath $out/bin/.communi-wrapped)" $out/bin/.communi-wrapped
   '';
 
diff --git a/pkgs/applications/networking/irc/konversation/default.nix b/pkgs/applications/networking/irc/konversation/default.nix
index 6f4bc2af79f2..4cfde1f9b078 100644
--- a/pkgs/applications/networking/irc/konversation/default.nix
+++ b/pkgs/applications/networking/irc/konversation/default.nix
@@ -1,15 +1,14 @@
-{ kdeDerivation
+{ mkDerivation
 , lib
 , fetchurl
 , extra-cmake-modules
+, kdoctools
 , kbookmarks
 , karchive
 , kconfig
 , kconfigwidgets
 , kcoreaddons
 , kdbusaddons
-, kdeWrapper
-, kdoctools
 , kemoticons
 , kglobalaccel
 , ki18n
@@ -21,62 +20,55 @@
 , kio
 , kparts
 , kwallet
-, makeQtWrapper
 , solid
 , sonnet
 , phonon
 }:
 
 let
-  unwrapped = let
-    pname = "konversation";
-    version = "1.6.2";
-  in kdeDerivation rec {
-    name = "${pname}-${version}";
+  pname = "konversation";
+  version = "1.6.2";
+in mkDerivation rec {
+  name = "${pname}-${version}";
 
-    src = fetchurl {
-      url = "mirror://kde/stable/${pname}/${version}/src/${name}.tar.xz";
-      sha256 = "1798sslwz7a3h1v524ra33p0j5iqvcg0v1insyvb5qp4kv11slmn";
-    };
+  src = fetchurl {
+    url = "mirror://kde/stable/${pname}/${version}/src/${name}.tar.xz";
+    sha256 = "1798sslwz7a3h1v524ra33p0j5iqvcg0v1insyvb5qp4kv11slmn";
+  };
 
-    buildInputs = [
-      kbookmarks
-      karchive
-      kconfig
-      kconfigwidgets
-      kcoreaddons
-      kdbusaddons
-      kdoctools
-      kemoticons
-      kglobalaccel
-      ki18n
-      kiconthemes
-      kidletime
-      kitemviews
-      knotifications
-      knotifyconfig
-      kio
-      kparts
-      kwallet
-      solid
-      sonnet
-      phonon
-    ];
+  buildInputs = [
+    kbookmarks
+    karchive
+    kconfig
+    kconfigwidgets
+    kcoreaddons
+    kdbusaddons
+    kdoctools
+    kemoticons
+    kglobalaccel
+    ki18n
+    kiconthemes
+    kidletime
+    kitemviews
+    knotifications
+    knotifyconfig
+    kio
+    kparts
+    kwallet
+    solid
+    sonnet
+    phonon
+  ];
 
-    nativeBuildInputs = [
-      extra-cmake-modules
-      kdoctools
-    ];
+  nativeBuildInputs = [
+    extra-cmake-modules
+    kdoctools
+  ];
 
-    meta = {
-      description = "Integrated IRC client for KDE";
-      license = with lib.licenses; [ gpl2 ];
-      maintainers = with lib.maintainers; [ fridh ];
-      homepage = https://konversation.kde.org;
-    };
+  meta = {
+    description = "Integrated IRC client for KDE";
+    license = with lib.licenses; [ gpl2 ];
+    maintainers = with lib.maintainers; [ fridh ];
+    homepage = https://konversation.kde.org;
   };
-in kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/konversation" ];
 }
-
diff --git a/pkgs/applications/networking/linssid/default.nix b/pkgs/applications/networking/linssid/default.nix
index d35c2e100e4c..ad571888a9ca 100644
--- a/pkgs/applications/networking/linssid/default.nix
+++ b/pkgs/applications/networking/linssid/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, qtbase, qtsvg, qmakeHook, pkgconfig, boost, wirelesstools, iw, qwt6 }:
+{ stdenv, fetchurl, qtbase, qtsvg, qmake, pkgconfig, boost, wirelesstools, iw, qwt6 }:
 
 stdenv.mkDerivation rec {
   name = "linssid-${version}";
@@ -9,7 +9,8 @@ stdenv.mkDerivation rec {
     sha256 = "13d35rlcjncd8lx3khkgn9x8is2xjd5fp6ns5xsn3w6l4xj9b4gl";
   };
 
-  buildInputs = [ qtbase qtsvg pkgconfig boost qwt6 qmakeHook ];
+  nativeBuildInputs = [ qmake ];
+  buildInputs = [ qtbase qtsvg pkgconfig boost qwt6 ];
 
   patches = [ ./0001-unbundled-qwt.patch ];
 
diff --git a/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix b/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix
index aba121ba7614..4f714cabf79b 100644
--- a/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix
+++ b/pkgs/applications/networking/mailreaders/thunderbird-bin/default.nix
@@ -46,7 +46,7 @@
 assert stdenv.isLinux;
 
 # imports `version` and `sources`
-with (import ./sources.nix);
+with (import ./release_sources.nix);
 
 let
   arch = if stdenv.system == "i686-linux"
@@ -163,6 +163,7 @@ stdenv.mkDerivation {
   passthru.updateScript = import ./../../browsers/firefox-bin/update.nix {
     inherit name writeScript xidel coreutils gnused gnugrep curl gnupg;
     baseName = "thunderbird";
+    channel = "release";
     basePath = "pkgs/applications/networking/mailreaders/thunderbird-bin";
     baseUrl = "http://archive.mozilla.org/pub/thunderbird/releases/";
   };
diff --git a/pkgs/applications/networking/mailreaders/thunderbird-bin/release_sources.nix b/pkgs/applications/networking/mailreaders/thunderbird-bin/release_sources.nix
new file mode 100644
index 000000000000..889d931c7069
--- /dev/null
+++ b/pkgs/applications/networking/mailreaders/thunderbird-bin/release_sources.nix
@@ -0,0 +1,595 @@
+{
+  version = "52.2.0";
+  sources = [
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/ar/thunderbird-52.2.0.tar.bz2";
+      locale = "ar";
+      arch = "linux-x86_64";
+      sha512 = "d25bdeda7f5ee563176809811c5373d5232842ddb68315f31992754100e5cc96e5a2d0427897d245fcf9bbfc647331492e9b1fa79e0adb64f4f2169dd66ddc29";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/ast/thunderbird-52.2.0.tar.bz2";
+      locale = "ast";
+      arch = "linux-x86_64";
+      sha512 = "f7d3f2caa404fa5b97b7c966bb4ddd6fc0f26531802d4db9930d984d9b4ca635c41f9b025ca3c0ccba93a288da9c229b43b760759969b269082402584eed14f0";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/be/thunderbird-52.2.0.tar.bz2";
+      locale = "be";
+      arch = "linux-x86_64";
+      sha512 = "baa46c3e1d07b284e6cbca0f6c61710d4760f2a33e829056b8fb4e05b63162e4e4c7c8414dd9b3733c6983b74765e2ed2129122feadeb5972f037a1a739eba1e";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/bg/thunderbird-52.2.0.tar.bz2";
+      locale = "bg";
+      arch = "linux-x86_64";
+      sha512 = "166e64acbb8464142e78222ffb00e5ee421dbfee6789f544439963f4d3476e46795d53050e60195bbce648a3400f24edcef7a8f4cb47d5c3db0441ca564ad6d4";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/bn-BD/thunderbird-52.2.0.tar.bz2";
+      locale = "bn-BD";
+      arch = "linux-x86_64";
+      sha512 = "817202f39eb6b0f79d07da92b7ad62c6dda9e8d196021828303030ac5eff97d5574ba99ae8a2d236cddf2eaa6cda4c85a17f23a6f84461654e8f0856156dc6bb";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/br/thunderbird-52.2.0.tar.bz2";
+      locale = "br";
+      arch = "linux-x86_64";
+      sha512 = "46eab89538b48e02237950207ce8e3d955ba87c7ffa7a030812bafa4bb54da5113a3ff53bfa1e1b243a77c1dcf32b5aa475382e824538536a759da0448cca305";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/ca/thunderbird-52.2.0.tar.bz2";
+      locale = "ca";
+      arch = "linux-x86_64";
+      sha512 = "7bcb35886fd0344c18f29d5221d765a91da48db3c32f7be4c4ca0e9808dee2f6577bfafff32e8b9676a00e488f7617c66dc6e2cce5238569c24fc1679ac6c1d8";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/cs/thunderbird-52.2.0.tar.bz2";
+      locale = "cs";
+      arch = "linux-x86_64";
+      sha512 = "8bda94fbe1043168894fb70edc3d87b670830377faee7397c26805bf8c2dd23bbbb5c4b1d797468875fb653fa02b8bc211aa3766793d3f9b21a139265651692b";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/cy/thunderbird-52.2.0.tar.bz2";
+      locale = "cy";
+      arch = "linux-x86_64";
+      sha512 = "65818715e994ab314ef4ac8a7d3e7c61e8918cd1d0d0ea4f51461f50d207d1c998c6452740c6f3fc07d70ebc1d24e5bebef622787d8e6f79f57ace1fc85e1e16";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/da/thunderbird-52.2.0.tar.bz2";
+      locale = "da";
+      arch = "linux-x86_64";
+      sha512 = "1b7166d185ff6fc8cbe826d11e7b96ccc4528ce6421a7ad73f82d9c9c0f35a8de043b30fdec1e6ea3cc6d48645f42173b941cd6f8cc6d526264d4301c2943ade";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/de/thunderbird-52.2.0.tar.bz2";
+      locale = "de";
+      arch = "linux-x86_64";
+      sha512 = "af6005f229a4cbc84c4f99ea1b13413d5a40ab506163786cacf513460170f77b3cb866a4b76b0691facc43cdccc39de68e9010550220f9d6cf288aac53909a40";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/dsb/thunderbird-52.2.0.tar.bz2";
+      locale = "dsb";
+      arch = "linux-x86_64";
+      sha512 = "c326aa0c775e414fbfab466be742b804dbb364f60b084b4890c783f6c9e7bbe5da05b09b1608d51535ec3b60eaad5f775eb36834dd69d66f18a4746b7fe55c68";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/el/thunderbird-52.2.0.tar.bz2";
+      locale = "el";
+      arch = "linux-x86_64";
+      sha512 = "b18fe1345c27095b2ea0afdec088b56d2cfccd57e285e881f1bbae4bd6eed6e39e76d24ada963d2337729eb93775d948195139815f694cb45978978a33682e08";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/en-GB/thunderbird-52.2.0.tar.bz2";
+      locale = "en-GB";
+      arch = "linux-x86_64";
+      sha512 = "622c2c3979b30f724be73b5c6bc54f944f24a797cb1c3cafd11c2a08381e692621b29eadf64438b8207dd9254bddfa8b524211f7802e83453c1eeec99ab27108";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/en-US/thunderbird-52.2.0.tar.bz2";
+      locale = "en-US";
+      arch = "linux-x86_64";
+      sha512 = "76505876b7a408cc296ee575dea6f89db9cafd31f58e961bd0c1c5cf021771cdaa8bb4dfa508a4bde386846f97be6eccbd499725dab8e5a692bfd48125f1bf82";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/es-AR/thunderbird-52.2.0.tar.bz2";
+      locale = "es-AR";
+      arch = "linux-x86_64";
+      sha512 = "38f32cb430c679c63b8c6ab7d22bf5cb2af85bfa17fcbedc94d9fafa27874b917c7f34d7ddaa6a4dfa5d1674c09b3901cc19de5e217a965890eac5ef9246b22f";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/es-ES/thunderbird-52.2.0.tar.bz2";
+      locale = "es-ES";
+      arch = "linux-x86_64";
+      sha512 = "049e9445a850da0df09a0675cc9524d1bcb6ac4dc0ba8178df07ae4fcb9b4d9ff4677229968573119c5ca2c61a6f35da96167ece9d2da97e6b4e541bd9fc04b1";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/et/thunderbird-52.2.0.tar.bz2";
+      locale = "et";
+      arch = "linux-x86_64";
+      sha512 = "e2bb4aaa7e6a447f63456adbc35feb56e5e6ceac791ae54a2f34eb283cf3a61565c06cc09f66fcf01d722b8ed0972e51da33a94dfd333108fee2e967346eb9cd";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/eu/thunderbird-52.2.0.tar.bz2";
+      locale = "eu";
+      arch = "linux-x86_64";
+      sha512 = "eacfbee76dc62b15e9a807db9409d63b2991f976faa109ef5991b2a6befadfeed8c341a448c0af84d1fc8f6914e4d515860294f2e54bb97f4ce2727c4d73a030";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/fi/thunderbird-52.2.0.tar.bz2";
+      locale = "fi";
+      arch = "linux-x86_64";
+      sha512 = "c6ba259c3729535199905773674800f2772bf952a8596e11eb73785a9176072434ae47abb40c35e8cb0f66b4c46162d48ae699985857ad9a208c645cf76f0189";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/fr/thunderbird-52.2.0.tar.bz2";
+      locale = "fr";
+      arch = "linux-x86_64";
+      sha512 = "eacdc3ce1967ef7913012c448c4a4898463c80fac41fb5bf16d924eb31ea2e68e7ad46ee88b5ce107e85a18789a19e05006ae4786a5d9e9a2f93c05013aa9f4a";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/fy-NL/thunderbird-52.2.0.tar.bz2";
+      locale = "fy-NL";
+      arch = "linux-x86_64";
+      sha512 = "450011ce8012918dc8196b68a32f4b2ab27dd893a15ebd621fa17923ba5a63bff6fb634e1cc22cca3fa64d61dcc23565ceda518e04e7f92d91a0bc86fcd0dda7";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/ga-IE/thunderbird-52.2.0.tar.bz2";
+      locale = "ga-IE";
+      arch = "linux-x86_64";
+      sha512 = "ba8271e67b61e92bb819b0739351cfbfb128ecd3842f1c7ad69f7e9c26f4d52c10cf71f5d8cb45dc1f30d3168dc0acb991be4ef208e6947c3c36f4e5c0071f69";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/gd/thunderbird-52.2.0.tar.bz2";
+      locale = "gd";
+      arch = "linux-x86_64";
+      sha512 = "324044728236a52fe136c62f250218d6d2e364bda7b9f781a5f1c05561e37e09c9180733be0dd69f170e2229924c9ff7f2db10def13b86a7d21d5801d171a3b0";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/gl/thunderbird-52.2.0.tar.bz2";
+      locale = "gl";
+      arch = "linux-x86_64";
+      sha512 = "a31f01bf15d17d8efc645ebe4184bf4b5f02107f24765721eee87dc10463c7e8219a1ba3d60468e132f6b934f6f138b441f94d3d3e790f2fbad45107210f69d9";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/he/thunderbird-52.2.0.tar.bz2";
+      locale = "he";
+      arch = "linux-x86_64";
+      sha512 = "c8356bc183eb9837c3049288d63e1c13098143cf7a80cc5452d9852ffd2407eb85aa5ed574063700f93fb503c53c2b733a1bebc62cb890d408af75f8e4970856";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/hr/thunderbird-52.2.0.tar.bz2";
+      locale = "hr";
+      arch = "linux-x86_64";
+      sha512 = "8ed3f1c84f28a4435a3a6c9b136d4c27f6fdd3a41089b34afa04b74d5ca15cd535e179070cfdc862d3b3f5559fbafa7ae6c620f448afc8279765aa6518cdbd9c";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/hsb/thunderbird-52.2.0.tar.bz2";
+      locale = "hsb";
+      arch = "linux-x86_64";
+      sha512 = "bd14c07d1c2f5b8aebbee64914db544823ab90b70cc2a4e5d9fda28e9611310a5d6a6fb0f17d07e60534e9d5082506f0ffe22b1b4da1351f5657620612add6b5";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/hu/thunderbird-52.2.0.tar.bz2";
+      locale = "hu";
+      arch = "linux-x86_64";
+      sha512 = "9cb1430ef3036f4ce06d0734775e83ec09c551ce573cf3b50b5a2484f411e76ca09ae0295d6285d15e1f8a71f27c804f9dc328a4e4b534fbad34a97676ec2d7e";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/hy-AM/thunderbird-52.2.0.tar.bz2";
+      locale = "hy-AM";
+      arch = "linux-x86_64";
+      sha512 = "0c1d84777286fb55c2d8d25d5f5abf5498575bd09261331cca680e1f18497dab80597e5a132618019c5d03350cc4d49f4856053b8d255f8a1d56d1029434b776";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/id/thunderbird-52.2.0.tar.bz2";
+      locale = "id";
+      arch = "linux-x86_64";
+      sha512 = "8adfabb7885b2442c9dd8ee1128675865690bc632185da20caa894b38c388cfff34a696c4932ffaab2217dd4c742e8c35acb2e10bee39a561aa83b19cce1ad6d";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/is/thunderbird-52.2.0.tar.bz2";
+      locale = "is";
+      arch = "linux-x86_64";
+      sha512 = "b5608a993d5a2a50a38516ba346cef8aa5f173f81eda2b29c06b77e8cc8964dc174fbd9a67294a66caa366956a0ae79aaf8c0e0d612935e871174b1073647f70";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/it/thunderbird-52.2.0.tar.bz2";
+      locale = "it";
+      arch = "linux-x86_64";
+      sha512 = "06bb846f018d1f8cc1bbda5e707b9aff31bf94ddd8a7aaa699c67f1c18ea8a4c92657587ae6c9a07571d2a6371d50e31b1000bec719aa432404924938a162274";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/ja/thunderbird-52.2.0.tar.bz2";
+      locale = "ja";
+      arch = "linux-x86_64";
+      sha512 = "9019ec44f39918796c5da7fb2b23e19918e20d5688b8e55aa986e2b8a4f2abaf6ae87149b1bbbdedd2227c3152f48e4042078c979930db5d521d3a641312599e";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/kab/thunderbird-52.2.0.tar.bz2";
+      locale = "kab";
+      arch = "linux-x86_64";
+      sha512 = "1ed0950fd1b5cf82efe2c031abbb8d34ab3a0ef93182467592a9f77610bf494ed61a2e1d0117132abd5bd0f835bdcad75bf202588097210acdfbd67a1be5caf0";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/ko/thunderbird-52.2.0.tar.bz2";
+      locale = "ko";
+      arch = "linux-x86_64";
+      sha512 = "65ae48fbc79da6e3e20f5d325d4c93b2e945a95eaffe572c83cee08cefbe6718bd202c7e54095ef74d3069148b58aea1d2b0b795e94230b4da99b9a42fb39155";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/lt/thunderbird-52.2.0.tar.bz2";
+      locale = "lt";
+      arch = "linux-x86_64";
+      sha512 = "f8870ee532dd73a0a387c00a1295209ebb965b3e7a63abcce7f17457c38636a07334ff7f4dd99c60349e748510645487ab3761efdbde985d1f3cd9038613cd05";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/nb-NO/thunderbird-52.2.0.tar.bz2";
+      locale = "nb-NO";
+      arch = "linux-x86_64";
+      sha512 = "d4316434d0e8a824b3502bd413abe112bdb9b6da28acb39127ca83b43f8fa3f7b80bdde15758f2ca5a5013abcb374382ce79dd16ea48342fb6f6283eb242e162";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/nl/thunderbird-52.2.0.tar.bz2";
+      locale = "nl";
+      arch = "linux-x86_64";
+      sha512 = "da6c7cf68f5502ea29a1600f2040953dcd064859a9b82856ae419472ae039bff5c2b31f56c282961eb02ae0c86c8ce63131fdc4aaaa712da03d76ee05726ba0c";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/nn-NO/thunderbird-52.2.0.tar.bz2";
+      locale = "nn-NO";
+      arch = "linux-x86_64";
+      sha512 = "9a5203e6f451aab318500eea9b7fcbdf70fcd22d6cf42e838926fa9fae14176f1abee875ac085823adeb40d2fd2e2992d538c34ad817b408fdae19248302aa88";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/pa-IN/thunderbird-52.2.0.tar.bz2";
+      locale = "pa-IN";
+      arch = "linux-x86_64";
+      sha512 = "43e86e758f547363bfd5bb1c9c16506bbf6314354aee4265fed588fc29759d87482a86c442ba9d3e16c50477c4a5542b02a1539de8833052ee23811d61bcdba8";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/pl/thunderbird-52.2.0.tar.bz2";
+      locale = "pl";
+      arch = "linux-x86_64";
+      sha512 = "d418735505f1152a3cf1a1c2ff36d4cba4801327b1f01e3743c6411d30b7fdad7f0ae72fa78de9b356bfb712bc834c6eef46df9c251be7d18119f5da423f3ca1";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/pt-BR/thunderbird-52.2.0.tar.bz2";
+      locale = "pt-BR";
+      arch = "linux-x86_64";
+      sha512 = "3e33431860b0f815153845ebde36de52d8bd0c2e1828e127009b467c33710c70d38c4b9f70c5572e09778b17c30f7688f1e802e48ce7cb0a6a015d0fa1e26648";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/pt-PT/thunderbird-52.2.0.tar.bz2";
+      locale = "pt-PT";
+      arch = "linux-x86_64";
+      sha512 = "953143e100d3ffcb76224da98ee5ae1d98342d2806565ab048fbb6d8de65f6a02c3b6dd87aec4cecff676ff724d4790964b2e82ebbc64a3eae8beb343ebab211";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/rm/thunderbird-52.2.0.tar.bz2";
+      locale = "rm";
+      arch = "linux-x86_64";
+      sha512 = "b5aa940b99282bd84748e47d8f51a53e250d20cf0c7b68e5f66719ae88d9c241f290b2d637fe3e711948f9a6c6df8304cf9514599d73e387eb268a1c8f8c8397";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/ro/thunderbird-52.2.0.tar.bz2";
+      locale = "ro";
+      arch = "linux-x86_64";
+      sha512 = "26dc1b0c57b468ba815154b035c3fe382051b638bdc673db69a88c879a8524f55a24626c655026cb67c2688a29b6c946e2b495cd7dec4f16d8fbba21d5a493bb";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/ru/thunderbird-52.2.0.tar.bz2";
+      locale = "ru";
+      arch = "linux-x86_64";
+      sha512 = "5d17e85ec3eeac8ea3916f0dc71be7560bb1c4877c505a1f29421a9d496d8aafe48b9236c225f1de48a4dffbc9ed536f91dffed7d6c823480ef1e0c5b6e400be";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/si/thunderbird-52.2.0.tar.bz2";
+      locale = "si";
+      arch = "linux-x86_64";
+      sha512 = "d4599a3814173d8bce2f24b6b015492d7b24547d4e53d17cad45cc9c01c8b65be3447f8b89ab8ef2f573140ef7e1aae7eef7943102e21611525abc6efcd02694";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/sk/thunderbird-52.2.0.tar.bz2";
+      locale = "sk";
+      arch = "linux-x86_64";
+      sha512 = "a990104e68df9c2bf833c821eefdc1cbefc16f6e782bb8202683261f395f33c419afb967119ced710dc08966978043731c1adcf16dc716ff6eac8275b03f1834";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/sl/thunderbird-52.2.0.tar.bz2";
+      locale = "sl";
+      arch = "linux-x86_64";
+      sha512 = "2fab7f52ceebee1895e520c6d185bbb92793a31c52ed2398731c0cf36e3888a58d945d92f5777fc87a0a55b96418406a0be15cdd95b0f54482e821ea1cf29ced";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/sq/thunderbird-52.2.0.tar.bz2";
+      locale = "sq";
+      arch = "linux-x86_64";
+      sha512 = "f201861a30f993306378043ecab288970c4a311a91a3d232cdfe9a4d9339052f026ceb35bc6dbc2bb452f58faa5e3eccd273b87e96af5cfcf292dfcf94612077";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/sr/thunderbird-52.2.0.tar.bz2";
+      locale = "sr";
+      arch = "linux-x86_64";
+      sha512 = "6f8962d8c30086434764f0d037801bfefeef13c67e46f2b639bc4f5a93ac0094630af375bffcc54574d50ecd8c7b5c5decdd9e2083666dc4394e6237fac0b746";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/sv-SE/thunderbird-52.2.0.tar.bz2";
+      locale = "sv-SE";
+      arch = "linux-x86_64";
+      sha512 = "b29f506138f62350717ba2d2881cf8852dbef0c9797da64b9d5d9affa884cd1057483e2d0e357e967d9567ff4e861d1ad79596b39aa02a36087041e1f94d9d67";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/ta-LK/thunderbird-52.2.0.tar.bz2";
+      locale = "ta-LK";
+      arch = "linux-x86_64";
+      sha512 = "3bc50fdc95776aeca2de94fa1b895d5a17cedafb95aa08f2d0100fbb4c3acd31990b96a57fad451c82b56d8cab7ea5066642da7b000857f00ba8f0bf94051f5a";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/tr/thunderbird-52.2.0.tar.bz2";
+      locale = "tr";
+      arch = "linux-x86_64";
+      sha512 = "8e1481a03ba5de00bc64aa252f779dc0ceb14c238985d11bb49467a719ca88bc4e7946086b039951f03ed43e11a15a5bbe98139d158f63dc3cdbf01686ec91e2";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/uk/thunderbird-52.2.0.tar.bz2";
+      locale = "uk";
+      arch = "linux-x86_64";
+      sha512 = "e9bfce635b1d56d646baf06bc642a7914846a6a796e983c4b0f78b912833ccee850719f0857ceb7199d328415a976b436706d72c95f01da1d0d0b4c0c5d0d732";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/vi/thunderbird-52.2.0.tar.bz2";
+      locale = "vi";
+      arch = "linux-x86_64";
+      sha512 = "ea989bcf275162c8d72ad595bee767b9652f192ac18f61119cae8f084f9a25c0d0a83caa14cbbf901fa675f1a0c0a6b40ef46454f9c8f1fc3d5173a0ef1397be";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/zh-CN/thunderbird-52.2.0.tar.bz2";
+      locale = "zh-CN";
+      arch = "linux-x86_64";
+      sha512 = "35637dedad6da1662057fc1506b2e21bc6269eb0256e332ff6b12bcdb71906e28dc0f361bd7aded2fa52d982589f0e319667acb7ccd405e2fbfa8ba991e5aeb2";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-x86_64/zh-TW/thunderbird-52.2.0.tar.bz2";
+      locale = "zh-TW";
+      arch = "linux-x86_64";
+      sha512 = "286ed00a024029f7e6ce30709cac3da3d6bf00576248622a09bd9ce1ae2e965a0fe158d718d35f1e088f51ac4e271d57aaa98446c87c0bdcdecfa0d36d988e92";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/ar/thunderbird-52.2.0.tar.bz2";
+      locale = "ar";
+      arch = "linux-i686";
+      sha512 = "8783d0cfba31ead11e49bf1a8afb5b66b1387b29681acf3c63217ba4a399a6fe496eb0357e0871c98e8b6465abc6539e6ccbd9d40e799e04674f3ab2dee25390";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/ast/thunderbird-52.2.0.tar.bz2";
+      locale = "ast";
+      arch = "linux-i686";
+      sha512 = "213f0457760072fd2e6cd2daa56677d8b67b8c345f44faebb2623f073ecf141ba4d30d2176fd5680efe91e46086b4add86462385fe5b9e72978cf2828eb8ed68";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/be/thunderbird-52.2.0.tar.bz2";
+      locale = "be";
+      arch = "linux-i686";
+      sha512 = "645d7eceac4d98ab37b8c85c2d0c58499bdba1c8db495690bc665c80b5aae414b0a8caad16931a74768137812f3ba8ce173f5080e95bd44e95e51d6f544cbf03";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/bg/thunderbird-52.2.0.tar.bz2";
+      locale = "bg";
+      arch = "linux-i686";
+      sha512 = "b9030a61e8d964dd18362e472d18d7a9d6a7636679c016bca82b254b06e221c6551aebb166f829977fb4f0d1809b18b820cb1d842e6949f44dd4e5becbf98651";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/bn-BD/thunderbird-52.2.0.tar.bz2";
+      locale = "bn-BD";
+      arch = "linux-i686";
+      sha512 = "fcf50581bb2f1548f4aab01b8f7a89e351e642a49ca76e05fc47d77b9e2459f2ff700501079180b92120727ab2ba74c3c6990fc7d6d9018b9ee4ec1d27c42aaf";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/br/thunderbird-52.2.0.tar.bz2";
+      locale = "br";
+      arch = "linux-i686";
+      sha512 = "5359fa3b6f745db0da286a0180773d3fd43c446c78d8351cc0c5589ade332fec5ccb6106a84ed3bc96e34ec7ca2d72f93c22f6653aa39250df05b0e39108fa89";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/ca/thunderbird-52.2.0.tar.bz2";
+      locale = "ca";
+      arch = "linux-i686";
+      sha512 = "e5d6d77ad204d279abcd34b9734ef5489d5b8522558af7cfb26de77fc0d22a5ce669dd6ff9fce7046745aa9ef75323fadaa70ad3ca4fa0f05aad85add6c1e7fd";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/cs/thunderbird-52.2.0.tar.bz2";
+      locale = "cs";
+      arch = "linux-i686";
+      sha512 = "4bee0154e7f1658ea88c7cf7cb5d89e354d29516c727090bd704945ecb2c0988551e98de2c8b44d5899e44ae141a6e3c230550392d34b5dac121cd1c4d6ce994";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/cy/thunderbird-52.2.0.tar.bz2";
+      locale = "cy";
+      arch = "linux-i686";
+      sha512 = "23779727198092d4d8e7ed1d40615b020858999ae5023ebf81553dfdc62b7cc03cf864eae262450d75d6088f6b283ef7f791073901f5fda367df96e291e9537f";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/da/thunderbird-52.2.0.tar.bz2";
+      locale = "da";
+      arch = "linux-i686";
+      sha512 = "e780597823f156e273832ff731adb2cb39a58e6e232d910f9f0a3b05dee68411ee3e8345462137d74a8aa2a6dd0c3d5e93bb889bd425c051ed7befcd4da5c711";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/de/thunderbird-52.2.0.tar.bz2";
+      locale = "de";
+      arch = "linux-i686";
+      sha512 = "1c35b4aab4bb27569955f3c29034e8c301c32d24547075c4662e162bfe1c19feb602b3fcc3c561956651328fa33605f60ed29ae52b50b06eecf39e43e82663e6";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/dsb/thunderbird-52.2.0.tar.bz2";
+      locale = "dsb";
+      arch = "linux-i686";
+      sha512 = "59fb994bd8b2db74ae5024e8c2f6c859b93afd247a159c552bffe8c2337a0d4229bd17433635f8c87420af614c7725af7b0ecd144938654f9372fe6d39a4152c";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/el/thunderbird-52.2.0.tar.bz2";
+      locale = "el";
+      arch = "linux-i686";
+      sha512 = "87e43e3c66db44c6c1d659eff81b72bae4d6961045c37ce776531ab6e4f4a3e6c8d3774f39fd437e5ca4cc289bbae25fae8dbf8ed3e21aa2327cc166d4f17f47";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/en-GB/thunderbird-52.2.0.tar.bz2";
+      locale = "en-GB";
+      arch = "linux-i686";
+      sha512 = "b397fb3142c0693282405d9e6d4515f368b3c6aba581e6eb0712c3d161f8fc9dbe034a913a67ea034dd89860b32072f82dbf2b767bd0c360f3bc9c0c8944d045";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/en-US/thunderbird-52.2.0.tar.bz2";
+      locale = "en-US";
+      arch = "linux-i686";
+      sha512 = "05926a74f6ecef5caa43884a3fa2cdf85f40c53da58ffa24cdd2c8c31efd1b3e90a0d06ddba33d612a3b88f31d4c72fe92f49e31b4f3ba3479c510a02d91eb33";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/es-AR/thunderbird-52.2.0.tar.bz2";
+      locale = "es-AR";
+      arch = "linux-i686";
+      sha512 = "4652c005c0c28760d1a2657b691b13fcf7882763cff4ff05313d1dc5786661e76ca74a4fa23e1e71e4315818c9c2a386407151a996fab4d2f3bf343a353038db";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/es-ES/thunderbird-52.2.0.tar.bz2";
+      locale = "es-ES";
+      arch = "linux-i686";
+      sha512 = "64e8eedb59df8ebc5a568aa05d0df5217a3c91311455a090b4614dddbb2bd0d09add02e11c712b84696f3d203bb5503959dee9ec8e0aee7ba5d0ef2e606942a4";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/et/thunderbird-52.2.0.tar.bz2";
+      locale = "et";
+      arch = "linux-i686";
+      sha512 = "2773894ea50cb0bc889ad1cd887bd7c34d594a19ae69fe48cc181d5bb31a9a15bf6e0e41fa1493ff86e481715e888d35db5b100b22516b187cbbb4e35f36fdbb";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/eu/thunderbird-52.2.0.tar.bz2";
+      locale = "eu";
+      arch = "linux-i686";
+      sha512 = "8a73144e9085f4f07db7d24da388808ebe94b4cbd2c3cb1f327ed0c44a3144c94fd61171b74c18c3e4ee72fd809791a8c942adc0a4b3bcaebaa2f02dbf26d572";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/fi/thunderbird-52.2.0.tar.bz2";
+      locale = "fi";
+      arch = "linux-i686";
+      sha512 = "ba53c735c136901bbcfebff6fa646d884aaeb919a77744c1ec412a109f39853b2d74d70a56f85e4bdc3b7780475283284c46b0db79c64980a7655eb8f0bbe0f6";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/fr/thunderbird-52.2.0.tar.bz2";
+      locale = "fr";
+      arch = "linux-i686";
+      sha512 = "fe93f41bbf357eb1b60c0418dd64afbb37310ec25aeb66521472f84eebc6205d87d19090df6f38de3d9fee29f7f961e68e9794a65f51a0fcd103a40a16a919fa";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/fy-NL/thunderbird-52.2.0.tar.bz2";
+      locale = "fy-NL";
+      arch = "linux-i686";
+      sha512 = "1739f96789414049ebb5a8fa47f0455a630bdfbc9757fd96f81a8fe0fbf6c0b522bdf04a315b590c968d1832ee2faa2bdd98fa4ef6e86cd8ab2d0a338e8a47f2";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/ga-IE/thunderbird-52.2.0.tar.bz2";
+      locale = "ga-IE";
+      arch = "linux-i686";
+      sha512 = "b42fb3d2cb8ba5be74d3f4212aa80fbf2af0366bdd9eceba69555eb766f0a96c1a8092a3b1e39c0ddc8bae7cc7efb59f56806f90c0de95d3073db15e3d894a20";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/gd/thunderbird-52.2.0.tar.bz2";
+      locale = "gd";
+      arch = "linux-i686";
+      sha512 = "0921d25bd235d2a234c75f24297ef38568d0532fbe1dbfe98f2b9ca3641ea95db6c4df0dba3f8a8313a2fd169d2d86f7adab21db795a96f68fa566117db2c2e9";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/gl/thunderbird-52.2.0.tar.bz2";
+      locale = "gl";
+      arch = "linux-i686";
+      sha512 = "7fe9346fcb26a7d4a96cb6cd2d804874bdf2f3f89c9b9791742f9a2a03a7a865fc20766f8618c04e7d7fbe1fcf0fc907b4db5834770218f4e1fbe8d8df37e94f";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/he/thunderbird-52.2.0.tar.bz2";
+      locale = "he";
+      arch = "linux-i686";
+      sha512 = "7082a591a52e8a0e7bf112dec08dc3e130791eebee6e7d39baf052f40b8b9fbc350518b7785f3bf7ec62df8dbe05a256fa322714ba7a4f704a9cddf40cd4b11c";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/hr/thunderbird-52.2.0.tar.bz2";
+      locale = "hr";
+      arch = "linux-i686";
+      sha512 = "397a1214ab27b187df6129f6f2f863ec1b76ce2af41c0ef5650f255451c57f07741f6a7d0674ad38432c7ea9c95fc2b36606d31defc698fffa4b676549b2c197";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/hsb/thunderbird-52.2.0.tar.bz2";
+      locale = "hsb";
+      arch = "linux-i686";
+      sha512 = "f0c76d90ae2b47e8d5c66a536ee1b2572f60164f76424b61b491326e719f4454448a9af4b6ceb8e1055f7e44adb6490a0fc4df086c344d160861d877766e227f";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/hu/thunderbird-52.2.0.tar.bz2";
+      locale = "hu";
+      arch = "linux-i686";
+      sha512 = "d26eb645574d9298c75bd334371fc7a4baaa9b358b37c5d8da6e61b6d8fdf3fe165a5ea1855a840a742c6b19e3a15fbe7879e43bb29b187daffa63c59a863e06";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/hy-AM/thunderbird-52.2.0.tar.bz2";
+      locale = "hy-AM";
+      arch = "linux-i686";
+      sha512 = "add66a00fd3a8be7c71276d02588ffafd0ed0a8b2e4875dab3b82e4fe9b2be3964096509ce6b0e67350f62cc814b7c7ed069f481516f72f19a8039967123346a";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/id/thunderbird-52.2.0.tar.bz2";
+      locale = "id";
+      arch = "linux-i686";
+      sha512 = "b793e65e9e9f8d30ad0193f019acf33bfbfb165313a960f120bfabeb4df0c769cc9fc5b7e34ea05eaa085a5c0872134d606862b381852d04748c2e97ed1bf9f7";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/is/thunderbird-52.2.0.tar.bz2";
+      locale = "is";
+      arch = "linux-i686";
+      sha512 = "d4f163358a2c8830e3a77a5a82b8ee42d2aff39f19fb95171a249d1cde5119c66ee29bc894f5e6ea023c34e030282194025b25c04af25f647df8745d2b8aa2b9";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/it/thunderbird-52.2.0.tar.bz2";
+      locale = "it";
+      arch = "linux-i686";
+      sha512 = "9e73d51cfac30480fe0ef46c02df12c771fdd827bf4c2971b99cad7b3db42d3d60a2355c20c0b3601c7d27be5b9c2d1748a1e3b8954523ef919d120429153103";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/ja/thunderbird-52.2.0.tar.bz2";
+      locale = "ja";
+      arch = "linux-i686";
+      sha512 = "ce3d8342c0fc63a9c6ab10a2d15f6ef79d8d827cbf542cf0eead9d01d1a26567edb48269ba2ed66dcf81bf83e35a120190614f740898181a3b2cd7fcbfd5e739";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/kab/thunderbird-52.2.0.tar.bz2";
+      locale = "kab";
+      arch = "linux-i686";
+      sha512 = "9ef94353b58ade84737debbd58a26aca9b8c5358c3fb852f2dd925e9c8eec46f091d4edeb0a4fe46da45eb9860ab76f43a97605085907fa79d2ba90751ea64e7";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/ko/thunderbird-52.2.0.tar.bz2";
+      locale = "ko";
+      arch = "linux-i686";
+      sha512 = "651ab9ae9b966e10f420802937140a689a3c925a67732cc3082e8f265d2f98fe88195188632386d64f892338b1c4ba659c7e475951810d5b6ee48a7339155413";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/lt/thunderbird-52.2.0.tar.bz2";
+      locale = "lt";
+      arch = "linux-i686";
+      sha512 = "f64c0869033ac939538f982ff66b0a88cb566e7000838e549d63fa6509afe8a29865fce3cb6c7fea84c78b5ffd07a4f8b11b44b14c234ae957f22439f7a84a99";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/nb-NO/thunderbird-52.2.0.tar.bz2";
+      locale = "nb-NO";
+      arch = "linux-i686";
+      sha512 = "9dbd31177470ba94a646d7d63890dcc2465681a4c6fc684f7cbe61eeebc788c03a863ed5a01a1baeb26ffa61d7af4631bebd74261c22ee1a109ceaf928ce4925";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/nl/thunderbird-52.2.0.tar.bz2";
+      locale = "nl";
+      arch = "linux-i686";
+      sha512 = "3616bce4895db1c2f3b02773b05586bf6e38550ad7abd5beb3b31a6c5b414120972b5475c080bed782e7f2b09fe47bde3e5b41f4c3fdb7ffd823767c976dca0a";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/nn-NO/thunderbird-52.2.0.tar.bz2";
+      locale = "nn-NO";
+      arch = "linux-i686";
+      sha512 = "4ec009d5aca053ffbbb6cd5c84572f0305f22f33cd24eec13eb3fd04aa4eccd3447701edb53e4929914ebd2f7acc8e3d7f8e5d91c9e7a7f0b9e9c18493f74d55";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/pa-IN/thunderbird-52.2.0.tar.bz2";
+      locale = "pa-IN";
+      arch = "linux-i686";
+      sha512 = "584c5cf7fc62f4f6435d9ed2ba9aa200012aa65e7fcd249aae10dc2b3dde8b4db724b11beb206a727f3eb2f60e4a8c0e5e1abbd4e621645d651cba449bc4a474";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/pl/thunderbird-52.2.0.tar.bz2";
+      locale = "pl";
+      arch = "linux-i686";
+      sha512 = "aa02a2910513159c2621dc17aff373a8c2124bf9aebb24bf54c239d823d0080a1c05c330185af5dce21084d7ac9060a2b8daf890a3227650416d82afd0fa8e9a";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/pt-BR/thunderbird-52.2.0.tar.bz2";
+      locale = "pt-BR";
+      arch = "linux-i686";
+      sha512 = "b5b2654bf153bd7f7c85534b95f836892550e519e254312584b22981bcdf7205f31babb5cf32033f7d676eee2bf2400f88503b52268f2ef10286da82b2713704";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/pt-PT/thunderbird-52.2.0.tar.bz2";
+      locale = "pt-PT";
+      arch = "linux-i686";
+      sha512 = "3d557b432531a757bad6f18754b9d2fb2359bdba49f20faf797f7eba821926aeb8476c89a93b475273514bf26a6f471637505c5eb8a1cc08d1cf830b28b21fca";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/rm/thunderbird-52.2.0.tar.bz2";
+      locale = "rm";
+      arch = "linux-i686";
+      sha512 = "434122ff7524630ec45a7e6a0e5f90e74ea1397b31bf67ce9e3046f8a31114a8320e56a5dedf1686e2eebc8c648e4a94fd0cdbe523bdcd6312448100d548e302";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/ro/thunderbird-52.2.0.tar.bz2";
+      locale = "ro";
+      arch = "linux-i686";
+      sha512 = "6f2c74d119ad7380961c50d5bb91afd4bb9455737776a08eb5168c17e83143fefacfeaa3b98e1816d1fe96a7f2022256cd2acf7b697508e4139d792562be2176";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/ru/thunderbird-52.2.0.tar.bz2";
+      locale = "ru";
+      arch = "linux-i686";
+      sha512 = "d9eff15876619a1bf0b8467847df18b0dba20c598e05428037b81e0cd90797b8baafc44541fed2a29dfb27075da19730919159495712099a54c9b488a693e3ca";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/si/thunderbird-52.2.0.tar.bz2";
+      locale = "si";
+      arch = "linux-i686";
+      sha512 = "a2e58a6b2632f8c2f6eaf6113e2af9e98ea222c5d2c98f0cfb4443804ce260bb3dba64bd5165590563fa946b500bbaed4341629eb25ea0c5388c61c69f4be5cf";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/sk/thunderbird-52.2.0.tar.bz2";
+      locale = "sk";
+      arch = "linux-i686";
+      sha512 = "0b26b3848864def3a5b485c2d67d3c907b58d9977ae91db58d91218da278243c04eeac781fe0063b762d0797809dcbee18010824aa5d25926f8f48011e2a5bb4";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/sl/thunderbird-52.2.0.tar.bz2";
+      locale = "sl";
+      arch = "linux-i686";
+      sha512 = "7158c776ec3776ac269402973482e2dfedb3c17aeac11fcae3bee6a982717443068223cc901ee71e6b7a42a8073f05d2a54047804997d992761fbe71d46bd223";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/sq/thunderbird-52.2.0.tar.bz2";
+      locale = "sq";
+      arch = "linux-i686";
+      sha512 = "1a838db31f4db574669987614dfcbd5f7f1eb061dc4f2fd0c9ca206d5a5291ac348efce3ce59b30f89fdc375e72467531d9d96b8ce43ffe28e92916f2864908c";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/sr/thunderbird-52.2.0.tar.bz2";
+      locale = "sr";
+      arch = "linux-i686";
+      sha512 = "beb9eee26aa5474ac5e70c168e2ee32c84216d919528c9edce4d45ab6c522d5fc888ba2f8c57cfcd47d299367ddb7c367dafc9ccd3d29c5700de28eb2efe08fe";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/sv-SE/thunderbird-52.2.0.tar.bz2";
+      locale = "sv-SE";
+      arch = "linux-i686";
+      sha512 = "e4c2320e547b2e61991feb586b7f9e4180cbeb88dc90cd0dfd2c026b062e4e1858d1d1b331cfde1e373cacec2231f7cb2ba61b5e4ef02a36802edbc96b39cf72";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/ta-LK/thunderbird-52.2.0.tar.bz2";
+      locale = "ta-LK";
+      arch = "linux-i686";
+      sha512 = "aa42add8ba31edb5a40fd62304f10ac55006918d5196f71ca0330c3ca52dbbf4d9b5d39a07e977ee89c6b913e6ac4d4a4c9460da194b41760826d96e89e7bffb";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/tr/thunderbird-52.2.0.tar.bz2";
+      locale = "tr";
+      arch = "linux-i686";
+      sha512 = "ceb90e08e906d5a2520152c40c4e32ab85da31c746ea285280b6e9bfbd60e9178886799357f39d54e0e072c616059ae7fe1948c39f6152b5f0d1b196185c8475";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/uk/thunderbird-52.2.0.tar.bz2";
+      locale = "uk";
+      arch = "linux-i686";
+      sha512 = "9d9fc486d556dbe3a216a3d4e822750cfa1cd0348af37ddaa5a19f9c390170e348a41b8251fff1499d2dc6d92feb34061286ff5400a4f9b6ed4fdee27064078c";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/vi/thunderbird-52.2.0.tar.bz2";
+      locale = "vi";
+      arch = "linux-i686";
+      sha512 = "010bc7ce4ee4329857291796e2077e0872593f2b52799b1524720fa7fca11f2f4b760610bc97db171421552eb59a36725f80d4852cd77d30c8e7eb6c6c523d2d";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/zh-CN/thunderbird-52.2.0.tar.bz2";
+      locale = "zh-CN";
+      arch = "linux-i686";
+      sha512 = "c07d2559296acb160c19af2db9f516254d33e1d55c78b2397d2c28764a8296e3da0b74409d48702e889bbf34f06115b493bbcea2666ad8b4884ea01fed6ad12f";
+    }
+    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.2.0/linux-i686/zh-TW/thunderbird-52.2.0.tar.bz2";
+      locale = "zh-TW";
+      arch = "linux-i686";
+      sha512 = "8fa1da0c35584cfb8013df9e86a37268e6ffed1ee5ba4617d3db185975b874af5dba3f3af5498b8ebfdf85e40409fb9fee8d517f84f4942cf69deaa94f3c64a1";
+    }
+    ];
+}
diff --git a/pkgs/applications/networking/mailreaders/thunderbird-bin/sources.nix b/pkgs/applications/networking/mailreaders/thunderbird-bin/sources.nix
deleted file mode 100644
index 78084753974c..000000000000
--- a/pkgs/applications/networking/mailreaders/thunderbird-bin/sources.nix
+++ /dev/null
@@ -1,595 +0,0 @@
-{
-  version = "52.1.1";
-  sources = [
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/ar/thunderbird-52.1.1.tar.bz2";
-      locale = "ar";
-      arch = "linux-x86_64";
-      sha512 = "41e7b02fa088054e59d68abf636b376837519502273ff9e25ba18d220e8e35927db2a7795354f997ba0f980f33a74338128999666dc0ea730babb4cb3077c17f";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/ast/thunderbird-52.1.1.tar.bz2";
-      locale = "ast";
-      arch = "linux-x86_64";
-      sha512 = "772e90be4cd4d10c1fc98df69d20509c954feb29c64a801d907f4944c429844d375ec241b8c45fdac375cfaeec3adfe7db81c2fd10e592cceb066b6c23c2c2e8";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/be/thunderbird-52.1.1.tar.bz2";
-      locale = "be";
-      arch = "linux-x86_64";
-      sha512 = "76832c00106c68a9b48c4892a11f7b48384d7934e7cf410eb2d7891f79303af29a2a94a3ac377bcda36a0894baf9c3768cfc62c3ebef0c640291c1b70d23e55a";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/bg/thunderbird-52.1.1.tar.bz2";
-      locale = "bg";
-      arch = "linux-x86_64";
-      sha512 = "a8776f1bb3c3d1c34b0a1d538cd70cfefb283031f372d0c7b1bc8bfe9dc39f240c746525a8a52968e060024282642a634488d7a8b30509b830232a63b3111fa9";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/bn-BD/thunderbird-52.1.1.tar.bz2";
-      locale = "bn-BD";
-      arch = "linux-x86_64";
-      sha512 = "e0596b70e52733a01f7cbc073f444b5798e7beeed42effcb329fffe8a74de25fd69636624ef74f0bc31aa27a078a6a5c763f203eb3fdc275f59c3eccf49e0cc5";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/br/thunderbird-52.1.1.tar.bz2";
-      locale = "br";
-      arch = "linux-x86_64";
-      sha512 = "12269d34c5ea1836f8fc12f7c163b966ee57afacf8bab7a010fd1ce2315193a8dbbba201fa474c9dd2e642f418ffb64eef608eaa37a5991168faaceda818aa49";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/ca/thunderbird-52.1.1.tar.bz2";
-      locale = "ca";
-      arch = "linux-x86_64";
-      sha512 = "42180ce29e1e53aa08c22d71902cb792ffd212c42c7a3632d069907d7dfa1571d0beb16141ab5b91af9f637d10278a5f5f5a2bd56146ea848b7f88010655cb92";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/cs/thunderbird-52.1.1.tar.bz2";
-      locale = "cs";
-      arch = "linux-x86_64";
-      sha512 = "63e4c8ba853a1289e977ffc27627e69f4509addbf9dcc294be3a49ed7030eb56181cdc6630e6dc3d207d50e2060ef80d5aeb3aa58c3ff95890ad54f0b88a8fea";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/cy/thunderbird-52.1.1.tar.bz2";
-      locale = "cy";
-      arch = "linux-x86_64";
-      sha512 = "30110d9db650afb9b0d47efa25006f03b4a9d9863f7fd37a49d49cfc4f2d8b7735a27676d36c84ef390d8358e0069d4708e6ef9eceeb12a38d226f917c4a2c19";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/da/thunderbird-52.1.1.tar.bz2";
-      locale = "da";
-      arch = "linux-x86_64";
-      sha512 = "1b0d6727f72cb8547f6b09c78d9375a63121d73959666e9500c01aa72253e923bc8f85f7a7738d9a0426c9a9e85bacfde3ad3e35b3101ae0af2c132841c60fa2";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/de/thunderbird-52.1.1.tar.bz2";
-      locale = "de";
-      arch = "linux-x86_64";
-      sha512 = "4e9c924cd763c15627494f9f247c76ad69fa719e1fec0aae1650949d0e13abdf7d4bdb86bf53cba0db7a124e97f8bb66895c00bbded00f324f8de06c9d1e9b55";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/dsb/thunderbird-52.1.1.tar.bz2";
-      locale = "dsb";
-      arch = "linux-x86_64";
-      sha512 = "b1b5fd7176a5743cb7064cfb9c74c78eb29873978551a6afd6c80bde92744d9793e53ff4bfca2af1bd06f9285305774d7be0d72d6fdd9ec38dd05e0c58fd537a";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/el/thunderbird-52.1.1.tar.bz2";
-      locale = "el";
-      arch = "linux-x86_64";
-      sha512 = "f85bc8f35b59176c69e7dc8cfcd7dbbe649c54487d453e56f35c414ce98548127cdf973db7739f7481dca6476c0f9cc54cd42576a5b05abf03ca8a2a26fff229";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/en-GB/thunderbird-52.1.1.tar.bz2";
-      locale = "en-GB";
-      arch = "linux-x86_64";
-      sha512 = "95249b37205cee0a1677c8fed8199b1a9a98d80b0dfbc513321d72e2a294a84e1d82f19b8732fe30189d9c508d9ebf98be9bf5deda87ddb83134f9b1e24834a3";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/en-US/thunderbird-52.1.1.tar.bz2";
-      locale = "en-US";
-      arch = "linux-x86_64";
-      sha512 = "dd13cf3e5e8ca042583fd134172a4dbcbcbaf8fe923d7f2c19e1f66d2802edc9901fad3a2593e382305b97bc17ae3b1266f3c2176648f8255894749db55ac8fb";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/es-AR/thunderbird-52.1.1.tar.bz2";
-      locale = "es-AR";
-      arch = "linux-x86_64";
-      sha512 = "ca300f267a36f1c5251c8eb5200d93ec558cebb22736c6939581f06bb3c00a9b617188be183bcde78afc6bef2c8a579c82d0085cb8cb0b8668c4975f3bd4578c";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/es-ES/thunderbird-52.1.1.tar.bz2";
-      locale = "es-ES";
-      arch = "linux-x86_64";
-      sha512 = "050a9b2468db62c306ff94eca093c9bebb3b55227bda653f4355915264a73a3da4ee930f46fac27ad932e67d8b37f125b33895cc759f5aa213b8b5f432e82339";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/et/thunderbird-52.1.1.tar.bz2";
-      locale = "et";
-      arch = "linux-x86_64";
-      sha512 = "f07a8ddb278b697396a2988208cd28059fd1449044dfdce6330a058e060113c8748607c52443349bb59ee8851e6d17626830acb99a836f4102b30ba83e96d12e";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/eu/thunderbird-52.1.1.tar.bz2";
-      locale = "eu";
-      arch = "linux-x86_64";
-      sha512 = "20d04d59df7689d515ecdfb64f118efec8964b7034e0e0bed0225e8b63c7f46228086f1d63b636eb3a549226aecc944db61e3d8fb1273ed5bf669f538f56017f";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/fi/thunderbird-52.1.1.tar.bz2";
-      locale = "fi";
-      arch = "linux-x86_64";
-      sha512 = "357ef2351d131fc4da8a4998cb3ca6147c3b2de638156d69a826d98c48d2fc8478905ba5c0a778280a2b29471f899d1851fa1cf8a7a010b0d7c7c8fcbf73f8c9";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/fr/thunderbird-52.1.1.tar.bz2";
-      locale = "fr";
-      arch = "linux-x86_64";
-      sha512 = "279e46c579577643adbd671455c3053b96c97fad626392b755ebd173b4c09e46ff9f2b52a829b90850e12ebbaea2afa0520c21b5376389b80e5e4f4b09b25ed7";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/fy-NL/thunderbird-52.1.1.tar.bz2";
-      locale = "fy-NL";
-      arch = "linux-x86_64";
-      sha512 = "ab4f11659e682eb78d14952ca60a1394a8cb7a982d182eaffce9a6c97cd9e6a6cdd1cfe1e278caee66a91a9fa85a28e9cb8daf06f4efc40fd36daef77b0ec2cf";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/ga-IE/thunderbird-52.1.1.tar.bz2";
-      locale = "ga-IE";
-      arch = "linux-x86_64";
-      sha512 = "31e8294c81955b1bd512c46d11659e9d95ef6e421060e37296e4e27d3a810ea3201c5ef01bec34a4161bb4e0a980063c546c4c8a2f23bbb7628dc6762857afc8";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/gd/thunderbird-52.1.1.tar.bz2";
-      locale = "gd";
-      arch = "linux-x86_64";
-      sha512 = "88bf4276c8148e8e1809411706bfa3f5dbafaffee11d3a2e6cfe32e76a9c9d99c1d43aec5c9221d684ae446ec117704e501dce5790a1f16ce8c3ab6124df5bbf";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/gl/thunderbird-52.1.1.tar.bz2";
-      locale = "gl";
-      arch = "linux-x86_64";
-      sha512 = "d19ccbf5cde54e6d4d9813803c33cf4b8bfdce14611e56c364bc2bbed0c65ab6bdb06b9c81e1e22f8b17f341552ea822a61eee431da815ab2b1ce21c32aa6d77";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/he/thunderbird-52.1.1.tar.bz2";
-      locale = "he";
-      arch = "linux-x86_64";
-      sha512 = "582654cd958b5ed3abe8a751dc085dcf47e3da92731512925144a9e7b77ac4efd05dc6414b61b63e107763f8149b9acb244913ab83014b45801da79c16d3ece4";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/hr/thunderbird-52.1.1.tar.bz2";
-      locale = "hr";
-      arch = "linux-x86_64";
-      sha512 = "61019566186e0d5c3ab8dc963472d010bff1d0ed705b2df17d3e545ebb7cb8d4caf1982cd11b530659413c5e7776b086da89df5fa52775654038eed1ba8826a1";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/hsb/thunderbird-52.1.1.tar.bz2";
-      locale = "hsb";
-      arch = "linux-x86_64";
-      sha512 = "7b1987d86b6eb4d620b6989f3b40583db56653be1c9bba9ac7d2a3132267790fadfaa4c34755c8c0df2a0fdfae15f6b8e70fa81dee9fd3885699ab67518a2958";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/hu/thunderbird-52.1.1.tar.bz2";
-      locale = "hu";
-      arch = "linux-x86_64";
-      sha512 = "89b902b9bc281db85ba11904dd1b422a65ffaadcb41d933ebd5fcd7b7b3f97c2d050a8fdb78a6da88b29b47f0f7643511e90a4af133e528c38f63db326d13e86";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/hy-AM/thunderbird-52.1.1.tar.bz2";
-      locale = "hy-AM";
-      arch = "linux-x86_64";
-      sha512 = "0afb1d38f1e4ceec5ec0a9d28ea9ca41558d3cec0d1ad04691e11901996d875a2d7508440c6870264c05b12f3776b2d705470cbef83cb11a68c19ae923b75763";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/id/thunderbird-52.1.1.tar.bz2";
-      locale = "id";
-      arch = "linux-x86_64";
-      sha512 = "34dd65c256900d0ad08db33272adc1761c190fc429de0e62d791f4160c241d9950d42efa03cd4e3aaa4ae5627b48ad2c9f0f0ad865f0d26233379d3b9a4e9f26";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/is/thunderbird-52.1.1.tar.bz2";
-      locale = "is";
-      arch = "linux-x86_64";
-      sha512 = "1b651359c2ccf8249fa2ed951e69bc2d16bdef08db6d103dd5110305ec497cce4452d2764c814068c968bfdfe75bfaeea0d119f8457ba1d72c881097c22fd143";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/it/thunderbird-52.1.1.tar.bz2";
-      locale = "it";
-      arch = "linux-x86_64";
-      sha512 = "15aaeacb1a0ab38297a179007039fb3fa5825618eae5e5d650f041bf5311e8f244dc0ef53d99b9513fc8e17b4f1d0a731cc06f08223b42d222be5e8f56b2a651";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/ja/thunderbird-52.1.1.tar.bz2";
-      locale = "ja";
-      arch = "linux-x86_64";
-      sha512 = "ab3fc3d0cf7be8e463c5e8f25ccac1cde2df9be15277bb81f253af15a0de53935cd5c53b8435e7ef5369cc43739b6e2fb8424bb2d7e1b153201b50a8385d1763";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/kab/thunderbird-52.1.1.tar.bz2";
-      locale = "kab";
-      arch = "linux-x86_64";
-      sha512 = "60f2a58444b06ec8f7bd98ccada16b33b0e528bc59b73d33df370cd44283b2b0e65160aa1b5ab9cd0a7f7c628056e3bef4d7c293814837b6a7df17dd057b8ec8";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/ko/thunderbird-52.1.1.tar.bz2";
-      locale = "ko";
-      arch = "linux-x86_64";
-      sha512 = "de7fedb8b379f54488c5ef6927c53e0c3651f08cb33b97a06359fa9c5a31b0d4a7717df8d493236b7e6cfcc5173d1faa3f07e938b65322ad6847f59c4061597e";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/lt/thunderbird-52.1.1.tar.bz2";
-      locale = "lt";
-      arch = "linux-x86_64";
-      sha512 = "9c4c9969a851509dbddf3fbf0118067b29f679b2e13c15f507579f232a311941c1345636714c94151323bfe726f760ab507def1dfd3a4a4053c60d533a3a2abe";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/nb-NO/thunderbird-52.1.1.tar.bz2";
-      locale = "nb-NO";
-      arch = "linux-x86_64";
-      sha512 = "61f6e4a840b8cbcb9b0706f121c93798924302184ecc92e4f6b4489178ae3d6962d6ecee52feee21fd4d89c5da7f349b383b5bef6f0b961e6e15a10f6dd5f2e8";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/nl/thunderbird-52.1.1.tar.bz2";
-      locale = "nl";
-      arch = "linux-x86_64";
-      sha512 = "4de0257fa93e7450442cafcb3cb328928687b974303d3df9c4c37db843bc3379716a7c7058400dc11f25b632266f1f4f740de4c4ae099d6f88d810673856d562";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/nn-NO/thunderbird-52.1.1.tar.bz2";
-      locale = "nn-NO";
-      arch = "linux-x86_64";
-      sha512 = "ff6152e088e8f94f60c31b172502207609a9b0908057f8343177e9b7c6a079dd2c503928debeb2c133a77edd6ebac5f691a2078f54d572c2479f60327ba580d0";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/pa-IN/thunderbird-52.1.1.tar.bz2";
-      locale = "pa-IN";
-      arch = "linux-x86_64";
-      sha512 = "9a7876869b412efc3463eb2d161f4655804f740bbae0aee075d0f7e1466de6fbed21545bcfb93c5f03fcb837d3459a40882f4fceafae137f8aa4d3841010feeb";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/pl/thunderbird-52.1.1.tar.bz2";
-      locale = "pl";
-      arch = "linux-x86_64";
-      sha512 = "9f897729f752126cf676a05672aaa35c620d025ca74ef8c611948b2b19e9239d39090a2983bf9568f796d0a20acba4fccd262ed04433c564791c5ef837955425";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/pt-BR/thunderbird-52.1.1.tar.bz2";
-      locale = "pt-BR";
-      arch = "linux-x86_64";
-      sha512 = "fba636db2837ee9835a35bc36af874e50b113be1edd123a74c9d71080b25be761500b8aeed7605f589cd06328d67659cb25fa25959e49c017a4c63a27be3df6f";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/pt-PT/thunderbird-52.1.1.tar.bz2";
-      locale = "pt-PT";
-      arch = "linux-x86_64";
-      sha512 = "0ec0668509a19f52432c0de6450d14b20be01e0a26eedb316e63b33f44a001c3ff82c3b553ef51c9de740a164ad33ca25f9b4b2d64b792e89ed803b9d68d11fa";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/rm/thunderbird-52.1.1.tar.bz2";
-      locale = "rm";
-      arch = "linux-x86_64";
-      sha512 = "fc75870ecccb5cac6533887e96a3be0b44a07b638b96c5993c7d6ede1cf0e501172ab83c85b2e5978d6818086c4e7802ae133da96a8331846456c184f3dfa34a";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/ro/thunderbird-52.1.1.tar.bz2";
-      locale = "ro";
-      arch = "linux-x86_64";
-      sha512 = "bbb3f37e6559599022f3ac5aafb62ba9e62b67ee5165eb4aad2fb29e722206b7ddd0e4bfa1e5cf57453e0fb572b3829bba3c80e4ab0b3b14c91ce4f824f5150f";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/ru/thunderbird-52.1.1.tar.bz2";
-      locale = "ru";
-      arch = "linux-x86_64";
-      sha512 = "f93506805c0d45f19a7b17f3eb82a6f8ce6beec11e4fd6ea09888bacbb90f258cfa15bf35a6b5868ce496491b1dd62cf12ad4877576f4b00117f169065061555";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/si/thunderbird-52.1.1.tar.bz2";
-      locale = "si";
-      arch = "linux-x86_64";
-      sha512 = "09a1aa2393d95815cea16ecdc4a2abf7cc7782744e8ab39a447ee195feabf35102a7cbcc57761c1a8bab085036dea949a3ab2fc5cb3cd00cdd01047e1de0faee";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/sk/thunderbird-52.1.1.tar.bz2";
-      locale = "sk";
-      arch = "linux-x86_64";
-      sha512 = "d37c2fbc9c72b627278e8bc8073544f0a35bd175e7015f88bc037861a5513286627ca016ed643db490759d7a9b57feaa7d0bb8948545da67ac6fdb2580549e93";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/sl/thunderbird-52.1.1.tar.bz2";
-      locale = "sl";
-      arch = "linux-x86_64";
-      sha512 = "0134f110196af343e0fb3f24970caa74fa0a9f48c4c652e484bd79c2fd76f97eea86776c5b528c432ed98d24b2ce83529e7e68c3e4ff2533dd554465f24f701d";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/sq/thunderbird-52.1.1.tar.bz2";
-      locale = "sq";
-      arch = "linux-x86_64";
-      sha512 = "9a85f94121e1af70e8eee2f0e56693807f881c288efbc9d4f4affe9353f0018145d2df03be74b76026dc0f51b28969cff69e19b639271df7bb34bbaeef21ffbe";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/sr/thunderbird-52.1.1.tar.bz2";
-      locale = "sr";
-      arch = "linux-x86_64";
-      sha512 = "a11ec69a7fa8f49c9fe98a53280f6e71cb4dddea4f8a5a4adcb7a95cfcaa548575b334a15ce7c06dcb6053d633a1f2bb09b77ab022a09c3987228fd5a9fce339";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/sv-SE/thunderbird-52.1.1.tar.bz2";
-      locale = "sv-SE";
-      arch = "linux-x86_64";
-      sha512 = "04215a4507f057151a9d3bbbc092e7c54a02bdf19af3e18c8042c0fdc477cf5739d3007beb4e28dd3354dae7ffc628fb601c18ad06e8898e5445c35855cdcf5f";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/ta-LK/thunderbird-52.1.1.tar.bz2";
-      locale = "ta-LK";
-      arch = "linux-x86_64";
-      sha512 = "f04af1419a7175a2c15f65bcca7def7e1ef0a82d4e1f706599a8a2a731b07d7d554dfd859911836f586cb0da09c8c67452110eb8caa181e4cf1d39af39406f55";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/tr/thunderbird-52.1.1.tar.bz2";
-      locale = "tr";
-      arch = "linux-x86_64";
-      sha512 = "44b3a06fded09732b1914ad6a373411eacd77defa23c29b1ac2d422f9f38eb3aaf5838915d96ae2400b35b6e751208f21b3f213fa92968887504187548f70431";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/uk/thunderbird-52.1.1.tar.bz2";
-      locale = "uk";
-      arch = "linux-x86_64";
-      sha512 = "c7024c0394da23e067327f9db5cacb263ed02e5e23dfec0059a64383a331b8c9695d30f0e25b2892516e189e2a7e4796d91041e684f44a66d0d6bfd287499203";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/vi/thunderbird-52.1.1.tar.bz2";
-      locale = "vi";
-      arch = "linux-x86_64";
-      sha512 = "d7718cbb734a11c82b4ec88e73174f34fc34819c0c398855897b7b11d811ef27c785d9588764dfd8c149adf61227ac416b8e64dac7d0a2bdfc1fefa5b980a4d2";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/zh-CN/thunderbird-52.1.1.tar.bz2";
-      locale = "zh-CN";
-      arch = "linux-x86_64";
-      sha512 = "29b5183a5d824e6e5d4045b9e41403fb5b321ff7c05c73dd43357fe67c87fe05be26988f408788a7e0e1655f0068cbdb80311f396ba991801d0af462dade3432";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-x86_64/zh-TW/thunderbird-52.1.1.tar.bz2";
-      locale = "zh-TW";
-      arch = "linux-x86_64";
-      sha512 = "0fa4d43ff9a1f32fdc9695075205bdd32932ef790f53e04da778309bd35f5dde56f2d51d972d8c998eee3117a287d16fe79a49435b5cdf6631fe65395bd184c7";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/ar/thunderbird-52.1.1.tar.bz2";
-      locale = "ar";
-      arch = "linux-i686";
-      sha512 = "0234f231e1dbbe5776d9ea37a18e546d049470efe29eac34c2c4d05c59aaa81f509bf778b37d3865d117fbb43db17e33464090830b531ee434d7775b4020ab44";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/ast/thunderbird-52.1.1.tar.bz2";
-      locale = "ast";
-      arch = "linux-i686";
-      sha512 = "5ab2c379709ef07d82870da6259fb9354005235d485d6eed4d5a0b1d23c83903e7e6092cd49ac2439b01c5d4f1e663f121bff7a45ade72eb18d166787c4f62f5";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/be/thunderbird-52.1.1.tar.bz2";
-      locale = "be";
-      arch = "linux-i686";
-      sha512 = "69c596d711b91664031e52605c1510532f2600b3927afc4ea12a1c9332baf5b05982a09648be6b30ea42b763a18f495d8fa2274515f8088c0b2e07be60e0510e";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/bg/thunderbird-52.1.1.tar.bz2";
-      locale = "bg";
-      arch = "linux-i686";
-      sha512 = "0de0dcdd70902f0f1eb8d8d361ce20383c8bec9ce9ea6ddd664876e6386075a424045478bbe6c88076085c97dc42bcf2205f6870e6b03f46dfa3872275ac195b";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/bn-BD/thunderbird-52.1.1.tar.bz2";
-      locale = "bn-BD";
-      arch = "linux-i686";
-      sha512 = "73e82f771d90a4861b9b34adfe94714cab47dd2cc86b9dbad23390a2cef8c0150a654a26a05a6a0effd0efe79a3caf419fce748e35ab3c94610d42e2cb06686e";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/br/thunderbird-52.1.1.tar.bz2";
-      locale = "br";
-      arch = "linux-i686";
-      sha512 = "1abfcb8f361ccf5526f947ad8b7c497233d646913abb6fd345814355c548b4c93069a9710d27d2141c5e0045323522a6e76f9f3f53d7dff2c131ac94778545fb";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/ca/thunderbird-52.1.1.tar.bz2";
-      locale = "ca";
-      arch = "linux-i686";
-      sha512 = "07a3436b009ba87180659345261de142d94500b8fb00fe21d9c48cffa43fc42f644c28bab739d420908342e28747f4f564eb46ae4e24222dea45f369a5caf3a5";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/cs/thunderbird-52.1.1.tar.bz2";
-      locale = "cs";
-      arch = "linux-i686";
-      sha512 = "58b90bdba30ad6626f285c73601faf30f45fefc1e670e013e7f9e6b92540647cb402ec69eb88ca00dc450801fe07589792bae6eb602ccc60479f3ee6e5104ee7";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/cy/thunderbird-52.1.1.tar.bz2";
-      locale = "cy";
-      arch = "linux-i686";
-      sha512 = "d880dcce1b4dd47bb738d990886b71a858022b8ca76c67d33d8d97257e28cd4489d058526fce6b677cd6e925acdc2d04870e5ff6d84a89d82e2bc9f91469536a";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/da/thunderbird-52.1.1.tar.bz2";
-      locale = "da";
-      arch = "linux-i686";
-      sha512 = "31e26b2333544c950b69a631a4f889052c79f3411b3f55b8c02d7fa248d50409a363ab9935d57946b704b5b85819b3e30bbb8230871a582bb27b8f2c062ef1b7";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/de/thunderbird-52.1.1.tar.bz2";
-      locale = "de";
-      arch = "linux-i686";
-      sha512 = "c86681f6616d5f234f0878aa9370cca4c0fc5f38c131f2a3908d8529ab2e86e340558988c3ac5067a82edb99a3cacf316727652d181fcc0bc15ad7ecd713d11b";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/dsb/thunderbird-52.1.1.tar.bz2";
-      locale = "dsb";
-      arch = "linux-i686";
-      sha512 = "4f3b39c1023235579079a46a7d557d177c3f2e398a6e311c728ec1083952b2c67db0cdf539d8ae3abc54061d22e607c6849699008b76e9b01569d12d6600feee";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/el/thunderbird-52.1.1.tar.bz2";
-      locale = "el";
-      arch = "linux-i686";
-      sha512 = "623205d1e326a0310c54a9c14e469fdbe156e538c2a09a770c872be8214611743b6d354b5a7b106db5105b8b278540d7f623c6fc56bc1fd450333ec774ded706";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/en-GB/thunderbird-52.1.1.tar.bz2";
-      locale = "en-GB";
-      arch = "linux-i686";
-      sha512 = "b38b9e6350edd11e58c644ebe4c11aa6bfeba7e7aa6fdf40f9b9a4cb5845f5a2895b82ebf717ca78138a0f11cdc2f6f5aefe5636acbcff857ba99d27e258b824";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/en-US/thunderbird-52.1.1.tar.bz2";
-      locale = "en-US";
-      arch = "linux-i686";
-      sha512 = "192f42fe4c7b9689743ec16191ef8576a19699812cfc4984e4b559fd847ab92c1dc002cbbdbb2212fb547fc9bfd77b4f58639d219ccc1ed86290b61f9effebf0";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/es-AR/thunderbird-52.1.1.tar.bz2";
-      locale = "es-AR";
-      arch = "linux-i686";
-      sha512 = "2022d12dd755e6583b3ccb068ffc53b91308702cff57f57ed455aee7299f8a7d4e614e600acc80be9da0e9df8e86c273b6cc7e99b94c5194420be367d5f12497";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/es-ES/thunderbird-52.1.1.tar.bz2";
-      locale = "es-ES";
-      arch = "linux-i686";
-      sha512 = "058004f7a94b55a393d626869d7b7690d17fa5b51b0466d83c029c65ef3a49d9efdfc0df2c2110865282972b23fbd22a68f81785d098cbe3ba6c39c81f5e903f";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/et/thunderbird-52.1.1.tar.bz2";
-      locale = "et";
-      arch = "linux-i686";
-      sha512 = "95247bec1a365afcc5f6985ac635b0ebc02b2c345704749856ff5d9aa3d23e22fb274812617f3cd1648f80b9e47c95100fc10d41d5cbf0f8b7322e57adf48165";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/eu/thunderbird-52.1.1.tar.bz2";
-      locale = "eu";
-      arch = "linux-i686";
-      sha512 = "e561dc2fd2f32dcdaba034f7486a55da8e332c7a67fa4948ccb073fea5a49910c02bac3b4f988366d0e4cf7da00efa52020eb1fd837119e95360e7418b65e37b";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/fi/thunderbird-52.1.1.tar.bz2";
-      locale = "fi";
-      arch = "linux-i686";
-      sha512 = "d014aec796d7c4823748eb2d4a76df85a10fb6bba58d26fc9e46f72bbdc1457acbe473a563a1ebebed152c11242bd64b8c306c2fb43959ad2b649830bf50e95d";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/fr/thunderbird-52.1.1.tar.bz2";
-      locale = "fr";
-      arch = "linux-i686";
-      sha512 = "e7bfe888ce1bffcb302c96bdb685bdbb7588521e9dec863175015622ebe13d0aa2b8a75c8fbe9ad6030be8303728a6a6718a837fc8fef8d0009fedad6ecd1b36";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/fy-NL/thunderbird-52.1.1.tar.bz2";
-      locale = "fy-NL";
-      arch = "linux-i686";
-      sha512 = "08bb1c4e4187e6a4f61f9ad88daa605186b341033c256506f9dc2c7626af842a628dfd59732084cf1b6bf94eb52e78af9942fcbbfb3c0a0c42568c94d3a874d7";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/ga-IE/thunderbird-52.1.1.tar.bz2";
-      locale = "ga-IE";
-      arch = "linux-i686";
-      sha512 = "737af536b710b633b849ae0f7017bf9387daa6a3145409ed8cb315a0738083195992bac1fb4215b590784b7b2389f0611d89b55e17b5b02bedb79869e7caace9";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/gd/thunderbird-52.1.1.tar.bz2";
-      locale = "gd";
-      arch = "linux-i686";
-      sha512 = "2ede5eebf73d7fa2f9ddf5a10b26649d43bc24512512b8f31b2998786c80de1c75890d3c825829ce1ee030ebb90e6bde1264cebc45d17475bfa5a343a5520491";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/gl/thunderbird-52.1.1.tar.bz2";
-      locale = "gl";
-      arch = "linux-i686";
-      sha512 = "b0ae9a3d08160024203b6bddfa6fb4a9a15c552cce91701d644636cc9f9c6add879a1b78138a0bdf3946c9f356dfb50d97293cbd070bbc2a9764b30a7a29263a";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/he/thunderbird-52.1.1.tar.bz2";
-      locale = "he";
-      arch = "linux-i686";
-      sha512 = "b1f5d4e299cc2d40397fb96b076625ea7e86faecc0ba6503276d675125373fe7eecfd531caf24241cb446bf47ba986c4ee497fbd115cf67160ef24b87f6ef19f";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/hr/thunderbird-52.1.1.tar.bz2";
-      locale = "hr";
-      arch = "linux-i686";
-      sha512 = "7e52b5aeeaf9cd3c205555b1cf69c7a184b3a30605611a0cbc66a7591beb9d11a18b5e084adc9f88a7b74b24b06dd9b470bb966c6dc4fd946ab23b6565608ff4";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/hsb/thunderbird-52.1.1.tar.bz2";
-      locale = "hsb";
-      arch = "linux-i686";
-      sha512 = "49c718f7424337a6477b175446f3b532d0603ed8dd2bf789497706dd6c25f1d4968058facb61b2ea858e908911d0c04e87493a0956c33ad33df11d9990aaabb7";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/hu/thunderbird-52.1.1.tar.bz2";
-      locale = "hu";
-      arch = "linux-i686";
-      sha512 = "e6ca202e31f41b7e57235172fb107ddc0707633ba5762651da62e9e55f433fe21de642f20bc3cbddf99ee8a9881dd646add04bb180e630364e45384a13e75ef0";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/hy-AM/thunderbird-52.1.1.tar.bz2";
-      locale = "hy-AM";
-      arch = "linux-i686";
-      sha512 = "43aed794a82dc7e74f086bdc9e401ecfd59329098c8a9a650c485348977815f7419cd1cf913bc3fba025fbfcf1a15db6b883ef6bf483e16187a85dfdad9cb299";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/id/thunderbird-52.1.1.tar.bz2";
-      locale = "id";
-      arch = "linux-i686";
-      sha512 = "3ce1c383d7640b9af2b7eae5e7689a200d27bc0a5527b3f3be1b1443ef3278cc58c0f2c0e3a9f94cb419fdc3b5797612fa96d78aa9a418b59fb066977955096a";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/is/thunderbird-52.1.1.tar.bz2";
-      locale = "is";
-      arch = "linux-i686";
-      sha512 = "365d5b4c78605df8869438eca9ad700ff2353bc18d64cfedf8905bc7307646b45c365813b537eb813806a25b8d1f121595df744ac60b1cb48cfcbe4395affc7f";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/it/thunderbird-52.1.1.tar.bz2";
-      locale = "it";
-      arch = "linux-i686";
-      sha512 = "ad0946bf1282f3ded23847b6fbbce55e620ca34b71bb3c7a12a6bb24e6e09a4d737503c39f5d634bdcd4c3a54418ef6b96a83fa997d911b85d8d05632d921711";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/ja/thunderbird-52.1.1.tar.bz2";
-      locale = "ja";
-      arch = "linux-i686";
-      sha512 = "34841d9c22e9b4d737bc56e23935f12a5a0bedcdbb127447a21ae9a837c9f61ef93b9613fa2123dafc39cbe7f9ec3cc0b92c7dc27f96ca3175ae359be3cfa1db";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/kab/thunderbird-52.1.1.tar.bz2";
-      locale = "kab";
-      arch = "linux-i686";
-      sha512 = "19a40cf4ff9c0e34b4ae46a54364ca9b152aee18f2d4a438fe947cb225d9214f8316bd9aacfbec803076716668f100b0a02dd18b1f307498d086cfd6466f6433";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/ko/thunderbird-52.1.1.tar.bz2";
-      locale = "ko";
-      arch = "linux-i686";
-      sha512 = "1497535d1de169c0498837ef164434700a99d5dfe5032cfbef62de4535f47c2473ef335f9796c0d7adf5c7f2cde7c3a655aaa92d65651667afd7f3cdf7cde574";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/lt/thunderbird-52.1.1.tar.bz2";
-      locale = "lt";
-      arch = "linux-i686";
-      sha512 = "54bdb2bfa2cf97e03c389a390ad018f485b5452c6c4e8acab9cc71c0076b830cfc7267a1e755f98ac54c87231511827ba7c64aa2502c502ab47d554fc5044856";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/nb-NO/thunderbird-52.1.1.tar.bz2";
-      locale = "nb-NO";
-      arch = "linux-i686";
-      sha512 = "20f5d2e7bbc083a990d9e9d8373d1485d58d62837c4d0d0d9d0955d3a9355c326d8eebbbfe0c61090c598fca11dad85d101ffb96b12f72b76da55fe72773ad03";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/nl/thunderbird-52.1.1.tar.bz2";
-      locale = "nl";
-      arch = "linux-i686";
-      sha512 = "c25e14b9d28f4985ffbb125b984168b4f073773c03bfc2af2bb845db19659b25d69e634896d9b0d92ad7f08ccd4523a5d58ee42fbf23ac25499f64e7da7463cd";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/nn-NO/thunderbird-52.1.1.tar.bz2";
-      locale = "nn-NO";
-      arch = "linux-i686";
-      sha512 = "9fe667f785abbdcf57890c3c19def43165a5574409342eae335ba32c2f9fa089eb4c2d443fc6254fe5d21ead0f0d04fa1e2250f54ef805c2668aae37b15a3f84";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/pa-IN/thunderbird-52.1.1.tar.bz2";
-      locale = "pa-IN";
-      arch = "linux-i686";
-      sha512 = "cfd6c5d43ad9c78663f217b4ebc40b34d80cceed7e266f95dff1d70665b4e7187742621367085ae38718ba15e14bebaf8a32bc8e696fad0febbbbbf360abfd69";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/pl/thunderbird-52.1.1.tar.bz2";
-      locale = "pl";
-      arch = "linux-i686";
-      sha512 = "01dec9139816be174f14aa3f6e2165bcc52e53b8f681d8fbedb4db4f428a36128b832aa36fba7af096d15e83ecedb6b3570a447cde6bf10a722c2a452520852a";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/pt-BR/thunderbird-52.1.1.tar.bz2";
-      locale = "pt-BR";
-      arch = "linux-i686";
-      sha512 = "2f616760f069944f43cc8517981a7fb793564cf30214ca62b42161aa3fcd332bf3f25761deae00697c8f544c84c3a500e9fac6b4424ef5481250fe2b8b6075a1";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/pt-PT/thunderbird-52.1.1.tar.bz2";
-      locale = "pt-PT";
-      arch = "linux-i686";
-      sha512 = "0e27a359621fc08e1162f413aabaf406af4754e0e6947764d2b86c0c20b4d88c7eea336863ad9a9c670a6b05d84bda3678b9665f3c6c2d6b8ec71f2278f8a494";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/rm/thunderbird-52.1.1.tar.bz2";
-      locale = "rm";
-      arch = "linux-i686";
-      sha512 = "84e58d1a7ce7e4d09ed30e83c6e46b88aac1419e719e1c55aa4cb5e1521ea3dd679e0bd41663de2a12d77c489d69f5ac0d5f5f0845fb2f9cc34d8f55ca278026";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/ro/thunderbird-52.1.1.tar.bz2";
-      locale = "ro";
-      arch = "linux-i686";
-      sha512 = "9272c9fba59beab72fb6f59c81180514ddfa6b6dbd050f6b789e5072beb34a0cc6c70ecc26e11bbc082e9368df98cc13923eea643daaf24051371755b0bb26ac";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/ru/thunderbird-52.1.1.tar.bz2";
-      locale = "ru";
-      arch = "linux-i686";
-      sha512 = "734b738d9712dc089db8460b72404be9bb6a97944ec9dc5a286a401531ef2a30f8b7c5fc22e689b98d1f80551515996c6d7ba1a7b72290e4071a95a4519c45b0";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/si/thunderbird-52.1.1.tar.bz2";
-      locale = "si";
-      arch = "linux-i686";
-      sha512 = "3868793813b2b09177ff7c5b36e44a289f7d7ae84f65c3194703f77e0067fd975a1397a289d3921b5ba7dcfe56c81280abec81c731b369692f2135f572dcdce6";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/sk/thunderbird-52.1.1.tar.bz2";
-      locale = "sk";
-      arch = "linux-i686";
-      sha512 = "101f95b2bb118bb730117920099d1f5cc5f7744960a0148a1324043c17468d5b43c5d31fc5c45111fd3fc16a6e4d207548161fb600dbc4c4b92b015e342586fa";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/sl/thunderbird-52.1.1.tar.bz2";
-      locale = "sl";
-      arch = "linux-i686";
-      sha512 = "a019e01de194d51acc6695447c30fd5d9e179d91035f942b2f42a536b29d03244a7fffe2821c19e51133d39773e70b18fda79b6b19c2a33fba3d9917669b0748";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/sq/thunderbird-52.1.1.tar.bz2";
-      locale = "sq";
-      arch = "linux-i686";
-      sha512 = "64bdc99eb9bb3ece6fb5de9380fdc3d0a7e2598d36a66e7542c500a63c49f0d307ebdb99599b3bc72677a1053dd5d2aaf52088605236baa7d8d29dc2b377771d";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/sr/thunderbird-52.1.1.tar.bz2";
-      locale = "sr";
-      arch = "linux-i686";
-      sha512 = "8d5d2ee0f5326b9cf76dcb1cfd2401350ca5aa39efbc2afcd822eb3c9a40e477d25e0d82d8f50e569b2fed487463c6a978d12284f63764b7259bd3f479b2461b";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/sv-SE/thunderbird-52.1.1.tar.bz2";
-      locale = "sv-SE";
-      arch = "linux-i686";
-      sha512 = "0efd878da02ec1e81f373f7e8090445f45c11f2c9a1931ed29a52c3d8642a277be07a2d194d873f1a11dc8cdb79ed4100fd87b8f262f8fa2ea034d4c20e96e6e";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/ta-LK/thunderbird-52.1.1.tar.bz2";
-      locale = "ta-LK";
-      arch = "linux-i686";
-      sha512 = "555c1b5862e71e7b9112b97b137375e0a38549ea91398b1631cb6000f5881f0adbbfe230612c2bd8765a20b1d14cf538e1b5c0e9ccfeb9fc7c1258afae54503b";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/tr/thunderbird-52.1.1.tar.bz2";
-      locale = "tr";
-      arch = "linux-i686";
-      sha512 = "e9c5333cd807f44d98c83514caa5fa81ef54a11362b7aee05c2496d8c79288c6707ff154229cc77d9a4e8097b13c53845a7516d04ff4c3336513183a8218ac3b";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/uk/thunderbird-52.1.1.tar.bz2";
-      locale = "uk";
-      arch = "linux-i686";
-      sha512 = "a7486ab5f63cece470b2850452cac236e153c3c797622cd2d87f6c4b276cea1c43d3770e7726c459334c5ca51034a8013d78176026375ac3d760c05e1cd9cd84";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/vi/thunderbird-52.1.1.tar.bz2";
-      locale = "vi";
-      arch = "linux-i686";
-      sha512 = "6b815b2dc07fc6cb799bdf2266d6bfbef4f2623790814cae80ba1853075f7c561270e2463b1be571cc4495de5f2c36df4d716cf5754470198b97602ef3fe3979";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/zh-CN/thunderbird-52.1.1.tar.bz2";
-      locale = "zh-CN";
-      arch = "linux-i686";
-      sha512 = "7269d75bbec19be4045a6080c4e64679b5873a89039ffa9b633f40f41ca8d98a5f5f8a1b76233102b41a38ee307a49fe0c45206df1128b1526f490a417fb60c6";
-    }
-    { url = "http://archive.mozilla.org/pub/thunderbird/releases/52.1.1/linux-i686/zh-TW/thunderbird-52.1.1.tar.bz2";
-      locale = "zh-TW";
-      arch = "linux-i686";
-      sha512 = "3741d5ebd862706b212f90a9f81ea8f0c9f7b1a4eeb74acab420e287afb930cc74748db958debb698a49fbd9d8011107ea6a1bc917606700a80eea640b40ab1a";
-    }
-    ];
-}
diff --git a/pkgs/applications/networking/mailreaders/thunderbird/default.nix b/pkgs/applications/networking/mailreaders/thunderbird/default.nix
index 0f6be0281f35..ccced87a5506 100644
--- a/pkgs/applications/networking/mailreaders/thunderbird/default.nix
+++ b/pkgs/applications/networking/mailreaders/thunderbird/default.nix
@@ -22,11 +22,11 @@ let
   wrapperTool = if enableGTK3 then wrapGAppsHook else makeWrapper;
 in stdenv.mkDerivation rec {
   name = "thunderbird-${version}";
-  version = "52.1.1";
+  version = "52.2.0";
 
   src = fetchurl {
     url = "mirror://mozilla/thunderbird/releases/${version}/source/thunderbird-${version}.source.tar.xz";
-    sha512 = "84b54ae4401c9728c38f32f58e0df24e049471b3613f9973981b305e0ed09b2e8c2c1b5a35d4fee85ce2cf1d6fa99e80418bc216ae0d35d40e9fdeef61a6c06e";
+    sha512 = "e5c2ad5f7bbea4fb9abca94db6c149ee459c1c35b756b7840ee87b5fb631ccbcd323c743a12cddf8d504e0175bb93378beb7fe100b185ea6ab03a4968859ea89";
   };
 
   # New sed no longer tolerates this mistake.
diff --git a/pkgs/applications/networking/mailreaders/trojita/default.nix b/pkgs/applications/networking/mailreaders/trojita/default.nix
index fa6e4db0a0d2..26cb9e40a263 100644
--- a/pkgs/applications/networking/mailreaders/trojita/default.nix
+++ b/pkgs/applications/networking/mailreaders/trojita/default.nix
@@ -1,13 +1,12 @@
-{ stdenv
+{ mkDerivation
 , lib
 , fetchgit
 , cmake
 , qtbase
 , qtwebkit
-, makeQtWrapper
 }:
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   name = "trojita-${version}";
   version = "0.7";
 
@@ -18,25 +17,20 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [
-    cmake
     qtbase
     qtwebkit
   ];
 
   nativeBuildInputs = [
-    makeQtWrapper
+    cmake
   ];
 
-  postInstall = ''
-    wrapQtProgram "$out/bin/trojita"
-  '';
-
 
-  meta = {
+  meta = with lib; {
     description = "A Qt IMAP e-mail client";
     homepage = http://trojita.flaska.net/;
-    license = with lib.licenses; [ gpl2 gpl3 ];
-    platforms = stdenv.lib.platforms.linux;
+    license = with licenses; [ gpl2 gpl3 ];
+    platforms = platforms.linux;
   };
 
 }
diff --git a/pkgs/applications/networking/mumble/default.nix b/pkgs/applications/networking/mumble/default.nix
index fa8ccf60a2a0..696681dce277 100644
--- a/pkgs/applications/networking/mumble/default.nix
+++ b/pkgs/applications/networking/mumble/default.nix
@@ -20,7 +20,7 @@ let
     patches = optional jackSupport ./mumble-jack-support.patch;
 
     nativeBuildInputs = [ pkgconfig python ]
-      ++ { qt4 = [ qmake4Hook ]; qt5 = [ qt5.qmakeHook ]; }."qt${toString source.qtVersion}"
+      ++ { qt4 = [ qmake4Hook ]; qt5 = [ qt5.qmake ]; }."qt${toString source.qtVersion}"
       ++ (overrides.nativeBuildInputs or [ ]);
     buildInputs = [ boost protobuf avahi ]
       ++ { qt4 = [ qt4 ]; qt5 = [ qt5.qtbase ]; }."qt${toString source.qtVersion}"
@@ -70,7 +70,7 @@ let
   client = source: generic {
     type = "mumble";
 
-    nativeBuildInputs = optionals (source.qtVersion == 5) [ qt5.qttools qt5.makeQtWrapper ];
+    nativeBuildInputs = optionals (source.qtVersion == 5) [ qt5.qttools ];
     buildInputs = [ libopus libsndfile speex ]
       ++ optional (source.qtVersion == 5) qt5.qtsvg
       ++ optional stdenv.isLinux alsaLib
@@ -91,10 +91,6 @@ let
       mkdir -p $out/share/icons{,/hicolor/scalable/apps}
       cp icons/mumble.svg $out/share/icons
       ln -s $out/share/icon/mumble.svg $out/share/icons/hicolor/scalable/apps
-
-      ${optionalString (source.qtVersion == 5) ''
-        wrapQtProgram $out/bin/mumble
-      ''}
     '';
   } source;
 
diff --git a/pkgs/applications/networking/newsreaders/quiterss/default.nix b/pkgs/applications/networking/newsreaders/quiterss/default.nix
index 53520909b09c..4bf571a93d83 100644
--- a/pkgs/applications/networking/newsreaders/quiterss/default.nix
+++ b/pkgs/applications/networking/newsreaders/quiterss/default.nix
@@ -1,21 +1,18 @@
-{ stdenv, fetchFromGitHub, qt5, qmakeHook, makeQtWrapper, pkgconfig, sqlite }:
+{ stdenv, fetchFromGitHub, qtbase, qmake, qttools, qtwebkit, pkgconfig, sqlite }:
 
 stdenv.mkDerivation rec {
   name = "quiterss-${version}";
-  version = "0.18.4";
+  version = "0.18.5";
 
   src = fetchFromGitHub {
     owner = "QuiteRSS";
     repo = "quiterss";
     rev = "${version}";
-    sha256 = "0gk4s41npg8is0jf4yyqpn8ksqrhwxq97z40iqcbd7dzsiv7bkvj";
+    sha256 = "1y0n5ps1z4wgf9hkfjrw7dfyncrw22bf9mi3052vmf3s7xzz6vbb";
   };
 
-  buildInputs = [ qt5.qtbase qt5.qttools qt5.qtwebkit qmakeHook makeQtWrapper pkgconfig sqlite.dev ];
-
-  postInstall = ''
-    wrapQtProgram "$out/bin/quiterss"
-  '';
+  nativeBuildInputs = [ pkgconfig qmake ];
+  buildInputs = [ qtbase qttools qtwebkit sqlite.dev ];
 
   meta = with stdenv.lib; {
     description = "A Qt-based RSS/Atom news feed reader";
diff --git a/pkgs/applications/networking/p2p/eiskaltdcpp/default.nix b/pkgs/applications/networking/p2p/eiskaltdcpp/default.nix
index 8d46cf621044..6b6f66e24d09 100644
--- a/pkgs/applications/networking/p2p/eiskaltdcpp/default.nix
+++ b/pkgs/applications/networking/p2p/eiskaltdcpp/default.nix
@@ -15,6 +15,7 @@ stdenv.mkDerivation rec {
     -DUSE_QT_QML=ON
     -DFREE_SPACE_BAR_C=ON
     -DUSE_MINIUPNP=ON
+    -DLOCAL_MINIUPNP=ON
     -DDBUS_NOTIFY=ON
     -DUSE_JS=ON
     -DPERL_REGEX=ON
diff --git a/pkgs/applications/networking/p2p/qbittorrent/default.nix b/pkgs/applications/networking/p2p/qbittorrent/default.nix
index de05555633eb..4db6c9dc16bb 100644
--- a/pkgs/applications/networking/p2p/qbittorrent/default.nix
+++ b/pkgs/applications/networking/p2p/qbittorrent/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, pkgconfig, which
-, boost, libtorrentRasterbar, qmakeHook, qt5
+, boost, libtorrentRasterbar, qmake, qtbase, qttools
 , debugSupport ? false # Debugging
 , guiSupport ? true, dbus_libs ? null # GUI (disable to run headless)
 , webuiSupport ? true # WebUI
@@ -17,9 +17,9 @@ stdenv.mkDerivation rec {
     sha256 = "0vs626khavhqqnq2hrwrxyc8ihbngharcf1fd37nwccvy13qqljn";
   };
 
-  nativeBuildInputs = [ pkgconfig which ];
+  nativeBuildInputs = [ pkgconfig which qmake ];
 
-  buildInputs = [ boost libtorrentRasterbar qt5.qtbase qt5.qttools ]
+  buildInputs = [ boost libtorrentRasterbar qtbase qttools ]
     ++ optional guiSupport dbus_libs;
 
   preConfigure = ''
diff --git a/pkgs/applications/networking/syncthing/inotify-deps.nix b/pkgs/applications/networking/syncthing/inotify-deps.nix
index d8b087dcb80a..e5e554db67b8 100644
--- a/pkgs/applications/networking/syncthing/inotify-deps.nix
+++ b/pkgs/applications/networking/syncthing/inotify-deps.nix
@@ -1,30 +1,21 @@
-# This file was generated by go2nix.
+# This file was generated by https://github.com/kamilchm/go2nix v1.2.0
 [
   {
-    goPackagePath = "github.com/cenkalti/backoff";
-    fetch = {
-      type = "git";
-      url = "https://github.com/cenkalti/backoff";
-      rev = "b02f2bbce11d7ea6b97f282ef1771b0fe2f65ef3";
-      sha256 = "0lhcll9pzcxbbm9sdsijvcvdqc4lrsgbyw0q1xly0pnz556v6pyc";
-    };
-  }
-  {
     goPackagePath = "github.com/syncthing/syncthing";
     fetch = {
       type = "git";
       url = "https://github.com/syncthing/syncthing";
-      rev = "fb6d453c74d8420af847460e42e05779e90311b6";
-      sha256 = "18fya44i80ij5wqpwg0bff2hp058rh87b9zld2rpw0z8r04bnsv0";
+      rev = "d0061c172caecd3baf61f3ff720f56fdb805186e";
+      sha256 = "08cn0ym4arjppbnfn2b37crarwmiqbj4yjr7kinhdxx9gqm5wkj1";
     };
   }
   {
-    goPackagePath = "github.com/zillode/notify";
+    goPackagePath = "golang.org/x/sys";
     fetch = {
       type = "git";
-      url = "https://github.com/zillode/notify";
-      rev = "df33c1a773b462f936a149c36696c018c047eaa9";
-      sha256 = "0ncfqnj5kvbyw630xsxqkxy3y6jv5hp89fqi9mzra3lr4zckiv3s";
+      url = "https://go.googlesource.com/sys";
+      rev = "fb4cac33e3196ff7f507ab9b2d2a44b0142f5b5a";
+      sha256 = "1y5lx3f7rawfxrqg0s2ndgbjjjaml3rn3f27h9w9c5mw3xk7lrgj";
     };
   }
 ]
diff --git a/pkgs/applications/networking/syncthing/inotify.nix b/pkgs/applications/networking/syncthing/inotify.nix
index 6e9c1ba10280..c83d9a2fcd00 100644
--- a/pkgs/applications/networking/syncthing/inotify.nix
+++ b/pkgs/applications/networking/syncthing/inotify.nix
@@ -2,7 +2,7 @@
 
 buildGoPackage rec {
   name = "syncthing-inotify-${version}";
-  version = "0.8.5";
+  version = "0.8.6";
 
   goPackagePath = "github.com/syncthing/syncthing-inotify";
 
@@ -10,7 +10,7 @@ buildGoPackage rec {
     owner  = "syncthing";
     repo   = "syncthing-inotify";
     rev    = "v${version}";
-    sha256 = "13qfppwlqrx3fs44ghnffdp9x0hs7mn1gal2316p7jb0klkcpfzh";
+    sha256 = "0z1zpb7av4q5nj2d4yda9jcbjdz4yj3823c29y73yf0gfp26lppl";
   };
 
   goDeps = ./inotify-deps.nix;
diff --git a/pkgs/applications/office/cb2bib/default.nix b/pkgs/applications/office/cb2bib/default.nix
index abff61b881fc..1004733a18b5 100644
--- a/pkgs/applications/office/cb2bib/default.nix
+++ b/pkgs/applications/office/cb2bib/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, qmakeHook, qtbase, qtwebkit, qtx11extras, lzo, libX11 }:
+{ stdenv, fetchurl, qmake, qtbase, qtwebkit, qtx11extras, lzo, libX11 }:
 
 stdenv.mkDerivation rec {
   name = pname + "-" + version;
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
     sha256 = "0yz79v023w1229wzck3gij0iqah1xg8rg4a352q8idvg7bdmyfin";
   };
   buildInputs = [ qtbase qtwebkit qtx11extras lzo libX11 ];
-  nativeBuildInputs = [ qmakeHook ];
+  nativeBuildInputs = [ qmake ];
 
   configurePhase = ''
     runHook preConfigure
diff --git a/pkgs/applications/office/libreoffice/default.nix b/pkgs/applications/office/libreoffice/default.nix
index ee59f0d078d4..0f5f59209660 100644
--- a/pkgs/applications/office/libreoffice/default.nix
+++ b/pkgs/applications/office/libreoffice/default.nix
@@ -72,6 +72,8 @@ in stdenv.mkDerivation rec {
   configureScript = "./autogen.sh";
   dontUseCmakeConfigure = true;
 
+  patches = [ ./xdg-open.patch ];
+
   postUnpack = ''
     mkdir -v $sourceRoot/src
   '' + (stdenv.lib.concatMapStrings (f: "ln -sfv ${f} $sourceRoot/src/${f.md5 or f.outputHash}-${f.name}\nln -sfv ${f} $sourceRoot/src/${f.name}\n") srcs.third_party)
diff --git a/pkgs/applications/office/libreoffice/still.nix b/pkgs/applications/office/libreoffice/still.nix
index 7a2174b557e1..7c122c0725af 100644
--- a/pkgs/applications/office/libreoffice/still.nix
+++ b/pkgs/applications/office/libreoffice/still.nix
@@ -73,11 +73,14 @@ in stdenv.mkDerivation rec {
   dontUseCmakeConfigure = true;
 
   # ICU 58, included in 5.3.x
-  patches = [(fetchurl {
-    url = "https://gerrit.libreoffice.org/gitweb?p=core.git;a=patch;h=3e42714c76b1347babfdea0564009d8d82a83af4";
-    sha256 = "10bid0jdw1rpdsqwzzk3r4rp6bjs2cvi82h7anz2m1amfjdv86my";
-    name = "libreoffice-5.2.x-icu4c-58.patch";
-  })];
+  patches = [
+    (fetchurl {
+      url = "https://gerrit.libreoffice.org/gitweb?p=core.git;a=patch;h=3e42714c76b1347babfdea0564009d8d82a83af4";
+      sha256 = "10bid0jdw1rpdsqwzzk3r4rp6bjs2cvi82h7anz2m1amfjdv86my";
+      name = "libreoffice-5.2.x-icu4c-58.patch";}
+    )
+    ./xdg-open.patch
+  ];
 
   postUnpack = ''
     mkdir -v $sourceRoot/src
diff --git a/pkgs/applications/office/libreoffice/xdg-open.patch b/pkgs/applications/office/libreoffice/xdg-open.patch
new file mode 100644
index 000000000000..3ff7e5d80f7a
--- /dev/null
+++ b/pkgs/applications/office/libreoffice/xdg-open.patch
@@ -0,0 +1,25 @@
+diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx
+--- a/shell/source/unix/exec/shellexec.cxx
++++ b/shell/source/unix/exec/shellexec.cxx
+@@ -150,7 +150,7 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar
+         if (std::getenv("LIBO_FLATPAK") != nullptr) {
+             aBuffer.append("/app/bin/xdg-open");
+         } else {
+-            aBuffer.append("/usr/bin/xdg-open");
++            aBuffer.append("xdg-open");
+         }
+ #endif
+         aBuffer.append(" ");
+diff --git a/shell/source/unix/misc/senddoc.sh b/shell/source/unix/misc/senddoc.sh
+index 4519e01f26e2..8985711a2c01 100755
+--- a/shell/source/unix/misc/senddoc.sh
++++ b/shell/source/unix/misc/senddoc.sh
+@@ -393,6 +393,8 @@ case `basename "$MAILER" | sed 's/-.*$//'` in
+             MAILER=/usr/bin/kde-open
+         elif [ -x /usr/bin/xdg-open ] ; then
+             MAILER=/usr/bin/xdg-open
++        elif type -p xdg-open >/dev/null 2>&1 ; then
++            MAILER="$(type -p xdg-open)"
+         else
+             echo "Unsupported mail client: `basename $MAILER | sed 's/-.*^//'`"
+             exit 2
diff --git a/pkgs/applications/office/mendeley/default.nix b/pkgs/applications/office/mendeley/default.nix
index 95286f3ab650..7178a0930e77 100644
--- a/pkgs/applications/office/mendeley/default.nix
+++ b/pkgs/applications/office/mendeley/default.nix
@@ -1,4 +1,5 @@
 { fetchurl, stdenv, dpkg, which
+, makeWrapper
 , alsaLib
 , desktop_file_utils
 , dbus
@@ -92,7 +93,7 @@ stdenv.mkDerivation {
     sha256 = sha256;
   };
 
-  nativeBuildInputs = [ qt5.makeQtWrapper ];
+  nativeBuildInputs = [ makeWrapper ];
   buildInputs = [ dpkg which ] ++ deps;
 
   unpackPhase = "true";
@@ -107,7 +108,7 @@ stdenv.mkDerivation {
              $out/bin/mendeleydesktop
     paxmark m $out/bin/mendeleydesktop
 
-    wrapQtProgram $out/bin/mendeleydesktop \
+    wrapProgram $out/bin/mendeleydesktop \
       --add-flags "--unix-distro-build" \
       ${stdenv.lib.optionalString autorunLinkHandler
       ''--run "$out/bin/install-mendeley-link-handler.sh $out/bin/mendeleydesktop"''}
diff --git a/pkgs/applications/office/mytetra/default.nix b/pkgs/applications/office/mytetra/default.nix
index b35e60cf2d61..9f54f2df6bf2 100644
--- a/pkgs/applications/office/mytetra/default.nix
+++ b/pkgs/applications/office/mytetra/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, qmakeHook, makeQtWrapper, qtsvg }:
+{ stdenv, fetchurl, qmake, qtsvg }:
 
 let
   version = "1.42.2";
@@ -9,7 +9,8 @@ in stdenv.mkDerivation rec {
     sha256 = "1ah44nf4ksxkh01a2zmgvvby4pwczhyq5vcp270rf6visp8v9804";
   };
 
-  buildInputs = [ qmakeHook makeQtWrapper qtsvg ];
+  nativeBuildInputs = [ qmake ];
+  buildInputs = [ qtsvg ];
 
   hardeningDisable = [ "format" ];
 
@@ -22,8 +23,6 @@ in stdenv.mkDerivation rec {
       --replace ":/resource/pic/logo.svg" "$out/share/icons/hicolor/48x48/apps/mytetra.png"
   '';
 
-  postInstall = "wrapQtProgram $out/bin/mytetra";
-
   meta = with stdenv.lib; {
     description = "Smart manager for information collecting";
     homepage = http://webhamster.ru/site/page/index/articles/projectcode/138;
diff --git a/pkgs/applications/office/skrooge/default.nix b/pkgs/applications/office/skrooge/default.nix
index acf60bd03755..38ec107bcf73 100644
--- a/pkgs/applications/office/skrooge/default.nix
+++ b/pkgs/applications/office/skrooge/default.nix
@@ -1,9 +1,10 @@
-{ stdenv, fetchurl, cmake, extra-cmake-modules, makeQtWrapper, qtwebkit, qtscript, grantlee,
+{ mkDerivation, lib, fetchurl,
+  cmake, extra-cmake-modules, qtwebkit, qtscript, grantlee,
   kxmlgui, kwallet, kparts, kdoctools, kjobwidgets, kdesignerplugin,
   kiconthemes, knewstuff, sqlcipher, qca-qt5, kdelibs4support, kactivities,
   knotifyconfig, krunner, libofx }:
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   name = "skrooge-${version}";
   version = "2.7.0";
 
@@ -12,21 +13,14 @@ stdenv.mkDerivation rec {
     sha256 = "1xrh9nal122rzlv4m0x8qah6zpqb6891al3351piarpk2xgjgj4x";
   };
 
-  nativeBuildInputs = [ cmake extra-cmake-modules makeQtWrapper ];
+  nativeBuildInputs = [ cmake extra-cmake-modules ];
 
   buildInputs = [ qtwebkit qtscript grantlee kxmlgui kwallet kparts kdoctools
     kjobwidgets kdesignerplugin kiconthemes knewstuff sqlcipher qca-qt5
     kdelibs4support kactivities knotifyconfig krunner libofx
   ];
 
-  enableParallelBuilding = true;
-
-  postInstall = ''
-    wrapQtProgram "$out/bin/skrooge"
-    wrapQtProgram "$out/bin/skroogeconvert"
-  '';
-
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "A personal finances manager, powered by KDE";
     license = with licenses; [ gpl3 ];
     maintainers = with maintainers; [ joko ];
diff --git a/pkgs/applications/office/zim/default.nix b/pkgs/applications/office/zim/default.nix
index 227b982689e1..18c4514c4de1 100644
--- a/pkgs/applications/office/zim/default.nix
+++ b/pkgs/applications/office/zim/default.nix
@@ -9,11 +9,11 @@
 
 python2Packages.buildPythonApplication rec {
   name = "zim-${version}";
-  version = "0.65";
+  version = "0.67-rc2";
 
   src = fetchurl {
     url = "http://zim-wiki.org/downloads/${name}.tar.gz";
-    sha256 = "15pdq4fxag85qjsrdmmssiq85qsk5vnbp8mrqnpvx8lm8crz6hjl";
+    sha256 = "0l4q2dfnvyn0jr1lggf8g7515q4z7qr1lnmy0lsyhjf477ldszqf";
   };
 
   propagatedBuildInputs = with python2Packages; [ pyGtkGlade pyxdg pygobject2 ];
@@ -37,9 +37,10 @@ python2Packages.buildPythonApplication rec {
   '';
 
 
-  meta = {
-      description = "A desktop wiki";
-      homepage = http://zim-wiki.org;
-      license = stdenv.lib.licenses.gpl2Plus;
+  meta = with stdenv.lib; {
+    description = "A desktop wiki";
+    homepage = http://zim-wiki.org;
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ pSub ];
   };
 }
diff --git a/pkgs/applications/science/astronomy/stellarium/default.nix b/pkgs/applications/science/astronomy/stellarium/default.nix
index 49c774f7039a..da6aa38d746a 100644
--- a/pkgs/applications/science/astronomy/stellarium/default.nix
+++ b/pkgs/applications/science/astronomy/stellarium/default.nix
@@ -1,9 +1,10 @@
-{ stdenv, fetchurl, cmake, freetype, libpng, mesa, gettext, openssl, perl, libiconv
-, qtscript, qtserialport, qttools, makeQtWrapper
+{ mkDerivation, lib, fetchurl
+, cmake, freetype, libpng, mesa, gettext, openssl, perl, libiconv
+, qtscript, qtserialport, qttools
 , qtmultimedia
 }:
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   name = "stellarium-${version}";
   version = "0.15.0";
 
@@ -12,25 +13,19 @@ stdenv.mkDerivation rec {
     sha256 = "0il751lgnfkx35h1m8fzwwnrygpxjx2a80gng1i1rbybkykf7l3l";
   };
 
-  nativeBuildInputs = [ makeQtWrapper ];
+  nativeBuildInputs = [ cmake perl ];
 
   buildInputs = [
-    cmake freetype libpng mesa gettext openssl perl libiconv qtscript
-    qtserialport qttools qtmultimedia
+    freetype libpng mesa openssl libiconv qtscript qtserialport qttools
+    qtmultimedia
   ];
 
-  enableParallelBuilding = true;
-
-  postInstall = ''
-    wrapQtProgram "$out/bin/stellarium"
-  '';
-
-  meta = {
+  meta = with lib; {
     description = "Free open-source planetarium";
     homepage = "http://stellarium.org/";
-    license = stdenv.lib.licenses.gpl2;
+    license = licenses.gpl2;
 
-    platforms = stdenv.lib.platforms.linux; # should be mesaPlatforms, but we don't have qt on darwin
-    maintainers = [ stdenv.lib.maintainers.peti ];
+    platforms = platforms.linux; # should be mesaPlatforms, but we don't have qt on darwin
+    maintainers = [ maintainers.peti ];
   };
 }
diff --git a/pkgs/applications/science/electronics/fritzing/default.nix b/pkgs/applications/science/electronics/fritzing/default.nix
index 838697f1394f..ab5088543102 100644
--- a/pkgs/applications/science/electronics/fritzing/default.nix
+++ b/pkgs/applications/science/electronics/fritzing/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchpatch, fetchFromGitHub, makeQtWrapper, qmakeHook, pkgconfig
+{ stdenv, fetchpatch, fetchFromGitHub, qmake, pkgconfig
 , qtbase, qtsvg, qtserialport, boost, libgit2
 }:
 
@@ -28,20 +28,14 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ qtbase qtsvg qtserialport boost libgit2 ];
 
-  nativeBuildInputs = [ qmakeHook makeQtWrapper pkgconfig ];
+  nativeBuildInputs = [ qmake pkgconfig ];
 
   qmakeFlags = [ "phoenix.pro" ];
 
-  enableParallelBuilding = true;
-
   preConfigure = ''
     ln -s "$parts" parts
   '';
 
-  postInstall = ''
-    wrapQtProgram $out/bin/Fritzing
-  '';
-
   meta = {
     description = "An open source prototyping tool for Arduino-based projects";
     homepage = http://fritzing.org/;
diff --git a/pkgs/applications/science/logic/lean/default.nix b/pkgs/applications/science/logic/lean/default.nix
index a863b01f43ae..08861341a1ae 100644
--- a/pkgs/applications/science/logic/lean/default.nix
+++ b/pkgs/applications/science/logic/lean/default.nix
@@ -2,13 +2,13 @@
 
 stdenv.mkDerivation rec {
   name = "lean-${version}";
-  version = "3.1.0";
+  version = "3.2.0";
 
   src = fetchFromGitHub {
     owner  = "leanprover";
     repo   = "lean";
     rev    = "v${version}";
-    sha256 = "0w4cdai6mzx4wr7gscv4sl5q4mxx1agjbpp4smvrslav7gpbz025";
+    sha256 = "13sb9rwgc9ni2j5zx77imjhkzhix9d7klsdb8cg68c17b20sy1g3";
   };
 
   buildInputs = [ gmp cmake ];
diff --git a/pkgs/applications/science/math/speedcrunch/default.nix b/pkgs/applications/science/math/speedcrunch/default.nix
index 861deaff741c..d36b135531c2 100644
--- a/pkgs/applications/science/math/speedcrunch/default.nix
+++ b/pkgs/applications/science/math/speedcrunch/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchgit, cmake, makeQtWrapper, qtbase, qttools }:
+{ mkDerivation, lib, fetchgit, cmake, qtbase, qttools }:
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   name = "speedcrunch-${version}";
   version = "0.12.0";
 
@@ -11,21 +11,15 @@ stdenv.mkDerivation rec {
     sha256 = "0vh7cd1915bjqzkdp3sk25ngy8cq624mkh8c53c5bnzk357kb0fk";
   };
 
-  enableParallelBuilding = true;
-
   buildInputs = [ qtbase qttools ];
 
-  nativeBuildInputs = [ cmake makeQtWrapper ];
+  nativeBuildInputs = [ cmake ];
 
   preConfigure = ''
     cd src
   '';
 
-  postFixup = ''
-    wrapQtProgram $out/bin/speedcrunch
-  '';
-
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage    = http://speedcrunch.org;
     license     = licenses.gpl2Plus;
     description = "A fast power user calculator";
diff --git a/pkgs/applications/science/programming/fdr/default.nix b/pkgs/applications/science/programming/fdr/default.nix
index a82027a628f3..8ed8e0e73b00 100644
--- a/pkgs/applications/science/programming/fdr/default.nix
+++ b/pkgs/applications/science/programming/fdr/default.nix
@@ -28,7 +28,7 @@ stdenv.mkDerivation {
     cp -r * "$out"
     # Hack around lack of libtinfo in NixOS
     ln -s ${ncurses.out}/lib/libncursesw.so.6 $out/lib/libtinfo.so.5
-    ln -s ${qtbase.out}/lib/qt5/plugins $out/lib/qt_plugins
+    ln -s ${qtbase.out}/$qtPluginPrefix $out/lib/qt_plugins
     ln -s ${zlib.out}/lib/libz.so.1 $out/lib/libz.so.1
 
     for b in fdr4 _fdr4 refines _refines cspmprofiler cspmexplorerprof
diff --git a/pkgs/applications/science/robotics/qgroundcontrol/default.nix b/pkgs/applications/science/robotics/qgroundcontrol/default.nix
index e323b42d7ae6..98ec39eb2064 100644
--- a/pkgs/applications/science/robotics/qgroundcontrol/default.nix
+++ b/pkgs/applications/science/robotics/qgroundcontrol/default.nix
@@ -1,19 +1,16 @@
 { stdenv, fetchgit, git,  espeak, SDL, udev, doxygen, cmake
-  , qtbase, qtlocation, qtserialport, qtdeclarative, qtconnectivity, qtxmlpatterns
-  , qtsvg, qtquick1, qtquickcontrols, qtgraphicaleffects, qmakeHook
-  , makeQtWrapper, lndir
-  , gst_all_1, qt-gstreamer1, pkgconfig, glibc
-  , version ? "2.9.4"
+, qtbase, qtlocation, qtserialport, qtdeclarative, qtconnectivity, qtxmlpatterns
+, qtsvg, qtquick1, qtquickcontrols, qtgraphicaleffects, qmake
+, makeWrapper, lndir
+, gst_all_1, qt-gstreamer1, pkgconfig, glibc
+, version ? "2.9.4"
 }:
 
 stdenv.mkDerivation rec {
   name = "qgroundcontrol-${version}";
-  buildInputs = [
-   SDL udev doxygen git
-  ] ++ gstInputs;
 
   qtInputs = [
-    qtbase qtlocation qtserialport qtdeclarative qtconnectivity qtxmlpatterns qtsvg 
+    qtbase qtlocation qtserialport qtdeclarative qtconnectivity qtxmlpatterns qtsvg
     qtquick1 qtquickcontrols qtgraphicaleffects
   ];
 
@@ -22,9 +19,8 @@ stdenv.mkDerivation rec {
   ];
 
   enableParallelBuilding = true;
-  nativeBuildInputs = [
-    pkgconfig makeQtWrapper qmakeHook
- ] ++ qtInputs;
+  buildInputs = [ SDL udev doxygen git ] ++ gstInputs ++ qtInputs;
+  nativeBuildInputs = [ pkgconfig makeWrapper qmake ];
 
   patches = [ ./0001-fix-gcc-cmath-namespace-issues.patch ];
   postPatch = ''
@@ -56,10 +52,10 @@ stdenv.mkDerivation rec {
 
     # we need to link to our Qt deps in our own output if we want
     # this package to work without being installed as a system pkg
-    mkdir -p $out/lib/qt5 $out/etc/xdg
+    mkdir -p $out/lib/qt-$qtCompatVersion $out/etc/xdg
     for pkg in $qtInputs; do
-      if [[ -d $pkg/lib/qt5 ]]; then
-        for dir in lib/qt5 share etc/xdg; do
+      if [[ -d $pkg/lib/qt-$qtCompatVersion ]]; then
+        for dir in lib/qt-$qtCompatVersion share etc/xdg; do
           if [[ -d $pkg/$dir ]]; then
             ${lndir}/bin/lndir "$pkg/$dir" "$out/$dir"
           fi
@@ -70,7 +66,7 @@ stdenv.mkDerivation rec {
 
 
   postInstall = ''
-    wrapQtProgram "$out/bin/qgroundcontrol" \
+    wrapProgram "$out/bin/qgroundcontrol" \
       --prefix GST_PLUGIN_SYSTEM_PATH : "$GST_PLUGIN_SYSTEM_PATH"
   '';
   
diff --git a/pkgs/applications/video/bomi/default.nix b/pkgs/applications/video/bomi/default.nix
index c98e27479894..bffb038f6536 100644
--- a/pkgs/applications/video/bomi/default.nix
+++ b/pkgs/applications/video/bomi/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchFromGitHub, fetchpatch, pkgconfig, perl, python, which, makeQtWrapper
+{ stdenv, fetchFromGitHub, fetchpatch, pkgconfig, perl, python, which
 , libX11, libxcb, mesa
-, qtbase, qtdeclarative, qtquickcontrols, qttools, qtx11extras, qmakeHook
+, qtbase, qtdeclarative, qtquickcontrols, qttools, qtx11extras, qmake, makeWrapper
 , libchardet
 , ffmpeg
 
@@ -90,7 +90,7 @@ stdenv.mkDerivation rec {
   '';
 
   postInstall = ''
-    wrapQtProgram $out/bin/bomi \
+    wrapProgram $out/bin/bomi \
       ${optionalString youtubeSupport "--prefix PATH ':' '${youtube-dl}/bin'"}
   '';
 
@@ -104,9 +104,7 @@ stdenv.mkDerivation rec {
                    ++ optional cddaSupport "--enable-cdda"
                    ;
 
-  nativeBuildInputs = [ pkgconfig perl python which qttools makeQtWrapper qmakeHook ];
-
-  enableParallelBuilding = true;
+  nativeBuildInputs = [ makeWrapper pkgconfig perl python which qttools qmake ];
 
   meta = with stdenv.lib; {
     description = "Powerful and easy-to-use multimedia player";
diff --git a/pkgs/applications/video/openshot-qt/default.nix b/pkgs/applications/video/openshot-qt/default.nix
index 656ec1163dc2..f67ab412c26e 100644
--- a/pkgs/applications/video/openshot-qt/default.nix
+++ b/pkgs/applications/video/openshot-qt/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchFromGitHub
 , doxygen, python3Packages, libopenshot
-, makeQtWrapper, wrapGAppsHook, gtk3 }:
+, wrapGAppsHook, gtk3 }:
 
 python3Packages.buildPythonApplication rec {
   name = "openshot-qt-${version}";
diff --git a/pkgs/applications/video/qstopmotion/default.nix b/pkgs/applications/video/qstopmotion/default.nix
new file mode 100644
index 000000000000..310ac974fca7
--- /dev/null
+++ b/pkgs/applications/video/qstopmotion/default.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchurl, qt5, gstreamer, gstreamermm, gst_plugins_bad
+, gst_plugins_base, gst_plugins_good, ffmpeg, guvcview, automoc4
+, cmake, libxml2, gettext, pkgconfig, libgphoto2, gphoto2, v4l_utils
+, libv4l, pcre }:
+
+stdenv.mkDerivation rec {
+  pname = "qstopmotion";
+  version = "2.3.2";
+  name = "${pname}-${version}";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/project/${pname}/Version_2_3_2/${name}-Source.tar.gz";
+    sha256 = "1vbiznwyc05jqg0dpmgxmvf7kdzmlck0i8v2c5d69kgrdnaypcrf";
+  };
+
+  buildInputs = [ qt5.qtbase gstreamer gstreamermm gst_plugins_bad gst_plugins_good
+                  gst_plugins_base ffmpeg guvcview v4l_utils libv4l pcre
+		];
+
+  nativeBuildInputs = [ pkgconfig cmake gettext libgphoto2 gphoto2 libxml2 libv4l ];
+
+  meta = with stdenv.lib; {
+    homepage = "http://www.qstopmotion.org";
+    description = "Create stopmotion animation with a (web)camera";
+    longDescription = ''
+      Qstopmotion is a tool to create stopmotion
+      animation. Its users are able to create stop-motions from pictures
+      imported from a camera or from the harddrive and export the
+      animation to different video formats such as mpeg or avi.
+    '';
+
+    license = stdenv.lib.licenses.gpl2Plus;
+    maintainers = [ maintainers.leenaars ];
+    platforms = stdenv.lib.platforms.gnu;
+  };
+}
diff --git a/pkgs/applications/video/shotcut/default.nix b/pkgs/applications/video/shotcut/default.nix
index 140c8e5863d1..4ca31916965c 100644
--- a/pkgs/applications/video/shotcut/default.nix
+++ b/pkgs/applications/video/shotcut/default.nix
@@ -1,7 +1,7 @@
 { stdenv, fetchurl, SDL, frei0r, gettext, mlt, jack1, pkgconfig, qtbase,
 qtmultimedia, qtwebkit, qtx11extras, qtwebsockets, qtquickcontrols,
 qtgraphicaleffects,
-qmakeHook, makeQtWrapper }:
+qmake, makeWrapper }:
 
 stdenv.mkDerivation rec {
   name = "shotcut-${version}";
@@ -12,10 +12,14 @@ stdenv.mkDerivation rec {
     sha256 = "09nygz1x9fvqf33gqpc6jnr1j7ny0yny3w2ngwqqfkf3f8n83qhr";
   };
 
-  buildInputs = [ SDL frei0r gettext mlt pkgconfig qtbase qtmultimedia qtwebkit
-    qtx11extras qtwebsockets qtquickcontrols qtgraphicaleffects qmakeHook makeQtWrapper ];
 
   enableParallelBuilding = true;
+  nativeBuildInputs = [ makeWrapper pkgconfig qmake ];
+  buildInputs = [
+    SDL frei0r gettext mlt
+    qtbase qtmultimedia qtwebkit qtx11extras qtwebsockets qtquickcontrols
+    qtgraphicaleffects
+  ];
 
   prePatch = ''
     sed 's_shotcutPath, "qmelt"_"${mlt}/bin/melt"_' -i src/jobs/meltjob.cpp
@@ -27,7 +31,7 @@ stdenv.mkDerivation rec {
   postInstall = ''
     mkdir -p $out/share/shotcut
     cp -r src/qml $out/share/shotcut/
-    wrapQtProgram $out/bin/shotcut --prefix FREI0R_PATH : ${frei0r}/lib/frei0r-1 --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ jack1 SDL ]} --prefix PATH : ${mlt}/bin
+    wrapProgram $out/bin/shotcut --prefix FREI0R_PATH : ${frei0r}/lib/frei0r-1 --prefix LD_LIBRARY_PATH : ${stdenv.lib.makeLibraryPath [ jack1 SDL ]} --prefix PATH : ${mlt}/bin
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/applications/video/smplayer/default.nix b/pkgs/applications/video/smplayer/default.nix
index 146cb3b0e464..b7e4fe6b7c6d 100644
--- a/pkgs/applications/video/smplayer/default.nix
+++ b/pkgs/applications/video/smplayer/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, qmakeHook, qtscript }:
+{ stdenv, fetchurl, qmake, qtscript }:
 
 stdenv.mkDerivation rec {
   name = "smplayer-17.6.0";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ qtscript ];
-  nativeBuildInputs = [ qmakeHook ];
+  nativeBuildInputs = [ qmake ];
 
   dontUseQmakeConfigure = true;
 
diff --git a/pkgs/applications/video/smtube/default.nix b/pkgs/applications/video/smtube/default.nix
index 3f0aff6a15b9..b05887967093 100644
--- a/pkgs/applications/video/smtube/default.nix
+++ b/pkgs/applications/video/smtube/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, qmakeHook, qtscript, qtwebkit }:
+{ stdenv, fetchurl, qmake, qtscript, qtwebkit }:
 
 stdenv.mkDerivation rec {
   version = "17.5.0";
@@ -15,7 +15,8 @@ stdenv.mkDerivation rec {
 
   dontUseQmakeConfigure = true;
 
-  buildInputs = [ qmakeHook qtscript qtwebkit ];
+  nativeBuildInputs = [ qmake ];
+  buildInputs = [ qtscript qtwebkit ];
 
   meta = with stdenv.lib; {
     description = "Play and download Youtube videos";
diff --git a/pkgs/applications/video/vokoscreen/default.nix b/pkgs/applications/video/vokoscreen/default.nix
index 204580b108f7..b10495434b99 100644
--- a/pkgs/applications/video/vokoscreen/default.nix
+++ b/pkgs/applications/video/vokoscreen/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchgit
-, pkgconfig, qtbase, qttools, qmakeHook, qtx11extras, alsaLib, libv4l, libXrandr
+, pkgconfig, qtbase, qttools, qmake, qtx11extras, alsaLib, libv4l, libXrandr
 , ffmpeg
 }:
 
@@ -11,13 +11,12 @@ stdenv.mkDerivation {
     sha256 = "1hvw7xz1mj16ishbaip73wddbmgibsz0pad4y586zbarpynss25z";
   };
 
+  nativeBuildInputs = [ pkgconfig qmake ];
   buildInputs = [
     alsaLib
     libv4l
-    pkgconfig
     qtbase
     qttools
-    qmakeHook
     qtx11extras
     libXrandr
   ];
diff --git a/pkgs/applications/virtualization/virt-manager/qt.nix b/pkgs/applications/virtualization/virt-manager/qt.nix
index 7e05324a046b..783a424e18c2 100644
--- a/pkgs/applications/virtualization/virt-manager/qt.nix
+++ b/pkgs/applications/virtualization/virt-manager/qt.nix
@@ -1,9 +1,9 @@
-{ stdenv, fetchFromGitHub, cmake, pkgconfig
-, qtbase, qtmultimedia, qtsvg, makeQtWrapper
+{ mkDerivation, lib, fetchFromGitHub, cmake, pkgconfig
+, qtbase, qtmultimedia, qtsvg
 , lxqt, libvncserver, libvirt, pixman, spice_gtk, spice_protocol
 }:
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   name = "virt-manager-qt-${version}";
   version = "0.43.70.2";
 
@@ -23,17 +23,9 @@ stdenv.mkDerivation rec {
     libvirt libvncserver pixman spice_gtk spice_protocol
   ];
 
-  nativeBuildInputs = [ cmake pkgconfig makeQtWrapper ];
+  nativeBuildInputs = [ cmake pkgconfig ];
 
-  postFixup = ''
-    for f in $out/bin/* ; do
-      wrapQtProgram $f
-    done
-  '';
-
-  enableParallelBuilding = true;
-
-  meta = with stdenv.lib; {
+  meta = with lib; {
     homepage = http://f1ash.github.io/qt-virt-manager;
     description = "Desktop user interface for managing virtual machines (QT)";
     longDescription = ''
diff --git a/pkgs/applications/virtualization/virtualbox/default.nix b/pkgs/applications/virtualization/virtualbox/default.nix
index 6c49e95b6b94..32e8f9d23f4b 100644
--- a/pkgs/applications/virtualization/virtualbox/default.nix
+++ b/pkgs/applications/virtualization/virtualbox/default.nix
@@ -58,7 +58,7 @@ in stdenv.mkDerivation {
     ++ optional pythonBindings python # Python is needed even when not building bindings
     ++ optional pulseSupport libpulseaudio
     ++ optionals (headless) [ libXrandr ]
-    ++ optionals (!headless) [ qt5.qtbase qt5.qtx11extras qt5.makeQtWrapper libXinerama SDL ];
+    ++ optionals (!headless) [ qt5.qtbase qt5.qtx11extras libXinerama SDL ];
 
   hardeningDisable = [ "fortify" "pic" "stackprotector" ];
 
@@ -153,12 +153,8 @@ in stdenv.mkDerivation {
     find out/linux.*/${buildType}/bin -mindepth 1 -maxdepth 1 \
       -name src -o -exec cp -avt "$libexec" {} +
 
-    # Create wrapper script
     mkdir -p $out/bin
-    ${optionalString (!headless) ''
-      makeQtWrapper "$libexec/VirtualBox" $out/bin/VirtualBox
-    ''}
-    for file in ${optionalString (!headless) "VBoxSDL rdesktop-vrdp"} VBoxManage VBoxBalloonCtrl VBoxHeadless; do
+    for file in ${optionalString (!headless) "VirtualBox VBoxSDL rdesktop-vrdp"} VBoxManage VBoxBalloonCtrl VBoxHeadless; do
         echo "Linking $file to /bin"
         test -x "$libexec/$file"
         ln -s "$libexec/$file" $out/bin/$file
diff --git a/pkgs/build-support/kde/derivation.nix b/pkgs/build-support/kde/derivation.nix
deleted file mode 100644
index 2e29a0a661e1..000000000000
--- a/pkgs/build-support/kde/derivation.nix
+++ /dev/null
@@ -1,17 +0,0 @@
-{ stdenv, lib, debug ? false }:
-
-args:
-
-stdenv.mkDerivation (args // {
-
-  outputs = args.outputs or [ "out" "dev" ];
-
-  propagatedUserEnvPkgs =
-    builtins.map lib.getBin (args.propagatedBuildInputs or []);
-
-  cmakeFlags =
-    (args.cmakeFlags or [])
-    ++ [ "-DBUILD_TESTING=OFF" ]
-    ++ lib.optional debug "-DCMAKE_BUILD_TYPE=Debug";
-
-})
diff --git a/pkgs/build-support/kde/wrapper.nix b/pkgs/build-support/kde/wrapper.nix
deleted file mode 100644
index 4442b111d790..000000000000
--- a/pkgs/build-support/kde/wrapper.nix
+++ /dev/null
@@ -1,68 +0,0 @@
-{ stdenv, lib, makeWrapper, buildEnv, gtk3, dconf }:
-
-packages:
-
-let
-  packages_ = if builtins.isList packages then packages else [packages];
-
-  unwrapped = lib.concatMap (p: if builtins.isList p.unwrapped then p.unwrapped else [p.unwrapped]) packages_;
-  targets = lib.concatMap (p: p.targets) packages_;
-  paths = lib.concatMap (p: p.paths or []) packages_;
-
-  name =
-    if builtins.length unwrapped == 1
-    then (lib.head unwrapped).name
-    else "kde-application";
-  meta =
-    if builtins.length unwrapped == 1
-    then (lib.head unwrapped).meta
-    else {};
-
-  env = buildEnv {
-    inherit name meta;
-    paths = builtins.map lib.getBin (unwrapped ++ paths);
-    pathsToLink = [ "/bin" "/share" "/lib/qt5" "/etc/xdg" ];
-  };
-in
-
-stdenv.mkDerivation {
-  inherit name meta;
-  preferLocalBuild = true;
-
-  inherit unwrapped env targets;
-
-  passthru = {
-    inherit targets paths;
-    unwrapped = if builtins.length unwrapped == 1 then lib.head unwrapped else unwrapped;
-  };
-
-  nativeBuildInputs = [ makeWrapper ];
-
-  buildCommand = ''
-    for t in $targets; do
-        good=""
-        for drv in $unwrapped; do
-            if [ -a "$drv/$t" ]; then
-                makeWrapper "$drv/$t" "$out/$t" \
-                    --argv0 '"$0"' \
-                    --suffix PATH : "$env/bin" \
-                    --prefix XDG_CONFIG_DIRS : "$env/etc/xdg" \
-                    --prefix XDG_DATA_DIRS : "$env/share:${gtk3}/share/gsettings-schemas/${gtk3.name}" \
-                    --prefix QML_IMPORT_PATH : "$env/lib/qt5/imports" \
-                    --prefix QML2_IMPORT_PATH : "$env/lib/qt5/qml" \
-                    --prefix QT_PLUGIN_PATH : "$env/lib/qt5/plugins" \
-                    --prefix GIO_EXTRA_MODULES : "${dconf.lib}/lib/gio/modules"
-                good="1"
-                break
-            fi
-        done
-        if [ -z "$good" ]; then
-            echo "file or directory not found in derivations: $t"
-            exit 1
-        fi
-    done
-
-    mkdir -p "$out/nix-support"
-    echo "$unwrapped" > "$out/nix-support/propagated-user-env-packages"
-  '';
-}
diff --git a/pkgs/data/documentation/zeal/default.nix b/pkgs/data/documentation/zeal/default.nix
index 25a99789af50..36416c6f827c 100644
--- a/pkgs/data/documentation/zeal/default.nix
+++ b/pkgs/data/documentation/zeal/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchFromGitHub, libarchive, pkgconfig, qtbase
-, qtimageformats, qtwebkit, qtx11extras, xcbutilkeysyms, qmakeHook }:
+, qtimageformats, qtwebkit, qtx11extras, xcbutilkeysyms, qmake }:
 
 stdenv.mkDerivation rec {
   version = "0.3.1";
@@ -12,8 +12,9 @@ stdenv.mkDerivation rec {
     sha256 = "14ld7zm15677jdlasnfa6c42kiswd4d6yg1db50xbk2yflzzwqqa";
   };
 
+  nativeBuildInputs = [ pkgconfig qmake ];
   buildInputs = [
-    xcbutilkeysyms pkgconfig qtbase qtimageformats qtwebkit qtx11extras libarchive qmakeHook
+    xcbutilkeysyms qtbase qtimageformats qtwebkit qtx11extras libarchive
   ];
 
   qmakeFlags = [ "PREFIX=/" ];
diff --git a/pkgs/desktops/lumina/default.nix b/pkgs/desktops/lumina/default.nix
index 2c80f5157b66..81ced85d4620 100644
--- a/pkgs/desktops/lumina/default.nix
+++ b/pkgs/desktops/lumina/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchFromGitHub, fluxbox, xscreensaver, desktop_file_utils, numlockx,
-  xorg, qtbase, qtsvg, qtmultimedia, qtx11extras, qmakeHook, qttools, oxygen-icons5
+  xorg, qtbase, qtsvg, qtmultimedia, qtx11extras, qmake, qttools, oxygen-icons5
 }:
 
 stdenv.mkDerivation rec {
@@ -14,7 +14,7 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [
-    qmakeHook
+    qmake
     qttools
   ];
 
diff --git a/pkgs/desktops/lxqt/default.nix b/pkgs/desktops/lxqt/default.nix
index fbcb286f5b24..735ba79b405c 100644
--- a/pkgs/desktops/lxqt/default.nix
+++ b/pkgs/desktops/lxqt/default.nix
@@ -13,7 +13,7 @@ let
           --replace "DESTINATION \"\''${LXQT_ETC_XDG_DIR}" "DESTINATION \"etc/xdg" \
           --replace "DESTINATION \"\''${LXQT_SHARE_DIR}" "DESTINATION \"share/lxqt" \
           --replace "DESTINATION \"\''${LXQT_GRAPHICS_DIR}" "DESTINATION \"share/lxqt/graphics" \
-          --replace "DESTINATION \"\''${QT_PLUGINS_DIR}" "DESTINATION \"lib/qt5/plugins" \
+          --replace "DESTINATION \"\''${QT_PLUGINS_DIR}" "DESTINATION \"$qtPluginPrefix" \
           --replace "\''${LXQT_TRANSLATIONS_DIR}" share/lxqt/translations
         echo ============================
         echo $file
diff --git a/pkgs/desktops/mate/atril/default.nix b/pkgs/desktops/mate/atril/default.nix
new file mode 100644
index 000000000000..197c5470d2bd
--- /dev/null
+++ b/pkgs/desktops/mate/atril/default.nix
@@ -0,0 +1,37 @@
+{ stdenv, fetchurl, pkgconfig, intltool, gtk3, libxml2, libsecret, poppler, itstool, mate, wrapGAppsHook }:
+
+stdenv.mkDerivation rec {
+  name = "atril-${version}";
+  version = "${major-ver}.${minor-ver}";
+  major-ver = "1.19";
+  minor-ver = "0";
+
+  src = fetchurl {
+    url = "http://pub.mate-desktop.org/releases/${major-ver}/${name}.tar.xz";
+    sha256 = "0v829yvr738y5s2knyvimcgqv351qzb0rpw5il19qc27rbzyri1r";
+  };
+
+  nativeBuildInputs = [
+    pkgconfig
+    intltool
+    wrapGAppsHook
+  ];
+
+  buildInputs = [
+    gtk3
+    itstool
+    libsecret
+    libxml2
+    poppler
+    mate.mate-desktop
+  ];
+
+  configureFlags = [ "--disable-caja" ];
+  
+  meta = {
+    description = "A simple multi-page document viewer for the MATE desktop";
+    homepage = "http://mate-desktop.org";
+    license = stdenv.lib.licenses.gpl2;
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/pkgs/desktops/mate/default.nix b/pkgs/desktops/mate/default.nix
index d9565e8f4d1a..528f792a600d 100644
--- a/pkgs/desktops/mate/default.nix
+++ b/pkgs/desktops/mate/default.nix
@@ -1,5 +1,6 @@
 { callPackage, pkgs }:
 rec {
+  atril = callPackage ./atril { };
   caja = callPackage ./caja { };
   mate-common = callPackage ./mate-common { };
   mate-desktop = callPackage ./mate-desktop { };
diff --git a/pkgs/desktops/plasma-5/bluedevil.nix b/pkgs/desktops/plasma-5/bluedevil.nix
index d0e784998132..44e8a26eee15 100644
--- a/pkgs/desktops/plasma-5/bluedevil.nix
+++ b/pkgs/desktops/plasma-5/bluedevil.nix
@@ -1,17 +1,16 @@
 {
-  plasmaPackage, extra-cmake-modules, shared_mime_info,
+  mkDerivation, extra-cmake-modules, shared_mime_info,
   bluez-qt, kcoreaddons, kdbusaddons, kded, ki18n, kiconthemes, kio,
   knotifications, kwidgetsaddons, kwindowsystem, plasma-framework, qtdeclarative
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "bluedevil";
   nativeBuildInputs = [ extra-cmake-modules shared_mime_info ];
-  propagatedBuildInputs = [
+  buildInputs = [
     bluez-qt ki18n kio kwindowsystem plasma-framework qtdeclarative kcoreaddons
     kdbusaddons kded kiconthemes knotifications kwidgetsaddons
   ];
-  propagatedUserEnvPkgs = [ bluez-qt.out ];
   postInstall = ''
     # Fix the location of logic.js for the plasmoid
     ln -s $out/share/plasma/plasmoids/org.kde.plasma.bluetooth/contents/code/logic.js $out/share/plasma/plasmoids/org.kde.plasma.bluetooth/contents/ui/logic.js
diff --git a/pkgs/desktops/plasma-5/breeze-grub.nix b/pkgs/desktops/plasma-5/breeze-grub.nix
index da0fb6f73ad7..eed396b54375 100644
--- a/pkgs/desktops/plasma-5/breeze-grub.nix
+++ b/pkgs/desktops/plasma-5/breeze-grub.nix
@@ -1,10 +1,9 @@
 {
-  plasmaPackage
+  mkDerivation
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "breeze-grub";
-  outputs = [ "out" ];
   installPhase = ''
     runHook preInstall
 
diff --git a/pkgs/desktops/plasma-5/breeze-gtk.nix b/pkgs/desktops/plasma-5/breeze-gtk.nix
index 4048d98431db..cc51c4b0471c 100644
--- a/pkgs/desktops/plasma-5/breeze-gtk.nix
+++ b/pkgs/desktops/plasma-5/breeze-gtk.nix
@@ -1,11 +1,14 @@
-{ plasmaPackage
-, extra-cmake-modules
-, qtbase
-}:
+{ mkDerivation, lib, extra-cmake-modules, gtk2, qtbase, }:
 
-plasmaPackage {
+let inherit (lib) getLib; in
+
+mkDerivation {
   name = "breeze-gtk";
   nativeBuildInputs = [ extra-cmake-modules ];
-  cmakeFlags = [ "-DWITH_GTK3_VERSION=3.20" ];
   buildInputs = [ qtbase ];
+  postPatch = ''
+    sed -i cmake/FindGTKEngine.cmake \
+      -e "s|\''${KDE_INSTALL_FULL_LIBDIR}|${getLib gtk2}/lib|"
+  '';
+  cmakeFlags = [ "-DWITH_GTK3_VERSION=3.22" ];
 }
diff --git a/pkgs/desktops/plasma-5/breeze-plymouth/default.nix b/pkgs/desktops/plasma-5/breeze-plymouth/default.nix
index dfbdf48165aa..41a4dd66b2c8 100644
--- a/pkgs/desktops/plasma-5/breeze-plymouth/default.nix
+++ b/pkgs/desktops/plasma-5/breeze-plymouth/default.nix
@@ -1,14 +1,13 @@
 {
-  plasmaPackage, lib, copyPathsToStore,
+  mkDerivation, lib, copyPathsToStore,
   extra-cmake-modules,
   plymouth
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "breeze-plymouth";
   nativeBuildInputs = [ extra-cmake-modules ];
   buildInputs = [ plymouth ];
-  outputs = [ "out" ];
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
   postPatch = ''
       substituteInPlace cmake/FindPlymouth.cmake --subst-var out
diff --git a/pkgs/desktops/plasma-5/breeze-qt4.nix b/pkgs/desktops/plasma-5/breeze-qt4.nix
index adcc6110c4d7..6c31398037b0 100644
--- a/pkgs/desktops/plasma-5/breeze-qt4.nix
+++ b/pkgs/desktops/plasma-5/breeze-qt4.nix
@@ -1,14 +1,15 @@
 {
-  plasmaPackage, lib,
+  mkDerivation, lib,
   automoc4, cmake, perl, pkgconfig,
   kdelibs4, qt4, xproto
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "breeze-qt4";
   sname = "breeze";
   buildInputs = [ kdelibs4 qt4 xproto ];
   nativeBuildInputs = [ automoc4 cmake perl pkgconfig ];
+  outputs = [ "out" "dev" ];
   cmakeFlags = [
     "-DUSE_KDE4=ON"
     "-DQT_QMAKE_EXECUTABLE=${qt4}/bin/qmake"
diff --git a/pkgs/desktops/plasma-5/breeze-qt5.nix b/pkgs/desktops/plasma-5/breeze-qt5.nix
index a1b64a4656cb..c0e55dec76d5 100644
--- a/pkgs/desktops/plasma-5/breeze-qt5.nix
+++ b/pkgs/desktops/plasma-5/breeze-qt5.nix
@@ -1,17 +1,20 @@
 {
-  plasmaPackage,
+  mkDerivation,
   extra-cmake-modules,
   frameworkintegration, kcmutils, kconfigwidgets, kcoreaddons, kdecoration,
-  kguiaddons, ki18n, kwayland, kwindowsystem, plasma-framework, qtx11extras
+  kguiaddons, ki18n, kwayland, kwindowsystem, plasma-framework, qtdeclarative,
+  qtx11extras
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "breeze-qt5";
   sname = "breeze";
   nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     frameworkintegration kcmutils kconfigwidgets kcoreaddons kdecoration
-    kguiaddons ki18n kwayland kwindowsystem plasma-framework qtx11extras
+    kguiaddons ki18n kwayland kwindowsystem plasma-framework qtdeclarative
+    qtx11extras
   ];
+  outputs = [ "out" "dev" "bin" ];
   cmakeFlags = [ "-DUSE_Qt4=OFF" ];
 }
diff --git a/pkgs/desktops/plasma-5/build-support/package.nix b/pkgs/desktops/plasma-5/build-support/package.nix
deleted file mode 100644
index 1e9ba016c471..000000000000
--- a/pkgs/desktops/plasma-5/build-support/package.nix
+++ /dev/null
@@ -1,27 +0,0 @@
-{ kdeDerivation, lib, fetchurl }:
-
-let
-  mirror = "mirror://kde";
-  srcs = import ../srcs.nix { inherit fetchurl mirror; };
-in
-
-args:
-
-let
-  inherit (args) name;
-  sname = args.sname or name;
-  inherit (srcs."${sname}") src version;
-in
-kdeDerivation (args // {
-  name = "${name}-${version}";
-  inherit src;
-
-  meta = {
-    license = with lib.licenses; [
-      lgpl21Plus lgpl3Plus bsd2 mit gpl2Plus gpl3Plus fdl12
-    ];
-    platforms = lib.platforms.linux;
-    maintainers = with lib.maintainers; [ ttuegel ];
-    homepage = "http://www.kde.org";
-  } // (args.meta or {});
-})
diff --git a/pkgs/desktops/plasma-5/default.nix b/pkgs/desktops/plasma-5/default.nix
index 1a8f1ed064b0..e101d4e14c57 100644
--- a/pkgs/desktops/plasma-5/default.nix
+++ b/pkgs/desktops/plasma-5/default.nix
@@ -25,19 +25,71 @@ existing packages here and modify it as necessary.
 */
 
 {
-  libsForQt5, kdeDerivation, lib, fetchurl,
+  libsForQt5, lib, fetchurl,
   gconf,
   debug ? false,
 }:
 
 let
+  srcs = import ./srcs.nix {
+    inherit fetchurl;
+    mirror = "mirror://kde";
+  };
+
+  mkDerivation = libsForQt5.callPackage ({ mkDerivation }: mkDerivation) {};
+
   packages = self: with self;
     let
+
+      propagate = out:
+        let setupHook = { writeScript }:
+              writeScript "setup-hook.sh" ''
+                # Propagate $${out} output
+                propagatedUserEnvPkgs+=" @${out}@"
+
+                # Propagate $dev so that this setup hook is propagated
+                # But only if there is a separate $dev output
+                if [ "$outputDev" != out ]; then
+                    if [ -n "$crossConfig" ]; then
+                      propagatedBuildInputs+=" @dev@"
+                    else
+                      propagatedNativeBuildInputs+=" @dev@"
+                    fi
+                fi
+              '';
+        in callPackage setupHook {};
+
+      propagateBin = propagate "bin";
+
       callPackage = self.newScope {
-        plasmaPackage = import ./build-support/package.nix {
-          inherit kdeDerivation lib fetchurl;
-        };
+        mkDerivation = args:
+          let
+            inherit (args) name;
+            sname = args.sname or name;
+            inherit (srcs."${sname}") src version;
+
+            outputs = args.outputs or [ "out" ];
+            hasBin = lib.elem "bin" outputs;
+            hasDev = lib.elem "dev" outputs;
+
+            defaultSetupHook = if hasBin && hasDev then propagateBin else null;
+            setupHook = args.setupHook or defaultSetupHook;
+
+            meta = {
+              license = with lib.licenses; [
+                lgpl21Plus lgpl3Plus bsd2 mit gpl2Plus gpl3Plus fdl12
+              ];
+              platforms = lib.platforms.linux;
+              maintainers = with lib.maintainers; [ ttuegel ];
+              homepage = "http://www.kde.org";
+            } // (args.meta or {});
+          in
+          mkDerivation (args // {
+            name = "${name}-${version}";
+            inherit meta outputs setupHook src;
+          });
       };
+
     in {
       bluedevil = callPackage ./bluedevil.nix {};
       breeze-gtk = callPackage ./breeze-gtk.nix {};
diff --git a/pkgs/desktops/plasma-5/kactivitymanagerd.nix b/pkgs/desktops/plasma-5/kactivitymanagerd.nix
index 282e58ecf9e6..ae2736fde113 100644
--- a/pkgs/desktops/plasma-5/kactivitymanagerd.nix
+++ b/pkgs/desktops/plasma-5/kactivitymanagerd.nix
@@ -1,13 +1,14 @@
-{ plasmaPackage
-, extra-cmake-modules
-, boost, kconfig, kcoreaddons, kdbusaddons, ki18n, kio, kglobalaccel
-, kwindowsystem, kxmlgui
+{
+  mkDerivation,
+  extra-cmake-modules,
+  boost, kconfig, kcoreaddons, kdbusaddons, ki18n, kio, kglobalaccel,
+  kwindowsystem, kxmlgui
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "kactivitymanagerd";
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
+  buildInputs = [
     boost kconfig kcoreaddons kdbusaddons kglobalaccel ki18n kio kwindowsystem
     kxmlgui
   ];
diff --git a/pkgs/desktops/plasma-5/kde-cli-tools.nix b/pkgs/desktops/plasma-5/kde-cli-tools.nix
index 87a46703997a..6bcafc5813a9 100644
--- a/pkgs/desktops/plasma-5/kde-cli-tools.nix
+++ b/pkgs/desktops/plasma-5/kde-cli-tools.nix
@@ -1,14 +1,14 @@
 {
-  plasmaPackage, extra-cmake-modules,
-  kcmutils, kconfig, kdelibs4support, kdesu, kdoctools, ki18n, kiconthemes,
-  kwindowsystem, qtsvg, qtx11extras
+  mkDerivation, extra-cmake-modules, kdoctools,
+  kcmutils, kconfig, kdesu, ki18n, kiconthemes, kinit, kio, kwindowsystem,
+  qtsvg, qtx11extras,
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "kde-cli-tools";
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  propagatedBuildInputs = [
-    kcmutils kconfig kdesu kdelibs4support ki18n kiconthemes kwindowsystem qtsvg
+  buildInputs = [
+    kcmutils kconfig kdesu ki18n kiconthemes kinit kio kwindowsystem qtsvg
     qtx11extras
   ];
 }
diff --git a/pkgs/desktops/plasma-5/kde-gtk-config/default.nix b/pkgs/desktops/plasma-5/kde-gtk-config/default.nix
index f482f2a6a3f3..38bab58c829e 100644
--- a/pkgs/desktops/plasma-5/kde-gtk-config/default.nix
+++ b/pkgs/desktops/plasma-5/kde-gtk-config/default.nix
@@ -1,25 +1,18 @@
-{ plasmaPackage
-, extra-cmake-modules
-, glib
-, gtk2
-, gtk3
-, karchive
-, kcmutils
-, kconfigwidgets
-, ki18n
-, kiconthemes
-, kio
-, knewstuff
+{
+  mkDerivation,
+  extra-cmake-modules,
+  glib, gtk2, gtk3, karchive, kcmutils, kconfigwidgets, ki18n, kiconthemes, kio,
+  knewstuff
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "kde-gtk-config";
-  patches = [ ./0001-follow-symlinks.patch ];
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
+  buildInputs = [
     ki18n kio glib gtk2 gtk3 karchive kcmutils kconfigwidgets kiconthemes
     knewstuff
   ];
+  patches = [ ./0001-follow-symlinks.patch ];
   cmakeFlags = [
     "-DGTK2_GLIBCONFIG_INCLUDE_DIR=${glib.out}/lib/glib-2.0/include"
     "-DGTK2_GDKCONFIG_INCLUDE_DIR=${gtk2.out}/lib/gtk-2.0/include"
diff --git a/pkgs/desktops/plasma-5/kdecoration.nix b/pkgs/desktops/plasma-5/kdecoration.nix
index 546f72c3f384..d8f996421ac9 100644
--- a/pkgs/desktops/plasma-5/kdecoration.nix
+++ b/pkgs/desktops/plasma-5/kdecoration.nix
@@ -1,7 +1,8 @@
-{ plasmaPackage, extra-cmake-modules, qtbase }:
+{ mkDerivation, extra-cmake-modules, qtbase }:
 
-plasmaPackage {
+mkDerivation {
   name = "kdecoration";
   nativeBuildInputs = [ extra-cmake-modules ];
   buildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/desktops/plasma-5/kdeplasma-addons.nix b/pkgs/desktops/plasma-5/kdeplasma-addons.nix
index 3371e17beaf8..b9f40563ef64 100644
--- a/pkgs/desktops/plasma-5/kdeplasma-addons.nix
+++ b/pkgs/desktops/plasma-5/kdeplasma-addons.nix
@@ -1,20 +1,17 @@
-{ plasmaPackage, extra-cmake-modules, kdoctools
-, kconfig, kconfigwidgets, kcoreaddons, kcmutils, kdelibs4support, ki18n
-, kio, knewstuff, kross, krunner, kservice, ksysguard, kunitconversion
-, plasma-framework, plasma-workspace, qtdeclarative, qtx11extras
-, ibus
+{
+  mkDerivation,
+  extra-cmake-modules, kdoctools,
+  kconfig, kconfigwidgets, kcoreaddons, kcmutils, kdelibs4support, ki18n, kio,
+  knewstuff, kross, krunner, kservice, ksysguard, kunitconversion, ibus,
+  plasma-framework, plasma-workspace, qtdeclarative, qtx11extras,
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "kdeplasma-addons";
-  nativeBuildInputs = [
-    extra-cmake-modules
-    kdoctools
-  ];
-  propagatedBuildInputs = [
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
     kconfig kconfigwidgets kcoreaddons kcmutils kdelibs4support kio knewstuff
-    kross krunner kservice ksysguard kunitconversion plasma-framework
+    kross krunner kservice ksysguard kunitconversion ibus plasma-framework
     plasma-workspace qtdeclarative qtx11extras
-    ibus
   ];
 }
diff --git a/pkgs/desktops/plasma-5/kgamma5.nix b/pkgs/desktops/plasma-5/kgamma5.nix
index 965c33e6eef8..ea58cad12ae0 100644
--- a/pkgs/desktops/plasma-5/kgamma5.nix
+++ b/pkgs/desktops/plasma-5/kgamma5.nix
@@ -1,9 +1,11 @@
-{ plasmaPackage, extra-cmake-modules, kdoctools, kdelibs4support
-, qtx11extras
+{
+  mkDerivation,
+  extra-cmake-modules, kdoctools,
+  kconfig, kconfigwidgets, ki18n, qtx11extras,
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "kgamma5";
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  propagatedBuildInputs = [ kdelibs4support qtx11extras ];
+  buildInputs = [ kconfig kconfigwidgets ki18n qtx11extras ];
 }
diff --git a/pkgs/desktops/plasma-5/khotkeys.nix b/pkgs/desktops/plasma-5/khotkeys.nix
index 2b02e5916b9f..abfb85a867c5 100644
--- a/pkgs/desktops/plasma-5/khotkeys.nix
+++ b/pkgs/desktops/plasma-5/khotkeys.nix
@@ -1,14 +1,16 @@
-{ plasmaPackage, extra-cmake-modules, kdoctools, kcmutils
-, kdbusaddons, kdelibs4support, kglobalaccel, ki18n, kio, kxmlgui
-, plasma-framework, plasma-workspace, qtx11extras
-, fetchpatch
+{
+  mkDerivation,
+  extra-cmake-modules, kdoctools,
+  kcmutils, kdbusaddons, kdelibs4support, kglobalaccel, ki18n, kio, kxmlgui,
+  plasma-framework, plasma-workspace, qtx11extras
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "khotkeys";
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  propagatedBuildInputs = [
-    kdelibs4support kglobalaccel ki18n kio plasma-framework plasma-workspace
-    qtx11extras kcmutils kdbusaddons kxmlgui
+  buildInputs = [
+    kcmutils kdbusaddons kdelibs4support kglobalaccel ki18n kio kxmlgui
+    plasma-framework plasma-workspace qtx11extras
   ];
+  outputs = [ "out" "dev" "bin" ];
 }
diff --git a/pkgs/desktops/plasma-5/kinfocenter.nix b/pkgs/desktops/plasma-5/kinfocenter.nix
index b4c8dc99adcb..d366aa4b36e4 100644
--- a/pkgs/desktops/plasma-5/kinfocenter.nix
+++ b/pkgs/desktops/plasma-5/kinfocenter.nix
@@ -1,15 +1,15 @@
 {
-  plasmaPackage,
+  mkDerivation,
   extra-cmake-modules, kdoctools,
   kcmutils, kcompletion, kconfig, kconfigwidgets, kcoreaddons, kdbusaddons,
   kdeclarative, kdelibs4support, ki18n, kiconthemes, kio, kpackage, kservice,
   kwayland, kwidgetsaddons, kxmlgui, libraw1394, mesa_glu, pciutils, solid
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "kinfocenter";
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  propagatedBuildInputs = [
+  buildInputs = [
     kcmutils kcompletion kconfig kconfigwidgets kcoreaddons kdbusaddons
     kdeclarative kdelibs4support ki18n kiconthemes kio kpackage kservice
     kwayland kwidgetsaddons kxmlgui libraw1394 mesa_glu pciutils solid
diff --git a/pkgs/desktops/plasma-5/kmenuedit.nix b/pkgs/desktops/plasma-5/kmenuedit.nix
index a27dc5dd92a8..016ea940d99b 100644
--- a/pkgs/desktops/plasma-5/kmenuedit.nix
+++ b/pkgs/desktops/plasma-5/kmenuedit.nix
@@ -1,14 +1,14 @@
 {
-  plasmaPackage,
+  mkDerivation,
   extra-cmake-modules, kdoctools,
   kdbusaddons, kdelibs4support, khotkeys, ki18n, kiconthemes, kio, kxmlgui,
   sonnet
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "kmenuedit";
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  propagatedBuildInputs = [
+  buildInputs = [
     kdbusaddons kdelibs4support khotkeys ki18n kiconthemes kio kxmlgui sonnet
   ];
 }
diff --git a/pkgs/desktops/plasma-5/kscreen.nix b/pkgs/desktops/plasma-5/kscreen.nix
index e0fbea5d7467..7fdaedbb78d7 100644
--- a/pkgs/desktops/plasma-5/kscreen.nix
+++ b/pkgs/desktops/plasma-5/kscreen.nix
@@ -1,13 +1,15 @@
-{ plasmaPackage, extra-cmake-modules, kconfig, kconfigwidgets
-, kdbusaddons, kglobalaccel, ki18n, kwidgetsaddons, kxmlgui
-, libkscreen, qtdeclarative, qtgraphicaleffects
+{
+  mkDerivation,
+  extra-cmake-modules,
+  kconfig, kconfigwidgets, kdbusaddons, kglobalaccel, ki18n, kwidgetsaddons,
+  kxmlgui, libkscreen, qtdeclarative, qtgraphicaleffects
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "kscreen";
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
-    kglobalaccel ki18n libkscreen qtdeclarative qtgraphicaleffects kconfig
-    kconfigwidgets kdbusaddons kwidgetsaddons kxmlgui
+  buildInputs = [
+    kconfig kconfigwidgets kdbusaddons kglobalaccel ki18n kwidgetsaddons kxmlgui
+    libkscreen qtdeclarative qtgraphicaleffects
   ];
 }
diff --git a/pkgs/desktops/plasma-5/kscreenlocker.nix b/pkgs/desktops/plasma-5/kscreenlocker.nix
index 3551feab76fc..e748121132c1 100644
--- a/pkgs/desktops/plasma-5/kscreenlocker.nix
+++ b/pkgs/desktops/plasma-5/kscreenlocker.nix
@@ -1,15 +1,17 @@
 {
-  plasmaPackage,
+  mkDerivation,
   extra-cmake-modules, kdoctools,
   kcmutils, kcrash, kdeclarative, kdelibs4support, kglobalaccel, kidletime,
-  kwayland, libXcursor, pam, plasma-framework, qtdeclarative, wayland
+  kwayland, libXcursor, pam, plasma-framework, qtdeclarative, qtx11extras,
+  wayland,
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "kscreenlocker";
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  propagatedBuildInputs = [
+  buildInputs = [
     kcmutils kcrash kdeclarative kdelibs4support kglobalaccel kidletime kwayland
-    libXcursor pam plasma-framework qtdeclarative wayland
+    libXcursor pam plasma-framework qtdeclarative qtx11extras wayland
   ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/desktops/plasma-5/ksshaskpass.nix b/pkgs/desktops/plasma-5/ksshaskpass.nix
index f1a6b82ae93c..39e260f6c708 100644
--- a/pkgs/desktops/plasma-5/ksshaskpass.nix
+++ b/pkgs/desktops/plasma-5/ksshaskpass.nix
@@ -1,9 +1,11 @@
-{ plasmaPackage, extra-cmake-modules, kdoctools, kcoreaddons
-, ki18n, kwallet, kwidgetsaddons
+{
+  mkDerivation,
+  extra-cmake-modules, kdoctools,
+  kcoreaddons, ki18n, kwallet, kwidgetsaddons, qtbase,
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "ksshaskpass";
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  propagatedBuildInputs = [ kcoreaddons ki18n kwallet kwidgetsaddons ];
+  buildInputs = [ kcoreaddons ki18n kwallet kwidgetsaddons qtbase ];
 }
diff --git a/pkgs/desktops/plasma-5/ksysguard.nix b/pkgs/desktops/plasma-5/ksysguard.nix
index 366b154cae70..150b97be50d7 100644
--- a/pkgs/desktops/plasma-5/ksysguard.nix
+++ b/pkgs/desktops/plasma-5/ksysguard.nix
@@ -1,17 +1,16 @@
 {
-  plasmaPackage,
+  mkDerivation,
   extra-cmake-modules, kdoctools,
   lm_sensors,
   kconfig, kcoreaddons, kdelibs4support, ki18n, kiconthemes, kitemviews,
   knewstuff, libksysguard, qtwebkit
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "ksysguard";
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  buildInputs = [ lm_sensors ];
-  propagatedBuildInputs = [
+  buildInputs = [
     kconfig kcoreaddons kitemviews knewstuff kiconthemes libksysguard
-    kdelibs4support ki18n qtwebkit
+    kdelibs4support ki18n lm_sensors qtwebkit
   ];
 }
diff --git a/pkgs/desktops/plasma-5/kwallet-pam.nix b/pkgs/desktops/plasma-5/kwallet-pam.nix
index 2789499c50a2..1cbfb87ea563 100644
--- a/pkgs/desktops/plasma-5/kwallet-pam.nix
+++ b/pkgs/desktops/plasma-5/kwallet-pam.nix
@@ -1,11 +1,10 @@
-{ plasmaPackage, extra-cmake-modules, pam, socat, libgcrypt
-}:
+{ mkDerivation, lib, extra-cmake-modules, pam, socat, libgcrypt, qtbase, }:
 
-plasmaPackage {
+mkDerivation {
   name = "kwallet-pam";
-
   nativeBuildInputs = [ extra-cmake-modules ];
-
-  buildInputs = [ pam socat libgcrypt ];
-
+  buildInputs = [ pam socat libgcrypt qtbase ];
+  postPatch = ''
+    sed -i pam_kwallet_init -e "s|socat|${lib.getBin socat}/bin/socat|"
+  '';
 }
diff --git a/pkgs/desktops/plasma-5/kwayland-integration.nix b/pkgs/desktops/plasma-5/kwayland-integration.nix
index 9045227a51a9..1344b477f736 100644
--- a/pkgs/desktops/plasma-5/kwayland-integration.nix
+++ b/pkgs/desktops/plasma-5/kwayland-integration.nix
@@ -1,16 +1,11 @@
-{ plasmaPackage
-, extra-cmake-modules
-, kidletime
-, kwayland
-, kwindowsystem
+{
+  mkDerivation,
+  extra-cmake-modules,
+  kidletime, kwayland, kwindowsystem, qtbase,
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "kwayland-integration";
-  nativeBuildInputs = [
-    extra-cmake-modules
-  ];
-  propagatedBuildInputs = [
-    kidletime kwindowsystem kwayland
-  ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ kidletime kwindowsystem kwayland qtbase ];
 }
diff --git a/pkgs/desktops/plasma-5/kwin/default.nix b/pkgs/desktops/plasma-5/kwin/default.nix
index a14b6433a76e..09708b654877 100644
--- a/pkgs/desktops/plasma-5/kwin/default.nix
+++ b/pkgs/desktops/plasma-5/kwin/default.nix
@@ -1,41 +1,45 @@
 {
-  plasmaPackage, lib, copyPathsToStore,
+  mkDerivation, lib, copyPathsToStore,
   extra-cmake-modules, kdoctools,
-  breeze-qt5, epoxy, kactivities, kcompletion, kcmutils, kconfig,
-  kconfigwidgets, kcoreaddons, kcrash, kdeclarative, kdecoration, kglobalaccel,
-  ki18n, kiconthemes, kidletime, kinit, kio, knewstuff, knotifications,
-  kpackage, kscreenlocker, kservice, kwayland, kwidgetsaddons, kwindowsystem,
-  kxmlgui, libICE, libSM, libinput, libxkbcommon, plasma-framework,
-  qtdeclarative, qtmultimedia, qtscript, qtx11extras, udev, wayland,
-  xcb-util-cursor, xwayland
+
+  epoxy,libICE, libSM, libinput, libxkbcommon, udev, wayland, xcb-util-cursor,
+  xwayland,
+
+  qtdeclarative, qtmultimedia, qtscript, qtx11extras,
+
+  breeze-qt5, kactivities, kcompletion, kcmutils, kconfig, kconfigwidgets,
+  kcoreaddons, kcrash, kdeclarative, kdecoration, kglobalaccel, ki18n,
+  kiconthemes, kidletime, kinit, kio, knewstuff, knotifications, kpackage,
+  kscreenlocker, kservice, kwayland, kwidgetsaddons, kwindowsystem, kxmlgui,
+  plasma-framework,
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "kwin";
-  nativeBuildInputs = [
-    extra-cmake-modules
-    kdoctools
-  ];
-  propagatedBuildInputs = [
-    breeze-qt5 epoxy kactivities kcmutils kcompletion kconfig kconfigwidgets
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    epoxy libICE libSM libinput libxkbcommon udev wayland xcb-util-cursor
+    xwayland
+
+    qtdeclarative qtmultimedia qtscript qtx11extras
+
+    breeze-qt5 kactivities kcmutils kcompletion kconfig kconfigwidgets
     kcoreaddons kcrash kdeclarative kdecoration kglobalaccel ki18n kiconthemes
     kidletime kinit kio knewstuff knotifications kpackage kscreenlocker kservice
-    kwayland kwidgetsaddons kwindowsystem kxmlgui libICE libSM libxkbcommon
-    libinput plasma-framework qtdeclarative qtmultimedia qtscript qtx11extras
-    udev wayland xcb-util-cursor xwayland
+    kwayland kwidgetsaddons kwindowsystem kxmlgui plasma-framework
   ];
+  outputs = [ "out" "dev" "bin" ];
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
-  postPatch = ''
-    substituteInPlace main_wayland.cpp \
-        --subst-var-by xwayland ${lib.getBin xwayland}/bin/Xwayland
-  '';
+  NIX_CFLAGS_COMPILE = [
+    ''-DNIXPKGS_XWAYLAND="${lib.getBin xwayland}/bin/Xwayland"''
+  ];
   cmakeFlags = [ "-DCMAKE_SKIP_BUILD_RPATH=OFF" ];
   postInstall = ''
     # Some package(s) refer to these service types by the wrong name.
     # I would prefer to patch those packages, but I cannot find them!
-    ln -s $out/share/kservicetypes5/kwineffect.desktop \
-          $out/share/kservicetypes5/kwin-effect.desktop
-    ln -s $out/share/kservicetypes5/kwinscript.desktop \
-          $out/share/kservicetypes5/kwin-script.desktop
+    ln -s ''${!outputBin}/share/kservicetypes5/kwineffect.desktop \
+          ''${!outputBin}/share/kservicetypes5/kwin-effect.desktop
+    ln -s ''${!outputBin}/share/kservicetypes5/kwinscript.desktop \
+          ''${!outputBin}/share/kservicetypes5/kwin-script.desktop
   '';
 }
diff --git a/pkgs/desktops/plasma-5/kwin/xwayland.patch b/pkgs/desktops/plasma-5/kwin/xwayland.patch
index 5fde01d08bf3..51f15c87d274 100644
--- a/pkgs/desktops/plasma-5/kwin/xwayland.patch
+++ b/pkgs/desktops/plasma-5/kwin/xwayland.patch
@@ -7,7 +7,7 @@ Index: kwin-5.7.3/main_wayland.cpp
      m_xwaylandProcess = new Process(kwinApp());
      m_xwaylandProcess->setProcessChannelMode(QProcess::ForwardedErrorChannel);
 -    m_xwaylandProcess->setProgram(QStringLiteral("Xwayland"));
-+    m_xwaylandProcess->setProgram(QStringLiteral("@xwayland@"));
++    m_xwaylandProcess->setProgram(QLatin1String(NIXPKGS_XWAYLAND));
      QProcessEnvironment env = m_environment;
      env.insert("WAYLAND_SOCKET", QByteArray::number(wlfd));
      m_xwaylandProcess->setProcessEnvironment(env);
diff --git a/pkgs/desktops/plasma-5/kwrited.nix b/pkgs/desktops/plasma-5/kwrited.nix
index 29498e93404d..f6f6187e9462 100644
--- a/pkgs/desktops/plasma-5/kwrited.nix
+++ b/pkgs/desktops/plasma-5/kwrited.nix
@@ -1,9 +1,11 @@
-{ plasmaPackage, extra-cmake-modules, kcoreaddons, ki18n, kpty
-, knotifications, kdbusaddons
+{
+  mkDerivation,
+  extra-cmake-modules,
+  kcoreaddons, kdbusaddons, ki18n, knotifications, kpty, qtbase,
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "kwrited";
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [ kcoreaddons ki18n kpty knotifications kdbusaddons ];
+  buildInputs = [ kcoreaddons kdbusaddons ki18n knotifications kpty qtbase ];
 }
diff --git a/pkgs/desktops/plasma-5/libkscreen/default.nix b/pkgs/desktops/plasma-5/libkscreen/default.nix
index afb2c20e90cc..b81755ed7579 100644
--- a/pkgs/desktops/plasma-5/libkscreen/default.nix
+++ b/pkgs/desktops/plasma-5/libkscreen/default.nix
@@ -1,19 +1,16 @@
-{ plasmaPackage, lib, copyPathsToStore
-, extra-cmake-modules
-, kwayland, libXrandr
-, qtx11extras
+{
+  mkDerivation, lib, copyPathsToStore,
+  extra-cmake-modules,
+  kwayland, libXrandr, qtx11extras
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "libkscreen";
-  nativeBuildInputs = [
-    extra-cmake-modules
-  ];
-  propagatedBuildInputs = [
-    kwayland libXrandr qtx11extras
-  ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ kwayland libXrandr qtx11extras ];
+  outputs = [ "out" "dev" ];
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
   preConfigure = ''
-    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_LIBKSCREEN_BACKENDS=\"''${!outputLib}/lib/qt5/plugins/kf5/kscreen\""
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_LIBKSCREEN_BACKENDS=\"''${!outputBin}/$qtPluginPrefix/kf5/kscreen\""
   '';
 }
diff --git a/pkgs/desktops/plasma-5/libkscreen/libkscreen-backends-path.patch b/pkgs/desktops/plasma-5/libkscreen/libkscreen-backends-path.patch
index 9d3cf49b9cd1..48be0d037df5 100644
--- a/pkgs/desktops/plasma-5/libkscreen/libkscreen-backends-path.patch
+++ b/pkgs/desktops/plasma-5/libkscreen/libkscreen-backends-path.patch
@@ -17,7 +17,7 @@ Index: libkscreen-5.9.4/src/backendmanager.cpp
 -        finfos.append(dir.entryInfoList());
 -    }
 -    return finfos;
-+    const QDir dir(QStringLiteral(NIXPKGS_LIBKSCREEN_BACKENDS),
++    const QDir dir(QLatin1String(NIXPKGS_LIBKSCREEN_BACKENDS),
 +                   QStringLiteral("KSC_*"),
 +                   QDir::SortFlags(QDir::QDir::Name),
 +                   QDir::NoDotAndDotDot | QDir::Files);
diff --git a/pkgs/desktops/plasma-5/libksysguard/default.nix b/pkgs/desktops/plasma-5/libksysguard/default.nix
index b67e041a7821..4e88cd3df0e7 100644
--- a/pkgs/desktops/plasma-5/libksysguard/default.nix
+++ b/pkgs/desktops/plasma-5/libksysguard/default.nix
@@ -1,20 +1,21 @@
 {
-  plasmaPackage,
+  mkDerivation,
   extra-cmake-modules,
   kauth, kcompletion, kconfig, kconfigwidgets, kcoreaddons, ki18n, kiconthemes,
   kservice, kwidgetsaddons, kwindowsystem, plasma-framework, qtscript, qtwebkit,
   qtx11extras
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "libksysguard";
   patches = [
     ./0001-qdiriterator-follow-symlinks.patch
   ];
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
+  buildInputs = [
     kauth kconfig ki18n kiconthemes kwindowsystem kcompletion kconfigwidgets
     kcoreaddons kservice kwidgetsaddons plasma-framework qtscript qtx11extras
     qtwebkit
   ];
+  outputs = [ "out" "dev" "bin" ];
 }
diff --git a/pkgs/desktops/plasma-5/milou.nix b/pkgs/desktops/plasma-5/milou.nix
index 43f78d9e2a97..fa4ad3fcd296 100644
--- a/pkgs/desktops/plasma-5/milou.nix
+++ b/pkgs/desktops/plasma-5/milou.nix
@@ -1,15 +1,15 @@
-{ plasmaPackage, extra-cmake-modules, qtscript, qtdeclarative
-, kcoreaddons, ki18n, kdeclarative, kservice, plasma-framework
-, krunner
+{
+  mkDerivation,
+  extra-cmake-modules,
+  kcoreaddons, kdeclarative, ki18n, krunner, kservice, plasma-framework,
+  qtscript, qtdeclarative,
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "milou";
-  nativeBuildInputs = [
-    extra-cmake-modules
-  ];
-  propagatedBuildInputs = [
-    kdeclarative ki18n krunner plasma-framework qtdeclarative qtscript
-    kcoreaddons kservice
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    kcoreaddons kdeclarative ki18n krunner kservice plasma-framework
+    qtdeclarative qtscript
   ];
 }
diff --git a/pkgs/desktops/plasma-5/oxygen.nix b/pkgs/desktops/plasma-5/oxygen.nix
index b4ff775264f8..97421191d905 100644
--- a/pkgs/desktops/plasma-5/oxygen.nix
+++ b/pkgs/desktops/plasma-5/oxygen.nix
@@ -1,21 +1,18 @@
 {
-  plasmaPackage, kdeWrapper,
+  mkDerivation,
   extra-cmake-modules,
   frameworkintegration, kcmutils, kcompletion, kconfig, kdecoration, kguiaddons,
-  ki18n, kwidgetsaddons, kservice, kwayland, kwindowsystem, qtx11extras
+  ki18n, kwidgetsaddons, kservice, kwayland, kwindowsystem, qtdeclarative,
+  qtx11extras
 }:
 
-let
-  unwrapped = plasmaPackage {
-    name = "oxygen";
-    nativeBuildInputs = [ extra-cmake-modules ];
-    propagatedBuildInputs = [
-      frameworkintegration kcmutils kcompletion kconfig kdecoration kguiaddons
-      ki18n kservice kwayland kwidgetsaddons kwindowsystem qtx11extras
-    ];
-  };
-in
-kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/oxygen-demo5" "bin/oxygen-settings5" ];
+mkDerivation {
+  name = "oxygen";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  propagatedBuildInputs = [
+    frameworkintegration kcmutils kcompletion kconfig kdecoration kguiaddons
+    ki18n kservice kwayland kwidgetsaddons kwindowsystem qtdeclarative
+    qtx11extras
+  ];
+  outputs = [ "out" "dev" "bin" ];
 }
diff --git a/pkgs/desktops/plasma-5/plasma-desktop/default.nix b/pkgs/desktops/plasma-5/plasma-desktop/default.nix
index 1c152500b6a0..18675159df6d 100644
--- a/pkgs/desktops/plasma-5/plasma-desktop/default.nix
+++ b/pkgs/desktops/plasma-5/plasma-desktop/default.nix
@@ -1,45 +1,50 @@
 {
-  plasmaPackage, lib, copyPathsToStore,
+  mkDerivation, lib, copyPathsToStore,
   extra-cmake-modules, kdoctools,
-  attica, baloo, boost, fontconfig, ibus, kactivities, kactivities-stats, kauth,
-  kcmutils, kdbusaddons, kdeclarative, kded, kdelibs4support, kemoticons,
-  kglobalaccel, ki18n, kitemmodels, knewstuff, knotifications, knotifyconfig,
-  kpeople, krunner, ksysguard, kwallet, kwin, libXcursor, libXft,
-  libcanberra_kde, libpulseaudio, libxkbfile, phonon, plasma-framework,
-  plasma-workspace, qtdeclarative, qtquickcontrols, qtquickcontrols2, qtsvg,
-  qtx11extras, xf86inputevdev, xf86inputsynaptics, xinput, xkeyboard_config,
-  xorgserver,
-  utillinux
+
+  boost, fontconfig, ibus, libXcursor, libXft, libcanberra_kde, libpulseaudio,
+  libxkbfile, xf86inputevdev, xf86inputsynaptics, xinput, xkeyboard_config,
+  xorgserver, utillinux,
+
+  qtdeclarative, qtquickcontrols, qtquickcontrols2, qtsvg, qtx11extras,
+
+  attica, baloo, kactivities, kactivities-stats, kauth, kcmutils, kdbusaddons,
+  kdeclarative, kded, kdelibs4support, kemoticons, kglobalaccel, ki18n,
+  kitemmodels, knewstuff, knotifications, knotifyconfig, kpeople, krunner,
+  kscreenlocker, ksysguard, kwallet, kwin, phonon, plasma-framework,
+  plasma-workspace,
 }:
 
-plasmaPackage rec {
+mkDerivation rec {
   name = "plasma-desktop";
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   buildInputs = [
-    attica boost fontconfig ibus kcmutils kdbusaddons kded kitemmodels knewstuff
-    knotifications knotifyconfig kwallet libcanberra_kde libXcursor
-    libpulseaudio libXft libxkbfile phonon qtsvg xf86inputevdev
-    xf86inputsynaptics xkeyboard_config xinput baloo kactivities
-    kactivities-stats kauth kdeclarative kdelibs4support kemoticons kglobalaccel
-    ki18n kpeople krunner kwin plasma-framework plasma-workspace qtdeclarative
-    qtquickcontrols qtquickcontrols2 qtx11extras ksysguard
+    boost fontconfig ibus libcanberra_kde libpulseaudio libXcursor libXft
+    libxkbfile phonon xf86inputevdev xf86inputsynaptics xinput xkeyboard_config
+
+    qtdeclarative qtquickcontrols qtquickcontrols2 qtsvg qtx11extras
+
+    attica baloo kactivities kactivities-stats kauth kcmutils kdbusaddons
+    kdeclarative kded kdelibs4support kemoticons kglobalaccel ki18n kitemmodels
+    knewstuff knotifications knotifyconfig kpeople krunner kscreenlocker
+    ksysguard kwallet kwin plasma-framework plasma-workspace
   ];
 
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
   postPatch = ''
-    substituteInPlace kcms/dateandtime/helper.cpp \
-        --subst-var hwclock "${utillinux}/sbin/hwclock"
-
     sed '1i#include <cmath>' -i kcms/touchpad/src/backends/x11/synapticstouchpad.cpp
   '';
-  NIX_CFLAGS_COMPILE = [ "-I${xorgserver.dev}/include/xorg" ];
+  NIX_CFLAGS_COMPILE = [
+    "-I${lib.getDev xorgserver}/include/xorg"
+    ''-DNIXPKGS_HWCLOCK="${lib.getBin utillinux}/sbin/hwclock"''
+  ];
   cmakeFlags = [
-    "-DEvdev_INCLUDE_DIRS=${xf86inputevdev.dev}/include/xorg"
-    "-DSynaptics_INCLUDE_DIRS=${xf86inputsynaptics.dev}/include/xorg"
+    "-DEvdev_INCLUDE_DIRS=${lib.getDev xf86inputevdev}/include/xorg"
+    "-DSynaptics_INCLUDE_DIRS=${lib.getDev xf86inputsynaptics}/include/xorg"
   ];
   postInstall = ''
     # Display ~/Desktop contents on the desktop by default.
-    sed -i "$out/share/plasma/shells/org.kde.plasma.desktop/contents/defaults" \
+    sed -i "''${!outputBin}/share/plasma/shells/org.kde.plasma.desktop/contents/defaults" \
         -e 's/Containment=org.kde.desktopcontainment/Containment=org.kde.plasma.folder/'
   '';
 }
diff --git a/pkgs/desktops/plasma-5/plasma-desktop/hwclock-path.patch b/pkgs/desktops/plasma-5/plasma-desktop/hwclock-path.patch
index 5623de84668f..a46212af10fb 100644
--- a/pkgs/desktops/plasma-5/plasma-desktop/hwclock-path.patch
+++ b/pkgs/desktops/plasma-5/plasma-desktop/hwclock-path.patch
@@ -18,7 +18,7 @@ Index: plasma-desktop-5.8.5/kcms/dateandtime/helper.cpp
  void ClockHelper::toHwclock()
  {
 -    QString hwclock = KStandardDirs::findExe(QStringLiteral("hwclock"), exePath);
-+    QString hwclock = "@hwclock@";
++    QString hwclock = QLatin1String(NIXPKGS_HWCLOCK);
      if (!hwclock.isEmpty()) {
          KProcess::execute(hwclock, QStringList() << QStringLiteral("--systohc"));
      }
diff --git a/pkgs/desktops/plasma-5/plasma-integration.nix b/pkgs/desktops/plasma-5/plasma-integration.nix
index 97d30dcd7732..de46bb4373c6 100644
--- a/pkgs/desktops/plasma-5/plasma-integration.nix
+++ b/pkgs/desktops/plasma-5/plasma-integration.nix
@@ -1,17 +1,17 @@
-{ plasmaPackage, extra-cmake-modules
-, breeze-qt5, kconfig, kconfigwidgets, kiconthemes, kio, kwayland
-, libXcursor
+{
+  mkDerivation,
+  extra-cmake-modules,
+  breeze-qt5, kconfig, kconfigwidgets, kiconthemes, kio, knotifications,
+  kwayland, libXcursor
 }:
 
 # TODO: install Noto Sans and Oxygen Mono fonts with plasma-integration
 
-plasmaPackage {
+mkDerivation {
   name = "plasma-integration";
-  nativeBuildInputs = [
-    extra-cmake-modules
-  ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   buildInputs = [
-    breeze-qt5 kconfig kconfigwidgets kiconthemes kio kwayland
+    breeze-qt5 kconfig kconfigwidgets kiconthemes kio knotifications kwayland
     libXcursor
   ];
 }
diff --git a/pkgs/desktops/plasma-5/plasma-nm/default.nix b/pkgs/desktops/plasma-5/plasma-nm/default.nix
index 736d59b40412..cc1dcb7ee9f7 100644
--- a/pkgs/desktops/plasma-5/plasma-nm/default.nix
+++ b/pkgs/desktops/plasma-5/plasma-nm/default.nix
@@ -1,14 +1,23 @@
-{ plasmaPackage, substituteAll, extra-cmake-modules, kdoctools
-, kcompletion, kconfigwidgets, kcoreaddons, kdbusaddons, kdeclarative
-, kdelibs4support, ki18n, kiconthemes, kinit, kio, kitemviews
-, knotifications, kservice, kwallet, kwidgetsaddons, kwindowsystem
-, kxmlgui, mobile_broadband_provider_info
-, modemmanager-qt, networkmanager-qt, openconnect, plasma-framework
-, qca-qt5, qtdeclarative, solid, openvpn
+{
+  mkDerivation, substituteAll,
+  extra-cmake-modules, kdoctools,
+  kcompletion, kconfigwidgets, kcoreaddons, kdbusaddons, kdeclarative,
+  kdelibs4support, ki18n, kiconthemes, kinit, kio, kitemviews, knotifications,
+  kservice, kwallet, kwidgetsaddons, kwindowsystem, kxmlgui,
+  mobile_broadband_provider_info, modemmanager-qt, networkmanager-qt,
+  openconnect, openvpn, plasma-framework, qca-qt5, qtdeclarative, qttools, solid
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "plasma-nm";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools qttools ];
+  buildInputs = [
+    kdeclarative kdelibs4support ki18n kio kwindowsystem plasma-framework
+    qtdeclarative kcompletion kconfigwidgets kcoreaddons kdbusaddons kiconthemes
+    kinit kitemviews knotifications kservice kwallet kwidgetsaddons kxmlgui
+    mobile_broadband_provider_info modemmanager-qt networkmanager-qt openconnect
+    qca-qt5 solid
+  ];
   patches = [
     (substituteAll {
       src = ./0001-mobile-broadband-provider-info-path.patch;
@@ -19,13 +28,4 @@ plasmaPackage {
       inherit openvpn;
     })
   ];
-  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  propagatedBuildInputs = [
-    kdeclarative kdelibs4support ki18n kio kwindowsystem plasma-framework
-    qtdeclarative kcompletion kconfigwidgets kcoreaddons kdbusaddons kiconthemes
-    kinit kitemviews knotifications kservice kwallet kwidgetsaddons kxmlgui
-    mobile_broadband_provider_info modemmanager-qt networkmanager-qt openconnect
-    qca-qt5 solid
-  ];
-  enableParallelBuilding = true;
 }
diff --git a/pkgs/desktops/plasma-5/plasma-pa.nix b/pkgs/desktops/plasma-5/plasma-pa.nix
index f398e1a9efc0..50f53d70a987 100644
--- a/pkgs/desktops/plasma-5/plasma-pa.nix
+++ b/pkgs/desktops/plasma-5/plasma-pa.nix
@@ -1,17 +1,15 @@
 {
-  plasmaPackage,
-  extra-cmake-modules,
-  gconf, glib, kdoctools, kconfigwidgets, kcoreaddons, kdeclarative, kglobalaccel,
-  ki18n, libcanberra_gtk3, libpulseaudio, plasma-framework
+  mkDerivation,
+  extra-cmake-modules, kdoctools,
+  gconf, glib, kconfigwidgets, kcoreaddons, kdeclarative, kglobalaccel, ki18n,
+  libcanberra_gtk3, libpulseaudio, plasma-framework, qtdeclarative
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "plasma-pa";
-  nativeBuildInputs = [
-    extra-cmake-modules kdoctools
-  ];
-  propagatedBuildInputs = [
-    gconf glib kconfigwidgets kcoreaddons kdeclarative
-    kglobalaccel ki18n libcanberra_gtk3 libpulseaudio plasma-framework
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    gconf glib kconfigwidgets kcoreaddons kdeclarative kglobalaccel ki18n
+    libcanberra_gtk3 libpulseaudio plasma-framework qtdeclarative
   ];
 }
diff --git a/pkgs/desktops/plasma-5/plasma-workspace-wallpapers.nix b/pkgs/desktops/plasma-5/plasma-workspace-wallpapers.nix
index 8af9caaa5795..cb068166c1d9 100644
--- a/pkgs/desktops/plasma-5/plasma-workspace-wallpapers.nix
+++ b/pkgs/desktops/plasma-5/plasma-workspace-wallpapers.nix
@@ -1,11 +1,6 @@
-{ plasmaPackage
-, extra-cmake-modules
-}:
+{ mkDerivation , extra-cmake-modules }:
 
-plasmaPackage {
+mkDerivation {
   name = "plasma-workspace-wallpapers";
-  outputs = [ "out" ];
-  nativeBuildInputs = [
-    extra-cmake-modules
-  ];
+  nativeBuildInputs = [ extra-cmake-modules ];
 }
diff --git a/pkgs/desktops/plasma-5/plasma-workspace/default.nix b/pkgs/desktops/plasma-5/plasma-workspace/default.nix
index 8759c7d8c1e7..29d92f9a9df3 100644
--- a/pkgs/desktops/plasma-5/plasma-workspace/default.nix
+++ b/pkgs/desktops/plasma-5/plasma-workspace/default.nix
@@ -1,44 +1,47 @@
 {
-  plasmaPackage, lib, copyPathsToStore,
+  mkDerivation, lib, copyPathsToStore,
 
   extra-cmake-modules, kdoctools,
 
+  isocodes, libdbusmenu, libSM, libXcursor, pam, wayland,
+
   baloo, kactivities, kcmutils, kconfig, kcrash, kdbusaddons, kdeclarative,
   kdelibs4support, kdesu, kglobalaccel, kidletime, kjsembed, knewstuff,
-  knotifyconfig, kpackage, krunner, ktexteditor, ktextwidgets, kwallet,
-  kwayland, kwin, kxmlrpcclient, libkscreen, libksysguard, networkmanager-qt,
-  phonon, plasma-framework, qtgraphicaleffects, qtquickcontrols,
-  qtquickcontrols2, qtscript, qtx11extras, solid, isocodes, libdbusmenu, libSM,
-  libXcursor, pam, wayland
+  knotifyconfig, kpackage, krunner, kscreenlocker, ktexteditor, ktextwidgets,
+  kwallet, kwayland, kwin, kxmlrpcclient, libkscreen, libksysguard,
+  networkmanager-qt, phonon, plasma-framework, prison, solid,
+
+  qtgraphicaleffects, qtquickcontrols, qtquickcontrols2, qtscript, qtx11extras,
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "plasma-workspace";
 
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   buildInputs = [
     isocodes libdbusmenu libSM libXcursor pam wayland
-  ];
-  propagatedBuildInputs = [
+
     baloo kactivities kcmutils kconfig kcrash kdbusaddons kdeclarative
     kdelibs4support kdesu kglobalaccel kidletime kjsembed knewstuff
-    knotifyconfig kpackage krunner ktexteditor ktextwidgets kwallet kwayland
-    kwin kxmlrpcclient libkscreen libksysguard networkmanager-qt phonon
-    plasma-framework solid qtgraphicaleffects qtquickcontrols qtquickcontrols2
-    qtscript qtx11extras
+    knotifyconfig kpackage krunner kscreenlocker ktexteditor ktextwidgets
+    kwallet kwayland kwin kxmlrpcclient libkscreen libksysguard
+    networkmanager-qt phonon plasma-framework prison solid
+
+    qtgraphicaleffects qtquickcontrols qtquickcontrols2 qtscript qtx11extras
   ];
+  outputs = [ "out" "dev" "bin" ];
 
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
 
   postPatch = ''
     substituteInPlace startkde/kstartupconfig/kstartupconfig.cpp \
-        --replace kdostartupconfig5 $out/bin/kdostartupconfig5
+        --replace kdostartupconfig5 ''${!outputBin}/bin/kdostartupconfig5
   '';
 
   postInstall = ''
-    rm "$out/bin/startkde"
-    rm "$out/bin/startplasmacompositor"
-    rm "$out/lib/libexec/startplasma"
-    rm -r "$out/share/wayland-sessions"
+    rm "''${!outputBin}/bin/startkde"
+    rm "''${!outputBin}/bin/startplasmacompositor"
+    rm "''${!outputLib}/lib/libexec/startplasma"
+    rm -r "''${!outputBin}/share/wayland-sessions"
   '';
 }
diff --git a/pkgs/desktops/plasma-5/polkit-kde-agent.nix b/pkgs/desktops/plasma-5/polkit-kde-agent.nix
index 1d7d20a7ffbf..bd3e5d6e1f4b 100644
--- a/pkgs/desktops/plasma-5/polkit-kde-agent.nix
+++ b/pkgs/desktops/plasma-5/polkit-kde-agent.nix
@@ -1,10 +1,10 @@
 {
-  plasmaPackage, extra-cmake-modules,
+  mkDerivation, extra-cmake-modules,
   kcoreaddons, kconfig, kcrash, kdbusaddons, ki18n, kiconthemes, knotifications,
   kwidgetsaddons, kwindowsystem, polkit-qt
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "polkit-kde-agent";
   nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
diff --git a/pkgs/desktops/plasma-5/powerdevil.nix b/pkgs/desktops/plasma-5/powerdevil.nix
index c3469cc2ebc8..65fc5446c16e 100644
--- a/pkgs/desktops/plasma-5/powerdevil.nix
+++ b/pkgs/desktops/plasma-5/powerdevil.nix
@@ -1,13 +1,15 @@
-{ plasmaPackage, extra-cmake-modules, kdoctools, bluez-qt, kactivities
-, kauth, kconfig, kdbusaddons, kdelibs4support, kglobalaccel, ki18n
-, kidletime, kio, knotifyconfig, kwayland, libkscreen, networkmanager-qt
-, plasma-workspace, qtx11extras, solid, udev
+{
+  mkDerivation,
+  extra-cmake-modules, kdoctools,
+  bluez-qt, kactivities, kauth, kconfig, kdbusaddons, kdelibs4support,
+  kglobalaccel, ki18n, kidletime, kio, knotifyconfig, kwayland, libkscreen,
+  networkmanager-qt, plasma-workspace, qtx11extras, solid, udev
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "powerdevil";
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  propagatedBuildInputs = [
+  buildInputs = [
     kconfig kdbusaddons knotifyconfig solid udev bluez-qt kactivities kauth
     kdelibs4support kglobalaccel ki18n kio kidletime kwayland libkscreen
     networkmanager-qt plasma-workspace qtx11extras
diff --git a/pkgs/desktops/plasma-5/startkde/default.nix b/pkgs/desktops/plasma-5/startkde/default.nix
index 87c72fdc5995..3b04c037073d 100644
--- a/pkgs/desktops/plasma-5/startkde/default.nix
+++ b/pkgs/desktops/plasma-5/startkde/default.nix
@@ -1,54 +1,41 @@
 {
-  stdenv, lib, runCommand, dbus, qttools, socat, gnugrep, gnused, kconfig,
-  kinit, kservice, plasma-workspace, xmessage, xprop, xsetroot, qtbase,
-  qtdeclarative, qtgraphicaleffects, qtquickcontrols, qtquickcontrols2,
-  qtscript, qtsvg, qtx11extras, qtxmlpatterns
+  stdenv, lib, runCommand, substituteAll, dbus, gnugrep, gnused, kconfig,
+  kinit, kservice, plasma-desktop, plasma-workspace, xmessage, xprop, xrdb,
+  xsetroot, qttools,
 }:
 
 let
 
-  env = {
+  inherit (lib) getBin getLib;
+
+  script = substituteAll {
+    src = ./startkde.sh;
     inherit (stdenv) shell;
-    bins = builtins.map (pkg: pkg.out or pkg)
-      [
-        dbus qttools socat
-        gnugrep gnused
-        kconfig kinit kservice
-        plasma-workspace
-        xmessage xprop xsetroot
-      ];
-    libs = builtins.map (pkg: pkg.out or pkg)
-      [
-        qtbase qtdeclarative qtgraphicaleffects qtquickcontrols qtquickcontrols2
-        qtscript qtsvg qtx11extras qtxmlpatterns
-      ];
+    kbuildsycoca5 = "${getBin kservice}/bin/kbuildsycoca5";
+    sed = "${getBin gnused}/bin/sed";
+    kcheckrunning = "${getBin plasma-workspace}/bin/kcheckrunning";
+    xmessage = "${getBin xmessage}/bin/xmessage";
+    kstartupconfig5 = "${getBin plasma-workspace}/bin/kstartupconfig5";
+    kapplymousetheme = "${getBin plasma-desktop}/bin/kapplymousetheme";
+    xsetroot = "${getBin xsetroot}/bin/xsetroot";
+    xrdb = "${getBin xrdb}/bin/xrdb";
+    ksplashqml = "${getBin plasma-workspace}/bin/ksplashqml";
+    qdbus = "${getBin qttools}/bin/qdbus";
+    xprop = "${getBin xprop}/bin/xprop";
+    qtpaths = "${getBin qttools}/bin/qtpaths";
+    dbus_update_activation_environment = "${getBin dbus}/bin/dbus-update-activation-environment";
+    start_kdeinit_wrapper = "${getLib kinit}/lib/libexec/kf5/start_kdeinit_wrapper";
+    kwrapper5 = "${getBin kinit}/bin/kwrapper5";
+    ksmserver = "${getBin plasma-workspace}/bin/ksmserver";
+    kreadconfig5 = "${getBin kconfig}/bin/kreadconfig5";
+    kdeinit5_shutdown = "${getBin kinit}/bin/kdeinit5_shutdown";
   };
 
-in runCommand "startkde" env ''
-
-  # Configure PATH variable
-  suffixPATH=
-  for p in $bins; do
-      addToSearchPath suffixPATH "$p/bin"
-      addToSearchPath suffixPATH "$p/lib/libexec"
-      addToSearchPath suffixPATH "$p/lib/libexec/kf5"
-  done
+in
 
-  # Configure Qt search paths
-  QT_PLUGIN_PATH=
-  QML_IMPORT_PATH=
-  QML2_IMPORT_PATH=
-  for p in $libs; do
-      addToSearchPath QT_PLUGIN_PATH "$p/lib/qt5/plugins"
-      addToSearchPath QML_IMPORT_PATH "$p/lib/qt5/imports"
-      addToSearchPath QML2_IMPORT_PATH "$p/lib/qt5/qml"
-  done
-
-  substitute ${./startkde.sh} "$out" \
-      --subst-var shell \
-      --subst-var suffixPATH \
-      --subst-var QT_PLUGIN_PATH \
-      --subst-var QML_IMPORT_PATH \
-      --subst-var QML2_IMPORT_PATH
-  chmod +x "$out"
+runCommand "startkde.sh"
+{ preferLocalBuild = true; allowSubstitutes = false; }
+''
+  cp ${script} $out
+  chmod +x $out
 ''
diff --git a/pkgs/desktops/plasma-5/startkde/startkde.sh b/pkgs/desktops/plasma-5/startkde/startkde.sh
index c38450516e91..f8b4f4844e23 100755
--- a/pkgs/desktops/plasma-5/startkde/startkde.sh
+++ b/pkgs/desktops/plasma-5/startkde/startkde.sh
@@ -1,12 +1,6 @@
 #!@shell@
 
-PATH="$PATH${PATH:+:}@suffixPATH@"
-
-export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}@QT_PLUGIN_PATH@"
-export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}@QML_IMPORT_PATH@"
-export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}@QML2_IMPORT_PATH@"
-
-kbuildsycoca5
+@kbuildsycoca5@
 
 # Set the default GTK 2 theme
 if ! [ -e $HOME/.gtkrc-2.0 ] \
@@ -32,6 +26,7 @@ fi
 
 if ! [ -e $HOME/.config/gtk-3.0/settings.ini ] \
        && [ -e /run/current-system/sw/share/themes/Breeze/gtk-3.0 ]; then
+    mkdir -p $HOME/.config/gtk-3.0
     cat >$HOME/.config/gtk-3.0/settings.ini <<EOF
 [Settings]
 gtk-font-name=Sans Serif Regular 10
@@ -63,7 +58,7 @@ rm -fv $HOME/.cache/icon-cache.kcache
 # in Trolltech.conf.  A better solution would be to stop
 # Qt from doing this wackiness in the first place.
 if [ -e $HOME/.config/Trolltech.conf ]; then
-    sed -e '/nix\\store\|nix\/store/ d' -i $HOME/.config/Trolltech.conf
+    @sed@ -e '/nix\\store\|nix\/store/ d' -i $HOME/.config/Trolltech.conf
 fi
 
 if test "x$1" = x--failsafe; then
@@ -81,11 +76,11 @@ trap 'echo GOT SIGHUP' HUP
 unset DYLD_FORCE_FLAT_NAMESPACE
 
 # Check if a KDE session already is running and whether it's possible to connect to X
-kcheckrunning
+@kcheckrunning@
 kcheckrunning_result=$?
 if test $kcheckrunning_result -eq 0 ; then
     echo "KDE seems to be already running on this display."
-    xmessage -geometry 500x100 "KDE seems to be already running on this display."
+    @xmessage@ -geometry 500x100 "KDE seems to be already running on this display."
     exit 1
 elif test $kcheckrunning_result -eq 2 ; then
     echo "\$DISPLAY is not set or cannot connect to the X server."
@@ -107,7 +102,7 @@ fi
 # * Then ksmserver is started which takes control of the rest of the startup sequence
 
 # We need to create config folder so we can write startupconfigkeys
-configDir=$(qtpaths --writable-path GenericConfigLocation)
+configDir=$(@qtpaths@ --writable-path GenericConfigLocation)
 mkdir -p "$configDir"
 
 if ! [ -e $configDir/kcminputrc ]; then
@@ -164,10 +159,10 @@ activeFont=Noto Sans,12,-1,5,50,0,0,0,0,0,Bold
 EOF
 }
 
-kstartupconfig5
+@kstartupconfig5@
 returncode=$?
 if test $returncode -ne 0; then
-    xmessage -geometry 500x100 "kstartupconfig5 does not exist or fails. The error code is $returncode. Check your installation."
+    @xmessage@ -geometry 500x100 "kstartupconfig5 does not exist or fails. The error code is $returncode. Check your installation."
     exit 1
 fi
 [ -r $configDir/startupconfig ] && . $configDir/startupconfig
@@ -189,7 +184,7 @@ export XCURSOR_PATH
 # XCursor mouse theme needs to be applied here to work even for kded or ksmserver
 if test -n "$kcminputrc_mouse_cursortheme" -o -n "$kcminputrc_mouse_cursorsize" ; then
 
-    kapplymousetheme "$kcminputrc_mouse_cursortheme" "$kcminputrc_mouse_cursorsize"
+    @kapplymousetheme@ "$kcminputrc_mouse_cursortheme" "$kcminputrc_mouse_cursorsize"
     if test $? -eq 10; then
         XCURSOR_THEME=breeze_cursors
         export XCURSOR_THEME
@@ -213,10 +208,10 @@ unset THEME
 # If the user has overwritten fonts, the cursor font may be different now
 # so don't move this up.
 #
-xsetroot -cursor_name left_ptr
+@xsetroot@ -cursor_name left_ptr
 
 if test "$kcmfonts_general_forcefontdpi" -ne 0; then
-    xrdb -quiet -merge -nocpp <<EOF
+    @xrdb@ -quiet -merge -nocpp <<EOF
 Xft.dpi: $kcmfonts_general_forcefontdpi
 EOF
 fi
@@ -229,7 +224,7 @@ if test -z "$dl"; then
   # the splashscreen and progress indicator
   case "$ksplashrc_ksplash_engine" in
     KSplashQML)
-      ksplash_pid=$(ksplashqml "${ksplashrc_ksplash_theme}" --pid)
+      ksplash_pid=$(@ksplashqml@ "${ksplashrc_ksplash_theme}" --pid)
       ;;
     None)
       ;;
@@ -241,12 +236,12 @@ fi
 echo 'startkde: Starting up...'  1>&2
 
 # Make sure that D-Bus is running
-if qdbus >/dev/null 2>/dev/null; then
+if @qdbus@ >/dev/null 2>/dev/null; then
     : # ok
 else
     echo 'startkde: Could not start D-Bus. Can you call qdbus?'  1>&2
     test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
-    xmessage -geometry 500x100 "Could not start D-Bus. Can you call qdbus?"
+    @xmessage@ -geometry 500x100 "Could not start D-Bus. Can you call qdbus?"
     exit 1
 fi
 
@@ -274,11 +269,11 @@ fi
 #
 KDE_FULL_SESSION=true
 export KDE_FULL_SESSION
-xprop -root -f KDE_FULL_SESSION 8t -set KDE_FULL_SESSION true
+@xprop@ -root -f KDE_FULL_SESSION 8t -set KDE_FULL_SESSION true
 
 KDE_SESSION_VERSION=5
 export KDE_SESSION_VERSION
-xprop -root -f KDE_SESSION_VERSION 32c -set KDE_SESSION_VERSION 5
+@xprop@ -root -f KDE_SESSION_VERSION 32c -set KDE_SESSION_VERSION 5
 
 KDE_SESSION_UID=$(id -ru)
 export KDE_SESSION_UID
@@ -300,7 +295,7 @@ export XDG_CURRENT_DESKTOP
 # For anything else (that doesn't set env vars, or that needs a window manager),
 # better use the Autostart folder.
 
-IFS=":" read -r -a scriptpath <<< $(qtpaths --paths GenericConfigLocation)
+IFS=":" read -r -a scriptpath <<< $(@qtpaths@ --paths GenericConfigLocation)
 # Add /env/ to the directory to locate the scripts to be sourced
 for prefix in "${scriptpath[@]}"; do
   for file in "$prefix"/plasma-workspace/env/*.sh; do
@@ -308,37 +303,28 @@ for prefix in "${scriptpath[@]}"; do
   done
 done
 
-# At this point all the environment is ready, let's send it to kwalletd if running
-if test -n "$PAM_KWALLET_LOGIN" ; then
-    env | socat STDIN UNIX-CONNECT:$PAM_KWALLET_LOGIN
-fi
-# ...and also to kwalletd5
-if test -n "$PAM_KWALLET5_LOGIN" ; then
-    env | socat STDIN UNIX-CONNECT:$PAM_KWALLET5_LOGIN
-fi
-
 # At this point all environment variables are set, let's send it to the DBus session server to update the activation environment
-dbus-update-activation-environment --systemd --all
+@dbus_update_activation_environment@ --systemd --all
 if test $? -ne 0; then
   # Startup error
   echo 'startkde: Could not sync environment to dbus.'  1>&2
   test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
-  xmessage -geometry 500x100 "Could not sync environment to dbus."
+  @xmessage@ -geometry 500x100 "Could not sync environment to dbus."
   exit 1
 fi
 
 # We set LD_BIND_NOW to increase the efficiency of kdeinit.
 # kdeinit unsets this variable before loading applications.
-LD_BIND_NOW=true start_kdeinit_wrapper --kded +kcminit_startup
+LD_BIND_NOW=true @start_kdeinit_wrapper@ --kded +kcminit_startup
 if test $? -ne 0; then
   # Startup error
   echo 'startkde: Could not start kdeinit5. Check your installation.'  1>&2
   test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
-  xmessage -geometry 500x100 "Could not start kdeinit5. Check your installation."
+  @xmessage@ -geometry 500x100 "Could not start kdeinit5. Check your installation."
   exit 1
 fi
 
-qdbus org.kde.KSplash /KSplash org.kde.KSplash.setStage kinit
+@qdbus@ org.kde.KSplash /KSplash org.kde.KSplash.setStage kinit
 
 # finally, give the session control to the session manager
 # see kdebase/ksmserver for the description of the rest of the startup sequence
@@ -355,15 +341,15 @@ test -n "$KDEWM" && KDEWM="--windowmanager $KDEWM"
 # lock now and do the rest of the KDE startup underneath the locker.
 KSMSERVEROPTIONS=""
 test -n "$dl" && KSMSERVEROPTIONS=" --lockscreen"
-kwrapper5 ksmserver $KDEWM $KSMSERVEROPTIONS
+@kwrapper5@ @ksmserver@ $KDEWM $KSMSERVEROPTIONS
 if test $? -eq 255; then
   # Startup error
   echo 'startkde: Could not start ksmserver. Check your installation.'  1>&2
   test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
-  xmessage -geometry 500x100 "Could not start ksmserver. Check your installation."
+  @xmessage@ -geometry 500x100 "Could not start ksmserver. Check your installation."
 fi
 
-wait_drkonqi=$(kreadconfig5 --file startkderc --group WaitForDrKonqi --key Enabled --default true)
+wait_drkonqi=$(@kreadconfig5@ --file startkderc --group WaitForDrKonqi --key Enabled --default true)
 
 if test x"$wait_drkonqi"x = x"true"x ; then
     # wait for remaining drkonqi instances with timeout (in seconds)
@@ -374,8 +360,8 @@ if test x"$wait_drkonqi"x = x"true"x ; then
         wait_drkonqi_counter=$((wait_drkonqi_counter+5))
         if test "$wait_drkonqi_counter" -ge "$wait_drkonqi_timeout" ; then
             # ask remaining drkonqis to die in a graceful way
-            qdbus | grep 'org.kde.drkonqi-' | while read address ; do
-                qdbus "$address" "/MainApplication" "quit"
+            @qdbus@ | grep 'org.kde.drkonqi-' | while read address ; do
+                @qdbus@ "$address" "/MainApplication" "quit"
             done
             break
         fi
@@ -387,12 +373,12 @@ echo 'startkde: Shutting down...'  1>&2
 test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
 
 # Clean up
-kdeinit5_shutdown
+@kdeinit5_shutdown@
 
 unset KDE_FULL_SESSION
-xprop -root -remove KDE_FULL_SESSION
+@xprop@ -root -remove KDE_FULL_SESSION
 unset KDE_SESSION_VERSION
-xprop -root -remove KDE_SESSION_VERSION
+@xprop@ -root -remove KDE_SESSION_VERSION
 unset KDE_SESSION_UID
 
 echo 'startkde: Done.'  1>&2
diff --git a/pkgs/desktops/plasma-5/systemsettings.nix b/pkgs/desktops/plasma-5/systemsettings.nix
index 4146e34c2f73..a24eabc39f31 100644
--- a/pkgs/desktops/plasma-5/systemsettings.nix
+++ b/pkgs/desktops/plasma-5/systemsettings.nix
@@ -1,14 +1,15 @@
 {
-  plasmaPackage, extra-cmake-modules, kdoctools, makeQtWrapper,
+  mkDerivation, extra-cmake-modules, kdoctools,
   kcmutils, kconfig, kdbusaddons, khtml, ki18n, kiconthemes, kio, kitemviews,
   kservice, kwindowsystem, kxmlgui, qtquickcontrols, qtquickcontrols2
 }:
 
-plasmaPackage {
+mkDerivation {
   name = "systemsettings";
-  nativeBuildInputs = [ extra-cmake-modules kdoctools makeQtWrapper ];
-  propagatedBuildInputs = [
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
     kcmutils kconfig kdbusaddons khtml ki18n kiconthemes kio kitemviews kservice
     kwindowsystem kxmlgui qtquickcontrols qtquickcontrols2
   ];
+  outputs = [ "out" "dev" "bin" ];
 }
diff --git a/pkgs/development/compilers/gerbil/default.nix b/pkgs/development/compilers/gerbil/default.nix
index 1bffd1bd1c84..7ea403715a53 100644
--- a/pkgs/development/compilers/gerbil/default.nix
+++ b/pkgs/development/compilers/gerbil/default.nix
@@ -3,10 +3,10 @@
 stdenv.mkDerivation rec {
   name    = "gerbil-${version}";
 
-  version = "0.10";
+  version = "0.11";
   src = fetchurl {
     url    = "https://github.com/vyzo/gerbil/archive/v${version}.tar.gz";
-    sha256 = "14wzdnifr99g1mvm2xwks97nhaq62hfx43pxcw9gs647i7cymbly";
+    sha256 = "0mqg6cqdcf5qr7vk79x5zkls7z2wm8i3lhwn0b7i0g1m6yyyyff7";
   };
 
   buildInputs = [ gambit openssl zlib coreutils rsync bash ];
@@ -46,7 +46,7 @@ EOF
   dontStrip = true;
 
   meta = {
-    description = "Gerbil";
+    description = "Gerbil Scheme";
     homepage    = "https://github.com/vyzo/gerbil";
     license     = stdenv.lib.licenses.lgpl2;
     platforms   = stdenv.lib.platforms.linux;
diff --git a/pkgs/development/compilers/ghc/8.2.1.nix b/pkgs/development/compilers/ghc/8.2.1.nix
new file mode 100644
index 000000000000..6b0cdf4fbdc5
--- /dev/null
+++ b/pkgs/development/compilers/ghc/8.2.1.nix
@@ -0,0 +1,117 @@
+{ stdenv, lib, fetchurl, bootPkgs, perl, ncurses, libiconv, binutils, coreutils
+, autoconf, automake, happy, alex, python3, sphinx, hscolour
+, buildPlatform, targetPlatform , selfPkgs, cross ? null
+
+  # If enabled GHC will be build with the GPL-free but slower integer-simple
+  # library instead of the faster but GPLed integer-gmp library.
+, enableIntegerSimple ? false, gmp
+}:
+
+let
+  inherit (bootPkgs) ghc;
+  version = "8.2.1-rc2";
+  preReleaseName = "ghc-8.2.0.20170507";
+  commonBuildInputs = [ alex autoconf automake ghc happy hscolour perl python3 sphinx ];
+  commonPreConfigure =  ''
+    sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
+  '' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
+    export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/${preReleaseName}"
+  '' + stdenv.lib.optionalString stdenv.isDarwin ''
+    export NIX_LDFLAGS+=" -no_dtrace_dof"
+  '' + stdenv.lib.optionalString enableIntegerSimple ''
+    echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk
+  '';
+in stdenv.mkDerivation (rec {
+  inherit version;
+  name = "ghc-${version}";
+
+  src = fetchurl {
+    url = "https://downloads.haskell.org/~ghc/${version}/${preReleaseName}-src.tar.xz";
+    sha256 = "1hy3l6nzkyhzwy9mii4zs51jv048zwvdqk1q3188jznz35392zrn";
+  };
+
+  postPatch = "patchShebangs .";
+
+  preConfigure = commonPreConfigure;
+
+  buildInputs = commonBuildInputs;
+
+  enableParallelBuilding = true;
+
+  configureFlags = [
+    "CC=${stdenv.cc}/bin/cc"
+    "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
+    "--datadir=$doc/share/doc/ghc"
+  ] ++ stdenv.lib.optional (! enableIntegerSimple) [
+    "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
+  ] ++ stdenv.lib.optional stdenv.isDarwin [
+    "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
+  ];
+
+  # required, because otherwise all symbols from HSffi.o are stripped, and
+  # that in turn causes GHCi to abort
+  stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
+
+  checkTarget = "test";
+
+  postInstall = ''
+    paxmark m $out/lib/${preReleaseName}/bin/{ghc,haddock}
+
+    # Install the bash completion file.
+    install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/ghc
+
+    # Patch scripts to include "readelf" and "cat" in $PATH.
+    for i in "$out/bin/"*; do
+      test ! -h $i || continue
+      egrep --quiet '^#!' <(head -n 1 $i) || continue
+      sed -i -e '2i export PATH="$PATH:${stdenv.lib.makeBinPath [ binutils coreutils ]}"' $i
+    done
+  '';
+
+  outputs = [ "out" "doc" ];
+
+  passthru = {
+    inherit bootPkgs;
+  } // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) {
+    crossCompiler = selfPkgs.ghc.override {
+      cross = targetPlatform;
+      bootPkgs = selfPkgs;
+    };
+  };
+
+  meta = {
+    homepage = "http://haskell.org/ghc";
+    description = "The Glasgow Haskell Compiler";
+    maintainers = with stdenv.lib.maintainers; [ marcweber andres peti ];
+    inherit (ghc.meta) license platforms;
+  };
+
+} // stdenv.lib.optionalAttrs (cross != null) {
+  name = "${cross.config}-ghc-${version}";
+
+  preConfigure = commonPreConfigure + ''
+    sed 's|#BuildFlavour  = quick-cross|BuildFlavour  = perf-cross|' mk/build.mk.sample > mk/build.mk
+  '';
+
+  configureFlags = [
+    "CC=${stdenv.ccCross}/bin/${cross.config}-cc"
+    "LD=${stdenv.binutils}/bin/${cross.config}-ld"
+    "AR=${stdenv.binutils}/bin/${cross.config}-ar"
+    "NM=${stdenv.binutils}/bin/${cross.config}-nm"
+    "RANLIB=${stdenv.binutils}/bin/${cross.config}-ranlib"
+    "--target=${cross.config}"
+    "--enable-bootstrap-with-devel-snapshot"
+  ] ++
+    # fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
+    lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
+
+  buildInputs = commonBuildInputs ++ [ stdenv.ccCross stdenv.binutils ];
+
+  dontSetConfigureCross = true;
+
+  passthru = {
+    inherit bootPkgs cross;
+    cc = "${stdenv.ccCross}/bin/${cross.config}-cc";
+    ld = "${stdenv.binutils}/bin/${cross.config}-ld";
+  };
+})
diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix
index 006a9f8fbc46..3e1aada22eb1 100644
--- a/pkgs/development/compilers/ghc/head.nix
+++ b/pkgs/development/compilers/ghc/head.nix
@@ -15,6 +15,8 @@ let
   version = "8.1.20170106";
   rev = "b4f2afe70ddbd0576b4eba3f82ba1ddc52e9b3bd";
 
+  outputs = [ "out" "doc" ];
+
   commonPreConfigure =  ''
     echo ${version} >VERSION
     echo ${rev} >GIT_COMMIT_ID
@@ -48,6 +50,7 @@ in stdenv.mkDerivation (rec {
   configureFlags = [
     "CC=${stdenv.cc}/bin/cc"
     "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib"
+    "--datadir=$doc/share/doc/ghc"
   ] ++ stdenv.lib.optional (! enableIntegerSimple) [
     "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
   ] ++ stdenv.lib.optional stdenv.isDarwin [
diff --git a/pkgs/development/compilers/kotlin/default.nix b/pkgs/development/compilers/kotlin/default.nix
index ca788a57c7ce..e23bee15e1bf 100644
--- a/pkgs/development/compilers/kotlin/default.nix
+++ b/pkgs/development/compilers/kotlin/default.nix
@@ -1,12 +1,12 @@
 { stdenv, fetchurl, makeWrapper, jre, unzip }:
 
 stdenv.mkDerivation rec {
-  version = "1.1.2";
+  version = "1.1.2-5";
   name = "kotlin-${version}";
 
   src = fetchurl {
     url = "https://github.com/JetBrains/kotlin/releases/download/v${version}/kotlin-compiler-${version}.zip";
-    sha256 = "0kngyv5qjjpd93i1b8gn1vw6r8p52lfjrqa2f13nf06v9aqk0vfb";
+    sha256 = "0whfnn7wf8nil9lb8hl9bccjrzwf9zpbf8pz607zg9x3q8g01p9d";
   };
 
   propagatedBuildInputs = [ jre ] ;
diff --git a/pkgs/development/compilers/llvm/3.7/fix-llvm-config.patch b/pkgs/development/compilers/llvm/3.7/fix-llvm-config.patch
new file mode 100644
index 000000000000..772c49609275
--- /dev/null
+++ b/pkgs/development/compilers/llvm/3.7/fix-llvm-config.patch
@@ -0,0 +1,13 @@
+diff --git a/utils/llvm-build/llvmbuild/main.py b/utils/llvm-build/llvmbuild/main.py
+index eacefdf60bf..40d25f5cef8 100644
+--- a/utils/llvm-build/llvmbuild/main.py
++++ b/utils/llvm-build/llvmbuild/main.py
+@@ -412,7 +412,7 @@ subdirectories = %s
+             if library_name is None:
+                 library_name_as_cstr = '0'
+             else:
+-                library_name_as_cstr = '"lib%s.a"' % library_name
++                library_name_as_cstr = '"lib%s.so"' % library_name
+             f.write('  { "%s", %s, %d, { %s } },\n' % (
+                 name, library_name_as_cstr, is_installed,
+                 ', '.join('"%s"' % dep
diff --git a/pkgs/development/compilers/llvm/3.7/llvm.nix b/pkgs/development/compilers/llvm/3.7/llvm.nix
index d4e7c73ad0de..1bdefd214f96 100644
--- a/pkgs/development/compilers/llvm/3.7/llvm.nix
+++ b/pkgs/development/compilers/llvm/3.7/llvm.nix
@@ -53,6 +53,11 @@ in stdenv.mkDerivation rec {
     ln -sv $PWD/lib $out
   '';
 
+  patches = stdenv.lib.optionals (!stdenv.isDarwin) [
+    # llvm-config --libfiles returns (non-existing) static libs
+    ./fix-llvm-config.patch
+  ];
+
   cmakeFlags = with stdenv; [
     "-DCMAKE_BUILD_TYPE=${if debugVersion then "Debug" else "Release"}"
     "-DLLVM_INSTALL_UTILS=ON"  # Needed by rustc
diff --git a/pkgs/development/compilers/rust/bootstrap.nix b/pkgs/development/compilers/rust/bootstrap.nix
index 409bf465630e..ad49b1305706 100644
--- a/pkgs/development/compilers/rust/bootstrap.nix
+++ b/pkgs/development/compilers/rust/bootstrap.nix
@@ -12,16 +12,17 @@ let
     then "x86_64-apple-darwin"
     else throw "missing bootstrap url for platform ${stdenv.system}";
 
-  # fetch hashes by running `print-hashes.sh 1.17.0`
+  # fetch hashes by patching print-hashes.sh to not use the "$DATE" variable
+  # then running `print-hashes.sh 1.16.0`
   bootstrapHash =
     if stdenv.system == "i686-linux"
-    then "39d16ce0f618ba37ee1024b83e4822a2d38e6ba9f341ff2020d34df94c7a6beb"
+    then "b5859161ebb182d3b75fa14a5741e5de87b088146fb0ef4a30f3b2439c6179c5"
     else if stdenv.system == "x86_64-linux"
-    then "bbb0e249a7a3e8143b569706c7d2e7e5f51932c753b7fd26c58ccd2015b02c6b"
+    then "48621912c242753ba37cad5145df375eeba41c81079df46f93ffb4896542e8fd"
     else if stdenv.system == "i686-darwin"
-    then "308132b33d4002f95a725c2d31b975ff37905e3644894ed86e614b03ded70265"
+    then "26356b14164354725bd0351e8084f9b164abab134fb05cddb7758af35aad2065"
     else if stdenv.system == "x86_64-darwin"
-    then "1689060c07ec727e9756f19c9373045668471ab56fd8f53e92701150bbe2032b"
+    then "2d08259ee038d3a2c77a93f1a31fc59e7a1d6d1bbfcba3dba3c8213b2e5d1926"
     else throw "missing bootstrap hash for platform ${stdenv.system}";
 
   src = fetchurl {
@@ -29,7 +30,9 @@ let
      sha256 = bootstrapHash;
   };
 
-  version = "1.17.0";
+  # Note: the version  MUST be one version prior to the version we're
+  # building
+  version = "1.16.0";
 in import ./binaryBuild.nix
   { inherit stdenv fetchurl makeWrapper cacert zlib curl;
     buildRustPackage = null;
diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix
index a8ba933b52f2..4e0d0971cb66 100644
--- a/pkgs/development/compilers/rust/rustc.nix
+++ b/pkgs/development/compilers/rust/rustc.nix
@@ -93,11 +93,6 @@ stdenv.mkDerivation {
     rm src/test/debuginfo/vec-slices.rs
     rm src/test/debuginfo/vec.rs
 
-    # this can probably be removed when rust is updated beyond 1.17
-    # fixes a warning in the test harness (I think?) which fails the build due
-    # to strict warnings
-    sed -i '/static_in_const/d' src/tools/compiletest/src/main.rs
-
     # Useful debugging parameter
     # export VERBOSE=1
   ''
diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix
index ec6e723db0d2..464ea25aee1e 100644
--- a/pkgs/development/haskell-modules/configuration-common.nix
+++ b/pkgs/development/haskell-modules/configuration-common.nix
@@ -67,7 +67,7 @@ self: super: {
       name = "git-annex-${drv.version}-src";
       url = "git://git-annex.branchable.com/";
       rev = "refs/tags/" + drv.version;
-      sha256 = "1iwqxjvga0wam0dg1alwawvnz13hm7d7c9rfph0w6adrdgfmhnzc";
+      sha256 = "1psyklfyjf4zqh3qxjn11sp2jiwvp8mfxqvsi1wggqpidfmk39jx";
     };
   }))).override {
     dbus = if pkgs.stdenv.isLinux then self.dbus else null;
@@ -305,7 +305,6 @@ self: super: {
   haeredes = dontCheck super.haeredes;
   hashed-storage = dontCheck super.hashed-storage;
   hashring = dontCheck super.hashring;
-  hastache = dontCheck super.hastache;
   hath = dontCheck super.hath;
   haxl-facebook = dontCheck super.haxl-facebook;        # needs facebook credentials for testing
   hdbi-postgresql = dontCheck super.hdbi-postgresql;
@@ -683,6 +682,7 @@ self: super: {
   stack = super.stack.overrideScope (self: super: {
     store-core = self.store-core_0_3;
     store = self.store_0_3_1;
+    hpack = self.hpack_0_17_1;
   });
 
   # It makes no sense to have intero-nix-shim in Hackage, so we publish it here only.
@@ -861,4 +861,11 @@ self: super: {
   # build liquidhaskell with the proper (old) aeson version
   liquidhaskell = super.liquidhaskell.override { aeson = self.aeson_0_11_3_0; };
 
+  # Test suite fails: https://github.com/lymar/hastache/issues/46.
+  # Don't install internal mkReadme tool.
+  hastache = overrideCabal super.hastache (drv: {
+    doCheck = false;
+    postInstall = "rm $out/bin/mkReadme && rmdir $out/bin";
+  });
+
 }
diff --git a/pkgs/development/haskell-modules/configuration-ghc-8.2.x.nix b/pkgs/development/haskell-modules/configuration-ghc-8.2.x.nix
new file mode 100644
index 000000000000..e1bdfb776f31
--- /dev/null
+++ b/pkgs/development/haskell-modules/configuration-ghc-8.2.x.nix
@@ -0,0 +1,60 @@
+{ pkgs }:
+
+with import ./lib.nix { inherit pkgs; };
+
+self: super: {
+
+  # Suitable LLVM version.
+  llvmPackages = pkgs.llvmPackages_39;
+
+  # Disable GHC 8.2.x core libraries.
+  array = null;
+  base = null;
+  binary = null;
+  bytestring = null;
+  Cabal = null;
+  containers = null;
+  deepseq = null;
+  directory = null;
+  filepath = null;
+  ghc-boot = null;
+  ghc-boot-th = null;
+  ghc-compact = null;
+  ghc-prim = null;
+  ghci = null;
+  haskeline = null;
+  hoopl = null;
+  hpc = null;
+  integer-gmp = null;
+  pretty = null;
+  process = null;
+  rts = null;
+  template-haskell = null;
+  terminfo = null;
+  time = null;
+  transformers = null;
+  unix = null;
+  xhtml = null;
+
+  # cabal-install can use the native Cabal library.
+  cabal-install = super.cabal-install.override { Cabal = null; };
+
+  # jailbreak-cabal can use the native Cabal library.
+  jailbreak-cabal = super.jailbreak-cabal.override { Cabal = null; };
+
+  # https://github.com/bmillwood/applicative-quoters/issues/6
+  applicative-quoters = appendPatch super.applicative-quoters (pkgs.fetchpatch {
+    url = "https://patch-diff.githubusercontent.com/raw/bmillwood/applicative-quoters/pull/7.patch";
+    sha256 = "026vv2k3ks73jngwifszv8l59clg88pcdr4mz0wr0gamivkfa1zy";
+  });
+
+  ## GHC > 8.0.2
+
+  # http://hub.darcs.net/dolio/vector-algorithms/issue/9#comment-20170112T145715
+  vector-algorithms = dontCheck super.vector-algorithms;
+
+  # https://github.com/thoughtbot/yesod-auth-oauth2/pull/77
+  yesod-auth-oauth2 = doJailbreak super.yesod-auth-oauth2;
+
+
+}
diff --git a/pkgs/development/haskell-modules/configuration-hackage2nix.yaml b/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
index 42334b380b7d..493181ea16c3 100644
--- a/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
+++ b/pkgs/development/haskell-modules/configuration-hackage2nix.yaml
@@ -37,7 +37,7 @@ core-packages:
   - ghcjs-base-0
 
 default-package-overrides:
-  # LTS Haskell 8.17
+  # LTS Haskell 8.18
   - abstract-deque ==0.3
   - abstract-par ==0.3.3
   - AC-Vector ==2.3.2
@@ -348,7 +348,7 @@ default-package-overrides:
   - check-email ==1.0.2
   - checkers ==0.4.6
   - chell ==0.4.0.1
-  - choice ==0.2.0
+  - choice ==0.2.1
   - chunked-data ==0.3.0
   - cipher-aes ==0.2.11
   - cipher-aes128 ==0.7.0.3
@@ -403,7 +403,7 @@ default-package-overrides:
   - concurrent-output ==1.7.9
   - concurrent-split ==0.0.1
   - concurrent-supply ==0.1.8
-  - conduit ==1.2.10
+  - conduit ==1.2.11
   - conduit-combinators ==1.1.1
   - conduit-connection ==0.1.0.3
   - conduit-extra ==1.1.16
@@ -497,7 +497,7 @@ default-package-overrides:
   - data-inttrie ==0.1.2
   - data-lens-light ==0.1.2.2
   - data-memocombinators ==0.5.1
-  - data-msgpack ==0.0.9
+  - data-msgpack ==0.0.10
   - data-or ==1.0.0.5
   - data-ordlist ==0.4.7.0
   - data-ref ==0.0.1.1
@@ -526,7 +526,7 @@ default-package-overrides:
   - diagrams-core ==1.4
   - diagrams-gtk ==1.4
   - diagrams-html5 ==1.4
-  - diagrams-lib ==1.4.1
+  - diagrams-lib ==1.4.1.2
   - diagrams-postscript ==1.4
   - diagrams-rasterific ==1.4
   - diagrams-solve ==0.1.0.1
@@ -601,7 +601,7 @@ default-package-overrides:
   - ekg-statsd ==0.2.1.0
   - ekg-wai ==0.1.0.1
   - elerea ==2.9.0
-  - elm-bridge ==0.4.0
+  - elm-bridge ==0.4.1
   - elm-core-sources ==1.0.0
   - elm-export ==0.6.0.1
   - elm-export-persistent ==0.1.2
@@ -705,7 +705,7 @@ default-package-overrides:
   - format-numbers ==0.1.0.0
   - formatting ==6.2.4
   - fortran-src ==0.1.0.4
-  - foundation ==0.0.9
+  - foundation ==0.0.10
   - Frames ==0.1.9
   - free ==4.12.4
   - free-vl ==0.1.4
@@ -740,7 +740,7 @@ default-package-overrides:
   - ghc-mod ==5.7.0.0
   - ghc-paths ==0.1.0.9
   - ghc-prof ==1.3.0.2
-  - ghc-syb-utils ==0.2.3
+  - ghc-syb-utils ==0.2.3.1
   - ghc-tcplugins-extra ==0.2
   - ghc-typelits-extra ==0.2.3
   - ghc-typelits-knownnat ==0.2.4
@@ -757,7 +757,7 @@ default-package-overrides:
   - gi-gio ==2.0.12
   - gi-glib ==2.0.12
   - gi-gobject ==2.0.12
-  - gi-gtk ==3.0.14
+  - gi-gtk ==3.0.15
   - gi-javascriptcore ==3.0.12
   - gi-pango ==1.0.13
   - gi-soup ==2.4.12
@@ -920,7 +920,7 @@ default-package-overrides:
   - haddock-library ==1.4.3
   - hailgun ==0.4.1.3
   - hailgun-simple ==0.1.0.0
-  - hakyll ==4.9.5.1
+  - hakyll ==4.9.7.0
   - half ==0.2.2.3
   - hamilton ==0.1.0.0
   - hamlet ==1.2.0
@@ -991,7 +991,7 @@ default-package-overrides:
   - hedis ==0.9.8
   - here ==1.2.11
   - heredoc ==0.2.0.0
-  - heterocephalus ==1.0.4.0
+  - heterocephalus ==1.0.5.0
   - hex ==0.1.2
   - hexml ==0.3.2
   - hexpat ==0.20.10
@@ -1068,7 +1068,7 @@ default-package-overrides:
   - hslua-aeson ==0.1.0.4
   - hsndfile ==0.8.0
   - hsndfile-vector ==0.5.2
-  - HsOpenSSL ==0.11.4.8
+  - HsOpenSSL ==0.11.4.9
   - HsOpenSSL-x509-system ==0.1.0.3
   - hsp ==0.10.0
   - hspec ==2.4.3
@@ -1232,7 +1232,7 @@ default-package-overrides:
   - jwt ==0.7.2
   - kan-extensions ==5.0.2
   - kansas-comet ==0.4
-  - katip ==0.3.1.4
+  - katip ==0.3.1.5
   - katip-elasticsearch ==0.3.0.2
   - kawhi ==0.2.3
   - kdt ==0.2.4
@@ -1254,7 +1254,7 @@ default-package-overrides:
   - language-glsl ==0.2.0
   - language-haskell-extract ==0.2.4
   - language-java ==0.2.8
-  - language-javascript ==0.6.0.9
+  - language-javascript ==0.6.0.10
   - language-lua2 ==0.1.0.5
   - language-puppet ==1.3.7
   - language-python ==0.5.4
@@ -1355,7 +1355,7 @@ default-package-overrides:
   - median-stream ==0.7.0.0
   - mega-sdist ==0.3.0.2
   - megaparsec ==5.2.0
-  - memory ==0.14.5
+  - memory ==0.14.6
   - MemoTrie ==0.6.7
   - mersenne-random ==1.0.0.1
   - mersenne-random-pure64 ==0.2.2.0
@@ -1555,7 +1555,7 @@ default-package-overrides:
   - parsec ==3.1.11
   - parsec-numeric ==0.1.0.0
   - ParsecTools ==0.0.2.0
-  - parsers ==0.12.4
+  - parsers ==0.12.5
   - partial-handler ==1.0.2
   - partial-isomorphisms ==0.2.2.1
   - patat ==0.5.2.0
@@ -1590,7 +1590,7 @@ default-package-overrides:
   - picoparsec ==0.1.2.3
   - pid1 ==0.1.0.1
   - pinboard ==0.9.12.4
-  - pinch ==0.3.1.0
+  - pinch ==0.3.2.0
   - pinchot ==0.24.0.0
   - pipes ==4.3.4
   - pipes-attoparsec ==0.5.1.5
@@ -1667,12 +1667,12 @@ default-package-overrides:
   - prometheus-client ==0.1.1
   - prometheus-metrics-ghc ==0.1.1
   - prompt ==0.1.1.2
-  - proto-lens ==0.2.0.1
+  - proto-lens ==0.2.1.0
   - proto-lens-arbitrary ==0.1.0.2
-  - proto-lens-combinators ==0.1.0.6
-  - proto-lens-descriptors ==0.2.0.1
+  - proto-lens-combinators ==0.1.0.7
+  - proto-lens-descriptors ==0.2.1.0
   - proto-lens-optparse ==0.1.0.2
-  - proto-lens-protoc ==0.2.0.1
+  - proto-lens-protoc ==0.2.1.0
   - protobuf ==0.2.1.1
   - protobuf-simple ==0.1.0.4
   - protocol-buffers ==2.4.0
@@ -1747,7 +1747,7 @@ default-package-overrides:
   - reform-happstack ==0.2.5.1
   - reform-hsp ==0.2.7.1
   - RefSerialize ==0.4.0
-  - regex ==1.0.1.0
+  - regex ==1.0.1.3
   - regex-applicative ==0.3.3
   - regex-applicative-text ==0.1.0.1
   - regex-base ==0.93.2
@@ -1759,7 +1759,7 @@ default-package-overrides:
   - regex-posix ==0.95.2
   - regex-tdfa ==1.2.2
   - regex-tdfa-text ==1.0.0.3
-  - regex-with-pcre ==1.0.1.0
+  - regex-with-pcre ==1.0.1.3
   - reinterpret-cast ==0.1.0
   - relational-query ==0.8.4.0
   - relational-query-HDBC ==0.6.0.3
@@ -1819,7 +1819,7 @@ default-package-overrides:
   - scalpel ==0.5.1
   - scalpel-core ==0.5.1
   - scanner ==0.2
-  - scientific ==0.3.4.13
+  - scientific ==0.3.4.15
   - scotty ==0.11.0
   - scrape-changes ==0.1.0.5
   - scrypt ==0.5.0
@@ -2061,7 +2061,7 @@ default-package-overrides:
   - temporary ==1.2.0.4
   - temporary-rc ==1.2.0.3
   - termcolor ==0.2.0.0
-  - terminal-progress-bar ==0.1.1
+  - terminal-progress-bar ==0.1.1.1
   - terminal-size ==0.3.2.1
   - terminfo ==0.4.1.0
   - test-fixture ==0.5.0.1
@@ -2124,7 +2124,7 @@ default-package-overrides:
   - timemap ==0.0.4
   - timerep ==2.0.0.2
   - timespan ==0.3.0.0
-  - timezone-olson ==0.1.7
+  - timezone-olson ==0.1.8
   - timezone-series ==0.1.6.1
   - tinylog ==0.14.0
   - tinytemplate ==0.1.2.0
@@ -2145,7 +2145,7 @@ default-package-overrides:
   - true-name ==0.1.0.2
   - tsv2csv ==0.1.0.2
   - ttrie ==0.1.2.1
-  - tttool ==1.7.0.2
+  - tttool ==1.7.0.3
   - tuple ==0.3.0.2
   - tuple-th ==0.2.5
   - tuples-homogenous-h98 ==0.1.1.0
@@ -2174,6 +2174,7 @@ default-package-overrides:
   - tzdata ==0.1.20161123.0
   - ua-parser ==0.7.3
   - uglymemo ==0.1.0.1
+  - unagi-chan ==0.4.0.0
   - unbound ==0.5.1
   - unbound-generics ==0.3.1
   - unbounded-delays ==0.1.1.0
@@ -2208,7 +2209,7 @@ default-package-overrides:
   - unlit ==0.4.0.0
   - unordered-containers ==0.2.8.0
   - unsafe ==0.0
-  - uri-bytestring ==0.2.3.2
+  - uri-bytestring ==0.2.3.3
   - uri-encode ==1.5.0.5
   - uri-templater ==0.2.1.0
   - url ==2.1.3
@@ -2376,12 +2377,12 @@ default-package-overrides:
   - YampaSynth ==0.2
   - yes-precure5-command ==5.5.3
   - yesod ==1.4.5
-  - yesod-auth ==1.4.17.1
+  - yesod-auth ==1.4.17.2
   - yesod-auth-account ==1.4.3
   - yesod-auth-basic ==0.1.0.2
   - yesod-auth-hashdb ==1.6.1
   - yesod-bin ==1.5.2.3
-  - yesod-core ==1.4.33
+  - yesod-core ==1.4.35
   - yesod-eventsource ==1.4.1
   - yesod-fay ==0.8.0
   - yesod-form ==1.4.12
@@ -2392,10 +2393,10 @@ default-package-overrides:
   - yesod-newsfeed ==1.6
   - yesod-persistent ==1.4.2
   - yesod-sitemap ==1.4.0.1
-  - yesod-static ==1.5.2
+  - yesod-static ==1.5.3
   - yesod-static-angular ==0.1.8
   - yesod-table ==2.0.3
-  - yesod-test ==1.5.5
+  - yesod-test ==1.5.6
   - yesod-websockets ==0.2.6
   - yi-core ==0.13.5
   - yi-frontend-vty ==0.13.5
@@ -2416,10 +2417,10 @@ default-package-overrides:
   - zero ==0.1.4
   - zeromq4-haskell ==0.6.5
   - zip ==0.1.11
-  - zip-archive ==0.3.0.6
+  - zip-archive ==0.3.1
   - zippers ==0.2.3
-  - ziptastic-client ==0.3.0.2
-  - ziptastic-core ==0.2.0.2
+  - ziptastic-client ==0.3.0.3
+  - ziptastic-core ==0.2.0.3
   - zlib ==0.6.1.2
   - zlib-bindings ==0.1.1.5
   - zlib-lens ==0.1.2.1
@@ -2444,6 +2445,7 @@ extra-packages:
   - haddock-api == 2.16.*               # required on GHC 7.10.x
   - haddock-library == 1.2.*            # required for haddock-api-2.16.x
   - haskell-src-exts == 1.18.*          # required by hoogle-5.0.4
+  - hpack < 0.18                        # required by stack-1.4.0
   - mtl < 2.2                           # newer versions require transformers > 0.4.x, which we cannot provide in GHC 7.8.x
   - mtl-prelude < 2                     # required for to build postgrest on mtl 2.1.x platforms
   - parallel == 3.2.0.3                 # newer versions don't work with GHC 6.12.3
@@ -8329,6 +8331,7 @@ dont-distribute-packages:
   transient-universe-tls:                       [ i686-linux, x86_64-linux, x86_64-darwin ]
   translatable-intset:                          [ i686-linux, x86_64-linux, x86_64-darwin ]
   translate:                                    [ i686-linux, x86_64-linux, x86_64-darwin ]
+  trasa-reflex:                                 [ i686-linux, x86_64-linux, x86_64-darwin ]
   travis-meta-yaml:                             [ i686-linux, x86_64-linux, x86_64-darwin ]
   trawl:                                        [ i686-linux, x86_64-linux, x86_64-darwin ]
   traypoweroff:                                 [ i686-linux, x86_64-linux, x86_64-darwin ]
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix
index 9516aca53663..38d74178e2e2 100644
--- a/pkgs/development/haskell-modules/generic-builder.nix
+++ b/pkgs/development/haskell-modules/generic-builder.nix
@@ -144,9 +144,9 @@ let
   allPkgconfigDepends = pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++
                         optionals doCheck testPkgconfigDepends ++ optionals withBenchmarkDepends benchmarkPkgconfigDepends;
 
+  nativeBuildInputs = setupHaskellDepends ++ buildTools ++ libraryToolDepends ++ executableToolDepends;
   propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends;
-  otherBuildInputs = extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++ setupHaskellDepends ++
-                     buildTools ++ libraryToolDepends ++ executableToolDepends ++
+  otherBuildInputs = extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++
                      optionals (allPkgconfigDepends != []) ([pkgconfig] ++ allPkgconfigDepends) ++
                      optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testToolDepends) ++
                      # ghcjs's hsc2hs calls out to the native hsc2hs
@@ -181,8 +181,9 @@ stdenv.mkDerivation ({
 
   inherit src;
 
-  nativeBuildInputs = otherBuildInputs ++ optionals (!hasActiveLibrary) propagatedBuildInputs;
-  propagatedNativeBuildInputs = optionals hasActiveLibrary propagatedBuildInputs;
+  inherit nativeBuildInputs;
+  buildInputs = otherBuildInputs ++ optionals (!hasActiveLibrary) propagatedBuildInputs;
+  propagatedBuildInputs = optionals hasActiveLibrary propagatedBuildInputs;
 
   LANG = "en_US.UTF-8";         # GHC needs the locale configured during the Haddock phase.
 
@@ -209,11 +210,8 @@ stdenv.mkDerivation ({
     setupCompileFlags="${concatStringsSep " " setupCompileFlags}"
     configureFlags="${concatStringsSep " " defaultConfigureFlags} $configureFlags"
 
-    local inputClosure=""
-    for i in $propagatedNativeBuildInputs $nativeBuildInputs; do
-      findInputs $i inputClosure propagated-native-build-inputs
-    done
-    for p in $inputClosure; do
+    # nativePkgs defined in stdenv/setup.hs
+    for p in $nativePkgs; 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/haskell-modules/hackage-packages.nix b/pkgs/development/haskell-modules/hackage-packages.nix
index 057df5adf584..a384a682757e 100644
--- a/pkgs/development/haskell-modules/hackage-packages.nix
+++ b/pkgs/development/haskell-modules/hackage-packages.nix
@@ -7674,6 +7674,8 @@ self: {
        pname = "HJavaScript";
        version = "0.4.7";
        sha256 = "0sb2wqbf6kml5d414xi6jk0gr31673djqxa5wg1mxl40vwn14pvh";
+       revision = "1";
+       editedCabalFile = "05m2kgz0laxv9jl1qfc1sxndan9503010y3aadvfcsxi9cyg3j1j";
        libraryHaskellDepends = [ base pretty ];
        description = "HJavaScript is an abstract syntax for a typed subset of JavaScript";
        license = stdenv.lib.licenses.bsd3;
@@ -8698,6 +8700,41 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "HaRe_0_8_4_1" = callPackage
+    ({ mkDerivation, attoparsec, base, base-prelude, Cabal
+     , cabal-helper, case-insensitive, containers, conversion
+     , conversion-case-insensitive, conversion-text, Diff, directory
+     , filepath, foldl, ghc, ghc-exactprint, ghc-mod, ghc-syb-utils
+     , gitrev, hslogger, hspec, HUnit, monad-control, mtl
+     , optparse-applicative, optparse-simple, parsec
+     , Strafunski-StrategyLib, syb, syz, turtle
+     }:
+     mkDerivation {
+       pname = "HaRe";
+       version = "0.8.4.1";
+       sha256 = "16ld7lrdf6vjmxam4kfc6zyy2g4baw7mr9ha39nrxjq0p8d4hn3v";
+       isLibrary = true;
+       isExecutable = true;
+       libraryHaskellDepends = [
+         base cabal-helper containers directory filepath ghc ghc-exactprint
+         ghc-mod ghc-syb-utils hslogger monad-control mtl
+         Strafunski-StrategyLib syb syz
+       ];
+       executableHaskellDepends = [
+         base Cabal ghc-mod gitrev mtl optparse-applicative optparse-simple
+       ];
+       testHaskellDepends = [
+         attoparsec base base-prelude case-insensitive containers conversion
+         conversion-case-insensitive conversion-text Diff directory foldl
+         ghc ghc-exactprint ghc-mod ghc-syb-utils hslogger hspec HUnit mtl
+         parsec turtle
+       ];
+       homepage = "https://github.com/RefactoringTools/HaRe/wiki";
+       description = "the Haskell Refactorer";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "HaTeX" = callPackage
     ({ mkDerivation, base, bytestring, containers, matrix, parsec
      , QuickCheck, tasty, tasty-quickcheck, text, transformers
@@ -9734,26 +9771,6 @@ self: {
      }:
      mkDerivation {
        pname = "HsOpenSSL";
-       version = "0.11.4.8";
-       sha256 = "07r190anfnrcy51xy6fqxcpn16sq3jazhjiidkix33kq4w40akfc";
-       setupHaskellDepends = [ base Cabal ];
-       libraryHaskellDepends = [
-         base bytestring integer-gmp network time
-       ];
-       librarySystemDepends = [ openssl ];
-       testHaskellDepends = [ base bytestring ];
-       homepage = "https://github.com/vshabanov/HsOpenSSL";
-       description = "Partial OpenSSL binding for Haskell";
-       license = stdenv.lib.licenses.publicDomain;
-       hydraPlatforms = stdenv.lib.platforms.none;
-     }) {inherit (pkgs) openssl;};
-
-  "HsOpenSSL_0_11_4_9" = callPackage
-    ({ mkDerivation, base, bytestring, Cabal, integer-gmp, network
-     , openssl, time
-     }:
-     mkDerivation {
-       pname = "HsOpenSSL";
        version = "0.11.4.9";
        sha256 = "0y5khy8a1anisa8s1zysz763yg29mr6c9zcx4bjszaba5axyj3za";
        setupHaskellDepends = [ base Cabal ];
@@ -9939,6 +9956,26 @@ self: {
        license = stdenv.lib.licenses.gpl3;
      }) {};
 
+  "Hydrogen" = callPackage
+    ({ mkDerivation, aeson, base, binary, directory, HFitUI, MissingH
+     , shakespeare, yaml
+     }:
+     mkDerivation {
+       pname = "Hydrogen";
+       version = "0.1.0.0";
+       sha256 = "10n45j8ri1svxhplpfj88riqk4qigzl02cqxkk3mrsahhgn6bkmp";
+       isLibrary = true;
+       isExecutable = true;
+       libraryHaskellDepends = [
+         aeson base binary directory HFitUI MissingH shakespeare yaml
+       ];
+       executableHaskellDepends = [ base ];
+       testHaskellDepends = [ base ];
+       homepage = "https://github.com/iqsf/Hydrogen.git";
+       description = "The library for generating a WebGL scene for the web";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "IDynamic" = callPackage
     ({ mkDerivation, base, containers, directory }:
      mkDerivation {
@@ -10078,8 +10115,8 @@ self: {
      }:
      mkDerivation {
        pname = "IPv6DB";
-       version = "0.2.0";
-       sha256 = "029qhw6h9vhzdcqbvm0km2fkijr20c0k4gk4ry5p9f3157d5pj0k";
+       version = "0.2.1";
+       sha256 = "1730whn02k1d9w6znfiibz8slwwnbrm1z47s544c24vdziwfh54v";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -10094,7 +10131,7 @@ self: {
        testHaskellDepends = [
          aeson base hspec http-client http-types vector
        ];
-       homepage = "https://github.com/MichelBoucey/IPv6DB";
+       homepage = "http://ipv6db.cybervisible.com";
        description = "A RESTful Web Service for IPv6-related data";
        license = stdenv.lib.licenses.bsd3;
        hydraPlatforms = stdenv.lib.platforms.none;
@@ -13288,6 +13325,17 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "Only" = callPackage
+    ({ mkDerivation, base, deepseq }:
+     mkDerivation {
+       pname = "Only";
+       version = "0.1";
+       sha256 = "0rdj3a629fk2vp121jq8mf2smkblrz5w3cxhlsyx6my2x29s2ymb";
+       libraryHaskellDepends = [ base deepseq ];
+       description = "The 1-tuple type or single-value \"collection\"";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "OpenAFP" = callPackage
     ({ mkDerivation, array, base, binary, bytestring, containers
      , directory, hashable, hashtables, mtl, process, regex-compat
@@ -14542,6 +14590,25 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "QuickCheck_2_10_0_1" = callPackage
+    ({ mkDerivation, base, containers, deepseq, random
+     , template-haskell, tf-random, transformers
+     }:
+     mkDerivation {
+       pname = "QuickCheck";
+       version = "2.10.0.1";
+       sha256 = "0bml00g26vyky6mhfhkzh0rsafcxfkrdvk1imvlb2l4mrli0bm80";
+       libraryHaskellDepends = [
+         base containers deepseq random template-haskell tf-random
+         transformers
+       ];
+       testHaskellDepends = [ base ];
+       homepage = "https://github.com/nick8325/quickcheck";
+       description = "Automatic testing of Haskell programs";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "QuickCheck-GenT" = callPackage
     ({ mkDerivation, base, mtl, QuickCheck, random }:
      mkDerivation {
@@ -20936,7 +21003,7 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
-  "aeson_1_2_0_0" = callPackage
+  "aeson_1_2_1_0" = callPackage
     ({ mkDerivation, attoparsec, base, base-compat, base-orphans
      , base16-bytestring, bytestring, containers, deepseq, directory
      , dlist, filepath, generic-deriving, ghc-prim, hashable
@@ -20948,8 +21015,8 @@ self: {
      }:
      mkDerivation {
        pname = "aeson";
-       version = "1.2.0.0";
-       sha256 = "0q0awch81kmq7k8p26wr6h1z31zkfyfxia8386vmsy0bgbcki8fb";
+       version = "1.2.1.0";
+       sha256 = "0wwa2i8jy3q7i8mys8hmy1nhis2a7hbs1bbfpmbj7xcvxpdhy5wn";
        libraryHaskellDepends = [
          attoparsec base base-compat bytestring containers deepseq dlist
          ghc-prim hashable scientific tagged template-haskell text time
@@ -21382,6 +21449,29 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "aeson-pretty_0_8_5" = callPackage
+    ({ mkDerivation, aeson, attoparsec, base, base-compat, bytestring
+     , cmdargs, scientific, text, unordered-containers, vector
+     }:
+     mkDerivation {
+       pname = "aeson-pretty";
+       version = "0.8.5";
+       sha256 = "1yd98972srlbkn0f2jhrb3f443j9wnq2fnw5gbxjxzmkcinfh5yx";
+       isLibrary = true;
+       isExecutable = true;
+       libraryHaskellDepends = [
+         aeson base base-compat bytestring scientific text
+         unordered-containers vector
+       ];
+       executableHaskellDepends = [
+         aeson attoparsec base bytestring cmdargs
+       ];
+       homepage = "http://github.com/informatikr/aeson-pretty";
+       description = "JSON pretty-printing library and command-line tool";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "aeson-qq" = callPackage
     ({ mkDerivation, aeson, attoparsec, base, base-compat, ghc-prim
      , haskell-src-meta, hspec, parsec, scientific, template-haskell
@@ -21404,6 +21494,29 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
+  "aeson-qq_0_8_2" = callPackage
+    ({ mkDerivation, aeson, attoparsec, base, base-compat, ghc-prim
+     , haskell-src-meta, hspec, parsec, scientific, template-haskell
+     , text, vector
+     }:
+     mkDerivation {
+       pname = "aeson-qq";
+       version = "0.8.2";
+       sha256 = "0ln13jqyfh5726hdrk1rad9a6cgrrj201plmwcfcpvq18v4m5ckd";
+       libraryHaskellDepends = [
+         aeson attoparsec base base-compat haskell-src-meta parsec
+         scientific template-haskell text vector
+       ];
+       testHaskellDepends = [
+         aeson attoparsec base base-compat ghc-prim haskell-src-meta hspec
+         parsec scientific template-haskell text vector
+       ];
+       homepage = "https://github.com/sol/aeson-qq#readme";
+       description = "JSON quasiquoter for Haskell";
+       license = stdenv.lib.licenses.mit;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "aeson-quick" = callPackage
     ({ mkDerivation, aeson, attoparsec, base, bytestring, criterion
      , deepseq, microlens, tasty, tasty-hunit, text
@@ -21928,15 +22041,17 @@ self: {
      }) {};
 
   "aivika" = callPackage
-    ({ mkDerivation, array, base, containers, mtl, random, vector }:
+    ({ mkDerivation, array, base, binary, containers, deepseq, mtl
+     , random, vector
+     }:
      mkDerivation {
        pname = "aivika";
-       version = "5.0.1";
-       sha256 = "0myayp5z77qwcjlvphiigd4sw3mbsxcgn1hm7izr8nn0fh0djpgc";
+       version = "5.1";
+       sha256 = "1mmpqmcvsx3qygwm8iszhcdnafp09vbnnklkskd1qsg55nisp0ps";
        libraryHaskellDepends = [
-         array base containers mtl random vector
+         array base binary containers deepseq mtl random vector
        ];
-       homepage = "http://www.aivikasoft.com/en/products/aivika.html";
+       homepage = "http://www.aivikasoft.com";
        description = "A multi-method simulation library";
        license = stdenv.lib.licenses.bsd3;
      }) {};
@@ -21947,12 +22062,12 @@ self: {
      }:
      mkDerivation {
        pname = "aivika-branches";
-       version = "0.1.3";
-       sha256 = "1cqzyhc1chzn9bsr3k2s5z2z9jqhg7k7ic2frwdfba2r7lpsqkfi";
+       version = "0.2";
+       sha256 = "0riavp8jvsxmlqxjljm0dsijvrc0vknhkrjgf9g501g5yypd6byy";
        libraryHaskellDepends = [
          aivika aivika-transformers base containers mtl random
        ];
-       homepage = "http://www.aivikasoft.com/en/products/aivika.html";
+       homepage = "http://www.aivikasoft.com";
        description = "Nested discrete event simulation module for the Aivika library";
        license = stdenv.lib.licenses.bsd3;
      }) {};
@@ -21964,30 +22079,30 @@ self: {
      }:
      mkDerivation {
        pname = "aivika-distributed";
-       version = "0.3.1";
-       sha256 = "0lp80khb8nw335nwfnn5ik2qzbw4mgijra3p2wyqgakqllflxnz5";
+       version = "0.5";
+       sha256 = "0ghsnq1a9jfrdgaf4gqplka53ywnr8jbabz4ikdzvrh80nnf3gpc";
        libraryHaskellDepends = [
          aivika aivika-transformers base binary containers
          distributed-process exceptions mtl random stm time
        ];
-       homepage = "http://www.aivikasoft.com/en/products/aivika.html";
+       homepage = "http://www.aivikasoft.com";
        description = "Parallel distributed discrete event simulation module for the Aivika library";
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
   "aivika-experiment" = callPackage
-    ({ mkDerivation, aivika, base, containers, directory, filepath, mtl
-     , network-uri, parallel-io, split
+    ({ mkDerivation, aivika, aivika-transformers, base, containers
+     , directory, filepath, mtl, network-uri, parallel-io, split
      }:
      mkDerivation {
        pname = "aivika-experiment";
-       version = "4.0.3";
-       sha256 = "1v0x37kmav87b3mxvribw6658glf5hbk7npipkabp1qbfz5sp7zv";
+       version = "5.0";
+       sha256 = "1bcmkpzdmca0xcnvmbvsb5g0gsrxbrhf7lc3nig472w0pxa0xhg9";
        libraryHaskellDepends = [
-         aivika base containers directory filepath mtl network-uri
-         parallel-io split
+         aivika aivika-transformers base containers directory filepath mtl
+         network-uri parallel-io split
        ];
-       homepage = "http://github.com/dsorokin/aivika-experiment";
+       homepage = "http://www.aivikasoft.com";
        description = "Simulation experiments for the Aivika library";
        license = stdenv.lib.licenses.bsd3;
      }) {};
@@ -21998,13 +22113,13 @@ self: {
      }:
      mkDerivation {
        pname = "aivika-experiment-cairo";
-       version = "4.3.1";
-       sha256 = "0p54ssbl0ack51gwlj962x45954v4h22mqq6zqa5r8xrbcig2pdb";
+       version = "5.0";
+       sha256 = "1ybynnr9yiv9vi3v1zww9hlf7klm6kggs56basgpn7lzv5qdaz07";
        libraryHaskellDepends = [
          aivika-experiment aivika-experiment-chart base Chart Chart-cairo
        ];
-       homepage = "http://github.com/dsorokin/aivika-experiment-cairo";
-       description = "Cairo backend for the Aivika simulation library";
+       homepage = "http://www.aivikasoft.com";
+       description = "Cairo-based charting backend for the Aivika simulation library";
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
@@ -22015,13 +22130,13 @@ self: {
      }:
      mkDerivation {
        pname = "aivika-experiment-chart";
-       version = "4.3.2";
-       sha256 = "1ndysamwsxqna1qrk4wps1adms7vjvp1dj3ri48dzk9n1hymz7l1";
+       version = "5.0";
+       sha256 = "0hmdb6bk8iy3y4dq5pkf1yqwgxl3mjyhl4lqjj0pz24bxxwlg33z";
        libraryHaskellDepends = [
          aivika aivika-experiment array base Chart colour containers
          data-default-class filepath lens mtl split
        ];
-       homepage = "http://github.com/dsorokin/aivika-experiment-chart";
+       homepage = "http://www.aivikasoft.com";
        description = "Simulation experiments with charting for the Aivika library";
        license = stdenv.lib.licenses.bsd3;
      }) {};
@@ -22032,14 +22147,14 @@ self: {
      }:
      mkDerivation {
        pname = "aivika-experiment-diagrams";
-       version = "4.3.1";
-       sha256 = "1plb44bcjnawg3fsb9crmlyzwzyiz802ldsk559ni9sb590ywr7n";
+       version = "5.0";
+       sha256 = "013l4zp8pxz34xjkl7q9hwy4sk75k8gdwhg5kc5hsmw9nm47xa72";
        libraryHaskellDepends = [
          aivika-experiment aivika-experiment-chart base Chart Chart-diagrams
          containers filepath
        ];
-       homepage = "http://github.com/dsorokin/aivika-experiment-diagrams";
-       description = "Diagrams backend for the Aivika simulation library";
+       homepage = "http://www.aivikasoft.com";
+       description = "Diagrams-based charting backend for the Aivika simulation library";
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
@@ -22049,12 +22164,12 @@ self: {
      }:
      mkDerivation {
        pname = "aivika-lattice";
-       version = "0.1.1";
-       sha256 = "1mz1a1jdqf5609mfivr8vr9jk3q6jql99kaapjjrkgsdaszdsrv8";
+       version = "0.2";
+       sha256 = "0bd3xwga4cq2qibywq20rnl7fhhxs7ax1dl13ylcaxbg0sxyd0cj";
        libraryHaskellDepends = [
          aivika aivika-transformers base containers mtl random
        ];
-       homepage = "http://www.aivikasoft.com/en/products/aivika.html";
+       homepage = "http://www.aivikasoft.com";
        description = "Nested discrete event simulation module for the Aivika library using lattice";
        license = stdenv.lib.licenses.bsd3;
      }) {};
@@ -22065,13 +22180,13 @@ self: {
      }:
      mkDerivation {
        pname = "aivika-realtime";
-       version = "0.1.2";
-       sha256 = "0yny61yskyvb5n4m32iwxdyq0qmhbijiz68mx529zh33cl9ajq7v";
+       version = "0.2";
+       sha256 = "0dbbhf55w1i2wfr8lw3y5k2a51kw3223gnfhbamzz2283g5n80pg";
        libraryHaskellDepends = [
          aivika aivika-transformers async base containers mtl random stm
          time
        ];
-       homepage = "http://www.aivikasoft.com/en/products/aivika.html";
+       homepage = "http://www.aivikasoft.com";
        description = "Soft real-time simulation module for the Aivika library";
        license = stdenv.lib.licenses.bsd3;
      }) {};
@@ -22082,12 +22197,12 @@ self: {
      }:
      mkDerivation {
        pname = "aivika-transformers";
-       version = "5.0.1";
-       sha256 = "1n9kfdyhwx0rylnsrxfx9x7cjbmb0l7cr6mb2faq2hln92400kks";
+       version = "5.1";
+       sha256 = "0ihwgql0ilavwx81f3z902r51p180b4facicd4sximnyg6qankdr";
        libraryHaskellDepends = [
          aivika array base containers mtl random vector
        ];
-       homepage = "http://www.aivikasoft.com/en/products/aivika.html";
+       homepage = "http://www.aivikasoft.com";
        description = "Transformers for the Aivika simulation library";
        license = stdenv.lib.licenses.bsd3;
      }) {};
@@ -22172,8 +22287,8 @@ self: {
      }:
      mkDerivation {
        pname = "alerta";
-       version = "0.1.0.3";
-       sha256 = "0phw1l11v1dhim7njc5rrxlkacmk5wwm2vw9jcvkyh2j1bz5gx5g";
+       version = "0.1.0.4";
+       sha256 = "107qdab0wag38qj5j5wl0r3zp7zyhm2zj3c12zmksq4g5bzki8cb";
        libraryHaskellDepends = [
          aeson aeson-pretty base containers data-default http-api-data
          http-client servant servant-client servant-server text time
@@ -25249,8 +25364,8 @@ self: {
      }:
      mkDerivation {
        pname = "antigate";
-       version = "2.0.1";
-       sha256 = "0vd2f4kq2zkngyqpnw3lcvjkn8335gs9rdfr7kb8442p8dhps139";
+       version = "2.0.2";
+       sha256 = "1s1m0k2r18jvz14nqy07m1jm87cdk0n5x2r1xznyfbcik7081ywb";
        libraryHaskellDepends = [
          base bytestring data-default deepseq exceptions failure http-client
          http-conduit resourcet safe text transformers
@@ -25346,6 +25461,8 @@ self: {
        pname = "anydbm";
        version = "1.0.7";
        sha256 = "1rxk36r6i065m0qiq4g5xlrk2yjsds7j896cbddbsyddbzy10d6k";
+       revision = "1";
+       editedCabalFile = "1iny2zl44lbyv266al9047mkj51510vany6nfyq0xi7h7ak3wb13";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [ base containers MissingH mtl ];
@@ -26062,8 +26179,8 @@ self: {
      }:
      mkDerivation {
        pname = "apply-refact";
-       version = "0.3.0.1";
-       sha256 = "0578ql80fzkbjiw589v4498qd9jd7l2sz626imkdybxr1lqbsm0p";
+       version = "0.4.0.0";
+       sha256 = "1s25nlkbfzjr6b5psii3n7hmwvg7lgvaljp1ilq5y82rq8sfyxps";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -26130,19 +26247,19 @@ self: {
      }) {};
 
   "approximate" = callPackage
-    ({ mkDerivation, base, binary, bytes, cereal, comonad, deepseq
-     , directory, doctest, filepath, ghc-prim, hashable, hashable-extras
-     , lens, log-domain, pointed, safecopy, semigroupoids, semigroups
-     , simple-reflect, vector
+    ({ mkDerivation, base, binary, bytes, Cabal, cabal-doctest, cereal
+     , comonad, deepseq, directory, doctest, filepath, ghc-prim
+     , hashable, lens, log-domain, pointed, safecopy, semigroupoids
+     , semigroups, simple-reflect, vector
      }:
      mkDerivation {
        pname = "approximate";
-       version = "0.2.2.3";
-       sha256 = "1b1b61an77k0dxz60w8f07mw7s36i39nnnrcdqn5kg9npmnc3z90";
+       version = "0.3";
+       sha256 = "0zg94yqbm6iasjkf8bxz1bnwc3gx5lh6603cvab8rrxz4xm7k27j";
+       setupHaskellDepends = [ base Cabal cabal-doctest ];
        libraryHaskellDepends = [
-         base binary bytes cereal comonad deepseq ghc-prim hashable
-         hashable-extras lens log-domain pointed safecopy semigroupoids
-         semigroups vector
+         base binary bytes cereal comonad deepseq ghc-prim hashable lens
+         log-domain pointed safecopy semigroupoids semigroups vector
        ];
        testHaskellDepends = [
          base directory doctest filepath semigroups simple-reflect
@@ -26857,6 +26974,22 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "arrowp-qq" = callPackage
+    ({ mkDerivation, array, base, containers, haskell-src
+     , template-haskell, transformers
+     }:
+     mkDerivation {
+       pname = "arrowp-qq";
+       version = "0.1";
+       sha256 = "05cj6drvnk74bcjkr1pqj65c57y09gwmribii887jvg6p77abkgv";
+       libraryHaskellDepends = [
+         array base containers haskell-src template-haskell transformers
+       ];
+       homepage = "http://www.haskell.org/arrows/";
+       description = "quasiquoter translating arrow notation into Haskell 98";
+       license = "GPL";
+     }) {};
+
   "arrows" = callPackage
     ({ mkDerivation, base, Stream }:
      mkDerivation {
@@ -27547,6 +27680,28 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "async-timer" = callPackage
+    ({ mkDerivation, base, containers, criterion, HUnit, lifted-async
+     , lifted-base, monad-control, safe-exceptions, test-framework
+     , test-framework-hunit, transformers-base
+     }:
+     mkDerivation {
+       pname = "async-timer";
+       version = "0.1.4.0";
+       sha256 = "00kdhxq0wpml4f7gdjvr2h8km8i3yj68bawpa229rzpp0y0yp3k3";
+       libraryHaskellDepends = [
+         base lifted-async lifted-base monad-control safe-exceptions
+         transformers-base
+       ];
+       testHaskellDepends = [
+         base containers criterion HUnit lifted-async test-framework
+         test-framework-hunit
+       ];
+       homepage = "https://github.com/mtesseract/async-timer";
+       description = "Provides API for timer based execution of IO actions";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "asynchronous-exceptions" = callPackage
     ({ mkDerivation, base }:
      mkDerivation {
@@ -27764,7 +27919,7 @@ self: {
        license = stdenv.lib.licenses.publicDomain;
      }) {};
 
-  "atom-conduit_0_4_0_2" = callPackage
+  "atom-conduit_0_4_0_3" = callPackage
     ({ mkDerivation, base, blaze-builder, conduit, conduit-combinators
      , data-default, hlint, lens-simple, mono-traversable, parsers
      , quickcheck-instances, resourcet, safe-exceptions, tasty
@@ -27773,8 +27928,8 @@ self: {
      }:
      mkDerivation {
        pname = "atom-conduit";
-       version = "0.4.0.2";
-       sha256 = "1zrrx3vd9y3r34ghfl5zn8k58y6w87r7zca00h9846wn01hd19fw";
+       version = "0.4.0.3";
+       sha256 = "0pl5p9zj33fjjgrxkyj2y45r3qyl5p8z9g17zg19gvqzszsk3vr1";
        libraryHaskellDepends = [
          base blaze-builder conduit conduit-combinators lens-simple
          mono-traversable parsers safe-exceptions text time timerep
@@ -28279,6 +28434,28 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "audacity_0_0_1_2" = callPackage
+    ({ mkDerivation, base, bytestring, deepseq, directory
+     , explicit-exception, filepath, non-empty, storable-record
+     , storablevector, tagchup, transformers, utility-ht, xml-basic
+     }:
+     mkDerivation {
+       pname = "audacity";
+       version = "0.0.1.2";
+       sha256 = "1df9vk6f1gj0jpj3rmq63s3xjqc5p02hprfvq1nqgws0vfnp5lab";
+       isLibrary = true;
+       isExecutable = true;
+       libraryHaskellDepends = [
+         base bytestring deepseq directory explicit-exception filepath
+         non-empty storable-record storablevector tagchup transformers
+         utility-ht xml-basic
+       ];
+       homepage = "http://hub.darcs.net/thielema/audacity";
+       description = "Interchange with the Audacity sound signal editor";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "audiovisual" = callPackage
     ({ mkDerivation, base, boundingboxes, colors, deepseq, directory
      , filepath, free, freetype2, hashable, JuicyPixels
@@ -28921,6 +29098,8 @@ self: {
        pname = "aws";
        version = "0.16";
        sha256 = "1710jajfla76igqrb2hv455gqhr4wap8225z1bffvjgk4w1cddc4";
+       revision = "1";
+       editedCabalFile = "0q4nbmi6s2zzp9jc4hwvdml101xskgindv0scyjjzcvl2cfa0zk9";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -30915,6 +31094,25 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "bench_1_0_5" = callPackage
+    ({ mkDerivation, base, criterion, optparse-applicative, silently
+     , text, turtle
+     }:
+     mkDerivation {
+       pname = "bench";
+       version = "1.0.5";
+       sha256 = "0fm92vwavgnh7pm0491vy5x21wylckga4a2n765nbw5hzmk9pz92";
+       isLibrary = false;
+       isExecutable = true;
+       executableHaskellDepends = [
+         base criterion optparse-applicative silently text turtle
+       ];
+       homepage = "http://github.com/Gabriel439/bench";
+       description = "Command-line benchmark tool";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "benchmark-function" = callPackage
     ({ mkDerivation, base, process, random, time }:
      mkDerivation {
@@ -33176,6 +33374,8 @@ self: {
        pname = "bitarray";
        version = "0.0.1.1";
        sha256 = "00nqd62cbh42qqqvcl6iv1i9kbv0f0mkiygv4j70wfh5cl86yzxj";
+       revision = "1";
+       editedCabalFile = "10fk92v9afjqk43zi621jxl0n8kci0xjj32lz3vqa9xbh67zjz45";
        libraryHaskellDepends = [ array base ];
        homepage = "http://code.haskell.org/~bkomuves/";
        description = "Mutable and immutable bit arrays";
@@ -35297,6 +35497,8 @@ self: {
        pname = "bound";
        version = "2";
        sha256 = "0z63k6kkj43rvwzsy7rbrxz97f8clq87ajbdv7768xziw4mb022x";
+       revision = "1";
+       editedCabalFile = "1sdsshbvhv955ncgxygzl4mfkkk76rdkilwc70w04j9jmbvj5p6j";
        setupHaskellDepends = [ base Cabal cabal-doctest ];
        libraryHaskellDepends = [
          base bifunctors binary bytes cereal comonad deepseq hashable mmorph
@@ -35601,6 +35803,28 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "brick_0_18" = callPackage
+    ({ mkDerivation, base, containers, contravariant, data-clist
+     , deepseq, dlist, microlens, microlens-mtl, microlens-th, stm
+     , template-haskell, text, text-zipper, transformers, vector, vty
+     }:
+     mkDerivation {
+       pname = "brick";
+       version = "0.18";
+       sha256 = "1qk3ds8h1krqhl8gk3c6akblybq2zvs9686ispj14im88mzjma8r";
+       isLibrary = true;
+       isExecutable = true;
+       libraryHaskellDepends = [
+         base containers contravariant data-clist deepseq dlist microlens
+         microlens-mtl microlens-th stm template-haskell text text-zipper
+         transformers vector vty
+       ];
+       homepage = "https://github.com/jtdaugherty/brick/";
+       description = "A declarative terminal user interface library";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "brillig" = callPackage
     ({ mkDerivation, base, binary, cmdargs, containers, directory
      , filepath, ListZipper, text
@@ -36011,8 +36235,8 @@ self: {
      }:
      mkDerivation {
        pname = "buildbox";
-       version = "2.1.9.2";
-       sha256 = "1kjk237ap86qwrxrwywwi8w80i6bb5im5nhixq630b9vcj13v6kz";
+       version = "2.1.9.3";
+       sha256 = "1ffvf82qmf05vxzxi70jm1yq8apv5s62nms529n6x1p5lyrwwdr5";
        libraryHaskellDepends = [
          base bytestring containers directory exceptions mtl old-locale
          pretty process stm temporary text time
@@ -38700,8 +38924,8 @@ self: {
      }:
      mkDerivation {
        pname = "canteven-log";
-       version = "2.0.0.1";
-       sha256 = "1jajfk7n6c0d42d2ciqn6x16dz7mzybh12jza4rdsp9bj6s23k8i";
+       version = "2.0.1.0";
+       sha256 = "0w7hzhb13g62l08ggld3rj9aamw1jhjkir1bpzc73bl59ls4gdgy";
        libraryHaskellDepends = [
          aeson base bytestring directory fast-logger filepath monad-logger
          template-haskell text time transformers yaml
@@ -38952,6 +39176,24 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "carray_0_1_6_7" = callPackage
+    ({ mkDerivation, array, base, binary, bytestring, ix-shapable
+     , QuickCheck, syb
+     }:
+     mkDerivation {
+       pname = "carray";
+       version = "0.1.6.7";
+       sha256 = "0b5zabyfzi60llvimk2hfw93r38qfl3z5kjhp71rdgqj0alaxmx9";
+       libraryHaskellDepends = [
+         array base binary bytestring ix-shapable QuickCheck syb
+       ];
+       testHaskellDepends = [ array base ix-shapable QuickCheck ];
+       benchmarkHaskellDepends = [ array base ];
+       description = "A C-compatible array library";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "carte" = callPackage
     ({ mkDerivation, base, filepath, mtl, network, optparse-applicative
      , random, semigroups, time, transformers, tuple
@@ -40978,27 +41220,12 @@ self: {
     ({ mkDerivation, base }:
      mkDerivation {
        pname = "choice";
-       version = "0.2.0";
-       sha256 = "0bppl551b384c28fqzww73lddzhfdgs10qcf2wd8xk2awna0i9w9";
-       revision = "1";
-       editedCabalFile = "1bv77nhabm33jfaqhpl77jdcbfl7zxz4daphsmqb0pi6z85man7p";
-       libraryHaskellDepends = [ base ];
-       homepage = "https://github.com/mboes/choice#readme";
-       description = "A solution to boolean blindness";
-       license = stdenv.lib.licenses.publicDomain;
-     }) {};
-
-  "choice_0_2_1" = callPackage
-    ({ mkDerivation, base }:
-     mkDerivation {
-       pname = "choice";
        version = "0.2.1";
        sha256 = "163p6ji6gsr0lgxvldnz0rmcbckfk75wpq0xn1n41fbhxzchr2gi";
        libraryHaskellDepends = [ base ];
        homepage = "https://github.com/mboes/choice#readme";
        description = "A solution to boolean blindness";
        license = stdenv.lib.licenses.publicDomain;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "choose" = callPackage
@@ -43689,8 +43916,8 @@ self: {
      }:
      mkDerivation {
        pname = "coin";
-       version = "1.2";
-       sha256 = "01vryj8i55yfwf47m35yzh9b18xq31an41s5fi0ic4djzdacainh";
+       version = "1.2.1";
+       sha256 = "0076dvka5c0m3smppp58lklnf26ry9kibzyiy4yx1ygw5rn7m7pc";
        isLibrary = false;
        isExecutable = true;
        executableHaskellDepends = [
@@ -44660,23 +44887,22 @@ self: {
      }) {};
 
   "compensated" = callPackage
-    ({ mkDerivation, base, bifunctors, binary, bytes, cereal, comonad
-     , deepseq, directory, distributive, doctest, filepath
+    ({ mkDerivation, base, bifunctors, binary, bytes, Cabal
+     , cabal-doctest, cereal, comonad, deepseq, distributive, doctest
      , generic-deriving, hashable, lens, log-domain, safecopy
      , semigroupoids, semigroups, simple-reflect, vector
      }:
      mkDerivation {
        pname = "compensated";
-       version = "0.7";
-       sha256 = "1cp9nnagsnqkq3lmgg9khyg0dsi247gpy8afss25635q45cj8smg";
+       version = "0.7.1";
+       sha256 = "05vpx3jqb8m1naz1ka88kl2jfcf9snfhizb5mg6z2vf1w4axj7w6";
+       setupHaskellDepends = [ base Cabal cabal-doctest ];
        libraryHaskellDepends = [
          base bifunctors binary bytes cereal comonad deepseq distributive
-         generic-deriving hashable lens log-domain safecopy semigroupoids
-         semigroups vector
+         hashable lens log-domain safecopy semigroupoids semigroups vector
        ];
        testHaskellDepends = [
-         base directory doctest filepath generic-deriving semigroups
-         simple-reflect
+         base doctest generic-deriving semigroups simple-reflect
        ];
        homepage = "http://github.com/analytics/compensated/";
        description = "Compensated floating-point arithmetic";
@@ -45201,8 +45427,8 @@ self: {
      }:
      mkDerivation {
        pname = "concrete-haskell";
-       version = "0.1.0.7";
-       sha256 = "1v076bi2fk6a5sm4bjrxlah8hglbgbr2gcbsh3017h2hkkhl8gdv";
+       version = "0.1.0.8";
+       sha256 = "10pr4c48kdgbm365y4jjwk5ba3xvi90p1n8m94161y1j4bs1zzvm";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -45599,33 +45825,6 @@ self: {
      }:
      mkDerivation {
        pname = "conduit";
-       version = "1.2.10";
-       sha256 = "1paqps8sc5ilx2nj98svvv5y9p26cl02d2a16qk9m16slzg7l5ni";
-       libraryHaskellDepends = [
-         base exceptions lifted-base mmorph monad-control mtl primitive
-         resourcet transformers transformers-base
-       ];
-       testHaskellDepends = [
-         base containers exceptions hspec mtl QuickCheck resourcet safe
-         split transformers
-       ];
-       benchmarkHaskellDepends = [
-         base containers criterion deepseq hspec kan-extensions mwc-random
-         transformers vector
-       ];
-       homepage = "http://github.com/snoyberg/conduit";
-       description = "Streaming data processing library";
-       license = stdenv.lib.licenses.mit;
-     }) {};
-
-  "conduit_1_2_11" = callPackage
-    ({ mkDerivation, base, containers, criterion, deepseq, exceptions
-     , hspec, kan-extensions, lifted-base, mmorph, monad-control, mtl
-     , mwc-random, primitive, QuickCheck, resourcet, safe, split
-     , transformers, transformers-base, vector
-     }:
-     mkDerivation {
-       pname = "conduit";
        version = "1.2.11";
        sha256 = "1xx8vj2azbzr2skcrpcy02hgnik01i6hcx01h0mjd4fr0hzl4rhb";
        libraryHaskellDepends = [
@@ -45643,7 +45842,6 @@ self: {
        homepage = "http://github.com/snoyberg/conduit";
        description = "Streaming data processing library";
        license = stdenv.lib.licenses.mit;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "conduit-audio" = callPackage
@@ -45907,6 +46105,29 @@ self: {
        license = "unknown";
      }) {};
 
+  "conduit-parse_0_1_2_1" = callPackage
+    ({ mkDerivation, base, conduit, conduit-combinators, dlist, hlint
+     , mtl, parsers, resourcet, safe, safe-exceptions, tasty
+     , tasty-hunit, text, transformers
+     }:
+     mkDerivation {
+       pname = "conduit-parse";
+       version = "0.1.2.1";
+       sha256 = "0yc3mkg3fic5bpjsffghidk51sx5dhzvyc1h94ppic9mym985fwd";
+       libraryHaskellDepends = [
+         base conduit conduit-combinators dlist mtl parsers safe
+         safe-exceptions text transformers
+       ];
+       testHaskellDepends = [
+         base conduit hlint mtl parsers resourcet safe-exceptions tasty
+         tasty-hunit
+       ];
+       homepage = "https://github.com/k0ral/conduit-parse";
+       description = "Parsing framework based on conduit";
+       license = stdenv.lib.licenses.publicDomain;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "conduit-resumablesink" = callPackage
     ({ mkDerivation, base, bytestring, conduit, hspec, transformers
      , void
@@ -49664,8 +49885,8 @@ self: {
      }:
      mkDerivation {
        pname = "csound-expression";
-       version = "5.2.0";
-       sha256 = "1lnnjwc4hvy54q1q8vdbjl1baz8psqfaivjkb0hfc36y0bgishsl";
+       version = "5.2.1";
+       sha256 = "1an6m2090xjrraibmbxagbwlakmg83d1d0wasr7njv3cihms2dbq";
        libraryHaskellDepends = [
          base Boolean colour containers csound-expression-dynamic
          csound-expression-opcodes csound-expression-typed data-default
@@ -49711,16 +49932,16 @@ self: {
   "csound-expression-typed" = callPackage
     ({ mkDerivation, base, Boolean, colour, containers
      , csound-expression-dynamic, data-default, deepseq, ghc-prim
-     , hashable, temporal-media, transformers, wl-pprint
+     , hashable, NumInstances, temporal-media, transformers, wl-pprint
      }:
      mkDerivation {
        pname = "csound-expression-typed";
-       version = "0.2.0.0";
-       sha256 = "1ihwl9mjbm8nr91nh9laxqgx4mx6i63kvykn6dmzawhj7bz20bi8";
+       version = "0.2.0.1";
+       sha256 = "1hihdgar789kbdb17a63h9cwsy4xz8mqlxq3919zj6cny87xl1af";
        libraryHaskellDepends = [
          base Boolean colour containers csound-expression-dynamic
-         data-default deepseq ghc-prim hashable temporal-media transformers
-         wl-pprint
+         data-default deepseq ghc-prim hashable NumInstances temporal-media
+         transformers wl-pprint
        ];
        homepage = "https://github.com/anton-k/csound-expression-typed";
        description = "typed core for the library csound-expression";
@@ -52152,35 +52373,6 @@ self: {
      }:
      mkDerivation {
        pname = "data-msgpack";
-       version = "0.0.9";
-       sha256 = "0p2bn29z7cdfc10sd0f34qqhyswhg5rwnfdicnqprzpv3hziwas3";
-       isLibrary = true;
-       isExecutable = true;
-       libraryHaskellDepends = [
-         base binary bytestring containers data-binary-ieee754 deepseq
-         hashable QuickCheck text unordered-containers vector void
-       ];
-       executableHaskellDepends = [ base bytestring groom ];
-       testHaskellDepends = [
-         base bytestring containers hashable hspec QuickCheck text
-         unordered-containers vector void
-       ];
-       benchmarkHaskellDepends = [
-         base bytestring criterion deepseq QuickCheck
-       ];
-       homepage = "http://msgpack.org/";
-       description = "A Haskell implementation of MessagePack";
-       license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
-     }) {};
-
-  "data-msgpack_0_0_10" = callPackage
-    ({ mkDerivation, base, binary, bytestring, containers, criterion
-     , data-binary-ieee754, deepseq, groom, hashable, hspec, QuickCheck
-     , text, unordered-containers, vector, void
-     }:
-     mkDerivation {
-       pname = "data-msgpack";
        version = "0.0.10";
        sha256 = "0vpv4l6phsa9b3l0wxk798w9kzkc454v2kk554rcmz94wq3k6n61";
        isLibrary = true;
@@ -54266,19 +54458,18 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
-  "dejafu_0_7_0_1" = callPackage
+  "dejafu_0_7_0_2" = callPackage
     ({ mkDerivation, base, concurrency, containers, deepseq, exceptions
-     , leancheck, monad-loops, mtl, random, ref-fd, semigroups
-     , transformers, transformers-base
+     , leancheck, mtl, random, ref-fd, semigroups, transformers
+     , transformers-base
      }:
      mkDerivation {
        pname = "dejafu";
-       version = "0.7.0.1";
-       sha256 = "0cdkf5qgcwy4sapvingi0s37s0k9d5v8crskaj5wjy1pwl9vs8kq";
+       version = "0.7.0.2";
+       sha256 = "0l2as53zmsr94sf2kh1h5mj1ra1gpnzik2yqj0nj56cxys6sm6iy";
        libraryHaskellDepends = [
-         base concurrency containers deepseq exceptions leancheck
-         monad-loops mtl random ref-fd semigroups transformers
-         transformers-base
+         base concurrency containers deepseq exceptions leancheck mtl random
+         ref-fd semigroups transformers transformers-base
        ];
        homepage = "https://github.com/barrucadu/dejafu";
        description = "Systematic testing for Haskell concurrency";
@@ -55482,40 +55673,8 @@ self: {
      }:
      mkDerivation {
        pname = "diagrams-lib";
-       version = "1.4.1";
-       sha256 = "0x7v0j27ydizb6lw89q7wilalzwyl545nqdwkxwnzg0fdnnhkz5w";
-       libraryHaskellDepends = [
-         active adjunctions array base bytestring cereal colour containers
-         data-default-class diagrams-core diagrams-solve directory
-         distributive dual-tree exceptions filepath fingertree fsnotify
-         hashable intervals JuicyPixels lens linear monoid-extras mtl
-         optparse-applicative process profunctors semigroups tagged text
-         transformers unordered-containers
-       ];
-       testHaskellDepends = [
-         base deepseq diagrams-solve lens numeric-extras tasty tasty-hunit
-         tasty-quickcheck
-       ];
-       benchmarkHaskellDepends = [ base criterion diagrams-core ];
-       homepage = "http://projects.haskell.org/diagrams";
-       description = "Embedded domain-specific language for declarative graphics";
-       license = stdenv.lib.licenses.bsd3;
-     }) {};
-
-  "diagrams-lib_1_4_1_1" = callPackage
-    ({ mkDerivation, active, adjunctions, array, base, bytestring
-     , cereal, colour, containers, criterion, data-default-class
-     , deepseq, diagrams-core, diagrams-solve, directory, distributive
-     , dual-tree, exceptions, filepath, fingertree, fsnotify, hashable
-     , intervals, JuicyPixels, lens, linear, monoid-extras, mtl
-     , numeric-extras, optparse-applicative, process, profunctors
-     , semigroups, tagged, tasty, tasty-hunit, tasty-quickcheck, text
-     , transformers, unordered-containers
-     }:
-     mkDerivation {
-       pname = "diagrams-lib";
-       version = "1.4.1.1";
-       sha256 = "1sgpmxs8n05bl9cq4fmbgwyqra5kr69di2ngwlc2vqf1fpymis9a";
+       version = "1.4.1.2";
+       sha256 = "0w16cljv9jcvn46hd19qvw1bfvxijlak286nap9qbvyavq2qhvjb";
        libraryHaskellDepends = [
          active adjunctions array base bytestring cereal colour containers
          data-default-class diagrams-core diagrams-solve directory
@@ -55532,7 +55691,6 @@ self: {
        homepage = "http://projects.haskell.org/diagrams";
        description = "Embedded domain-specific language for declarative graphics";
        license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "diagrams-pandoc" = callPackage
@@ -58176,6 +58334,34 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
+  "doctest_0_11_3" = callPackage
+    ({ mkDerivation, base, base-compat, code-page, deepseq, directory
+     , filepath, ghc, ghc-paths, hspec, HUnit, mockery, process
+     , QuickCheck, setenv, silently, stringbuilder, syb, transformers
+     , with-location
+     }:
+     mkDerivation {
+       pname = "doctest";
+       version = "0.11.3";
+       sha256 = "0j3qbcvsc389g2y5k5xyln3cik7wfy8ii9c3jp665fywp28r1iys";
+       isLibrary = true;
+       isExecutable = true;
+       libraryHaskellDepends = [
+         base base-compat code-page deepseq directory filepath ghc ghc-paths
+         process syb transformers
+       ];
+       executableHaskellDepends = [ base ];
+       testHaskellDepends = [
+         base base-compat code-page deepseq directory filepath ghc ghc-paths
+         hspec HUnit mockery process QuickCheck setenv silently
+         stringbuilder syb transformers with-location
+       ];
+       homepage = "https://github.com/sol/doctest#readme";
+       description = "Test interactive Haskell examples";
+       license = stdenv.lib.licenses.mit;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "doctest-discover" = callPackage
     ({ mkDerivation, aeson, base, bytestring, directory, doctest
      , filepath
@@ -58482,6 +58668,34 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
+  "dotenv_0_3_4_0" = callPackage
+    ({ mkDerivation, base, base-compat, exceptions, hspec
+     , hspec-megaparsec, megaparsec, optparse-applicative, process, text
+     , transformers
+     }:
+     mkDerivation {
+       pname = "dotenv";
+       version = "0.3.4.0";
+       sha256 = "0rbz73wfsw89pc4l06xqk3x9m5r43r0w1swbmnciwy238v9w7bz8";
+       isLibrary = true;
+       isExecutable = true;
+       libraryHaskellDepends = [
+         base base-compat exceptions megaparsec text transformers
+       ];
+       executableHaskellDepends = [
+         base base-compat megaparsec optparse-applicative process text
+         transformers
+       ];
+       testHaskellDepends = [
+         base base-compat exceptions hspec hspec-megaparsec megaparsec text
+         transformers
+       ];
+       homepage = "https://github.com/stackbuilders/dotenv-hs";
+       description = "Loads environment variables from dotenv files";
+       license = stdenv.lib.licenses.mit;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "dotfs" = callPackage
     ({ mkDerivation, base, bytestring, containers, directory, filepath
      , haskell-src, HFuse, HUnit, parsec, process, QuickCheck
@@ -61186,23 +61400,6 @@ self: {
      }:
      mkDerivation {
        pname = "elm-bridge";
-       version = "0.4.0";
-       sha256 = "1n8znpk75ms50c433lgc594xh6761rx0l65bkjdirch6wig1swj5";
-       libraryHaskellDepends = [ aeson base template-haskell ];
-       testHaskellDepends = [
-         aeson base containers hspec QuickCheck text
-       ];
-       homepage = "https://github.com/agrafix/elm-bridge";
-       description = "Derive Elm types from Haskell types";
-       license = stdenv.lib.licenses.bsd3;
-     }) {};
-
-  "elm-bridge_0_4_1" = callPackage
-    ({ mkDerivation, aeson, base, containers, hspec, QuickCheck
-     , template-haskell, text
-     }:
-     mkDerivation {
-       pname = "elm-bridge";
        version = "0.4.1";
        sha256 = "1wp813l6bdw5x7vpiq098v1gbxzvv3129n2rl4div9mrj53a3i2l";
        revision = "1";
@@ -61214,7 +61411,6 @@ self: {
        homepage = "https://github.com/agrafix/elm-bridge";
        description = "Derive Elm types and Json code from Haskell types";
        license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "elm-build-lib" = callPackage
@@ -63597,20 +63793,20 @@ self: {
 
   "eventful-core" = callPackage
     ({ mkDerivation, aeson, base, containers, hlint, hspec
-     , http-api-data, HUnit, path-pieces, template-haskell, text
-     , transformers, uuid
+     , http-api-data, HUnit, path-pieces, sum-type-boilerplate
+     , template-haskell, text, transformers, uuid
      }:
      mkDerivation {
        pname = "eventful-core";
-       version = "0.1.1";
-       sha256 = "10s5qqc1amqn3zy6grdl6zbx8kfk6ny7q6dla7v743aiv4yi4zga";
+       version = "0.1.2";
+       sha256 = "0vlhn54qiwi6cvvf9r4nwgnlp747y3i1nh9y2dxr8g9zkpj0wcyn";
        libraryHaskellDepends = [
-         aeson base containers http-api-data path-pieces template-haskell
-         text transformers uuid
+         aeson base containers http-api-data path-pieces
+         sum-type-boilerplate template-haskell text transformers uuid
        ];
        testHaskellDepends = [
          aeson base containers hlint hspec http-api-data HUnit path-pieces
-         template-haskell text transformers uuid
+         sum-type-boilerplate template-haskell text transformers uuid
        ];
        homepage = "https://github.com/jdreaver/eventful#readme";
        description = "Core module for eventful";
@@ -63625,8 +63821,8 @@ self: {
      }:
      mkDerivation {
        pname = "eventful-dynamodb";
-       version = "0.1.1";
-       sha256 = "14fc76dzfg1ngg89k92fylyd8j3ym0xgvicl75mxrixpb40zcc9l";
+       version = "0.1.2";
+       sha256 = "0q8wvnxcprh4gz74d4jsia5ripgn87lb2mw037mrf817g0w63dgl";
        libraryHaskellDepends = [
          aeson amazonka amazonka-dynamodb base bytestring conduit
          eventful-core lens safe text unordered-containers vector
@@ -63644,19 +63840,19 @@ self: {
      }) {};
 
   "eventful-memory" = callPackage
-    ({ mkDerivation, async, base, containers, eventful-core
+    ({ mkDerivation, base, containers, eventful-core
      , eventful-test-helpers, hlint, hspec, HUnit, mtl, safe, stm
      }:
      mkDerivation {
        pname = "eventful-memory";
-       version = "0.1.1";
-       sha256 = "1rj2hhw9qrkkakg87xznamr2fnam5y6dl4gmd7bc06jpja8b3lzg";
+       version = "0.1.2";
+       sha256 = "0kq8f6x7q19vlwgfz7mwlisik0j5wi8pxwlliyv2ispa37rlmvgx";
        libraryHaskellDepends = [
-         async base containers eventful-core mtl safe stm
+         base containers eventful-core mtl safe stm
        ];
        testHaskellDepends = [
-         async base containers eventful-core eventful-test-helpers hlint
-         hspec HUnit mtl safe stm
+         base containers eventful-core eventful-test-helpers hlint hspec
+         HUnit mtl safe stm
        ];
        homepage = "https://github.com/jdreaver/eventful#readme";
        description = "In-memory implementations for eventful";
@@ -63670,11 +63866,11 @@ self: {
      }:
      mkDerivation {
        pname = "eventful-postgresql";
-       version = "0.1.1";
-       sha256 = "14icv9h1hjxj15r37xjldii21xpw7cfyinh38ch4045d3lldyals";
+       version = "0.1.2";
+       sha256 = "0aim6907mkjxlwiwkhmjmmfcbagkaq7z633447xr4mw931v8k84l";
        libraryHaskellDepends = [
          aeson base bytestring eventful-core eventful-sql-common mtl
-         persistent persistent-postgresql text
+         persistent text
        ];
        testHaskellDepends = [
          aeson base bytestring eventful-core eventful-sql-common
@@ -63689,15 +63885,15 @@ self: {
 
   "eventful-sql-common" = callPackage
     ({ mkDerivation, aeson, base, bytestring, eventful-core, mtl
-     , persistent, persistent-template, split, text, uuid
+     , persistent, persistent-template, text, uuid
      }:
      mkDerivation {
        pname = "eventful-sql-common";
-       version = "0.1.1";
-       sha256 = "1xk6i34wd0drba7mj7pgd7ynb7mr1bp64jbahnbqc21sck0br8b0";
+       version = "0.1.2";
+       sha256 = "05q1v64l007saazflvp70sz4579dpzpr08qcgzhg2b1m2ga3pwhn";
        libraryHaskellDepends = [
          aeson base bytestring eventful-core mtl persistent
-         persistent-template split text uuid
+         persistent-template text uuid
        ];
        homepage = "https://github.com/jdreaver/eventful#readme";
        description = "Common library for SQL event stores";
@@ -63711,11 +63907,11 @@ self: {
      }:
      mkDerivation {
        pname = "eventful-sqlite";
-       version = "0.1.1";
-       sha256 = "0bnwvk86rjcjy8i2ng4j7v29c75jz9q41x1ks2niq3pnc7kx3sz4";
+       version = "0.1.2";
+       sha256 = "191c8fcw7wyr9bvviz1h9nbwcyrh5sl31arv4s9b3rjw847zg50j";
        libraryHaskellDepends = [
          aeson base bytestring eventful-core eventful-sql-common mtl
-         persistent persistent-sqlite text uuid
+         persistent text uuid
        ];
        testHaskellDepends = [
          aeson base bytestring eventful-core eventful-sql-common
@@ -63733,8 +63929,8 @@ self: {
      }:
      mkDerivation {
        pname = "eventful-test-helpers";
-       version = "0.1.1";
-       sha256 = "0mj3cmm4nn4clr52q8glzn85x9qsdgq3vhsjbb67wvx6j2i3bs9g";
+       version = "0.1.2";
+       sha256 = "17i55zi9npjj7c97lc6fzad5aak46agcr73d5lv3yycm4lk2hj1g";
        libraryHaskellDepends = [
          aeson aeson-casing base eventful-core extra hspec monad-logger
        ];
@@ -64115,8 +64311,8 @@ self: {
        pname = "exceptions";
        version = "0.8.3";
        sha256 = "1gl7xzffsqmigam6zg0jsglncgzxqafld2p6kb7ccp9xirzdjsjd";
-       revision = "1";
-       editedCabalFile = "06qrs9vdscwy6bs9isfyc3b2x9n05xzpas04sq88d6rrc4a2c4zw";
+       revision = "2";
+       editedCabalFile = "1vl59j0l7m53hkzlcfmdbqbab8dk4lp9gzwryn7nsr6ylg94wayw";
        libraryHaskellDepends = [
          base mtl stm template-haskell transformers transformers-compat
        ];
@@ -64848,6 +65044,26 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "extra_1_5_3" = callPackage
+    ({ mkDerivation, base, clock, directory, filepath, process
+     , QuickCheck, time, unix
+     }:
+     mkDerivation {
+       pname = "extra";
+       version = "1.5.3";
+       sha256 = "0w4csmpzj88vkgyngyw4i91f9hfali50xqrqyycr4jh0qyq5sjx4";
+       libraryHaskellDepends = [
+         base clock directory filepath process time unix
+       ];
+       testHaskellDepends = [
+         base clock directory filepath QuickCheck time unix
+       ];
+       homepage = "https://github.com/ndmitchell/extra#readme";
+       description = "Extra functions I use";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "extract-dependencies" = callPackage
     ({ mkDerivation, async, base, Cabal, containers
      , package-description-remote
@@ -66397,6 +66613,24 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {inherit (pkgs) fftw; inherit (pkgs) fftwFloat;};
 
+  "fft_0_1_8_6" = callPackage
+    ({ mkDerivation, array, base, carray, fftw, fftwFloat, ix-shapable
+     , QuickCheck, storable-complex, syb, transformers
+     }:
+     mkDerivation {
+       pname = "fft";
+       version = "0.1.8.6";
+       sha256 = "0hjv3r09imb2ypgbz3qj9hf4f36v977z38gdcad3qa0334qdin1f";
+       libraryHaskellDepends = [
+         array base carray ix-shapable storable-complex syb transformers
+       ];
+       libraryPkgconfigDepends = [ fftw fftwFloat ];
+       testHaskellDepends = [ base carray QuickCheck storable-complex ];
+       description = "Bindings to the FFTW library";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {inherit (pkgs) fftw; inherit (pkgs) fftwFloat;};
+
   "fftwRaw" = callPackage
     ({ mkDerivation, base, fftw }:
      mkDerivation {
@@ -68159,8 +68393,8 @@ self: {
      }:
      mkDerivation {
        pname = "fltkhs";
-       version = "0.5.2.4";
-       sha256 = "196hfy2sw2ikgfnlwycmyn9bm8aykaqh05c67bjr03cgi42rnixk";
+       version = "0.5.2.6";
+       sha256 = "1krjwrwhfjyp80anb8y79a5rgfcs3qdlw6mgwdid5hfpddjbc1nd";
        isLibrary = true;
        isExecutable = true;
        setupHaskellDepends = [ base Cabal directory filepath ];
@@ -68524,6 +68758,29 @@ self: {
        hydraPlatforms = [ "x86_64-darwin" "x86_64-linux" ];
      }) {};
 
+  "foldl-statistics_0_1_4_6" = callPackage
+    ({ mkDerivation, base, criterion, foldl, math-functions, mwc-random
+     , profunctors, quickcheck-instances, statistics, tasty
+     , tasty-quickcheck, vector
+     }:
+     mkDerivation {
+       pname = "foldl-statistics";
+       version = "0.1.4.6";
+       sha256 = "05ibj8gw86n5jspn5qnvvqyihb1fanmk86xxrm04sghxbfc9szzy";
+       libraryHaskellDepends = [ base foldl math-functions profunctors ];
+       testHaskellDepends = [
+         base foldl profunctors quickcheck-instances statistics tasty
+         tasty-quickcheck vector
+       ];
+       benchmarkHaskellDepends = [
+         base criterion foldl mwc-random statistics vector
+       ];
+       homepage = "http://github.com/Data61/foldl-statistics#readme";
+       description = "Statistical functions from the statistics package implemented as Folds";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "foldl-transduce" = callPackage
     ({ mkDerivation, base, bifunctors, bytestring, comonad, containers
      , criterion, doctest, foldl, free, lens-family-core
@@ -69236,8 +69493,8 @@ self: {
      }:
      mkDerivation {
        pname = "foundation";
-       version = "0.0.9";
-       sha256 = "15ji4pr81na7q4d1v5jlrd3sczvhqscndfma43kcblvrgg0p55nv";
+       version = "0.0.10";
+       sha256 = "0ihrdgsn4ivpyhck0qqcfqx2xza1spqv81sd071i151yfyvl1a5p";
        libraryHaskellDepends = [ base ghc-prim ];
        testHaskellDepends = [
          base mtl QuickCheck tasty tasty-hunit tasty-quickcheck
@@ -69249,14 +69506,14 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
-  "foundation_0_0_10" = callPackage
+  "foundation_0_0_11" = callPackage
     ({ mkDerivation, base, criterion, ghc-prim, mtl, QuickCheck, tasty
      , tasty-hunit, tasty-quickcheck
      }:
      mkDerivation {
        pname = "foundation";
-       version = "0.0.10";
-       sha256 = "0ihrdgsn4ivpyhck0qqcfqx2xza1spqv81sd071i151yfyvl1a5p";
+       version = "0.0.11";
+       sha256 = "0jgxcr532vb7376h43l88g0rjgbil2caqnknmznfsprawy6a9s1v";
        libraryHaskellDepends = [ base ghc-prim ];
        testHaskellDepends = [
          base mtl QuickCheck tasty tasty-hunit tasty-quickcheck
@@ -71833,6 +72090,18 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
+  "generic-lens" = callPackage
+    ({ mkDerivation, base }:
+     mkDerivation {
+       pname = "generic-lens";
+       version = "0.2.0.0";
+       sha256 = "05p53pqx0an32zdjj9x7dj4l04yh0p8rww32i8hh2ymg3h616apl";
+       libraryHaskellDepends = [ base ];
+       homepage = "https://github.com/kcsongor/generic-lens";
+       description = "Generic data-structure operations exposed as lenses";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "generic-lucid-scaffold" = callPackage
     ({ mkDerivation, base, lucid, text }:
      mkDerivation {
@@ -72037,14 +72306,12 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
-  "generics-sop_0_3_0_0" = callPackage
+  "generics-sop_0_3_1_0" = callPackage
     ({ mkDerivation, base, deepseq, ghc-prim, template-haskell }:
      mkDerivation {
        pname = "generics-sop";
-       version = "0.3.0.0";
-       sha256 = "0flirwxbkxq1fl4xnnmn166qivm9j1cc5vmqyyb684nxdz2d1g03";
-       revision = "1";
-       editedCabalFile = "0znmanm560ig69ba9hfaj42j91mqn0jifig8ld4d84s4jpprk9rm";
+       version = "0.3.1.0";
+       sha256 = "1bazlhgmxcwv7vd44jhdx74cnhmaz6yy47jxfycapjj4mjrnp0x7";
        libraryHaskellDepends = [ base deepseq ghc-prim template-haskell ];
        testHaskellDepends = [ base ];
        description = "Generic Programming using True Sums of Products";
@@ -73254,6 +73521,53 @@ self: {
        license = stdenv.lib.licenses.agpl3;
      }) {};
 
+  "ghc-mod_5_8_0_0" = callPackage
+    ({ mkDerivation, base, binary, bytestring, Cabal, cabal-helper
+     , containers, criterion, deepseq, directory, djinn-ghc, doctest
+     , extra, fclabels, filepath, ghc, ghc-boot, ghc-paths
+     , ghc-syb-utils, haskell-src-exts, hlint, hspec, monad-control
+     , monad-journal, mtl, old-time, optparse-applicative, pipes
+     , process, safe, semigroups, shelltest, split, syb
+     , template-haskell, temporary, text, time, transformers
+     , transformers-base
+     }:
+     mkDerivation {
+       pname = "ghc-mod";
+       version = "5.8.0.0";
+       sha256 = "1yf4fkg1xj1b66jg6kikzc6djad1xi44y7ark7ghgif0ab0g6rn3";
+       isLibrary = true;
+       isExecutable = true;
+       setupHaskellDepends = [
+         base Cabal containers directory filepath process template-haskell
+         transformers
+       ];
+       libraryHaskellDepends = [
+         base binary bytestring cabal-helper containers deepseq directory
+         djinn-ghc extra fclabels filepath ghc ghc-boot ghc-paths
+         ghc-syb-utils haskell-src-exts hlint monad-control monad-journal
+         mtl old-time optparse-applicative pipes process safe semigroups
+         split syb template-haskell temporary text time transformers
+         transformers-base
+       ];
+       executableHaskellDepends = [
+         base binary deepseq directory fclabels filepath ghc monad-control
+         mtl old-time optparse-applicative process semigroups split time
+       ];
+       testHaskellDepends = [
+         base cabal-helper containers directory doctest fclabels filepath
+         ghc ghc-boot hspec monad-journal mtl process split temporary
+         transformers
+       ];
+       testToolDepends = [ shelltest ];
+       benchmarkHaskellDepends = [
+         base criterion directory filepath temporary
+       ];
+       homepage = "https://github.com/DanielG/ghc-mod";
+       description = "Happy Haskell Hacking";
+       license = stdenv.lib.licenses.agpl3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {shelltest = null;};
+
   "ghc-mtl" = callPackage
     ({ mkDerivation, base, exceptions, extensible-exceptions, ghc, mtl
      }:
@@ -73529,15 +73843,30 @@ self: {
      }) {};
 
   "ghc-syb-utils" = callPackage
-    ({ mkDerivation, base, ghc, syb }:
+    ({ mkDerivation, base, directory, filepath, ghc, ghc-paths, syb }:
      mkDerivation {
        pname = "ghc-syb-utils";
-       version = "0.2.3";
-       sha256 = "0rxwdivpcppwzbqglbrz8rm9f4g1gmba9ij7p7aj3di9x37kzxky";
+       version = "0.2.3.1";
+       sha256 = "13gazr6ydlxrj5yfg9pqhrgm7az9a36m7cfxmmvv1hkq2plfgw7y";
+       libraryHaskellDepends = [ base ghc syb ];
+       testHaskellDepends = [ base directory filepath ghc ghc-paths ];
+       homepage = "http://github.com/nominolo/ghc-syb";
+       description = "Scrap Your Boilerplate utilities for the GHC API";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
+  "ghc-syb-utils_0_2_3_2" = callPackage
+    ({ mkDerivation, base, directory, filepath, ghc, ghc-paths, syb }:
+     mkDerivation {
+       pname = "ghc-syb-utils";
+       version = "0.2.3.2";
+       sha256 = "1h05blm311cg0ricd9skb0m115512mmrrp7g6qh4bbihjmy0l5nb";
        libraryHaskellDepends = [ base ghc syb ];
+       testHaskellDepends = [ base directory filepath ghc ghc-paths ];
        homepage = "http://github.com/nominolo/ghc-syb";
        description = "Scrap Your Boilerplate utilities for the GHC API";
        license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "ghc-tcplugins-extra" = callPackage
@@ -73905,16 +74234,18 @@ self: {
      }) {};
 
   "ghcjs-dom-hello" = callPackage
-    ({ mkDerivation, base, ghcjs-dom, jsaddle-warp, jsaddle-webkit2gtk
-     , mtl
+    ({ mkDerivation, base, ghcjs-dom, jsaddle, jsaddle-warp
+     , jsaddle-webkit2gtk, mtl
      }:
      mkDerivation {
        pname = "ghcjs-dom-hello";
-       version = "5.0.0.0";
-       sha256 = "0v6xdbax9p6q1r5rmrkamnzfhscv9x2bv33jw9848glsxj966ppa";
+       version = "6.0.0.0";
+       sha256 = "16f69w53a3vcfnb805nyn257465gvyv2981gsggvpkzvyqklsp74";
        isLibrary = true;
        isExecutable = true;
-       libraryHaskellDepends = [ base ghcjs-dom mtl ];
+       libraryHaskellDepends = [
+         base ghcjs-dom jsaddle jsaddle-warp mtl
+       ];
        executableHaskellDepends = [
          base ghcjs-dom jsaddle-warp jsaddle-webkit2gtk mtl
        ];
@@ -74446,29 +74777,6 @@ self: {
      }:
      mkDerivation {
        pname = "gi-gtk";
-       version = "3.0.14";
-       sha256 = "0q5yf54idrrkgcc6mx53cvlc8qd7c6hgv491g60vc8i3559nfx20";
-       setupHaskellDepends = [ base Cabal haskell-gi ];
-       libraryHaskellDepends = [
-         base bytestring containers gi-atk gi-cairo gi-gdk gi-gdkpixbuf
-         gi-gio gi-glib gi-gobject gi-pango haskell-gi haskell-gi-base text
-         transformers
-       ];
-       libraryPkgconfigDepends = [ gtk3 ];
-       doHaddock = false;
-       homepage = "https://github.com/haskell-gi/haskell-gi";
-       description = "Gtk bindings";
-       license = stdenv.lib.licenses.lgpl21;
-       hydraPlatforms = stdenv.lib.platforms.none;
-     }) {gtk3 = pkgs.gnome3.gtk;};
-
-  "gi-gtk_3_0_15" = callPackage
-    ({ mkDerivation, base, bytestring, Cabal, containers, gi-atk
-     , gi-cairo, gi-gdk, gi-gdkpixbuf, gi-gio, gi-glib, gi-gobject
-     , gi-pango, gtk3, haskell-gi, haskell-gi-base, text, transformers
-     }:
-     mkDerivation {
-       pname = "gi-gtk";
        version = "3.0.15";
        sha256 = "176hvvrl2w71dy096irazr83v07qd8nixl6gsihn2i9caaxn4scb";
        setupHaskellDepends = [ base Cabal haskell-gi ];
@@ -74492,8 +74800,8 @@ self: {
      }:
      mkDerivation {
        pname = "gi-gtk-hs";
-       version = "0.3.4.2";
-       sha256 = "13p8sda776v5svsz0kilidb3j2284jwf8a4n6dd79jjh84fn90s3";
+       version = "0.3.4.3";
+       sha256 = "0ypvb5iklmw7k7j1jzd62arbn875hwyg0lcx1z24csyin6gl7zda";
        libraryHaskellDepends = [
          base base-compat containers gi-gdk gi-gdkpixbuf gi-glib gi-gobject
          gi-gtk haskell-gi-base mtl text transformers
@@ -75117,8 +75425,8 @@ self: {
      }:
      mkDerivation {
        pname = "git-annex";
-       version = "6.20170519";
-       sha256 = "0avp6f07nsy7hb0334b33dng7hh20qqvaxbrzqyzsbcc9crnlq18";
+       version = "6.20170520";
+       sha256 = "05r701gd7jqjcxcvm8l11fb04z8rqjalf4z8id693q9c2x29pkzq";
        configureFlags = [
          "-fassistant" "-fcryptonite" "-fdbus" "-fdesktopnotify" "-fdns"
          "-ffeed" "-finotify" "-fpairing" "-fproduction" "-fquvi" "-fs3"
@@ -75315,8 +75623,8 @@ self: {
      }:
      mkDerivation {
        pname = "git-mediate";
-       version = "1.0.2";
-       sha256 = "0v1h53fyblq3br3jaga3ajaiywa0qhgysvqknrjga4basaqi220v";
+       version = "1.0.3";
+       sha256 = "01lvw1lb2xfp9yyvj1053cczi1jfzvcxn5q5ls3jzc4g979grw18";
        isLibrary = false;
        isExecutable = true;
        executableHaskellDepends = [
@@ -84495,8 +84803,8 @@ self: {
      }:
      mkDerivation {
        pname = "hail";
-       version = "0.1.0.2";
-       sha256 = "0n1h1wf8vxkyqfa8sw9gh30zmj6akl9ycphy7x5ssrzymj8zkvj3";
+       version = "0.1.0.3";
+       sha256 = "1nh76kk3bfnx802kc6afj6iw1xkj5s4sz07zwmhq32fvqbkmw889";
        isLibrary = false;
        isExecutable = true;
        executableHaskellDepends = [
@@ -84709,6 +85017,20 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "hakka" = callPackage
+    ({ mkDerivation, base, transformers }:
+     mkDerivation {
+       pname = "hakka";
+       version = "0.2.0";
+       sha256 = "02rd2sw4a6ayr4kqqvkr14gxbpd3y9m92m9kvkk5m5701l1nz0xq";
+       isLibrary = true;
+       isExecutable = true;
+       libraryHaskellDepends = [ base transformers ];
+       executableHaskellDepends = [ base ];
+       description = "Minimal akka-inspired actor library";
+       license = stdenv.lib.licenses.mit;
+     }) {};
+
   "hako" = callPackage
     ({ mkDerivation, base, haskell-src-meta, parsec, QuickCheck
      , template-haskell, text, transformers
@@ -84739,8 +85061,8 @@ self: {
      }:
      mkDerivation {
        pname = "hakyll";
-       version = "4.9.5.1";
-       sha256 = "1rngwb75sm8z0mhfms8rkgs2mc505bldynbm4b574wvi74ws7v4d";
+       version = "4.9.7.0";
+       sha256 = "1zy2328lj7k6j0h7nrcd998sk1hbcl67yzaiysaxyif5c60l05ab";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -84769,50 +85091,6 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {inherit (pkgs) utillinux;};
 
-  "hakyll_4_9_6_0" = callPackage
-    ({ mkDerivation, base, binary, blaze-html, blaze-markup, bytestring
-     , containers, cryptohash, data-default, deepseq, directory
-     , filepath, fsnotify, http-conduit, http-types, lrucache, mtl
-     , network, network-uri, optparse-applicative, pandoc
-     , pandoc-citeproc, parsec, process, QuickCheck, random, regex-base
-     , regex-tdfa, resourcet, scientific, system-filepath, tagsoup
-     , tasty, tasty-hunit, tasty-quickcheck, text, time
-     , time-locale-compat, unordered-containers, utillinux, vector, wai
-     , wai-app-static, warp, yaml
-     }:
-     mkDerivation {
-       pname = "hakyll";
-       version = "4.9.6.0";
-       sha256 = "0qkwa8fs5wpqg4gvk19cg5jsjhwyirvwbah1hk7a5b8yfrbsm08c";
-       isLibrary = true;
-       isExecutable = true;
-       libraryHaskellDepends = [
-         base binary blaze-html blaze-markup bytestring containers
-         cryptohash data-default deepseq directory filepath fsnotify
-         http-conduit http-types lrucache mtl network network-uri
-         optparse-applicative pandoc pandoc-citeproc parsec process random
-         regex-base regex-tdfa resourcet scientific system-filepath tagsoup
-         text time time-locale-compat unordered-containers vector wai
-         wai-app-static warp yaml
-       ];
-       executableHaskellDepends = [ base directory filepath ];
-       testHaskellDepends = [
-         base binary blaze-html blaze-markup bytestring containers
-         cryptohash data-default deepseq directory filepath fsnotify
-         http-conduit http-types lrucache mtl network network-uri
-         optparse-applicative pandoc pandoc-citeproc parsec process
-         QuickCheck random regex-base regex-tdfa resourcet scientific
-         system-filepath tagsoup tasty tasty-hunit tasty-quickcheck text
-         time time-locale-compat unordered-containers vector wai
-         wai-app-static warp yaml
-       ];
-       testToolDepends = [ utillinux ];
-       homepage = "http://jaspervdj.be/hakyll";
-       description = "A static website compiler library";
-       license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
-     }) {inherit (pkgs) utillinux;};
-
   "hakyll-R" = callPackage
     ({ mkDerivation, base, directory, filepath, hakyll, pandoc, process
      }:
@@ -85701,15 +85979,15 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
-  "hapistrano_0_3_2_1" = callPackage
+  "hapistrano_0_3_2_2" = callPackage
     ({ mkDerivation, aeson, async, base, directory, filepath, hspec
      , mtl, optparse-applicative, path, path-io, process, stm, temporary
      , time, transformers, yaml
      }:
      mkDerivation {
        pname = "hapistrano";
-       version = "0.3.2.1";
-       sha256 = "0iafa8ina7c78dqhyql8k625s9ibjb15mpw7yizl7mg2rxj2ksb4";
+       version = "0.3.2.2";
+       sha256 = "0yb0www1nab0nybg0nxs64cni9j2n8sw1l5c8byfnivagqz428w7";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -86758,6 +87036,28 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "hasbolt_0_1_1_3" = callPackage
+    ({ mkDerivation, base, binary, bytestring, containers
+     , data-binary-ieee754, data-default, hex, hspec, network
+     , network-simple, QuickCheck, text, transformers
+     }:
+     mkDerivation {
+       pname = "hasbolt";
+       version = "0.1.1.3";
+       sha256 = "1ba85bq8p6cjrxajinb3ykqyffq0h2xcsq80q26y9iy18ys7mcbr";
+       libraryHaskellDepends = [
+         base binary bytestring containers data-binary-ieee754 data-default
+         hex network network-simple text transformers
+       ];
+       testHaskellDepends = [
+         base bytestring containers hex hspec QuickCheck text
+       ];
+       homepage = "https://github.com/zmactep/hasbolt#readme";
+       description = "Haskell driver for Neo4j 3+ (BOLT protocol)";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "hascal" = callPackage
     ({ mkDerivation, base, data-default, split }:
      mkDerivation {
@@ -87378,8 +87678,8 @@ self: {
      }:
      mkDerivation {
        pname = "haskdogs";
-       version = "0.4.5";
-       sha256 = "1k1ihdyj6xm2956xw5fjjrjcf4rb908g2q6hk5fr74yhi72l604i";
+       version = "0.5.0";
+       sha256 = "16ba13qihpxfvb65szzs5ajhk854c0yii939xavwq76dk0cr01w3";
        isLibrary = false;
        isExecutable = true;
        executableHaskellDepends = [
@@ -90108,6 +90408,26 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "haskus-system-build" = callPackage
+    ({ mkDerivation, base, directory, filepath, hashable, haskus-utils
+     , optparse-applicative, optparse-simple, process, simple-download
+     , temporary, text, yaml
+     }:
+     mkDerivation {
+       pname = "haskus-system-build";
+       version = "0.7.0.0";
+       sha256 = "1wfl4n7manfwgwjccvrsfwjb3la7sjg1zpzgj8v6r5sv2zdyl86g";
+       isLibrary = false;
+       isExecutable = true;
+       executableHaskellDepends = [
+         base directory filepath hashable haskus-utils optparse-applicative
+         optparse-simple process simple-download temporary text yaml
+       ];
+       homepage = "http://www.haskus.org/system";
+       description = "Haskus system build tool";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "haskus-utils" = callPackage
     ({ mkDerivation, base, containers, extra, file-embed, list-t, mtl
      , stm, stm-containers, tasty, tasty-quickcheck, template-haskell
@@ -90115,8 +90435,8 @@ self: {
      }:
      mkDerivation {
        pname = "haskus-utils";
-       version = "0.6.0.0";
-       sha256 = "0hph5305ykz9qbc0dbm043q6m4x9bxzgwdnjqby7f6rir6ks995w";
+       version = "0.7.0.0";
+       sha256 = "0s28m6bhc5a1q3z7r1pd9f1l0nhsk5lnsi8y9zqadyg8j4jcv9kx";
        libraryHaskellDepends = [
          base containers extra file-embed list-t mtl stm stm-containers
          template-haskell transformers vector
@@ -90162,14 +90482,15 @@ self: {
      }) {};
 
   "hasmin" = callPackage
-    ({ mkDerivation, attoparsec, base, bytestring, containers, doctest
-     , doctest-discover, gitrev, hopfli, hspec, hspec-attoparsec, matrix
-     , mtl, numbers, optparse-applicative, parsers, QuickCheck, text
+    ({ mkDerivation, attoparsec, base, bytestring, containers
+     , criterion, directory, doctest, doctest-discover, gitrev, hopfli
+     , hspec, hspec-attoparsec, matrix, mtl, numbers
+     , optparse-applicative, parsers, QuickCheck, text
      }:
      mkDerivation {
        pname = "hasmin";
-       version = "0.3.2";
-       sha256 = "16w52fsiw5ahrlyna9q9bs4f7wkkb15ksigshnjsbdbh32qp751f";
+       version = "0.3.2.2";
+       sha256 = "0522rp8cicvizvr183vfr07a5c8a98hz7g6m6pjjk1vzf95b7w20";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -90184,6 +90505,7 @@ self: {
          attoparsec base doctest doctest-discover hspec hspec-attoparsec mtl
          QuickCheck text
        ];
+       benchmarkHaskellDepends = [ base criterion directory text ];
        homepage = "https://github.com/contivero/hasmin#readme";
        description = "\"A CSS Minifier\"";
        license = stdenv.lib.licenses.bsd3;
@@ -91134,6 +91456,8 @@ self: {
        pname = "hbayes";
        version = "0.5.2";
        sha256 = "1x8nwh3ba9qvrbcxd2fdb3lv9b94w6lkvdg4vrqm7vbns9yyk162";
+       revision = "2";
+       editedCabalFile = "19nclaq6y157gn8k4sl79rm30ws5gcykiq4zjmcnm7d5c1rm4dhn";
        libraryHaskellDepends = [
          array base binary boxes containers directory filepath gamma HUnit
          mtl mwc-random parsec pretty QuickCheck random split statistics
@@ -92115,8 +92439,8 @@ self: {
      }:
      mkDerivation {
        pname = "hedgehog";
-       version = "0.2.2";
-       sha256 = "1lnqqjfvqajkav42pcw6dd9cirg6fz900wv6pr2zwq1al21hw32s";
+       version = "0.3";
+       sha256 = "0navcrq51wy7040a8vh9izzln61qpk06z4r4g33j7v6qk2hflwb7";
        libraryHaskellDepends = [
          ansi-terminal async base bytestring concurrent-output containers
          directory exceptions mmorph mtl pretty-show primitive random
@@ -93084,24 +93408,6 @@ self: {
 
   "heterocephalus" = callPackage
     ({ mkDerivation, base, blaze-html, blaze-markup, containers, dlist
-     , doctest, Glob, parsec, shakespeare, template-haskell, text
-     }:
-     mkDerivation {
-       pname = "heterocephalus";
-       version = "1.0.4.0";
-       sha256 = "0alqdw8d41v9ih3crf4lxhz4h9wqy27yv2r31kqpadasy4q8h82a";
-       libraryHaskellDepends = [
-         base blaze-html blaze-markup containers dlist parsec shakespeare
-         template-haskell text
-       ];
-       testHaskellDepends = [ base doctest Glob ];
-       homepage = "https://github.com/arowM/heterocephalus#readme";
-       description = "A type-safe template engine for working with popular front end development tools";
-       license = stdenv.lib.licenses.mit;
-     }) {};
-
-  "heterocephalus_1_0_5_0" = callPackage
-    ({ mkDerivation, base, blaze-html, blaze-markup, containers, dlist
      , doctest, Glob, mtl, parsec, shakespeare, template-haskell, text
      , transformers
      }:
@@ -93117,7 +93423,6 @@ self: {
        homepage = "https://github.com/arowM/heterocephalus#readme";
        description = "A type-safe template engine for working with popular front end development tools";
        license = stdenv.lib.licenses.mit;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "heterolist" = callPackage
@@ -93853,8 +94158,8 @@ self: {
      }:
      mkDerivation {
        pname = "hgis";
-       version = "0.1.3.4";
-       sha256 = "07p2n9nyzispgbdlra5fvr87iglsny9rhch4mkcw95qr74qcw87m";
+       version = "0.1.3.5";
+       sha256 = "1vmx21s0q9w21118m60hzrfk1p704m7675k7idrqlwd4da54ib7c";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -94449,8 +94754,8 @@ self: {
      }:
      mkDerivation {
        pname = "hills";
-       version = "0.1.2.4";
-       sha256 = "0hsnal3agzy4d5y52yyaxscyw3zp7w754glxksz6kzn6n2djg1nq";
+       version = "0.1.2.5";
+       sha256 = "02zmjc056phi8xcdx8i86xms5204q1zkcg9c5dbd8phm11a5n3iz";
        isLibrary = false;
        isExecutable = true;
        executableHaskellDepends = [
@@ -94740,6 +95045,26 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "hint_0_7_0" = callPackage
+    ({ mkDerivation, base, directory, exceptions, extensible-exceptions
+     , filepath, ghc, ghc-paths, HUnit, mtl, random, unix
+     }:
+     mkDerivation {
+       pname = "hint";
+       version = "0.7.0";
+       sha256 = "0mc17qdq0wb57zgh755viwcnby2jkmyv9r7fvq5jwsxx91c776i9";
+       libraryHaskellDepends = [
+         base directory exceptions filepath ghc ghc-paths mtl random unix
+       ];
+       testHaskellDepends = [
+         base directory exceptions extensible-exceptions filepath HUnit
+       ];
+       homepage = "https://github.com/mvdan/hint";
+       description = "Runtime Haskell interpreter (GHC API wrapper)";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "hint-server" = callPackage
     ({ mkDerivation, base, eprocess, exceptions, hint, monad-loops, mtl
      }:
@@ -95847,7 +96172,7 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
-  "hlint_2_0_8" = callPackage
+  "hlint_2_0_9" = callPackage
     ({ mkDerivation, ansi-terminal, base, bytestring, cmdargs
      , containers, cpphs, directory, extra, filepath, haskell-src-exts
      , hscolour, process, refact, text, transformers, uniplate
@@ -95855,8 +96180,8 @@ self: {
      }:
      mkDerivation {
        pname = "hlint";
-       version = "2.0.8";
-       sha256 = "1zdwlyj913cwdi0gfv5wmbqbgsxjg4ypggmkmlzj006sj7qpbn2z";
+       version = "2.0.9";
+       sha256 = "1bd5nizx1dbzhrfcr9mgpjvg4b6f6z73jvslkbialp7g9pkr6a95";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -96540,13 +96865,15 @@ self: {
      , attoparsec-iso8601, base, bytestring, conduit
      , conduit-combinators, conduit-extra, containers, criterion
      , deepseq, directory, hspec, hspec-attoparsec, hspec-core
-     , hspec-expectations, ip, optparse-applicative, permute, random
-     , resourcet, text, time, unordered-containers, word8, yaml
+     , hspec-expectations, ip, lifted-base, monad-control, monad-loops
+     , mtl, optparse-applicative, permute, random, resourcet, text, time
+     , transformers-base, unix, unordered-containers, word8, yaml
+     , zeromq4-conduit, zeromq4-haskell
      }:
      mkDerivation {
        pname = "hnormalise";
-       version = "0.3.3.0";
-       sha256 = "1rrriy9i6bfh1l6q9iwsc9zfcaif3d3f1vmkzm353gprf7vg8fnk";
+       version = "0.4.1.0";
+       sha256 = "0mmkd0nidkffp80nn8yn9i1x7cqsi8qs2qyfgp36sjay58y92744";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -96556,7 +96883,9 @@ self: {
        executableHaskellDepends = [
          aeson aeson-pretty attoparsec attoparsec-iso8601 base bytestring
          conduit conduit-combinators conduit-extra containers directory ip
-         optparse-applicative resourcet text time word8 yaml
+         lifted-base monad-control monad-loops mtl optparse-applicative
+         resourcet text time transformers-base unix word8 yaml
+         zeromq4-conduit zeromq4-haskell
        ];
        testHaskellDepends = [
          aeson attoparsec attoparsec-iso8601 base conduit-extra hspec
@@ -98092,7 +98421,7 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
-  "hpack" = callPackage
+  "hpack_0_17_1" = callPackage
     ({ mkDerivation, aeson, aeson-qq, base, base-compat, bytestring
      , containers, deepseq, directory, filepath, Glob, hspec
      , interpolate, mockery, QuickCheck, temporary, text
@@ -98120,6 +98449,37 @@ self: {
        homepage = "https://github.com/sol/hpack#readme";
        description = "An alternative format for Haskell packages";
        license = stdenv.lib.licenses.mit;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
+  "hpack" = callPackage
+    ({ mkDerivation, aeson, aeson-qq, base, base-compat, bytestring
+     , containers, deepseq, directory, filepath, Glob, hspec
+     , interpolate, mockery, QuickCheck, temporary, text
+     , unordered-containers, yaml
+     }:
+     mkDerivation {
+       pname = "hpack";
+       version = "0.18.0";
+       sha256 = "1z738mw0kzic4wx5dpihh1c1gimpjkl14wl6w2nmmdfx2bdjm5rv";
+       isLibrary = true;
+       isExecutable = true;
+       libraryHaskellDepends = [
+         aeson base base-compat bytestring containers deepseq directory
+         filepath Glob text unordered-containers yaml
+       ];
+       executableHaskellDepends = [
+         aeson base base-compat bytestring containers deepseq directory
+         filepath Glob text unordered-containers yaml
+       ];
+       testHaskellDepends = [
+         aeson aeson-qq base base-compat bytestring containers deepseq
+         directory filepath Glob hspec interpolate mockery QuickCheck
+         temporary text unordered-containers yaml
+       ];
+       homepage = "https://github.com/sol/hpack#readme";
+       description = "An alternative format for Haskell packages";
+       license = stdenv.lib.licenses.mit;
      }) {};
 
   "hpack-convert" = callPackage
@@ -101276,6 +101636,30 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
+  "hspec_2_4_4" = callPackage
+    ({ mkDerivation, base, call-stack, directory, hspec-core
+     , hspec-discover, hspec-expectations, hspec-meta, HUnit, QuickCheck
+     , stringbuilder, transformers
+     }:
+     mkDerivation {
+       pname = "hspec";
+       version = "2.4.4";
+       sha256 = "08fg8w38xbhidw3pfn13ag3mnpp3rb1lzp7xpq47cncwv92k46mh";
+       libraryHaskellDepends = [
+         base call-stack hspec-core hspec-discover hspec-expectations HUnit
+         QuickCheck transformers
+       ];
+       testHaskellDepends = [
+         base call-stack directory hspec-core hspec-discover
+         hspec-expectations hspec-meta HUnit QuickCheck stringbuilder
+         transformers
+       ];
+       homepage = "http://hspec.github.io/";
+       description = "A Testing Framework for Haskell";
+       license = stdenv.lib.licenses.mit;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "hspec-attoparsec" = callPackage
     ({ mkDerivation, attoparsec, base, bytestring, hspec
      , hspec-expectations, text
@@ -101348,6 +101732,33 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
+  "hspec-core_2_4_4" = callPackage
+    ({ mkDerivation, ansi-terminal, array, async, base, call-stack
+     , deepseq, directory, filepath, hspec-expectations, hspec-meta
+     , HUnit, process, QuickCheck, quickcheck-io, random, setenv
+     , silently, temporary, tf-random, time, transformers
+     }:
+     mkDerivation {
+       pname = "hspec-core";
+       version = "2.4.4";
+       sha256 = "1pxzr3l8b9640mh904n51nwlr2338wak23781s48a9kzvwf347b0";
+       libraryHaskellDepends = [
+         ansi-terminal array async base call-stack deepseq directory
+         filepath hspec-expectations HUnit QuickCheck quickcheck-io random
+         setenv tf-random time transformers
+       ];
+       testHaskellDepends = [
+         ansi-terminal array async base call-stack deepseq directory
+         filepath hspec-expectations hspec-meta HUnit process QuickCheck
+         quickcheck-io random setenv silently temporary tf-random time
+         transformers
+       ];
+       homepage = "http://hspec.github.io/";
+       description = "A Testing Framework for Haskell";
+       license = stdenv.lib.licenses.mit;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "hspec-discover" = callPackage
     ({ mkDerivation, base, directory, filepath, hspec-meta }:
      mkDerivation {
@@ -101364,6 +101775,23 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
+  "hspec-discover_2_4_4" = callPackage
+    ({ mkDerivation, base, directory, filepath, hspec-meta }:
+     mkDerivation {
+       pname = "hspec-discover";
+       version = "2.4.4";
+       sha256 = "0isx9nc59nw8pkh4r6ynd55dghqnzgrzn9pvrq6ail1y5z3knhkn";
+       isLibrary = true;
+       isExecutable = true;
+       libraryHaskellDepends = [ base directory filepath ];
+       executableHaskellDepends = [ base directory filepath ];
+       testHaskellDepends = [ base directory filepath hspec-meta ];
+       homepage = "http://hspec.github.io/";
+       description = "Automatically discover and run Hspec tests";
+       license = stdenv.lib.licenses.mit;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "hspec-expectations" = callPackage
     ({ mkDerivation, base, call-stack, HUnit, nanospec }:
      mkDerivation {
@@ -103465,8 +103893,8 @@ self: {
      }:
      mkDerivation {
        pname = "http-conduit-browser";
-       version = "2.0.0.0";
-       sha256 = "1swgsb14mwsfrwhw2ggydi2wm24hrqlisslh5q46qll7rl2gx19q";
+       version = "2.0.0.1";
+       sha256 = "0h8kqjpw859q8kafplbxz5hn7zva71ym25z7vf5vz0pwiw2587wv";
        libraryHaskellDepends = [
          base bytestring conduit containers cookie data-default exceptions
          http-client http-conduit http-types lifted-base monad-control
@@ -106199,20 +106627,21 @@ self: {
      }) {};
 
   "hyperloglog" = callPackage
-    ({ mkDerivation, approximate, base, binary, bits, bytes, cereal
-     , cereal-vector, comonad, deepseq, directory, distributive, doctest
-     , filepath, generic-deriving, hashable, hashable-extras, lens
+    ({ mkDerivation, approximate, base, binary, bits, bytes, Cabal
+     , cabal-doctest, cereal, cereal-vector, comonad, deepseq, directory
+     , distributive, doctest, filepath, generic-deriving, hashable, lens
      , reflection, safecopy, semigroupoids, semigroups, simple-reflect
      , siphash, tagged, vector
      }:
      mkDerivation {
        pname = "hyperloglog";
-       version = "0.4.0.4";
-       sha256 = "0iwqkgrvk7p9qmfbfld7cpparbc2j674i8vzmcwbr06n63ds5mrl";
+       version = "0.4.1";
+       sha256 = "08r0yrnfjcfv0p14p69dqjrsmff4alx5yykkq06mig0wycl4v4q0";
+       setupHaskellDepends = [ base Cabal cabal-doctest ];
        libraryHaskellDepends = [
          approximate base binary bits bytes cereal cereal-vector comonad
-         deepseq distributive hashable hashable-extras lens reflection
-         safecopy semigroupoids semigroups siphash tagged vector
+         deepseq distributive hashable lens reflection safecopy
+         semigroupoids semigroups siphash tagged vector
        ];
        testHaskellDepends = [
          base directory doctest filepath generic-deriving semigroups
@@ -112282,16 +112711,17 @@ self: {
     ({ mkDerivation, aeson, attoparsec, base, base64-bytestring
      , bytestring, containers, deepseq, filepath, ghc-prim, http-types
      , lens, primitive, process, ref-tf, scientific, stm, text, time
-     , transformers, unordered-containers, vector
+     , transformers, unordered-containers, uuid, uuid-types, vector
      }:
      mkDerivation {
        pname = "jsaddle";
-       version = "0.9.0.0";
-       sha256 = "1g61chx063m8n3yvs4z6awmdksvkr0yp5vwd4ffkhl94yczqh0q8";
+       version = "0.9.2.0";
+       sha256 = "0ymq70kwwi60f1rgjnjz914xv465zrnbbw5z351439qg572f8mvg";
        libraryHaskellDepends = [
          aeson attoparsec base base64-bytestring bytestring containers
          deepseq filepath ghc-prim http-types lens primitive process ref-tf
-         scientific stm text time transformers unordered-containers vector
+         scientific stm text time transformers unordered-containers uuid
+         uuid-types vector
        ];
        description = "Interface for JavaScript that works with GHCJS and GHC";
        license = stdenv.lib.licenses.mit;
@@ -112346,18 +112776,19 @@ self: {
 
   "jsaddle-warp" = callPackage
     ({ mkDerivation, aeson, base, bytestring, containers, deepseq
-     , doctest, filepath, ghc-prim, http-types, jsaddle, lens, network
-     , primitive, process, QuickCheck, ref-tf, stm, text, time
-     , transformers, uuid, uuid-types, wai, wai-websockets, warp
+     , doctest, filepath, foreign-store, ghc-prim, http-types, jsaddle
+     , lens, network, primitive, process, QuickCheck, ref-tf, stm, text
+     , time, transformers, uuid, uuid-types, wai, wai-websockets, warp
      , webdriver, websockets
      }:
      mkDerivation {
        pname = "jsaddle-warp";
-       version = "0.9.1.0";
-       sha256 = "0d7q3dr05j81zx13qvl0kxhdmkk9bpka4cc2db8ck4wfnv7nj3yq";
+       version = "0.9.2.0";
+       sha256 = "08r9nzx8yvdw7klv7n19znqfp5r5585fvhz9jsk5mcinpkc7yvyv";
        libraryHaskellDepends = [
-         aeson base bytestring containers http-types jsaddle stm text time
-         transformers uuid uuid-types wai wai-websockets warp websockets
+         aeson base bytestring containers foreign-store http-types jsaddle
+         stm text time transformers uuid uuid-types wai wai-websockets warp
+         websockets
        ];
        testHaskellDepends = [
          aeson base bytestring containers deepseq doctest filepath ghc-prim
@@ -113990,42 +114421,6 @@ self: {
      , semigroups, string-conv, tasty, tasty-golden, tasty-hunit
      , tasty-quickcheck, template-haskell, text, time
      , time-locale-compat, transformers, transformers-base
-     , transformers-compat, unix, unordered-containers
-     }:
-     mkDerivation {
-       pname = "katip";
-       version = "0.3.1.4";
-       sha256 = "14w43fcfqpsammhq8hb7yh9jychrglfcqjkg43aalsj4p53q8xq4";
-       libraryHaskellDepends = [
-         aeson auto-update base bytestring containers either exceptions
-         hostname microlens microlens-th monad-control mtl old-locale
-         resourcet semigroups string-conv template-haskell text time
-         transformers transformers-base transformers-compat unix
-         unordered-containers
-       ];
-       testHaskellDepends = [
-         aeson base bytestring directory microlens quickcheck-instances
-         regex-tdfa tasty tasty-golden tasty-hunit tasty-quickcheck
-         template-haskell text time time-locale-compat unordered-containers
-       ];
-       benchmarkHaskellDepends = [
-         aeson async base blaze-builder criterion deepseq text time
-         transformers unix
-       ];
-       homepage = "https://github.com/Soostone/katip";
-       description = "A structured logging framework";
-       license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
-     }) {};
-
-  "katip_0_3_1_5" = callPackage
-    ({ mkDerivation, aeson, async, auto-update, base, blaze-builder
-     , bytestring, containers, criterion, deepseq, directory, either
-     , exceptions, hostname, microlens, microlens-th, monad-control, mtl
-     , old-locale, quickcheck-instances, regex-tdfa, resourcet
-     , semigroups, string-conv, tasty, tasty-golden, tasty-hunit
-     , tasty-quickcheck, template-haskell, text, time
-     , time-locale-compat, transformers, transformers-base
      , transformers-compat, unagi-chan, unix, unordered-containers
      }:
      mkDerivation {
@@ -114616,12 +115011,12 @@ self: {
      , keera-hails-mvc-solutions-config, keera-hails-mvc-solutions-gtk
      , keera-hails-mvc-view-gtk, keera-hails-reactive-gtk
      , keera-hails-reactivevalues, MissingK, mtl, network, process, SDL
-     , SDL-mixer, setlocale, time, utf8-string
+     , SDL-mixer, SDL_mixer, setlocale, time, utf8-string
      }:
      mkDerivation {
        pname = "keera-posture";
-       version = "0.2.4.1";
-       sha256 = "1gcc4hxcvhaaqgz0q5l1mr7938m1wwl7sky8x1qcg82q8mdvl8vx";
+       version = "0.2.4.3";
+       sha256 = "0kaka302qgax29583kvzhyl6fffzmywh3fk398xhzvixmza9k7sl";
        isLibrary = false;
        isExecutable = true;
        executableHaskellDepends = [
@@ -114635,11 +115030,12 @@ self: {
          keera-hails-reactivevalues MissingK mtl network process SDL
          SDL-mixer setlocale time utf8-string
        ];
+       executableSystemDepends = [ SDL_mixer ];
        homepage = "http://keera.co.uk/projects/keera-posture";
        description = "Get notifications when your sitting posture is inappropriate";
        license = "unknown";
        hydraPlatforms = stdenv.lib.platforms.none;
-     }) {};
+     }) {inherit (pkgs) SDL_mixer;};
 
   "keiretsu" = callPackage
     ({ mkDerivation, aeson, ansi-terminal, async, base, bytestring
@@ -116873,28 +117269,6 @@ self: {
      }:
      mkDerivation {
        pname = "language-javascript";
-       version = "0.6.0.9";
-       sha256 = "1k1ji4iia6wpzls5999hirypxsng5bgfrvbv9zjvn9wczga9hsx8";
-       libraryHaskellDepends = [
-         array base blaze-builder bytestring containers mtl text utf8-string
-       ];
-       libraryToolDepends = [ alex happy ];
-       testHaskellDepends = [
-         array base blaze-builder bytestring Cabal containers hspec mtl
-         QuickCheck utf8-light utf8-string
-       ];
-       homepage = "https://github.com/erikd/language-javascript";
-       description = "Parser for JavaScript";
-       license = stdenv.lib.licenses.bsd3;
-     }) {};
-
-  "language-javascript_0_6_0_10" = callPackage
-    ({ mkDerivation, alex, array, base, blaze-builder, bytestring
-     , Cabal, containers, happy, hspec, mtl, QuickCheck, text
-     , utf8-light, utf8-string
-     }:
-     mkDerivation {
-       pname = "language-javascript";
        version = "0.6.0.10";
        sha256 = "0m1yk0v4myzjjv3czhavwlsgzp8ffpmbkwks97d3yipl1d0lrwfa";
        libraryHaskellDepends = [
@@ -116908,7 +117282,6 @@ self: {
        homepage = "https://github.com/erikd/language-javascript";
        description = "Parser for JavaScript";
        license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "language-kort" = callPackage
@@ -120189,18 +120562,19 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
-  "linear-accelerate_0_3" = callPackage
-    ({ mkDerivation, accelerate, base, Cabal, distributive, filepath
-     , lens, linear
+  "linear-accelerate_0_4" = callPackage
+    ({ mkDerivation, accelerate, base, Cabal, cabal-doctest
+     , distributive, doctest, lens, linear
      }:
      mkDerivation {
        pname = "linear-accelerate";
-       version = "0.3";
-       sha256 = "1aa2vfdhfdvyxnis4xkdjar15ircg2zsp6ljfc2nafwy0l20rvrs";
-       setupHaskellDepends = [ base Cabal filepath ];
+       version = "0.4";
+       sha256 = "03pma42zkk6cfisyfsjmb8496jkfqiab3my4wdahk8z9shmqa3rg";
+       setupHaskellDepends = [ base Cabal cabal-doctest ];
        libraryHaskellDepends = [
          accelerate base distributive lens linear
        ];
+       testHaskellDepends = [ base doctest ];
        homepage = "http://github.com/ekmett/linear-accelerate/";
        description = "Lifting linear vector spaces into Accelerate";
        license = stdenv.lib.licenses.bsd3;
@@ -122220,6 +122594,30 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "log-domain_0_11_1" = callPackage
+    ({ mkDerivation, base, binary, bytes, Cabal, cabal-doctest, cereal
+     , comonad, deepseq, distributive, doctest, generic-deriving
+     , hashable, safecopy, semigroupoids, semigroups, simple-reflect
+     , vector
+     }:
+     mkDerivation {
+       pname = "log-domain";
+       version = "0.11.1";
+       sha256 = "0zbwnx6bs417g67m0hr9n4lk9iwpcm0ivmfhjgaz98hryxx3s8wc";
+       setupHaskellDepends = [ base Cabal cabal-doctest ];
+       libraryHaskellDepends = [
+         base binary bytes cereal comonad deepseq distributive hashable
+         safecopy semigroupoids semigroups vector
+       ];
+       testHaskellDepends = [
+         base doctest generic-deriving semigroups simple-reflect
+       ];
+       homepage = "http://github.com/ekmett/log-domain/";
+       description = "Log-domain arithmetic";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "log-effect" = callPackage
     ({ mkDerivation, base, bytestring, extensible-effects, fast-logger
      , time
@@ -123153,18 +123551,20 @@ self: {
 
   "loup" = callPackage
     ({ mkDerivation, aeson, amazonka, amazonka-swf, base, bytestring
-     , conduit, lifted-async, monad-control, optparse-generic, preamble
-     , shakers, time, turtle, uuid, yaml
+     , conduit, lifted-async, lifted-base, monad-control
+     , optparse-generic, preamble, shakers, time, turtle
+     , unordered-containers, uuid, yaml
      }:
      mkDerivation {
        pname = "loup";
-       version = "0.0.2";
-       sha256 = "1lfa20m67zncn9dpbbrdjq3qbv6qn2h1qb1iy0b5npan9sd85r5z";
+       version = "0.0.5";
+       sha256 = "1c42rp22r37l0fbmd5i463f9pfv7nqchi1rcchv7mcc3wwzyzymq";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
          aeson amazonka amazonka-swf base bytestring conduit lifted-async
-         monad-control preamble time turtle uuid yaml
+         lifted-base monad-control preamble time turtle unordered-containers
+         uuid yaml
        ];
        executableHaskellDepends = [ base optparse-generic shakers ];
        homepage = "https://github.com/swift-nav/loup";
@@ -123256,6 +123656,26 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "lrucaching_0_3_2" = callPackage
+    ({ mkDerivation, base, base-compat, containers, deepseq, hashable
+     , hspec, psqueues, QuickCheck, transformers, vector
+     }:
+     mkDerivation {
+       pname = "lrucaching";
+       version = "0.3.2";
+       sha256 = "1vg6ip77vlqixj2ghvwm036yb4qhkif175k8gfd27nmr4w5rv2ns";
+       libraryHaskellDepends = [
+         base base-compat deepseq hashable psqueues vector
+       ];
+       testHaskellDepends = [
+         base containers deepseq hashable hspec QuickCheck transformers
+       ];
+       homepage = "https://github.com/cocreature/lrucaching#readme";
+       description = "LRU cache";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "ls-usb" = callPackage
     ({ mkDerivation, ansi-wl-pprint, base, base-unicode-symbols
      , cmdtheline, text, usb, usb-id-database, vector
@@ -124645,13 +125065,13 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
-  "makefile_1_0_0_3" = callPackage
+  "makefile_1_0_0_4" = callPackage
     ({ mkDerivation, attoparsec, base, doctest, Glob, QuickCheck, text
      }:
      mkDerivation {
        pname = "makefile";
-       version = "1.0.0.3";
-       sha256 = "0w36rxzx4ryhrmjayqm9fad2zpkxnq4dmpxshd8q2x8wa3wp8j5p";
+       version = "1.0.0.4";
+       sha256 = "17g8syj2l2fr2f22flcngxsnpprl4hbfqpanql1k55a0z19sjr5k";
        libraryHaskellDepends = [ attoparsec base text ];
        testHaskellDepends = [
          attoparsec base doctest Glob QuickCheck text
@@ -127193,25 +127613,6 @@ self: {
      }:
      mkDerivation {
        pname = "memory";
-       version = "0.14.5";
-       sha256 = "01d1bg8pkhw9mpyd7nm5zzpqv9kh9cj2fkd2ywvkay7np2r14820";
-       revision = "1";
-       editedCabalFile = "01g68h3r1h15rrbfsbbk0195fyn93x256j8xwzlb11074sdwr0gy";
-       libraryHaskellDepends = [
-         base bytestring deepseq foundation ghc-prim
-       ];
-       testHaskellDepends = [ base tasty tasty-hunit tasty-quickcheck ];
-       homepage = "https://github.com/vincenthz/hs-memory";
-       description = "memory and related abstraction stuff";
-       license = stdenv.lib.licenses.bsd3;
-     }) {};
-
-  "memory_0_14_6" = callPackage
-    ({ mkDerivation, base, bytestring, deepseq, foundation, ghc-prim
-     , tasty, tasty-hunit, tasty-quickcheck
-     }:
-     mkDerivation {
-       pname = "memory";
        version = "0.14.6";
        sha256 = "0q61zxdlgcw7wg244hb3c11qm5agrmnmln0h61sz2mj72xqc1pn7";
        libraryHaskellDepends = [
@@ -127223,7 +127624,6 @@ self: {
        homepage = "https://github.com/vincenthz/hs-memory";
        description = "memory and related abstraction stuff";
        license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "memorypool" = callPackage
@@ -127260,8 +127660,8 @@ self: {
      }:
      mkDerivation {
        pname = "mercury-api";
-       version = "0.1.0.0";
-       sha256 = "0pyrfwl0jzm8v25aviqflfw4q95hlkq9n6ps44shzb9l0bm5zls1";
+       version = "0.1.0.1";
+       sha256 = "0h5v08k27nqksl3x8r5d4p26zgb4s7k2shgrjkg6bc2n0bn9iqzr";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -127967,6 +128367,27 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "midi-music-box_0_0_0_4" = callPackage
+    ({ mkDerivation, base, containers, diagrams-lib
+     , diagrams-postscript, event-list, midi, non-empty
+     , optparse-applicative, utility-ht
+     }:
+     mkDerivation {
+       pname = "midi-music-box";
+       version = "0.0.0.4";
+       sha256 = "0l8nv3bfbncjbh80dav7qps5aqd20g88sx00xhqr6j9m66znfg1p";
+       isLibrary = false;
+       isExecutable = true;
+       executableHaskellDepends = [
+         base containers diagrams-lib diagrams-postscript event-list midi
+         non-empty optparse-applicative utility-ht
+       ];
+       homepage = "http://hub.darcs.net/thielema/midi-music-box";
+       description = "Convert MIDI file to music box punch tape";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "midi-simple" = callPackage
     ({ mkDerivation, attoparsec, base, bytestring, criterion
      , generic-random, hspec, hspec-attoparsec, QuickCheck, tasty
@@ -128185,17 +128606,18 @@ self: {
 
   "milena" = callPackage
     ({ mkDerivation, base, bytestring, cereal, containers, digest, lens
-     , lifted-base, mtl, murmur-hash, network, QuickCheck, random
-     , resource-pool, semigroups, tasty, tasty-hspec, tasty-quickcheck
-     , transformers
+     , lifted-base, monad-control, mtl, murmur-hash, network, QuickCheck
+     , random, resource-pool, semigroups, tasty, tasty-hspec
+     , tasty-quickcheck, transformers, zlib
      }:
      mkDerivation {
        pname = "milena";
-       version = "0.5.0.2";
-       sha256 = "0jsw9zvilyk8c49g927wi535bx573hcnzf8nzgaxvjmhj6x0wxwf";
+       version = "0.5.1.0";
+       sha256 = "0vfypwp503ab91hca5mmclgxxy0ggzd9g90h7jaj5vxrij7ya5ly";
        libraryHaskellDepends = [
-         base bytestring cereal containers digest lens lifted-base mtl
-         murmur-hash network random resource-pool semigroups transformers
+         base bytestring cereal containers digest lens lifted-base
+         monad-control mtl murmur-hash network random resource-pool
+         semigroups transformers zlib
        ];
        testHaskellDepends = [
          base bytestring lens mtl network QuickCheck semigroups tasty
@@ -128993,6 +129415,27 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
+  "mockery_0_3_5" = callPackage
+    ({ mkDerivation, base, base-compat, bytestring, directory, filepath
+     , hspec, logging-facade, temporary
+     }:
+     mkDerivation {
+       pname = "mockery";
+       version = "0.3.5";
+       sha256 = "09ypgm3z69gq8mj6y66ss58kbjnk15r8frwcwbqcfbfksfnfv8dp";
+       libraryHaskellDepends = [
+         base base-compat bytestring directory filepath logging-facade
+         temporary
+       ];
+       testHaskellDepends = [
+         base base-compat bytestring directory filepath hspec logging-facade
+         temporary
+       ];
+       description = "Support functions for automated testing";
+       license = stdenv.lib.licenses.mit;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "modbus-tcp" = callPackage
     ({ mkDerivation, base, bytestring, cereal, mtl, transformers }:
      mkDerivation {
@@ -129470,6 +129913,23 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "monad-control_1_0_2_0" = callPackage
+    ({ mkDerivation, base, stm, transformers, transformers-base
+     , transformers-compat
+     }:
+     mkDerivation {
+       pname = "monad-control";
+       version = "1.0.2.0";
+       sha256 = "1k5lgwdnbqmzzc7y29pfq7a35g428qivsp5cafdv0mbn5kc59aq5";
+       libraryHaskellDepends = [
+         base stm transformers transformers-base transformers-compat
+       ];
+       homepage = "https://github.com/basvandijk/monad-control";
+       description = "Lift control operations, like exception catching, through monad transformers";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "monad-control-aligned" = callPackage
     ({ mkDerivation, base, stm, transformers, transformers-base
      , transformers-compat
@@ -131227,6 +131687,38 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "morte_1_6_9" = callPackage
+    ({ mkDerivation, alex, array, base, binary, code-page, containers
+     , criterion, deepseq, Earley, http-client, http-client-tls
+     , microlens, microlens-mtl, mtl, optparse-applicative, pipes
+     , QuickCheck, system-fileio, system-filepath, tasty, tasty-hunit
+     , tasty-quickcheck, text, text-format, transformers
+     }:
+     mkDerivation {
+       pname = "morte";
+       version = "1.6.9";
+       sha256 = "1a0s0hj09rhgixs09ay7fjk12d3wrlhm2w957md7pkan412vx200";
+       isLibrary = true;
+       isExecutable = true;
+       libraryHaskellDepends = [
+         array base binary containers deepseq Earley http-client
+         http-client-tls microlens microlens-mtl pipes system-fileio
+         system-filepath text text-format transformers
+       ];
+       libraryToolDepends = [ alex ];
+       executableHaskellDepends = [
+         base code-page optparse-applicative text text-format
+       ];
+       testHaskellDepends = [
+         base mtl QuickCheck system-filepath tasty tasty-hunit
+         tasty-quickcheck text transformers
+       ];
+       benchmarkHaskellDepends = [ base criterion system-filepath text ];
+       description = "A bare-bones calculus of constructions";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "mosaico-lib" = callPackage
     ({ mkDerivation, base, base-unicode-symbols, colour, diagrams-cairo
      , diagrams-core, diagrams-gtk, diagrams-lib, glib, gtk, JuicyPixels
@@ -133052,8 +133544,8 @@ self: {
      }:
      mkDerivation {
        pname = "mvc";
-       version = "1.1.3";
-       sha256 = "0cxnjw5pzxdpg25jw28a6wgjk61znbg90z8nniwdfmskldas6fqf";
+       version = "1.1.4";
+       sha256 = "0nx66swbca3c481abzbpgxfhs93y6bsm897dbk56v0dfdqn0inw4";
        libraryHaskellDepends = [
          async base contravariant foldl managed mmorph pipes
          pipes-concurrency transformers
@@ -134079,6 +134571,8 @@ self: {
        pname = "natural-transformation";
        version = "0.4";
        sha256 = "1by8xwjc23l6pa9l4iv7zp82dykpll3vc3hgxk0pgva724n8xhma";
+       revision = "1";
+       editedCabalFile = "1scwm1gs07znkj4ahfyxpwrksj4rdl1pa81xflcqhkqfgcndvgl3";
        libraryHaskellDepends = [ base ];
        testHaskellDepends = [
          base containers quickcheck-instances tasty tasty-quickcheck
@@ -136322,6 +136816,25 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "nix-derivation" = callPackage
+    ({ mkDerivation, attoparsec, base, containers, criterion, deepseq
+     , QuickCheck, system-filepath, text, vector
+     }:
+     mkDerivation {
+       pname = "nix-derivation";
+       version = "1.0.0";
+       sha256 = "1qx37nk5fg7kqvy9pfvf1jhn9cyr8rkfgz4hm3xy8m92l0rprfw4";
+       libraryHaskellDepends = [
+         attoparsec base containers deepseq system-filepath text vector
+       ];
+       testHaskellDepends = [
+         attoparsec base QuickCheck system-filepath text vector
+       ];
+       benchmarkHaskellDepends = [ attoparsec base criterion text ];
+       description = "Parse and render *.drv files";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "nix-eval" = callPackage
     ({ mkDerivation, base, hindent, process, QuickCheck, strict, tasty
      , tasty-quickcheck
@@ -137780,6 +138293,32 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "oanda-rest-api_0_4_1" = callPackage
+    ({ mkDerivation, aeson, base, bytestring, conduit, containers
+     , Decimal, hlint, hspec, http-client, http-conduit, HUnit, lens
+     , old-locale, resourcet, scientific, text, thyme, transformers
+     , vector
+     }:
+     mkDerivation {
+       pname = "oanda-rest-api";
+       version = "0.4.1";
+       sha256 = "1r20vn0hbx1xca5jaq9djfhgrxgdyhj1m4i9708wd972h2h7q2vr";
+       libraryHaskellDepends = [
+         aeson base bytestring conduit containers Decimal http-client
+         http-conduit lens old-locale resourcet scientific text thyme
+         transformers vector
+       ];
+       testHaskellDepends = [
+         aeson base bytestring conduit containers Decimal hlint hspec
+         http-client http-conduit HUnit lens old-locale resourcet scientific
+         text thyme transformers vector
+       ];
+       homepage = "https://github.com/jdreaver/oanda-rest-api#readme";
+       description = "Client to the OANDA REST API";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "oauth10a" = callPackage
     ({ mkDerivation, aeson, base, base64-bytestring, bytestring
      , cryptohash, entropy, http-types, time, transformers
@@ -138825,6 +139364,63 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {atomspace-cwrapper = null;};
 
+  "opencv" = callPackage
+    ({ mkDerivation, aeson, base, base64-bytestring, bindings-DSL
+     , bytestring, Cabal, containers, criterion, data-default, deepseq
+     , directory, Glob, haskell-src-exts, inline-c, inline-c-cpp
+     , JuicyPixels, lens, linear, opencv, primitive, QuickCheck, repa
+     , tasty, tasty-hunit, tasty-quickcheck, template-haskell, text
+     , transformers, vector
+     }:
+     mkDerivation {
+       pname = "opencv";
+       version = "0.0.0.0";
+       sha256 = "1y2mjb6a6iym6h6m7c214lwrmcjhm9snsqgf1jrbq27fr346mrkb";
+       setupHaskellDepends = [ base Cabal ];
+       libraryHaskellDepends = [
+         aeson base base64-bytestring bindings-DSL bytestring containers
+         data-default deepseq inline-c inline-c-cpp JuicyPixels linear
+         primitive repa template-haskell text transformers vector
+       ];
+       libraryPkgconfigDepends = [ opencv ];
+       testHaskellDepends = [
+         base bytestring containers data-default directory Glob
+         haskell-src-exts JuicyPixels lens linear primitive QuickCheck repa
+         tasty tasty-hunit tasty-quickcheck template-haskell text
+         transformers vector
+       ];
+       benchmarkHaskellDepends = [ base bytestring criterion repa ];
+       hardeningDisable = [ "bindnow" ];
+       homepage = "https://github.com/LumiGuide/haskell-opencv";
+       description = "Haskell binding to OpenCV-3.x";
+       license = stdenv.lib.licenses.bsd3;
+     }) {inherit (pkgs) opencv;};
+
+  "opencv-extra" = callPackage
+    ({ mkDerivation, base, bindings-DSL, bytestring, Cabal, containers
+     , data-default, directory, Glob, haskell-src-exts, inline-c
+     , inline-c-cpp, JuicyPixels, linear, opencv, primitive
+     , template-haskell, text, transformers, vector
+     }:
+     mkDerivation {
+       pname = "opencv-extra";
+       version = "0.0.0.0";
+       sha256 = "18r1y9ppw5i324fyfcbc3wm40gg16816javaxmsny5jc0vbl56gq";
+       setupHaskellDepends = [ base Cabal ];
+       libraryHaskellDepends = [
+         base bindings-DSL bytestring containers inline-c inline-c-cpp
+         linear opencv primitive template-haskell transformers vector
+       ];
+       testHaskellDepends = [
+         base bytestring containers data-default directory Glob
+         haskell-src-exts JuicyPixels linear opencv primitive
+         template-haskell text transformers vector
+       ];
+       homepage = "https://github.com/LumiGuide/haskell-opencv";
+       description = "Haskell binding to OpenCV-3.x extra modules";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "opencv-raw" = callPackage
     ({ mkDerivation, base, bindings-DSL, Cabal, opencv, vector }:
      mkDerivation {
@@ -138948,17 +139544,18 @@ self: {
      }) {EGL = null; GLESv2 = null;};
 
   "openid" = callPackage
-    ({ mkDerivation, base, bytestring, containers, HsOpenSSL, HTTP
-     , monadLib, network, time, xml
+    ({ mkDerivation, base, base-compat, bytestring, containers
+     , HsOpenSSL, HTTP, monadLib, network, network-uri, time, xml
      }:
      mkDerivation {
        pname = "openid";
-       version = "0.2.0.2";
-       sha256 = "0rhd2hz3ls9ifcrifxhd4qvd7axydnlk5gckxay55dp2lcfc4css";
+       version = "0.2.1.0";
+       sha256 = "1vwwwwcw03srgyr612gsnpv0gq8gvbykbwg6myrsn1k8c89f673d";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
-         base bytestring containers HsOpenSSL HTTP monadLib network time xml
+         base base-compat bytestring containers HsOpenSSL HTTP monadLib
+         network network-uri time xml
        ];
        homepage = "http://github.com/elliottt/hsopenid";
        description = "An implementation of the OpenID-2.0 spec.";
@@ -139514,7 +140111,7 @@ self: {
        license = stdenv.lib.licenses.publicDomain;
      }) {};
 
-  "opml-conduit_0_6_0_2" = callPackage
+  "opml-conduit_0_6_0_3" = callPackage
     ({ mkDerivation, base, bytestring, case-insensitive, conduit
      , conduit-combinators, containers, data-default, hlint, lens-simple
      , mono-traversable, monoid-subclasses, mtl, parsers, QuickCheck
@@ -139524,8 +140121,8 @@ self: {
      }:
      mkDerivation {
        pname = "opml-conduit";
-       version = "0.6.0.2";
-       sha256 = "09a19s0g2aimijrjlhs8hcwqcnna5nk7z3h5i5l47prgm45nrxmi";
+       version = "0.6.0.3";
+       sha256 = "1flzv6v1mds7w9v3ap3g7gfwlvq54z0j1w7g2b07d17x334lyhgb";
        libraryHaskellDepends = [
          base case-insensitive conduit conduit-combinators containers
          lens-simple mono-traversable monoid-subclasses safe-exceptions
@@ -139774,14 +140371,14 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
-  "optparse-generic_1_2_0" = callPackage
+  "optparse-generic_1_2_1" = callPackage
     ({ mkDerivation, base, bytestring, optparse-applicative, semigroups
      , system-filepath, text, time, transformers, void
      }:
      mkDerivation {
        pname = "optparse-generic";
-       version = "1.2.0";
-       sha256 = "1zhvrwcrchnls5fhy4m0466hhz84whrc2xm7nxwk1xjnmaqrb4l7";
+       version = "1.2.1";
+       sha256 = "1dk945dp98mwk1v4y0cky3z0ngmd29nbg6fbaaxnigcrgpbvkjml";
        libraryHaskellDepends = [
          base bytestring optparse-applicative semigroups system-filepath
          text time transformers void
@@ -142294,6 +142891,18 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "parser-combinators" = callPackage
+    ({ mkDerivation, base }:
+     mkDerivation {
+       pname = "parser-combinators";
+       version = "0.1.0";
+       sha256 = "18swiwkw5as3xqxqjw46rl07sgjsz5533ki9q3rngfciyzzdj1qv";
+       libraryHaskellDepends = [ base ];
+       homepage = "https://github.com/mrkkrp/parser-combinators";
+       description = "Lightweight package providing commonly useful parser combinators";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "parser-helper" = callPackage
     ({ mkDerivation, aeson, base, bytestring, haskell-src-exts, text }:
      mkDerivation {
@@ -142349,31 +142958,6 @@ self: {
      }) {};
 
   "parsers" = callPackage
-    ({ mkDerivation, attoparsec, base, base-orphans, bytestring
-     , charset, containers, directory, doctest, filepath, parsec
-     , QuickCheck, quickcheck-instances, scientific, text, transformers
-     , unordered-containers
-     }:
-     mkDerivation {
-       pname = "parsers";
-       version = "0.12.4";
-       sha256 = "07najh7f9y3ahh42z96sw4hnd0kc4x3wm0xlf739y0gh81ys5097";
-       revision = "1";
-       editedCabalFile = "1y63jydbb5jsxj66ac0wljk0dyg4prrn2ik1rm636v9g0s8lf2di";
-       libraryHaskellDepends = [
-         attoparsec base base-orphans charset containers parsec scientific
-         text transformers unordered-containers
-       ];
-       testHaskellDepends = [
-         attoparsec base bytestring containers directory doctest filepath
-         parsec QuickCheck quickcheck-instances
-       ];
-       homepage = "http://github.com/ekmett/parsers/";
-       description = "Parsing combinators";
-       license = stdenv.lib.licenses.bsd3;
-     }) {};
-
-  "parsers_0_12_5" = callPackage
     ({ mkDerivation, attoparsec, base, base-orphans, bytestring, Cabal
      , cabal-doctest, charset, containers, directory, doctest, filepath
      , mtl, parsec, QuickCheck, quickcheck-instances, scientific, text
@@ -142395,7 +142979,6 @@ self: {
        homepage = "http://github.com/ekmett/parsers/";
        description = "Parsing combinators";
        license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "parsestar" = callPackage
@@ -142515,8 +143098,8 @@ self: {
      }:
      mkDerivation {
        pname = "partial-order";
-       version = "0.1.2";
-       sha256 = "1lgmrq2fl7jygy7lshzqpqza60xm5w2n4mdvl7cigmyx0rr3nd4s";
+       version = "0.1.2.1";
+       sha256 = "15y3593fl5gabcf0qzyfql30v80sninv1f79dz4v2ll89dzwfzg3";
        libraryHaskellDepends = [ base containers ];
        testHaskellDepends = [
          base containers HUnit test-framework test-framework-hunit
@@ -142660,6 +143243,30 @@ self: {
        license = stdenv.lib.licenses.gpl2;
      }) {};
 
+  "patat_0_5_2_2" = callPackage
+    ({ mkDerivation, aeson, ansi-terminal, ansi-wl-pprint, base
+     , bytestring, containers, directory, filepath, mtl, network
+     , network-uri, optparse-applicative, pandoc, skylighting
+     , terminal-size, text, time, unordered-containers, yaml
+     }:
+     mkDerivation {
+       pname = "patat";
+       version = "0.5.2.2";
+       sha256 = "01g74kw9qszz4781srqsjvf4vxf0rvb4q8yy5nbx3zyp4lwggv3j";
+       isLibrary = false;
+       isExecutable = true;
+       executableHaskellDepends = [
+         aeson ansi-terminal ansi-wl-pprint base bytestring containers
+         directory filepath mtl network network-uri optparse-applicative
+         pandoc skylighting terminal-size text time unordered-containers
+         yaml
+       ];
+       homepage = "http://github.com/jaspervdj/patat";
+       description = "Terminal-based presentations using Pandoc";
+       license = stdenv.lib.licenses.gpl2;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "patch-combinators" = callPackage
     ({ mkDerivation, base }:
      mkDerivation {
@@ -142736,6 +143343,27 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "path_0_6_0" = callPackage
+    ({ mkDerivation, aeson, base, bytestring, deepseq, exceptions
+     , filepath, genvalidity, genvalidity-property, hashable, hspec, mtl
+     , QuickCheck, template-haskell, validity
+     }:
+     mkDerivation {
+       pname = "path";
+       version = "0.6.0";
+       sha256 = "107jkd0wz40njxbdmgvc51q6bjqz71wl0bi0sprjhvgm2bn64x2x";
+       libraryHaskellDepends = [
+         aeson base deepseq exceptions filepath hashable template-haskell
+       ];
+       testHaskellDepends = [
+         aeson base bytestring filepath genvalidity genvalidity-property
+         hspec mtl QuickCheck validity
+       ];
+       description = "Support for well-typed paths";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "path-extra" = callPackage
     ({ mkDerivation, base, exceptions, path }:
      mkDerivation {
@@ -142767,17 +143395,17 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
-  "path-io_1_3_0" = callPackage
-    ({ mkDerivation, base, containers, directory, exceptions, filepath
-     , hspec, path, temporary, time, transformers, unix-compat
+  "path-io_1_3_1" = callPackage
+    ({ mkDerivation, base, containers, directory, dlist, exceptions
+     , filepath, hspec, path, temporary, time, transformers, unix-compat
      }:
      mkDerivation {
        pname = "path-io";
-       version = "1.3.0";
-       sha256 = "1s3rkhfqcrnb3yalwlzd6ldvqlvwgf0h8yzc85l5gld8mwjs2lif";
+       version = "1.3.1";
+       sha256 = "166wxidsfyyv609bjfrn204k7lia02hgb4kmmbfv716dplywsb0q";
        libraryHaskellDepends = [
-         base containers directory exceptions filepath path temporary time
-         transformers unix-compat
+         base containers directory dlist exceptions filepath path temporary
+         time transformers unix-compat
        ];
        testHaskellDepends = [
          base exceptions hspec path transformers unix-compat
@@ -143785,8 +144413,8 @@ self: {
      }:
      mkDerivation {
        pname = "period";
-       version = "0.1.0.5";
-       sha256 = "1y6mijk8860nb0ln64iplnz4bjr4z3h3y25p8g7jdl092s7xwvmn";
+       version = "0.1.0.6";
+       sha256 = "0zk7ac5casyxgdx5895jap7sw0klys26b29kj4f4p1f75b1ga8lz";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -144388,6 +145016,8 @@ self: {
        pname = "persistent-template";
        version = "2.5.2";
        sha256 = "04a0ifjidy7lv5ip0dipjgsvr3h9kkw37z03s5kaxyaqh405nsfy";
+       revision = "1";
+       editedCabalFile = "0jhcanaz680knzc45g594fa68ihh7mkkrhlyaxnj6rjwbrcwjp9x";
        libraryHaskellDepends = [
          aeson aeson-compat base bytestring containers ghc-prim
          http-api-data monad-control monad-logger path-pieces persistent
@@ -144649,8 +145279,8 @@ self: {
      }:
      mkDerivation {
        pname = "pgdl";
-       version = "10.7";
-       sha256 = "0wzy7g6xc8snkfciahahm3qnhg0k21y9535gd1bzz6zmpx113sg9";
+       version = "10.8";
+       sha256 = "127xgzx1j2d4flqykgb6vp57zjmyc6jkx8l2jak4df68wpcy1gwq";
        isLibrary = false;
        isExecutable = true;
        executableHaskellDepends = [
@@ -145306,28 +145936,6 @@ self: {
      }:
      mkDerivation {
        pname = "pinch";
-       version = "0.3.1.0";
-       sha256 = "1gw5bl9l7l6dj1bfnxgikhz8irxpdn4292wvdav4dgkgl90sm2vg";
-       libraryHaskellDepends = [
-         array base bytestring containers deepseq ghc-prim hashable text
-         unordered-containers vector
-       ];
-       testHaskellDepends = [
-         base bytestring containers hspec hspec-discover QuickCheck text
-         unordered-containers vector
-       ];
-       homepage = "https://github.com/abhinav/pinch#readme";
-       description = "An alternative implementation of Thrift for Haskell";
-       license = stdenv.lib.licenses.bsd3;
-     }) {};
-
-  "pinch_0_3_2_0" = callPackage
-    ({ mkDerivation, array, base, bytestring, containers, deepseq
-     , ghc-prim, hashable, hspec, hspec-discover, QuickCheck, text
-     , unordered-containers, vector
-     }:
-     mkDerivation {
-       pname = "pinch";
        version = "0.3.2.0";
        sha256 = "0r0pxdhzlmfg8h13fi10bvy1wxvsk1ckzzlcxbpg6zrly9n0z4m1";
        libraryHaskellDepends = [
@@ -145341,7 +145949,6 @@ self: {
        homepage = "https://github.com/abhinav/pinch#readme";
        description = "An alternative implementation of Thrift for Haskell";
        license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "pinchot" = callPackage
@@ -145565,6 +146172,22 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "pipes-bytestring_2_1_5" = callPackage
+    ({ mkDerivation, base, bytestring, pipes, pipes-group, pipes-parse
+     , transformers
+     }:
+     mkDerivation {
+       pname = "pipes-bytestring";
+       version = "2.1.5";
+       sha256 = "10snjd1abl954gbcl2vxn5vsj830k4sb1jxs8z3h372has13ls9c";
+       libraryHaskellDepends = [
+         base bytestring pipes pipes-group pipes-parse transformers
+       ];
+       description = "ByteString support for pipes";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "pipes-bzip" = callPackage
     ({ mkDerivation, base, bindings-DSL, bytestring, bzip2, bzlib
      , data-default, directory, hspec, MonadRandom, mtl, pipes
@@ -146694,6 +147317,8 @@ self: {
        pname = "plan-b";
        version = "0.2.1";
        sha256 = "038w0y90k7fn13ba5vrpyxa6vjn03lxqdnd2vgki9hmb4idxiakv";
+       revision = "1";
+       editedCabalFile = "0ci5x3vvwgasy47rxmqk2d1z7qakhh34zwgjbc3gydii2vapd7zh";
        libraryHaskellDepends = [
          base exceptions path path-io transformers
        ];
@@ -147569,18 +148194,21 @@ self: {
      }) {};
 
   "polynomial" = callPackage
-    ({ mkDerivation, base, deepseq, pretty, vector, vector-space
-     , vector-th-unbox
+    ({ mkDerivation, base, deepseq, HUnit, pretty, QuickCheck
+     , test-framework, test-framework-hunit, test-framework-quickcheck2
+     , vector, vector-space, vector-th-unbox
      }:
      mkDerivation {
        pname = "polynomial";
-       version = "0.7.2";
-       sha256 = "1w1zpa2l7l7yzqdgr142mqhf73mq8kiz7h3ydpd84n4vawjzz7z1";
-       revision = "1";
-       editedCabalFile = "0davyhlqj2w92k0rnb0v6glkw0xrls90lry9i5lyrqzlypks5jws";
+       version = "0.7.3";
+       sha256 = "0wl9wdaqrs6hs83xi27m879j7i2q04v14jqkrwns2qy3f2yhq2rr";
        libraryHaskellDepends = [
          base deepseq pretty vector vector-space vector-th-unbox
        ];
+       testHaskellDepends = [
+         base HUnit QuickCheck test-framework test-framework-hunit
+         test-framework-quickcheck2 vector vector-space
+       ];
        homepage = "https://github.com/mokus0/polynomial";
        description = "Polynomials";
        license = stdenv.lib.licenses.publicDomain;
@@ -148400,6 +149028,24 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {inherit (pkgs) postgresql;};
 
+  "postgresql-named" = callPackage
+    ({ mkDerivation, base, bytestring, extra, generics-sop, hspec, mtl
+     , postgresql-libpq, postgresql-simple, utf8-string
+     }:
+     mkDerivation {
+       pname = "postgresql-named";
+       version = "0.1.0";
+       sha256 = "0b7a3i8mcp9xs2zga6qi1byy489cl33j3mcrkx3smrz926ahbz95";
+       libraryHaskellDepends = [
+         base bytestring extra generics-sop mtl postgresql-libpq
+         postgresql-simple utf8-string
+       ];
+       testHaskellDepends = [ base generics-sop hspec postgresql-simple ];
+       homepage = "https://github.com/cocreature/postgresql-named#readme";
+       description = "Generic deserialization of PostgreSQL rows based on column names";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "postgresql-orm" = callPackage
     ({ mkDerivation, aeson, base, blaze-builder, bytestring
      , bytestring-builder, directory, filepath, ghc-prim, mtl
@@ -148552,16 +149198,17 @@ self: {
      }) {};
 
   "postgresql-simple-opts" = callPackage
-    ({ mkDerivation, base, bytestring, hspec, markdown-unlit
-     , optparse-applicative, optparse-generic, postgresql-simple
+    ({ mkDerivation, base, bytestring, data-default, either, hspec
+     , markdown-unlit, optparse-applicative, optparse-generic
+     , postgresql-simple
      }:
      mkDerivation {
        pname = "postgresql-simple-opts";
-       version = "0.1.0.4";
-       sha256 = "1rb08900n21afs8vkmbhbma2jhlxw0a6mj4c67cpxgsidrysh174";
+       version = "0.2.0.0";
+       sha256 = "07zsykbxcl1rjbcnq21bw99r77jm743py9lcvk8grnqfjqyn43a7";
        libraryHaskellDepends = [
-         base bytestring markdown-unlit optparse-applicative
-         optparse-generic postgresql-simple
+         base bytestring data-default either markdown-unlit
+         optparse-applicative optparse-generic postgresql-simple
        ];
        testHaskellDepends = [
          base bytestring hspec optparse-applicative postgresql-simple
@@ -148697,26 +149344,26 @@ self: {
   "postgrest" = callPackage
     ({ mkDerivation, aeson, aeson-qq, ansi-wl-pprint, async
      , auto-update, base, base64-bytestring, bytestring
-     , case-insensitive, cassava, configurator, containers
+     , case-insensitive, cassava, configurator-ng, containers
      , contravariant, cookie, either, hasql, hasql-pool
      , hasql-transaction, heredoc, hjsonpointer, hjsonschema, hspec
      , hspec-wai, hspec-wai-json, HTTP, http-types
      , insert-ordered-containers, interpolatedstring-perl6, jwt, lens
      , lens-aeson, monad-control, network-uri, optparse-applicative
-     , parsec, process, protolude, Ranged-sets, regex-tdfa, safe
+     , parsec, process, protolude, Ranged-sets, regex-tdfa, retry, safe
      , scientific, swagger2, text, time, transformers-base, unix
      , unordered-containers, vector, wai, wai-cors, wai-extra
      , wai-middleware-static, warp
      }:
      mkDerivation {
        pname = "postgrest";
-       version = "0.4.1.0";
-       sha256 = "1g344xb9gg8n60wrk9chr0v7k32ryjn7bfcinwj7zydv5xis2j8l";
+       version = "0.4.2.0";
+       sha256 = "0256mjq9xc0shanyb54p1bhbpb68mdadc71c5p7lpr0q4cn91c0m";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
          aeson ansi-wl-pprint base bytestring case-insensitive cassava
-         configurator containers contravariant cookie either hasql
+         configurator-ng containers contravariant cookie either hasql
          hasql-pool hasql-transaction heredoc HTTP http-types
          insert-ordered-containers interpolatedstring-perl6 jwt lens
          lens-aeson network-uri optparse-applicative parsec protolude
@@ -148726,7 +149373,7 @@ self: {
        ];
        executableHaskellDepends = [
          auto-update base base64-bytestring bytestring hasql hasql-pool
-         protolude text time unix warp
+         protolude retry text time unix warp
        ];
        testHaskellDepends = [
          aeson aeson-qq async auto-update base base64-bytestring bytestring
@@ -149792,6 +150439,8 @@ self: {
        pname = "prettyprinter";
        version = "1.1";
        sha256 = "0bksn65rvnc0f59mfzhyl9yaccfh5ap6jxj1r477izlnkfs0k03y";
+       revision = "1";
+       editedCabalFile = "0b3f3b55h49pini9fv01km1ydqwp6l687qmy193y8lcmrygnzbdy";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [ base text ];
@@ -150295,6 +150944,25 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
+  "process-extras_0_7_2" = callPackage
+    ({ mkDerivation, base, bytestring, data-default, deepseq
+     , generic-deriving, HUnit, ListLike, mtl, process, text
+     }:
+     mkDerivation {
+       pname = "process-extras";
+       version = "0.7.2";
+       sha256 = "0n79m1kj59w4s2a86m1hm98019452mhh06szn0jwsvb9xhqi0v77";
+       libraryHaskellDepends = [
+         base bytestring data-default deepseq generic-deriving ListLike mtl
+         process text
+       ];
+       testHaskellDepends = [ base HUnit ];
+       homepage = "https://github.com/seereason/process-extras";
+       description = "Process extras";
+       license = stdenv.lib.licenses.mit;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "process-iterio" = callPackage
     ({ mkDerivation, base, bytestring, cpphs, iterIO, process
      , transformers
@@ -151125,25 +151793,6 @@ self: {
      }:
      mkDerivation {
        pname = "proto-lens";
-       version = "0.2.0.1";
-       sha256 = "1440kfxlwz8inbr68sml9najfb91yybmz5m93qz0fpf550p51h3k";
-       libraryHaskellDepends = [
-         attoparsec base bytestring containers data-default-class
-         lens-family parsec pretty text transformers void
-       ];
-       homepage = "https://github.com/google/proto-lens";
-       description = "A lens-based implementation of protocol buffers in Haskell";
-       license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
-     }) {};
-
-  "proto-lens_0_2_1_0" = callPackage
-    ({ mkDerivation, attoparsec, base, bytestring, containers
-     , data-default-class, lens-family, parsec, pretty, text
-     , transformers, void
-     }:
-     mkDerivation {
-       pname = "proto-lens";
        version = "0.2.1.0";
        sha256 = "1nibz7cqlwj0vp350km80df10330s2hqvhwr36liiqc92ghphvzg";
        libraryHaskellDepends = [
@@ -151174,29 +151823,6 @@ self: {
      }) {};
 
   "proto-lens-combinators" = callPackage
-    ({ mkDerivation, base, data-default-class, HUnit, lens-family
-     , lens-family-core, proto-lens, proto-lens-protoc, test-framework
-     , test-framework-hunit, transformers
-     }:
-     mkDerivation {
-       pname = "proto-lens-combinators";
-       version = "0.1.0.6";
-       sha256 = "0zycwrfn2c6vdp3ld2pspn9d5br0jn4m8qgjaxn0n4h3ilfzrskc";
-       libraryHaskellDepends = [
-         base data-default-class lens-family proto-lens proto-lens-protoc
-         transformers
-       ];
-       testHaskellDepends = [
-         base HUnit lens-family lens-family-core proto-lens
-         proto-lens-protoc test-framework test-framework-hunit
-       ];
-       homepage = "https://github.com/google/proto-lens";
-       description = "Utilities functions to proto-lens";
-       license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
-     }) {};
-
-  "proto-lens-combinators_0_1_0_7" = callPackage
     ({ mkDerivation, base, Cabal, data-default-class, HUnit
      , lens-family, lens-family-core, proto-lens, proto-lens-protoc
      , test-framework, test-framework-hunit, transformers
@@ -151226,8 +151852,8 @@ self: {
      }:
      mkDerivation {
        pname = "proto-lens-descriptors";
-       version = "0.2.0.1";
-       sha256 = "1vjdp3n7fh8qwql9a8gpcgrkcgdpf0d2x4y1i7ghvd6f2gq77jmh";
+       version = "0.2.1.0";
+       sha256 = "1qaprwdxck8h06wha6hp94kia5m247bc73973rz870c7hk2pdh6s";
        libraryHaskellDepends = [
          base bytestring containers data-default-class lens-family
          lens-labels proto-lens text
@@ -151236,29 +151862,27 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
-  "proto-lens-descriptors_0_2_1_0" = callPackage
-    ({ mkDerivation, base, bytestring, containers, data-default-class
-     , lens-family, lens-labels, proto-lens, text
-     }:
+  "proto-lens-optparse" = callPackage
+    ({ mkDerivation, base, optparse-applicative, proto-lens, text }:
      mkDerivation {
-       pname = "proto-lens-descriptors";
-       version = "0.2.1.0";
-       sha256 = "1qaprwdxck8h06wha6hp94kia5m247bc73973rz870c7hk2pdh6s";
+       pname = "proto-lens-optparse";
+       version = "0.1.0.2";
+       sha256 = "1mi4q21i7zzlk6bs8p6ir07bfw2n1kavamxb90v90vdjy42bdbyn";
        libraryHaskellDepends = [
-         base bytestring containers data-default-class lens-family
-         lens-labels proto-lens text
+         base optparse-applicative proto-lens text
        ];
-       description = "Protocol buffers for describing the definitions of messages";
+       homepage = "https://github.com/google/proto-lens";
+       description = "Adapting proto-lens to optparse-applicative ReadMs";
        license = stdenv.lib.licenses.bsd3;
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
-  "proto-lens-optparse" = callPackage
+  "proto-lens-optparse_0_1_0_3" = callPackage
     ({ mkDerivation, base, optparse-applicative, proto-lens, text }:
      mkDerivation {
        pname = "proto-lens-optparse";
-       version = "0.1.0.2";
-       sha256 = "1mi4q21i7zzlk6bs8p6ir07bfw2n1kavamxb90v90vdjy42bdbyn";
+       version = "0.1.0.3";
+       sha256 = "16wk5paba9p7rz1z614d9byszygkqvxca78zwxyzjgvyjw1yssyl";
        libraryHaskellDepends = [
          base optparse-applicative proto-lens text
        ];
@@ -151289,32 +151913,6 @@ self: {
      }:
      mkDerivation {
        pname = "proto-lens-protoc";
-       version = "0.2.0.1";
-       sha256 = "0zsd7gw6nirfsa5pg119a7pqcqmc005ynhqvw2r2ccvdppq5y26y";
-       isLibrary = true;
-       isExecutable = true;
-       libraryHaskellDepends = [
-         base bytestring Cabal containers data-default-class directory
-         filepath haskell-src-exts lens-family lens-labels process
-         proto-lens proto-lens-descriptors text
-       ];
-       executableHaskellDepends = [
-         base bytestring containers data-default-class filepath
-         haskell-src-exts lens-family proto-lens proto-lens-descriptors text
-       ];
-       description = "Protocol buffer compiler for the proto-lens library";
-       license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
-     }) {};
-
-  "proto-lens-protoc_0_2_1_0" = callPackage
-    ({ mkDerivation, base, bytestring, Cabal, containers
-     , data-default-class, directory, filepath, haskell-src-exts
-     , lens-family, lens-labels, process, proto-lens
-     , proto-lens-descriptors, text
-     }:
-     mkDerivation {
-       pname = "proto-lens-protoc";
        version = "0.2.1.0";
        sha256 = "0ywjn4px6sj82h53yzx466gsa42cgfg47w5vzvxfbdzqk4bskfdd";
        isLibrary = true;
@@ -152273,7 +152871,6 @@ self: {
        homepage = "http://www.purescript.org/";
        description = "PureScript Programming Language Compiler";
        license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "purescript-bridge" = callPackage
@@ -152294,7 +152891,6 @@ self: {
        ];
        description = "Generate PureScript data types from Haskell data types";
        license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "purescript-bridge_0_11_0_0" = callPackage
@@ -153015,8 +153611,8 @@ self: {
     ({ mkDerivation, base, process, qtah-generator, qtbase }:
      mkDerivation {
        pname = "qtah-cpp-qt5";
-       version = "0.2.0";
-       sha256 = "1npgfxz3m30lsknw1nw1apmhl40zsaps3ysci23iv92m720zdnnn";
+       version = "0.3.1";
+       sha256 = "0yy6q10lsjhjnvirs2d8pdivs9d0kdilwsm4j7s59jz5xhwzbqzl";
        libraryHaskellDepends = [ base process qtah-generator ];
        librarySystemDepends = [ qtbase ];
        homepage = "http://khumba.net/projects/qtah";
@@ -153026,17 +153622,17 @@ self: {
      }) {inherit (pkgs.qt5) qtbase;};
 
   "qtah-examples" = callPackage
-    ({ mkDerivation, base, binary, bytestring, filepath, hoppy-runtime
-     , qtah-qt5
+    ({ mkDerivation, base, binary, bytestring, containers, filepath
+     , hoppy-runtime, qtah-qt5
      }:
      mkDerivation {
        pname = "qtah-examples";
-       version = "0.2.1";
-       sha256 = "13rwb7vxi1clg5mw6l1qh97knp53prh0hxy9yq40pxpak7wknwd9";
+       version = "0.3.0";
+       sha256 = "0scb00dilgbiqzp1jq0jknx76qb0fc9l9wsv214k9x741q7cv71b";
        isLibrary = false;
        isExecutable = true;
        executableHaskellDepends = [
-         base binary bytestring filepath hoppy-runtime qtah-qt5
+         base binary bytestring containers filepath hoppy-runtime qtah-qt5
        ];
        homepage = "http://khumba.net/projects/qtah";
        description = "Example programs for Qtah Qt bindings";
@@ -153050,8 +153646,8 @@ self: {
      }:
      mkDerivation {
        pname = "qtah-generator";
-       version = "0.2.1";
-       sha256 = "1vrg9cbp9ipvm3c9flg0pdj3n11rw4z9jcnwfgivcsp46rbm6y74";
+       version = "0.3.0";
+       sha256 = "0zyhpb70lcp9r8skq6lzw4xqpa3fndbq4vxk098diqivknl064ff";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [ base ];
@@ -153072,8 +153668,8 @@ self: {
      }:
      mkDerivation {
        pname = "qtah-qt5";
-       version = "0.2.0";
-       sha256 = "12n62sy7226r2bybppivjkaqywna31nnnmhsr4v984mvk53s6iw6";
+       version = "0.3.0";
+       sha256 = "0rrg0ymkhvgdhwcabr4n4alrqkzyyzyggdclygmjp7l2lq4md1ad";
        libraryHaskellDepends = [
          base binary bytestring hoppy-runtime qtah-cpp-qt5 qtah-generator
        ];
@@ -153452,21 +154048,21 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
-  "quickcheck-instances_0_3_14" = callPackage
-    ({ mkDerivation, array, base, bytestring, case-insensitive
-     , containers, hashable, old-time, QuickCheck, scientific, tagged
-     , text, time, unordered-containers, uuid-types, vector
+  "quickcheck-instances_0_3_15" = callPackage
+    ({ mkDerivation, array, base, base-compat, bytestring
+     , case-insensitive, containers, hashable, old-time, QuickCheck
+     , scientific, tagged, text, time, transformers, transformers-compat
+     , unordered-containers, uuid-types, vector
      }:
      mkDerivation {
        pname = "quickcheck-instances";
-       version = "0.3.14";
-       sha256 = "1mq9zg7d0h275lhwqjq5z2hs4ql4v13q7c8x5n6rhp47rr07pcgr";
-       revision = "1";
-       editedCabalFile = "107xlrf2r0d11c4ig33p5rg3hr8di0mbhnzzvkw0q7ys1ik5v0qn";
+       version = "0.3.15";
+       sha256 = "02nwas0i2jlvjahlj5mayhpiy8pkb46xicypjw63kzp1xc6zs3ly";
        libraryHaskellDepends = [
-         array base bytestring case-insensitive containers hashable old-time
-         QuickCheck scientific tagged text time unordered-containers
-         uuid-types vector
+         array base base-compat bytestring case-insensitive containers
+         hashable old-time QuickCheck scientific tagged text time
+         transformers transformers-compat unordered-containers uuid-types
+         vector
        ];
        testHaskellDepends = [
          base containers QuickCheck tagged uuid-types
@@ -153489,6 +154085,19 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
+  "quickcheck-io_0_2_0" = callPackage
+    ({ mkDerivation, base, HUnit, QuickCheck }:
+     mkDerivation {
+       pname = "quickcheck-io";
+       version = "0.2.0";
+       sha256 = "08k4v7pkgjf30pv5j2dfv1gqv6hclxlniyq2sps8zq4zswcr2xzv";
+       libraryHaskellDepends = [ base HUnit QuickCheck ];
+       homepage = "https://github.com/hspec/quickcheck-io#readme";
+       description = "Use HUnit assertions as QuickCheck properties";
+       license = stdenv.lib.licenses.mit;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "quickcheck-poly" = callPackage
     ({ mkDerivation, base, haskell98, hint, MonadCatchIO-mtl
      , QuickCheck, regex-compat, regex-tdfa
@@ -155242,6 +155851,8 @@ self: {
        pname = "rasterific-svg";
        version = "0.3.2.1";
        sha256 = "1pxgazmyl9ky08vx2nnf5k7bw183ljpvzggvddrdlpwzczm8fzki";
+       revision = "1";
+       editedCabalFile = "19w6f01qc1ahwfsqnqb6ajsgv4wqy5vfy54f6x15z1pivnyw37sk";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -157408,27 +158019,6 @@ self: {
 
   "regex" = callPackage
     ({ mkDerivation, array, base, base-compat, bytestring, containers
-     , hashable, regex-base, regex-tdfa, regex-tdfa-text
-     , template-haskell, text, time, time-locale-compat, transformers
-     , unordered-containers
-     }:
-     mkDerivation {
-       pname = "regex";
-       version = "1.0.1.0";
-       sha256 = "1kh4bh1yvpclx5f903pig034b2sjkvm3ijsrwmdh94ws9h0fdc9p";
-       libraryHaskellDepends = [
-         array base base-compat bytestring containers hashable regex-base
-         regex-tdfa regex-tdfa-text template-haskell text time
-         time-locale-compat transformers unordered-containers
-       ];
-       homepage = "http://regex.uk";
-       description = "Toolkit for regex-base";
-       license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
-     }) {};
-
-  "regex_1_0_1_3" = callPackage
-    ({ mkDerivation, array, base, base-compat, bytestring, containers
      , hashable, regex-base, regex-pcre-builtin, regex-tdfa
      , regex-tdfa-text, template-haskell, text, time, time-locale-compat
      , transformers, unordered-containers, utf8-string
@@ -157893,26 +158483,6 @@ self: {
      }:
      mkDerivation {
        pname = "regex-with-pcre";
-       version = "1.0.1.0";
-       sha256 = "0r7fqh9mkbjdf21m9m1j9s21h27c1cm2xcmb3j1ai9ga7jhl4864";
-       libraryHaskellDepends = [
-         base base-compat bytestring containers regex regex-base
-         regex-pcre-builtin regex-pcre-text regex-tdfa template-haskell text
-         transformers unordered-containers
-       ];
-       homepage = "http://regex.uk";
-       description = "Toolkit for regex-base";
-       license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
-     }) {};
-
-  "regex-with-pcre_1_0_1_3" = callPackage
-    ({ mkDerivation, base, base-compat, bytestring, containers, regex
-     , regex-base, regex-pcre-builtin, regex-pcre-text, regex-tdfa
-     , template-haskell, text, transformers, unordered-containers
-     }:
-     mkDerivation {
-       pname = "regex-with-pcre";
        version = "1.0.1.3";
        sha256 = "17pq70wiyq97rh6ba1zsl6rzifi8k5mykn6kwwxcvjqqs9n2nzh9";
        libraryHaskellDepends = [
@@ -159346,6 +159916,19 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "reproject" = callPackage
+    ({ mkDerivation, base, hspec, template-haskell }:
+     mkDerivation {
+       pname = "reproject";
+       version = "0.2.0.0";
+       sha256 = "1h1m5fdlhd2dxpk8bphcvbjybw40lw48b7j1bkk2grq3ljyvgmwl";
+       libraryHaskellDepends = [ base template-haskell ];
+       testHaskellDepends = [ base hspec ];
+       homepage = "https://github.com/agrafix/reproject#readme";
+       description = "Define and combine \"materialized\" projections";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "req" = callPackage
     ({ mkDerivation, aeson, authenticate-oauth, base, blaze-builder
      , bytestring, case-insensitive, connection, data-default-class
@@ -161686,7 +162269,7 @@ self: {
        license = stdenv.lib.licenses.publicDomain;
      }) {};
 
-  "rss-conduit_0_3_1_0" = callPackage
+  "rss-conduit_0_3_1_1" = callPackage
     ({ mkDerivation, base, bytestring, conduit, conduit-combinators
      , containers, data-default, hlint, lens-simple, mono-traversable
      , QuickCheck, quickcheck-instances, resourcet, safe
@@ -161695,8 +162278,8 @@ self: {
      }:
      mkDerivation {
        pname = "rss-conduit";
-       version = "0.3.1.0";
-       sha256 = "1j9wxfadvhs4aaf84q4xy2p1x0ic7zhr22srrwzmw9qjjl4dy4is";
+       version = "0.3.1.1";
+       sha256 = "16pghxkk9pyskhp73sz43nw84w7qw62sdlwqpsrrfs2wr2ab71bd";
        libraryHaskellDepends = [
          base conduit conduit-combinators containers lens-simple
          mono-traversable safe safe-exceptions text time timerep
@@ -162213,6 +162796,8 @@ self: {
        pname = "safe-exceptions";
        version = "0.1.5.0";
        sha256 = "068srl44q66iv939fhk3mxalmxdn7348f6xh46pwg5mjj4vfrvvh";
+       revision = "1";
+       editedCabalFile = "0m0m2bj8xmiqj1qxkl00p0fndn6aw54a4yf2kx2qhijgzc4f1hwl";
        libraryHaskellDepends = [ base deepseq exceptions transformers ];
        testHaskellDepends = [ base hspec void ];
        homepage = "https://github.com/fpco/safe-exceptions#readme";
@@ -163557,22 +164142,23 @@ self: {
   "schematic" = callPackage
     ({ mkDerivation, aeson, base, bytestring, hspec, hspec-core
      , hspec-discover, hspec-smallcheck, HUnit, regex-compat, scientific
-     , singletons, smallcheck, smallcheck-series, text
+     , singletons, smallcheck, smallcheck-series, tagged, text
      , unordered-containers, validationt, vector, vinyl
      }:
      mkDerivation {
        pname = "schematic";
-       version = "0.1.1.0";
-       sha256 = "1g0myq6rslzn4q611r6wvcfdpvvfw8f85rck3ha7qhaw7vmm5vyb";
+       version = "0.1.4.0";
+       sha256 = "11dc24f657wh5g5yx256qnwmajxs5f6pv2ydzdqig3a7al32kvfb";
        libraryHaskellDepends = [
          aeson base bytestring regex-compat scientific singletons smallcheck
-         smallcheck-series text unordered-containers validationt vector
-         vinyl
+         smallcheck-series tagged text unordered-containers validationt
+         vector vinyl
        ];
        testHaskellDepends = [
          aeson base bytestring hspec hspec-core hspec-discover
          hspec-smallcheck HUnit regex-compat singletons smallcheck
-         smallcheck-series text unordered-containers validationt vinyl
+         smallcheck-series tagged text unordered-containers validationt
+         vinyl
        ];
        description = "JSON-biased spec and validation tool";
        license = stdenv.lib.licenses.bsd3;
@@ -163756,30 +164342,6 @@ self: {
      }:
      mkDerivation {
        pname = "scientific";
-       version = "0.3.4.13";
-       sha256 = "0fpn0mwv4rvvn44dn2lm5nxws8w90jv9vlwjy85xsvhn5dvv7bhq";
-       libraryHaskellDepends = [
-         base binary bytestring containers deepseq ghc-prim hashable
-         integer-gmp integer-logarithms text vector
-       ];
-       testHaskellDepends = [
-         base binary bytestring QuickCheck smallcheck tasty tasty-ant-xml
-         tasty-hunit tasty-quickcheck tasty-smallcheck text
-       ];
-       benchmarkHaskellDepends = [ base criterion ];
-       homepage = "https://github.com/basvandijk/scientific";
-       description = "Numbers represented using scientific notation";
-       license = stdenv.lib.licenses.bsd3;
-     }) {};
-
-  "scientific_0_3_4_15" = callPackage
-    ({ mkDerivation, base, binary, bytestring, containers, criterion
-     , deepseq, ghc-prim, hashable, integer-gmp, integer-logarithms
-     , QuickCheck, smallcheck, tasty, tasty-ant-xml, tasty-hunit
-     , tasty-quickcheck, tasty-smallcheck, text, vector
-     }:
-     mkDerivation {
-       pname = "scientific";
        version = "0.3.4.15";
        sha256 = "1gsmpn3563k90nrai0jdjfvkxjjaxs7bxxsfbdpmw4xvbp2lmp9n";
        libraryHaskellDepends = [
@@ -163794,7 +164356,6 @@ self: {
        homepage = "https://github.com/basvandijk/scientific";
        description = "Numbers represented using scientific notation";
        license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "scion" = callPackage
@@ -164452,8 +165013,8 @@ self: {
      }:
      mkDerivation {
        pname = "sdl2-compositor";
-       version = "1.2.0.6";
-       sha256 = "055hafyp8xrdy00fyp9r263nh5ga077q7cv5acb48sagy4fwxyij";
+       version = "1.2.0.7";
+       sha256 = "1yfbqxrfhy951qdcf43vx9gxd4jj3l2dq5bz04blchpq4qzm4876";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -164948,18 +165509,20 @@ self: {
      }) {sedna = null;};
 
   "selda" = callPackage
-    ({ mkDerivation, base, exceptions, hashable, mtl, psqueues, text
-     , time, unordered-containers
+    ({ mkDerivation, base, bytestring, exceptions, hashable, mtl
+     , psqueues, text, time, unordered-containers
      }:
      mkDerivation {
        pname = "selda";
-       version = "0.1.7.0";
-       sha256 = "0mg21i8aw4vmiwnflcmg8qkvqz8fx0j50z67hr2k9pvqld13vr5s";
+       version = "0.1.8.0";
+       sha256 = "13ccbpwsd2w6l534a9l6d1mmssfy1q9lh6df14zf2am8ph184av7";
+       revision = "1";
+       editedCabalFile = "1lqq7ik4s1xvbc94knv57h2k08r8rk4nyhxq6nlfy23spb56r0a6";
        libraryHaskellDepends = [
-         base exceptions hashable mtl psqueues text time
+         base bytestring exceptions hashable mtl psqueues text time
          unordered-containers
        ];
-       homepage = "https://github.com/valderman/selda";
+       homepage = "https://selda.link";
        description = "Type-safe, high-level EDSL for interacting with relational databases";
        license = stdenv.lib.licenses.mit;
      }) {};
@@ -164970,8 +165533,8 @@ self: {
      }:
      mkDerivation {
        pname = "selda-postgresql";
-       version = "0.1.4.0";
-       sha256 = "1zld5pwgfsm9rp8wads0k8dmfn2lbz6y093nj31gv1pkb8w392vs";
+       version = "0.1.5.0";
+       sha256 = "1ziavpl33m82xfv7528nvfgmlamz2rzmdd73gs7zbrvqnizjq4b5";
        libraryHaskellDepends = [
          base bytestring exceptions postgresql-libpq selda text
        ];
@@ -164986,8 +165549,8 @@ self: {
      }:
      mkDerivation {
        pname = "selda-sqlite";
-       version = "0.1.4.0";
-       sha256 = "0irx8j3akzyb325q75jlcjnkir0kp820knaqwn9j393g4v9g1i40";
+       version = "0.1.5.0";
+       sha256 = "10r0sqbps515qbcdfgsi9lkjx5axps02hbgrjgkc7djg01i3c6x1";
        libraryHaskellDepends = [
          base direct-sqlite directory exceptions selda text
        ];
@@ -165423,8 +165986,8 @@ self: {
      }:
      mkDerivation {
        pname = "sensu-run";
-       version = "0.1.1";
-       sha256 = "0gcwwb8w0rr0kjhp13afsszsb81qvnryb5qnhskyr9wpx8vvm9bk";
+       version = "0.1.1.3";
+       sha256 = "1zhhnddp81p42z243i10kma5jic283gqlg190lfifsg8kdg3yms1";
        isLibrary = false;
        isExecutable = true;
        executableHaskellDepends = [
@@ -166899,6 +167462,8 @@ self: {
        pname = "servant-mock";
        version = "0.8.2";
        sha256 = "146z4n7ayg0347kabwdz1crha7ilfdcdx3pazdgsmq2bl8mwad3w";
+       revision = "1";
+       editedCabalFile = "19vvzy09wj0yxjz4sv417c45h1n34nd7zc9n8agxavr3wyi9lihh";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -167422,6 +167987,8 @@ self: {
        pname = "servant-subscriber";
        version = "0.6.0.0";
        sha256 = "0pa0zwb8qqs6y2fcs8acwljym9jmha273gb2v5nyhhfyimdl8x8q";
+       revision = "1";
+       editedCabalFile = "16r1ry5zd67mj5f2mi2sv9ls3vvc6y78ryijp8fcw1rif7mynf7h";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -167993,6 +168560,19 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "setlocale_1_0_0_5" = callPackage
+    ({ mkDerivation, base }:
+     mkDerivation {
+       pname = "setlocale";
+       version = "1.0.0.5";
+       sha256 = "1w4zgpjjy56bpgjjcxh2fj3v4pqwmfhfwwvs5nhys12h8y8q8hsp";
+       libraryHaskellDepends = [ base ];
+       homepage = "https://bitbucket.org/IchUndNichtDu/haskell-setlocale";
+       description = "Haskell bindings to setlocale";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "setoid" = callPackage
     ({ mkDerivation, base, containers, mtl, smallcheck, tasty
      , tasty-discover, tasty-hunit, tasty-quickcheck, tasty-smallcheck
@@ -170767,21 +171347,21 @@ self: {
   "siphon" = callPackage
     ({ mkDerivation, attoparsec, base, bytestring, colonnade
      , contravariant, either, HUnit, pipes, profunctors, QuickCheck
-     , test-framework, test-framework-hunit, test-framework-quickcheck2
-     , text, vector
+     , streaming, test-framework, test-framework-hunit
+     , test-framework-quickcheck2, text, transformers, vector
      }:
      mkDerivation {
        pname = "siphon";
-       version = "0.6";
-       sha256 = "04959v1dmfn5x6gdng3w2dyapr9yr34yqxkzmdw249pldsfbjxjp";
+       version = "0.7";
+       sha256 = "1k03gzgi9d27yzcvmxzibpgc5l6k7g41048x1qxd3l67qpxxbsl9";
        libraryHaskellDepends = [
-         attoparsec base bytestring colonnade contravariant pipes text
+         attoparsec base bytestring colonnade streaming text transformers
          vector
        ];
        testHaskellDepends = [
          base bytestring colonnade contravariant either HUnit pipes
-         profunctors QuickCheck test-framework test-framework-hunit
-         test-framework-quickcheck2 text
+         profunctors QuickCheck streaming test-framework
+         test-framework-hunit test-framework-quickcheck2 text
        ];
        homepage = "https://github.com/andrewthad/colonnade#readme";
        description = "Encode and decode CSV files";
@@ -171709,6 +172289,18 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "smiles" = callPackage
+    ({ mkDerivation, base, hspec, megaparsec, QuickCheck, text }:
+     mkDerivation {
+       pname = "smiles";
+       version = "0.1.0.1";
+       sha256 = "1bmnzwb8i6l8frfwzac1lv6r2iwipd84pwchnl9pam6w7gj0ncck";
+       libraryHaskellDepends = [ base megaparsec text ];
+       testHaskellDepends = [ base hspec megaparsec QuickCheck text ];
+       homepage = "https://github.com/zmactep/smiles#readme";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "smoothie" = callPackage
     ({ mkDerivation, aeson, base, linear, text, vector }:
      mkDerivation {
@@ -173995,8 +174587,8 @@ self: {
      }:
      mkDerivation {
        pname = "sound-collage";
-       version = "0.2";
-       sha256 = "1hishmz0mccxxgz99pda1gykz8iqv7lwjqlxcks940j576mcy1sw";
+       version = "0.2.0.1";
+       sha256 = "0ywsy3q8f6y6k0vg4g21v6cm3n7662ngbzvfx502makdkf47i75a";
        isLibrary = false;
        isExecutable = true;
        executableHaskellDepends = [
@@ -177532,6 +178124,8 @@ self: {
        pname = "storable-endian";
        version = "0.2.6";
        sha256 = "12allvahkgx1nr10z4gp07gwaxqf52n4yyzihdxiilsf127sqhrp";
+       revision = "1";
+       editedCabalFile = "12f8sscsvsarlwz3p6kk9vbvqsbyhs8lhafgn9h7c0z6pz1amrya";
        libraryHaskellDepends = [ base byteorder ];
        description = "Storable instances with endianness";
        license = stdenv.lib.licenses.bsd3;
@@ -177942,6 +178536,8 @@ self: {
        pname = "stream-fusion";
        version = "0.1.2.5";
        sha256 = "006fz03jdwd9d0kwf8ma3077xxmg6zym94pwbb4sx1xcn7zf4yc6";
+       revision = "1";
+       editedCabalFile = "1jyb8mc99ag72y4bqxw997klrikhnxqrbacmx2ag5kmwsd1v1p12";
        libraryHaskellDepends = [ base ];
        homepage = "http://hackage.haskell.org/trac/ghc/ticket/915";
        description = "Faster Haskell lists using stream fusion";
@@ -178100,8 +178696,8 @@ self: {
      }:
      mkDerivation {
        pname = "streaming-conduit";
-       version = "0.1.1.0";
-       sha256 = "1cj2p3c6rs5cbz0jdj7k8mxfnslk96966dshfhjxi56mrpjxmzjy";
+       version = "0.1.2.0";
+       sha256 = "1vzw0lfj8l4ic1fcw0iqiwygg4zrfxw9xdjbl7qpkfsjsbjqyg2q";
        libraryHaskellDepends = [
          base bytestring conduit streaming streaming-bytestring transformers
        ];
@@ -180197,8 +180793,8 @@ self: {
     ({ mkDerivation, base, diagrams-cairo, diagrams-lib, sym }:
      mkDerivation {
        pname = "sym-plot";
-       version = "0.2.0";
-       sha256 = "0186i6c3dyvs5pa4fh0b284wgpm10pgwax9prahirnq8whph94p2";
+       version = "0.3.0";
+       sha256 = "1ppq86fv5knfdcfn3pfiyg7v9k1aq47xp0b6yn8bwkfhcxxmbbhp";
        libraryHaskellDepends = [ base diagrams-cairo diagrams-lib sym ];
        homepage = "http://github.com/akc/sym-plot";
        description = "Plot permutations; an addition to the sym package";
@@ -182681,6 +183277,22 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
+  "tasty-quickcheck_0_9" = callPackage
+    ({ mkDerivation, base, pcre-light, QuickCheck, random, tagged
+     , tasty, tasty-hunit
+     }:
+     mkDerivation {
+       pname = "tasty-quickcheck";
+       version = "0.9";
+       sha256 = "00h7vvmadiq07bzd9dpi8maw1apshz66si9vkkqzxmgvnv9src33";
+       libraryHaskellDepends = [ base QuickCheck random tagged tasty ];
+       testHaskellDepends = [ base pcre-light tasty tasty-hunit ];
+       homepage = "http://documentup.com/feuerbach/tasty";
+       description = "QuickCheck support for the Tasty test framework";
+       license = stdenv.lib.licenses.mit;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "tasty-rerun" = callPackage
     ({ mkDerivation, base, containers, mtl, optparse-applicative
      , reducers, split, stm, tagged, tasty, transformers
@@ -183105,6 +183717,28 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "teardown" = callPackage
+    ({ mkDerivation, ansi-wl-pprint, base, criterion, doctest, Glob
+     , protolude, QuickCheck, tasty, tasty-hspec, tasty-hunit
+     , tasty-rerun, tasty-smallcheck, text, time
+     }:
+     mkDerivation {
+       pname = "teardown";
+       version = "0.0.0.2";
+       sha256 = "0d28sxx2krf3p5alj8gn8gs98slfs9fqwbaf6lyimayy2fx9d5jf";
+       libraryHaskellDepends = [
+         ansi-wl-pprint base protolude text time
+       ];
+       testHaskellDepends = [
+         base doctest Glob protolude QuickCheck tasty tasty-hspec
+         tasty-hunit tasty-rerun tasty-smallcheck text time
+       ];
+       benchmarkHaskellDepends = [ base criterion protolude text time ];
+       homepage = "https://github.com/roman/Haskell-teardown#readme";
+       description = "Build composable, idempotent & transparent application cleanup sub-routines";
+       license = stdenv.lib.licenses.mit;
+     }) {};
+
   "teeth" = callPackage
     ({ mkDerivation, base }:
      mkDerivation {
@@ -183549,6 +184183,26 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "temporary_1_2_1" = callPackage
+    ({ mkDerivation, base, base-compat, directory, exceptions, filepath
+     , tasty, tasty-hunit, transformers, unix
+     }:
+     mkDerivation {
+       pname = "temporary";
+       version = "1.2.1";
+       sha256 = "1y54fx183sfmpd3xj94c74z9v42y1d7ski3jqrfrd7pnbh38ikwy";
+       libraryHaskellDepends = [
+         base directory exceptions filepath transformers unix
+       ];
+       testHaskellDepends = [
+         base base-compat directory filepath tasty tasty-hunit unix
+       ];
+       homepage = "https://github.com/feuerbach/temporary";
+       description = "Portable temporary file and directory support";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "temporary-rc" = callPackage
     ({ mkDerivation, base, directory, exceptions, filepath
      , transformers, unix
@@ -183886,8 +184540,8 @@ self: {
      }:
      mkDerivation {
        pname = "terminal-progress-bar";
-       version = "0.1.1";
-       sha256 = "107kr4yii14fg1330i3n8w0hqhxswys4f945x1m8ldqkj6naflr0";
+       version = "0.1.1.1";
+       sha256 = "1y9mpmnbc12bbybaqq7cqwhvbbdbx31zxkb63mymiaz1bnhi58fp";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [ base stm stm-chans ];
@@ -185048,6 +185702,23 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "text-metrics_0_3_0" = callPackage
+    ({ mkDerivation, base, containers, criterion, deepseq, hspec
+     , QuickCheck, text, vector, weigh
+     }:
+     mkDerivation {
+       pname = "text-metrics";
+       version = "0.3.0";
+       sha256 = "18mzxwkdvjp31r720ai9bnxr638qq8x3a2v408bz0d8f0rsayx1q";
+       libraryHaskellDepends = [ base containers text vector ];
+       testHaskellDepends = [ base hspec QuickCheck text ];
+       benchmarkHaskellDepends = [ base criterion deepseq text weigh ];
+       homepage = "https://github.com/mrkkrp/text-metrics";
+       description = "Calculate various string metrics efficiently";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "text-normal" = callPackage
     ({ mkDerivation, base, deepseq, hspec, QuickCheck
      , quickcheck-instances, text, text-icu
@@ -185198,6 +185869,25 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "text-short" = callPackage
+    ({ mkDerivation, base, binary, bytestring, deepseq, hashable
+     , quickcheck-instances, tasty, tasty-hunit, tasty-quickcheck, text
+     }:
+     mkDerivation {
+       pname = "text-short";
+       version = "0.1";
+       sha256 = "0zlkvzh99dyrvvk4i9pbhwkj2kf8akc8j1g3z06saprl7kjz6sn0";
+       libraryHaskellDepends = [
+         base binary bytestring deepseq hashable text
+       ];
+       testHaskellDepends = [
+         base binary quickcheck-instances tasty tasty-hunit tasty-quickcheck
+         text
+       ];
+       description = "Memory-efficient representation of Unicode text strings";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "text-show" = callPackage
     ({ mkDerivation, array, base, base-compat, base-orphans, bifunctors
      , bytestring, bytestring-builder, containers, contravariant
@@ -185249,6 +185939,8 @@ self: {
        pname = "text-show";
        version = "3.6";
        sha256 = "0gvg1fpgvws75zhvxdkcg03m6sy5rv4m77fynjh8v6rakbiy7gb4";
+       revision = "1";
+       editedCabalFile = "052zp68y3fbwvg9xigngaqfv7afjw9prfns5qlx6s7mv3i8dc2mk";
        libraryHaskellDepends = [
          array base base-compat bifunctors bytestring bytestring-builder
          containers contravariant generic-deriving ghc-boot-th ghc-prim
@@ -185323,6 +186015,8 @@ self: {
        pname = "text-show-instances";
        version = "3.6.1";
        sha256 = "1ws5gkmb7y21aw6lrakjq760lgg7j8r5rfm45sdfalhgasxh54lz";
+       revision = "1";
+       editedCabalFile = "1zkncw3nflhqgs0wmfj4pz2jvbp2hq5xanyv3ggdbjff6zzpcx6m";
        libraryHaskellDepends = [
          base base-compat bifunctors binary bytestring containers directory
          ghc-boot-th haskeline hoopl hpc old-locale old-time pretty process
@@ -185652,8 +186346,8 @@ self: {
     ({ mkDerivation, base, containers, ghc-prim, template-haskell }:
      mkDerivation {
        pname = "th-abstraction";
-       version = "0.2.1.0";
-       sha256 = "08kn5siadiz4zv1p03bcys1yzsdaac10l2rh017g2sxrb40hnffk";
+       version = "0.2.2.0";
+       sha256 = "00xnyknp1xgbr6rqbmdbpvxrnd3pw1wax46vv03g8bbjm0m4d7kd";
        libraryHaskellDepends = [
          base containers ghc-prim template-haskell
        ];
@@ -186010,6 +186704,24 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "th-reify-many_0_1_7" = callPackage
+    ({ mkDerivation, base, containers, mtl, safe, template-haskell
+     , th-expand-syns
+     }:
+     mkDerivation {
+       pname = "th-reify-many";
+       version = "0.1.7";
+       sha256 = "1sa4gxkkv30h6g12cqss3qffmphcamfqmvnn69ix2w0wlsya81m8";
+       libraryHaskellDepends = [
+         base containers mtl safe template-haskell th-expand-syns
+       ];
+       testHaskellDepends = [ base template-haskell ];
+       homepage = "http://github.com/mgsloan/th-reify-many";
+       description = "Recurseively reify template haskell datatype info";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "th-sccs" = callPackage
     ({ mkDerivation, base, containers, template-haskell }:
      mkDerivation {
@@ -186221,6 +186933,33 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "these_0_7_4" = callPackage
+    ({ mkDerivation, aeson, base, bifunctors, binary, containers
+     , data-default-class, deepseq, hashable, keys, mtl, profunctors
+     , QuickCheck, quickcheck-instances, semigroupoids, tasty
+     , tasty-quickcheck, transformers, transformers-compat
+     , unordered-containers, vector, vector-instances
+     }:
+     mkDerivation {
+       pname = "these";
+       version = "0.7.4";
+       sha256 = "0jl8ippnsy5zmy52cvpn252hm2g7xqp1zb1xcrbgr00pmdxpvwyw";
+       libraryHaskellDepends = [
+         aeson base bifunctors binary containers data-default-class deepseq
+         hashable keys mtl profunctors QuickCheck semigroupoids transformers
+         transformers-compat unordered-containers vector vector-instances
+       ];
+       testHaskellDepends = [
+         aeson base bifunctors binary containers hashable QuickCheck
+         quickcheck-instances tasty tasty-quickcheck transformers
+         unordered-containers vector
+       ];
+       homepage = "https://github.com/isomorphism/these";
+       description = "An either-or-both data type & a generalized 'zip with padding' typeclass";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "thespian" = callPackage
     ({ mkDerivation, base, containers, mtl }:
      mkDerivation {
@@ -186444,8 +187183,8 @@ self: {
      }:
      mkDerivation {
        pname = "threepenny-editors";
-       version = "0.2.0.10";
-       sha256 = "0hspg2zlkcmckdx2skgx3yh1sprx3a5fa57xspv4vcj0rws4kjr2";
+       version = "0.2.0.11";
+       sha256 = "0wq8s88l3pdl2n00gfyzg99dg2fd7d7gcq7pssxhg3z4rv72fdif";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -186628,6 +187367,23 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "throwable-exceptions" = callPackage
+    ({ mkDerivation, base, either, safe-exceptions, tasty
+     , tasty-discover, tasty-hunit, text
+     }:
+     mkDerivation {
+       pname = "throwable-exceptions";
+       version = "0.1.0.4";
+       sha256 = "1hpji5db3hg36f4ry3xsgl4cynw0djx3a61i19q4cy9sqbbdlw4c";
+       libraryHaskellDepends = [ base safe-exceptions ];
+       testHaskellDepends = [
+         base either safe-exceptions tasty tasty-discover tasty-hunit text
+       ];
+       homepage = "https://github.com/aiya000/hs-throwable-exceptions#README.md";
+       description = "throwable-exceptions gives the exception's value constructors";
+       license = stdenv.lib.licenses.mit;
+     }) {};
+
   "thumbnail" = callPackage
     ({ mkDerivation, base, bytestring, gd }:
      mkDerivation {
@@ -187702,24 +188458,6 @@ self: {
      }:
      mkDerivation {
        pname = "timezone-olson";
-       version = "0.1.7";
-       sha256 = "1am6vqq3zxrnb444waqfajk3s1wpynw9fszqnk9ww7akf2v5abr3";
-       revision = "2";
-       editedCabalFile = "1ss4ipn11m6y8bq9pw9i7cs3yciqacf7y281749xc77a1w2nw19b";
-       libraryHaskellDepends = [
-         base binary bytestring extensible-exceptions time timezone-series
-       ];
-       homepage = "http://projects.haskell.org/time-ng/";
-       description = "A pure Haskell parser and renderer for binary Olson timezone files";
-       license = stdenv.lib.licenses.bsd3;
-     }) {};
-
-  "timezone-olson_0_1_8" = callPackage
-    ({ mkDerivation, base, binary, bytestring, extensible-exceptions
-     , time, timezone-series
-     }:
-     mkDerivation {
-       pname = "timezone-olson";
        version = "0.1.8";
        sha256 = "0irpvmqpiw4j2wq4rn3jrndgn2jg10yvrnxvsrb1l6g5b80h2sxr";
        libraryHaskellDepends = [
@@ -187728,7 +188466,6 @@ self: {
        homepage = "http://projects.haskell.org/time-ng/";
        description = "A pure Haskell parser and renderer for binary Olson timezone files";
        license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "timezone-olson-th" = callPackage
@@ -189420,6 +190157,85 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "trasa" = callPackage
+    ({ mkDerivation, base, binary, bytestring, doctest, http-types
+     , tasty, tasty-hunit, tasty-quickcheck, text, unordered-containers
+     , vinyl
+     }:
+     mkDerivation {
+       pname = "trasa";
+       version = "0.1";
+       sha256 = "118x1z2hwx5gagiw4fas30jsdn1igqry2gydpjfnn9nvzf639x6y";
+       libraryHaskellDepends = [
+         base binary bytestring http-types text unordered-containers vinyl
+       ];
+       testHaskellDepends = [
+         base bytestring doctest tasty tasty-hunit tasty-quickcheck text
+         vinyl
+       ];
+       homepage = "https://github.com/haskell-trasa/trasa#readme";
+       description = "Type Safe Web Routing";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
+  "trasa-client" = callPackage
+    ({ mkDerivation, aeson, base, binary, bytestring, http-client
+     , http-types, ip, text, trasa, unordered-containers
+     }:
+     mkDerivation {
+       pname = "trasa-client";
+       version = "0.1.0.0";
+       sha256 = "00vhl41al809njjl94j5prrbhihc02627qfsacqy294sdf5pf6kd";
+       libraryHaskellDepends = [
+         base binary bytestring http-client http-types text trasa
+       ];
+       testHaskellDepends = [
+         aeson base http-client http-types ip text trasa
+         unordered-containers
+       ];
+       description = "Type safe http requests";
+       license = stdenv.lib.licenses.mit;
+     }) {};
+
+  "trasa-reflex" = callPackage
+    ({ mkDerivation, base, bytestring, containers, ghcjs-dom
+     , http-types, jsaddle, reflex, reflex-dom, text, trasa
+     }:
+     mkDerivation {
+       pname = "trasa-reflex";
+       version = "0.1.0.0";
+       sha256 = "10c9ssk5dzvqglhism3g3kpracaf4j913gd6m639ry8nkax0ndyv";
+       libraryHaskellDepends = [
+         base bytestring containers ghcjs-dom http-types jsaddle reflex
+         reflex-dom text trasa
+       ];
+       description = "Reactive Type Safe Routing";
+       license = stdenv.lib.licenses.mit;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
+  "trasa-server" = callPackage
+    ({ mkDerivation, base, bytestring, case-insensitive, containers
+     , doctest, http-client, http-types, mtl, tasty, tasty-hunit
+     , tasty-quickcheck, text, trasa, vinyl, wai, warp
+     }:
+     mkDerivation {
+       pname = "trasa-server";
+       version = "0.1";
+       sha256 = "1pj0rlpn0625vxm5hzik1vj2yrfkc8dmf04hc6mcjrpb78yyd2ai";
+       libraryHaskellDepends = [
+         base bytestring case-insensitive containers http-types mtl text
+         trasa wai
+       ];
+       testHaskellDepends = [
+         base bytestring doctest http-client tasty tasty-hunit
+         tasty-quickcheck text trasa vinyl warp
+       ];
+       homepage = "https://github.com/haskell-trasa/trasa#readme";
+       description = "Type safe web server";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "traverse-with-class" = callPackage
     ({ mkDerivation, base, template-haskell, transformers }:
      mkDerivation {
@@ -190160,30 +190976,6 @@ self: {
      }:
      mkDerivation {
        pname = "tttool";
-       version = "1.7.0.2";
-       sha256 = "08h3s1jldrlz9im5bb7s83jgr9grc9sd0i6im49fsb54nmahc41p";
-       isLibrary = false;
-       isExecutable = true;
-       executableHaskellDepends = [
-         aeson base binary bytestring containers directory executable-path
-         filepath hashable haskeline HPDF JuicyPixels mtl natural-sort
-         optparse-applicative parsec process random split spool
-         template-haskell time vector yaml zlib
-       ];
-       homepage = "https://github.com/entropia/tip-toi-reveng";
-       description = "Working with files for the Tiptoi® pen";
-       license = stdenv.lib.licenses.mit;
-     }) {};
-
-  "tttool_1_7_0_3" = callPackage
-    ({ mkDerivation, aeson, base, binary, bytestring, containers
-     , directory, executable-path, filepath, hashable, haskeline, HPDF
-     , JuicyPixels, mtl, natural-sort, optparse-applicative, parsec
-     , process, random, split, spool, template-haskell, time, vector
-     , yaml, zlib
-     }:
-     mkDerivation {
-       pname = "tttool";
        version = "1.7.0.3";
        sha256 = "0r8ha8wgzlf2ymyxylj16hfshf8w5dl13cwmdkl6ih2niwkzk9ch";
        isLibrary = false;
@@ -190197,7 +190989,6 @@ self: {
        homepage = "https://github.com/entropia/tip-toi-reveng";
        description = "Working with files for the Tiptoi® pen";
        license = stdenv.lib.licenses.mit;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "tubes" = callPackage
@@ -190475,6 +191266,30 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
+  "turtle_1_3_6" = callPackage
+    ({ mkDerivation, ansi-wl-pprint, async, base, bytestring, clock
+     , criterion, directory, doctest, foldl, hostname, managed
+     , optional-args, optparse-applicative, process, semigroups, stm
+     , system-fileio, system-filepath, temporary, text, time
+     , transformers, unix, unix-compat
+     }:
+     mkDerivation {
+       pname = "turtle";
+       version = "1.3.6";
+       sha256 = "0fr8p6rnk2lrsgbfh60jlqcjr0nxrh3ywxsj5d4psck0kgyhvg1m";
+       libraryHaskellDepends = [
+         ansi-wl-pprint async base bytestring clock directory foldl hostname
+         managed optional-args optparse-applicative process semigroups stm
+         system-fileio system-filepath temporary text time transformers unix
+         unix-compat
+       ];
+       testHaskellDepends = [ base doctest system-filepath temporary ];
+       benchmarkHaskellDepends = [ base criterion text ];
+       description = "Shell programming, Haskell-style";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "turtle-options" = callPackage
     ({ mkDerivation, base, HUnit, optional-args, parsec, text, turtle
      }:
@@ -190545,26 +191360,23 @@ self: {
   "tweet-hs" = callPackage
     ({ mkDerivation, aeson, ansi-wl-pprint, authenticate-oauth, base
      , bytestring, composition, containers, criterion, data-default
-     , directory, extra, hspec, hspec-megaparsec, http-client
-     , http-client-tls, http-types, lens, megaparsec
-     , optparse-applicative, split, text
+     , directory, extra, hspec, http-client, http-client-tls, http-types
+     , lens, optparse-applicative, split, text
      }:
      mkDerivation {
        pname = "tweet-hs";
-       version = "0.5.3.12";
-       sha256 = "0kscaq83m8yvnqpraq4m758r1q17cpqm6ks7c0lvknkgbv1f548v";
+       version = "0.6.0.0";
+       sha256 = "1myvwhyzw4a9xdrp16ibzgafdv84kwyvn0pqcsnq8kf3lnic60n3";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
          aeson ansi-wl-pprint authenticate-oauth base bytestring composition
          containers data-default directory extra http-client http-client-tls
-         http-types lens megaparsec optparse-applicative split text
+         http-types lens optparse-applicative split text
        ];
        executableHaskellDepends = [ base ];
-       testHaskellDepends = [
-         base bytestring hspec hspec-megaparsec megaparsec
-       ];
-       benchmarkHaskellDepends = [ base bytestring criterion megaparsec ];
+       testHaskellDepends = [ base bytestring hspec ];
+       benchmarkHaskellDepends = [ base bytestring criterion ];
        homepage = "https://github.com/vmchale/command-line-tweeter#readme";
        description = "Command-line tool for twitter";
        license = stdenv.lib.licenses.bsd3;
@@ -190957,8 +191769,8 @@ self: {
      }:
      mkDerivation {
        pname = "twitter-conduit";
-       version = "0.2.2";
-       sha256 = "0nzxzx4p0gxvn8w715ajivz8ddqgfs20n4g87hxwj9h8p2irlzw3";
+       version = "0.2.2.1";
+       sha256 = "06nbbh9lx816klc1hcd7rvqaxhshscc4bbq10mnhqrfzq69al695";
        libraryHaskellDepends = [
          aeson attoparsec authenticate-oauth base bytestring conduit
          conduit-extra containers data-default exceptions http-client
@@ -192460,6 +193272,32 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "ulid" = callPackage
+    ({ mkDerivation, base, binary, bytestring, crockford, crypto-api
+     , deepseq, format-numbers, hashable, hspec, random, text, time
+     }:
+     mkDerivation {
+       pname = "ulid";
+       version = "0.2.0.0";
+       sha256 = "1fw50j6ajrrfc1nzgf814rzj1x06dls220ngpxpdvs278spc1hns";
+       isLibrary = true;
+       isExecutable = true;
+       libraryHaskellDepends = [
+         base binary bytestring crockford crypto-api deepseq hashable random
+         time
+       ];
+       executableHaskellDepends = [ base crypto-api ];
+       testHaskellDepends = [
+         base binary bytestring hashable hspec random
+       ];
+       benchmarkHaskellDepends = [
+         base deepseq format-numbers text time
+       ];
+       homepage = "https://github.com/steven777400/ulid";
+       description = "Implementation of ULID, lexicographically sortable unique identifiers";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "una" = callPackage
     ({ mkDerivation, base, bytestring, cmdargs, directory, filepath
      , io-storage, process
@@ -192993,16 +193831,22 @@ self: {
      }) {};
 
   "unicoder" = callPackage
-    ({ mkDerivation, attoparsec, base, directory, text }:
+    ({ mkDerivation, attoparsec, base, data-default, directory
+     , filepath, text, twitch
+     }:
      mkDerivation {
        pname = "unicoder";
-       version = "0.4.1";
-       sha256 = "17a2rxq5b4a66ia4jm1g0lmkvsanfc477567wygq9kz4w9q4xwc3";
+       version = "0.5.0";
+       sha256 = "1974birppkd49jwq31x8bcbmgnximh233salnyq47ikgxfp6x4c6";
        isLibrary = true;
        isExecutable = true;
-       libraryHaskellDepends = [ attoparsec base text ];
-       executableHaskellDepends = [ attoparsec base directory text ];
-       testHaskellDepends = [ attoparsec base text ];
+       libraryHaskellDepends = [
+         attoparsec base directory filepath text
+       ];
+       executableHaskellDepends = [
+         base data-default directory filepath text twitch
+       ];
+       testHaskellDepends = [ base text ];
        homepage = "https://github.com/Zankoku-Okuno/unicoder";
        description = "Make writing in unicode easy";
        license = stdenv.lib.licenses.bsd3;
@@ -194129,35 +194973,6 @@ self: {
      }) {};
 
   "uri-bytestring" = callPackage
-    ({ mkDerivation, attoparsec, base, blaze-builder, bytestring
-     , containers, criterion, deepseq, deepseq-generics, generics-sop
-     , HUnit, lens-simple, network-uri, QuickCheck, quickcheck-instances
-     , semigroups, tasty, tasty-hunit, tasty-quickcheck
-     , template-haskell, th-lift-instances
-     }:
-     mkDerivation {
-       pname = "uri-bytestring";
-       version = "0.2.3.2";
-       sha256 = "0slchhhgwcig8ifla49r9j96cg5l1jf5gy9zzpvmmds0x3d42qh4";
-       libraryHaskellDepends = [
-         attoparsec base blaze-builder bytestring containers
-         template-haskell th-lift-instances
-       ];
-       testHaskellDepends = [
-         attoparsec base blaze-builder bytestring containers generics-sop
-         HUnit lens-simple QuickCheck quickcheck-instances semigroups tasty
-         tasty-hunit tasty-quickcheck
-       ];
-       benchmarkHaskellDepends = [
-         base blaze-builder bytestring criterion deepseq deepseq-generics
-         network-uri
-       ];
-       homepage = "https://github.com/Soostone/uri-bytestring";
-       description = "Haskell URI parsing as ByteStrings";
-       license = stdenv.lib.licenses.bsd3;
-     }) {};
-
-  "uri-bytestring_0_2_3_3" = callPackage
     ({ mkDerivation, attoparsec, base, base-compat, blaze-builder
      , bytestring, containers, criterion, deepseq, deepseq-generics
      , generics-sop, HUnit, network-uri, QuickCheck
@@ -194185,7 +195000,6 @@ self: {
        homepage = "https://github.com/Soostone/uri-bytestring";
        description = "Haskell URI parsing as ByteStrings";
        license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "uri-bytestring-aeson" = callPackage
@@ -195555,6 +196369,20 @@ self: {
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
+  "variation" = callPackage
+    ({ mkDerivation, base, cereal, containers, deepseq, semigroupoids
+     }:
+     mkDerivation {
+       pname = "variation";
+       version = "0.1.1.0";
+       sha256 = "05wkjr3sd4r3bid4n18qiblc8jvpzzdkh74f7qh3q1lfx8yv2133";
+       libraryHaskellDepends = [
+         base cereal containers deepseq semigroupoids
+       ];
+       description = "nominal value with possible variations";
+       license = stdenv.lib.licenses.bsd3;
+     }) {};
+
   "varying" = callPackage
     ({ mkDerivation, base, criterion, hspec, QuickCheck, time
      , transformers
@@ -196427,15 +197255,15 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
-  "versions_3_1_0_1" = callPackage
-    ({ mkDerivation, base, megaparsec, microlens, tasty, tasty-hunit
-     , text
+  "versions_3_1_1" = callPackage
+    ({ mkDerivation, base, deepseq, hashable, megaparsec, microlens
+     , tasty, tasty-hunit, text
      }:
      mkDerivation {
        pname = "versions";
-       version = "3.1.0.1";
-       sha256 = "0r6dzf27bw2d0d0p48rv2vqkiw4dagdk6ka0hhisxz5ii4x6lvl7";
-       libraryHaskellDepends = [ base megaparsec text ];
+       version = "3.1.1";
+       sha256 = "1pnmbvlchjskavp6h04xdxwxg61aplqpxnawnbzflyf1mvpz0dm4";
+       libraryHaskellDepends = [ base deepseq hashable megaparsec text ];
        testHaskellDepends = [ base microlens tasty tasty-hunit text ];
        description = "Types and parsers for software version numbers";
        license = stdenv.lib.licenses.bsd3;
@@ -196529,14 +197357,14 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
-  "viewprof_0_0_0_2" = callPackage
+  "viewprof_0_0_0_3" = callPackage
     ({ mkDerivation, base, brick, containers, ghc-prof, lens
      , scientific, text, vector, vector-algorithms, vty
      }:
      mkDerivation {
        pname = "viewprof";
-       version = "0.0.0.2";
-       sha256 = "1yxz4lfynq3smncaq0z845avzlvmsd44knrzf0dh0w39rag2z5jj";
+       version = "0.0.0.3";
+       sha256 = "13rb9cgi65vcc6y6rj79li1rywzb711ayl1dwsm97b7nqz4007rk";
        isLibrary = false;
        isExecutable = true;
        executableHaskellDepends = [
@@ -198021,6 +198849,8 @@ self: {
        pname = "wai-middleware-crowd";
        version = "0.1.4.2";
        sha256 = "0n5h4s3b2fdn2j0pl32bsdbf6wyyf2ms8qsbcs9r0wp7dhdbcdhi";
+       revision = "1";
+       editedCabalFile = "0qvh92p9s80kmzg5w7rga54kfqbwcrkkv5p03pd92px04j2h5lbm";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -200055,7 +200885,7 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {};
 
-  "websockets_0_11_1_0" = callPackage
+  "websockets_0_11_2_0" = callPackage
     ({ mkDerivation, attoparsec, base, base64-bytestring, binary
      , blaze-builder, bytestring, case-insensitive, containers
      , criterion, entropy, HUnit, network, QuickCheck, random, SHA
@@ -200064,8 +200894,8 @@ self: {
      }:
      mkDerivation {
        pname = "websockets";
-       version = "0.11.1.0";
-       sha256 = "1qbslmgj7blnm4al414h76mn8adzydpw2mba4w9vgb4rgi0w6b9w";
+       version = "0.11.2.0";
+       sha256 = "0bncy78zjyhb961lhiklg2d1zh6vh03xq1zjj9js8904p75kvbaq";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -200079,7 +200909,11 @@ self: {
          SHA streaming-commons test-framework test-framework-hunit
          test-framework-quickcheck2 text
        ];
-       benchmarkHaskellDepends = [ base bytestring criterion random ];
+       benchmarkHaskellDepends = [
+         attoparsec base base64-bytestring binary blaze-builder bytestring
+         case-insensitive containers criterion entropy network random SHA
+         text
+       ];
        doCheck = false;
        homepage = "http://jaspervdj.be/websockets";
        description = "A sensible and clean way to write WebSocket-capable servers in Haskell";
@@ -201236,8 +202070,8 @@ self: {
      }:
      mkDerivation {
        pname = "wordchoice";
-       version = "0.1.0.4";
-       sha256 = "1k7vjn114qwi46mdnqszwc8q7lg6k8s0k4g9rj4hfv7w83a2w377";
+       version = "0.1.0.5";
+       sha256 = "0841dzjxnj9hm2lm31sa7xabaywdpnjjksy1c7b4idirdpmz9rhd";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
@@ -202466,8 +203300,8 @@ self: {
        pname = "xdcc";
        version = "1.1.4";
        sha256 = "0r344vgkiwc7lkb7x78swnz0rimbgdcb0ki29dilqvdv0k4z9i59";
-       revision = "1";
-       editedCabalFile = "0zp24wny11q6firilvwc5fq9z4qycww6nspxfrczjmws3b60zxxd";
+       revision = "2";
+       editedCabalFile = "1r9vp01r8pym1skqy6ll632q5j4xbgsf6mf1n26rk296z2rqdvra";
        isLibrary = false;
        isExecutable = true;
        executableHaskellDepends = [
@@ -203045,6 +203879,31 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {};
 
+  "xml-conduit_1_5_1" = callPackage
+    ({ mkDerivation, attoparsec, base, blaze-builder, blaze-html
+     , blaze-markup, bytestring, conduit, conduit-extra, containers
+     , data-default, deepseq, hspec, HUnit, monad-control, resourcet
+     , text, transformers, xml-types
+     }:
+     mkDerivation {
+       pname = "xml-conduit";
+       version = "1.5.1";
+       sha256 = "0d4pb9d0mdz9djh8aiy5r8088rqh7w34mbqmg8mmaq1i7vx2dzks";
+       libraryHaskellDepends = [
+         attoparsec base blaze-builder blaze-html blaze-markup bytestring
+         conduit conduit-extra containers data-default deepseq monad-control
+         resourcet text transformers xml-types
+       ];
+       testHaskellDepends = [
+         base blaze-markup bytestring conduit containers hspec HUnit
+         resourcet text transformers xml-types
+       ];
+       homepage = "http://github.com/snoyberg/xml";
+       description = "Pure-Haskell utilities for dealing with XML with the conduit package";
+       license = stdenv.lib.licenses.mit;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {};
+
   "xml-conduit-decode" = callPackage
     ({ mkDerivation, base, bifunctors, data-default, lens, semigroups
      , tasty, tasty-hunit, text, time, xml-conduit, xml-types
@@ -203906,17 +204765,16 @@ self: {
      }:
      mkDerivation {
        pname = "xmonad-vanessa";
-       version = "0.1.1.1";
-       sha256 = "0f322aqfav3hzv9hh0krl778q25jq0m83lqdwzbymbgm4yy585y2";
+       version = "0.1.1.2";
+       sha256 = "065kcsr7s114sw8g8hdl2i5w0543r9f9ypirvh3bn38x2lv4f9ng";
        isLibrary = true;
        isExecutable = true;
        libraryHaskellDepends = [
          base containers process transformers X11 xmonad xmonad-contrib
        ];
-       executableHaskellDepends = [ base ];
        testHaskellDepends = [ base hspec xmonad ];
-       homepage = "https://github.com/vmchale/xmonad-vanessa#readme";
-       description = "Custom xmonad, which uses stack and sets various defaults";
+       homepage = "https://hub.darcs.net/vmchale/xmonad-vanessa";
+       description = "Custom xmonad, which builds with stack or cabal";
        license = stdenv.lib.licenses.bsd3;
        hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
@@ -204457,6 +205315,38 @@ self: {
        license = stdenv.lib.licenses.bsd3;
      }) {inherit (pkgs) libyaml;};
 
+  "yaml_0_8_23_1" = callPackage
+    ({ mkDerivation, aeson, aeson-qq, attoparsec, base, base-compat
+     , bytestring, conduit, containers, directory, filepath, hspec
+     , HUnit, libyaml, mockery, resourcet, scientific, semigroups
+     , template-haskell, temporary, text, transformers
+     , unordered-containers, vector
+     }:
+     mkDerivation {
+       pname = "yaml";
+       version = "0.8.23.1";
+       sha256 = "0sv01yzi08mr2r7wkjcrsl5pf02zzv3y2n7amznv0pdj82sw16sa";
+       configureFlags = [ "-fsystem-libyaml" ];
+       isLibrary = true;
+       isExecutable = true;
+       libraryHaskellDepends = [
+         aeson attoparsec base bytestring conduit containers directory
+         filepath resourcet scientific semigroups template-haskell text
+         transformers unordered-containers vector
+       ];
+       libraryPkgconfigDepends = [ libyaml ];
+       executableHaskellDepends = [ aeson base bytestring ];
+       testHaskellDepends = [
+         aeson aeson-qq base base-compat bytestring conduit directory hspec
+         HUnit mockery resourcet temporary text transformers
+         unordered-containers vector
+       ];
+       homepage = "http://github.com/snoyberg/yaml/";
+       description = "Support for parsing and rendering YAML documents";
+       license = stdenv.lib.licenses.bsd3;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {inherit (pkgs) libyaml;};
+
   "yaml-combinators" = callPackage
     ({ mkDerivation, aeson, base, bytestring, doctest, generics-sop
      , scientific, tasty, tasty-hunit, text, transformers
@@ -204464,8 +205354,8 @@ self: {
      }:
      mkDerivation {
        pname = "yaml-combinators";
-       version = "1.0";
-       sha256 = "05xxv6dxkr4rn48kbzhh0nilpg42mg18s901wlnf1n3nb61dz5wr";
+       version = "1.0.1";
+       sha256 = "03y7z08ly3l5plh2c06i1p83c12s15fwshkl4nakqf1a6vb7bl48";
        libraryHaskellDepends = [
          aeson base bytestring generics-sop scientific text transformers
          unordered-containers vector yaml
@@ -205040,35 +205930,6 @@ self: {
     ({ mkDerivation, aeson, authenticate, base, base16-bytestring
      , base64-bytestring, binary, blaze-builder, blaze-html
      , blaze-markup, byteable, bytestring, conduit, conduit-extra
-     , containers, cryptohash, data-default, email-validate, file-embed
-     , http-client, http-conduit, http-types, lifted-base, mime-mail
-     , network-uri, nonce, persistent, persistent-template, random
-     , resourcet, safe, shakespeare, template-haskell, text, time
-     , transformers, unordered-containers, wai, yesod-core, yesod-form
-     , yesod-persistent
-     }:
-     mkDerivation {
-       pname = "yesod-auth";
-       version = "1.4.17.1";
-       sha256 = "0d9mwk7wxp3bl0d7v95qndps0i761f57ky7vy1h7n2smm1x7yy7q";
-       libraryHaskellDepends = [
-         aeson authenticate base base16-bytestring base64-bytestring binary
-         blaze-builder blaze-html blaze-markup byteable bytestring conduit
-         conduit-extra containers cryptohash data-default email-validate
-         file-embed http-client http-conduit http-types lifted-base
-         mime-mail network-uri nonce persistent persistent-template random
-         resourcet safe shakespeare template-haskell text time transformers
-         unordered-containers wai yesod-core yesod-form yesod-persistent
-       ];
-       homepage = "http://www.yesodweb.com/";
-       description = "Authentication for Yesod";
-       license = stdenv.lib.licenses.mit;
-     }) {};
-
-  "yesod-auth_1_4_17_2" = callPackage
-    ({ mkDerivation, aeson, authenticate, base, base16-bytestring
-     , base64-bytestring, binary, blaze-builder, blaze-html
-     , blaze-markup, byteable, bytestring, conduit, conduit-extra
      , containers, cryptonite, data-default, email-validate, file-embed
      , http-client, http-conduit, http-types, lifted-base, memory
      , mime-mail, network-uri, nonce, persistent, persistent-template
@@ -205092,7 +205953,6 @@ self: {
        homepage = "http://www.yesodweb.com/";
        description = "Authentication for Yesod";
        license = stdenv.lib.licenses.mit;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "yesod-auth-account" = callPackage
@@ -205597,51 +206457,6 @@ self: {
      }:
      mkDerivation {
        pname = "yesod-core";
-       version = "1.4.33";
-       sha256 = "1pk3bymlpzxsx54l5lzifrlgy2avsbdb917gqkn5jbnkbcf6mqmb";
-       revision = "1";
-       editedCabalFile = "0ryxcikbr70sp716bh43baayv9ay4hwm5d36i198vi4n4a9k1j0v";
-       libraryHaskellDepends = [
-         aeson auto-update base blaze-builder blaze-html blaze-markup
-         byteable bytestring case-insensitive cereal clientsession conduit
-         conduit-extra containers cookie data-default deepseq
-         deepseq-generics directory exceptions fast-logger http-types
-         lifted-base monad-control monad-logger mtl mwc-random old-locale
-         parsec path-pieces primitive random resourcet safe semigroups
-         shakespeare template-haskell text time transformers
-         transformers-base unix-compat unordered-containers vector wai
-         wai-extra wai-logger warp word8
-       ];
-       testHaskellDepends = [
-         async base blaze-builder bytestring clientsession conduit
-         conduit-extra containers cookie hspec hspec-expectations http-types
-         HUnit lifted-base mwc-random network path-pieces QuickCheck random
-         resourcet shakespeare streaming-commons template-haskell text
-         transformers wai wai-extra
-       ];
-       benchmarkHaskellDepends = [
-         base blaze-html bytestring criterion shakespeare text transformers
-       ];
-       homepage = "http://www.yesodweb.com/";
-       description = "Creation of type-safe, RESTful web applications";
-       license = stdenv.lib.licenses.mit;
-     }) {};
-
-  "yesod-core_1_4_35" = callPackage
-    ({ mkDerivation, aeson, async, auto-update, base, blaze-builder
-     , blaze-html, blaze-markup, byteable, bytestring, case-insensitive
-     , cereal, clientsession, conduit, conduit-extra, containers, cookie
-     , criterion, data-default, deepseq, deepseq-generics, directory
-     , exceptions, fast-logger, hspec, hspec-expectations, http-types
-     , HUnit, lifted-base, monad-control, monad-logger, mtl, mwc-random
-     , network, old-locale, parsec, path-pieces, primitive, QuickCheck
-     , random, resourcet, safe, semigroups, shakespeare
-     , streaming-commons, template-haskell, text, time, transformers
-     , transformers-base, unix-compat, unordered-containers, vector, wai
-     , wai-extra, wai-logger, warp, word8
-     }:
-     mkDerivation {
-       pname = "yesod-core";
        version = "1.4.35";
        sha256 = "1wawpd2pwqn535zrs5wz43jvi0bca0q2kinml6waw5d4s7m0npby";
        revision = "1";
@@ -205670,7 +206485,6 @@ self: {
        homepage = "http://www.yesodweb.com/";
        description = "Creation of type-safe, RESTful web applications";
        license = stdenv.lib.licenses.mit;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "yesod-crud" = callPackage
@@ -206655,41 +207469,6 @@ self: {
      }:
      mkDerivation {
        pname = "yesod-static";
-       version = "1.5.2";
-       sha256 = "17h9f95dqincb7zbqb6fw6xhbxhxgdjfsh9gzz3k57kx13vcajdr";
-       libraryHaskellDepends = [
-         async attoparsec base base64-bytestring blaze-builder byteable
-         bytestring conduit conduit-extra containers cryptohash
-         cryptohash-conduit css-text data-default directory exceptions
-         file-embed filepath hashable hjsmin http-types mime-types old-time
-         process resourcet template-haskell text transformers unix-compat
-         unordered-containers wai wai-app-static yesod-core
-       ];
-       testHaskellDepends = [
-         async base base64-bytestring byteable bytestring conduit
-         conduit-extra containers cryptohash cryptohash-conduit data-default
-         directory exceptions file-embed filepath hjsmin hspec http-types
-         HUnit mime-types old-time process resourcet template-haskell text
-         transformers unix-compat unordered-containers wai wai-app-static
-         wai-extra yesod-core yesod-test
-       ];
-       homepage = "http://www.yesodweb.com/";
-       description = "Static file serving subsite for Yesod Web Framework";
-       license = stdenv.lib.licenses.mit;
-     }) {};
-
-  "yesod-static_1_5_3" = callPackage
-    ({ mkDerivation, async, attoparsec, base, base64-bytestring
-     , blaze-builder, byteable, bytestring, conduit, conduit-extra
-     , containers, cryptohash, cryptohash-conduit, css-text
-     , data-default, directory, exceptions, file-embed, filepath
-     , hashable, hjsmin, hspec, http-types, HUnit, mime-types, old-time
-     , process, resourcet, template-haskell, text, transformers
-     , unix-compat, unordered-containers, wai, wai-app-static, wai-extra
-     , yesod-core, yesod-test
-     }:
-     mkDerivation {
-       pname = "yesod-static";
        version = "1.5.3";
        sha256 = "0raxbnr1xpxgirh2fhs3m277yzbklf6k3dijrrx4kh2bnaiax1ml";
        libraryHaskellDepends = [
@@ -206711,7 +207490,6 @@ self: {
        homepage = "http://www.yesodweb.com/";
        description = "Static file serving subsite for Yesod Web Framework";
        license = stdenv.lib.licenses.mit;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "yesod-static-angular" = callPackage
@@ -206778,33 +207556,6 @@ self: {
      }:
      mkDerivation {
        pname = "yesod-test";
-       version = "1.5.5";
-       sha256 = "0f8adzhqkzw1bbvvks42q0bhq1imiinrfk5sn7q9yr22jpsmnhj4";
-       libraryHaskellDepends = [
-         attoparsec base blaze-builder blaze-html blaze-markup bytestring
-         case-insensitive containers cookie hspec-core html-conduit
-         http-types HUnit monad-control network persistent pretty-show text
-         time transformers wai wai-extra xml-conduit xml-types yesod-core
-       ];
-       testHaskellDepends = [
-         base bytestring containers hspec html-conduit http-types HUnit
-         lifted-base text wai xml-conduit yesod-core yesod-form
-       ];
-       homepage = "http://www.yesodweb.com";
-       description = "integration testing for WAI/Yesod Applications";
-       license = stdenv.lib.licenses.mit;
-     }) {};
-
-  "yesod-test_1_5_6" = callPackage
-    ({ mkDerivation, attoparsec, base, blaze-builder, blaze-html
-     , blaze-markup, bytestring, case-insensitive, containers, cookie
-     , hspec, hspec-core, html-conduit, http-types, HUnit, lifted-base
-     , monad-control, network, persistent, pretty-show, text, time
-     , transformers, wai, wai-extra, xml-conduit, xml-types, yesod-core
-     , yesod-form
-     }:
-     mkDerivation {
-       pname = "yesod-test";
        version = "1.5.6";
        sha256 = "1zb3zm6id0nnsbpic8643b1p0x6yx1in8x1c7n36wbp9crinr0h3";
        libraryHaskellDepends = [
@@ -206820,7 +207571,6 @@ self: {
        homepage = "http://www.yesodweb.com";
        description = "integration testing for WAI/Yesod Applications";
        license = stdenv.lib.licenses.mit;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "yesod-test-json" = callPackage
@@ -208061,6 +208811,29 @@ self: {
        license = stdenv.lib.licenses.mit;
      }) {inherit (pkgs) zeromq;};
 
+  "zeromq4-haskell_0_6_6" = callPackage
+    ({ mkDerivation, async, base, bytestring, containers, exceptions
+     , monad-control, QuickCheck, semigroups, tasty, tasty-hunit
+     , tasty-quickcheck, transformers, transformers-base, zeromq
+     }:
+     mkDerivation {
+       pname = "zeromq4-haskell";
+       version = "0.6.6";
+       sha256 = "1pblwyn2lly3px9843g4a2wpkqhnffd53kam1b9kx31zpplfhbx8";
+       libraryHaskellDepends = [
+         async base bytestring containers exceptions monad-control
+         semigroups transformers transformers-base
+       ];
+       libraryPkgconfigDepends = [ zeromq ];
+       testHaskellDepends = [
+         async base bytestring QuickCheck tasty tasty-hunit tasty-quickcheck
+       ];
+       homepage = "https://gitlab.com/twittner/zeromq-haskell/";
+       description = "Bindings to ZeroMQ 4.x";
+       license = stdenv.lib.licenses.mit;
+       hydraPlatforms = stdenv.lib.platforms.none;
+     }) {inherit (pkgs) zeromq;};
+
   "zeroth" = callPackage
     ({ mkDerivation, base, Cabal, derive, directory, filepath
      , haskell-src-exts, hskeleton, monoid-record, process, syb
@@ -208258,6 +209031,8 @@ self: {
        pname = "zip";
        version = "0.1.11";
        sha256 = "0adflrr7h6aqq4nz0751chs65zfj0ljz1mjwyym3s080sbrwncjn";
+       revision = "1";
+       editedCabalFile = "0f97aidxiw149m64bv6qnb6ba2xlmllv3cwalihvccc0vh5kn0as";
        libraryHaskellDepends = [
          base bytestring bzlib-conduit case-insensitive cereal conduit
          conduit-extra containers digest exceptions filepath mtl path
@@ -208280,31 +209055,6 @@ self: {
      }:
      mkDerivation {
        pname = "zip-archive";
-       version = "0.3.0.6";
-       sha256 = "1dnmmfqfvssx1saxwc3r6miazcnilrhy188jqa0195nj2m510h41";
-       isLibrary = true;
-       isExecutable = true;
-       libraryHaskellDepends = [
-         array base binary bytestring containers digest directory filepath
-         mtl old-time pretty text time unix zlib
-       ];
-       testHaskellDepends = [
-         base bytestring directory HUnit old-time process temporary time
-         unix
-       ];
-       testToolDepends = [ zip ];
-       homepage = "http://github.com/jgm/zip-archive";
-       description = "Library for creating and modifying zip archives";
-       license = stdenv.lib.licenses.bsd3;
-     }) {inherit (pkgs) zip;};
-
-  "zip-archive_0_3_1" = callPackage
-    ({ mkDerivation, array, base, binary, bytestring, containers
-     , digest, directory, filepath, HUnit, mtl, old-time, pretty
-     , process, temporary, text, time, unix, zlib
-     }:
-     mkDerivation {
-       pname = "zip-archive";
        version = "0.3.1";
        sha256 = "0ywy6isvyizs5d27lh108y6k4qnwmbcdmvzsrm3r45bwcj1nii5f";
        isLibrary = true;
@@ -208317,11 +209067,11 @@ self: {
          base bytestring directory HUnit old-time process temporary time
          unix
        ];
+       testToolDepends = [ zip ];
        homepage = "http://github.com/jgm/zip-archive";
        description = "Library for creating and modifying zip archives";
        license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
-     }) {};
+     }) {inherit (pkgs) zip;};
 
   "zip-conduit" = callPackage
     ({ mkDerivation, base, bytestring, cereal, conduit, conduit-extra
@@ -208456,29 +209206,6 @@ self: {
      }:
      mkDerivation {
        pname = "ziptastic-client";
-       version = "0.3.0.2";
-       sha256 = "1ara825win4zgngy5yhx16d8ffm94j1qlqha7b1s143dzk0vw8hs";
-       libraryHaskellDepends = [
-         base base-compat http-client iso3166-country-codes servant
-         servant-client text ziptastic-core
-       ];
-       testHaskellDepends = [
-         base base-compat hspec http-client http-client-tls http-types
-         iso3166-country-codes servant-client
-       ];
-       homepage = "https://github.com/Ziptastic/ziptastic-haskell#readme";
-       description = "A type-safe client for the Ziptastic API for doing forward and reverse geocoding";
-       license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
-     }) {};
-
-  "ziptastic-client_0_3_0_3" = callPackage
-    ({ mkDerivation, base, base-compat, hspec, http-client
-     , http-client-tls, http-types, iso3166-country-codes, servant
-     , servant-client, text, ziptastic-core
-     }:
-     mkDerivation {
-       pname = "ziptastic-client";
        version = "0.3.0.3";
        sha256 = "0phw247dbm68bbb9k9z4jiva0gz9yhirggcnsrvm697kzya9s25g";
        libraryHaskellDepends = [
@@ -208501,26 +209228,6 @@ self: {
      }:
      mkDerivation {
        pname = "ziptastic-core";
-       version = "0.2.0.2";
-       sha256 = "1hrbzsb09vsl5amkzyhs50c0la17xbh11nhnw5h59rq3dcv3kkyk";
-       libraryHaskellDepends = [
-         aeson base base-compat bytestring http-api-data
-         iso3166-country-codes servant text tz
-       ];
-       testHaskellDepends = [
-         aeson base base-compat here hspec iso3166-country-codes text tz
-       ];
-       homepage = "https://github.com/Ziptastic/ziptastic-haskell#readme";
-       description = "Core Servant specification for the Ziptastic API for doing forward and reverse geocoding";
-       license = stdenv.lib.licenses.bsd3;
-     }) {};
-
-  "ziptastic-core_0_2_0_3" = callPackage
-    ({ mkDerivation, aeson, base, base-compat, bytestring, here, hspec
-     , http-api-data, iso3166-country-codes, servant, text, tz
-     }:
-     mkDerivation {
-       pname = "ziptastic-core";
        version = "0.2.0.3";
        sha256 = "1c2ahblhqk4dq3105w3qd0j7isn3r0m7vvm5drd5g1ian37ywqwf";
        libraryHaskellDepends = [
@@ -208533,7 +209240,6 @@ self: {
        homepage = "https://github.com/Ziptastic/ziptastic-haskell#readme";
        description = "Core Servant specification for the Ziptastic API for doing forward and reverse geocoding";
        license = stdenv.lib.licenses.bsd3;
-       hydraPlatforms = stdenv.lib.platforms.none;
      }) {};
 
   "zlib_0_5_4_2" = callPackage
diff --git a/pkgs/development/interpreters/clojure/clooj.nix b/pkgs/development/interpreters/clojure/clooj.nix
index 527a5b2e5700..57ced325aad0 100644
--- a/pkgs/development/interpreters/clojure/clooj.nix
+++ b/pkgs/development/interpreters/clojure/clooj.nix
@@ -6,7 +6,8 @@ stdenv.mkDerivation {
   name = "clooj-${version}";
 
   jar = fetchurl {
-    url = "http://download1492.mediafire.com/5bbi05sxgxog/prkf64humftrmz3/clooj-0.4.4-standalone.jar";
+    # mirrored as original mediafire.com source does not work without user interaction
+    url = "https://archive.org/download/clooj-0.4.4-standalone/clooj-0.4.4-standalone.jar";
     sha256 = "0hbc29bg2a86rm3sx9kvj7h7db9j0kbnrb706wsfiyk3zi3bavnd";
   };
 
diff --git a/pkgs/development/libraries/accounts-qt/default.nix b/pkgs/development/libraries/accounts-qt/default.nix
index a6d9a9381f9f..883d0d65aa53 100644
--- a/pkgs/development/libraries/accounts-qt/default.nix
+++ b/pkgs/development/libraries/accounts-qt/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitLab, doxygen, glib, libaccounts-glib, pkgconfig, qtbase, qmakeHook }:
+{ stdenv, fetchFromGitLab, doxygen, glib, libaccounts-glib, pkgconfig, qtbase, qmake }:
 
 stdenv.mkDerivation rec {
   name = "accounts-qt-${version}";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ glib libaccounts-glib qtbase ];
-  nativeBuildInputs = [ doxygen pkgconfig qmakeHook ];
+  nativeBuildInputs = [ doxygen pkgconfig qmake ];
 
   preConfigure = ''
     qmakeFlags="$qmakeFlags LIBDIR=$out/lib CMAKE_CONFIG_PATH=$out/lib/cmake"
diff --git a/pkgs/development/libraries/accountsservice/default.nix b/pkgs/development/libraries/accountsservice/default.nix
index 1a49913727d8..d1b3b9b98271 100644
--- a/pkgs/development/libraries/accountsservice/default.nix
+++ b/pkgs/development/libraries/accountsservice/default.nix
@@ -3,15 +3,16 @@
 
 stdenv.mkDerivation rec {
   name = "accountsservice-${version}";
-  version = "0.6.43";
+  version = "0.6.45";
 
   src = fetchurl {
     url = "http://www.freedesktop.org/software/accountsservice/accountsservice-${version}.tar.xz";
-    sha256 = "1k6n9079001sgcwlkq0bz6mkn4m8y4dwf6hs1qm85swcld5ajfzd";
+    sha256 = "09pg25ir7kjigvp2cxd9fkfw8c8ql8vrswfvymg9zmbmma9w43zv";
   };
 
-  buildInputs = [ pkgconfig glib intltool libtool makeWrapper
-                  gobjectIntrospection polkit systemd ];
+  nativeBuildInputs = [ pkgconfig makeWrapper ];
+
+  buildInputs = [ glib intltool libtool gobjectIntrospection polkit systemd ];
 
   configureFlags = [ "--with-systemdsystemunitdir=$(out)/etc/systemd/system"
                      "--localstatedir=/var" ];
diff --git a/pkgs/development/libraries/audio/lilv/default.nix b/pkgs/development/libraries/audio/lilv/default.nix
index 101322f3f531..87ff0bdb0b6e 100644
--- a/pkgs/development/libraries/audio/lilv/default.nix
+++ b/pkgs/development/libraries/audio/lilv/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "lilv-${version}";
-  version = "0.24.0";
+  version = "0.24.2";
 
   src = fetchurl {
     url = "http://download.drobilla.net/${name}.tar.bz2";
-    sha256 = "17pv4wdaj7m5ghpfs7h7d8jd105xfzyn2lj438xslj1ndm9xwq7s";
+    sha256 = "08m5a372pr1l7aii9s3pic5nm68gynx1n1bc7bnlswziq6qnbv7p";
   };
 
   buildInputs = [ lv2 pkgconfig python serd sord sratom ];
diff --git a/pkgs/development/libraries/audio/ntk/default.nix b/pkgs/development/libraries/audio/ntk/default.nix
index 4f58adefdf3f..35144862ce9b 100644
--- a/pkgs/development/libraries/audio/ntk/default.nix
+++ b/pkgs/development/libraries/audio/ntk/default.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "ntk-${version}";
-  version = "2014-10-18";
+  version = "2017-04-22";
   src = fetchgit {
     url = "git://git.tuxfamily.org/gitroot/non/fltk.git";
-    rev = "5719b0044d9f267de5391fab006370cc7f4e70bd";
-    sha256 = "1wpqy5kk6sk31qyx1c6gdslcqcbczgji6lk8w1l8kri0s908ywyj";
+    rev = "92365eca0f9a6f054abc70489c009aba0fcde0ff";
+    sha256 = "0pph7hf07xaa011zr40cs62f3f7hclfbv5kcrl757gcp2s5pi2iq";
   };
 
   buildInputs = [
diff --git a/pkgs/development/libraries/aws-sdk-cpp/default.nix b/pkgs/development/libraries/aws-sdk-cpp/default.nix
index c80abd5f3a07..434c685e8233 100644
--- a/pkgs/development/libraries/aws-sdk-cpp/default.nix
+++ b/pkgs/development/libraries/aws-sdk-cpp/default.nix
@@ -14,13 +14,13 @@ let
         else throw "Unsupported system!";
 in stdenv.mkDerivation rec {
   name = "aws-sdk-cpp-${version}";
-  version = "1.0.127";
+  version = "1.0.153";
 
   src = fetchFromGitHub {
     owner = "awslabs";
     repo = "aws-sdk-cpp";
     rev = version;
-    sha256 = "1p06rkvi6mm4jylk5j7gji2c52qbls3i0yqg3hgs9iys4nd1p14r";
+    sha256 = "0mglg9a6klmsam8r9va7y5x2s8xylhljwcg93sr8152rvhxnjv08";
   };
 
   # FIXME: might be nice to put different APIs in different outputs
@@ -43,6 +43,8 @@ in stdenv.mkDerivation rec {
       for i in testing-resources aws-cpp-sdk-*; do
         export ${loaderVar}=$(pwd)/$i:''${${loaderVar}}
       done
+
+      export HOME=$TMPDIR
     '';
 
   NIX_LDFLAGS = lib.concatStringsSep " " (
diff --git a/pkgs/development/libraries/catch/default.nix b/pkgs/development/libraries/catch/default.nix
index 021512a40e70..66ed90a90b3a 100644
--- a/pkgs/development/libraries/catch/default.nix
+++ b/pkgs/development/libraries/catch/default.nix
@@ -3,16 +3,16 @@
 stdenv.mkDerivation rec {
 
   name = "catch-${version}";
-  version = "1.7.0";
+  version = "1.9.5";
 
   src = fetchFromGitHub {
     owner = "philsquared";
     repo = "Catch";
-    rev = "v." + version;
-    sha256 = "0harki6irc4mqipjc24zyy0jimidr5ng3ss29bnpzbbwhrnkyrgm";
+    rev = "v${version}";
+    sha256 = "1in4f6w1pja8m1hvyiwx7s7gxnj6nlj1fgxw9blldffh09ikgpm2";
   };
 
-  buildInputs = [ cmake ];
+  nativeBuildInputs = [ cmake ];
   cmakeFlags = [ "-DUSE_CPP14=ON" ];
 
   doCheck = true;
diff --git a/pkgs/development/libraries/gpgme/default.nix b/pkgs/development/libraries/gpgme/default.nix
index 5601a8854ef1..8ae88944dd14 100644
--- a/pkgs/development/libraries/gpgme/default.nix
+++ b/pkgs/development/libraries/gpgme/default.nix
@@ -1,4 +1,7 @@
-{ stdenv, fetchurl, libgpgerror, gnupg, pkgconfig, glib, pth, libassuan }:
+{ stdenv, fetchurl, fetchpatch, libgpgerror, gnupg, pkgconfig, glib, pth, libassuan
+, qtbase ? null }:
+
+let inherit (stdenv) lib system; in
 
 stdenv.mkDerivation rec {
   name = "gpgme-1.9.0";
@@ -8,10 +11,20 @@ stdenv.mkDerivation rec {
     sha256 = "1ssc0gs02r4fasabk7c6v6r865k2j02mpb5g1vkpbmzsigdzwa8v";
   };
 
+  patches = [
+    (fetchpatch {
+      url = "https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gpgme.git;a=commitdiff_plain;h=5d4f977dac542340c877fdd4b1304fa8f6e058e6";
+      sha256 = "0swpxzd3x3b6h2ry2py9j8l0xp3vdw8rixxhgfavzia5p869qyyx";
+      name = "qgpgme-format-security.patch";
+    })
+  ];
+
   outputs = [ "out" "dev" "info" ];
   outputBin = "dev"; # gpgme-config; not so sure about gpgme-tool
 
-  propagatedBuildInputs = [ libgpgerror glib libassuan pth ];
+  propagatedBuildInputs =
+    [ libgpgerror glib libassuan pth ]
+    ++ lib.optional (qtbase != null) qtbase;
 
   nativeBuildInputs = [ pkgconfig gnupg ];
 
@@ -21,7 +34,7 @@ stdenv.mkDerivation rec {
 
   # https://www.gnupg.org/documentation/manuals/gpgme/Largefile-Support-_0028LFS_0029.html
   NIX_CFLAGS_COMPILE =
-    with stdenv; lib.optional (system == "i686-linux") "-D_FILE_OFFSET_BITS=64";
+    lib.optional (system == "i686-linux") "-D_FILE_OFFSET_BITS=64";
 
   meta = with stdenv.lib; {
     homepage = "https://gnupg.org/software/gpgme/index.html";
diff --git a/pkgs/development/libraries/gpgme/gpgme_libsuffix.patch b/pkgs/development/libraries/gpgme/gpgme_libsuffix.patch
new file mode 100644
index 000000000000..4abc2757cf6f
--- /dev/null
+++ b/pkgs/development/libraries/gpgme/gpgme_libsuffix.patch
@@ -0,0 +1,12 @@
+diff --git a/lang/cpp/src/GpgmeppConfig.cmake.in.in b/lang/cpp/src/GpgmeppConfig.cmake.in.in
+index 928d19f..cbe9713 100644 (file)
+--- a/lang/cpp/src/GpgmeppConfig.cmake.in.in
++++ b/lang/cpp/src/GpgmeppConfig.cmake.in.in
+@@ -63,7 +63,7 @@ add_library(Gpgmepp SHARED IMPORTED)
+ 
+ set_target_properties(Gpgmepp PROPERTIES
+   INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/gpgme++;@resolved_includedir@"
+-  INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme@libsuffix@;@LIBASSUAN_LIBS@"
++  INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme.so;@LIBASSUAN_LIBS@"
+   IMPORTED_LOCATION "@resolved_libdir@/libgpgmepp.so"
+ )
diff --git a/pkgs/development/libraries/gtk+/3.x.nix b/pkgs/development/libraries/gtk+/3.x.nix
index 8fbe2ba8dc99..917371678e9d 100644
--- a/pkgs/development/libraries/gtk+/3.x.nix
+++ b/pkgs/development/libraries/gtk+/3.x.nix
@@ -65,6 +65,8 @@ stdenv.mkDerivation rec {
       --replace '-L${gmp.dev}/lib' '-L${gmp.out}/lib'
     # The updater is needed for nixos env and it's tiny.
     moveToOutput bin/gtk-update-icon-cache "$out"
+    # Launcher
+    moveToOutput bin/gtk-launch "$out"
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/kde-frameworks/attica.nix b/pkgs/development/libraries/kde-frameworks/attica.nix
index 6c120c20d3ac..3c725223979e 100644
--- a/pkgs/development/libraries/kde-frameworks/attica.nix
+++ b/pkgs/development/libraries/kde-frameworks/attica.nix
@@ -1,6 +1,6 @@
-{ kdeFramework, lib, extra-cmake-modules, qtbase }:
+{ mkDerivation, lib, extra-cmake-modules, qtbase }:
 
-kdeFramework {
+mkDerivation {
   name = "attica";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
@@ -8,4 +8,5 @@ kdeFramework {
   };
   nativeBuildInputs = [ extra-cmake-modules ];
   buildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/baloo.nix b/pkgs/development/libraries/kde-frameworks/baloo.nix
index dc7b6af193bc..d5da9f5af176 100644
--- a/pkgs/development/libraries/kde-frameworks/baloo.nix
+++ b/pkgs/development/libraries/kde-frameworks/baloo.nix
@@ -1,14 +1,17 @@
-{ kdeFramework, lib, extra-cmake-modules, kauth, kconfig
-, kcoreaddons, kcrash, kdbusaddons, kfilemetadata, ki18n, kidletime
-, kio, lmdb, qtbase, solid
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kauth, kconfig, kcoreaddons, kcrash, kdbusaddons, kfilemetadata, ki18n,
+  kidletime, kio, lmdb, qtbase, qtdeclarative, solid,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "baloo";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
-    kauth kconfig kcoreaddons kcrash kdbusaddons kfilemetadata ki18n kio
-    kidletime lmdb qtbase solid
+  buildInputs = [
+    kauth kconfig kcrash kdbusaddons ki18n kio kidletime lmdb qtdeclarative
+    solid
   ];
+  propagatedBuildInputs = [ kcoreaddons kfilemetadata qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/bluez-qt.nix b/pkgs/development/libraries/kde-frameworks/bluez-qt.nix
index 261d9471a771..ec4deae6cb40 100644
--- a/pkgs/development/libraries/kde-frameworks/bluez-qt.nix
+++ b/pkgs/development/libraries/kde-frameworks/bluez-qt.nix
@@ -1,18 +1,19 @@
-{ kdeFramework, lib
+{ mkDerivation, lib
 , extra-cmake-modules
 , qtbase, qtdeclarative
 }:
 
-kdeFramework {
+mkDerivation {
   name = "bluez-qt";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [ qtdeclarative ];
+  buildInputs = [ qtdeclarative ];
+  propagatedBuildInputs = [ qtbase ];
   preConfigure = ''
     substituteInPlace CMakeLists.txt \
-      --replace /lib/udev/rules.d "$out/lib/udev/rules.d"
+      --replace /lib/udev/rules.d "$bin/lib/udev/rules.d"
   '';
 }
diff --git a/pkgs/development/libraries/kde-frameworks/breeze-icons.nix b/pkgs/development/libraries/kde-frameworks/breeze-icons.nix
index 9a18ade96a80..9e4a40b22aba 100644
--- a/pkgs/development/libraries/kde-frameworks/breeze-icons.nix
+++ b/pkgs/development/libraries/kde-frameworks/breeze-icons.nix
@@ -1,10 +1,9 @@
-{ kdeFramework, lib, extra-cmake-modules, qtsvg }:
+{ mkDerivation, lib, extra-cmake-modules, qtsvg }:
 
-kdeFramework {
+mkDerivation {
   name = "breeze-icons";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  outputs = [ "out" ];
   nativeBuildInputs = [ extra-cmake-modules ];
   buildInputs = [ qtsvg ];
-  propagatedUserEnvPkgs = [ qtsvg.out ];
+  outputs = [ "out" ]; # only runtime outputs
 }
diff --git a/pkgs/development/libraries/kde-frameworks/build-support/framework.nix b/pkgs/development/libraries/kde-frameworks/build-support/framework.nix
deleted file mode 100644
index 5b6f2cc4b26d..000000000000
--- a/pkgs/development/libraries/kde-frameworks/build-support/framework.nix
+++ /dev/null
@@ -1,24 +0,0 @@
-{ kdeDerivation, lib, fetchurl }:
-
-let
-  mirror = "mirror://kde";
-  srcs = import ../srcs.nix { inherit fetchurl mirror; };
-in
-
-args:
-
-let
-  inherit (args) name;
-  inherit (srcs."${name}") src version;
-in kdeDerivation (args // {
-  name = "${name}-${version}";
-  inherit src;
-
-  meta = {
-    license = with lib.licenses; [
-      lgpl21Plus lgpl3Plus bsd2 mit gpl2Plus gpl3Plus fdl12
-    ];
-    platforms = lib.platforms.linux;
-    homepage = "http://www.kde.org";
-  } // (args.meta or {});
-})
diff --git a/pkgs/development/libraries/kde-frameworks/default.nix b/pkgs/development/libraries/kde-frameworks/default.nix
index 221fba628ba9..8ab1d1b99b65 100644
--- a/pkgs/development/libraries/kde-frameworks/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/default.nix
@@ -24,89 +24,159 @@ existing packages here and modify it as necessary.
 
 */
 
-{ libsForQt5, kdeDerivation, lib, fetchurl }:
+{ libsForQt5, lib, fetchurl }:
 
 let
+
+  srcs = import ./srcs.nix {
+    inherit fetchurl;
+    mirror = "mirror://kde";
+  };
+
+  mkDerivation = libsForQt5.callPackage ({ mkDerivation }: mkDerivation) {};
+
   packages = self: with self;
+    # SUPPORT
     let
+
+      propagate = out:
+        let setupHook = { writeScript }:
+              writeScript "setup-hook.sh" ''
+                # Propagate $${out} output
+                propagatedUserEnvPkgs+=" @${out}@"
+
+                # Propagate $dev so that this setup hook is propagated
+                # But only if there is a separate $dev output
+                if [ "$outputDev" != out ]; then
+                    if [ -n "$crossConfig" ]; then
+                      propagatedBuildInputs+=" @dev@"
+                    else
+                      propagatedNativeBuildInputs+=" @dev@"
+                    fi
+                fi
+              '';
+        in callPackage setupHook {};
+
+      propagateBin = propagate "bin";
+
       callPackage = self.newScope {
-        kdeFramework = import ./build-support/framework.nix {
-          inherit kdeDerivation lib fetchurl;
-        };
+
+        inherit propagate propagateBin;
+
+        mkDerivation = args:
+          let
+
+            inherit (args) name;
+            inherit (srcs."${name}") src version;
+
+            outputs = args.outputs or [ "out" "dev" "bin" ];
+            hasBin = lib.elem "bin" outputs;
+            hasDev = lib.elem "dev" outputs;
+
+            defaultSetupHook = if hasBin && hasDev then propagateBin else null;
+            setupHook = args.setupHook or defaultSetupHook;
+
+            meta = {
+              homepage = "http://www.kde.org";
+              license = with lib.licenses; [
+                lgpl21Plus lgpl3Plus bsd2 mit gpl2Plus gpl3Plus fdl12
+              ];
+              maintainers = [ lib.maintainers.ttuegel ];
+              platforms = lib.platforms.linux;
+            } // (args.meta or {});
+
+          in mkDerivation (args // {
+            name = "${name}-${version}";
+            inherit meta outputs setupHook src;
+          });
+
       };
+
     in {
+      extra-cmake-modules = callPackage ./extra-cmake-modules {};
+
+    # TIER 1
       attica = callPackage ./attica.nix {};
-      baloo = callPackage ./baloo.nix {};
       bluez-qt = callPackage ./bluez-qt.nix {};
       breeze-icons = callPackage ./breeze-icons.nix {};
-      extra-cmake-modules = callPackage ./extra-cmake-modules {};
-      frameworkintegration = callPackage ./frameworkintegration.nix {};
-      kactivities = callPackage ./kactivities.nix {};
-      kactivities-stats = callPackage ./kactivities-stats.nix {};
       kapidox = callPackage ./kapidox.nix {};
       karchive = callPackage ./karchive.nix {};
-      kauth = callPackage ./kauth {};
-      kbookmarks = callPackage ./kbookmarks.nix {};
-      kcmutils = callPackage ./kcmutils {};
       kcodecs = callPackage ./kcodecs.nix {};
-      kcompletion = callPackage ./kcompletion.nix {};
       kconfig = callPackage ./kconfig.nix {};
-      kconfigwidgets = callPackage ./kconfigwidgets {};
       kcoreaddons = callPackage ./kcoreaddons.nix {};
-      kcrash = callPackage ./kcrash.nix {};
       kdbusaddons = callPackage ./kdbusaddons.nix {};
+      kdnssd = callPackage ./kdnssd.nix {};
+      kguiaddons = callPackage ./kguiaddons.nix {};
+      ki18n = callPackage ./ki18n.nix {};
+      kidletime = callPackage ./kidletime.nix {};
+      kitemmodels = callPackage ./kitemmodels.nix {};
+      kitemviews = callPackage ./kitemviews.nix {};
+      kplotting = callPackage ./kplotting.nix {};
+      kwayland = callPackage ./kwayland.nix {};
+      kwidgetsaddons = callPackage ./kwidgetsaddons.nix {};
+      kwindowsystem = callPackage ./kwindowsystem {};
+      modemmanager-qt = callPackage ./modemmanager-qt.nix {};
+      networkmanager-qt = callPackage ./networkmanager-qt.nix {};
+      oxygen-icons5 = callPackage ./oxygen-icons5.nix {};
+      prison = callPackage ./prison.nix {};
+      solid = callPackage ./solid.nix {};
+      sonnet = callPackage ./sonnet.nix {};
+      syntax-highlighting = callPackage ./syntax-highlighting.nix {};
+      threadweaver = callPackage ./threadweaver.nix {};
+
+    # TIER 2
+      kactivities = callPackage ./kactivities.nix {};
+      kactivities-stats = callPackage ./kactivities-stats.nix {};
+      kauth = callPackage ./kauth {};
+      kcompletion = callPackage ./kcompletion.nix {};
+      kcrash = callPackage ./kcrash.nix {};
+      kdoctools = callPackage ./kdoctools {};
+      kfilemetadata = callPackage ./kfilemetadata {};
+      kimageformats = callPackage ./kimageformats.nix {};
+      kjobwidgets = callPackage ./kjobwidgets.nix {};
+      knotifications = callPackage ./knotifications.nix {};
+      kpackage = callPackage ./kpackage {};
+      kpty = callPackage ./kpty.nix {};
+      kunitconversion = callPackage ./kunitconversion.nix {};
+
+    # TIER 3
+      baloo = callPackage ./baloo.nix {};
+      kbookmarks = callPackage ./kbookmarks.nix {};
+      kcmutils = callPackage ./kcmutils {};
+      kconfigwidgets = callPackage ./kconfigwidgets {};
       kdeclarative = callPackage ./kdeclarative.nix {};
       kded = callPackage ./kded.nix {};
-      kdelibs4support = callPackage ./kdelibs4support {};
       kdesignerplugin = callPackage ./kdesignerplugin.nix {};
       kdesu = callPackage ./kdesu.nix {};
-      kdnssd = callPackage ./kdnssd.nix {};
-      kdoctools = callPackage ./kdoctools {};
       kemoticons = callPackage ./kemoticons.nix {};
-      kfilemetadata = callPackage ./kfilemetadata {};
       kglobalaccel = callPackage ./kglobalaccel.nix {};
-      kguiaddons = callPackage ./kguiaddons.nix {};
-      khtml = callPackage ./khtml.nix {};
-      ki18n = callPackage ./ki18n.nix {};
       kiconthemes = callPackage ./kiconthemes {};
-      kidletime = callPackage ./kidletime.nix {};
-      kimageformats = callPackage ./kimageformats.nix {};
       kinit = callPackage ./kinit {};
       kio = callPackage ./kio {};
-      kitemmodels = callPackage ./kitemmodels.nix {};
-      kitemviews = callPackage ./kitemviews.nix {};
-      kjobwidgets = callPackage ./kjobwidgets.nix {};
-      kjs = callPackage ./kjs.nix {};
-      kjsembed = callPackage ./kjsembed.nix {};
-      kmediaplayer = callPackage ./kmediaplayer.nix {};
       knewstuff = callPackage ./knewstuff.nix {};
-      knotifications = callPackage ./knotifications.nix {};
       knotifyconfig = callPackage ./knotifyconfig.nix {};
-      kpackage = callPackage ./kpackage {};
       kparts = callPackage ./kparts.nix {};
       kpeople = callPackage ./kpeople.nix {};
-      kplotting = callPackage ./kplotting.nix {};
-      kpty = callPackage ./kpty.nix {};
-      kross = callPackage ./kross.nix {};
       krunner = callPackage ./krunner.nix {};
       kservice = callPackage ./kservice {};
       ktexteditor = callPackage ./ktexteditor.nix {};
       ktextwidgets = callPackage ./ktextwidgets.nix {};
-      kunitconversion = callPackage ./kunitconversion.nix {};
       kwallet = callPackage ./kwallet.nix {};
-      kwayland = callPackage ./kwayland.nix {};
-      kwidgetsaddons = callPackage ./kwidgetsaddons.nix {};
-      kwindowsystem = callPackage ./kwindowsystem {};
       kxmlgui = callPackage ./kxmlgui.nix {};
       kxmlrpcclient = callPackage ./kxmlrpcclient.nix {};
-      modemmanager-qt = callPackage ./modemmanager-qt.nix {};
-      networkmanager-qt = callPackage ./networkmanager-qt.nix {};
-      oxygen-icons5 = callPackage ./oxygen-icons5.nix {};
       plasma-framework = callPackage ./plasma-framework.nix {};
-      solid = callPackage ./solid.nix {};
-      sonnet = callPackage ./sonnet.nix {};
-      syntax-highlighting = callPackage ./syntax-highlighting.nix {};
-      threadweaver = callPackage ./threadweaver.nix {};
+
+    # TIER 4
+      frameworkintegration = callPackage ./frameworkintegration.nix {};
+
+    # PORTING AIDS
+      kdelibs4support = callPackage ./kdelibs4support {};
+      khtml = callPackage ./khtml.nix {};
+      kjs = callPackage ./kjs.nix {};
+      kjsembed = callPackage ./kjsembed.nix {};
+      kmediaplayer = callPackage ./kmediaplayer.nix {};
+      kross = callPackage ./kross.nix {};
+
     };
 
 in lib.makeScope libsForQt5.newScope packages
diff --git a/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/default.nix b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/default.nix
index f8a774b68555..dfdb6a11803d 100644
--- a/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/default.nix
@@ -1,6 +1,6 @@
-{ kdeFramework, lib, copyPathsToStore, cmake, pkgconfig }:
+{ mkDerivation, lib, copyPathsToStore, cmake, pkgconfig }:
 
-kdeFramework {
+mkDerivation {
   name = "extra-cmake-modules";
 
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
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 9ee9ef90a44b..c1b1e21852cf 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
@@ -1,22 +1,17 @@
-_ecmSetXdgDirs() {
+_ecmEnvHook() {
     addToSearchPath XDG_DATA_DIRS "$1/share"
     addToSearchPath XDG_CONFIG_DIRS "$1/etc/xdg"
 }
+envHooks+=(_ecmEnvHook)
 
-envHooks+=(_ecmSetXdgDirs)
-
-_ecmConfig() {
+_ecmPreConfigureHook() {
     # Because we need to use absolute paths here, we must set *all* the paths.
     cmakeFlags+=" -DKDE_INSTALL_EXECROOTDIR=${!outputBin}"
     cmakeFlags+=" -DKDE_INSTALL_BINDIR=${!outputBin}/bin"
     cmakeFlags+=" -DKDE_INSTALL_SBINDIR=${!outputBin}/sbin"
     cmakeFlags+=" -DKDE_INSTALL_LIBDIR=${!outputLib}/lib"
-    cmakeFlags+=" -DKDE_INSTALL_LIBEXECDIR=${!outputBin}/lib/libexec"
+    cmakeFlags+=" -DKDE_INSTALL_LIBEXECDIR=${!outputLib}/lib/libexec"
     cmakeFlags+=" -DKDE_INSTALL_CMAKEPACKAGEDIR=${!outputDev}/lib/cmake"
-    cmakeFlags+=" -DKDE_INSTALL_QTPLUGINDIR=${!outputBin}/lib/qt5/plugins"
-    cmakeFlags+=" -DKDE_INSTALL_PLUGINDIR=${!outputBin}/lib/qt5/plugins"
-    cmakeFlags+=" -DKDE_INSTALL_QTQUICKIMPORTSDIR=${!outputBin}/lib/qt5/imports"
-    cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/lib/qt5/qml"
     cmakeFlags+=" -DKDE_INSTALL_INCLUDEDIR=${!outputInclude}/include"
     cmakeFlags+=" -DKDE_INSTALL_LOCALSTATEDIR=/var"
     cmakeFlags+=" -DKDE_INSTALL_DATAROOTDIR=${!outputBin}/share"
@@ -29,7 +24,7 @@ _ecmConfig() {
     cmakeFlags+=" -DKDE_INSTALL_KXMLGUI5DIR=${!outputBin}/share/kxmlgui5"
     cmakeFlags+=" -DKDE_INSTALL_KNOTIFY5RCDIR=${!outputBin}/share/knotifications5"
     cmakeFlags+=" -DKDE_INSTALL_ICONDIR=${!outputBin}/share/icons"
-    cmakeFlags+=" -DKDE_INSTALL_LOCALEDIR=${!outputBin}/share/locale"
+    cmakeFlags+=" -DKDE_INSTALL_LOCALEDIR=${!outputLib}/share/locale"
     cmakeFlags+=" -DKDE_INSTALL_SOUNDDIR=${!outputBin}/share/sounds"
     cmakeFlags+=" -DKDE_INSTALL_TEMPLATEDIR=${!outputBin}/share/templates"
     cmakeFlags+=" -DKDE_INSTALL_WALLPAPERDIR=${!outputBin}/share/wallpapers"
@@ -46,6 +41,14 @@ _ecmConfig() {
     cmakeFlags+=" -DKDE_INSTALL_SYSCONFDIR=${!outputBin}/etc"
     cmakeFlags+=" -DKDE_INSTALL_CONFDIR=${!outputBin}/etc/xdg"
     cmakeFlags+=" -DKDE_INSTALL_AUTOSTARTDIR=${!outputBin}/etc/xdg/autostart"
-}
 
-preConfigureHooks+=(_ecmConfig)
+    if [ -n "$qtPluginPrefix" ]; then
+        cmakeFlags+=" -DKDE_INSTALL_QTPLUGINDIR=${!outputBin}/$qtPluginPrefix"
+        cmakeFlags+=" -DKDE_INSTALL_PLUGINDIR=${!outputBin}/$qtPluginPrefix"
+    fi
+
+    if [ -n "$qtQmlPrefix" ]; then
+        cmakeFlags+=" -DKDE_INSTALL_QMLDIR=${!outputBin}/$qtQmlPrefix"
+    fi
+}
+preConfigureHooks+=(_ecmPreConfigureHook)
diff --git a/pkgs/development/libraries/kde-frameworks/frameworkintegration.nix b/pkgs/development/libraries/kde-frameworks/frameworkintegration.nix
index 325758bf91db..58b064806e52 100644
--- a/pkgs/development/libraries/kde-frameworks/frameworkintegration.nix
+++ b/pkgs/development/libraries/kde-frameworks/frameworkintegration.nix
@@ -1,16 +1,17 @@
 {
-  kdeFramework, lib,
+  mkDerivation, lib,
   extra-cmake-modules,
   kbookmarks, kcompletion, kconfig, kconfigwidgets, ki18n, kiconthemes, kio,
   knewstuff, knotifications, kpackage, kwidgetsaddons, libXcursor, qtx11extras
 }:
 
-kdeFramework {
+mkDerivation {
   name = "frameworkintegration";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
-    kbookmarks kcompletion kconfig kconfigwidgets ki18n kio kiconthemes
-    knewstuff knotifications kpackage kwidgetsaddons libXcursor qtx11extras
+  buildInputs = [
+    kbookmarks kcompletion kconfig ki18n kio knewstuff knotifications kpackage
+    kwidgetsaddons libXcursor qtx11extras
   ];
+  propagatedBuildInputs = [ kconfigwidgets kiconthemes ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kactivities-stats.nix b/pkgs/development/libraries/kde-frameworks/kactivities-stats.nix
index 25188b009b62..b558306248ae 100644
--- a/pkgs/development/libraries/kde-frameworks/kactivities-stats.nix
+++ b/pkgs/development/libraries/kde-frameworks/kactivities-stats.nix
@@ -1,8 +1,14 @@
-{ kdeFramework, lib, extra-cmake-modules, boost, kactivities, kconfig }:
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  boost, kactivities, kconfig, qtbase,
+}:
 
-kdeFramework {
+mkDerivation {
   name = "kactivities-stats";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [ boost kactivities kconfig ];
+  buildInputs = [ boost kactivities kconfig ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kactivities.nix b/pkgs/development/libraries/kde-frameworks/kactivities.nix
index 167c3f15bbda..eabac6aadd7e 100644
--- a/pkgs/development/libraries/kde-frameworks/kactivities.nix
+++ b/pkgs/development/libraries/kde-frameworks/kactivities.nix
@@ -1,14 +1,15 @@
-{ kdeFramework, lib, extra-cmake-modules, boost, kcmutils, kconfig
-, kcoreaddons, kdbusaddons, kdeclarative, kglobalaccel, ki18n
-, kio, kservice, kwindowsystem, kxmlgui, qtdeclarative
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  boost, kconfig, kcoreaddons, kio, kwindowsystem, qtbase, qtdeclarative,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kactivities";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
-    boost kcmutils kconfig kcoreaddons kdbusaddons kdeclarative kglobalaccel
-    ki18n kio kservice kwindowsystem kxmlgui qtdeclarative
+  buildInputs = [
+    boost kconfig kcoreaddons kio kwindowsystem qtdeclarative
   ];
+  propagatedBuildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kapidox.nix b/pkgs/development/libraries/kde-frameworks/kapidox.nix
index 749cf9b29709..ca5e773a45b9 100644
--- a/pkgs/development/libraries/kde-frameworks/kapidox.nix
+++ b/pkgs/development/libraries/kde-frameworks/kapidox.nix
@@ -1,7 +1,10 @@
-{ kdeFramework, lib, extra-cmake-modules, python }:
+{ mkDerivation, lib, extra-cmake-modules, python }:
 
-kdeFramework {
+mkDerivation {
   name = "kapidox";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules python ];
+  postFixup = ''
+    moveToOutput bin $bin
+  '';
 }
diff --git a/pkgs/development/libraries/kde-frameworks/karchive.nix b/pkgs/development/libraries/kde-frameworks/karchive.nix
index 71561b1109c8..1f90db2bc028 100644
--- a/pkgs/development/libraries/kde-frameworks/karchive.nix
+++ b/pkgs/development/libraries/kde-frameworks/karchive.nix
@@ -1,11 +1,17 @@
-{ kdeFramework, lib, extra-cmake-modules, qtbase }:
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  bzip2, lzma, qtbase, zlib,
+}:
 
-kdeFramework {
+mkDerivation {
   name = "karchive";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
   nativeBuildInputs = [ extra-cmake-modules ];
-  buildInputs = [ qtbase ];
+  buildInputs = [ bzip2 lzma zlib ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kauth/default.nix b/pkgs/development/libraries/kde-frameworks/kauth/default.nix
index 7561575ae84e..c94c8b91ecd2 100644
--- a/pkgs/development/libraries/kde-frameworks/kauth/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kauth/default.nix
@@ -1,9 +1,17 @@
-{ kdeFramework, lib, copyPathsToStore, extra-cmake-modules, kcoreaddons, polkit-qt, qttools }:
+{
+  mkDerivation, lib, copyPathsToStore, propagate,
+  extra-cmake-modules, kcoreaddons, polkit-qt, qttools
+}:
 
-kdeFramework {
+mkDerivation {
   name = "kauth";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ extra-cmake-modules qttools ];
-  propagatedBuildInputs = [ kcoreaddons polkit-qt ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ polkit-qt qttools ];
+  propagatedBuildInputs = [ kcoreaddons ];
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+  # library stores reference to plugin path,
+  # separating $out from $bin would create a reference cycle
+  outputs = [ "out" "dev" ];
+  setupHook = propagate "out";
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kbookmarks.nix b/pkgs/development/libraries/kde-frameworks/kbookmarks.nix
index 36ea74058429..dc2339632e45 100644
--- a/pkgs/development/libraries/kde-frameworks/kbookmarks.nix
+++ b/pkgs/development/libraries/kde-frameworks/kbookmarks.nix
@@ -1,13 +1,17 @@
 {
-  kdeFramework, lib, extra-cmake-modules,
-  kcodecs, kconfig, kconfigwidgets, kcoreaddons, kiconthemes, kxmlgui
+  mkDerivation, lib,
+  extra-cmake-modules, qttools,
+  kcodecs, kconfig, kconfigwidgets, kcoreaddons, kiconthemes, kwidgetsaddons,
+  kxmlgui, qtbase,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kbookmarks";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
+  buildInputs = [
     kcodecs kconfig kconfigwidgets kcoreaddons kiconthemes kxmlgui
   ];
+  propagatedBuildInputs = [ kwidgetsaddons qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kcmutils/default.nix b/pkgs/development/libraries/kde-frameworks/kcmutils/default.nix
index fdf55174548e..0c661dcdd48e 100644
--- a/pkgs/development/libraries/kde-frameworks/kcmutils/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kcmutils/default.nix
@@ -1,15 +1,18 @@
-{ kdeFramework, lib, extra-cmake-modules, kconfigwidgets
-, kcoreaddons, kdeclarative, ki18n, kiconthemes, kitemviews
-, kpackage, kservice, kxmlgui
+{
+  mkDerivation, lib, copyPathsToStore,
+  extra-cmake-modules,
+  kconfigwidgets, kcoreaddons, kdeclarative, ki18n, kiconthemes, kitemviews,
+  kpackage, kservice, kxmlgui, qtdeclarative,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kcmutils";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
-    kconfigwidgets kcoreaddons kdeclarative ki18n kiconthemes kitemviews
-    kpackage kservice kxmlgui
+  buildInputs = [
+    kcoreaddons kdeclarative ki18n kiconthemes kitemviews kpackage kxmlgui
+    qtdeclarative
   ];
-  patches = [ ./0001-qdiriterator-follow-symlinks.patch ];
+  propagatedBuildInputs = [ kconfigwidgets kservice ];
+  patches = (copyPathsToStore (lib.readPathsFromFile ./. ./series));
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-debug-module-loader.patch b/pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-debug-module-loader.patch
new file mode 100644
index 000000000000..0411755f45a6
--- /dev/null
+++ b/pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-debug-module-loader.patch
@@ -0,0 +1,13 @@
+Index: kcmutils-5.33.0/src/kcmoduleloader.cpp
+===================================================================
+--- kcmutils-5.33.0.orig/src/kcmoduleloader.cpp
++++ kcmutils-5.33.0/src/kcmoduleloader.cpp
+@@ -96,7 +96,7 @@ KCModule *KCModuleLoader::loadModule(con
+             KPluginLoader loader(KPluginLoader::findPlugin(QLatin1String("kcms/") + mod.service()->library()));
+             KPluginFactory* factory = loader.factory();
+             if (!factory) {
+-                qWarning() << "Error loading plugin:" << loader.errorString();
++                qWarning() << "Error loading KCM plugin" << mod.service()->library() << loader.errorString();
+             } else {
+                 KQuickAddons::ConfigModule *cm = factory->create<KQuickAddons::ConfigModule >();
+                 if (!cm) {
diff --git a/pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-fix-plugin-path.patch b/pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-fix-plugin-path.patch
new file mode 100644
index 000000000000..e82ce7d592c8
--- /dev/null
+++ b/pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-fix-plugin-path.patch
@@ -0,0 +1,13 @@
+Index: kcmutils-5.33.0/src/kcmoduleloader.cpp
+===================================================================
+--- kcmutils-5.33.0.orig/src/kcmoduleloader.cpp
++++ kcmutils-5.33.0/src/kcmoduleloader.cpp
+@@ -93,7 +93,7 @@ KCModule *KCModuleLoader::loadModule(con
+         if (module) {
+             return module;
+         } else {
+-            KPluginLoader loader(KPluginLoader::findPlugin(QLatin1String("kcms/") + mod.service()->library()));
++            KPluginLoader loader(KPluginLoader::findPlugin(mod.service()->library()));
+             KPluginFactory* factory = loader.factory();
+             if (!factory) {
+                 qWarning() << "Error loading KCM plugin" << mod.service()->library() << loader.errorString();
diff --git a/pkgs/development/libraries/kde-frameworks/kcmutils/0001-qdiriterator-follow-symlinks.patch b/pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-follow-symlinks.patch
index 0d861fa95012..5e1007b7fc0b 100644
--- a/pkgs/development/libraries/kde-frameworks/kcmutils/0001-qdiriterator-follow-symlinks.patch
+++ b/pkgs/development/libraries/kde-frameworks/kcmutils/kcmutils-follow-symlinks.patch
@@ -1,17 +1,8 @@
-From f14d2a275323a47104b33eb61c5b6910ae1a9f59 Mon Sep 17 00:00:00 2001
-From: Thomas Tuegel <ttuegel@gmail.com>
-Date: Wed, 14 Oct 2015 06:43:53 -0500
-Subject: [PATCH] qdiriterator follow symlinks
-
----
- src/kpluginselector.cpp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/kpluginselector.cpp b/src/kpluginselector.cpp
-index 9c3431d..d6b1ee2 100644
---- a/src/kpluginselector.cpp
-+++ b/src/kpluginselector.cpp
-@@ -305,7 +305,7 @@ void KPluginSelector::addPlugins(const QString &componentName,
+Index: kcmutils-5.33.0/src/kpluginselector.cpp
+===================================================================
+--- kcmutils-5.33.0.orig/src/kpluginselector.cpp
++++ kcmutils-5.33.0/src/kpluginselector.cpp
+@@ -305,7 +305,7 @@ void KPluginSelector::addPlugins(const Q
      QStringList desktopFileNames;
      const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, componentName + QStringLiteral("/kpartplugins"), QStandardPaths::LocateDirectory);
      Q_FOREACH (const QString &dir, dirs) {
@@ -20,6 +11,3 @@ index 9c3431d..d6b1ee2 100644
          while (it.hasNext()) {
              desktopFileNames.append(it.next());
          }
--- 
-2.5.2
-
diff --git a/pkgs/development/libraries/kde-frameworks/kcmutils/series b/pkgs/development/libraries/kde-frameworks/kcmutils/series
new file mode 100644
index 000000000000..6fbc4ca65635
--- /dev/null
+++ b/pkgs/development/libraries/kde-frameworks/kcmutils/series
@@ -0,0 +1,3 @@
+kcmutils-follow-symlinks.patch
+kcmutils-debug-module-loader.patch
+kcmutils-fix-plugin-path.patch
diff --git a/pkgs/development/libraries/kde-frameworks/kcodecs.nix b/pkgs/development/libraries/kde-frameworks/kcodecs.nix
index fa1679519cc1..90c9a963a60e 100644
--- a/pkgs/development/libraries/kde-frameworks/kcodecs.nix
+++ b/pkgs/development/libraries/kde-frameworks/kcodecs.nix
@@ -1,11 +1,13 @@
-{ kdeFramework, lib, extra-cmake-modules, qtbase, qttools }:
+{ mkDerivation, lib, extra-cmake-modules, qtbase, qttools }:
 
-kdeFramework {
+mkDerivation {
   name = "kcodecs";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
-  nativeBuildInputs = [ extra-cmake-modules qttools ];
-  buildInputs = [ qtbase ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qttools ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kcompletion.nix b/pkgs/development/libraries/kde-frameworks/kcompletion.nix
index f143524889ad..fdfe28db6c04 100644
--- a/pkgs/development/libraries/kde-frameworks/kcompletion.nix
+++ b/pkgs/development/libraries/kde-frameworks/kcompletion.nix
@@ -1,9 +1,14 @@
-{ kdeFramework, lib, extra-cmake-modules, kconfig, kwidgetsaddons, qtbase, qttools }:
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kconfig, kwidgetsaddons, qtbase, qttools
+}:
 
-kdeFramework {
+mkDerivation {
   name = "kcompletion";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ extra-cmake-modules qttools ];
-  buildInputs = [ qtbase ];
-  propagatedBuildInputs = [ kconfig kwidgetsaddons ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ kconfig kwidgetsaddons qttools ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kconfig.nix b/pkgs/development/libraries/kde-frameworks/kconfig.nix
index f6d38cd23363..78b554017ee8 100644
--- a/pkgs/development/libraries/kde-frameworks/kconfig.nix
+++ b/pkgs/development/libraries/kde-frameworks/kconfig.nix
@@ -1,11 +1,12 @@
-{ kdeFramework, lib, extra-cmake-modules, qtbase, qttools }:
+{ mkDerivation, lib, extra-cmake-modules, qtbase, qttools }:
 
-kdeFramework {
+mkDerivation {
   name = "kconfig";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
-  nativeBuildInputs = [ extra-cmake-modules qttools ];
-  buildInputs = [ qtbase ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qttools ];
+  propagatedBuildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kconfigwidgets/default.nix b/pkgs/development/libraries/kde-frameworks/kconfigwidgets/default.nix
index c44473bb915e..3943e5d6d494 100644
--- a/pkgs/development/libraries/kde-frameworks/kconfigwidgets/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kconfigwidgets/default.nix
@@ -1,17 +1,20 @@
 {
-  kdeFramework, lib, extra-cmake-modules,
-  kauth, kcodecs, kconfig, kdoctools, kguiaddons, ki18n, kwidgetsaddons
+  mkDerivation, lib, extra-cmake-modules,
+  kauth, kcodecs, kconfig, kdoctools, kguiaddons, ki18n, kwidgetsaddons, qtbase,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kconfigwidgets";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  propagatedBuildInputs = [
-    kauth kconfig kcodecs kguiaddons ki18n kwidgetsaddons
-  ];
+  buildInputs = [ kguiaddons ki18n qtbase ];
+  propagatedBuildInputs = [ kauth kcodecs kconfig kwidgetsaddons ];
   patches = [ ./0001-qdiriterator-follow-symlinks.patch ];
+  outputs = [ "out" "dev" ];
+  preConfigure = ''
+    outputBin=dev
+  '';
   postInstall = ''
-    moveToOutput "bin/preparetips5" "$dev"
+    moveToOutput share/man $dev
   '';
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kcoreaddons.nix b/pkgs/development/libraries/kde-frameworks/kcoreaddons.nix
index 4d35c0bbdea1..34073d64f89f 100644
--- a/pkgs/development/libraries/kde-frameworks/kcoreaddons.nix
+++ b/pkgs/development/libraries/kde-frameworks/kcoreaddons.nix
@@ -1,12 +1,16 @@
-{ kdeFramework, lib, fetchurl, extra-cmake-modules, qtbase, qttools, shared_mime_info }:
+{
+  mkDerivation, lib, fetchurl, writeScript,
+  extra-cmake-modules,
+  qtbase, qttools, shared_mime_info
+}:
 
-kdeFramework {
+mkDerivation {
   name = "kcoreaddons";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
-  nativeBuildInputs = [ extra-cmake-modules qttools ];
-  buildInputs = [ qtbase ];
-  propagatedBuildInputs = [ shared_mime_info ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qttools shared_mime_info ];
+  propagatedBuildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kcrash.nix b/pkgs/development/libraries/kde-frameworks/kcrash.nix
index bd008c732af7..d45d73d33e41 100644
--- a/pkgs/development/libraries/kde-frameworks/kcrash.nix
+++ b/pkgs/development/libraries/kde-frameworks/kcrash.nix
@@ -1,8 +1,14 @@
-{ kdeFramework, lib, extra-cmake-modules, kcoreaddons, kwindowsystem, qtx11extras }:
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kcoreaddons, kwindowsystem, qtbase, qtx11extras,
+}:
 
-kdeFramework {
+mkDerivation {
   name = "kcrash";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [ kcoreaddons kwindowsystem qtx11extras ];
+  buildInputs = [ kcoreaddons kwindowsystem qtx11extras ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kdbusaddons.nix b/pkgs/development/libraries/kde-frameworks/kdbusaddons.nix
index 2bbbf65f898e..d0c744da8864 100644
--- a/pkgs/development/libraries/kde-frameworks/kdbusaddons.nix
+++ b/pkgs/development/libraries/kde-frameworks/kdbusaddons.nix
@@ -1,11 +1,16 @@
-{ kdeFramework, lib, extra-cmake-modules, qtbase, qttools, qtx11extras }:
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  qtbase, qttools, qtx11extras
+}:
 
-kdeFramework {
+mkDerivation {
   name = "kdbusaddons";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
-  nativeBuildInputs = [ extra-cmake-modules qttools ];
-  propagatedBuildInputs = [ qtx11extras ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qttools qtx11extras ];
+  propagatedBuildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kdeclarative.nix b/pkgs/development/libraries/kde-frameworks/kdeclarative.nix
index 05eaffb9fbf6..7aabeb021545 100644
--- a/pkgs/development/libraries/kde-frameworks/kdeclarative.nix
+++ b/pkgs/development/libraries/kde-frameworks/kdeclarative.nix
@@ -1,15 +1,16 @@
 {
-  kdeFramework, lib, extra-cmake-modules,
+  mkDerivation, lib, extra-cmake-modules,
   epoxy, kconfig, kglobalaccel, kguiaddons, ki18n, kiconthemes, kio, kpackage,
   kwidgetsaddons, kwindowsystem, pkgconfig, qtdeclarative
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kdeclarative";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
-    epoxy kconfig kglobalaccel kguiaddons ki18n kiconthemes kio kpackage
-    kwidgetsaddons kwindowsystem qtdeclarative
+  buildInputs = [
+    epoxy kglobalaccel kguiaddons ki18n kiconthemes kio kwidgetsaddons
+    kwindowsystem
   ];
+  propagatedBuildInputs = [ kconfig kpackage qtdeclarative ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kded.nix b/pkgs/development/libraries/kde-frameworks/kded.nix
index 2da1bac8f39c..65377789582e 100644
--- a/pkgs/development/libraries/kde-frameworks/kded.nix
+++ b/pkgs/development/libraries/kde-frameworks/kded.nix
@@ -1,13 +1,16 @@
 {
-  kdeFramework, lib, extra-cmake-modules,
-  kconfig, kcoreaddons, kcrash, kdbusaddons, kdoctools, kinit, kservice
+  mkDerivation, lib, propagate,
+  extra-cmake-modules, kdoctools,
+  kconfig, kcoreaddons, kcrash, kdbusaddons, kinit, kservice, qtbase,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kded";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  propagatedBuildInputs = [
-    kconfig kcoreaddons kcrash kdbusaddons kinit kservice
+  buildInputs = [
+    kconfig kcoreaddons kcrash kdbusaddons kinit kservice qtbase
   ];
+  outputs = [ "out" "dev" ];
+  setupHook = propagate "out";
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kdelibs4support/default.nix b/pkgs/development/libraries/kde-frameworks/kdelibs4support/default.nix
index 1174972917e4..6937a4056b28 100644
--- a/pkgs/development/libraries/kde-frameworks/kdelibs4support/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kdelibs4support/default.nix
@@ -1,30 +1,32 @@
-{ kdeFramework, lib, copyPathsToStore
-, extra-cmake-modules, docbook_xml_dtd_45, kauth
-, karchive, kcompletion, kconfig, kconfigwidgets, kcoreaddons
-, kcrash, kdbusaddons, kded, kdesignerplugin, kdoctools, kemoticons
-, kglobalaccel, kguiaddons, ki18n, kiconthemes, kio, kitemmodels
-, kinit, knotifications, kparts, kservice, ktextwidgets
-, kunitconversion, kwidgetsaddons, kwindowsystem, kxmlgui
-, networkmanager, qtsvg, qtx11extras, xlibs
+{
+  mkDerivation, lib, copyPathsToStore,
+  docbook_xml_dtd_45, extra-cmake-modules, kdoctools,
+  kauth, karchive, kcompletion, kconfig, kconfigwidgets, kcoreaddons, kcrash,
+  kdbusaddons, kded, kdesignerplugin, kemoticons, kglobalaccel, kguiaddons,
+  ki18n, kiconthemes, kio, kitemmodels, kinit, knotifications, kparts, kservice,
+  ktextwidgets, kunitconversion, kwidgetsaddons, kwindowsystem, kxmlgui,
+  networkmanager, qtbase, qtsvg, qttools, qtx11extras, xlibs
 }:
 
-# TODO: debug docbook detection
-
-kdeFramework {
+mkDerivation {
   name = "kdelibs4support";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
   setupHook = ./setup-hook.sh;
-  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
+  propagatedNativeBuildInputs = [ kdoctools ];
+  buildInputs = [
+    kcompletion kconfig kded kglobalaccel ki18n kio kservice kwidgetsaddons
+    kxmlgui networkmanager qtsvg qtx11extras xlibs.libSM
+  ];
   propagatedBuildInputs = [
-    kauth karchive kcompletion kconfig kconfigwidgets kcoreaddons kcrash
-    kdbusaddons kded kdesignerplugin kemoticons kglobalaccel kguiaddons ki18n
-    kio kiconthemes kitemmodels kinit knotifications kparts kservice
-    ktextwidgets kunitconversion kwidgetsaddons kwindowsystem kxmlgui
-    networkmanager qtsvg qtx11extras xlibs.libSM
+    kauth karchive kconfigwidgets kcoreaddons kcrash kdbusaddons kdesignerplugin
+    kemoticons kguiaddons kiconthemes kitemmodels kinit knotifications kparts
+    ktextwidgets kunitconversion kwindowsystem qtbase
   ];
   cmakeFlags = [
     "-DDocBookXML4_DTD_DIR=${docbook_xml_dtd_45}/xml/dtd/docbook"
     "-DDocBookXML4_DTD_VERSION=4.5"
   ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kdesignerplugin.nix b/pkgs/development/libraries/kde-frameworks/kdesignerplugin.nix
index 8e17a1a60c8d..91b596cc4d38 100644
--- a/pkgs/development/libraries/kde-frameworks/kdesignerplugin.nix
+++ b/pkgs/development/libraries/kde-frameworks/kdesignerplugin.nix
@@ -1,26 +1,16 @@
-{ kdeFramework, lib
-, extra-cmake-modules
-, kcompletion
-, kconfig
-, kconfigwidgets
-, kcoreaddons
-, kdoctools
-, kiconthemes
-, kio
-, kitemviews
-, kplotting
-, ktextwidgets
-, kwidgetsaddons
-, kxmlgui
-, sonnet
+{
+  mkDerivation, lib,
+  extra-cmake-modules, kdoctools,
+  kcompletion, kconfig, kconfigwidgets, kcoreaddons, kiconthemes, kio,
+  kitemviews, kplotting, ktextwidgets, kwidgetsaddons, kxmlgui, qttools, sonnet,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kdesignerplugin";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  propagatedBuildInputs = [
-    kcompletion kconfig kconfigwidgets kcoreaddons kiconthemes kio
-    kitemviews kplotting ktextwidgets kwidgetsaddons kxmlgui sonnet
+  buildInputs = [
+    kcompletion kconfig kconfigwidgets kcoreaddons kiconthemes kio kitemviews
+    kplotting ktextwidgets kwidgetsaddons kxmlgui qttools sonnet
   ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kdesu.nix b/pkgs/development/libraries/kde-frameworks/kdesu.nix
index fcccea9161f1..df60511b5115 100644
--- a/pkgs/development/libraries/kde-frameworks/kdesu.nix
+++ b/pkgs/development/libraries/kde-frameworks/kdesu.nix
@@ -1,10 +1,14 @@
-{ kdeFramework, lib, extra-cmake-modules, kcoreaddons, ki18n, kpty
-, kservice
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kcoreaddons, ki18n, kpty, kservice, qtbase,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kdesu";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [ kcoreaddons ki18n kpty kservice ];
+  buildInputs = [ kcoreaddons ki18n kpty kservice qtbase ];
+  propagatedBuildInputs = [ kpty ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kdnssd.nix b/pkgs/development/libraries/kde-frameworks/kdnssd.nix
index 18a435139f6f..9382db43e2d5 100644
--- a/pkgs/development/libraries/kde-frameworks/kdnssd.nix
+++ b/pkgs/development/libraries/kde-frameworks/kdnssd.nix
@@ -1,15 +1,17 @@
-{ kdeFramework, lib
-, extra-cmake-modules, qttools
-, avahi, qtbase
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  avahi, qtbase, qttools,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kdnssd";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
-  nativeBuildInputs = [ extra-cmake-modules qttools ];
-  propagatedBuildInputs = [ avahi ];
-  buildInputs = [ qtbase ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ avahi qttools ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix b/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix
index 99fc4c7d023c..55d719e8d8c0 100644
--- a/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix
@@ -1,16 +1,28 @@
-{ kdeFramework, lib, extra-cmake-modules, docbook_xml_dtd_45
-, docbook5_xsl, karchive, ki18n, perl, perlPackages
+{
+  mkDerivation, lib,
+  extra-cmake-modules, docbook_xml_dtd_45, docbook5_xsl,
+  karchive, ki18n, qtbase,
+  perl, perlPackages
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kdoctools";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [ karchive ki18n ];
   propagatedNativeBuildInputs = [ perl perlPackages.URI ];
+  buildInputs = [ karchive ki18n ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
+  patches = [ ./kdoctools-no-find-docbook-xml.patch ];
+  preConfigure = ''
+    outputBin=dev
+  '';
   cmakeFlags = [
     "-DDocBookXML4_DTD_DIR=${docbook_xml_dtd_45}/xml/dtd/docbook"
     "-DDocBookXSL_DIR=${docbook5_xsl}/xml/xsl/docbook"
   ];
-  patches = [ ./kdoctools-no-find-docbook-xml.patch ];
+  postFixup = ''
+    moveToOutput "share/doc" "$dev"
+    moveToOutput "share/man" "$dev"
+  '';
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kemoticons.nix b/pkgs/development/libraries/kde-frameworks/kemoticons.nix
index 1e31277172d7..b7f4f036db5e 100644
--- a/pkgs/development/libraries/kde-frameworks/kemoticons.nix
+++ b/pkgs/development/libraries/kde-frameworks/kemoticons.nix
@@ -1,14 +1,13 @@
-{ kdeFramework, lib
-, extra-cmake-modules
-, karchive
-, kconfig
-, kcoreaddons
-, kservice
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  karchive, kcoreaddons, kservice, qtbase,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kemoticons";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [ karchive kconfig kcoreaddons kservice ];
+  buildInputs = [ karchive kcoreaddons ];
+  propagatedBuildInputs = [ kservice qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kfilemetadata/default.nix b/pkgs/development/libraries/kde-frameworks/kfilemetadata/default.nix
index bc7349e7453f..7f325c88049e 100644
--- a/pkgs/development/libraries/kde-frameworks/kfilemetadata/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kfilemetadata/default.nix
@@ -1,13 +1,16 @@
-{ kdeFramework, lib, copyPathsToStore, extra-cmake-modules
-, attr, ebook_tools, exiv2, ffmpeg, karchive, ki18n, poppler, qtbase, taglib
+{
+  mkDerivation, lib, copyPathsToStore,
+  extra-cmake-modules,
+  attr, ebook_tools, exiv2, ffmpeg, karchive, ki18n, poppler, qtbase, taglib
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kfilemetadata";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
-    attr ebook_tools exiv2 ffmpeg karchive ki18n poppler qtbase taglib
+  buildInputs = [
+    attr ebook_tools exiv2 ffmpeg karchive ki18n poppler taglib
   ];
+  propagatedBuildInputs = [ qtbase ];
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kglobalaccel.nix b/pkgs/development/libraries/kde-frameworks/kglobalaccel.nix
index 1c1336dd4d0f..05fde45f17d2 100644
--- a/pkgs/development/libraries/kde-frameworks/kglobalaccel.nix
+++ b/pkgs/development/libraries/kde-frameworks/kglobalaccel.nix
@@ -1,14 +1,20 @@
 {
-  kdeFramework, lib, extra-cmake-modules,
+  mkDerivation, lib,
+  extra-cmake-modules,
   kconfig, kcoreaddons, kcrash, kdbusaddons, kservice, kwindowsystem,
-  qtx11extras
+  qtbase, qttools, qtx11extras,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kglobalaccel";
-  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
-    kconfig kcoreaddons kcrash kdbusaddons kservice kwindowsystem qtx11extras
+  buildInputs = [
+    kconfig kcoreaddons kcrash kdbusaddons kservice kwindowsystem qttools
+    qtx11extras
   ];
+  propagatedBuildInputs = [ qtbase ];
+  postPatch = ''
+    sed -i src/runtime/org.kde.kglobalaccel.service.in \
+        -e "s|@CMAKE_INSTALL_PREFIX@|''${!outputBin}|"
+  '';
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kguiaddons.nix b/pkgs/development/libraries/kde-frameworks/kguiaddons.nix
index f93aa0967f67..5cc7e3607828 100644
--- a/pkgs/development/libraries/kde-frameworks/kguiaddons.nix
+++ b/pkgs/development/libraries/kde-frameworks/kguiaddons.nix
@@ -1,15 +1,17 @@
 {
-  kdeFramework, lib,
+  mkDerivation, lib,
   extra-cmake-modules,
   qtbase, qtx11extras,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kguiaddons";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [ qtx11extras ];
+  buildInputs = [ qtx11extras ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/khtml.nix b/pkgs/development/libraries/kde-frameworks/khtml.nix
index 99f6fe31e0d7..3724d078afff 100644
--- a/pkgs/development/libraries/kde-frameworks/khtml.nix
+++ b/pkgs/development/libraries/kde-frameworks/khtml.nix
@@ -1,16 +1,19 @@
-{ kdeFramework, lib, extra-cmake-modules, giflib, karchive
-, kcodecs, kglobalaccel, ki18n, kiconthemes, kio, kjs
-, knotifications, kparts, ktextwidgets, kwallet, kwidgetsaddons
-, kwindowsystem, kxmlgui, perl, phonon, qtx11extras, sonnet
+{
+  mkDerivation, lib,
+  extra-cmake-modules, perl,
+  giflib, karchive, kcodecs, kglobalaccel, ki18n, kiconthemes, kio, kjs,
+  knotifications, kparts, ktextwidgets, kwallet, kwidgetsaddons, kwindowsystem,
+  kxmlgui, phonon, qtx11extras, sonnet
 }:
 
-kdeFramework {
+mkDerivation {
   name = "khtml";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules perl ];
-  propagatedBuildInputs = [
-    giflib karchive kcodecs kglobalaccel ki18n kiconthemes kio kjs
-    knotifications kparts ktextwidgets kwallet kwidgetsaddons kwindowsystem
-    kxmlgui phonon qtx11extras sonnet
+  buildInputs = [
+    giflib karchive kcodecs kglobalaccel ki18n kiconthemes kio knotifications
+    kparts ktextwidgets kwallet kwidgetsaddons kwindowsystem kxmlgui phonon
+    qtx11extras sonnet
   ];
+  propagatedBuildInputs = [ kjs ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/ki18n.nix b/pkgs/development/libraries/kde-frameworks/ki18n.nix
index 68f29c8314f3..805cb201bd74 100644
--- a/pkgs/development/libraries/kde-frameworks/ki18n.nix
+++ b/pkgs/development/libraries/kde-frameworks/ki18n.nix
@@ -1,10 +1,10 @@
 {
-  kdeFramework, lib,
+  mkDerivation, lib,
   extra-cmake-modules, gettext, python,
   qtbase, qtdeclarative, qtscript,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "ki18n";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
@@ -12,5 +12,5 @@ kdeFramework {
   };
   nativeBuildInputs = [ extra-cmake-modules ];
   propagatedNativeBuildInputs = [ gettext python ];
-  propagatedBuildInputs = [ qtdeclarative qtscript ];
+  buildInputs = [ qtdeclarative qtscript ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kiconthemes/default.nix b/pkgs/development/libraries/kde-frameworks/kiconthemes/default.nix
index 6102bb0d4b56..4b8e0059377d 100644
--- a/pkgs/development/libraries/kde-frameworks/kiconthemes/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kiconthemes/default.nix
@@ -1,12 +1,17 @@
-{ kdeFramework, lib, copyPathsToStore
-, extra-cmake-modules
-, karchive, kconfigwidgets, ki18n, breeze-icons, kitemviews, qtsvg
+{
+  mkDerivation, lib, copyPathsToStore,
+  extra-cmake-modules,
+  breeze-icons, karchive, kcoreaddons, kconfigwidgets, ki18n, kitemviews,
+  qtbase, qtsvg,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kiconthemes";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [ breeze-icons kconfigwidgets karchive ki18n kitemviews qtsvg ];
+  buildInputs = [
+    breeze-icons karchive kcoreaddons kconfigwidgets ki18n kitemviews
+  ];
+  propagatedBuildInputs = [ qtbase qtsvg ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kidletime.nix b/pkgs/development/libraries/kde-frameworks/kidletime.nix
index bfec344ca112..69d83eb0ff5f 100644
--- a/pkgs/development/libraries/kde-frameworks/kidletime.nix
+++ b/pkgs/development/libraries/kde-frameworks/kidletime.nix
@@ -1,15 +1,16 @@
-{ kdeFramework, lib
-, extra-cmake-modules
-, qtbase
-, qtx11extras
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  qtbase, qtx11extras
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kidletime";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [ qtbase qtx11extras ];
+  buildInputs = [ qtx11extras ];
+  propagatedBuildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kimageformats.nix b/pkgs/development/libraries/kde-frameworks/kimageformats.nix
index 2a8e825893bf..26a8637bafc2 100644
--- a/pkgs/development/libraries/kde-frameworks/kimageformats.nix
+++ b/pkgs/development/libraries/kde-frameworks/kimageformats.nix
@@ -1,14 +1,16 @@
 {
-  kdeFramework, lib,
+  mkDerivation, lib,
   extra-cmake-modules,
-  ilmbase, karchive, qtbase
+  ilmbase, karchive, openexr, qtbase
 }:
 
-kdeFramework {
+let inherit (lib) getDev; in
+
+mkDerivation {
   name = "kimageformats";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  buildInputs = [ ilmbase qtbase ];
-  propagatedBuildInputs = [ karchive ];
-  NIX_CFLAGS_COMPILE = "-I${ilmbase.dev}/include/OpenEXR";
+  buildInputs = [ karchive openexr qtbase ];
+  outputs = [ "out" ]; # plugins only
+  NIX_CFLAGS_COMPILE = "-I${getDev ilmbase}/include/OpenEXR";
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kinit/default.nix b/pkgs/development/libraries/kde-frameworks/kinit/default.nix
index f5cfa166e911..1036ea277452 100644
--- a/pkgs/development/libraries/kde-frameworks/kinit/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kinit/default.nix
@@ -1,17 +1,16 @@
 {
-  kdeFramework, lib, copyPathsToStore,
+  mkDerivation, lib, copyPathsToStore, writeScript,
   extra-cmake-modules, kdoctools,
   kconfig, kcrash, ki18n, kio, kparts, kservice, kwindowsystem, plasma-framework
 }:
 
-let
-  inherit (lib) getLib;
-in
-kdeFramework {
+let inherit (lib) getLib; in
+
+mkDerivation {
   name = "kinit";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  propagatedBuildInputs = [
+  buildInputs = [
     kconfig kcrash ki18n kio kservice kwindowsystem
   ];
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
@@ -20,4 +19,18 @@ kdeFramework {
     ''-DNIXPKGS_KF5_PARTS="${getLib kparts}/lib/libKF5Parts.so.5"''
     ''-DNIXPKGS_KF5_PLASMA="${getLib plasma-framework}/lib/libKF5Plasma.so.5"''
   ];
+  postFixup = ''
+    moveToOutput "lib/libexec/kf5/start_kdeinit" "$bin"
+  '';
+  setupHook = writeScript "setup-hook.sh" ''
+    kinitFixupOutputHook() {
+        if [ $prefix != ''${!outputBin} ] && [ -d $prefix/lib ]; then
+            mkdir -p ''${!outputBin}/lib
+            find $prefix/lib -maxdepth 1 -name 'libkdeinit5_*.so' -exec ln -s \{\} ''${!outputBin}/lib \;
+            rmdir --ignore-fail-on-non-empty ''${!outputBin}/lib
+        fi
+    }
+
+    fixupOutputHooks+=(kinitFixupOutputHook)
+  '';
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kio/default.nix b/pkgs/development/libraries/kde-frameworks/kio/default.nix
index 3f4ae5a25c2b..e4e4c90bfe14 100644
--- a/pkgs/development/libraries/kde-frameworks/kio/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kio/default.nix
@@ -1,21 +1,23 @@
-{ kdeFramework, lib, copyPathsToStore
-, extra-cmake-modules, acl, karchive
-, kbookmarks, kcompletion, kconfig, kconfigwidgets, kcoreaddons
-, kdbusaddons, kdoctools, ki18n, kiconthemes, kitemviews
-, kjobwidgets, knotifications, kservice, ktextwidgets, kwallet
-, kwidgetsaddons, kwindowsystem, kxmlgui
-, qtscript, qtx11extras, solid, fetchpatch
+{
+  mkDerivation, lib, copyPathsToStore,
+  extra-cmake-modules, kdoctools,
+  karchive, kbookmarks, kcompletion, kconfig, kconfigwidgets, kcoreaddons,
+  kdbusaddons, ki18n, kiconthemes, kitemviews, kjobwidgets, knotifications,
+  kservice, ktextwidgets, kwallet, kwidgetsaddons, kwindowsystem, kxmlgui,
+  qtbase, qtscript, qtx11extras, solid,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kio";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    karchive kconfigwidgets kdbusaddons ki18n kiconthemes knotifications
+    ktextwidgets kwallet kwidgetsaddons kwindowsystem qtscript qtx11extras
+  ];
   propagatedBuildInputs = [
-    acl karchive kbookmarks kcompletion kconfig kconfigwidgets kcoreaddons
-    kdbusaddons ki18n kiconthemes kitemviews kjobwidgets knotifications kservice
-    ktextwidgets kwallet kwidgetsaddons kwindowsystem kxmlgui solid qtscript
-    qtx11extras
+    kbookmarks kcompletion kconfig kcoreaddons kitemviews kjobwidgets kservice
+    kxmlgui qtbase solid
   ];
   patches = (copyPathsToStore (lib.readPathsFromFile ./. ./series));
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kio/kio-debug-module-loader.patch b/pkgs/development/libraries/kde-frameworks/kio/kio-debug-module-loader.patch
new file mode 100644
index 000000000000..d26af49e5eb2
--- /dev/null
+++ b/pkgs/development/libraries/kde-frameworks/kio/kio-debug-module-loader.patch
@@ -0,0 +1,13 @@
+Index: kio-5.33.0/src/kiod/kiod_main.cpp
+===================================================================
+--- kio-5.33.0.orig/src/kiod/kiod_main.cpp
++++ kio-5.33.0/src/kiod/kiod_main.cpp
+@@ -60,7 +60,7 @@ void KIOD::loadModule(const QString &nam
+         module = factory->create<KDEDModule>();
+     }
+     if (!module) {
+-        qCWarning(KIOD_CATEGORY) << "Error loading plugin:" << loader.errorString();
++        qCWarning(KIOD_CATEGORY) << "Error loading plugin" << name << loader.errorString();
+         return;
+     }
+     module->setModuleName(name); // makes it register to DBus
diff --git a/pkgs/development/libraries/kde-frameworks/kio/series b/pkgs/development/libraries/kde-frameworks/kio/series
index 77ca15450047..5330c40a3306 100644
--- a/pkgs/development/libraries/kde-frameworks/kio/series
+++ b/pkgs/development/libraries/kde-frameworks/kio/series
@@ -1 +1,2 @@
 samba-search-path.patch
+kio-debug-module-loader.patch
diff --git a/pkgs/development/libraries/kde-frameworks/kitemmodels.nix b/pkgs/development/libraries/kde-frameworks/kitemmodels.nix
index e2f0633da8c5..faeb5b16c34d 100644
--- a/pkgs/development/libraries/kde-frameworks/kitemmodels.nix
+++ b/pkgs/development/libraries/kde-frameworks/kitemmodels.nix
@@ -1,13 +1,16 @@
-{ kdeFramework, lib
-, extra-cmake-modules, qtbase
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  qtbase
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kitemmodels";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
   nativeBuildInputs = [ extra-cmake-modules ];
-  buildInputs = [ qtbase ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kitemviews.nix b/pkgs/development/libraries/kde-frameworks/kitemviews.nix
index df420f8f4b99..c4c0e804e2d3 100644
--- a/pkgs/development/libraries/kde-frameworks/kitemviews.nix
+++ b/pkgs/development/libraries/kde-frameworks/kitemviews.nix
@@ -1,13 +1,17 @@
-{ kdeFramework, lib
-, extra-cmake-modules, qtbase, qttools
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  qtbase, qttools
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kitemviews";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
-  nativeBuildInputs = [ extra-cmake-modules qttools ];
-  buildInputs = [ qtbase ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qttools ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kjobwidgets.nix b/pkgs/development/libraries/kde-frameworks/kjobwidgets.nix
index ddc66d2eb20a..810e2bf8c84e 100644
--- a/pkgs/development/libraries/kde-frameworks/kjobwidgets.nix
+++ b/pkgs/development/libraries/kde-frameworks/kjobwidgets.nix
@@ -1,13 +1,12 @@
-{ kdeFramework, lib
-, extra-cmake-modules
-, kcoreaddons
-, kwidgetsaddons
-, qttools, qtx11extras
+{
+  mkDerivation, lib,
+  extra-cmake-modules, qttools,
+  kcoreaddons, kwidgetsaddons, qtx11extras
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kjobwidgets";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules qttools ];
-  propagatedBuildInputs = [ kcoreaddons kwidgetsaddons qtx11extras ];
+  buildInputs = [ kcoreaddons kwidgetsaddons qtx11extras ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kjs.nix b/pkgs/development/libraries/kde-frameworks/kjs.nix
index abdc15ce8df6..62bcc0065b3e 100644
--- a/pkgs/development/libraries/kde-frameworks/kjs.nix
+++ b/pkgs/development/libraries/kde-frameworks/kjs.nix
@@ -1,10 +1,12 @@
-{ kdeFramework, lib
-, extra-cmake-modules
-, kdoctools
+{
+  mkDerivation, lib,
+  extra-cmake-modules, kdoctools,
+  qtbase,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kjs";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kjsembed.nix b/pkgs/development/libraries/kde-frameworks/kjsembed.nix
index 95bc02422f1b..e8cd5070ae53 100644
--- a/pkgs/development/libraries/kde-frameworks/kjsembed.nix
+++ b/pkgs/development/libraries/kde-frameworks/kjsembed.nix
@@ -1,10 +1,13 @@
-{ kdeFramework, lib, extra-cmake-modules, kdoctools, ki18n, kjs
-, qtsvg
+{
+  mkDerivation, lib,
+  extra-cmake-modules, kdoctools, qttools,
+  ki18n, kjs, qtsvg,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kjsembed";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  propagatedBuildInputs = [ ki18n kjs qtsvg ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools qttools ];
+  buildInputs = [ ki18n qtsvg ];
+  propagatedBuildInputs = [ kjs ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kmediaplayer.nix b/pkgs/development/libraries/kde-frameworks/kmediaplayer.nix
index 93a6b450f762..a4714c9e4ad7 100644
--- a/pkgs/development/libraries/kde-frameworks/kmediaplayer.nix
+++ b/pkgs/development/libraries/kde-frameworks/kmediaplayer.nix
@@ -1,12 +1,12 @@
-{ kdeFramework, lib
+{ mkDerivation, lib
 , extra-cmake-modules
 , kparts
 , kxmlgui
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kmediaplayer";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [ kparts kxmlgui ];
+  buildInputs = [ kparts kxmlgui ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/knewstuff.nix b/pkgs/development/libraries/kde-frameworks/knewstuff.nix
index 002418c65ad0..70f3cbb3c37e 100644
--- a/pkgs/development/libraries/kde-frameworks/knewstuff.nix
+++ b/pkgs/development/libraries/kde-frameworks/knewstuff.nix
@@ -1,14 +1,18 @@
-{ kdeFramework, lib, extra-cmake-modules, attica, karchive
-, kcompletion, kconfig, kcoreaddons, ki18n, kiconthemes, kio
-, kitemviews, kservice, ktextwidgets, kwidgetsaddons, kxmlgui
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  attica, karchive, kcompletion, kconfig, kcoreaddons, ki18n, kiconthemes,
+  kio, kitemviews, kservice, ktextwidgets, kwidgetsaddons, kxmlgui, qtbase,
+  qtdeclarative,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "knewstuff";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
-    attica karchive kcompletion kconfig kcoreaddons ki18n kiconthemes kio
-    kitemviews kservice ktextwidgets kwidgetsaddons kxmlgui
+  buildInputs = [
+    karchive kcompletion kconfig kcoreaddons ki18n kiconthemes kio kitemviews
+    ktextwidgets kwidgetsaddons qtbase qtdeclarative
   ];
+  propagatedBuildInputs = [ attica kservice kxmlgui ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/knotifications.nix b/pkgs/development/libraries/kde-frameworks/knotifications.nix
index c1c079578725..964e1b441154 100644
--- a/pkgs/development/libraries/kde-frameworks/knotifications.nix
+++ b/pkgs/development/libraries/kde-frameworks/knotifications.nix
@@ -1,4 +1,4 @@
-{ kdeFramework, lib
+{ mkDerivation, lib
 , extra-cmake-modules
 , kcodecs, kconfig, kcoreaddons, kwindowsystem
 , libdbusmenu
@@ -6,11 +6,11 @@
 , qttools, qtx11extras
 }:
 
-kdeFramework {
+mkDerivation {
   name = "knotifications";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules qttools ];
-  propagatedBuildInputs = [
+  buildInputs = [
     kcodecs kconfig kcoreaddons kwindowsystem libdbusmenu phonon qtx11extras
   ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/knotifyconfig.nix b/pkgs/development/libraries/kde-frameworks/knotifyconfig.nix
index 0e357aecb999..6739f96183c1 100644
--- a/pkgs/development/libraries/kde-frameworks/knotifyconfig.nix
+++ b/pkgs/development/libraries/kde-frameworks/knotifyconfig.nix
@@ -1,10 +1,14 @@
-{ kdeFramework, lib, extra-cmake-modules, kcompletion, kconfig
-, ki18n, kio, phonon
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kcompletion, kconfig, ki18n, kio, phonon, qtbase,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "knotifyconfig";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [ kcompletion kconfig ki18n kio phonon ];
+  buildInputs = [ kcompletion kconfig ki18n kio phonon ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kpackage/default.nix b/pkgs/development/libraries/kde-frameworks/kpackage/default.nix
index 2953aea9a557..c0b4b6312861 100644
--- a/pkgs/development/libraries/kde-frameworks/kpackage/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kpackage/default.nix
@@ -1,13 +1,13 @@
 {
-  kdeFramework, fetchurl, lib, copyPathsToStore,
+  mkDerivation, fetchurl, lib, copyPathsToStore,
   extra-cmake-modules, kdoctools,
-  karchive, kconfig, kcoreaddons, ki18n
+  karchive, kconfig, kcoreaddons, ki18n, qtbase,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kpackage";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  propagatedBuildInputs = [ karchive kconfig kcoreaddons ki18n ];
+  buildInputs = [ karchive kconfig kcoreaddons ki18n qtbase ];
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kparts.nix b/pkgs/development/libraries/kde-frameworks/kparts.nix
index ad6ea2dbc305..f657569277a1 100644
--- a/pkgs/development/libraries/kde-frameworks/kparts.nix
+++ b/pkgs/development/libraries/kde-frameworks/kparts.nix
@@ -1,14 +1,17 @@
-{ kdeFramework, lib, extra-cmake-modules, kconfig, kcoreaddons
-, ki18n, kiconthemes, kio, kjobwidgets, knotifications, kservice
-, ktextwidgets, kwidgetsaddons, kxmlgui
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kconfig, kcoreaddons, ki18n, kiconthemes, kio, kjobwidgets, knotifications,
+  kservice, ktextwidgets, kwidgetsaddons, kxmlgui
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kparts";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
-    kconfig kcoreaddons ki18n kiconthemes kio kjobwidgets knotifications
-    kservice ktextwidgets kwidgetsaddons kxmlgui
+  buildInputs = [
+    kconfig kcoreaddons ki18n kiconthemes kjobwidgets knotifications kservice
+    kwidgetsaddons
   ];
+  propagatedBuildInputs = [ kio ktextwidgets kxmlgui ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kpeople.nix b/pkgs/development/libraries/kde-frameworks/kpeople.nix
index 6acb5e2eed51..04181fd3e13a 100644
--- a/pkgs/development/libraries/kde-frameworks/kpeople.nix
+++ b/pkgs/development/libraries/kde-frameworks/kpeople.nix
@@ -1,12 +1,16 @@
-{ kdeFramework, lib, extra-cmake-modules, kcoreaddons, ki18n
-, kitemviews, kservice, kwidgetsaddons, qtdeclarative
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kcoreaddons, ki18n, kitemviews, kservice, kwidgetsaddons, qtbase,
+  qtdeclarative,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kpeople";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
+  buildInputs = [
     kcoreaddons ki18n kitemviews kservice kwidgetsaddons qtdeclarative
   ];
+  propagatedBuildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kplotting.nix b/pkgs/development/libraries/kde-frameworks/kplotting.nix
index e132a45976f5..5ff37fb1db12 100644
--- a/pkgs/development/libraries/kde-frameworks/kplotting.nix
+++ b/pkgs/development/libraries/kde-frameworks/kplotting.nix
@@ -1,13 +1,14 @@
-{ kdeFramework, lib
+{ mkDerivation, lib
 , extra-cmake-modules, qtbase
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kplotting";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
   nativeBuildInputs = [ extra-cmake-modules ];
-  buildInputs = [ qtbase ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kpty.nix b/pkgs/development/libraries/kde-frameworks/kpty.nix
index 8bdaacb85f82..150c5b3d2b26 100644
--- a/pkgs/development/libraries/kde-frameworks/kpty.nix
+++ b/pkgs/development/libraries/kde-frameworks/kpty.nix
@@ -1,8 +1,9 @@
-{ kdeFramework, lib, extra-cmake-modules, kcoreaddons, ki18n }:
+{ mkDerivation, lib, extra-cmake-modules, kcoreaddons, ki18n, qtbase, }:
 
-kdeFramework {
+mkDerivation {
   name = "kpty";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [ kcoreaddons ki18n ];
+  buildInputs = [ kcoreaddons ki18n qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kross.nix b/pkgs/development/libraries/kde-frameworks/kross.nix
index 0e66d95b5cce..f45fb5ecd1d0 100644
--- a/pkgs/development/libraries/kde-frameworks/kross.nix
+++ b/pkgs/development/libraries/kde-frameworks/kross.nix
@@ -1,14 +1,14 @@
-{ kdeFramework, lib, extra-cmake-modules, kcompletion, kcoreaddons
+{ mkDerivation, lib, extra-cmake-modules, kcompletion, kcoreaddons
 , kdoctools, ki18n, kiconthemes, kio, kparts, kwidgetsaddons
-, kxmlgui, qtscript
+, kxmlgui, qtbase, qtscript, qtxmlpatterns,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kross";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ kcompletion kcoreaddons kxmlgui ];
   propagatedBuildInputs = [
-    kcompletion kcoreaddons ki18n kiconthemes kio kparts kwidgetsaddons kxmlgui
-    qtscript
+    ki18n kiconthemes kio kparts kwidgetsaddons qtbase qtscript qtxmlpatterns
   ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/krunner.nix b/pkgs/development/libraries/kde-frameworks/krunner.nix
index ec9ab7abe9f9..9782320a4873 100644
--- a/pkgs/development/libraries/kde-frameworks/krunner.nix
+++ b/pkgs/development/libraries/kde-frameworks/krunner.nix
@@ -1,14 +1,17 @@
-{ kdeFramework, lib, extra-cmake-modules, kconfig, kcoreaddons
-, ki18n, kio, kservice, plasma-framework, solid
-, threadweaver
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kconfig, kcoreaddons, ki18n, kio, kservice, plasma-framework, qtbase,
+  qtdeclarative, solid, threadweaver
 }:
 
-kdeFramework {
+mkDerivation {
   name = "krunner";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
-    kconfig kcoreaddons ki18n kio kservice plasma-framework solid
+  buildInputs = [
+    kconfig kcoreaddons ki18n kio kservice qtdeclarative solid
     threadweaver
   ];
+  propagatedBuildInputs = [ plasma-framework qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kservice/default.nix b/pkgs/development/libraries/kde-frameworks/kservice/default.nix
index 2751a7f5d6e0..3ac4f4dc2688 100644
--- a/pkgs/development/libraries/kde-frameworks/kservice/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kservice/default.nix
@@ -1,14 +1,19 @@
 {
-  kdeFramework, lib, copyPathsToStore,
+  mkDerivation, lib, copyPathsToStore,
   bison, extra-cmake-modules, flex,
-  kconfig, kcoreaddons, kcrash, kdbusaddons, kdoctools, ki18n, kwindowsystem
+  kconfig, kcoreaddons, kcrash, kdbusaddons, kdoctools, ki18n, kwindowsystem,
+  qtbase, shared_mime_info,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kservice";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  propagatedNativeBuildInputs = [ bison extra-cmake-modules flex ];
-  nativeBuildInputs = [ kdoctools ];
-  propagatedBuildInputs = [ kconfig kcoreaddons kcrash kdbusaddons ki18n kwindowsystem ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  propagatedNativeBuildInputs = [ bison flex ];
+  buildInputs = [
+    kcrash kdbusaddons ki18n kwindowsystem qtbase
+  ];
+  propagatedBuildInputs = [ kconfig kcoreaddons ];
+  propagatedUserEnvPkgs = [ shared_mime_info ]; # for kbuildsycoca5
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
 }
diff --git a/pkgs/development/libraries/kde-frameworks/ktexteditor.nix b/pkgs/development/libraries/kde-frameworks/ktexteditor.nix
index fbd73c65eff6..ae4d3a71d535 100644
--- a/pkgs/development/libraries/kde-frameworks/ktexteditor.nix
+++ b/pkgs/development/libraries/kde-frameworks/ktexteditor.nix
@@ -1,17 +1,17 @@
-{ kdeFramework, lib, copyPathsToStore
-, extra-cmake-modules, perl
-, karchive, kconfig, kguiaddons, kiconthemes, kparts
-, libgit2
-, qtscript, qtxmlpatterns
-, ki18n, kio, sonnet, syntax-highlighting
+{
+  mkDerivation, lib, copyPathsToStore,
+  extra-cmake-modules, perl,
+  karchive, kconfig, kguiaddons, ki18n, kiconthemes, kio, kparts, libgit2,
+  qtscript, qtxmlpatterns, sonnet, syntax-highlighting
 }:
 
-kdeFramework {
+mkDerivation {
   name = "ktexteditor";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules perl ];
-  propagatedBuildInputs = [
-    karchive kconfig kguiaddons ki18n kiconthemes kio kparts libgit2 qtscript
+  buildInputs = [
+    karchive kconfig kguiaddons ki18n kiconthemes kio libgit2 qtscript
     qtxmlpatterns sonnet syntax-highlighting
   ];
+  propagatedBuildInputs = [ kparts ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/ktextwidgets.nix b/pkgs/development/libraries/kde-frameworks/ktextwidgets.nix
index 25954c603971..8b082f7f3655 100644
--- a/pkgs/development/libraries/kde-frameworks/ktextwidgets.nix
+++ b/pkgs/development/libraries/kde-frameworks/ktextwidgets.nix
@@ -1,14 +1,16 @@
-{ kdeFramework, lib, extra-cmake-modules, kcompletion, kconfig
-, kconfigwidgets, ki18n, kiconthemes, kservice, kwindowsystem
-, sonnet
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  kcompletion, kconfig, kconfigwidgets, ki18n, kiconthemes, kservice,
+  kwindowsystem, qtbase, sonnet,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "ktextwidgets";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
-    kcompletion kconfig kconfigwidgets ki18n kiconthemes kservice kwindowsystem
-    sonnet
+  buildInputs = [
+    kcompletion kconfig kconfigwidgets kiconthemes kservice kwindowsystem
   ];
+  propagatedBuildInputs = [ ki18n qtbase sonnet ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kunitconversion.nix b/pkgs/development/libraries/kde-frameworks/kunitconversion.nix
index c04ded722aa4..d6c079fd83b8 100644
--- a/pkgs/development/libraries/kde-frameworks/kunitconversion.nix
+++ b/pkgs/development/libraries/kde-frameworks/kunitconversion.nix
@@ -1,8 +1,9 @@
-{ kdeFramework, lib, extra-cmake-modules, ki18n }:
+{ mkDerivation, lib, extra-cmake-modules, ki18n, qtbase, }:
 
-kdeFramework {
+mkDerivation {
   name = "kunitconversion";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [ ki18n ];
+  buildInputs = [ ki18n qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kwallet.nix b/pkgs/development/libraries/kde-frameworks/kwallet.nix
index 48181040a757..fca0dedd083e 100644
--- a/pkgs/development/libraries/kde-frameworks/kwallet.nix
+++ b/pkgs/development/libraries/kde-frameworks/kwallet.nix
@@ -1,14 +1,18 @@
-{ kdeFramework, lib, extra-cmake-modules, kconfig, kconfigwidgets
-, kcoreaddons , kdbusaddons, kdoctools, ki18n, kiconthemes
-, knotifications , kservice, kwidgetsaddons, kwindowsystem, libgcrypt, gpgme
+{
+  mkDerivation, lib,
+  extra-cmake-modules, kdoctools,
+  kconfig, kconfigwidgets, kcoreaddons , kdbusaddons, ki18n,
+  kiconthemes, knotifications, kservice, kwidgetsaddons, kwindowsystem,
+  libgcrypt, qgpgme, qtbase,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kwallet";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  propagatedBuildInputs = [
+  buildInputs = [
     kconfig kconfigwidgets kcoreaddons kdbusaddons ki18n kiconthemes
-    knotifications kservice kwidgetsaddons kwindowsystem libgcrypt gpgme
+    knotifications kservice kwidgetsaddons kwindowsystem libgcrypt qgpgme
   ];
+  propagatedBuildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kwayland.nix b/pkgs/development/libraries/kde-frameworks/kwayland.nix
index d34687def3e9..096100980d61 100644
--- a/pkgs/development/libraries/kde-frameworks/kwayland.nix
+++ b/pkgs/development/libraries/kde-frameworks/kwayland.nix
@@ -1,16 +1,17 @@
 {
-  kdeFramework, lib,
+  mkDerivation, lib, propagateBin,
   extra-cmake-modules,
   qtbase, wayland
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kwayland";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
   nativeBuildInputs = [ extra-cmake-modules ];
-  buildInputs = [ qtbase ];
-  propagatedBuildInputs = [ wayland ];
+  buildInputs = [ wayland ];
+  propagatedBuildInputs = [ qtbase ];
+  setupHook = propagateBin; # XDG_CONFIG_DIRS
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kwidgetsaddons.nix b/pkgs/development/libraries/kde-frameworks/kwidgetsaddons.nix
index ce16e280faa7..e607f90de8db 100644
--- a/pkgs/development/libraries/kde-frameworks/kwidgetsaddons.nix
+++ b/pkgs/development/libraries/kde-frameworks/kwidgetsaddons.nix
@@ -1,13 +1,17 @@
-{ kdeFramework, lib
-, extra-cmake-modules, qtbase, qttools
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  qtbase, qttools
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kwidgetsaddons";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
-  nativeBuildInputs = [ extra-cmake-modules qttools ];
-  buildInputs = [ qtbase ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qttools ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kwindowsystem/default.nix b/pkgs/development/libraries/kde-frameworks/kwindowsystem/default.nix
index 8a91bdbac528..fa9078eeb205 100644
--- a/pkgs/development/libraries/kde-frameworks/kwindowsystem/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kwindowsystem/default.nix
@@ -1,19 +1,21 @@
 {
-  kdeFramework, lib, copyPathsToStore,
+  mkDerivation, lib, copyPathsToStore,
   extra-cmake-modules,
   qtbase, qttools, qtx11extras
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kwindowsystem";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
-  nativeBuildInputs = [ extra-cmake-modules qttools ];
-  propagatedBuildInputs = [ qtx11extras ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qttools qtx11extras ];
+  propagatedBuildInputs = [ qtbase ];
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
   preConfigure = ''
-    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PATH=\"$out/lib/qt5/plugins\""
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PATH=\"''${!outputBin}/$qtPluginPrefix\""
   '';
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kwindowsystem/platform-plugins-path.patch b/pkgs/development/libraries/kde-frameworks/kwindowsystem/platform-plugins-path.patch
index ed24897d342a..ae0da37922e9 100644
--- a/pkgs/development/libraries/kde-frameworks/kwindowsystem/platform-plugins-path.patch
+++ b/pkgs/development/libraries/kde-frameworks/kwindowsystem/platform-plugins-path.patch
@@ -14,7 +14,7 @@ Index: kwindowsystem-5.32.0/src/pluginwrapper.cpp
 -        foreach (const QString &entry, pluginDir.entryList(QDir::Files | QDir::NoDotAndDotDot)) {
 -            ret << pluginDir.absoluteFilePath(entry);
 -        }
-+    QDir pluginDir(QStringLiteral(NIXPKGS_QT_PLUGIN_PATH) + QLatin1Literal("/kf5/org.kde.kwindowsystem.platforms"));
++    QDir pluginDir(QLatin1String(NIXPKGS_QT_PLUGIN_PATH) + QLatin1Literal("/kf5/org.kde.kwindowsystem.platforms"));
 +    foreach (const QString &entry, pluginDir.entryList(QDir::Files | QDir::NoDotAndDotDot)) {
 +        ret << pluginDir.absoluteFilePath(entry);
      }
diff --git a/pkgs/development/libraries/kde-frameworks/kxmlgui.nix b/pkgs/development/libraries/kde-frameworks/kxmlgui.nix
index ea800bf58ae0..b9aede81f9a9 100644
--- a/pkgs/development/libraries/kde-frameworks/kxmlgui.nix
+++ b/pkgs/development/libraries/kde-frameworks/kxmlgui.nix
@@ -1,14 +1,17 @@
-{ kdeFramework, lib, extra-cmake-modules, attica, kconfig
-, kconfigwidgets, kglobalaccel, ki18n, kiconthemes, kitemviews
-, ktextwidgets, kwindowsystem, sonnet
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  attica, kconfig, kconfigwidgets, kglobalaccel, ki18n, kiconthemes, kitemviews,
+  ktextwidgets, kwindowsystem, qtbase, sonnet,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "kxmlgui";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [
-    attica kconfig kconfigwidgets kglobalaccel ki18n kiconthemes kitemviews
-    ktextwidgets kwindowsystem sonnet
+  buildInputs = [
+    attica kglobalaccel ki18n kiconthemes kitemviews ktextwidgets kwindowsystem
+    sonnet
   ];
+  propagatedBuildInputs = [ kconfig kconfigwidgets qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kxmlrpcclient.nix b/pkgs/development/libraries/kde-frameworks/kxmlrpcclient.nix
index f20f4a223945..acffde6a7cf1 100644
--- a/pkgs/development/libraries/kde-frameworks/kxmlrpcclient.nix
+++ b/pkgs/development/libraries/kde-frameworks/kxmlrpcclient.nix
@@ -1,8 +1,10 @@
-{ kdeFramework, lib, extra-cmake-modules, ki18n, kio }:
+{ mkDerivation, lib, extra-cmake-modules, ki18n, kio }:
 
-kdeFramework {
+mkDerivation {
   name = "kxmlrpcclient";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules ];
-  propagatedBuildInputs = [ ki18n kio ];
+  buildInputs = [ ki18n ];
+  propagatedBuildInputs = [ kio ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/modemmanager-qt.nix b/pkgs/development/libraries/kde-frameworks/modemmanager-qt.nix
index ea2e112ff678..cdf09a48b4fa 100644
--- a/pkgs/development/libraries/kde-frameworks/modemmanager-qt.nix
+++ b/pkgs/development/libraries/kde-frameworks/modemmanager-qt.nix
@@ -1,15 +1,16 @@
-{ kdeFramework, lib
-, extra-cmake-modules
-, modemmanager, qtbase
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  modemmanager, qtbase
 }:
 
-kdeFramework {
+mkDerivation {
   name = "modemmanager-qt";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
   nativeBuildInputs = [ extra-cmake-modules ];
-  buildInputs = [ qtbase ];
-  propagatedBuildInputs = [ modemmanager ];
+  propagatedBuildInputs = [ modemmanager qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/networkmanager-qt.nix b/pkgs/development/libraries/kde-frameworks/networkmanager-qt.nix
index 80085bb2072d..3ed56bbf718d 100644
--- a/pkgs/development/libraries/kde-frameworks/networkmanager-qt.nix
+++ b/pkgs/development/libraries/kde-frameworks/networkmanager-qt.nix
@@ -1,15 +1,16 @@
-{ kdeFramework, lib
-, extra-cmake-modules
-, qtbase, networkmanager
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  networkmanager, qtbase,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "networkmanager-qt";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
   nativeBuildInputs = [ extra-cmake-modules ];
-  buildInputs = [ qtbase ];
-  propagatedBuildInputs = [ networkmanager ];
+  propagatedBuildInputs = [ networkmanager qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/oxygen-icons5.nix b/pkgs/development/libraries/kde-frameworks/oxygen-icons5.nix
index 1d45b51274c5..2d795bfc50cc 100644
--- a/pkgs/development/libraries/kde-frameworks/oxygen-icons5.nix
+++ b/pkgs/development/libraries/kde-frameworks/oxygen-icons5.nix
@@ -1,15 +1,15 @@
-{ kdeFramework
+{ mkDerivation
 , lib
 , extra-cmake-modules, qtbase
 }:
 
-kdeFramework {
+mkDerivation {
   name = "oxygen-icons5";
   meta = {
     license = lib.licenses.lgpl3Plus;
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  outputs = [ "out" ];
   nativeBuildInputs = [ extra-cmake-modules ];
   buildInputs = [ qtbase ];
+  outputs = [ "out" ]; # only runtime outputs
 }
diff --git a/pkgs/development/libraries/kde-frameworks/plasma-framework.nix b/pkgs/development/libraries/kde-frameworks/plasma-framework.nix
index 2fd667af0dc1..d3a81b50bf17 100644
--- a/pkgs/development/libraries/kde-frameworks/plasma-framework.nix
+++ b/pkgs/development/libraries/kde-frameworks/plasma-framework.nix
@@ -1,17 +1,20 @@
-{ kdeFramework, lib, fetchurl, extra-cmake-modules, kactivities, karchive
-, kconfig, kconfigwidgets, kcoreaddons, kdbusaddons, kdeclarative
-, kdoctools, kglobalaccel, kguiaddons, ki18n, kiconthemes, kio
-, knotifications, kpackage, kservice, kwayland, kwindowsystem, kxmlgui
-, qtscript, qtx11extras
+{
+  mkDerivation, lib,
+  extra-cmake-modules, kdoctools,
+  kactivities, karchive, kconfig, kconfigwidgets, kcoreaddons, kdbusaddons,
+  kdeclarative, kglobalaccel, kguiaddons, ki18n, kiconthemes, kio,
+  knotifications, kpackage, kservice, kwayland, kwindowsystem, kxmlgui,
+  qtbase, qtdeclarative, qtscript, qtx11extras,
 }:
 
-kdeFramework {
+mkDerivation {
   name = "plasma-framework";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-  propagatedBuildInputs = [
+  buildInputs = [
     kactivities karchive kconfig kconfigwidgets kcoreaddons kdbusaddons
     kdeclarative kglobalaccel kguiaddons ki18n kiconthemes kio knotifications
-    kpackage kservice kwayland kwindowsystem kxmlgui qtscript qtx11extras
+    kwayland kwindowsystem kxmlgui qtdeclarative qtscript qtx11extras
   ];
+  propagatedBuildInputs = [ kpackage kservice qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/prison.nix b/pkgs/development/libraries/kde-frameworks/prison.nix
new file mode 100644
index 000000000000..2d86f3fbf051
--- /dev/null
+++ b/pkgs/development/libraries/kde-frameworks/prison.nix
@@ -0,0 +1,14 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  libdmtx, qrencode, qtbase,
+}:
+
+mkDerivation {
+  name = "prison";
+  meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ libdmtx qrencode ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/pkgs/development/libraries/kde-frameworks/solid.nix b/pkgs/development/libraries/kde-frameworks/solid.nix
index d32acf598ebc..24705d6c114a 100644
--- a/pkgs/development/libraries/kde-frameworks/solid.nix
+++ b/pkgs/development/libraries/kde-frameworks/solid.nix
@@ -1,15 +1,17 @@
 {
-  kdeFramework, lib,
+  mkDerivation, lib,
   bison, extra-cmake-modules, flex,
-  qtbase, qtdeclarative, qttools
+  media-player-info, qtbase, qtdeclarative, qttools
 }:
 
-kdeFramework {
+mkDerivation {
   name = "solid";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
-  nativeBuildInputs = [ bison extra-cmake-modules flex qttools ];
-  propagatedBuildInputs = [ qtdeclarative ];
+  nativeBuildInputs = [ bison extra-cmake-modules flex ];
+  buildInputs = [ qtdeclarative qttools ];
+  propagatedBuildInputs = [ qtbase ];
+  propagatedUserEnvPkgs = [ media-player-info ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/sonnet.nix b/pkgs/development/libraries/kde-frameworks/sonnet.nix
index ae3e72e2a46a..90e2169c1667 100644
--- a/pkgs/development/libraries/kde-frameworks/sonnet.nix
+++ b/pkgs/development/libraries/kde-frameworks/sonnet.nix
@@ -1,14 +1,15 @@
-{ kdeFramework, lib
+{ mkDerivation, lib
 , extra-cmake-modules
 , hunspell, qtbase, qttools
 }:
 
-kdeFramework {
+mkDerivation {
   name = "sonnet";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
-  nativeBuildInputs = [ extra-cmake-modules qttools ];
-  buildInputs = [ hunspell qtbase ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ hunspell qttools ];
+  propagatedBuildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/syntax-highlighting.nix b/pkgs/development/libraries/kde-frameworks/syntax-highlighting.nix
index f199321e6746..82c8f323a0d2 100644
--- a/pkgs/development/libraries/kde-frameworks/syntax-highlighting.nix
+++ b/pkgs/development/libraries/kde-frameworks/syntax-highlighting.nix
@@ -1,13 +1,14 @@
-{ kdeFramework, lib
+{ mkDerivation, lib
 , extra-cmake-modules, perl, qtbase, qttools
 }:
 
-kdeFramework {
+mkDerivation {
   name = "syntax-highlighting";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
-  nativeBuildInputs = [ extra-cmake-modules perl qttools ];
-  buildInputs = [ qtbase ];
+  nativeBuildInputs = [ extra-cmake-modules perl ];
+  buildInputs = [ qttools ];
+  propagatedBuildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/threadweaver.nix b/pkgs/development/libraries/kde-frameworks/threadweaver.nix
index 4df3ff510cb9..8861d2853bab 100644
--- a/pkgs/development/libraries/kde-frameworks/threadweaver.nix
+++ b/pkgs/development/libraries/kde-frameworks/threadweaver.nix
@@ -1,13 +1,16 @@
-{ kdeFramework, lib
-, extra-cmake-modules, qtbase
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+  qtbase
 }:
 
-kdeFramework {
+mkDerivation {
   name = "threadweaver";
   meta = {
     maintainers = [ lib.maintainers.ttuegel ];
     broken = builtins.compareVersions qtbase.version "5.6.0" < 0;
   };
   nativeBuildInputs = [ extra-cmake-modules ];
-  buildInputs = [ qtbase ];
+  propagatedBuildInputs = [ qtbase ];
+  outputs = [ "out" "dev" ];
 }
diff --git a/pkgs/development/libraries/libcommuni/default.nix b/pkgs/development/libraries/libcommuni/default.nix
index 3632fff43bde..2dc9c6577a40 100644
--- a/pkgs/development/libraries/libcommuni/default.nix
+++ b/pkgs/development/libraries/libcommuni/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, qtbase, qtdeclarative, qmakeHook, which
+{ stdenv, fetchFromGitHub, qtbase, qtdeclarative, qmake, which
 }:
 
 stdenv.mkDerivation rec {
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ qtbase qtdeclarative ];
-  nativeBuildInputs = [ qmakeHook which ];
+  nativeBuildInputs = [ qmake which ];
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/libkeyfinder/default.nix b/pkgs/development/libraries/libkeyfinder/default.nix
index d95ada04a34b..326d9c4f9d78 100644
--- a/pkgs/development/libraries/libkeyfinder/default.nix
+++ b/pkgs/development/libraries/libkeyfinder/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, fftw, qtbase, qmakeHook }:
+{ stdenv, fetchFromGitHub, fftw, qtbase, qmake }:
 
 stdenv.mkDerivation rec {
   name = "libkeyfinder-${version}";
@@ -11,7 +11,8 @@ stdenv.mkDerivation rec {
     owner = "ibsh";
   };
 
-  buildInputs = [ fftw qtbase qmakeHook ];
+  nativeBuildInputs = [ qmake ];
+  buildInputs = [ fftw qtbase ];
 
   postPatch = ''
     substituteInPlace LibKeyFinder.pro \
diff --git a/pkgs/development/libraries/libqtav/default.nix b/pkgs/development/libraries/libqtav/default.nix
index 7b421f4ca365..a79e6d903842 100644
--- a/pkgs/development/libraries/libqtav/default.nix
+++ b/pkgs/development/libraries/libqtav/default.nix
@@ -1,20 +1,20 @@
-{ stdenv, lib, fetchFromGitHub, extra-cmake-modules, makeQtWrapper
+{ mkDerivation, lib, fetchFromGitHub, extra-cmake-modules
 , qtbase, qtmultimedia, qtquick1, qttools
 , mesa, libX11
 , libass, openal, ffmpeg, libuchardet
 , alsaLib, libpulseaudio, libva
 }:
 
-with stdenv.lib;
+with lib;
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   name = "libqtav-${version}";
 
   # Awaiting upcoming `v1.12.0` release. `v1.11.0` is not supporting cmake which is the
   # the reason behind taking an unstable git rev. 
   version = "unstable-2017-03-30";
 
-  nativeBuildInputs = [ extra-cmake-modules makeQtWrapper qttools ];
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
   buildInputs = [ 
     qtbase qtmultimedia qtquick1
     mesa libX11
@@ -45,12 +45,6 @@ stdenv.mkDerivation rec {
     cp -a "./bin/"* "$out/bin"
   '';
 
-  postFixup = ''
-    for i in `find $out/bin -maxdepth 1 -xtype f -executable`; do
-      wrapQtProgram "$i"
-    done
-  '';
-
   meta = {
     description = "A multimedia playback framework based on Qt + FFmpeg.";
     #license = licenses.lgpl21; # For the libraries / headers only.
diff --git a/pkgs/development/libraries/opencv/3.x.nix b/pkgs/development/libraries/opencv/3.x.nix
index 5c7972eb2fad..dc4a00e6dd99 100644
--- a/pkgs/development/libraries/opencv/3.x.nix
+++ b/pkgs/development/libraries/opencv/3.x.nix
@@ -36,6 +36,13 @@ let
     sha256 = "1lynpbxz1jay3ya5y45zac5v8c6ifgk4ssn8d1chfdk3spi691jj";
   };
 
+  # This fixes the build on OS X.
+  # See: https://github.com/opencv/opencv_contrib/pull/926
+  contribOSXFix = fetchpatch {
+    url = "https://github.com/opencv/opencv_contrib/commit/abf44fcccfe2f281b7442dac243e37b7f436d961.patch";
+    sha256 = "11dsq8dwh1k6f7zglbc26xwsjw184ggf2531mhf7v77kd72k19fm";
+  };
+
   vggFiles = fetchFromGitHub {
     owner  = "opencv";
     repo   = "opencv_3rdparty";
@@ -61,6 +68,9 @@ stdenv.mkDerivation rec {
     (lib.optionalString enableContrib ''
       cp --no-preserve=mode -r "${contribSrc}/modules" "$NIX_BUILD_TOP/opencv_contrib"
 
+      # This fixes the build on OS X.
+      patch -d "$NIX_BUILD_TOP/opencv_contrib" -p2 < "${contribOSXFix}"
+
       for name in vgg_generated_48.i \
                   vgg_generated_64.i \
                   vgg_generated_80.i \
diff --git a/pkgs/development/libraries/qmltermwidget/default.nix b/pkgs/development/libraries/qmltermwidget/default.nix
index bb058711b2ec..e8e0aba7a246 100644
--- a/pkgs/development/libraries/qmltermwidget/default.nix
+++ b/pkgs/development/libraries/qmltermwidget/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchgit, qtbase, qtquick1, qmakeHook, qtmultimedia }:
+{ stdenv, fetchgit, qtbase, qtquick1, qmake, qtmultimedia }:
 
 stdenv.mkDerivation rec {
   version = "0.1.0";
@@ -11,11 +11,11 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ qtbase qtquick1 qtmultimedia ];
-  nativeBuildInputs = [ qmakeHook ];
+  nativeBuildInputs = [ qmake ];
 
   patchPhase = ''
     substituteInPlace qmltermwidget.pro \
-      --replace '$$[QT_INSTALL_QML]' "/lib/qt5/qml/"
+      --replace '$$[QT_INSTALL_QML]' "/$qtQmlPrefix/"
   '';
 
   installFlags = [ "INSTALL_ROOT=$(out)" ];
diff --git a/pkgs/development/libraries/qscintilla/default.nix b/pkgs/development/libraries/qscintilla/default.nix
index 928ff5f788be..c2e6c3cb3b52 100644
--- a/pkgs/development/libraries/qscintilla/default.nix
+++ b/pkgs/development/libraries/qscintilla/default.nix
@@ -1,6 +1,6 @@
 { stdenv, fetchurl, unzip
 , qt4 ? null, qmake4Hook ? null
-, withQt5 ? false, qtbase ? null, qmakeHook ? null
+, withQt5 ? false, qtbase ? null, qmake ? null
 }:
 
 stdenv.mkDerivation rec {
@@ -15,7 +15,7 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = if withQt5 then [ qtbase ] else [ qt4 ];
-  nativeBuildInputs = [ unzip ] ++ (if withQt5 then [ qmakeHook ] else [ qmake4Hook ]);
+  nativeBuildInputs = [ unzip ] ++ (if withQt5 then [ qmake ] else [ qmake4Hook ]);
 
   enableParallelBuilding = true;
 
diff --git a/pkgs/development/libraries/qt-5/5.6/default.nix b/pkgs/development/libraries/qt-5/5.6/default.nix
index cc6475d31b64..b250ae8b9527 100644
--- a/pkgs/development/libraries/qt-5/5.6/default.nix
+++ b/pkgs/development/libraries/qt-5/5.6/default.nix
@@ -18,8 +18,9 @@ existing packages here and modify it as necessary.
 1. Update the URL in `./fetch.sh`.
 2. Run `./maintainers/scripts/fetch-kde-qt.sh pkgs/development/libraries/qt-5/$VERSION/`
    from the top of the Nixpkgs tree.
-3. Use `nox-review wip` to check that everything builds.
-4. Commit the changes and open a pull request.
+3. Update `qtCompatVersion` below if the minor version number changes.
+4. Check that the new packages build correctly.
+5. Commit the changes and open a pull request.
 
 */
 
@@ -32,21 +33,42 @@ existing packages here and modify it as necessary.
   # options
   developerBuild ? false,
   decryptSslTraffic ? false,
+  debug ? null,
 }:
 
 with stdenv.lib;
 
 let
 
+  qtCompatVersion = "5.6";
+
   mirror = "http://download.qt.io";
   srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; };
 
+  mkDerivation = args:
+    stdenv.mkDerivation (args // {
+
+      qmakeFlags =
+        (args.qmakeFlags or [])
+        ++ optional (debug != null)
+           (if debug then "CONFIG+=debug" else "CONFIG+=release");
+
+      cmakeFlags =
+        (args.cmakeFlags or [])
+        ++ [ "-DBUILD_TESTING=OFF" ]
+        ++ optional (debug != null)
+           (if debug then "-DCMAKE_BUILD_TYPE=Debug"
+                     else "-DCMAKE_BUILD_TYPE=Release");
+
+      enableParallelBuilding = args.enableParallelBuilding or true;
+
+    });
+
   qtSubmodule = args:
     let
       inherit (args) name;
       version = args.version or srcs."${name}".version;
       src = args.src or srcs."${name}".src;
-      inherit (stdenv) mkDerivation;
     in mkDerivation (args // {
       name = "${name}-${version}";
       inherit src;
@@ -54,7 +76,7 @@ let
       propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or []);
       nativeBuildInputs =
         (args.nativeBuildInputs or [])
-        ++ [ perl self.qmakeHook ];
+        ++ [ perl self.qmake ];
 
       NIX_QT_SUBMODULE = args.NIX_QT_SUBMODULE or true;
 
@@ -63,16 +85,22 @@ let
 
       setupHook = ../qtsubmodule-setup-hook.sh;
 
-      enableParallelBuilding = args.enableParallelBuilding or true;
-
-      meta = self.qtbase.meta // (args.meta or {});
+      meta = {
+        homepage = http://www.qt.io;
+        description = "A cross-platform application framework for C++";
+        license = with licenses; [ fdl13 gpl2 lgpl21 lgpl3 ];
+        maintainers = with maintainers; [ qknight ttuegel periklis ];
+        platforms = platforms.unix;
+      } // (args.meta or {});
     });
 
   addPackages = self: with self;
     let
-      callPackage = self.newScope { inherit qtSubmodule srcs; };
+      callPackage = self.newScope { inherit qtCompatVersion qtSubmodule srcs; };
     in {
 
+      inherit mkDerivation;
+
       qtbase = callPackage ./qtbase {
         inherit bison cups harfbuzz mesa;
         inherit developerBuild decryptSslTraffic;
@@ -119,15 +147,10 @@ let
         qtwebchannel qtwebengine qtwebkit qtwebsockets qtx11extras qtxmlpatterns
       ];
 
-      makeQtWrapper =
-        makeSetupHook
-        { deps = [ makeWrapper ]; }
-        (if stdenv.isDarwin then ../make-qt-wrapper-darwin.sh else ../make-qt-wrapper.sh);
-
-      qmakeHook =
-        makeSetupHook
-        { deps = [ self.qtbase.dev ]; }
-        (if stdenv.isDarwin then ../qmake-hook-darwin.sh else ../qmake-hook.sh);
+      qmake = makeSetupHook {
+        deps = [ self.qtbase.dev ];
+        substitutions = { inherit (stdenv) isDarwin; };
+      } ../qmake-hook.sh;
     };
 
    self = makeScope newScope addPackages;
diff --git a/pkgs/development/libraries/qt-5/5.6/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.6/qtbase/default.nix
index 289a1bbac6c7..4e7c7ea54568 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtbase/default.nix
+++ b/pkgs/development/libraries/qt-5/5.6/qtbase/default.nix
@@ -1,5 +1,5 @@
 { stdenv, lib, fetchgit, copyPathsToStore
-, srcs
+, srcs, qtCompatVersion
 
 , xlibs, libX11, libxcb, libXcursor, libXext, libXrender, libXi
 , xcbutil, xcbutilimage, xcbutilkeysyms, xcbutilwm, libxkbcommon
@@ -32,6 +32,7 @@ stdenv.mkDerivation {
 
   name = "qtbase-${srcs.qtbase.version}";
   inherit (srcs.qtbase) src version;
+  inherit qtCompatVersion;
 
   outputs = [ "out" "dev" ];
 
@@ -94,18 +95,22 @@ stdenv.mkDerivation {
     # Note on the above: \x27 is a way if including a single-quote
     # character in the sed string arguments.
 
+  qtPluginPrefix = "lib/qt-${qtCompatVersion}/plugins";
+  qtQmlPrefix = "lib/qt-${qtCompatVersion}/qml";
+  qtDocPrefix = "share/doc/qt-${qtCompatVersion}";
+
   setOutputFlags = false;
   preConfigure = ''
     export LD_LIBRARY_PATH="$PWD/lib:$PWD/plugins/platforms:$LD_LIBRARY_PATH"
     export MAKEFLAGS=-j$NIX_BUILD_CORES
 
     configureFlags+="\
-        -plugindir $out/lib/qt5/plugins \
-        -importdir $out/lib/qt5/imports \
-        -qmldir $out/lib/qt5/qml \
-        -docdir $out/share/doc/qt5"
+        -plugindir $out/$qtPluginPrefix \
+        -qmldir $out/$qtQmlPrefix \
+        -docdir $out/$qtDocPrefix"
 
-    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QPA_PLATFORM_PLUGIN_PATH=\"''${!outputLib}/lib/qt5/plugins/platforms\""
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PREFIX=\"$qtPluginPrefix\""
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QPA_PLATFORM_PLUGIN_PATH=\"''${!outputLib}/$qtPluginPrefix/platforms\""
   '';
 
   prefixKey = "-prefix ";
@@ -232,8 +237,9 @@ stdenv.mkDerivation {
   postInstall = ''
     find "$out" -name "*.cmake" | while read file; do
         substituteInPlace "$file" \
-            --subst-var-by NIX_OUT "$out" \
-            --subst-var-by NIX_DEV "$dev"
+            --subst-var-by NIX_OUT "''${!outputLib}" \
+            --subst-var-by NIX_DEV "''${!outputDev}" \
+            --subst-var-by NIX_BIN "''${!outputBin}"
     done
   '';
 
diff --git a/pkgs/development/libraries/qt-5/5.6/qtbase/dlopen-resolv.patch b/pkgs/development/libraries/qt-5/5.6/qtbase/dlopen-resolv.patch
index a0b546aaa3af..e9d3c2734d1e 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtbase/dlopen-resolv.patch
+++ b/pkgs/development/libraries/qt-5/5.6/qtbase/dlopen-resolv.patch
@@ -1,8 +1,8 @@
-Index: qtbase-opensource-src-5.6.1/src/network/kernel/qdnslookup_unix.cpp
+Index: qtbase-opensource-src-5.6.2/src/network/kernel/qdnslookup_unix.cpp
 ===================================================================
---- qtbase-opensource-src-5.6.1.orig/src/network/kernel/qdnslookup_unix.cpp
-+++ qtbase-opensource-src-5.6.1/src/network/kernel/qdnslookup_unix.cpp
-@@ -78,7 +78,7 @@ static bool resolveLibraryInternal()
+--- qtbase-opensource-src-5.6.2.orig/src/network/kernel/qdnslookup_unix.cpp
++++ qtbase-opensource-src-5.6.2/src/network/kernel/qdnslookup_unix.cpp
+@@ -83,7 +83,7 @@ static bool resolveLibraryInternal()
      if (!lib.load())
  #endif
      {
@@ -11,10 +11,10 @@ Index: qtbase-opensource-src-5.6.1/src/network/kernel/qdnslookup_unix.cpp
          if (!lib.load())
              return false;
      }
-Index: qtbase-opensource-src-5.6.1/src/network/kernel/qhostinfo_unix.cpp
+Index: qtbase-opensource-src-5.6.2/src/network/kernel/qhostinfo_unix.cpp
 ===================================================================
---- qtbase-opensource-src-5.6.1.orig/src/network/kernel/qhostinfo_unix.cpp
-+++ qtbase-opensource-src-5.6.1/src/network/kernel/qhostinfo_unix.cpp
+--- qtbase-opensource-src-5.6.2.orig/src/network/kernel/qhostinfo_unix.cpp
++++ qtbase-opensource-src-5.6.2/src/network/kernel/qhostinfo_unix.cpp
 @@ -94,7 +94,7 @@ static bool resolveLibraryInternal()
      if (!lib.load())
  #endif
diff --git a/pkgs/development/libraries/qt-5/5.6/qtbase/nix-profiles-library-paths.patch b/pkgs/development/libraries/qt-5/5.6/qtbase/library-paths.patch
index 68163fc0c312..fecbce59050d 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtbase/nix-profiles-library-paths.patch
+++ b/pkgs/development/libraries/qt-5/5.6/qtbase/library-paths.patch
@@ -6,12 +6,12 @@ Index: qtbase-opensource-src-5.6.2/src/corelib/kernel/qcoreapplication.cpp
          QStringList *app_libpaths = new QStringList;
          coreappdata()->app_libpaths.reset(app_libpaths);
  
-+        // Add library paths derived from NIX_PROFILES.
-+        const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
-+        const QString plugindir = QString::fromLatin1("/lib/qt5/plugins");
-+        for (const QByteArray &profile: profiles) {
-+            if (!profile.isEmpty()) {
-+                app_libpaths->append(QFile::decodeName(profile) + plugindir);
++        // Add library paths derived from PATH
++        const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
++        const QString plugindir = QStringLiteral("../" NIXPKGS_QT_PLUGIN_PREFIX);
++        for (const QString &path: paths) {
++            if (!path.isEmpty()) {
++                app_libpaths->append(QDir::cleanPath(path + QDir::separator() + plugindir));
 +            }
 +        }
 +
diff --git a/pkgs/development/libraries/qt-5/5.6/qtbase/series b/pkgs/development/libraries/qt-5/5.6/qtbase/series
index 3527a91c84de..bacb3a4ed899 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtbase/series
+++ b/pkgs/development/libraries/qt-5/5.6/qtbase/series
@@ -4,7 +4,6 @@ dlopen-libXcursor.patch
 dlopen-openssl.patch
 dlopen-dbus.patch
 xdg-config-dirs.patch
-nix-profiles-library-paths.patch
+library-paths.patch
 compose-search-path.patch
 libressl.patch
-qpa-platform-plugin-path.patch
diff --git a/pkgs/development/libraries/qt-5/5.6/qtbase/tzdir.patch b/pkgs/development/libraries/qt-5/5.6/qtbase/tzdir.patch
index 16e88d7c4f0d..f197211ded7b 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtbase/tzdir.patch
+++ b/pkgs/development/libraries/qt-5/5.6/qtbase/tzdir.patch
@@ -1,8 +1,8 @@
-Index: qtbase-opensource-src-5.6.0/src/corelib/tools/qtimezoneprivate_tz.cpp
+Index: qtbase-opensource-src-5.6.2/src/corelib/tools/qtimezoneprivate_tz.cpp
 ===================================================================
---- qtbase-opensource-src-5.6.0.orig/src/corelib/tools/qtimezoneprivate_tz.cpp
-+++ qtbase-opensource-src-5.6.0/src/corelib/tools/qtimezoneprivate_tz.cpp
-@@ -62,7 +62,10 @@ typedef QHash<QByteArray, QTzTimeZone> Q
+--- qtbase-opensource-src-5.6.2.orig/src/corelib/tools/qtimezoneprivate_tz.cpp
++++ qtbase-opensource-src-5.6.2/src/corelib/tools/qtimezoneprivate_tz.cpp
+@@ -64,7 +64,10 @@ typedef QHash<QByteArray, QTzTimeZone> Q
  // Parse zone.tab table, assume lists all installed zones, if not will need to read directories
  static QTzTimeZoneHash loadTzTimeZones()
  {
@@ -14,7 +14,7 @@ Index: qtbase-opensource-src-5.6.0/src/corelib/tools/qtimezoneprivate_tz.cpp
      if (!QFile::exists(path))
          path = QStringLiteral("/usr/lib/zoneinfo/zone.tab");
  
-@@ -560,12 +563,18 @@ void QTzTimeZonePrivate::init(const QByt
+@@ -636,12 +639,18 @@ void QTzTimeZonePrivate::init(const QByt
          if (!tzif.open(QIODevice::ReadOnly))
              return;
      } else {
diff --git a/pkgs/development/libraries/qt-5/5.6/qtdeclarative/default.nix b/pkgs/development/libraries/qt-5/5.6/qtdeclarative/default.nix
index 9b6a6c46176c..57b8e53b215c 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtdeclarative/default.nix
+++ b/pkgs/development/libraries/qt-5/5.6/qtdeclarative/default.nix
@@ -5,4 +5,8 @@ qtSubmodule {
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
   qtInputs = [ qtbase qtsvg qtxmlpatterns ];
   nativeBuildInputs = [ python2 ];
+
+  preConfigure = ''
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QML2_IMPORT_PREFIX=\"$qtQmlPrefix\""
+  '';
 }
diff --git a/pkgs/development/libraries/qt-5/5.6/qtdeclarative/import-paths.patch b/pkgs/development/libraries/qt-5/5.6/qtdeclarative/import-paths.patch
new file mode 100644
index 000000000000..a942d837c305
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.6/qtdeclarative/import-paths.patch
@@ -0,0 +1,20 @@
+Index: qtdeclarative-opensource-src-5.6.2/src/qml/qml/qqmlimport.cpp
+===================================================================
+--- qtdeclarative-opensource-src-5.6.2.orig/src/qml/qml/qqmlimport.cpp
++++ qtdeclarative-opensource-src-5.6.2/src/qml/qml/qqmlimport.cpp
+@@ -1568,6 +1568,15 @@ QQmlImportDatabase::QQmlImportDatabase(Q
+     QString installImportsPath =  QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
+     addImportPath(installImportsPath);
+ 
++    // Add import paths derived from PATH
++    const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
++    const QString qmldir = QStringLiteral("../" NIXPKGS_QML2_IMPORT_PREFIX);
++    for (const QString &path: paths) {
++        if (!path.isEmpty()) {
++            addImportPath(QDir::cleanPath(path + QDir::separator() + qmldir));
++        }
++    }
++
+     // env import paths
+     if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
+         const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
diff --git a/pkgs/development/libraries/qt-5/5.6/qtdeclarative/nix-profiles-import-paths.patch b/pkgs/development/libraries/qt-5/5.6/qtdeclarative/nix-profiles-import-paths.patch
deleted file mode 100644
index 06b244b974ff..000000000000
--- a/pkgs/development/libraries/qt-5/5.6/qtdeclarative/nix-profiles-import-paths.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Index: qtdeclarative-opensource-src-5.5.1/src/qml/qml/qqmlimport.cpp
-===================================================================
---- qtdeclarative-opensource-src-5.5.1.orig/src/qml/qml/qqmlimport.cpp
-+++ qtdeclarative-opensource-src-5.5.1/src/qml/qml/qqmlimport.cpp
-@@ -1549,6 +1549,15 @@ QQmlImportDatabase::QQmlImportDatabase(Q
-     QString installImportsPath =  QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
-     addImportPath(installImportsPath);
- 
-+    // Add library paths derived from NIX_PROFILES.
-+    const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
-+    const QString qmldir = QString::fromLatin1("/lib/qt5/qml");
-+    Q_FOREACH (const QByteArray &profile, profiles) {
-+        if (!profile.isEmpty()) {
-+            addImportPath(QFile::decodeName(profile) + qmldir);
-+        }
-+    }
-+
-     // env import paths
-     QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
-     if (!envImportPath.isEmpty()) {
diff --git a/pkgs/development/libraries/qt-5/5.6/qtdeclarative/series b/pkgs/development/libraries/qt-5/5.6/qtdeclarative/series
index 7dbe197c56e0..38abb916a508 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtdeclarative/series
+++ b/pkgs/development/libraries/qt-5/5.6/qtdeclarative/series
@@ -1 +1 @@
-nix-profiles-import-paths.patch
+import-paths.patch
diff --git a/pkgs/development/libraries/qt-5/5.6/qtserialport/0001-dlopen-serialport-udev.patch b/pkgs/development/libraries/qt-5/5.6/qtserialport/0001-dlopen-serialport-udev.patch
index 3a813dc80074..9893fdff9a5c 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtserialport/0001-dlopen-serialport-udev.patch
+++ b/pkgs/development/libraries/qt-5/5.6/qtserialport/0001-dlopen-serialport-udev.patch
@@ -11,15 +11,15 @@ diff --git a/src/serialport/qtudev_p.h b/src/serialport/qtudev_p.h
 index 6f2cabd..81b9849 100644
 --- a/src/serialport/qtudev_p.h
 +++ b/src/serialport/qtudev_p.h
-@@ -105,9 +105,9 @@ inline QFunctionPointer resolveSymbol(QLibrary *udevLibrary, const char *symbolN
+@@ -105,10 +105,9 @@ inline QFunctionPointer resolveSymbol(QLibrary *udevLibrary, const char *symbolN
  inline bool resolveSymbols(QLibrary *udevLibrary)
  {
      if (!udevLibrary->isLoaded()) {
 -        udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 1);
-+        udevLibrary->setFileNameAndVersion(QStringLiteral("@libudev@/lib/libudev"), 1);
++        udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 1);
          if (!udevLibrary->load()) {
 -            udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 0);
-+            udevLibrary->setFileNameAndVersion(QStringLiteral("@libudev@/lib/libudev"), 0);
++            udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 0);
              if (!udevLibrary->load()) {
                  qWarning("Failed to load the library: %s, supported version(s): %i and %i", qPrintable(udevLibrary->fileName()), 1, 0);
                  return false;
diff --git a/pkgs/development/libraries/qt-5/5.6/qtserialport/default.nix b/pkgs/development/libraries/qt-5/5.6/qtserialport/default.nix
index 2bffd0a2bd61..925e8a808f25 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtserialport/default.nix
+++ b/pkgs/development/libraries/qt-5/5.6/qtserialport/default.nix
@@ -1,12 +1,12 @@
-{ qtSubmodule, qtbase, substituteAll, systemd }:
+{ stdenv, qtSubmodule, lib, copyPathsToStore, qtbase, substituteAll, systemd }:
+
+let inherit (lib) getLib optional; in
 
 qtSubmodule {
   name = "qtserialport";
   qtInputs = [ qtbase ];
-  patches = [
-    (substituteAll {
-      src = ./0001-dlopen-serialport-udev.patch;
-      libudev = systemd.lib;
-    })
-  ];
+  patches =  copyPathsToStore (lib.readPathsFromFile ./. ./series);
+  NIX_CFLAGS_COMPILE =
+    optional stdenv.isLinux
+    ''-DNIXPKGS_LIBUDEV="${getLib systemd}/lib/libudev"'';
 }
diff --git a/pkgs/development/libraries/qt-5/5.6/qtserialport/qtserialport-dlopen-udev.patch b/pkgs/development/libraries/qt-5/5.6/qtserialport/qtserialport-dlopen-udev.patch
new file mode 100644
index 000000000000..65bb64710ebd
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.6/qtserialport/qtserialport-dlopen-udev.patch
@@ -0,0 +1,22 @@
+Index: qtserialport-opensource-src-5.8.0/src/serialport/qtudev_p.h
+===================================================================
+--- qtserialport-opensource-src-5.8.0.orig/src/serialport/qtudev_p.h
++++ qtserialport-opensource-src-5.8.0/src/serialport/qtudev_p.h
+@@ -111,9 +111,17 @@ inline QFunctionPointer resolveSymbol(QL
+ inline bool resolveSymbols(QLibrary *udevLibrary)
+ {
+     if (!udevLibrary->isLoaded()) {
++#ifdef NIXPKGS_LIBUDEV
++        udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 1);
++#else
+         udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 1);
++#endif
+         if (!udevLibrary->load()) {
++#ifdef NIXPKGS_LIBUDEV
++            udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 0);
++#else
+             udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 0);
++#endif
+             if (!udevLibrary->load()) {
+                 qWarning("Failed to load the library: %s, supported version(s): %i and %i", qPrintable(udevLibrary->fileName()), 1, 0);
+                 return false;
diff --git a/pkgs/development/libraries/qt-5/5.6/qtserialport/series b/pkgs/development/libraries/qt-5/5.6/qtserialport/series
new file mode 100644
index 000000000000..83f4abf094e9
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.6/qtserialport/series
@@ -0,0 +1 @@
+qtserialport-dlopen-udev.patch
diff --git a/pkgs/development/libraries/qt-5/5.6/qtwebengine/default.nix b/pkgs/development/libraries/qt-5/5.6/qtwebengine/default.nix
index 1234c825b14d..7ffc42fe7f68 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtwebengine/default.nix
+++ b/pkgs/development/libraries/qt-5/5.6/qtwebengine/default.nix
@@ -42,10 +42,9 @@ qtSubmodule {
     sed -i -e 's,/cert.pem,/certs/ca-bundle.crt,' src/3rdparty/chromium/third_party/boringssl/src/crypto/x509/x509_def.c
 
     configureFlags+="\
-        -plugindir $out/lib/qt5/plugins \
-        -importdir $out/lib/qt5/imports \
-        -qmldir $out/lib/qt5/qml \
-        -docdir $out/share/doc/qt5"
+        -plugindir $out/$qtPluginPrefix \
+        -qmldir $out/$qtQmlPrefix \
+        -docdir $out/$qtDocPrefix"
   '';
   propagatedBuildInputs = [
     # Image formats
diff --git a/pkgs/development/libraries/qt-5/5.6/qtwebkit/0003-dlopen-webkit-udev.patch b/pkgs/development/libraries/qt-5/5.6/qtwebkit/0003-dlopen-webkit-udev.patch
index 1c360cd81aa2..19de7d99c85e 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtwebkit/0003-dlopen-webkit-udev.patch
+++ b/pkgs/development/libraries/qt-5/5.6/qtwebkit/0003-dlopen-webkit-udev.patch
@@ -11,18 +11,18 @@ diff --git a/Source/WebCore/platform/qt/GamepadsQt.cpp b/Source/WebCore/platform
 index 60ff317..da8ac69 100644
 --- a/Source/WebCore/platform/qt/GamepadsQt.cpp
 +++ b/Source/WebCore/platform/qt/GamepadsQt.cpp
-@@ -111,12 +111,12 @@ private:
+@@ -111,13 +111,12 @@ private:
      bool load()
      {
          m_libUdev.setLoadHints(QLibrary::ResolveAllSymbolsHint);
 -        m_libUdev.setFileNameAndVersion(QStringLiteral("udev"), 1);
-+        m_libUdev.setFileNameAndVersion(QStringLiteral("@libudev@/lib/libudev"), 1);
++        m_libUdev.setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 1);
          m_loaded = m_libUdev.load();
          if (resolveMethods())
              return true;
  
 -        m_libUdev.setFileNameAndVersion(QStringLiteral("udev"), 0);
-+        m_libUdev.setFileNameAndVersion(QStringLiteral("@libudev@/lib/libudev"), 0);
++        m_libUdev.setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 0);
          m_loaded = m_libUdev.load();
          return resolveMethods();
      }
diff --git a/pkgs/development/libraries/qt-5/5.6/qtwebkit/default.nix b/pkgs/development/libraries/qt-5/5.6/qtwebkit/default.nix
index 23a45dd44ed2..664281aac311 100644
--- a/pkgs/development/libraries/qt-5/5.6/qtwebkit/default.nix
+++ b/pkgs/development/libraries/qt-5/5.6/qtwebkit/default.nix
@@ -1,39 +1,40 @@
-{ qtSubmodule, stdenv, qtdeclarative, qtlocation, qtsensors
+{ qtSubmodule, stdenv, copyPathsToStore, lib
+, qtdeclarative, qtlocation, qtsensors
 , fontconfig, gdk_pixbuf, gtk2, libwebp, libxml2, libxslt
 , sqlite, systemd, glib, gst_all_1
 , bison2, flex, gdb, gperf, perl, pkgconfig, python2, ruby
+, darwin
 , substituteAll
 , flashplayerFix ? false
 }:
 
-with stdenv.lib;
+let inherit (lib) optional optionals getLib; in
 
 qtSubmodule {
   name = "qtwebkit";
   qtInputs = [ qtdeclarative qtlocation qtsensors ];
-  buildInputs = [ fontconfig libwebp libxml2 libxslt sqlite glib gst_all_1.gstreamer gst_all_1.gst-plugins-base ];
+  buildInputs = [ fontconfig libwebp libxml2 libxslt sqlite glib gst_all_1.gstreamer gst_all_1.gst-plugins-base ]
+    ++ optionals (stdenv.isDarwin) (with darwin.apple_sdk.frameworks; [ OpenGL ]);
   nativeBuildInputs = [
     bison2 flex gdb gperf perl pkgconfig python2 ruby
   ];
-  patches =
-    let dlopen-webkit-nsplugin = substituteAll {
-          src = ./0001-dlopen-webkit-nsplugin.patch;
-          gtk = gtk2.out;
-          gdk_pixbuf = gdk_pixbuf.out;
-        };
-        dlopen-webkit-gtk = substituteAll {
-          src = ./0002-dlopen-webkit-gtk.patch;
-          gtk = gtk2.out;
-        };
-        dlopen-webkit-udev = substituteAll {
-          src = ./0003-dlopen-webkit-udev.patch;
-          libudev = systemd.lib;
-        };
-    in optionals flashplayerFix [ dlopen-webkit-nsplugin dlopen-webkit-gtk ]
-    ++ [ dlopen-webkit-udev ];
+
+  __impureHostDeps = optionals (stdenv.isDarwin) [
+    "/usr/lib/libicucore.dylib"
+  ];
+
+  patches =  copyPathsToStore (lib.readPathsFromFile ./. ./series);
+
+  NIX_CFLAGS_COMPILE =
+    optionals flashplayerFix
+      [
+        ''-DNIXPKGS_LIBGTK2="${getLib gtk2}/lib/libgtk-x11-2.0"''
+        ''-DNIXPKGS_LIBGDK2="${getLib gdk_pixbuf}/lib/libgdk-x11-2.0"''
+      ]
+    ++ optional (!stdenv.isDarwin) ''-DNIXPKGS_LIBUDEV="${getLib systemd}/lib/libudev"'';
 
   # Hack to avoid TMPDIR in RPATHs.
   preFixup = ''rm -rf "$(pwd)" && mkdir "$(pwd)" '';
 
-  meta.maintainers = with stdenv.lib.maintainers; [ abbradar ];
+  meta.maintainers = with stdenv.lib.maintainers; [ abbradar periklis ];
 }
diff --git a/pkgs/development/libraries/qt-5/5.6/qtwebkit/qtwebkit-dlopen-gtk.patch b/pkgs/development/libraries/qt-5/5.6/qtwebkit/qtwebkit-dlopen-gtk.patch
new file mode 100644
index 000000000000..e34eda592af7
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.6/qtwebkit/qtwebkit-dlopen-gtk.patch
@@ -0,0 +1,64 @@
+Index: qtwebkit-opensource-src-5.8.0/Source/WebCore/plugins/qt/PluginPackageQt.cpp
+===================================================================
+--- qtwebkit-opensource-src-5.8.0.orig/Source/WebCore/plugins/qt/PluginPackageQt.cpp
++++ qtwebkit-opensource-src-5.8.0/Source/WebCore/plugins/qt/PluginPackageQt.cpp
+@@ -136,7 +136,11 @@ static void initializeGtk(QLibrary* modu
+         }
+     }
+ 
++#ifdef NIXPKGS_LIBGTK2
++    QLibrary library(QLatin1String(NIXPKGS_LIBGTK2), 0);
++#else
+     QLibrary library(QLatin1String("libgtk-x11-2.0"), 0);
++#endif
+     if (library.load()) {
+         typedef void *(*gtk_init_check_ptr)(int*, char***);
+         gtk_init_check_ptr gtkInitCheck = (gtk_init_check_ptr)library.resolve("gtk_init_check");
+Index: qtwebkit-opensource-src-5.8.0/Source/WebCore/plugins/qt/PluginViewQt.cpp
+===================================================================
+--- qtwebkit-opensource-src-5.8.0.orig/Source/WebCore/plugins/qt/PluginViewQt.cpp
++++ qtwebkit-opensource-src-5.8.0/Source/WebCore/plugins/qt/PluginViewQt.cpp
+@@ -697,7 +697,11 @@ static Display *getPluginDisplay()
+     // support gdk based plugins (like flash) that use a different X connection.
+     // The code below has the same effect as this one:
+     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
++#ifdef NIXPKGS_LIBGDK2
++    QLibrary library(QLatin1String(NIXPKGS_LIBGDK2), 0);
++#else
+     QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
++#endif
+     if (!library.load())
+         return 0;
+ 
+Index: qtwebkit-opensource-src-5.8.0/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
+===================================================================
+--- qtwebkit-opensource-src-5.8.0.orig/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
++++ qtwebkit-opensource-src-5.8.0/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
+@@ -64,7 +64,11 @@ static Display* getPluginDisplay()
+     // The code below has the same effect as this one:
+     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
+ 
++#ifdef NIXPKGS_LIBGDK2
++    QLibrary library(QLatin1String(NIXPKGS_LIBGDK2), 0);
++#else
+     QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
++#endif
+     if (!library.load())
+         return 0;
+ 
+Index: qtwebkit-opensource-src-5.8.0/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
+===================================================================
+--- qtwebkit-opensource-src-5.8.0.orig/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
++++ qtwebkit-opensource-src-5.8.0/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
+@@ -53,7 +53,11 @@ static void messageHandler(QtMsgType typ
+ 
+ static bool initializeGtk()
+ {
++#ifdef NIXPKGS_LIBGTK2
++    QLibrary gtkLibrary(QLatin1String(NIXPKGS_LIBGTK2), 0);
++#else
+     QLibrary gtkLibrary(QLatin1String("libgtk-x11-2.0"), 0);
++#endif
+     if (!gtkLibrary.load())
+         return false;
+     typedef void* (*gtk_init_ptr)(void*, void*);
diff --git a/pkgs/development/libraries/qt-5/5.6/qtwebkit/qtwebkit-dlopen-udev.patch b/pkgs/development/libraries/qt-5/5.6/qtwebkit/qtwebkit-dlopen-udev.patch
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.6/qtwebkit/qtwebkit-dlopen-udev.patch
diff --git a/pkgs/development/libraries/qt-5/5.8/qtwebkit/0004-icucore-darwin.patch b/pkgs/development/libraries/qt-5/5.6/qtwebkit/qtwebkit-icucore-darwin.patch
index a1cc1892288b..63c653da94ef 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtwebkit/0004-icucore-darwin.patch
+++ b/pkgs/development/libraries/qt-5/5.6/qtwebkit/qtwebkit-icucore-darwin.patch
@@ -1,6 +1,8 @@
+Index: qtwebkit-opensource-src-5.8.0/Source/WTF/WTF.pri
+===================================================================
 --- qtwebkit-opensource-src-5.8.0.orig/Source/WTF/WTF.pri
 +++ qtwebkit-opensource-src-5.8.0/Source/WTF/WTF.pri
-@@ -12,7 +12,7 @@
+@@ -12,7 +12,7 @@ mac {
      # Mac OS does ship libicu but not the associated header files.
      # Therefore WebKit provides adequate header files.
      INCLUDEPATH = $${ROOT_WEBKIT_DIR}/Source/WTF/icu $$INCLUDEPATH
diff --git a/pkgs/development/libraries/qt-5/5.6/qtwebkit/series b/pkgs/development/libraries/qt-5/5.6/qtwebkit/series
new file mode 100644
index 000000000000..140e2a3dd4e2
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.6/qtwebkit/series
@@ -0,0 +1,3 @@
+qtwebkit-dlopen-gtk.patch
+qtwebkit-dlopen-udev.patch
+qtwebkit-icucore-darwin.patch
diff --git a/pkgs/development/libraries/qt-5/5.8/default.nix b/pkgs/development/libraries/qt-5/5.8/default.nix
index 2865a879f47d..fd4769a02c6a 100644
--- a/pkgs/development/libraries/qt-5/5.8/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/default.nix
@@ -9,8 +9,9 @@ top-level attribute to `top-level/all-packages.nix`.
 1. Update the URL in `maintainers/scripts/generate-qt.sh`.
 2. From the top of the Nixpkgs tree, run
    `./maintainers/scripts/generate-qt.sh > pkgs/development/libraries/qt-5/$VERSION/srcs.nix`.
-3. Check that the new packages build correctly.
-4. Commit the changes and open a pull request.
+3. Update `qtCompatVersion` below if the minor version number changes.
+4. Check that the new packages build correctly.
+5. Commit the changes and open a pull request.
 
 */
 
@@ -23,21 +24,42 @@ top-level attribute to `top-level/all-packages.nix`.
   # options
   developerBuild ? false,
   decryptSslTraffic ? false,
+  debug ? null,
 }:
 
 with stdenv.lib;
 
 let
 
+  qtCompatVersion = "5.8";
+
   mirror = "http://download.qt.io";
   srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; };
 
+  mkDerivation = args:
+    stdenv.mkDerivation (args // {
+
+      qmakeFlags =
+        (args.qmakeFlags or [])
+        ++ optional (debug != null)
+           (if debug then "CONFIG+=debug" else "CONFIG+=release");
+
+      cmakeFlags =
+        (args.cmakeFlags or [])
+        ++ [ "-DBUILD_TESTING=OFF" ]
+        ++ optional (debug != null)
+           (if debug then "-DCMAKE_BUILD_TYPE=Debug"
+                     else "-DCMAKE_BUILD_TYPE=Release");
+
+      enableParallelBuilding = args.enableParallelBuilding or true;
+
+    });
+
   qtSubmodule = args:
     let
       inherit (args) name;
       version = args.version or srcs."${name}".version;
       src = args.src or srcs."${name}".src;
-      inherit (stdenv) mkDerivation;
     in mkDerivation (args // {
       name = "${name}-${version}";
       inherit src;
@@ -45,7 +67,7 @@ let
       propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or []);
       nativeBuildInputs =
         (args.nativeBuildInputs or [])
-        ++ [ perl self.qmakeHook ];
+        ++ [ perl self.qmake ];
 
       NIX_QT_SUBMODULE = args.NIX_QT_SUBMODULE or true;
 
@@ -54,19 +76,26 @@ let
 
       setupHook = ../qtsubmodule-setup-hook.sh;
 
-      enableParallelBuilding = args.enableParallelBuilding or true;
-
-      meta = self.qtbase.meta // (args.meta or {});
+      meta = {
+        homepage = http://www.qt.io;
+        description = "A cross-platform application framework for C++";
+        license = with licenses; [ fdl13 gpl2 lgpl21 lgpl3 ];
+        maintainers = with maintainers; [ qknight ttuegel periklis ];
+        platforms = platforms.unix;
+      } // (args.meta or {});
     });
 
   addPackages = self: with self;
     let
-      callPackage = self.newScope { inherit qtSubmodule srcs; };
+      callPackage = self.newScope { inherit qtCompatVersion qtSubmodule srcs; };
     in {
 
+      inherit mkDerivation;
+
       qtbase = callPackage ./qtbase {
         inherit (srcs.qtbase) src version;
         inherit bison cups harfbuzz mesa;
+        inherit dconf gtk3;
         inherit developerBuild decryptSslTraffic;
       };
 
@@ -106,16 +135,10 @@ let
       ] ++ optional (!stdenv.isDarwin) qtwayland
         ++ optional (stdenv.isDarwin) qtmacextras);
 
-      makeQtWrapper =
-        makeSetupHook
-        { deps = [ makeWrapper ] ++ optionals (!stdenv.isDarwin) [ dconf.lib gtk3 ]; }
-        (if stdenv.isDarwin then ../make-qt-wrapper-darwin.sh else ../make-qt-wrapper.sh);
-
-      qmakeHook =
-        makeSetupHook
-        { deps = [ self.qtbase.dev ]; }
-        (if stdenv.isDarwin then ../qmake-hook-darwin.sh else ../qmake-hook.sh);
-
+      qmake = makeSetupHook {
+        deps = [ self.qtbase.dev ];
+        substitutions = { inherit (stdenv) isDarwin; };
+      } ../qmake-hook.sh;
     };
 
    self = makeScope newScope addPackages;
diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/cmake-paths.patch b/pkgs/development/libraries/qt-5/5.8/qtbase/cmake-paths.patch
index c43653558e32..3408b235e0c0 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtbase/cmake-paths.patch
+++ b/pkgs/development/libraries/qt-5/5.8/qtbase/cmake-paths.patch
@@ -306,11 +306,11 @@ Index: qtbase-opensource-src-5.8.0/mkspecs/features/data/cmake/Qt5PluginTarget.c
  
  !!IF !isEmpty(CMAKE_RELEASE_TYPE)
 -_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
-+_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"@NIX_OUT@/$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME RELEASE \"@NIX_BIN@/$${CMAKE_PLUGIN_LOCATION_RELEASE}\")
  !!ENDIF
  !!IF !isEmpty(CMAKE_DEBUG_TYPE)
 -_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
-+_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"@NIX_OUT@/$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
++_populate_$${CMAKE_MODULE_NAME}_plugin_properties($$CMAKE_PLUGIN_NAME DEBUG \"@NIX_BIN@/$${CMAKE_PLUGIN_LOCATION_DEBUG}\")
  !!ENDIF
  
  list(APPEND Qt5$${CMAKE_MODULE_NAME}_PLUGINS Qt5::$$CMAKE_PLUGIN_NAME)
diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/compose-search-path.patch b/pkgs/development/libraries/qt-5/5.8/qtbase/compose-search-path.patch
index d0bea4afaa32..225d47f8e229 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtbase/compose-search-path.patch
+++ b/pkgs/development/libraries/qt-5/5.8/qtbase/compose-search-path.patch
@@ -12,7 +12,7 @@ Index: qtbase-opensource-src-5.8.0/src/plugins/platforminputcontexts/compose/gen
 -    m_possibleLocations.append(QStringLiteral("/usr/local/lib/X11/locale"));
      m_possibleLocations.append(QStringLiteral(X11_PREFIX "/share/X11/locale"));
      m_possibleLocations.append(QStringLiteral(X11_PREFIX "/lib/X11/locale"));
-+    m_possibleLocations.append(QStringLiteral(NIXPKGS_QTCOMPOSE));
++    m_possibleLocations.append(QLatin1String(NIXPKGS_QTCOMPOSE));
  }
  
  QString TableGenerator::findComposeFile()
diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix b/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
index ee6399c2bd46..93be661b7dab 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtbase/default.nix
@@ -1,13 +1,13 @@
 {
   stdenv, lib, copyPathsToStore,
-  src, version,
+  src, version, qtCompatVersion,
 
   coreutils, bison, flex, gdb, gperf, lndir, patchelf, perl, pkgconfig, python2,
   ruby,
   # darwin support
   darwin, libiconv, libcxx,
 
-  dbus, fontconfig, freetype, glib, gtk3, harfbuzz, icu, libX11, libXcomposite,
+  dbus, dconf, fontconfig, freetype, glib, gtk3, harfbuzz, icu, libX11, libXcomposite,
   libXcursor, libXext, libXi, libXrender, libinput, libjpeg, libpng, libtiff,
   libxcb, libxkbcommon, libxml2, libxslt, openssl, pcre16, sqlite, udev,
   xcbutil, xcbutilimage, xcbutilkeysyms, xcbutilrenderutil, xcbutilwm, xlibs,
@@ -32,7 +32,7 @@ in
 stdenv.mkDerivation {
 
   name = "qtbase-${version}";
-  inherit src version;
+  inherit qtCompatVersion src version;
 
   propagatedBuildInputs =
     [
@@ -76,7 +76,7 @@ stdenv.mkDerivation {
     [ bison flex gperf lndir perl pkgconfig python2 ]
     ++ lib.optional (!stdenv.isDarwin) patchelf;
 
-  outputs = [ "out" "dev" ];
+  outputs = [ "out" "dev" "bin" ];
 
   patches =
     copyPathsToStore (lib.readPathsFromFile ./. ./series);
@@ -117,18 +117,21 @@ stdenv.mkDerivation {
      # Note on the above: \x27 is a way if including a single-quote
      # character in the sed string arguments.
 
+  qtPluginPrefix = "lib/qt-${qtCompatVersion}/plugins";
+  qtQmlPrefix = "lib/qt-${qtCompatVersion}/qml";
+  qtDocPrefix = "share/doc/qt-${qtCompatVersion}";
+
   setOutputFlags = false;
   preConfigure = ''
     export LD_LIBRARY_PATH="$PWD/lib:$PWD/plugins/platforms:$LD_LIBRARY_PATH"
     export MAKEFLAGS=-j$NIX_BUILD_CORES
 
     configureFlags+="\
-        -plugindir $out/lib/qt5/plugins \
-        -importdir $out/lib/qt5/imports \
-        -qmldir $out/lib/qt5/qml \
-        -docdir $out/share/doc/qt5"
+        -plugindir $out/$qtPluginPrefix \
+        -qmldir $out/$qtQmlPrefix \
+        -docdir $out/$qtDocPrefix"
 
-    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QPA_PLATFORM_PLUGIN_PATH=\"''${!outputLib}/lib/qt5/plugins/platforms\""
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QT_PLUGIN_PREFIX=\"$qtPluginPrefix\""
   '';
 
 
@@ -143,6 +146,12 @@ stdenv.mkDerivation {
     ++ lib.optional mesaSupported
        ''-DNIXPKGS_MESA_GL="${mesa.out}/lib/libGL"''
 
+    ++ lib.optionals (!stdenv.isDarwin)
+    [
+      ''-DNIXPKGS_QGTK3_XDG_DATA_DIRS="${gtk3}/share/gsettings-schemas/${gtk3.name}"''
+      ''-DNIXPKGS_QGTK3_GIO_EXTRA_MODULES="${dconf.lib}/lib/gio/modules"''
+    ]
+
     ++ lib.optionals stdenv.isDarwin
     [
       "-D__MAC_OS_X_VERSION_MAX_ALLOWED=1090"
@@ -254,29 +263,33 @@ stdenv.mkDerivation {
 
   enableParallelBuilding = true;
 
-  postInstall = ''
-    find "$out" -name "*.cmake" | while read file; do
-        substituteInPlace "$file" \
-            --subst-var-by NIX_OUT "$out" \
-            --subst-var-by NIX_DEV "$dev"
-    done
-  '';
+  postInstall =
+    # Hardcode some CMake module paths.
+    ''
+      find "$out" -name "*.cmake" | while read file; do
+          substituteInPlace "$file" \
+              --subst-var-by NIX_OUT "''${!outputLib}" \
+              --subst-var-by NIX_DEV "''${!outputDev}" \
+              --subst-var-by NIX_BIN "''${!outputBin}"
+      done
+    '';
 
-  preFixup = ''
-    # We cannot simply set these paths in configureFlags because libQtCore retains
-    # references to the paths it was built with.
-    moveToOutput "bin" "$dev"
-    moveToOutput "include" "$dev"
-    moveToOutput "mkspecs" "$dev"
+  preFixup =
+    # Move selected outputs.
+    ''
+      moveToOutput "bin" "$dev"
+      moveToOutput "include" "$dev"
+      moveToOutput "mkspecs" "$dev"
 
-    # The destination directory must exist or moveToOutput will do nothing
-    mkdir -p "$dev/share"
-    moveToOutput "share/doc" "$dev"
-  '';
+      mkdir -p "$dev/share"
+      moveToOutput "share/doc" "$dev"
+
+      moveToOutput "$qtPluginPrefix" "$bin"
+    '';
 
   postFixup =
+    # Don't retain build-time dependencies like gdb.
     ''
-      # Don't retain build-time dependencies like gdb.
       sed '/QMAKE_DEFAULT_.*DIRS/ d' -i $dev/mkspecs/qconfig.pri
     ''
 
diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/nix-profiles-library-paths.patch b/pkgs/development/libraries/qt-5/5.8/qtbase/library-paths.patch
index 553c71d0ace3..38eecbe2c646 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtbase/nix-profiles-library-paths.patch
+++ b/pkgs/development/libraries/qt-5/5.8/qtbase/library-paths.patch
@@ -6,12 +6,12 @@ Index: qtbase-opensource-src-5.8.0/src/corelib/kernel/qcoreapplication.cpp
          QStringList *app_libpaths = new QStringList;
          coreappdata()->app_libpaths.reset(app_libpaths);
  
-+        // Add library paths derived from NIX_PROFILES.
-+        const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
-+        const QString plugindir = QString::fromLatin1("/lib/qt5/plugins");
-+        for (const QByteArray &profile: profiles) {
-+            if (!profile.isEmpty()) {
-+                app_libpaths->append(QFile::decodeName(profile) + plugindir);
++        // Add library paths derived from PATH
++        const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
++        const QString plugindir = QStringLiteral("../" NIXPKGS_QT_PLUGIN_PREFIX);
++        for (const QString &path: paths) {
++            if (!path.isEmpty()) {
++                app_libpaths->append(QDir::cleanPath(path + QDir::separator() + plugindir));
 +            }
 +        }
 +
diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/qgtk-env.patch b/pkgs/development/libraries/qt-5/5.8/qtbase/qgtk-env.patch
new file mode 100644
index 000000000000..8e5e2c71828a
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.8/qtbase/qgtk-env.patch
@@ -0,0 +1,36 @@
+Index: qtbase-opensource-src-5.8.0/src/plugins/platformthemes/gtk3/main.cpp
+===================================================================
+--- qtbase-opensource-src-5.8.0.orig/src/plugins/platformthemes/gtk3/main.cpp
++++ qtbase-opensource-src-5.8.0/src/plugins/platformthemes/gtk3/main.cpp
+@@ -39,6 +39,7 @@
+ 
+ #include <qpa/qplatformthemeplugin.h>
+ #include "qgtk3theme.h"
++#include <QFile>
+ 
+ QT_BEGIN_NAMESPACE
+ 
+@@ -54,8 +55,22 @@ public:
+ QPlatformTheme *QGtk3ThemePlugin::create(const QString &key, const QStringList &params)
+ {
+     Q_UNUSED(params);
+-    if (!key.compare(QLatin1String(QGtk3Theme::name), Qt::CaseInsensitive))
++    if (!key.compare(QLatin1String(QGtk3Theme::name), Qt::CaseInsensitive)) {
++
++#ifdef NIXPKGS_QGTK3_XDG_DATA_DIRS
++        QStringList XDG_DATA_DIRS = QFile::decodeName(qgetenv("XDG_DATA_DIRS")).split(':');
++        XDG_DATA_DIRS << QLatin1String(NIXPKGS_QGTK3_XDG_DATA_DIRS);
++        qputenv("XDG_DATA_DIRS", QFile::encodeName(XDG_DATA_DIRS.join(':')));
++#endif
++
++#ifdef NIXPKGS_QGTK3_GIO_EXTRA_MODULES
++        QStringList GIO_EXTRA_MODULES = QFile::decodeName(qgetenv("GIO_EXTRA_MODULES")).split(':');
++        GIO_EXTRA_MODULES << QLatin1String(NIXPKGS_QGTK3_GIO_EXTRA_MODULES);
++        qputenv("GIO_EXTRA_MODULES", QFile::encodeName(GIO_EXTRA_MODULES.join(':')));
++#endif
++
+         return new QGtk3Theme;
++    }
+ 
+     return 0;
+ }
diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/qpa-platform-plugin-path.patch b/pkgs/development/libraries/qt-5/5.8/qtbase/qpa-platform-plugin-path.patch
deleted file mode 100644
index 270116e1978d..000000000000
--- a/pkgs/development/libraries/qt-5/5.8/qtbase/qpa-platform-plugin-path.patch
+++ /dev/null
@@ -1,43 +0,0 @@
-Index: qtbase-opensource-src-5.8.0/src/gui/kernel/qplatformintegrationfactory.cpp
-===================================================================
---- qtbase-opensource-src-5.8.0.orig/src/gui/kernel/qplatformintegrationfactory.cpp
-+++ qtbase-opensource-src-5.8.0/src/gui/kernel/qplatformintegrationfactory.cpp
-@@ -62,9 +62,10 @@ QPlatformIntegration *QPlatformIntegrati
-     // Try loading the plugin from platformPluginPath first:
-     if (!platformPluginPath.isEmpty()) {
-         QCoreApplication::addLibraryPath(platformPluginPath);
--        if (QPlatformIntegration *ret = qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin>(directLoader(), platform, paramList, argc, argv))
--            return ret;
-     }
-+    QCoreApplication::addLibraryPath(QStringLiteral(NIXPKGS_QPA_PLATFORM_PLUGIN_PATH));
-+    if (QPlatformIntegration *ret = qLoadPlugin<QPlatformIntegration, QPlatformIntegrationPlugin>(directLoader(), platform, paramList, argc, argv))
-+        return ret;
- #else
-     Q_UNUSED(platformPluginPath);
- #endif
-@@ -84,15 +85,16 @@ QStringList QPlatformIntegrationFactory:
- #ifndef QT_NO_LIBRARY
-     if (!platformPluginPath.isEmpty()) {
-         QCoreApplication::addLibraryPath(platformPluginPath);
--        list = directLoader()->keyMap().values();
--        if (!list.isEmpty()) {
--            const QString postFix = QLatin1String(" (from ")
--                                    + QDir::toNativeSeparators(platformPluginPath)
--                                    + QLatin1Char(')');
--            const QStringList::iterator end = list.end();
--            for (QStringList::iterator it = list.begin(); it != end; ++it)
--                (*it).append(postFix);
--        }
-+    }
-+    QCoreApplication::addLibraryPath(QStringLiteral(NIXPKGS_QPA_PLATFORM_PLUGIN_PATH));
-+    list = directLoader()->keyMap().values();
-+    if (!list.isEmpty()) {
-+        const QString postFix = QLatin1String(" (from ")
-+            + QDir::toNativeSeparators(platformPluginPath)
-+            + QLatin1Char(')');
-+        const QStringList::iterator end = list.end();
-+        for (QStringList::iterator it = list.begin(); it != end; ++it)
-+            (*it).append(postFix);
-     }
- #else
-     Q_UNUSED(platformPluginPath);
diff --git a/pkgs/development/libraries/qt-5/5.8/qtbase/series b/pkgs/development/libraries/qt-5/5.8/qtbase/series
index 47400cf7aa30..f3387694518a 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtbase/series
+++ b/pkgs/development/libraries/qt-5/5.8/qtbase/series
@@ -2,9 +2,9 @@ dlopen-resolv.patch
 tzdir.patch
 dlopen-libXcursor.patch
 xdg-config-dirs.patch
-nix-profiles-library-paths.patch
+library-paths.patch
 libressl.patch
-qpa-platform-plugin-path.patch
 dlopen-gl.patch
 compose-search-path.patch
 cmake-paths.patch
+qgtk-env.patch
diff --git a/pkgs/development/libraries/qt-5/5.8/qtconnectivity.nix b/pkgs/development/libraries/qt-5/5.8/qtconnectivity.nix
index 95cd6fea79b4..1c10535c7853 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtconnectivity.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtconnectivity.nix
@@ -3,4 +3,8 @@
 qtSubmodule {
   name = "qtconnectivity";
   qtInputs = [ qtbase qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+  postInstall = ''
+    moveToOutput "$qtQmlPrefix" "$bin"
+  '';
 }
diff --git a/pkgs/development/libraries/qt-5/5.8/qtdeclarative/default.nix b/pkgs/development/libraries/qt-5/5.8/qtdeclarative/default.nix
index acddbd9e3657..cc6653348859 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtdeclarative/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtdeclarative/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, qtSubmodule, makeQtWrapper, copyPathsToStore, python2, qtbase, qtsvg, qtxmlpatterns }:
+{ stdenv, qtSubmodule, copyPathsToStore, python2, qtbase, qtsvg, qtxmlpatterns }:
 
 with stdenv.lib;
 
@@ -6,13 +6,15 @@ qtSubmodule {
   name = "qtdeclarative";
   patches = copyPathsToStore (readPathsFromFile ./. ./series);
   qtInputs = [ qtbase qtsvg qtxmlpatterns ];
-  nativeBuildInputs = [ python2 makeQtWrapper ];
+  nativeBuildInputs = [ python2 ];
+  outputs = [ "out" "dev" "bin" ];
+
+  preConfigure = ''
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_QML2_IMPORT_PREFIX=\"$qtQmlPrefix\""
+  '';
 
   postInstall = ''
-    wrapQtProgram $out/bin/qmleasing
-    wrapQtProgram $out/bin/qmlscene
-    wrapQtProgram $out/bin/qmltestrunner
-  '' + optionalString (stdenv.isDarwin) ''
-    wrapQtProgram $out/bin/qml.app/Contents/MacOS/qml
+    moveToOutput "$qtPluginPrefix" "$bin"
+    moveToOutput "$qtQmlPrefix" "$bin"
   '';
 }
diff --git a/pkgs/development/libraries/qt-5/5.8/qtdeclarative/import-paths.patch b/pkgs/development/libraries/qt-5/5.8/qtdeclarative/import-paths.patch
new file mode 100644
index 000000000000..d50ee823a78b
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.8/qtdeclarative/import-paths.patch
@@ -0,0 +1,20 @@
+Index: qtdeclarative-opensource-src-5.8.0/src/qml/qml/qqmlimport.cpp
+===================================================================
+--- qtdeclarative-opensource-src-5.8.0.orig/src/qml/qml/qqmlimport.cpp
++++ qtdeclarative-opensource-src-5.8.0/src/qml/qml/qqmlimport.cpp
+@@ -1630,6 +1630,15 @@ QQmlImportDatabase::QQmlImportDatabase(Q
+     QString installImportsPath =  QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
+     addImportPath(installImportsPath);
+ 
++    // Add import paths derived from PATH
++    const QStringList paths = QFile::decodeName(qgetenv("PATH")).split(':');
++    const QString qmldir = QStringLiteral("../" NIXPKGS_QML2_IMPORT_PREFIX);
++    for (const QString &path: paths) {
++        if (!path.isEmpty()) {
++            addImportPath(QDir::cleanPath(path + QDir::separator() + qmldir));
++        }
++    }
++
+     // env import paths
+     if (Q_UNLIKELY(!qEnvironmentVariableIsEmpty("QML2_IMPORT_PATH"))) {
+         const QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
diff --git a/pkgs/development/libraries/qt-5/5.8/qtdeclarative/nix-profiles-import-paths.patch b/pkgs/development/libraries/qt-5/5.8/qtdeclarative/nix-profiles-import-paths.patch
deleted file mode 100644
index 06b244b974ff..000000000000
--- a/pkgs/development/libraries/qt-5/5.8/qtdeclarative/nix-profiles-import-paths.patch
+++ /dev/null
@@ -1,20 +0,0 @@
-Index: qtdeclarative-opensource-src-5.5.1/src/qml/qml/qqmlimport.cpp
-===================================================================
---- qtdeclarative-opensource-src-5.5.1.orig/src/qml/qml/qqmlimport.cpp
-+++ qtdeclarative-opensource-src-5.5.1/src/qml/qml/qqmlimport.cpp
-@@ -1549,6 +1549,15 @@ QQmlImportDatabase::QQmlImportDatabase(Q
-     QString installImportsPath =  QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath);
-     addImportPath(installImportsPath);
- 
-+    // Add library paths derived from NIX_PROFILES.
-+    const QByteArrayList profiles = qgetenv("NIX_PROFILES").split(' ');
-+    const QString qmldir = QString::fromLatin1("/lib/qt5/qml");
-+    Q_FOREACH (const QByteArray &profile, profiles) {
-+        if (!profile.isEmpty()) {
-+            addImportPath(QFile::decodeName(profile) + qmldir);
-+        }
-+    }
-+
-     // env import paths
-     QByteArray envImportPath = qgetenv("QML2_IMPORT_PATH");
-     if (!envImportPath.isEmpty()) {
diff --git a/pkgs/development/libraries/qt-5/5.8/qtdeclarative/series b/pkgs/development/libraries/qt-5/5.8/qtdeclarative/series
index 7dbe197c56e0..38abb916a508 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtdeclarative/series
+++ b/pkgs/development/libraries/qt-5/5.8/qtdeclarative/series
@@ -1 +1 @@
-nix-profiles-import-paths.patch
+import-paths.patch
diff --git a/pkgs/development/libraries/qt-5/5.8/qtdoc.nix b/pkgs/development/libraries/qt-5/5.8/qtdoc.nix
index 578ea6ba0b22..7f979ee94c0f 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtdoc.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtdoc.nix
@@ -3,4 +3,5 @@
 qtSubmodule {
   name = "qtdoc";
   qtInputs = [ qtdeclarative ];
+  outputs = [ "out" ];
 }
diff --git a/pkgs/development/libraries/qt-5/5.8/qtlocation.nix b/pkgs/development/libraries/qt-5/5.8/qtlocation.nix
index 1e134057c4b4..0eabe04e478c 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtlocation.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtlocation.nix
@@ -3,4 +3,9 @@
 qtSubmodule {
   name = "qtlocation";
   qtInputs = [ qtbase qtmultimedia ];
+  outputs = [ "out" "dev" "bin" ];
+  postInstall = ''
+    moveToOutput "$qtPluginPrefix" "$bin"
+    moveToOutput "$qtQmlPrefix" "$bin"
+  '';
 }
diff --git a/pkgs/development/libraries/qt-5/5.8/qtmultimedia.nix b/pkgs/development/libraries/qt-5/5.8/qtmultimedia.nix
index 1c2dcc90d41a..e133256e9004 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtmultimedia.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtmultimedia.nix
@@ -10,6 +10,11 @@ qtSubmodule {
   qtInputs = [ qtbase qtdeclarative ];
   buildInputs = [ pkgconfig gstreamer gst-plugins-base libpulseaudio]
     ++ optional (stdenv.isLinux) alsaLib;
+  outputs = [ "out" "dev" "bin" ];
   qmakeFlags = [ "GST_VERSION=1.0" ];
   NIX_LDFLAGS = optionalString (stdenv.isDarwin) "-lobjc";
+  postInstall = ''
+    moveToOutput "$qtPluginPrefix" "$bin"
+    moveToOutput "$qtQmlPrefix" "$bin"
+  '';
 }
diff --git a/pkgs/development/libraries/qt-5/5.8/qtquickcontrols2.nix b/pkgs/development/libraries/qt-5/5.8/qtquickcontrols2.nix
index 19750f2fd99d..1a52d1802cee 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtquickcontrols2.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtquickcontrols2.nix
@@ -3,4 +3,8 @@
 qtSubmodule {
   name = "qtquickcontrols2";
   qtInputs = [ qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+  postInstall = ''
+    moveToOutput "$qtQmlPrefix" "$bin"
+  '';
 }
diff --git a/pkgs/development/libraries/qt-5/5.8/qtsensors.nix b/pkgs/development/libraries/qt-5/5.8/qtsensors.nix
index 7bb18f56fe2e..75829d3f0aaf 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtsensors.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtsensors.nix
@@ -5,4 +5,9 @@ with stdenv.lib;
 qtSubmodule {
   name = "qtsensors";
   qtInputs = [ qtbase qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+  postInstall = ''
+    moveToOutput "$qtPluginPrefix" "$bin"
+    moveToOutput "$qtQmlPrefix" "$bin"
+  '';
 }
diff --git a/pkgs/development/libraries/qt-5/5.8/qtserialport/0001-dlopen-serialport-udev.patch b/pkgs/development/libraries/qt-5/5.8/qtserialport/0001-dlopen-serialport-udev.patch
deleted file mode 100644
index 3a813dc80074..000000000000
--- a/pkgs/development/libraries/qt-5/5.8/qtserialport/0001-dlopen-serialport-udev.patch
+++ /dev/null
@@ -1,28 +0,0 @@
-From d81c2c870b9bea8fb8e6b85baefb06542f568338 Mon Sep 17 00:00:00 2001
-From: Thomas Tuegel <ttuegel@gmail.com>
-Date: Sun, 23 Aug 2015 09:16:02 -0500
-Subject: [PATCH] dlopen serialport udev
-
----
- src/serialport/qtudev_p.h | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/serialport/qtudev_p.h b/src/serialport/qtudev_p.h
-index 6f2cabd..81b9849 100644
---- a/src/serialport/qtudev_p.h
-+++ b/src/serialport/qtudev_p.h
-@@ -105,9 +105,9 @@ inline QFunctionPointer resolveSymbol(QLibrary *udevLibrary, const char *symbolN
- inline bool resolveSymbols(QLibrary *udevLibrary)
- {
-     if (!udevLibrary->isLoaded()) {
--        udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 1);
-+        udevLibrary->setFileNameAndVersion(QStringLiteral("@libudev@/lib/libudev"), 1);
-         if (!udevLibrary->load()) {
--            udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 0);
-+            udevLibrary->setFileNameAndVersion(QStringLiteral("@libudev@/lib/libudev"), 0);
-             if (!udevLibrary->load()) {
-                 qWarning("Failed to load the library: %s, supported version(s): %i and %i", qPrintable(udevLibrary->fileName()), 1, 0);
-                 return false;
--- 
-2.5.0
-
diff --git a/pkgs/development/libraries/qt-5/5.8/qtserialport/default.nix b/pkgs/development/libraries/qt-5/5.8/qtserialport/default.nix
index 1fde2c2bd18e..925e8a808f25 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtserialport/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtserialport/default.nix
@@ -1,14 +1,12 @@
-{ stdenv, qtSubmodule, qtbase, substituteAll, systemd }:
+{ stdenv, qtSubmodule, lib, copyPathsToStore, qtbase, substituteAll, systemd }:
 
-with stdenv.lib;
+let inherit (lib) getLib optional; in
 
 qtSubmodule {
   name = "qtserialport";
   qtInputs = [ qtbase ];
-  patches = optionals (stdenv.isLinux) [
-    (substituteAll {
-      src = ./0001-dlopen-serialport-udev.patch;
-      libudev = systemd.lib;
-    })
-  ];
+  patches =  copyPathsToStore (lib.readPathsFromFile ./. ./series);
+  NIX_CFLAGS_COMPILE =
+    optional stdenv.isLinux
+    ''-DNIXPKGS_LIBUDEV="${getLib systemd}/lib/libudev"'';
 }
diff --git a/pkgs/development/libraries/qt-5/5.8/qtserialport/qtserialport-dlopen-udev.patch b/pkgs/development/libraries/qt-5/5.8/qtserialport/qtserialport-dlopen-udev.patch
new file mode 100644
index 000000000000..65bb64710ebd
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.8/qtserialport/qtserialport-dlopen-udev.patch
@@ -0,0 +1,22 @@
+Index: qtserialport-opensource-src-5.8.0/src/serialport/qtudev_p.h
+===================================================================
+--- qtserialport-opensource-src-5.8.0.orig/src/serialport/qtudev_p.h
++++ qtserialport-opensource-src-5.8.0/src/serialport/qtudev_p.h
+@@ -111,9 +111,17 @@ inline QFunctionPointer resolveSymbol(QL
+ inline bool resolveSymbols(QLibrary *udevLibrary)
+ {
+     if (!udevLibrary->isLoaded()) {
++#ifdef NIXPKGS_LIBUDEV
++        udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 1);
++#else
+         udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 1);
++#endif
+         if (!udevLibrary->load()) {
++#ifdef NIXPKGS_LIBUDEV
++            udevLibrary->setFileNameAndVersion(QLatin1String(NIXPKGS_LIBUDEV), 0);
++#else
+             udevLibrary->setFileNameAndVersion(QStringLiteral("udev"), 0);
++#endif
+             if (!udevLibrary->load()) {
+                 qWarning("Failed to load the library: %s, supported version(s): %i and %i", qPrintable(udevLibrary->fileName()), 1, 0);
+                 return false;
diff --git a/pkgs/development/libraries/qt-5/5.8/qtserialport/series b/pkgs/development/libraries/qt-5/5.8/qtserialport/series
new file mode 100644
index 000000000000..83f4abf094e9
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.8/qtserialport/series
@@ -0,0 +1 @@
+qtserialport-dlopen-udev.patch
diff --git a/pkgs/development/libraries/qt-5/5.8/qtsvg.nix b/pkgs/development/libraries/qt-5/5.8/qtsvg.nix
index b9ccac7cf933..0e21cf89340a 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtsvg.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtsvg.nix
@@ -3,4 +3,8 @@
 qtSubmodule {
   name = "qtsvg";
   qtInputs = [ qtbase ];
+  outputs = [ "out" "dev" "bin" ];
+  postInstall = ''
+    moveToOutput "$qtPluginPrefix" "$bin"
+  '';
 }
diff --git a/pkgs/development/libraries/qt-5/5.8/qttools/default.nix b/pkgs/development/libraries/qt-5/5.8/qttools/default.nix
index 6b97c2d85cd2..8c231271607c 100644
--- a/pkgs/development/libraries/qt-5/5.8/qttools/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qttools/default.nix
@@ -1,28 +1,15 @@
-{ stdenv, qtSubmodule, makeQtWrapper, copyPathsToStore, qtbase }:
+{ stdenv, qtSubmodule, copyPathsToStore, qtbase }:
 
 with stdenv.lib;
 
 qtSubmodule {
   name = "qttools";
   qtInputs = [ qtbase ];
-  nativeBuildInputs = [ makeQtWrapper ];
-
+  outputs = [ "out" "dev" "bin" ];
   patches = copyPathsToStore (readPathsFromFile ./. ./series);
+  # qmake moves all binaries to $dev in preFixup
   postFixup = ''
-    moveToOutput "bin/qdbus" "$out"
-    moveToOutput "bin/qtpaths" "$out"
-  '';
-
-  postInstall =   ''
-    wrapQtProgram $out/bin/qcollectiongenerator
-    wrapQtProgram $out/bin/qhelpconverter
-    wrapQtProgram $out/bin/qhelpgenerator
-    wrapQtProgram $out/bin/qtdiag
-  '' + optionalString (stdenv.isDarwin) ''
-    wrapQtProgram $out/bin/Assistant.app/Contents/MacOS/Assistant
-    wrapQtProgram $out/bin/Designer.app/Contents/MacOS/Designer
-    wrapQtProgram $out/bin/Linguist.app/Contents/MacOS/Linguist
-    wrapQtProgram $out/bin/pixeltool.app/Contents/MacOS/pixeltool
-    wrapQtProgram $out/bin/qdbusviewer.app/Contents/MacOS/qdbusviewer
+    moveToOutput "bin/qdbus" "$bin"
+    moveToOutput "bin/qtpaths" "$bin"
   '';
 }
diff --git a/pkgs/development/libraries/qt-5/5.8/qtwayland.nix b/pkgs/development/libraries/qt-5/5.8/qtwayland.nix
index 6d887f7c650b..7b7bd2f6ebcc 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtwayland.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtwayland.nix
@@ -5,4 +5,9 @@ qtSubmodule {
   qtInputs = [ qtbase qtquickcontrols ];
   buildInputs = [ wayland ];
   nativeBuildInputs = [ pkgconfig ];
+  outputs = [ "out" "dev" "bin" ];
+  postInstall = ''
+    moveToOutput "$qtPluginPrefix" "$bin"
+    moveToOutput "$qtQmlPrefix "$bin"
+  '';
 }
diff --git a/pkgs/development/libraries/qt-5/5.8/qtwebchannel.nix b/pkgs/development/libraries/qt-5/5.8/qtwebchannel.nix
index fd7a3c52026e..50a539dbe729 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtwebchannel.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtwebchannel.nix
@@ -3,5 +3,9 @@
 qtSubmodule {
   name = "qtwebchannel";
   qtInputs = [ qtbase qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+  postInstall = ''
+    moveToOutput "$qtQmlPrefix" "$bin"
+  '';
 }
 
diff --git a/pkgs/development/libraries/qt-5/5.8/qtwebengine/default.nix b/pkgs/development/libraries/qt-5/5.8/qtwebengine/default.nix
index 37f12eed758c..871fb21c1065 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtwebengine/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtwebengine/default.nix
@@ -25,6 +25,7 @@ qtSubmodule {
   buildInputs = [ bison flex git which gperf ];
   nativeBuildInputs = [ pkgconfig python2 coreutils ];
   doCheck = true;
+  outputs = [ "out" "dev" "bin" ];
 
   enableParallelBuilding = true;
 
@@ -90,5 +91,7 @@ qtSubmodule {
     EOF
 
     paxmark m $out/libexec/QtWebEngineProcess
+
+    moveToOutput "$qtQmlPrefix" "$bin"
   '';
 }
diff --git a/pkgs/development/libraries/qt-5/5.8/qtwebkit/0001-dlopen-webkit-nsplugin.patch b/pkgs/development/libraries/qt-5/5.8/qtwebkit/0001-dlopen-webkit-nsplugin.patch
deleted file mode 100644
index 0eeacce1bc05..000000000000
--- a/pkgs/development/libraries/qt-5/5.8/qtwebkit/0001-dlopen-webkit-nsplugin.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 862ce7d357a3ec32683ac6ec7c0ebdc9346b44ba Mon Sep 17 00:00:00 2001
-From: Thomas Tuegel <ttuegel@gmail.com>
-Date: Sun, 23 Aug 2015 09:18:54 -0500
-Subject: [PATCH 1/3] dlopen webkit nsplugin
-
----
- Source/WebCore/plugins/qt/PluginPackageQt.cpp                        | 2 +-
- Source/WebCore/plugins/qt/PluginViewQt.cpp                           | 2 +-
- Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp | 2 +-
- 3 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/Source/WebCore/plugins/qt/PluginPackageQt.cpp b/Source/WebCore/plugins/qt/PluginPackageQt.cpp
-index a923d49..2731d05 100644
---- a/Source/WebCore/plugins/qt/PluginPackageQt.cpp
-+++ b/Source/WebCore/plugins/qt/PluginPackageQt.cpp
-@@ -136,7 +136,7 @@ static void initializeGtk(QLibrary* module = 0)
-         }
-     }
- 
--    QLibrary library(QLatin1String("libgtk-x11-2.0"), 0);
-+    QLibrary library(QLatin1String("@gtk@/lib/libgtk-x11-2.0"), 0);
-     if (library.load()) {
-         typedef void *(*gtk_init_check_ptr)(int*, char***);
-         gtk_init_check_ptr gtkInitCheck = (gtk_init_check_ptr)library.resolve("gtk_init_check");
-diff --git a/Source/WebCore/plugins/qt/PluginViewQt.cpp b/Source/WebCore/plugins/qt/PluginViewQt.cpp
-index de06a2f..363bde5 100644
---- a/Source/WebCore/plugins/qt/PluginViewQt.cpp
-+++ b/Source/WebCore/plugins/qt/PluginViewQt.cpp
-@@ -697,7 +697,7 @@ static Display *getPluginDisplay()
-     // support gdk based plugins (like flash) that use a different X connection.
-     // The code below has the same effect as this one:
-     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
--    QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
-+    QLibrary library(QLatin1String("@gdk_pixbuf@/lib/libgdk-x11-2.0"), 0);
-     if (!library.load())
-         return 0;
- 
-diff --git a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
-index d734ff6..62a2197 100644
---- a/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
-+++ b/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
-@@ -64,7 +64,7 @@ static Display* getPluginDisplay()
-     // The code below has the same effect as this one:
-     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
- 
--    QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
-+    QLibrary library(QLatin1String("@gdk_pixbuf@/libgdk-x11-2.0"), 0);
-     if (!library.load())
-         return 0;
- 
--- 
-2.5.0
-
diff --git a/pkgs/development/libraries/qt-5/5.8/qtwebkit/0002-dlopen-webkit-gtk.patch b/pkgs/development/libraries/qt-5/5.8/qtwebkit/0002-dlopen-webkit-gtk.patch
deleted file mode 100644
index bb5d1f74364c..000000000000
--- a/pkgs/development/libraries/qt-5/5.8/qtwebkit/0002-dlopen-webkit-gtk.patch
+++ /dev/null
@@ -1,25 +0,0 @@
-From 6a407d30357c2551abceac75c82f4a1688e47437 Mon Sep 17 00:00:00 2001
-From: Thomas Tuegel <ttuegel@gmail.com>
-Date: Sun, 23 Aug 2015 09:19:16 -0500
-Subject: [PATCH 2/3] dlopen webkit gtk
-
----
- Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp b/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
-index 8de6521..0b25748 100644
---- a/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
-+++ b/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
-@@ -53,7 +53,7 @@ static void messageHandler(QtMsgType type, const QMessageLogContext&, const QStr
- 
- static bool initializeGtk()
- {
--    QLibrary gtkLibrary(QLatin1String("libgtk-x11-2.0"), 0);
-+    QLibrary gtkLibrary(QLatin1String("@gtk@/lib/libgtk-x11-2.0"), 0);
-     if (!gtkLibrary.load())
-         return false;
-     typedef void* (*gtk_init_ptr)(void*, void*);
--- 
-2.5.0
-
diff --git a/pkgs/development/libraries/qt-5/5.8/qtwebkit/0003-dlopen-webkit-udev.patch b/pkgs/development/libraries/qt-5/5.8/qtwebkit/0003-dlopen-webkit-udev.patch
deleted file mode 100644
index 1c360cd81aa2..000000000000
--- a/pkgs/development/libraries/qt-5/5.8/qtwebkit/0003-dlopen-webkit-udev.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 864020dd47c3b6d532d9f26b82185904cf9324f2 Mon Sep 17 00:00:00 2001
-From: Thomas Tuegel <ttuegel@gmail.com>
-Date: Sun, 23 Aug 2015 09:19:29 -0500
-Subject: [PATCH 3/3] dlopen webkit udev
-
----
- Source/WebCore/platform/qt/GamepadsQt.cpp | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/Source/WebCore/platform/qt/GamepadsQt.cpp b/Source/WebCore/platform/qt/GamepadsQt.cpp
-index 60ff317..da8ac69 100644
---- a/Source/WebCore/platform/qt/GamepadsQt.cpp
-+++ b/Source/WebCore/platform/qt/GamepadsQt.cpp
-@@ -111,12 +111,12 @@ private:
-     bool load()
-     {
-         m_libUdev.setLoadHints(QLibrary::ResolveAllSymbolsHint);
--        m_libUdev.setFileNameAndVersion(QStringLiteral("udev"), 1);
-+        m_libUdev.setFileNameAndVersion(QStringLiteral("@libudev@/lib/libudev"), 1);
-         m_loaded = m_libUdev.load();
-         if (resolveMethods())
-             return true;
- 
--        m_libUdev.setFileNameAndVersion(QStringLiteral("udev"), 0);
-+        m_libUdev.setFileNameAndVersion(QStringLiteral("@libudev@/lib/libudev"), 0);
-         m_loaded = m_libUdev.load();
-         return resolveMethods();
-     }
--- 
-2.5.0
-
diff --git a/pkgs/development/libraries/qt-5/5.8/qtwebkit/default.nix b/pkgs/development/libraries/qt-5/5.8/qtwebkit/default.nix
index bee3786ef32e..664281aac311 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtwebkit/default.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtwebkit/default.nix
@@ -1,4 +1,5 @@
-{ qtSubmodule, stdenv, qtdeclarative, qtlocation, qtsensors
+{ qtSubmodule, stdenv, copyPathsToStore, lib
+, qtdeclarative, qtlocation, qtsensors
 , fontconfig, gdk_pixbuf, gtk2, libwebp, libxml2, libxslt
 , sqlite, systemd, glib, gst_all_1
 , bison2, flex, gdb, gperf, perl, pkgconfig, python2, ruby
@@ -7,7 +8,7 @@
 , flashplayerFix ? false
 }:
 
-with stdenv.lib;
+let inherit (lib) optional optionals getLib; in
 
 qtSubmodule {
   name = "qtwebkit";
@@ -22,23 +23,15 @@ qtSubmodule {
     "/usr/lib/libicucore.dylib"
   ];
 
-  patches =
-    let dlopen-webkit-nsplugin = substituteAll {
-          src = ./0001-dlopen-webkit-nsplugin.patch;
-          gtk = gtk2.out;
-          gdk_pixbuf = gdk_pixbuf.out;
-        };
-        dlopen-webkit-gtk = substituteAll {
-          src = ./0002-dlopen-webkit-gtk.patch;
-          gtk = gtk2.out;
-        };
-        dlopen-webkit-udev = substituteAll {
-          src = ./0003-dlopen-webkit-udev.patch;
-          libudev = systemd.lib;
-        };
-    in optionals flashplayerFix [ dlopen-webkit-nsplugin dlopen-webkit-gtk ]
-    ++ optionals (!stdenv.isDarwin) [ dlopen-webkit-udev ]
-    ++ optionals (stdenv.isDarwin) [ ./0004-icucore-darwin.patch ];
+  patches =  copyPathsToStore (lib.readPathsFromFile ./. ./series);
+
+  NIX_CFLAGS_COMPILE =
+    optionals flashplayerFix
+      [
+        ''-DNIXPKGS_LIBGTK2="${getLib gtk2}/lib/libgtk-x11-2.0"''
+        ''-DNIXPKGS_LIBGDK2="${getLib gdk_pixbuf}/lib/libgdk-x11-2.0"''
+      ]
+    ++ optional (!stdenv.isDarwin) ''-DNIXPKGS_LIBUDEV="${getLib systemd}/lib/libudev"'';
 
   # Hack to avoid TMPDIR in RPATHs.
   preFixup = ''rm -rf "$(pwd)" && mkdir "$(pwd)" '';
diff --git a/pkgs/development/libraries/qt-5/5.8/qtwebkit/qtwebkit-dlopen-gtk.patch b/pkgs/development/libraries/qt-5/5.8/qtwebkit/qtwebkit-dlopen-gtk.patch
new file mode 100644
index 000000000000..e34eda592af7
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.8/qtwebkit/qtwebkit-dlopen-gtk.patch
@@ -0,0 +1,64 @@
+Index: qtwebkit-opensource-src-5.8.0/Source/WebCore/plugins/qt/PluginPackageQt.cpp
+===================================================================
+--- qtwebkit-opensource-src-5.8.0.orig/Source/WebCore/plugins/qt/PluginPackageQt.cpp
++++ qtwebkit-opensource-src-5.8.0/Source/WebCore/plugins/qt/PluginPackageQt.cpp
+@@ -136,7 +136,11 @@ static void initializeGtk(QLibrary* modu
+         }
+     }
+ 
++#ifdef NIXPKGS_LIBGTK2
++    QLibrary library(QLatin1String(NIXPKGS_LIBGTK2), 0);
++#else
+     QLibrary library(QLatin1String("libgtk-x11-2.0"), 0);
++#endif
+     if (library.load()) {
+         typedef void *(*gtk_init_check_ptr)(int*, char***);
+         gtk_init_check_ptr gtkInitCheck = (gtk_init_check_ptr)library.resolve("gtk_init_check");
+Index: qtwebkit-opensource-src-5.8.0/Source/WebCore/plugins/qt/PluginViewQt.cpp
+===================================================================
+--- qtwebkit-opensource-src-5.8.0.orig/Source/WebCore/plugins/qt/PluginViewQt.cpp
++++ qtwebkit-opensource-src-5.8.0/Source/WebCore/plugins/qt/PluginViewQt.cpp
+@@ -697,7 +697,11 @@ static Display *getPluginDisplay()
+     // support gdk based plugins (like flash) that use a different X connection.
+     // The code below has the same effect as this one:
+     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
++#ifdef NIXPKGS_LIBGDK2
++    QLibrary library(QLatin1String(NIXPKGS_LIBGDK2), 0);
++#else
+     QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
++#endif
+     if (!library.load())
+         return 0;
+ 
+Index: qtwebkit-opensource-src-5.8.0/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
+===================================================================
+--- qtwebkit-opensource-src-5.8.0.orig/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
++++ qtwebkit-opensource-src-5.8.0/Source/WebKit2/WebProcess/Plugins/Netscape/x11/NetscapePluginX11.cpp
+@@ -64,7 +64,11 @@ static Display* getPluginDisplay()
+     // The code below has the same effect as this one:
+     // Display *gdkDisplay = gdk_x11_display_get_xdisplay(gdk_display_get_default());
+ 
++#ifdef NIXPKGS_LIBGDK2
++    QLibrary library(QLatin1String(NIXPKGS_LIBGDK2), 0);
++#else
+     QLibrary library(QLatin1String("libgdk-x11-2.0"), 0);
++#endif
+     if (!library.load())
+         return 0;
+ 
+Index: qtwebkit-opensource-src-5.8.0/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
+===================================================================
+--- qtwebkit-opensource-src-5.8.0.orig/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
++++ qtwebkit-opensource-src-5.8.0/Source/WebKit2/PluginProcess/qt/PluginProcessMainQt.cpp
+@@ -53,7 +53,11 @@ static void messageHandler(QtMsgType typ
+ 
+ static bool initializeGtk()
+ {
++#ifdef NIXPKGS_LIBGTK2
++    QLibrary gtkLibrary(QLatin1String(NIXPKGS_LIBGTK2), 0);
++#else
+     QLibrary gtkLibrary(QLatin1String("libgtk-x11-2.0"), 0);
++#endif
+     if (!gtkLibrary.load())
+         return false;
+     typedef void* (*gtk_init_ptr)(void*, void*);
diff --git a/pkgs/development/libraries/qt-5/5.8/qtwebkit/qtwebkit-dlopen-udev.patch b/pkgs/development/libraries/qt-5/5.8/qtwebkit/qtwebkit-dlopen-udev.patch
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.8/qtwebkit/qtwebkit-dlopen-udev.patch
diff --git a/pkgs/development/libraries/qt-5/5.8/qtwebkit/qtwebkit-icucore-darwin.patch b/pkgs/development/libraries/qt-5/5.8/qtwebkit/qtwebkit-icucore-darwin.patch
new file mode 100644
index 000000000000..63c653da94ef
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.8/qtwebkit/qtwebkit-icucore-darwin.patch
@@ -0,0 +1,13 @@
+Index: qtwebkit-opensource-src-5.8.0/Source/WTF/WTF.pri
+===================================================================
+--- qtwebkit-opensource-src-5.8.0.orig/Source/WTF/WTF.pri
++++ qtwebkit-opensource-src-5.8.0/Source/WTF/WTF.pri
+@@ -12,7 +12,7 @@ mac {
+     # Mac OS does ship libicu but not the associated header files.
+     # Therefore WebKit provides adequate header files.
+     INCLUDEPATH = $${ROOT_WEBKIT_DIR}/Source/WTF/icu $$INCLUDEPATH
+-    LIBS += -licucore
++    LIBS += /usr/lib/libicucore.dylib
+ } else:!use?(wchar_unicode): {
+     win32 {
+         CONFIG(static, static|shared) {
diff --git a/pkgs/development/libraries/qt-5/5.8/qtwebkit/series b/pkgs/development/libraries/qt-5/5.8/qtwebkit/series
new file mode 100644
index 000000000000..140e2a3dd4e2
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.8/qtwebkit/series
@@ -0,0 +1,3 @@
+qtwebkit-dlopen-gtk.patch
+qtwebkit-dlopen-udev.patch
+qtwebkit-icucore-darwin.patch
diff --git a/pkgs/development/libraries/qt-5/5.8/qtwebsockets.nix b/pkgs/development/libraries/qt-5/5.8/qtwebsockets.nix
index fbdfbbcf0dbe..925adce75a92 100644
--- a/pkgs/development/libraries/qt-5/5.8/qtwebsockets.nix
+++ b/pkgs/development/libraries/qt-5/5.8/qtwebsockets.nix
@@ -3,4 +3,8 @@
 qtSubmodule {
   name = "qtwebsockets";
   qtInputs = [ qtbase qtdeclarative ];
+  outputs = [ "out" "dev" "bin" ];
+  postInstall = ''
+    moveToOutput "$qtQmlPrefix" "$bin"
+  '';
 }
diff --git a/pkgs/development/libraries/qt-5/make-qt-wrapper-darwin.sh b/pkgs/development/libraries/qt-5/make-qt-wrapper-darwin.sh
deleted file mode 100644
index 576c03d8c760..000000000000
--- a/pkgs/development/libraries/qt-5/make-qt-wrapper-darwin.sh
+++ /dev/null
@@ -1,38 +0,0 @@
-wrapQtProgram() {
-    local prog="$1"
-    shift
-    wrapProgram "$prog" \
-        --set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \
-        --set QML_IMPORT_PATH "$QML_IMPORT_PATH" \
-        --set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
-        --set DYLD_FRAMEWORK_PATH "/System/Library/Frameworks" \
-        --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
-        --prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
-        "$@"
-}
-
-makeQtWrapper() {
-    local old="$1"
-    local new="$2"
-    shift
-    shift
-    makeWrapper "$old" "$new" \
-        --set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \
-        --set QML_IMPORT_PATH "$QML_IMPORT_PATH" \
-        --set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
-        --set DYLD_FRAMEWORK_PATH "/System/Library/Frameworks" \
-        --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
-        --prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
-        "$@"
-}
-
-_makeQtWrapperSetup() {
-    # cannot use addToSearchPath because these directories may not exist yet
-    export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/lib/qt5/plugins"
-    export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}${!outputLib}/lib/qt5/imports"
-    export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/lib/qt5/qml"
-    export RUNTIME_XDG_DATA_DIRS="$RUNTIME_XDG_DATA_DIRS${RUNTIME_XDG_DATA_DIRS:+:}${!outputBin}/share"
-    export RUNTIME_XDG_CONFIG_DIRS="$RUNTIME_XDG_CONFIG_DIRS${RUNTIME_XDG_CONFIG_DIRS:+:}${!outputBin}/etc/xdg"
-}
-
-prePhases+=(_makeQtWrapperSetup)
diff --git a/pkgs/development/libraries/qt-5/make-qt-wrapper.sh b/pkgs/development/libraries/qt-5/make-qt-wrapper.sh
deleted file mode 100644
index 4a5651f74c9b..000000000000
--- a/pkgs/development/libraries/qt-5/make-qt-wrapper.sh
+++ /dev/null
@@ -1,46 +0,0 @@
-wrapQtProgram() {
-    local prog="$1"
-    shift
-    wrapProgram "$prog" \
-        --prefix QT_PLUGIN_PATH : "$QT_PLUGIN_PATH" \
-        --prefix QML_IMPORT_PATH : "$QML_IMPORT_PATH" \
-        --prefix QML2_IMPORT_PATH : "$QML2_IMPORT_PATH" \
-        --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
-        --prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
-        --prefix GIO_EXTRA_MODULES : "$GIO_EXTRA_MODULES" \
-        "$@"
-}
-
-makeQtWrapper() {
-    local old="$1"
-    local new="$2"
-    shift
-    shift
-    makeWrapper "$old" "$new" \
-        --prefix QT_PLUGIN_PATH : "$QT_PLUGIN_PATH" \
-        --prefix QML_IMPORT_PATH : "$QML_IMPORT_PATH" \
-        --prefix QML2_IMPORT_PATH : "$QML2_IMPORT_PATH" \
-        --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
-        --prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
-        --prefix GIO_EXTRA_MODULES : "$GIO_EXTRA_MODULES" \
-        "$@"
-}
-
-_makeQtWrapperSetup() {
-    # cannot use addToSearchPath because these directories may not exist yet
-    export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/lib/qt5/plugins"
-    export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}${!outputLib}/lib/qt5/imports"
-    export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/lib/qt5/qml"
-    export RUNTIME_XDG_DATA_DIRS="$RUNTIME_XDG_DATA_DIRS${RUNTIME_XDG_DATA_DIRS:+:}${!outputBin}/share${GSETTINGS_SCHEMAS_PATH:+:$GSETTINGS_SCHEMAS_PATH}"
-    export RUNTIME_XDG_CONFIG_DIRS="$RUNTIME_XDG_CONFIG_DIRS${RUNTIME_XDG_CONFIG_DIRS:+:}${!outputBin}/etc/xdg"
-}
-
-prePhases+=(_makeQtWrapperSetup)
-
-_findGioModules() {
-    if [ -d "$1"/lib/gio/modules ] && [ -n "$(ls -A $1/lib/gio/modules)" ] ; then
-        export GIO_EXTRA_MODULES="$GIO_EXTRA_MODULES${GIO_EXTRA_MODULES:+:}$1/lib/gio/modules"
-    fi
-}
-
-envHooks+=(_findGioModules)
diff --git a/pkgs/development/libraries/qt-5/qmake-hook-darwin.sh b/pkgs/development/libraries/qt-5/qmake-hook-darwin.sh
deleted file mode 100644
index c359cb4ee6a7..000000000000
--- a/pkgs/development/libraries/qt-5/qmake-hook-darwin.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-qmakeConfigurePhase() {
-    runHook preConfigure
-
-    qmake PREFIX=$out $qmakeFlags
-
-    runHook postConfigure
-}
-
-if [ -z "$dontUseQmakeConfigure" -a -z "$configurePhase" ]; then
-    configurePhase=qmakeConfigurePhase
-fi
-
-_qtModuleMultioutDevsPre() {
-    # We cannot simply set these paths in configureFlags because libQtCore retains
-    # references to the paths it was built with.
-    moveToOutput "bin" "${!outputDev}"
-    moveToOutput "include" "${!outputDev}"
-
-    # The destination directory must exist or moveToOutput will do nothing
-    mkdir -p "${!outputDev}/share"
-    moveToOutput "share/doc" "${!outputDev}"
-}
-
-_qtModuleMultioutDevsPost() {
-    # Move libtool archives and qmake project files to $dev/lib
-    if [ "z${!outputLib}" != "z${!outputDev}" ]; then
-        pushd "${!outputLib}"
-        if [ -d "lib" ]; then
-            find lib \( -name '*.a' -o -name '*.la' \) -print0 | \
-                while read -r -d $'\0' file; do
-                    mkdir -p "${!outputDev}/$(dirname "$file")"
-                    mv "${!outputLib}/$file" "${!outputDev}/$file"
-                done
-        fi
-        popd
-    fi
-}
-
-if [ -n "$NIX_QT_SUBMODULE" ]; then
-    preFixupHooks+=(_qtModuleMultioutDevsPre)
-    postFixupHooks+=(_qtModuleMultioutDevsPost)
-fi
diff --git a/pkgs/development/libraries/qt-5/qmake-hook.sh b/pkgs/development/libraries/qt-5/qmake-hook.sh
index 696b4ea8dad3..c70410975ecd 100644
--- a/pkgs/development/libraries/qt-5/qmake-hook.sh
+++ b/pkgs/development/libraries/qt-5/qmake-hook.sh
@@ -22,11 +22,16 @@ _qtModuleMultioutDevsPre() {
 }
 
 _qtModuleMultioutDevsPost() {
+    local -a findopts=(-name '*.a' -o -name '*.la')
+    if [ -z "@isDarwin@" ]; then
+        findopts+=(-o -name '*.prl')
+    fi
+
     # Move libtool archives and qmake project files to $dev/lib
     if [ "z${!outputLib}" != "z${!outputDev}" ]; then
         pushd "${!outputLib}"
         if [ -d "lib" ]; then
-            find lib \( -name '*.a' -o -name '*.la' -o -name '*.prl' \) -print0 | \
+            find lib \( "${findopts[@]}" \) -print0 | \
                 while read -r -d $'\0' file; do
                     mkdir -p "${!outputDev}/$(dirname "$file")"
                     mv "${!outputLib}/$file" "${!outputDev}/$file"
diff --git a/pkgs/development/libraries/qt-5/qt-env.nix b/pkgs/development/libraries/qt-5/qt-env.nix
index fad68fbd7450..728761689b42 100644
--- a/pkgs/development/libraries/qt-5/qt-env.nix
+++ b/pkgs/development/libraries/qt-5/qt-env.nix
@@ -13,10 +13,9 @@ buildEnv {
     cat >"$out/bin/qt.conf" <<EOF
     [Paths]
     Prefix = $out
-    Plugins = lib/qt5/plugins
-    Imports = lib/qt5/imports
-    Qml2Imports = lib/qt5/qml
-    Documentation = share/doc/qt5
+    Plugins = $qtPluginPrefix
+    Qml2Imports = $qtQmlPrefix
+    Documentation = $qtDocPrefix
     EOF
   '';
 }
diff --git a/pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh b/pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh
index aa2d24a741ca..81fcf5fc3d3c 100644
--- a/pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh
+++ b/pkgs/development/libraries/qt-5/qtbase-setup-hook-darwin.sh
@@ -1,3 +1,7 @@
+qtPluginPrefix=@qtPluginPrefix@
+qtQmlPrefix=@qtQmlPrefix@
+qtDocPrefix=@qtDocPrefix@
+
 addToSearchPathOnceWithCustomDelimiter() {
     local delim="$1"
     local search="$2"
@@ -25,30 +29,28 @@ propagateOnce() {
 }
 
 _qtPropagate() {
-    for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
+    for dir in $qtPluginPrefix $qtQmlPrefix; do
         if [ -d "$1/$dir" ]; then
             propagateOnce propagatedBuildInputs "$1"
             break
         fi
     done
-    addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
-    addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
-    addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
+    addToSearchPathOnce QT_PLUGIN_PATH "$1/$qtPluginPrefix"
+    addToSearchPathOnce QML2_IMPORT_PATH "$1/$qtQmlPrefix"
 }
 
 crossEnvHooks+=(_qtPropagate)
 
 _qtPropagateNative() {
-    for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
+    for dir in $qtPluginPrefix $qtQmlPrefix; do
         if [ -d "$1/$dir" ]; then
             propagateOnce propagatedNativeBuildInputs "$1"
             break
         fi
     done
     if [ -z "$crossConfig" ]; then
-        addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
-        addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
-        addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
+    addToSearchPathOnce QT_PLUGIN_PATH "$1/$qtPluginPrefix"
+    addToSearchPathOnce QML2_IMPORT_PATH "$1/$qtQmlPrefix"
     fi
 }
 
@@ -112,10 +114,9 @@ if [ -z "$NIX_QT5_TMP" ]; then
     cat >"$NIX_QT5_TMP/bin/qt.conf" <<EOF
 [Paths]
 Prefix = $NIX_QT5_TMP
-Plugins = lib/qt5/plugins
-Imports = lib/qt5/imports
-Qml2Imports = lib/qt5/qml
-Documentation = share/doc/qt5
+Plugins = $qtPluginPrefix
+Qml2Imports = $qtQmlPrefix
+Documentation = $qtDocPrefix
 EOF
     echo "bin/qt.conf" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
 
diff --git a/pkgs/development/libraries/qt-5/qtbase-setup-hook.sh b/pkgs/development/libraries/qt-5/qtbase-setup-hook.sh
index 47d196cec26b..e7752af43975 100644
--- a/pkgs/development/libraries/qt-5/qtbase-setup-hook.sh
+++ b/pkgs/development/libraries/qt-5/qtbase-setup-hook.sh
@@ -1,71 +1,55 @@
-addToSearchPathOnceWithCustomDelimiter() {
-    local delim="$1"
-    local search="$2"
-    local target="$3"
-    local dirs
-    local exported
-    IFS="$delim" read -a dirs <<< "${!search}"
-    local canonical
-    if canonical=$(readlink -e "$target"); then
-        for dir in ${dirs[@]}; do
-            if [ "z$dir" == "z$canonical" ]; then exported=1; fi
-        done
-        if [ -z $exported ]; then
-            eval "export ${search}=\"${!search}${!search:+$delim}$canonical\""
-        fi
-    fi
-}
+qtPluginPrefix=@qtPluginPrefix@
+qtQmlPrefix=@qtQmlPrefix@
+qtDocPrefix=@qtDocPrefix@
 
-addToSearchPathOnce() {
-    addToSearchPathOnceWithCustomDelimiter ':' "$@"
-}
+NIX_QT5_MODULES="${NIX_QT5_MODULES}${NIX_QT5_MODULES:+:}@out@"
+NIX_QT5_MODULES_DEV="${NIX_QT5_MODULES_DEV}${NIX_QT5_MODULES_DEV:+:}@dev@"
 
-propagateOnce() {
-    addToSearchPathOnceWithCustomDelimiter ' ' "$@"
+providesQtRuntime() {
+    [ -d "$1/$qtPluginPrefix" ] || [ -d "$1/$qtQmlPrefix" ]
 }
 
-_qtPropagate() {
-    for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
-        if [ -d "$1/$dir" ]; then
-            propagateOnce propagatedBuildInputs "$1"
-            break
-        fi
-    done
-    addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
-    addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
-    addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
+# Propagate any runtime dependency of the building package.
+# Each dependency is propagated to the user environment and as a build
+# input so that it will be re-propagated to the user environment by any
+# package depending on the building package. (This is necessary in case
+# the building package does not provide runtime dependencies itself and so
+# would not be propagated to the user environment.)
+_qtCrossEnvHook() {
+    if providesQtRuntime "$1"; then
+        propagatedBuildInputs+=" $1"
+        propagatedUserEnvPkgs+=" $1"
+    fi
 }
+if [ -z "$NIX_QT5_TMP" ]; then
+    crossEnvHooks+=(_qtCrossEnvHook)
+fi
 
-crossEnvHooks+=(_qtPropagate)
-
-_qtPropagateNative() {
-    for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
-        if [ -d "$1/$dir" ]; then
-            propagateOnce propagatedNativeBuildInputs "$1"
-            break
+_qtEnvHook() {
+    if providesQtRuntime "$1"; then
+        propagatedNativeBuildInputs+=" $1"
+        if [ -z "$crossConfig" ]; then
+        propagatedUserEnvPkgs+=" $1"
         fi
-    done
-    if [ -z "$crossConfig" ]; then
-        addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
-        addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
-        addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
     fi
 }
+if [ -z "$NIX_QT5_TMP" ]; then
+    envHooks+=(_qtEnvHook)
+fi
 
-envHooks+=(_qtPropagateNative)
-
-_qtMultioutDevs() {
-    # This is necessary whether the package is a Qt module or not
+_qtPreFixupHook() {
     moveToOutput "mkspecs" "${!outputDev}"
 }
+if [ -z "$NIX_QT5_TMP" ]; then
+    preFixupHooks+=(_qtPreFixupHook)
+fi
 
-preFixupHooks+=(_qtMultioutDevs)
-
-_qtSetCMakePrefix() {
-    export CMAKE_PREFIX_PATH="$NIX_QT5_TMP${CMAKE_PREFIX_PATH:+:}${CMAKE_PREFIX_PATH}"
-}
-
-_qtRmTmp() {
+_qtPostInstallHook() {
+    # Clean up temporary installation files created by this setup hook.
+    # For building Qt modules, this is necessary to prevent including
+    # dependencies in the output. For all other packages, this is necessary
+    # to induce patchelf to remove the temporary paths from the RPATH of
+    # dynamically-linked objects.
     if [ -z "$NIX_QT_SUBMODULE" ]; then
         rm -fr "$NIX_QT5_TMP"
     else
@@ -83,11 +67,52 @@ _qtRmTmp() {
 
         rm "$NIX_QT5_TMP/nix-support/qt-inputs"
     fi
+
+    # Patch CMake modules
+    if [ -n "$NIX_QT_SUBMODULE" ]; then
+        find "${!outputLib}" -name "*.cmake" | while read file; do
+            substituteInPlace "$file" \
+                --subst-var-by NIX_OUT "${!outputLib}" \
+                --subst-var-by NIX_DEV "${!outputDev}" \
+                --subst-var-by NIX_BIN "${!outputBin}"
+        done
+    fi
+}
+if [ -z "$NIX_QT5_TMP" ]; then
+    preConfigureHooks+=(_qtPreConfigureHook)
+fi
+
+_qtLinkModuleDir() {
+    if [ -d "$1/$2" ]; then
+        @lndir@/bin/lndir -silent "$1/$2" "$NIX_QT5_TMP/$2"
+        find "$1/$2" -printf "$2/%P\n" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
+    fi
 }
 
-_qtSetQmakePath() {
+_qtPreConfigureHook() {
+    # Find the temporary qmake executable first.
+    # This must run after all the environment hooks!
     export PATH="$NIX_QT5_TMP/bin${PATH:+:}$PATH"
+
+    # Link all runtime module dependencies into the temporary directory.
+    IFS=: read -a modules <<< $NIX_QT5_MODULES
+    for module in ${modules[@]}; do
+        _qtLinkModuleDir "$module" "lib"
+    done
+
+    # Link all the build-time module dependencies into the temporary directory.
+    IFS=: read -a modules <<< $NIX_QT5_MODULES_DEV
+    for module in ${modules[@]}; do
+        _qtLinkModuleDir "$module" "bin"
+        _qtLinkModuleDir "$module" "include"
+        _qtLinkModuleDir "$module" "lib"
+        _qtLinkModuleDir "$module" "mkspecs"
+        _qtLinkModuleDir "$module" "share"
+    done
 }
+if [ -z "$NIX_QT5_TMP" ]; then
+    postInstallHooks+=(_qtPostInstallHook)
+fi
 
 if [ -z "$NIX_QT5_TMP" ]; then
     if [ -z "$NIX_QT_SUBMODULE" ]; then
@@ -95,7 +120,6 @@ if [ -z "$NIX_QT5_TMP" ]; then
     else
         NIX_QT5_TMP=$out
     fi
-    postInstallHooks+=(_qtRmTmp)
 
     mkdir -p "$NIX_QT5_TMP/nix-support"
     for subdir in bin include lib mkspecs share; do
@@ -103,64 +127,18 @@ if [ -z "$NIX_QT5_TMP" ]; then
         echo "$subdir/" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
     done
 
-    postHooks+=(_qtSetCMakePrefix)
-
     cp "@dev@/bin/qmake" "$NIX_QT5_TMP/bin"
     echo "bin/qmake" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
 
     cat >"$NIX_QT5_TMP/bin/qt.conf" <<EOF
 [Paths]
 Prefix = $NIX_QT5_TMP
-Plugins = lib/qt5/plugins
-Imports = lib/qt5/imports
-Qml2Imports = lib/qt5/qml
-Documentation = share/doc/qt5
+Plugins = $qtPluginPrefix
+Qml2Imports = $qtQmlPrefix
+Documentation = $qtDocPrefix
 EOF
     echo "bin/qt.conf" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
 
     export QMAKE="$NIX_QT5_TMP/bin/qmake"
-
-    # Set PATH to find qmake first in a preConfigure hook
-    # It must run after all the envHooks!
-    preConfigureHooks+=(_qtSetQmakePath)
 fi
 
-qt5LinkModuleDir() {
-    if [ -d "$1/$2" ]; then
-        @lndir@/bin/lndir -silent "$1/$2" "$NIX_QT5_TMP/$2"
-        find "$1/$2" -printf "$2/%P\n" >> "$NIX_QT5_TMP/nix-support/qt-inputs"
-    fi
-}
-
-NIX_QT5_MODULES="${NIX_QT5_MODULES}${NIX_QT5_MODULES:+:}@out@"
-NIX_QT5_MODULES_DEV="${NIX_QT5_MODULES_DEV}${NIX_QT5_MODULES_DEV:+:}@dev@"
-
-_qtLinkAllModules() {
-    IFS=: read -a modules <<< $NIX_QT5_MODULES
-    for module in ${modules[@]}; do
-        qt5LinkModuleDir "$module" "lib"
-    done
-
-    IFS=: read -a modules <<< $NIX_QT5_MODULES_DEV
-    for module in ${modules[@]}; do
-        qt5LinkModuleDir "$module" "bin"
-        qt5LinkModuleDir "$module" "include"
-        qt5LinkModuleDir "$module" "lib"
-        qt5LinkModuleDir "$module" "mkspecs"
-        qt5LinkModuleDir "$module" "share"
-    done
-}
-
-preConfigureHooks+=(_qtLinkAllModules)
-
-_qtFixCMakePaths() {
-    find "${!outputLib}" -name "*.cmake" | while read file; do
-        substituteInPlace "$file" \
-            --subst-var-by NIX_OUT "${!outputLib}" \
-            --subst-var-by NIX_DEV "${!outputDev}"
-    done
-}
-
-if [ -n "$NIX_QT_SUBMODULE" ]; then
-    postInstallHooks+=(_qtFixCMakePaths)
-fi
diff --git a/pkgs/development/libraries/qtinstaller/default.nix b/pkgs/development/libraries/qtinstaller/default.nix
index 3379cbc9acfe..2fc8a8940565 100644
--- a/pkgs/development/libraries/qtinstaller/default.nix
+++ b/pkgs/development/libraries/qtinstaller/default.nix
@@ -1,10 +1,10 @@
-{ stdenv, fetchurl, qtdeclarative , qttools, qtbase, qmakeHook }:
+{ stdenv, fetchurl, qtdeclarative , qttools, qtbase, qmake }:
 
 stdenv.mkDerivation rec {
   name = "qtinstaller";
 
-  propagatedBuildInputs = [qtdeclarative qttools];
-  nativeBuildInputs = [ qmakeHook ];
+  propagatedBuildInputs = [ qtdeclarative qttools ];
+  nativeBuildInputs = [ qmake ];
 
   version = "2.0.3";
   src = fetchurl {
diff --git a/pkgs/development/libraries/qtstyleplugins/default.nix b/pkgs/development/libraries/qtstyleplugins/default.nix
index dc27e2034f1c..1be83731f202 100644
--- a/pkgs/development/libraries/qtstyleplugins/default.nix
+++ b/pkgs/development/libraries/qtstyleplugins/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, qmakeHook, qtbase, pkgconfig, gtk2 }:
+{ stdenv, fetchFromGitHub, qmake, qtbase, pkgconfig, gtk2 }:
 
 stdenv.mkDerivation rec {
   name = "qtstyleplugins-2017-03-11";
@@ -10,7 +10,8 @@ stdenv.mkDerivation rec {
     sha256 = "085wyn85nrmzr8nv5zv7fi2kqf8rp1gnd30h72s30j55xvhmxvmy";
   };
 
-  buildInputs = [ qmakeHook pkgconfig gtk2 ];
+  nativeBuildInputs = [ pkgconfig qmake ];
+  buildInputs = [ gtk2 ];
 
   installPhase = ''
     make INSTALL_ROOT=$NIX_QT5_TMP install
diff --git a/pkgs/development/libraries/qtwebkit-plugins/default.nix b/pkgs/development/libraries/qtwebkit-plugins/default.nix
index 73e629451135..201eb4e7ec9b 100644
--- a/pkgs/development/libraries/qtwebkit-plugins/default.nix
+++ b/pkgs/development/libraries/qtwebkit-plugins/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, qmakeHook, qtwebkit, hunspell }:
+{ stdenv, fetchFromGitHub, qmake, qtwebkit, hunspell }:
 
 stdenv.mkDerivation {
   name = "qtwebkit-plugins-2015-05-09";
@@ -10,13 +10,13 @@ stdenv.mkDerivation {
     sha256 = "0xyq25l56jgdxgqqv0380brhw9gg0hin5hyrf1j6d3c8k1gka20m";
   };
 
-  nativeBuildInputs = [ qmakeHook ];
+  nativeBuildInputs = [ qmake ];
 
   buildInputs = [ qtwebkit hunspell ];
 
   postPatch = ''
     sed -i "s,-lhunspell,-lhunspell-1.6," src/spellcheck/spellcheck.pri
-    sed -i "s,\$\$\[QT_INSTALL_PLUGINS\],$out/lib/qt5/plugins," src/src.pro
+    sed -i "s,\$\$\[QT_INSTALL_PLUGINS\],$out/$qtPluginPrefix," src/src.pro
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/development/libraries/quazip/default.nix b/pkgs/development/libraries/quazip/default.nix
index 7fbbf27c8eba..4379f5cf667b 100644
--- a/pkgs/development/libraries/quazip/default.nix
+++ b/pkgs/development/libraries/quazip/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, zip, zlib, qtbase, qmakeHook }:
+{ fetchurl, stdenv, zip, zlib, qtbase, qmake }:
 
 stdenv.mkDerivation rec {
   name = "quazip-0.7.1";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
   preConfigure = "cd quazip";
 
   buildInputs = [ zlib qtbase ];
-  nativeBuildInputs = [ qmakeHook ];
+  nativeBuildInputs = [ qmake ];
 
   meta = {
     description = "Provides access to ZIP archives from Qt programs";
diff --git a/pkgs/development/libraries/qwt/6.nix b/pkgs/development/libraries/qwt/6.nix
index cd940b818e92..314ab0f9e611 100644
--- a/pkgs/development/libraries/qwt/6.nix
+++ b/pkgs/development/libraries/qwt/6.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, qtbase, qtsvg, qttools, qmakeHook }:
+{ stdenv, fetchurl, qtbase, qtsvg, qttools, qmake }:
 
 stdenv.mkDerivation rec {
   name = "qwt-6.1.2";
@@ -9,7 +9,7 @@ stdenv.mkDerivation rec {
   };
 
   propagatedBuildInputs = [ qtbase qtsvg qttools ];
-  nativeBuildInputs = [ qmakeHook ];
+  nativeBuildInputs = [ qmake ];
 
   postPatch = ''
     sed -e "s|QWT_INSTALL_PREFIX.*=.*|QWT_INSTALL_PREFIX = $out|g" -i qwtconfig.pri
diff --git a/pkgs/development/node-packages/node-packages-v4.nix b/pkgs/development/node-packages/node-packages-v4.nix
index bbc0f2b8ad03..c8e51f53a9ac 100644
--- a/pkgs/development/node-packages/node-packages-v4.nix
+++ b/pkgs/development/node-packages/node-packages-v4.nix
@@ -2056,13 +2056,13 @@ let
         sha1 = "27a5dea06b36b04a0a9966774b290868f0fc40fd";
       };
     };
-    "uuid-3.0.1" = {
+    "uuid-3.1.0" = {
       name = "uuid";
       packageName = "uuid";
-      version = "3.0.1";
+      version = "3.1.0";
       src = fetchurl {
-        url = "https://registry.npmjs.org/uuid/-/uuid-3.0.1.tgz";
-        sha1 = "6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1";
+        url = "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz";
+        sha1 = "3dd3d3e790abc24d7b0d3a034ffababe28ebbc04";
       };
     };
     "delayed-stream-1.0.0" = {
@@ -3874,6 +3874,15 @@ let
         sha1 = "ec0c1e53536b76647a24b77cb83966d9315123d9";
       };
     };
+    "uuid-3.0.1" = {
+      name = "uuid";
+      packageName = "uuid";
+      version = "3.0.1";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/uuid/-/uuid-3.0.1.tgz";
+        sha1 = "6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1";
+      };
+    };
     "validate-npm-package-name-3.0.0" = {
       name = "validate-npm-package-name";
       packageName = "validate-npm-package-name";
@@ -6044,7 +6053,7 @@ in
             ];
           })
           sources."tunnel-agent-0.6.0"
-          sources."uuid-3.0.1"
+          sources."uuid-3.1.0"
         ];
       })
       sources."rimraf-2.6.1"
@@ -6542,7 +6551,7 @@ in
                     ];
                   })
                   sources."tunnel-agent-0.6.0"
-                  sources."uuid-3.0.1"
+                  sources."uuid-3.1.0"
                 ];
               })
               (sources."rimraf-2.6.1" // {
@@ -6784,7 +6793,7 @@ in
                     ];
                   })
                   sources."tunnel-agent-0.6.0"
-                  sources."uuid-3.0.1"
+                  sources."uuid-3.1.0"
                 ];
               })
               (sources."rimraf-2.6.1" // {
@@ -7099,7 +7108,7 @@ in
             ];
           })
           sources."tunnel-agent-0.6.0"
-          sources."uuid-3.0.1"
+          sources."uuid-3.1.0"
         ];
       })
       (sources."rimraf-2.6.1" // {
@@ -8107,7 +8116,7 @@ in
             ];
           })
           sources."tunnel-agent-0.4.3"
-          sources."uuid-3.0.1"
+          sources."uuid-3.1.0"
         ];
       })
       sources."semver-5.3.0"
diff --git a/pkgs/development/node-packages/node-packages-v6.json b/pkgs/development/node-packages/node-packages-v6.json
index 08b3445e3d47..b362281ee213 100644
--- a/pkgs/development/node-packages/node-packages-v6.json
+++ b/pkgs/development/node-packages/node-packages-v6.json
@@ -26,6 +26,7 @@
 , "htmlhint"
 , "ios-deploy"
 , "istanbul"
+, "javascript-typescript-langserver"
 , "jayschema"
 , "jshint"
 , "json"
diff --git a/pkgs/development/node-packages/node-packages-v6.nix b/pkgs/development/node-packages/node-packages-v6.nix
index 5387a2acd058..1fca65308082 100644
--- a/pkgs/development/node-packages/node-packages-v6.nix
+++ b/pkgs/development/node-packages/node-packages-v6.nix
@@ -1489,13 +1489,13 @@ let
         sha1 = "9c70bfd8169bc1dcbf48604e0f04b8b49cde9e9f";
       };
     };
-    "uuid-3.0.1" = {
+    "uuid-3.1.0" = {
       name = "uuid";
       packageName = "uuid";
-      version = "3.0.1";
+      version = "3.1.0";
       src = fetchurl {
-        url = "https://registry.npmjs.org/uuid/-/uuid-3.0.1.tgz";
-        sha1 = "6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1";
+        url = "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz";
+        sha1 = "3dd3d3e790abc24d7b0d3a034ffababe28ebbc04";
       };
     };
     "validator-5.2.0" = {
@@ -2767,13 +2767,13 @@ let
         sha1 = "8ce447bdb5b6c577f8a63e3fa78056ec4bb4dbfb";
       };
     };
-    "promise-7.1.1" = {
+    "promise-7.3.0" = {
       name = "promise";
       packageName = "promise";
-      version = "7.1.1";
+      version = "7.3.0";
       src = fetchurl {
-        url = "https://registry.npmjs.org/promise/-/promise-7.1.1.tgz";
-        sha1 = "489654c692616b8aa55b0724fa809bb7db49c5bf";
+        url = "https://registry.npmjs.org/promise/-/promise-7.3.0.tgz";
+        sha1 = "e7feec5aa87a2cbb81acf47d9a3adbd9d4642d7b";
       };
     };
     "asap-2.0.5" = {
@@ -7528,6 +7528,15 @@ let
         sha1 = "71766db352326928cf3a807242ba762322636723";
       };
     };
+    "uuid-3.0.1" = {
+      name = "uuid";
+      packageName = "uuid";
+      version = "3.0.1";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/uuid/-/uuid-3.0.1.tgz";
+        sha1 = "6544bba2dfda8c1cf17e629a3a305e2bb1fee6c1";
+      };
+    };
     "bplist-creator-0.0.7" = {
       name = "bplist-creator";
       packageName = "bplist-creator";
@@ -9053,13 +9062,13 @@ let
         sha1 = "cac328f7bee45730d404b692203fcb590e172d5e";
       };
     };
-    "aws-sdk-2.70.0" = {
+    "aws-sdk-2.72.0" = {
       name = "aws-sdk";
       packageName = "aws-sdk";
-      version = "2.70.0";
+      version = "2.72.0";
       src = fetchurl {
-        url = "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.70.0.tgz";
-        sha1 = "4163d94ac9e6a82f6a073ab74f8ae3c28a0a7534";
+        url = "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.72.0.tgz";
+        sha1 = "59021c14e354f34a4fb4f229ac10f8e36428f4d4";
       };
     };
     "request-2.81.0" = {
@@ -12231,6 +12240,231 @@ let
         sha1 = "dab73fbcfc2ba819b4de03bd6f6eaa48164b3f9d";
       };
     };
+    "@reactivex/rxjs-5.4.1" = {
+      name = "@reactivex/rxjs";
+      packageName = "@reactivex/rxjs";
+      version = "5.4.1";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/@reactivex/rxjs/-/rxjs-5.4.1.tgz";
+        sha1 = "e472c38c84eb411690f281253d3a93a3466ad041";
+      };
+    };
+    "chai-4.0.2" = {
+      name = "chai";
+      packageName = "chai";
+      version = "4.0.2";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/chai/-/chai-4.0.2.tgz";
+        sha1 = "2f7327c4de6f385dd7787999e2ab02697a32b83b";
+      };
+    };
+    "chai-as-promised-7.0.0" = {
+      name = "chai-as-promised";
+      packageName = "chai-as-promised";
+      version = "7.0.0";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.0.0.tgz";
+        sha1 = "c87ee613eaa196766393da6fbb4052f112acf675";
+      };
+    };
+    "fast-json-patch-1.2.2" = {
+      name = "fast-json-patch";
+      packageName = "fast-json-patch";
+      version = "1.2.2";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/fast-json-patch/-/fast-json-patch-1.2.2.tgz";
+        sha1 = "d377d97c6911dbdd2a1c80bfacda048a4f83bbf9";
+      };
+    };
+    "iterare-0.0.8" = {
+      name = "iterare";
+      packageName = "iterare";
+      version = "0.0.8";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/iterare/-/iterare-0.0.8.tgz";
+        sha1 = "a969a80a1fbff6b78f28776594d7bc2bdfab6aad";
+      };
+    };
+    "mz-2.6.0" = {
+      name = "mz";
+      packageName = "mz";
+      version = "2.6.0";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/mz/-/mz-2.6.0.tgz";
+        sha1 = "c8b8521d958df0a4f2768025db69c719ee4ef1ce";
+      };
+    };
+    "object-hash-1.1.8" = {
+      name = "object-hash";
+      packageName = "object-hash";
+      version = "1.1.8";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/object-hash/-/object-hash-1.1.8.tgz";
+        sha1 = "28a659cf987d96a4dabe7860289f3b5326c4a03c";
+      };
+    };
+    "opentracing-0.14.1" = {
+      name = "opentracing";
+      packageName = "opentracing";
+      version = "0.14.1";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/opentracing/-/opentracing-0.14.1.tgz";
+        sha1 = "40d278beea417660a35dd9d3ee76511ffa911dcd";
+      };
+    };
+    "semaphore-async-await-1.5.1" = {
+      name = "semaphore-async-await";
+      packageName = "semaphore-async-await";
+      version = "1.5.1";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/semaphore-async-await/-/semaphore-async-await-1.5.1.tgz";
+        sha1 = "857bef5e3644601ca4b9570b87e9df5ca12974fa";
+      };
+    };
+    "string-similarity-1.2.0" = {
+      name = "string-similarity";
+      packageName = "string-similarity";
+      version = "1.2.0";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/string-similarity/-/string-similarity-1.2.0.tgz";
+        sha1 = "d75153cb383846318b7a39a8d9292bb4db4e9c30";
+      };
+    };
+    "typescript-2.3.4" = {
+      name = "typescript";
+      packageName = "typescript";
+      version = "2.3.4";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/typescript/-/typescript-2.3.4.tgz";
+        sha1 = "3d38321828231e434f287514959c37a82b629f42";
+      };
+    };
+    "vscode-jsonrpc-3.3.0" = {
+      name = "vscode-jsonrpc";
+      packageName = "vscode-jsonrpc";
+      version = "3.3.0";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/vscode-jsonrpc/-/vscode-jsonrpc-3.3.0.tgz";
+        sha1 = "03bdab0b10f04727ec3b8d403cd511a8a365b13d";
+      };
+    };
+    "vscode-languageserver-3.3.0" = {
+      name = "vscode-languageserver";
+      packageName = "vscode-languageserver";
+      version = "3.3.0";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/vscode-languageserver/-/vscode-languageserver-3.3.0.tgz";
+        sha1 = "f547d4f0e5702f88ff3695bae5905f9604c8cc62";
+      };
+    };
+    "vscode-languageserver-types-3.3.0" = {
+      name = "vscode-languageserver-types";
+      packageName = "vscode-languageserver-types";
+      version = "3.3.0";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/vscode-languageserver-types/-/vscode-languageserver-types-3.3.0.tgz";
+        sha1 = "8964dc7c2247536fbefd2d6836bf3febac80dd00";
+      };
+    };
+    "symbol-observable-1.0.4" = {
+      name = "symbol-observable";
+      packageName = "symbol-observable";
+      version = "1.0.4";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.4.tgz";
+        sha1 = "29bf615d4aa7121bdd898b22d4b3f9bc4e2aa03d";
+      };
+    };
+    "assertion-error-1.0.2" = {
+      name = "assertion-error";
+      packageName = "assertion-error";
+      version = "1.0.2";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz";
+        sha1 = "13ca515d86206da0bac66e834dd397d87581094c";
+      };
+    };
+    "check-error-1.0.2" = {
+      name = "check-error";
+      packageName = "check-error";
+      version = "1.0.2";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz";
+        sha1 = "574d312edd88bb5dd8912e9286dd6c0aed4aac82";
+      };
+    };
+    "deep-eql-2.0.2" = {
+      name = "deep-eql";
+      packageName = "deep-eql";
+      version = "2.0.2";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/deep-eql/-/deep-eql-2.0.2.tgz";
+        sha1 = "b1bac06e56f0a76777686d50c9feb75c2ed7679a";
+      };
+    };
+    "get-func-name-2.0.0" = {
+      name = "get-func-name";
+      packageName = "get-func-name";
+      version = "2.0.0";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz";
+        sha1 = "ead774abee72e20409433a066366023dd6887a41";
+      };
+    };
+    "pathval-1.1.0" = {
+      name = "pathval";
+      packageName = "pathval";
+      version = "1.1.0";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz";
+        sha1 = "b942e6d4bde653005ef6b71361def8727d0645e0";
+      };
+    };
+    "type-detect-4.0.3" = {
+      name = "type-detect";
+      packageName = "type-detect";
+      version = "4.0.3";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz";
+        sha1 = "0e3f2670b44099b0b46c284d136a7ef49c74c2ea";
+      };
+    };
+    "type-detect-3.0.0" = {
+      name = "type-detect";
+      packageName = "type-detect";
+      version = "3.0.0";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/type-detect/-/type-detect-3.0.0.tgz";
+        sha1 = "46d0cc8553abb7b13a352b0d6dea2fd58f2d9b55";
+      };
+    };
+    "any-promise-1.3.0" = {
+      name = "any-promise";
+      packageName = "any-promise";
+      version = "1.3.0";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz";
+        sha1 = "abc6afeedcea52e809cdc0376aed3ce39635d17f";
+      };
+    };
+    "thenify-all-1.6.0" = {
+      name = "thenify-all";
+      packageName = "thenify-all";
+      version = "1.6.0";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz";
+        sha1 = "1a1918d402d8fc3f98fbf234db0bcc8cc10e9726";
+      };
+    };
+    "thenify-3.3.0" = {
+      name = "thenify";
+      packageName = "thenify";
+      version = "3.3.0";
+      src = fetchurl {
+        url = "https://registry.npmjs.org/thenify/-/thenify-3.3.0.tgz";
+        sha1 = "e69e38a1babe969b0108207978b9f62b88604839";
+      };
+    };
     "when-3.4.6" = {
       name = "when";
       packageName = "when";
@@ -14589,13 +14823,13 @@ let
         sha1 = "52c074f42a32140132baea108d42cbcd0ef397d2";
       };
     };
-    "node-red-node-rbe-0.1.10" = {
+    "node-red-node-rbe-0.1.11" = {
       name = "node-red-node-rbe";
       packageName = "node-red-node-rbe";
-      version = "0.1.10";
+      version = "0.1.11";
       src = fetchurl {
-        url = "https://registry.npmjs.org/node-red-node-rbe/-/node-red-node-rbe-0.1.10.tgz";
-        sha1 = "f05f72ace39b1b6158a48ee19d5c6cc426719a8f";
+        url = "https://registry.npmjs.org/node-red-node-rbe/-/node-red-node-rbe-0.1.11.tgz";
+        sha1 = "a670c1542a6eaf5e06db45490c2a7edf8a9f70b6";
       };
     };
     "bcrypt-1.0.2" = {
@@ -20605,7 +20839,7 @@ in
       sources."tunnel-0.0.2"
       sources."underscore-1.4.4"
       sources."user-home-2.0.0"
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       sources."validator-5.2.0"
       (sources."winston-2.1.1" // {
         dependencies = [
@@ -20795,7 +21029,7 @@ in
       sources."then-request-2.2.0"
       sources."typedarray-0.0.6"
       sources."http-basic-2.5.1"
-      sources."promise-7.1.1"
+      sources."promise-7.3.0"
       sources."asap-2.0.5"
       sources."os-homedir-1.0.2"
       sources."mute-stream-0.0.7"
@@ -21653,7 +21887,7 @@ in
         dependencies = [
           sources."form-data-2.1.4"
           sources."qs-6.3.2"
-          sources."uuid-3.0.1"
+          sources."uuid-3.1.0"
         ];
       })
       sources."tar-2.2.1"
@@ -22480,7 +22714,7 @@ in
       sources."JSONStream-1.3.1"
       sources."async-2.4.1"
       sources."aws4-1.6.0"
-      sources."aws-sdk-2.70.0"
+      sources."aws-sdk-2.72.0"
       sources."ini-1.3.4"
       sources."optimist-0.6.1"
       sources."request-2.81.0"
@@ -23249,7 +23483,7 @@ in
       sources."stringstream-0.0.5"
       sources."tough-cookie-2.3.2"
       sources."tunnel-agent-0.6.0"
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       sources."delayed-stream-1.0.0"
       sources."asynckit-0.4.0"
       sources."ajv-4.11.8"
@@ -23927,6 +24161,201 @@ in
     };
     production = true;
   };
+  javascript-typescript-langserver = nodeEnv.buildNodePackage {
+    name = "javascript-typescript-langserver";
+    packageName = "javascript-typescript-langserver";
+    version = "2.0.0";
+    src = fetchurl {
+      url = "https://registry.npmjs.org/javascript-typescript-langserver/-/javascript-typescript-langserver-2.0.0.tgz";
+      sha1 = "aad1582560c53dc91c13be6c2abb76cebbc9c971";
+    };
+    dependencies = [
+      sources."@reactivex/rxjs-5.4.1"
+      sources."chai-4.0.2"
+      sources."chai-as-promised-7.0.0"
+      sources."chalk-1.1.3"
+      sources."commander-2.9.0"
+      sources."fast-json-patch-1.2.2"
+      sources."glob-7.1.2"
+      sources."iterare-0.0.8"
+      sources."lodash-4.17.4"
+      sources."mz-2.6.0"
+      sources."object-hash-1.1.8"
+      sources."opentracing-0.14.1"
+      sources."semaphore-async-await-1.5.1"
+      sources."string-similarity-1.2.0"
+      sources."typescript-2.3.4"
+      sources."vscode-jsonrpc-3.3.0"
+      sources."vscode-languageserver-3.3.0"
+      sources."vscode-languageserver-types-3.3.0"
+      sources."symbol-observable-1.0.4"
+      sources."assertion-error-1.0.2"
+      sources."check-error-1.0.2"
+      (sources."deep-eql-2.0.2" // {
+        dependencies = [
+          sources."type-detect-3.0.0"
+        ];
+      })
+      sources."get-func-name-2.0.0"
+      sources."pathval-1.1.0"
+      sources."type-detect-4.0.3"
+      sources."eslint-3.19.0"
+      sources."babel-code-frame-6.22.0"
+      sources."concat-stream-1.6.0"
+      sources."debug-2.6.8"
+      sources."doctrine-2.0.0"
+      sources."escope-3.6.0"
+      sources."espree-3.4.3"
+      sources."esquery-1.0.0"
+      sources."estraverse-4.2.0"
+      sources."esutils-2.0.2"
+      sources."file-entry-cache-2.0.0"
+      sources."globals-9.18.0"
+      sources."ignore-3.3.3"
+      sources."imurmurhash-0.1.4"
+      sources."inquirer-0.12.0"
+      sources."is-my-json-valid-2.16.0"
+      sources."is-resolvable-1.0.0"
+      sources."js-yaml-3.8.4"
+      sources."json-stable-stringify-1.0.1"
+      sources."levn-0.3.0"
+      sources."mkdirp-0.5.1"
+      sources."natural-compare-1.4.0"
+      sources."optionator-0.8.2"
+      sources."path-is-inside-1.0.2"
+      sources."pluralize-1.2.1"
+      sources."progress-1.1.8"
+      sources."require-uncached-1.0.3"
+      sources."shelljs-0.7.8"
+      sources."strip-bom-3.0.0"
+      sources."strip-json-comments-2.0.1"
+      (sources."table-3.8.3" // {
+        dependencies = [
+          sources."string-width-2.0.0"
+          sources."is-fullwidth-code-point-2.0.0"
+        ];
+      })
+      sources."text-table-0.2.0"
+      sources."user-home-2.0.0"
+      sources."js-tokens-3.0.1"
+      sources."inherits-2.0.3"
+      sources."typedarray-0.0.6"
+      sources."readable-stream-2.2.11"
+      sources."core-util-is-1.0.2"
+      sources."isarray-1.0.0"
+      sources."process-nextick-args-1.0.7"
+      sources."safe-buffer-5.0.1"
+      sources."string_decoder-1.0.2"
+      sources."util-deprecate-1.0.2"
+      sources."ms-2.0.0"
+      sources."es6-map-0.1.5"
+      sources."es6-weak-map-2.0.2"
+      (sources."esrecurse-4.1.0" // {
+        dependencies = [
+          sources."estraverse-4.1.1"
+        ];
+      })
+      sources."d-1.0.0"
+      sources."es5-ext-0.10.23"
+      sources."es6-iterator-2.0.1"
+      sources."es6-set-0.1.5"
+      sources."es6-symbol-3.1.1"
+      sources."event-emitter-0.3.5"
+      sources."object-assign-4.1.1"
+      sources."acorn-5.0.3"
+      (sources."acorn-jsx-3.0.1" // {
+        dependencies = [
+          sources."acorn-3.3.0"
+        ];
+      })
+      sources."flat-cache-1.2.2"
+      sources."circular-json-0.3.1"
+      sources."del-2.2.2"
+      sources."graceful-fs-4.1.11"
+      sources."write-0.2.1"
+      sources."globby-5.0.0"
+      sources."is-path-cwd-1.0.0"
+      sources."is-path-in-cwd-1.0.0"
+      sources."pify-2.3.0"
+      sources."pinkie-promise-2.0.1"
+      sources."rimraf-2.6.1"
+      sources."array-union-1.0.2"
+      sources."arrify-1.0.1"
+      sources."array-uniq-1.0.3"
+      sources."is-path-inside-1.0.0"
+      sources."pinkie-2.0.4"
+      sources."ansi-escapes-1.4.0"
+      sources."ansi-regex-2.1.1"
+      sources."cli-cursor-1.0.2"
+      sources."cli-width-2.1.0"
+      sources."figures-1.7.0"
+      sources."readline2-1.0.1"
+      sources."run-async-0.1.0"
+      sources."rx-lite-3.1.2"
+      sources."string-width-1.0.2"
+      sources."strip-ansi-3.0.1"
+      sources."through-2.3.8"
+      sources."restore-cursor-1.0.1"
+      sources."exit-hook-1.1.1"
+      sources."onetime-1.1.0"
+      sources."escape-string-regexp-1.0.5"
+      sources."code-point-at-1.1.0"
+      sources."is-fullwidth-code-point-1.0.0"
+      sources."mute-stream-0.0.5"
+      sources."number-is-nan-1.0.1"
+      sources."once-1.4.0"
+      sources."wrappy-1.0.2"
+      sources."generate-function-2.0.0"
+      sources."generate-object-property-1.2.0"
+      sources."jsonpointer-4.0.1"
+      sources."xtend-4.0.1"
+      sources."is-property-1.0.2"
+      sources."tryit-1.0.3"
+      sources."argparse-1.0.9"
+      sources."esprima-3.1.3"
+      sources."sprintf-js-1.0.3"
+      sources."jsonify-0.0.0"
+      sources."prelude-ls-1.1.2"
+      sources."type-check-0.3.2"
+      sources."minimist-0.0.8"
+      sources."deep-is-0.1.3"
+      sources."wordwrap-1.0.0"
+      sources."fast-levenshtein-2.0.6"
+      sources."caller-path-0.1.0"
+      sources."resolve-from-1.0.1"
+      sources."callsites-0.2.0"
+      sources."interpret-1.0.3"
+      sources."rechoir-0.6.2"
+      sources."resolve-1.3.3"
+      sources."path-parse-1.0.5"
+      sources."ajv-4.11.8"
+      sources."ajv-keywords-1.5.1"
+      sources."slice-ansi-0.0.4"
+      sources."co-4.6.0"
+      sources."os-homedir-1.0.2"
+      sources."ansi-styles-2.2.1"
+      sources."has-ansi-2.0.0"
+      sources."supports-color-2.0.0"
+      sources."graceful-readlink-1.0.1"
+      sources."fs.realpath-1.0.0"
+      sources."inflight-1.0.6"
+      sources."minimatch-3.0.4"
+      sources."path-is-absolute-1.0.1"
+      sources."brace-expansion-1.1.8"
+      sources."balanced-match-1.0.0"
+      sources."concat-map-0.0.1"
+      sources."any-promise-1.3.0"
+      sources."thenify-all-1.6.0"
+      sources."thenify-3.3.0"
+    ];
+    buildInputs = globalBuildInputs;
+    meta = {
+      description = "Implementation of the Language Server Protocol for JavaScript and TypeScript";
+      homepage = https://github.com/sourcegraph/javascript-typescript-langserver;
+      license = "Apache-2.0";
+    };
+    production = true;
+  };
   jayschema = nodeEnv.buildNodePackage {
     name = "jayschema";
     packageName = "jayschema";
@@ -24150,7 +24579,7 @@ in
       sources."stringstream-0.0.5"
       sources."tough-cookie-2.3.2"
       sources."tunnel-agent-0.6.0"
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       sources."delayed-stream-1.0.0"
       sources."asynckit-0.4.0"
       sources."ajv-4.11.8"
@@ -24534,7 +24963,7 @@ in
       sources."stringstream-0.0.5"
       sources."tough-cookie-2.3.2"
       sources."tunnel-agent-0.6.0"
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       sources."delayed-stream-1.0.0"
       sources."asynckit-0.4.0"
       sources."ajv-4.11.8"
@@ -25162,7 +25591,7 @@ in
       sources."stringstream-0.0.5"
       sources."tough-cookie-2.3.2"
       sources."tunnel-agent-0.6.0"
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       sources."delayed-stream-1.0.0"
       sources."asynckit-0.4.0"
       sources."ajv-4.11.8"
@@ -25339,7 +25768,7 @@ in
       sources."stringstream-0.0.5"
       sources."tough-cookie-2.3.2"
       sources."tunnel-agent-0.6.0"
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       sources."delayed-stream-1.0.0"
       sources."asynckit-0.4.0"
       sources."ajv-4.11.8"
@@ -25612,7 +26041,7 @@ in
       sources."stringstream-0.0.5"
       sources."tough-cookie-2.3.2"
       sources."tunnel-agent-0.6.0"
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       sources."delayed-stream-1.0.0"
       sources."asynckit-0.4.0"
       sources."ajv-4.11.8"
@@ -25751,7 +26180,7 @@ in
       sources."stringstream-0.0.5"
       sources."tough-cookie-2.3.2"
       sources."tunnel-agent-0.6.0"
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       sources."delayed-stream-1.0.0"
       sources."asynckit-0.4.0"
       sources."ajv-4.11.8"
@@ -25963,7 +26392,7 @@ in
       sources."stringstream-0.0.5"
       sources."tough-cookie-2.3.2"
       sources."tunnel-agent-0.6.0"
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       sources."delayed-stream-1.0.0"
       sources."asynckit-0.4.0"
       sources."ajv-4.11.8"
@@ -26162,7 +26591,7 @@ in
           sources."tunnel-agent-0.6.0"
         ];
       })
-      sources."node-red-node-rbe-0.1.10"
+      sources."node-red-node-rbe-0.1.11"
       sources."bcrypt-1.0.2"
       sources."bytes-2.4.0"
       sources."content-type-1.0.2"
@@ -26471,7 +26900,7 @@ in
       sources."twitter-ng-0.6.2"
       sources."oauth-0.9.14"
       sources."performance-now-0.2.0"
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       sources."asynckit-0.4.0"
       sources."ajv-4.11.8"
       sources."har-schema-1.0.5"
@@ -27089,7 +27518,7 @@ in
       sources."stringstream-0.0.5"
       sources."tough-cookie-2.3.2"
       sources."tunnel-agent-0.6.0"
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       sources."delayed-stream-1.0.0"
       sources."asynckit-0.4.0"
       sources."ajv-4.11.8"
@@ -27548,7 +27977,7 @@ in
           sources."punycode-1.3.2"
         ];
       })
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       sources."xdg-basedir-2.0.0"
       sources."async-1.5.2"
       sources."cli-cursor-1.0.2"
@@ -27665,7 +28094,7 @@ in
       sources."is-utf8-0.2.1"
       sources."pseudomap-1.0.2"
       sources."yallist-2.1.2"
-      sources."promise-7.1.1"
+      sources."promise-7.3.0"
       sources."string-length-1.0.1"
       sources."duplexify-3.5.0"
       sources."infinity-agent-2.0.3"
@@ -27820,7 +28249,7 @@ in
         ];
       })
       sources."object.assign-4.0.4"
-      sources."promise-7.1.1"
+      sources."promise-7.3.0"
       sources."inflight-1.0.6"
       sources."minimatch-3.0.4"
       sources."once-1.4.0"
@@ -27883,7 +28312,7 @@ in
       sources."stringstream-0.0.5"
       sources."tough-cookie-2.3.2"
       sources."tunnel-agent-0.6.0"
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       sources."delayed-stream-1.0.0"
       sources."asynckit-0.4.0"
       sources."ajv-4.11.8"
@@ -29000,7 +29429,7 @@ in
       sources."stringstream-0.0.5"
       sources."tough-cookie-2.3.2"
       sources."tunnel-agent-0.6.0"
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       sources."delayed-stream-1.0.0"
       sources."asynckit-0.4.0"
       sources."ajv-4.11.8"
@@ -29199,7 +29628,7 @@ in
       sources."stringstream-0.0.5"
       sources."tough-cookie-2.3.2"
       sources."tunnel-agent-0.6.0"
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       sources."delayed-stream-1.0.0"
       sources."asynckit-0.4.0"
       sources."ajv-4.11.8"
@@ -29637,10 +30066,10 @@ in
   uglify-js = nodeEnv.buildNodePackage {
     name = "uglify-js";
     packageName = "uglify-js";
-    version = "3.0.16";
+    version = "3.0.17";
     src = fetchurl {
-      url = "https://registry.npmjs.org/uglify-js/-/uglify-js-3.0.16.tgz";
-      sha1 = "fe394c6708a79ffbf21ca15d6591b16334501aec";
+      url = "https://registry.npmjs.org/uglify-js/-/uglify-js-3.0.17.tgz";
+      sha1 = "d228cd55c2df9b3d2f53f147568cb4cc4a72cc06";
     };
     dependencies = [
       sources."commander-2.9.0"
@@ -30761,7 +31190,7 @@ in
       sources."stringstream-0.0.5"
       sources."tough-cookie-2.3.2"
       sources."tunnel-agent-0.6.0"
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       sources."delayed-stream-1.0.0"
       sources."asynckit-0.4.0"
       sources."har-schema-1.0.5"
@@ -30911,7 +31340,7 @@ in
       sources."strip-bom-3.0.0"
       sources."tar-fs-1.15.3"
       sources."tar-stream-1.5.4"
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       sources."v8-compile-cache-1.1.0"
       sources."validate-npm-package-license-3.0.1"
       sources."core-js-2.4.1"
@@ -31263,7 +31692,7 @@ in
       sources."os-name-1.0.3"
       sources."request-2.81.0"
       sources."tough-cookie-2.3.2"
-      sources."uuid-3.0.1"
+      sources."uuid-3.1.0"
       (sources."mkdirp-0.5.1" // {
         dependencies = [
           sources."minimist-0.0.8"
diff --git a/pkgs/development/ocaml-modules/containers/default.nix b/pkgs/development/ocaml-modules/containers/default.nix
index 2e56635f3600..f44db6151751 100644
--- a/pkgs/development/ocaml-modules/containers/default.nix
+++ b/pkgs/development/ocaml-modules/containers/default.nix
@@ -6,7 +6,7 @@ let
   mkpath = p:
       "${p}/lib/ocaml/${ocaml.version}/site-lib";
 
-  version = "0.22";
+  version = "1.2";
 
 in
 
@@ -17,7 +17,7 @@ stdenv.mkDerivation {
     owner = "c-cube";
     repo = "ocaml-containers";
     rev = "${version}";
-    sha256 = "1kbf865z484z9nxskmg150xhfspikkvsxk0wbry5vvczqr63cwhq";
+    sha256 = "0k1676bn12hhayjlpy8bxfc3sgq6wd7zkh0ca700zh8jxjrshjqk";
   };
 
   buildInputs = [ ocaml findlib ocamlbuild cppo gen sequence qtest ounit ocaml_oasis qcheck ];
@@ -39,9 +39,8 @@ EOF
   configureFlags = [
     "--enable-unix"
     "--enable-thread"
-    "--enable-bigarray"
-    "--enable-advanced"
     "--enable-tests"
+    "--enable-docs"
     "--disable-bench"
   ];
 
diff --git a/pkgs/development/python-modules/keystoneauth1/default.nix b/pkgs/development/python-modules/keystoneauth1/default.nix
new file mode 100644
index 000000000000..033f08f9587c
--- /dev/null
+++ b/pkgs/development/python-modules/keystoneauth1/default.nix
@@ -0,0 +1,27 @@
+{ buildPythonPackage, isPyPy, fetchPypi, python
+, pbr, testtools, testresources, testrepository, mock
+, pep8, fixtures, mox3, requests-mock
+, iso8601, requests, six, stevedore, webob, oslo-config
+}:
+
+buildPythonPackage rec {
+  pname = "keystoneauth1";
+  version = "1.1.0";
+  name = "${pname}-${version}";
+  disabled = isPyPy; # a test fails
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "05fc6xsp5mal52ijvj84sf7mrw706ihadfdf5mnq9zxn7pfl4118";
+  };
+
+  buildInputs = [ pbr testtools testresources testrepository mock
+                  pep8 fixtures mox3 requests-mock ];
+  propagatedBuildInputs = [ iso8601 requests six stevedore
+                            webob oslo-config ];
+
+  postPatch = ''
+    sed -i 's@python@${python.interpreter}@' .testr.conf
+    substituteInPlace requirements.txt --replace "argparse"
+  '';
+}
diff --git a/pkgs/development/python-modules/oslo-config/default.nix b/pkgs/development/python-modules/oslo-config/default.nix
new file mode 100644
index 000000000000..7cdfb9061fb2
--- /dev/null
+++ b/pkgs/development/python-modules/oslo-config/default.nix
@@ -0,0 +1,22 @@
+{ buildPythonPackage, fetchPypi, pbr, six, netaddr, stevedore, mock }:
+
+buildPythonPackage rec {
+  pname = "oslo.config";
+  version = "2.5.0";
+  name = "${pname}-${version}";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "043mavrzj7vjn7kh1dddci4sf67qwqnnn6cm0k1d19alks9hismz";
+  };
+
+  propagatedBuildInputs = [ pbr six netaddr stevedore ];
+  buildInputs = [ mock ];
+
+  # TODO: circular import on oslo-i18n
+  doCheck = false;
+
+  postPatch = ''
+    substituteInPlace requirements.txt --replace "argparse"
+  '';
+}
diff --git a/pkgs/development/python-modules/pyqt/5.x.nix b/pkgs/development/python-modules/pyqt/5.x.nix
index 880edfbab079..5d98544da886 100644
--- a/pkgs/development/python-modules/pyqt/5.x.nix
+++ b/pkgs/development/python-modules/pyqt/5.x.nix
@@ -1,5 +1,5 @@
 { lib, fetchurl, pythonPackages, pkgconfig, qtbase, qtsvg, qtwebkit, qtwebengine, dbus_libs
-, lndir, makeWrapper, qmakeHook }:
+, lndir, makeWrapper, qmake }:
 
 let
   version = "5.8.1";
@@ -21,9 +21,10 @@ in buildPythonPackage {
     sha256 = "0biak7l574i2gc8lj1s45skajbxsmmx66nlvs6xaakzkc6r293qy";
   };
 
+  nativeBuildInputs = [ pkgconfig makeWrapper qmake ];
+
   buildInputs = [
-    pkgconfig makeWrapper lndir
-    qtbase qtsvg qtwebkit qtwebengine dbus_libs qmakeHook
+    lndir qtbase qtsvg qtwebkit qtwebengine dbus_libs
   ];
 
   propagatedBuildInputs = [ sip ];
diff --git a/pkgs/development/python-modules/rebulk/default.nix b/pkgs/development/python-modules/rebulk/default.nix
new file mode 100644
index 000000000000..3dec364b292d
--- /dev/null
+++ b/pkgs/development/python-modules/rebulk/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, buildPythonPackage, fetchPypi, pytest, pytestrunner, six, regex}:
+
+buildPythonPackage rec {
+  pname = "rebulk";
+  version = "0.9.0";
+  name = "${pname}-${version}";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "1sw516ihfrb7i9bfl1n3049akvb23mpsk3llh7w3xfnbvkfrpip0";
+  };
+
+  # Some kind of trickery with imports that doesn't work.
+  doCheck = false;
+  buildInputs = [ pytest pytestrunner ];
+  propagatedBuildInputs = [ six regex ];
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/Toilal/rebulk/";
+    license = licenses.mit;
+    description = "Advanced string matching from simple patterns";
+  };
+}
diff --git a/pkgs/development/qtcreator/default.nix b/pkgs/development/qtcreator/default.nix
index f66070be6944..ff4341c6783a 100644
--- a/pkgs/development/qtcreator/default.nix
+++ b/pkgs/development/qtcreator/default.nix
@@ -1,13 +1,13 @@
 { stdenv, fetchurl, makeWrapper
-, qtbase, makeQtWrapper, qtquickcontrols, qtscript, qtdeclarative, qmakeHook
+, qtbase, qtquickcontrols, qtscript, qtdeclarative, qmake
 , withDocumentation ? false
 }:
 
 with stdenv.lib;
 
 let
-  baseVersion = "4.2";
-  revision = "1";
+  baseVersion = "4.3";
+  revision = "0";
 in
 
 stdenv.mkDerivation rec {
@@ -15,13 +15,13 @@ stdenv.mkDerivation rec {
   version = "${baseVersion}.${revision}";
 
   src = fetchurl {
-    url = "http://download.qt-project.org/official_releases/qtcreator/${baseVersion}/${version}/qt-creator-opensource-src-${version}.tar.gz";
-    sha256 = "0f2slaf579q2anflf524lbhmpwrwy3hzjfxzs10n44r7s7yc4dr5";
+    url = "http://download.qt-project.org/official_releases/qtcreator/${baseVersion}/${version}/qt-creator-opensource-src-${version}.tar.xz";
+    sha256 = "1n3ihky72p6q69n6c8s5hacq8rxdqmmr6msg89w5amwd17sam7p9";
   };
 
   buildInputs = [ qtbase qtscript qtquickcontrols qtdeclarative ];
 
-  nativeBuildInputs = [ qmakeHook makeQtWrapper makeWrapper ];
+  nativeBuildInputs = [ qmake makeWrapper ];
 
   doCheck = true;
 
@@ -32,23 +32,12 @@ stdenv.mkDerivation rec {
   installFlags = [ "INSTALL_ROOT=$(out)" ] ++ optional withDocumentation "install_docs";
 
   preBuild = optional withDocumentation ''
-    ln -s ${qtbase}/share/doc $NIX_QT5_TMP/share
+    ln -s ${qtbase}/$qtDocPrefix $NIX_QT5_TMP/share
   '';
 
   postInstall = ''
-    # Install desktop file
-    mkdir -p "$out/share/applications"
-    cat > "$out/share/applications/qtcreator.desktop" << __EOF__
-    [Desktop Entry]
-    Exec=$out/bin/qtcreator
-    Name=Qt Creator
-    GenericName=Cross-platform IDE for Qt
-    Icon=QtProject-qtcreator.png
-    Terminal=false
-    Type=Application
-    Categories=Qt;Development;IDE;
-    __EOF__
-    wrapQtProgram $out/bin/qtcreator
+    substituteInPlace $out/share/applications/org.qt-project.qtcreator.desktop \
+      --replace "Exec=qtcreator" "Exec=$out/bin/qtcreator"
   '';
 
   meta = {
diff --git a/pkgs/development/tools/analysis/flow/default.nix b/pkgs/development/tools/analysis/flow/default.nix
index d356caad1f64..9987996c95de 100644
--- a/pkgs/development/tools/analysis/flow/default.nix
+++ b/pkgs/development/tools/analysis/flow/default.nix
@@ -3,14 +3,14 @@
 with lib;
 
 stdenv.mkDerivation rec {
-  version = "0.46.0";
+  version = "0.48.0";
   name = "flow-${version}";
 
   src = fetchFromGitHub {
     owner = "facebook";
     repo = "flow";
     rev = "v${version}";
-    sha256 = "05rnlckwiynkh0300f27xhrn53pf0hxlkb0iz3nlb81xmsk005a4";
+    sha256 = "13f9z4jg1v34jpaswa8kvbxkfp7flabv616vyqfvy9hafgfyisff";
   };
 
   installPhase = ''
diff --git a/pkgs/development/tools/analysis/qcachegrind/default.nix b/pkgs/development/tools/analysis/qcachegrind/default.nix
index 64bb39aaf45d..395f720906c9 100644
--- a/pkgs/development/tools/analysis/qcachegrind/default.nix
+++ b/pkgs/development/tools/analysis/qcachegrind/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, qmakeHook, makeQtWrapper, qtbase, perl, python, php }:
+{ stdenv, fetchurl, cmake, qmake, qtbase, perl, python, php }:
 
 stdenv.mkDerivation rec {
   name = "qcachegrind-${version}";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ qtbase perl python php ];
 
-  nativeBuildInputs = [ qmakeHook makeQtWrapper ];
+  nativeBuildInputs = [ qmake ];
 
   postInstall = ''
      mkdir -p $out/bin
@@ -25,10 +25,8 @@ stdenv.mkDerivation rec {
     mkdir -p $out/Applications
     cp cgview/cgview.app/Contents/MacOS/cgview $out/bin
     cp -a qcachegrind/qcachegrind.app $out/Applications
-    wrapQtProgram $out/Applications/qcachegrind.app/Contents/MacOS/qcachegrind
   '' else ''
     install qcachegrind/qcachegrind cgview/cgview -t "$out/bin"
-    wrapQtProgram "$out/bin/qcachegrind"
     install -Dm644 qcachegrind/qcachegrind.desktop -t "$out/share/applications"
     install -Dm644 kcachegrind/hi32-app-kcachegrind.png "$out/share/icons/hicolor/32x32/apps/kcachegrind.png"
     install -Dm644 kcachegrind/hi48-app-kcachegrind.png "$out/share/icons/hicolor/48x48/apps/kcachegrind.png"
diff --git a/pkgs/development/tools/build-managers/gradle/default.nix b/pkgs/development/tools/build-managers/gradle/default.nix
index 51aaf5e6a79a..460c6d44e4e3 100644
--- a/pkgs/development/tools/build-managers/gradle/default.nix
+++ b/pkgs/development/tools/build-managers/gradle/default.nix
@@ -52,6 +52,16 @@ rec {
   };
 
   gradle_latest = gradleGen rec {
+    name = "gradle-4.0";
+    nativeVersion = "0.14";
+
+    src = fetchurl {
+      url = "http://services.gradle.org/distributions/${name}-bin.zip";
+      sha256 = "1zlxnyb7iva0bb0862vbigfjrmxgbisa2zam7j896ams57g2vgan";
+    };
+  };
+
+  gradle_3_5 = gradleGen rec {
     name = "gradle-3.5";
     nativeVersion = "0.14";
 
diff --git a/pkgs/development/tools/build-managers/sbt/scala-native.nix b/pkgs/development/tools/build-managers/sbt/scala-native.nix
new file mode 100644
index 000000000000..6c8b44605a35
--- /dev/null
+++ b/pkgs/development/tools/build-managers/sbt/scala-native.nix
@@ -0,0 +1,14 @@
+{ lib, sbt, makeWrapper, boehmgc, libunwind, re2, llvmPackages, zlib }:
+
+sbt.overrideDerivation(old: {
+  nativeBuildInputs = [ makeWrapper ];
+
+  postFixup = ''
+    wrapProgram $out/bin/sbt \
+      --set CLANG_PATH      "${llvmPackages.clang}/bin/clang" \
+      --set CLANGPP_PATH    "${llvmPackages.clang}/bin/clang" \
+      --set CPATH           "${lib.makeSearchPathOutput "dev" "include" [ re2 zlib boehmgc libunwind llvmPackages.libcxxabi llvmPackages.libcxx ]}/c++/v1" \
+      --set LIBRARY_PATH    "${lib.makeLibraryPath [ re2 zlib boehmgc libunwind llvmPackages.libcxxabi llvmPackages.libcxx ]}" \
+      --set NIX_CFLAGS_LINK "-lc++abi -lc++"
+  '';
+})
diff --git a/pkgs/development/tools/database/sqlitebrowser/default.nix b/pkgs/development/tools/database/sqlitebrowser/default.nix
index 28c618c29a0e..a43d3928980e 100644
--- a/pkgs/development/tools/database/sqlitebrowser/default.nix
+++ b/pkgs/development/tools/database/sqlitebrowser/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, fetchFromGitHub, qtbase, qttools, makeQtWrapper, sqlite, cmake }:
+{ mkDerivation, lib, fetchFromGitHub, qtbase, qttools, sqlite, cmake }:
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   version = "3.9.1";
   name = "sqlitebrowser-${version}";
 
@@ -12,23 +12,17 @@ stdenv.mkDerivation rec {
   };
 
   buildInputs = [ qtbase qttools sqlite ];
-  nativeBuildInputs = [ makeQtWrapper cmake ];
-  
-  enableParallelBuilding = true;
-  
+  nativeBuildInputs = [ cmake ];
+
   cmakeFlags = [ "-DUSE_QT5=TRUE" ];
-  
+
   # A regression was introduced in CMakeLists.txt on v3.9.x
   # See https://github.com/sqlitebrowser/sqlitebrowser/issues/832 and issues/755
   postPatch = ''
     substituteInPlace CMakeLists.txt --replace 'project("DB Browser for SQLite")' 'project(sqlitebrowser)'
   '';
 
-  postInstall = ''
-    wrapQtProgram $out/bin/sqlitebrowser
-  '';
-
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "DB Browser for SQLite";
     homepage = "http://sqlitebrowser.org/";
     license = licenses.gpl3;
diff --git a/pkgs/development/tools/ocaml/camlidl/default.nix b/pkgs/development/tools/ocaml/camlidl/default.nix
index 780862b6727f..7cdf7dc93964 100644
--- a/pkgs/development/tools/ocaml/camlidl/default.nix
+++ b/pkgs/development/tools/ocaml/camlidl/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, makeWrapper, ocaml, ncurses }:
+{ stdenv, fetchurl, makeWrapper, ocaml, ncurses, writeText }:
 
 let
   pname = "camlidl";
@@ -36,6 +36,12 @@ stdenv.mkDerivation rec {
     ln -s $out/camlidl $out/bin
   '';
 
+  setupHook = writeText "setupHook.sh" ''
+    export CAML_LD_LIBRARY_PATH="''${CAML_LD_LIBRARY_PATH}''${CAML_LD_LIBRARY_PATH:+:}''$1/lib/ocaml/${ocaml.version}/site-lib/${name}/"
+    export NIX_CFLAGS_COMPILE+=" -isystem $1/lib/ocaml/${ocaml.version}/site-lib/camlidl"
+    export NIX_LDFLAGS+=" -L $1/lib/ocaml/${ocaml.version}/site-lib/camlidl"
+  '';
+
   meta = {
     description = "A stub code generator and COM binding for Objective Caml";
     homepage = "${webpage}";
diff --git a/pkgs/development/tools/ocaml/utop/default.nix b/pkgs/development/tools/ocaml/utop/default.nix
index c50e6a108bda..9e394751761a 100644
--- a/pkgs/development/tools/ocaml/utop/default.nix
+++ b/pkgs/development/tools/ocaml/utop/default.nix
@@ -61,8 +61,8 @@ stdenv.mkDerivation rec {
       --argv0 "" \
       --prefix CAML_LD_LIBRARY_PATH ":" "${get "CAML_LD_LIBRARY_PATH"}" \
       --prefix OCAMLPATH ":" "${get "OCAMLPATH"}" \
-      --prefix OCAMLPATH ":" $(unset OCAMLPATH; addOCamlPath "$out"; printf %s "$OCAMLPATH")
-
+      --prefix OCAMLPATH ":" $(unset OCAMLPATH; addOCamlPath "$out"; printf %s "$OCAMLPATH") \
+      --add-flags "-I ${findlib}/lib/ocaml/${stdenv.lib.getVersion ocaml}/site-lib"
    done
    '';
 
diff --git a/pkgs/development/tools/rust/rustfmt/default.nix b/pkgs/development/tools/rust/rustfmt/default.nix
index 3efc82a60c81..0e3802a214f1 100644
--- a/pkgs/development/tools/rust/rustfmt/default.nix
+++ b/pkgs/development/tools/rust/rustfmt/default.nix
@@ -2,16 +2,16 @@
 
 rustPlatform.buildRustPackage rec {
   name = "rustfmt-${version}";
-  version = "0.8.3";
+  version = "0.9.0";
 
   src = fetchFromGitHub {
     owner = "rust-lang-nursery";
     repo = "rustfmt";
     rev = "${version}";
-    sha256 = "1nh0h8mncz5vnn5hmw74f8nnh5cxdlrg67891l4dyq0p38vjhimz";
+    sha256 = "12l3ff0s0pzhcf5jbs8wqawjk4jghhhz8j6dq1n5201yvny12jlr";
   };
 
-  depsSha256 = "002d7y33a0bavd07wl7xrignmyaamnzfabdnr7a2x3zfizkfnblb";
+  depsSha256 = "1nnb2lpzjf6hv1a7cw3cbkc22fb54rsp6h87wzmqi4hsy1csff7a";
 
   meta = with stdenv.lib; {
     description = "A tool for formatting Rust code according to style guidelines";
diff --git a/pkgs/development/tools/tora/default.nix b/pkgs/development/tools/tora/default.nix
index 350cda4e2630..578e759548a1 100644
--- a/pkgs/development/tools/tora/default.nix
+++ b/pkgs/development/tools/tora/default.nix
@@ -1,10 +1,10 @@
-{ stdenv, lib, fetchFromGitHub, cmake, extra-cmake-modules, makeQtWrapper
+{ mkDerivation, lib, fetchFromGitHub, cmake, extra-cmake-modules, makeWrapper
 , boost, doxygen, openssl, mysql, postgresql, graphviz, loki, qscintilla, qtbase }:
 
 let
   qscintillaLib = (qscintilla.override { withQt5 = true; });
 
-in stdenv.mkDerivation rec {
+in mkDerivation rec {
   name = "tora-${version}";
   version = "3.1";
 
@@ -15,10 +15,8 @@ in stdenv.mkDerivation rec {
     sha256 = "0wninl10bcgiljf6wnhn2rv8kmzryw78x5qvbw8s2zfjlnxjsbn7";
   };
 
-  enableParallelBuilding = true;
-
+  nativeBuildInputs = [ cmake extra-cmake-modules makeWrapper ];
   buildInputs = [
-    cmake extra-cmake-modules makeQtWrapper
     boost doxygen graphviz loki mysql openssl postgresql qscintillaLib qtbase
   ];
 
@@ -54,11 +52,11 @@ in stdenv.mkDerivation rec {
   ];
 
   postFixup = ''
-    wrapQtProgram $out/bin/tora \
+    wrapProgram $out/bin/tora \
       --prefix PATH : ${lib.getBin graphviz}/bin
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Tora SQL tool";
     maintainers = with maintainers; [ peterhoeg ];
     platforms = platforms.linux;
diff --git a/pkgs/development/tools/vogl/default.nix b/pkgs/development/tools/vogl/default.nix
index 56f15d62154c..e351a75db4b2 100644
--- a/pkgs/development/tools/vogl/default.nix
+++ b/pkgs/development/tools/vogl/default.nix
@@ -1,11 +1,12 @@
-{ fetchFromGitHub, stdenv
+{ mkDerivation, lib, fetchFromGitHub
 , cmake, git, pkgconfig, wget, zip
-, makeQtWrapper, qtbase, qtx11extras
+, qtbase, qtx11extras
 , libdwarf, libjpeg_turbo, libunwind, lzma, tinyxml, libX11
 , SDL2, SDL2_gfx, SDL2_image, SDL2_ttf
 , freeglut, mesa_glu
 }:
-stdenv.mkDerivation rec {
+
+mkDerivation rec {
   name = "vogl-${version}";
   version = "2016-05-13";
 
@@ -16,9 +17,7 @@ stdenv.mkDerivation rec {
     sha256 = "17gwd73x3lnqv6ccqs48pzqwbzjhbn41c0x0l5zzirhiirb3yh0n";
   };
 
-  nativeBuildInputs = [
-    cmake makeQtWrapper pkgconfig
-  ];
+  nativeBuildInputs = [ cmake pkgconfig ];
 
   buildInputs = [
     git wget zip
@@ -28,16 +27,17 @@ stdenv.mkDerivation rec {
     freeglut mesa_glu
   ];
 
-  enableParallelBuilding = true;
-
   dontUseCmakeBuildDir = true;
   preConfigure = ''
     cmakeDir=$PWD
     mkdir -p vogl/vogl_build/release64 && cd $_
   '';
-  cmakeFlags = '' -DCMAKE_VERBOSE=On -DCMAKE_BUILD_TYPE=Release -DBUILD_X64=On'';
+  cmakeFlags = [
+    "-DCMAKE_VERBOSE=On"
+    "-DBUILD_X64=On"
+  ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "OpenGL capture / playback debugger.";
     homepage = https://github.com/ValveSoftware/vogl;
     license = licenses.mit;
diff --git a/pkgs/games/chessx/default.nix b/pkgs/games/chessx/default.nix
index f1dd86d67b92..e8daca26ef7d 100644
--- a/pkgs/games/chessx/default.nix
+++ b/pkgs/games/chessx/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, pkgconfig, zlib, qtbase, qtsvg, qttools, qtmultimedia, qmakeHook, fetchurl }:
+{ stdenv, pkgconfig, zlib, qtbase, qtsvg, qttools, qtmultimedia, qmake, fetchurl }:
 stdenv.mkDerivation rec {
   name = "chessx-${version}";
   version = "1.4.0";
@@ -7,15 +7,13 @@ stdenv.mkDerivation rec {
     sha256 = "1x10c9idj2qks8xk9dy7aw3alc5w7z1kvv6dnahs0428j0sp4a74";
   };
   buildInputs = [
-   stdenv
-   pkgconfig
    qtbase
    qtsvg
    qttools
    qtmultimedia
    zlib
-   qmakeHook
   ];
+  nativeBuildInputs = [ pkgconfig qmake ];
 
   # RCC: Error in 'resources.qrc': Cannot find file 'i18n/chessx_da.qm'
   #enableParallelBuilding = true;
diff --git a/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix b/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix
index 57610fb1c1c8..5be8c7d759e9 100644
--- a/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix
+++ b/pkgs/games/dwarf-fortress/dwarf-therapist/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, coreutils, qtbase, qtdeclarative, qmakeHook, texlive }:
+{ stdenv, fetchFromGitHub, coreutils, qtbase, qtdeclarative, qmake, texlive }:
 
 stdenv.mkDerivation rec {
   name = "dwarf-therapist-original-${version}";
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "layouts" ];
   buildInputs = [ qtbase qtdeclarative ];
-  nativeBuildInputs = [ texlive qmakeHook ];
+  nativeBuildInputs = [ texlive qmake ];
 
   enableParallelBuilding = false;
 
diff --git a/pkgs/games/ltris/default.nix b/pkgs/games/ltris/default.nix
new file mode 100644
index 000000000000..10a79a696732
--- /dev/null
+++ b/pkgs/games/ltris/default.nix
@@ -0,0 +1,22 @@
+{ stdenv, fetchurl, SDL, SDL_mixer }:
+
+stdenv.mkDerivation rec {
+  name = "ltris-${version}";
+  version = "1.0.19";
+  buildInputs = [ SDL SDL_mixer ];
+
+  src = fetchurl {
+    url = "mirror://sourceforge/lgames/${name}.tar.gz";
+    sha256 = "1895wv1fqklrj4apkz47rnkcfhfav7zjknskw6p0886j35vrwslg";
+  };
+
+  patchPhase = "patch -p0 < ${./gcc5_compliance.diff}";
+
+  meta = with stdenv.lib; {
+    description = "Tetris clone from the LGames series";
+    homepage = http://lgames.sourceforge.net/LBreakout2/;
+    license = licenses.gpl2;
+    maintainers = [ maintainers.ciil ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/games/ltris/gcc5_compliance.diff b/pkgs/games/ltris/gcc5_compliance.diff
new file mode 100644
index 000000000000..bf53fcf8467b
--- /dev/null
+++ b/pkgs/games/ltris/gcc5_compliance.diff
@@ -0,0 +1,299 @@
+Index: ChangeLog
+===================================================================
+--- ChangeLog	(revision 163)
++++ ChangeLog	(revision 164)
+@@ -1,3 +1,5 @@
++- removed all inline keywords to work with GCC 5 (2015/05/16 MS)
++
+ 1.0.19:
+ - removed link to lib math as not needed (2013/10/29 MS)
+ - reset key states when unpausing to prevent unwanted movement (2013/10/29 MS)
+Index: src/bowl.c
+===================================================================
+--- src/bowl.c	(revision 163)
++++ src/bowl.c	(revision 164)
+@@ -333,7 +333,7 @@
+ Set a tile contents and pixel contents.
+ ====================================================================
+ */
+-inline void bowl_set_tile( Bowl *bowl, int x, int y, int tile_id )
++void bowl_set_tile( Bowl *bowl, int x, int y, int tile_id )
+ {
+     int i, j = y * bowl->block_size;
+     bowl->contents[x][y] = tile_id;
+Index: src/sdl.c
+===================================================================
+--- src/sdl.c	(revision 163)
++++ src/sdl.c	(revision 164)
+@@ -244,7 +244,7 @@
+ #endif
+ 
+ /* return full path of bitmap */
+-inline void get_full_bmp_path( char *full_path, char *file_name )
++void get_full_bmp_path( char *full_path, char *file_name )
+ {
+     sprintf(full_path,  "%s/gfx/%s", SRC_DIR, file_name );
+ }
+@@ -330,7 +330,7 @@
+ /*
+     lock surface
+ */
+-inline void lock_surf(SDL_Surface *sur)
++void lock_surf(SDL_Surface *sur)
+ {
+     if (SDL_MUSTLOCK(sur))
+         SDL_LockSurface(sur);
+@@ -339,7 +339,7 @@
+ /*
+     unlock surface
+ */
+-inline void unlock_surf(SDL_Surface *sur)
++void unlock_surf(SDL_Surface *sur)
+ {
+     if (SDL_MUSTLOCK(sur))
+         SDL_UnlockSurface(sur);
+@@ -666,7 +666,7 @@
+ /*
+     lock font surface
+ */
+-inline void lock_font(Font *fnt)
++void lock_font(Font *fnt)
+ {
+     if (SDL_MUSTLOCK(fnt->pic))
+         SDL_LockSurface(fnt->pic);
+@@ -675,7 +675,7 @@
+ /*
+     unlock font surface
+ */
+-inline void unlock_font(Font *fnt)
++void unlock_font(Font *fnt)
+ {
+     if (SDL_MUSTLOCK(fnt->pic))
+         SDL_UnlockSurface(fnt->pic);
+@@ -905,7 +905,7 @@
+ /*
+     update rectangle (0,0,0,0)->fullscreen
+ */
+-inline void refresh_screen(int x, int y, int w, int h)
++void refresh_screen(int x, int y, int w, int h)
+ {
+     SDL_UpdateRect(sdl.screen, x, y, w, h);
+ }
+@@ -1055,7 +1055,7 @@
+ /*
+     lock surface
+ */
+-inline void lock_screen()
++void lock_screen()
+ {
+     if (SDL_MUSTLOCK(sdl.screen))
+         SDL_LockSurface(sdl.screen);
+@@ -1064,7 +1064,7 @@
+ /*
+     unlock surface
+ */
+-inline void unlock_screen()
++void unlock_screen()
+ {
+     if (SDL_MUSTLOCK(sdl.screen))
+         SDL_UnlockSurface(sdl.screen);
+@@ -1073,7 +1073,7 @@
+ /*
+     flip hardware screens (double buffer)
+ */
+-inline void flip_screen()
++void flip_screen()
+ {
+     SDL_Flip(sdl.screen);
+ }
+@@ -1132,7 +1132,7 @@
+ /*
+     get milliseconds since last call
+ */
+-inline int get_time()
++int get_time()
+ {
+     int ms;
+     cur_time = SDL_GetTicks();
+@@ -1148,7 +1148,7 @@
+ /*
+     reset timer
+ */
+-inline void reset_timer()
++void reset_timer()
+ {
+     last_time = SDL_GetTicks();
+ }
+Index: src/sdl.h
+===================================================================
+--- src/sdl.h	(revision 163)
++++ src/sdl.h	(revision 164)
+@@ -41,8 +41,8 @@
+ SDL_Surface* load_surf(char *fname, int f);
+ SDL_Surface* create_surf(int w, int h, int f);
+ void free_surf( SDL_Surface **surf );
+-inline void lock_surf(SDL_Surface *sur);
+-inline void unlock_surf(SDL_Surface *sur);
++void lock_surf(SDL_Surface *sur);
++void unlock_surf(SDL_Surface *sur);
+ void blit_surf(void);
+ void alpha_blit_surf(int alpha);
+ void fill_surf(int c);
+@@ -86,8 +86,8 @@
+ Font* load_fixed_font(char *fname, int off, int len, int w);
+ void free_font(Font **sfnt);
+ int  write_text(Font *sfnt, SDL_Surface *dest, int x, int y, char *str, int alpha);
+-inline void lock_font(Font *sfnt);
+-inline void unlock_font(Font *sfnt);
++void lock_font(Font *sfnt);
++void unlock_font(Font *sfnt);
+ SDL_Rect last_write_rect(Font *fnt);
+ int  text_width(Font *fnt, char *str);
+ 
+@@ -132,14 +132,14 @@
+ char** get_mode_names( int *count );
+ int  set_video_mode( Video_Mode mode );
+ void hardware_cap();
+-inline void refresh_screen( int x, int y, int w, int h );
++void refresh_screen( int x, int y, int w, int h );
+ void refresh_rects();
+ void add_refresh_rect(int x, int y, int w, int h);
+ int  wait_for_key();
+ void wait_for_click();
+-inline void lock_screen();
+-inline void unlock_screen();
+-inline void flip_screen();
++void lock_screen();
++void unlock_screen();
++void flip_screen();
+ void fade_screen( int type, int ms );
+ void take_screenshot( int i );
+ 
+@@ -148,8 +148,8 @@
+ SDL_Cursor* create_cursor( int width, int height, int hot_x, int hot_y, char *source );
+ 
+ /* timer */
+-inline int get_time();
+-inline void reset_timer();
++int get_time();
++void reset_timer();
+ 
+ #ifdef __cplusplus
+ };
+Index: src/tools.c
+===================================================================
+--- src/tools.c	(revision 163)
++++ src/tools.c	(revision 164)
+@@ -23,7 +23,7 @@
+ #include "ltris.h"
+ 
+ /* compares to strings and returns true if their first strlen(str1) chars are equal */
+-inline int strequal( char *str1, char *str2 )
++int strequal( char *str1, char *str2 )
+ {
+     if ( strlen( str1 ) != strlen( str2 ) ) return 0;
+     return ( !strncmp( str1, str2, strlen( str1 ) ) );
+@@ -30,7 +30,7 @@
+ }
+ 
+ /* set delay to ms milliseconds */
+-inline void delay_set( Delay *delay, int ms )
++void delay_set( Delay *delay, int ms )
+ {
+     delay->limit = ms;
+     delay->cur = 0;
+@@ -37,13 +37,13 @@
+ }
+ 
+ /* reset delay ( cur = 0 )*/
+-inline void delay_reset( Delay *delay )
++void delay_reset( Delay *delay )
+ {
+     delay->cur = 0;
+ }
+ 
+ /* check if times out and reset */
+-inline int delay_timed_out( Delay *delay, int ms )
++int delay_timed_out( Delay *delay, int ms )
+ {
+     delay->cur += ms;
+     if ( delay->cur >= delay->limit ) {
+@@ -56,12 +56,12 @@
+ }
+ 
+ /* set timer so that we have a time out next call of delay_timed_out() */
+-inline void delay_force_time_out( Delay *delay )
++void delay_force_time_out( Delay *delay )
+ {
+     delay->cur = delay->limit;
+ }
+ 
+-inline void goto_tile( int *x, int *y, int d )
++void goto_tile( int *x, int *y, int d )
+ {
+     /*  0 -up, clockwise, 5 - left up */
+     switch ( d ) {
+@@ -326,24 +326,24 @@
+ the target value until reached when counter_update() is called.
+ ====================================================================
+ */
+-inline void counter_set( Counter *counter, double value )
++void counter_set( Counter *counter, double value )
+ {
+     counter->value = value;
+     counter->approach = value;
+ }
+-inline void counter_add( Counter *counter, double add )
++void counter_add( Counter *counter, double add )
+ {
+     counter->value += add;
+ }
+-inline double counter_get_approach( Counter counter )
++double counter_get_approach( Counter counter )
+ {
+     return counter.approach;
+ }
+-inline double counter_get( Counter counter )
++double counter_get( Counter counter )
+ {
+     return counter.value;
+ }
+-inline void counter_update( Counter *counter, int ms )
++void counter_update( Counter *counter, int ms )
+ {
+     double change;
+     if ( counter->approach == counter->value ) return;
+Index: src/tools.h
+===================================================================
+--- src/tools.h	(revision 163)
++++ src/tools.h	(revision 164)
+@@ -33,7 +33,7 @@
+ #define VEC_DIST( vec1, vec2 ) ( sqrt( ( vec1.x - vec2.x ) * ( vec1.x - vec2.x ) + ( vec1.y - vec2.y ) * ( vec1.y - vec2.y ) ) )
+ 
+ /* compares to strings and returns true if their first strlen(str1) chars are equal */
+-inline int strequal( char *str1, char *str2 );
++int strequal( char *str1, char *str2 );
+ 
+ /* delete lines */
+ void delete_lines( char **lines, int line_number );
+@@ -45,16 +45,16 @@
+ } Delay;
+ 
+ /* set delay to ms milliseconds */
+-inline void delay_set( Delay *delay, int ms );
++void delay_set( Delay *delay, int ms );
+ 
+ /* reset delay ( cur = 0 )*/
+-inline void delay_reset( Delay *delay );
++void delay_reset( Delay *delay );
+ 
+ /* check if time's out ( add ms milliseconds )and reset */
+-inline int delay_timed_out( Delay *delay, int ms );
++int delay_timed_out( Delay *delay, int ms );
+ 
+ /* set timer so that we have a time out next call of delay_timed_out() */
+-inline void delay_force_time_out( Delay *delay );
++void delay_force_time_out( Delay *delay );
+ 
+ /* return distance betwteen to map positions */
+ int get_dist( int x1, int y1, int x2, int y2 );
diff --git a/pkgs/games/mudlet/default.nix b/pkgs/games/mudlet/default.nix
index 99c06e56043e..078075931dae 100644
--- a/pkgs/games/mudlet/default.nix
+++ b/pkgs/games/mudlet/default.nix
@@ -1,5 +1,5 @@
 { fetchurl, unzip, stdenv, makeWrapper, qtbase, yajl, libzip, hunspell
-, boost, lua5_1, luafilesystem, luazip, lrexlib, luasqlite3, qmakeHook }:
+, boost, lua5_1, luafilesystem, luazip, lrexlib, luasqlite3, qmake }:
 
 stdenv.mkDerivation rec {
   name = "mudlet-${version}";
@@ -10,9 +10,10 @@ stdenv.mkDerivation rec {
     sha256 = "08fhqd323kgz5s17ac5z9dhkjxcmwvcmvhzy0x1vw4rayhijfrd7";
   };
 
+  nativeBuildInputs = [ makeWrapper qmake ];
   buildInputs = [
-    unzip qtbase lua5_1 hunspell libzip yajl boost makeWrapper
-    luafilesystem luazip lrexlib luasqlite3 qmakeHook
+    unzip qtbase lua5_1 hunspell libzip yajl boost
+    luafilesystem luazip lrexlib luasqlite3
   ];
 
   preConfigure = "cd src";
diff --git a/pkgs/games/unnethack/default.nix b/pkgs/games/unnethack/default.nix
index ae32de2e7716..ea0186323c02 100644
--- a/pkgs/games/unnethack/default.nix
+++ b/pkgs/games/unnethack/default.nix
@@ -20,6 +20,8 @@ stdenv.mkDerivation rec {
                      "--with-gamesdir=/tmp/unnethack"
                    ];
 
+  makeFlags = [ "GAMEPERM=744" ];
+
   postInstall = ''
     cp -r /tmp/unnethack $out/share/unnethack/profile
     mv $out/bin/unnethack $out/bin/.wrapped_unnethack
diff --git a/pkgs/games/xconq/default.nix b/pkgs/games/xconq/default.nix
index e6e237529531..e8e27d7afb66 100644
--- a/pkgs/games/xconq/default.nix
+++ b/pkgs/games/xconq/default.nix
@@ -26,6 +26,8 @@ stdenv.mkDerivation rec {
     # Fix Makefiles
     find . -name 'Makefile.in' -exec sed -re 's@^        ( *)(cd|[&][&])@	\1\2@' -i '{}' ';'
     find . -name 'Makefile.in' -exec sed -e '/chown/d; /chgrp/d' -i '{}' ';'
+    # do not set sticky bit in nix store
+    find . -name 'Makefile.in' -exec sed -e 's/04755/755/g' -i '{}' ';'
     sed -e '/^			* *[$][(]tcltkdir[)]\/[*][.][*]/d' -i tcltk/Makefile.in
 
     # Fix C files
diff --git a/pkgs/games/xsokoban/default.nix b/pkgs/games/xsokoban/default.nix
index 47d05b7e3f6a..814241244e31 100644
--- a/pkgs/games/xsokoban/default.nix
+++ b/pkgs/games/xsokoban/default.nix
@@ -15,6 +15,10 @@ stdenv.mkDerivation rec {
 
   hardeningDisable = [ "format" ];
 
+  prePatch = ''
+    substituteInPlace Makefile.in --replace 4755 0755
+  '';
+
   preConfigure = ''
     sed -e 's/getline/my_getline/' -i score.c
 
@@ -22,7 +26,7 @@ stdenv.mkDerivation rec {
     cat >>config.h <<EOF
     #define HERE "@nixos-packaged"
     #define WWW 0
-    #define OWNER "'$(whoami)'"
+    #define OWNER "$(whoami)"
     #define ROOTDIR "$out/lib/xsokoban"
     #define ANYLEVEL 1
     #define SCOREFILE ".xsokoban-score"
diff --git a/pkgs/misc/vim-plugins/default.nix b/pkgs/misc/vim-plugins/default.nix
index 87d57e441824..c871e422638b 100644
--- a/pkgs/misc/vim-plugins/default.nix
+++ b/pkgs/misc/vim-plugins/default.nix
@@ -5,7 +5,7 @@
 , python3, boost, icu
 , ycmd
 , pythonPackages, python3Packages
-, Cocoa ? null
+, Cocoa ? null, git
 }:
 
 let
@@ -1775,11 +1775,10 @@ rec {
       sha256 = "15wil973sqfgvix9li15qk49kv9l3rn8zqis2cl71k6xh1xvd9ff";
     };
     dependencies = [];
-    buildInputs = [ perl ruby ];
+    buildInputs = [ perl ruby git ];
     buildPhase = ''
       pushd ruby/command-t
-      ruby extconf.rb
-      make
+      gem build ./command-t.gemspec
       popd
     '';
   };
diff --git a/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/command-t b/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/command-t
index a29c602b5d7e..57aa35999dc7 100644
--- a/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/command-t
+++ b/pkgs/misc/vim-plugins/vim2nix/additional-nix-code/command-t
@@ -1,7 +1,6 @@
     buildInputs = [ perl ruby ];
     buildPhase = ''
       pushd ruby/command-t
-      ruby extconf.rb
-      make
+      gem build command-t.gemspec
       popd
     '';
diff --git a/pkgs/os-specific/linux/kernel/linux-4.11.nix b/pkgs/os-specific/linux/kernel/linux-4.11.nix
index d6d183198040..92525b115eec 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.11.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.11.nix
@@ -1,12 +1,12 @@
 { stdenv, fetchurl, perl, buildLinux, ... } @ args:
 
 import ./generic.nix (args // rec {
-  version = "4.11.5";
+  version = "4.11.6";
   extraMeta.branch = "4.11";
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "0k3dy4izi56nfkp2r0cps817zfnc14czghr9l5z5k8j8x5blqipp";
+    sha256 = "0ccna0hrqcza3jz83gaxlcg5vijl83w5w3g87v93a5x06ky9nlr5";
   };
 
   kernelPatches = args.kernelPatches;
diff --git a/pkgs/os-specific/linux/kernel/linux-4.4.nix b/pkgs/os-specific/linux/kernel/linux-4.4.nix
index 51cd396ac60c..5328bb9a0432 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.4.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.4.nix
@@ -1,12 +1,12 @@
 { stdenv, fetchurl, perl, buildLinux, ... } @ args:
 
 import ./generic.nix (args // rec {
-  version = "4.4.72";
+  version = "4.4.73";
   extraMeta.branch = "4.4";
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "1s7d6mw4vjsjwdyxbj0p04yq1nsxs3b0b7bi04ilcn2zhldv8cs1";
+    sha256 = "1dj4gpv01si4wiihm8wijkhx0l6ashvydniqrbpq78sby6sn5180";
   };
 
   kernelPatches = args.kernelPatches;
diff --git a/pkgs/os-specific/linux/kernel/linux-4.9.nix b/pkgs/os-specific/linux/kernel/linux-4.9.nix
index ae1a4e4b120b..521f53e309ba 100644
--- a/pkgs/os-specific/linux/kernel/linux-4.9.nix
+++ b/pkgs/os-specific/linux/kernel/linux-4.9.nix
@@ -1,12 +1,12 @@
 { stdenv, fetchurl, perl, buildLinux, ... } @ args:
 
 import ./generic.nix (args // rec {
-  version = "4.9.32";
+  version = "4.9.33";
   extraMeta.branch = "4.9";
 
   src = fetchurl {
     url = "mirror://kernel/linux/kernel/v4.x/linux-${version}.tar.xz";
-    sha256 = "0r87c65gf9j6shavsr0zviibpbvngccppw5k3wfmmxfjpdsnayf3";
+    sha256 = "0d2cai3bq1bkmisbsl6l27di765xmzn3lscwray30ldbssijpjpm";
   };
 
   kernelPatches = args.kernelPatches;
diff --git a/pkgs/os-specific/linux/ply/default.nix b/pkgs/os-specific/linux/ply/default.nix
new file mode 100644
index 000000000000..a9c84516ef84
--- /dev/null
+++ b/pkgs/os-specific/linux/ply/default.nix
@@ -0,0 +1,33 @@
+{ stdenv, kernel, fetchFromGitHub, autoreconfHook, yacc, flex, bison, p7zip }:
+
+assert kernel != null -> stdenv.lib.versionAtLeast kernel.version "4.0";
+
+let
+  version = "1.0.beta1-9e810b1";
+in stdenv.mkDerivation {
+  name = "ply-${version}";
+  nativeBuildInputs = [ autoreconfHook flex yacc p7zip ];
+
+  src = fetchFromGitHub {
+    owner = "iovisor";
+    repo = "ply";
+    rev = "9e810b157ba079c32c430a7d4c6034826982056e";
+    sha256 = "15cp6iczawaqlhsa0af6i37zn5iq53kh6ya8s2hzd018yd7mhg50";
+  };
+
+  preAutoreconf = ''
+    # ply wants to install header fails to its build directory
+    # use 7z to handle multiple archive formats transparently
+    7z x ${kernel.src} -so | 7z x -aoa -si -ttar
+
+    configureFlagsArray+=(--with-kerneldir=$(echo $(pwd)/linux-*))
+    ./autogen.sh --prefix=$out
+  '';
+
+  meta = with stdenv.lib; {
+    description = "dynamic Tracing in Linux";
+    homepage = https://wkz.github.io/ply/;
+    license = [ licenses.gpl2 ];
+    maintainers = with maintainers; [ mic92 mbbx6spp ];
+  };
+}
diff --git a/pkgs/os-specific/linux/rewritefs/default.nix b/pkgs/os-specific/linux/rewritefs/default.nix
index 362f3edbc92a..8ec46d64600a 100644
--- a/pkgs/os-specific/linux/rewritefs/default.nix
+++ b/pkgs/os-specific/linux/rewritefs/default.nix
@@ -13,6 +13,11 @@ stdenv.mkDerivation rec {
  
   buildInputs = [ pkgconfig fuse pcre ];
 
+  prePatch = ''
+    # do not set sticky bit in nix store
+    substituteInPlace Makefile --replace 6755 0755
+  '';
+
   preConfigure = "substituteInPlace Makefile --replace /usr/local $out";
 
   meta = with stdenv.lib; {
diff --git a/pkgs/os-specific/linux/spl/default.nix b/pkgs/os-specific/linux/spl/default.nix
index a67c94268440..26cc8ea7c711 100644
--- a/pkgs/os-specific/linux/spl/default.nix
+++ b/pkgs/os-specific/linux/spl/default.nix
@@ -62,8 +62,8 @@ in
   assert buildKernel -> kernel != null;
   {
     splStable = common {
-      version = "0.6.5.9";
-      sha256 = "15qpx2nhprmk14jgb7yqp9dvfb6i3hhhspi77kvian171b0a6112";
+      version = "0.6.5.10";
+      sha256 = "1zdxggpdz9j0lpcqfnkvf4iym7mp2k246sg1s4frqaw1pwwcw9vi";
     };
     splUnstable = common {
       version = "0.7.0-rc4";
diff --git a/pkgs/os-specific/linux/v4l-utils/default.nix b/pkgs/os-specific/linux/v4l-utils/default.nix
index c0e065b3b555..622bf4fbd5cc 100644
--- a/pkgs/os-specific/linux/v4l-utils/default.nix
+++ b/pkgs/os-specific/linux/v4l-utils/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, pkgconfig, perl, makeQtWrapper
+{ stdenv, lib, fetchurl, pkgconfig, perl
 , libjpeg, udev
 , withUtils ? true
 , withGUI ? true, alsaLib, libX11, qtbase, mesa_glu
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     ln -s "$dev/include/libv4l1-videodev.h" "$dev/include/videodev.h"
   '';
 
-  nativeBuildInputs = [ pkgconfig perl ] ++ lib.optional (withUtils && withGUI) makeQtWrapper;
+  nativeBuildInputs = [ pkgconfig perl ];
 
   buildInputs = [ udev ] ++ lib.optionals (withUtils && withGUI) [ alsaLib libX11 qtbase mesa_glu ];
 
@@ -41,10 +41,6 @@ stdenv.mkDerivation rec {
     patchShebangs .
   '';
 
-  postInstall = lib.optionalString (withUtils && withGUI) ''
-    wrapQtProgram $out/bin/qv4l2
-  '';
-
   meta = with stdenv.lib; {
     description = "V4L utils and libv4l, provide common image formats regardless of the v4l device";
     homepage = http://linuxtv.org/projects.php;
diff --git a/pkgs/os-specific/linux/wpa_supplicant/gui.nix b/pkgs/os-specific/linux/wpa_supplicant/gui.nix
index d2bd6ff739fd..06a38b291661 100644
--- a/pkgs/os-specific/linux/wpa_supplicant/gui.nix
+++ b/pkgs/os-specific/linux/wpa_supplicant/gui.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, qtbase, qmakeHook, inkscape, imagemagick, wpa_supplicant }:
+{ stdenv, fetchurl, qtbase, qmake, inkscape, imagemagick, wpa_supplicant }:
 
 stdenv.mkDerivation {
   name = "wpa_gui-${wpa_supplicant.version}";
@@ -6,7 +6,7 @@ stdenv.mkDerivation {
   inherit (wpa_supplicant) src;
 
   buildInputs = [ qtbase ];
-  nativeBuildInputs = [ qmakeHook inkscape imagemagick ];
+  nativeBuildInputs = [ qmake inkscape imagemagick ];
 
   prePatch = ''
     cd wpa_supplicant/wpa_gui-qt4
diff --git a/pkgs/os-specific/linux/zfs/default.nix b/pkgs/os-specific/linux/zfs/default.nix
index b03da8869f74..8a6d727a6964 100644
--- a/pkgs/os-specific/linux/zfs/default.nix
+++ b/pkgs/os-specific/linux/zfs/default.nix
@@ -123,12 +123,12 @@ in
     # to be adapted
     zfsStable = common {
       # comment/uncomment if breaking kernel versions are known
-      incompatibleKernelVersion = "4.11";
+      incompatibleKernelVersion = "4.12";
 
-      version = "0.6.5.9";
+      version = "0.6.5.10";
 
       # this package should point to the latest release.
-      sha256 = "1m8q39j13k46fn0pw3adq87c20rpkg28llxgv2a90994p4127xh0";
+      sha256 = "04gn5fj22z17zq2nazxwl3j9dr33l79clha6ipxvdz241bhjqrk3";
       extraPatches = [
         (fetchpatch {
           url = "https://github.com/Mic92/zfs/compare/zfs-0.6.5.8...nixos-zfs-0.6.5.8.patch";
diff --git a/pkgs/servers/atlassian/confluence.nix b/pkgs/servers/atlassian/confluence.nix
index aafb30441d74..20b7250d75df 100644
--- a/pkgs/servers/atlassian/confluence.nix
+++ b/pkgs/servers/atlassian/confluence.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "atlassian-confluence-${version}";
-  version = "6.1.1";
+  version = "6.2.2";
 
   src = fetchurl {
     url = "https://www.atlassian.com/software/confluence/downloads/binary/${name}.tar.gz";
-    sha256 = "0klb8hxsmgcwjcp20xa7823jm040q7wdqicc6g7s27gjzvbqj800";
+    sha256 = "1fpn799382m8x7b0s3w4mxzlhy1s62ya287i622gbadqscprhagg";
   };
 
   phases = [ "unpackPhase" "buildPhase" "installPhase" ];
diff --git a/pkgs/servers/atlassian/crowd.nix b/pkgs/servers/atlassian/crowd.nix
index d80691231c5e..0d78f361525b 100644
--- a/pkgs/servers/atlassian/crowd.nix
+++ b/pkgs/servers/atlassian/crowd.nix
@@ -3,11 +3,11 @@
 
 stdenv.mkDerivation rec {
   name = "atlassian-crowd-${version}";
-  version = "2.11.1";
+  version = "2.12.0";
 
   src = fetchurl {
     url = "https://www.atlassian.com/software/crowd/downloads/binary/${name}.tar.gz";
-    sha256 = "12gb9p5npcdr7mxyyir3xgjkc6n05zfi4i5dqkg8f7jrhi49nas7";
+    sha256 = "1kfnsa25axlyhnapfza381p94pyfixh7j999qhpg3ii821n9sggm";
   };
 
   phases = [ "unpackPhase" "buildPhase" "installPhase" "fixupPhase" ];
diff --git a/pkgs/servers/atlassian/jira.nix b/pkgs/servers/atlassian/jira.nix
index 1f2601ab0d5e..48678804c566 100644
--- a/pkgs/servers/atlassian/jira.nix
+++ b/pkgs/servers/atlassian/jira.nix
@@ -2,11 +2,11 @@
 
 stdenv.mkDerivation rec {
   name = "atlassian-jira-${version}";
-  version = "7.3.4";
+  version = "7.3.7";
 
   src = fetchurl {
     url = "https://downloads.atlassian.com/software/jira/downloads/atlassian-jira-software-${version}.tar.gz";
-    sha256 = "0xkwf8n37hwv52rl3dbqkacr1fyxz4bd7gkcmpg0wshnxmyq4vg7";
+    sha256 = "1ixnnw3yj2ip9ndr9pwxcmdy8gaixkmp517ahg3w8xzymr8wh2qp";
   };
 
   phases = [ "unpackPhase" "buildPhase" "installPhase" "fixupPhase" ];
diff --git a/pkgs/servers/computing/torque/default.nix b/pkgs/servers/computing/torque/default.nix
index 6d0037f74bdb..d0b8567c7483 100644
--- a/pkgs/servers/computing/torque/default.nix
+++ b/pkgs/servers/computing/torque/default.nix
@@ -29,8 +29,9 @@ stdenv.mkDerivation rec {
 
    for f in $(find ./ -name Makefile.in); do
      echo patching $f...
-     sed -i $f -e '/PBS_MKDIRS/d'
+     sed -i $f -e '/PBS_MKDIRS/d' -e '/chmod u+s/d'
    done
+
   '';
 
   postInstall = ''
diff --git a/pkgs/servers/http/hiawatha/default.nix b/pkgs/servers/http/hiawatha/default.nix
index 26566b2281cc..c5dd9f7a577d 100644
--- a/pkgs/servers/http/hiawatha/default.nix
+++ b/pkgs/servers/http/hiawatha/default.nix
@@ -21,6 +21,10 @@ stdenv.mkDerivation rec {
 
   buildInputs =  [ cmake libxslt zlib libxml2 ] ++ stdenv.lib.optional enableSSL openssl ;
 
+  prePatch = ''
+    substituteInPlace CMakeLists.txt --replace SETUID ""
+  '';
+
   cmakeFlags = [
     ( if enableSSL then "-DENABLE_TLS=on" else "-DENABLE_TLS=off" )
     ( if enableMonitor then "-DENABLE_MONITOR=on" else "-DENABLE_MONITOR=off" )
diff --git a/pkgs/servers/sql/cockroachdb/default.nix b/pkgs/servers/sql/cockroachdb/default.nix
index 0a5e0d170403..01f92dfa2b99 100644
--- a/pkgs/servers/sql/cockroachdb/default.nix
+++ b/pkgs/servers/sql/cockroachdb/default.nix
@@ -1,27 +1,36 @@
-{ stdenv, buildGoPackage, fetchFromGitHub, gcc }:
+{ stdenv, buildGoPackage, fetchurl, cmake, xz, which }:
 
 buildGoPackage rec {
   name = "cockroach-${version}";
-  version = "beta-20160915";
+  version = "v1.0.2";
 
   goPackagePath = "github.com/cockroachdb/cockroach";
-  subPackages = [ "." ];
 
-  src = fetchFromGitHub {
-    owner = "cockroachdb";
-    repo = "cockroach";
-    rev = version;
-    sha256 = "11camp588vsccxlc138l7x4qws2fj5wpx1177irzayqdng8dilx3";
+  src = fetchurl {
+    url = "https://binaries.cockroachdb.com/cockroach-${version}.src.tgz";
+    sha256 = "0xq5lg9a2lxn89lilq3zzcd4kph0a5sga3b5bb9xv6af87igy6zp";
   };
 
-  buildFlagsArray = ''
-    -ldflags=
-      -X github.com/cockroachdb/cockroach/build.tag=${version}
-  '';
+  buildInputs = [ cmake xz which ];
 
-  buildInputs = [ gcc ];
+  buildPhase =
+    ''
+      cd $NIX_BUILD_TOP/go/src/${goPackagePath}
+      patchShebangs ./
+      make buildoss
+      cd src/${goPackagePath}
+      for asset in man autocomplete; do
+        ./cockroach gen $asset
+      done
+    '';
 
-  goDeps = ./deps.nix;
+  installPhase =
+    ''
+      mkdir -p $bin/{bin,share,etc/bash_completion.d}
+      mv cockroach $bin/bin
+      mv man $bin/share
+      mv cockroach.bash $bin/etc/bash_completion.d
+    '';
 
   meta = with stdenv.lib; {
     homepage = https://www.cockroachlabs.com;
diff --git a/pkgs/servers/sql/cockroachdb/deps.nix b/pkgs/servers/sql/cockroachdb/deps.nix
deleted file mode 100644
index da2ab57f91a1..000000000000
--- a/pkgs/servers/sql/cockroachdb/deps.nix
+++ /dev/null
@@ -1,471 +0,0 @@
-# This file was generated by go2nix.
-[
-  {
-    goPackagePath = "github.com/VividCortex/ewma";
-    fetch = {
-      type = "git";
-      url = "https://github.com/VividCortex/ewma";
-      rev = "8b9f1311551e712ea8a06b494238b8a2351e1c33";
-      sha256 = "1w8gf6310dxl57jdq1b04wbh4ssb0nvck3926bbd86mnw78z0byl";
-    };
-  }
-  {
-    goPackagePath = "github.com/backtrace-labs/go-bcd";
-    fetch = {
-      type = "git";
-      url = "https://github.com/backtrace-labs/go-bcd";
-      rev = "c5383e2df7004f8b2fb2f10a33167d757bb0fbfb";
-      sha256 = "0v7al14ql8vddj8bw2yp1pp47nfdhq6vglbv6fmpg5sf5yfsp9xa";
-    };
-  }
-  {
-    goPackagePath = "github.com/biogo/store";
-    fetch = {
-      type = "git";
-      url = "https://github.com/biogo/store";
-      rev = "913427a1d5e89604e50ea1db0f28f34966d61602";
-      sha256 = "0xgz1g9digvvw64rmzw90a6iyxlljiiz2i1x0x0d8mw4wyaxcipz";
-    };
-  }
-  {
-    goPackagePath = "github.com/cenk/backoff";
-    fetch = {
-      type = "git";
-      url = "https://github.com/cenk/backoff";
-      rev = "cdf48bbc1eb78d1349cbda326a4a037f7ba565c6";
-      sha256 = "0dg7hvpv0a1db8qriygz1jqgp16v8k505b197x9902z7z6lldgbh";
-    };
-  }
-  {
-    goPackagePath = "github.com/chzyer/readline";
-    fetch = {
-      type = "git";
-      url = "https://github.com/chzyer/readline";
-      rev = "a193146c91dea4b6cf30f355e99fb85f73d20f07";
-      sha256 = "0amg5p3xadmj4p58f63f8kkggs9q3f3jhi7ijzb79grbg1lj2rj2";
-    };
-  }
-  {
-    goPackagePath = "github.com/cockroachdb/c-jemalloc";
-    fetch = {
-      type = "git";
-      url = "https://github.com/cockroachdb/c-jemalloc";
-      rev = "42e6a32cd7a4dff9c70d80323681d46d046181ef";
-      sha256 = "16ddzw35xj2vz8324mac5bhhr9akvjrg14lgq2mn5nfw1zs42r7n";
-    };
-  }
-  {
-    goPackagePath = "github.com/cockroachdb/c-protobuf";
-    fetch = {
-      type = "git";
-      url = "https://github.com/cockroachdb/c-protobuf";
-      rev = "951f3e665896e7ba939fd1f2db9aeaae6ca988f8";
-      sha256 = "032ncrq4p48riwk8zj6p3rp65p87k9793lg107ja6mf8nx0v3z3l";
-    };
-  }
-  {
-    goPackagePath = "github.com/cockroachdb/c-rocksdb";
-    fetch = {
-      type = "git";
-      url = "https://github.com/cockroachdb/c-rocksdb";
-      rev = "b5ca031b93fde49bfa2ba99aba423136aebf3c06";
-      sha256 = "1vwq8fbcgwvq2mqv1vwm3b671iklg26s7zd3bgxr5rl076mhn6s5";
-    };
-  }
-  {
-    goPackagePath = "github.com/cockroachdb/c-snappy";
-    fetch = {
-      type = "git";
-      url = "https://github.com/cockroachdb/c-snappy";
-      rev = "d4e7b428fe7fc09e93573df3448567a62df8c9fa";
-      sha256 = "09c1pnks51ypvqh97yf9mvi034cc3bb8dj3vkl9v959pg5ix91g4";
-    };
-  }
-  {
-    goPackagePath = "github.com/cockroachdb/cmux";
-    fetch = {
-      type = "git";
-      url = "https://github.com/cockroachdb/cmux";
-      rev = "b64f5908f4945f4b11ed4a0a9d3cc1e23350866d";
-      sha256 = "1by4f3x7j3r3z1sdx1v04r494hn6jaag7lc03prrgx455j8i0jlh";
-    };
-  }
-  {
-    goPackagePath = "github.com/cockroachdb/cockroach";
-    fetch = {
-      type = "git";
-      url = "https://github.com/cockroachdb/cockroach";
-      rev = "3fff05767cd3eda2197ce102391c0de447fef606";
-      sha256 = "11camp588vsccxlc138l7x4qws2fj5wpx1177irzayqdng8dilx3";
-    };
-  }
-  {
-    goPackagePath = "github.com/cockroachdb/pq";
-    fetch = {
-      type = "git";
-      url = "https://github.com/cockroachdb/pq";
-      rev = "40c6b2414c76cdb84aacc955f79dc844e48ad0c0";
-      sha256 = "16pnyndzlsk5rbbrimpkg6mf9w2qf0z64pk2k70ja4a65kihlw9g";
-    };
-  }
-  {
-    goPackagePath = "github.com/codahale/hdrhistogram";
-    fetch = {
-      type = "git";
-      url = "https://github.com/codahale/hdrhistogram";
-      rev = "f8ad88b59a584afeee9d334eff879b104439117b";
-      sha256 = "1y1llqaczhc5hqa71pwa1ns8nchizpl678lp23vl51c04swn8h8n";
-    };
-  }
-  {
-    goPackagePath = "github.com/coreos/etcd";
-    fetch = {
-      type = "git";
-      url = "https://github.com/coreos/etcd";
-      rev = "656167d760543d442eae62f0c8c4f92c05f59508";
-      sha256 = "1v4bwfh7ziklfcdapnyky00gjivcn1n30b72pwmbdlk7283p555k";
-    };
-  }
-  {
-    goPackagePath = "github.com/cpuguy83/go-md2man";
-    fetch = {
-      type = "git";
-      url = "https://github.com/cpuguy83/go-md2man";
-      rev = "2724a9c9051aa62e9cca11304e7dd518e9e41599";
-      sha256 = "1j2bigs7ixy20cdqd246nxr417md2qcyvkfk3x94992cr88d0vyj";
-    };
-  }
-  {
-    goPackagePath = "github.com/dustin/go-humanize";
-    fetch = {
-      type = "git";
-      url = "https://github.com/dustin/go-humanize";
-      rev = "2fcb5204cdc65b4bec9fd0a87606bb0d0e3c54e8";
-      sha256 = "1m2qgn5vh5m66ggmclgikvwc05np2r7sxgpvlj2jip5d61x29j5k";
-    };
-  }
-  {
-    goPackagePath = "github.com/elastic/gosigar";
-    fetch = {
-      type = "git";
-      url = "https://github.com/elastic/gosigar";
-      rev = "7c0ce0d4814c8d4950d7e7f40ed3b6359e757875";
-      sha256 = "1nar7jia3xfgwnvazp25m9b0kxxklarrq9fzdr63j3nqy2fnwvca";
-    };
-  }
-  {
-    goPackagePath = "github.com/elazarl/go-bindata-assetfs";
-    fetch = {
-      type = "git";
-      url = "https://github.com/elazarl/go-bindata-assetfs";
-      rev = "e1a2a7ec64b07d04ac9ebb072404fe8b7b60de1b";
-      sha256 = "0b6q8h9fwpgpkvml1j87wq9174g7px1dmskhm884drpvswda2djk";
-    };
-  }
-  {
-    goPackagePath = "github.com/facebookgo/clock";
-    fetch = {
-      type = "git";
-      url = "https://github.com/facebookgo/clock";
-      rev = "600d898af40aa09a7a93ecb9265d87b0504b6f03";
-      sha256 = "1z3jxwsqll65il7rcdx5j4dggg6w143z24h3agk09xvsc2iyj7a2";
-    };
-  }
-  {
-    goPackagePath = "github.com/gogo/protobuf";
-    fetch = {
-      type = "git";
-      url = "https://github.com/gogo/protobuf";
-      rev = "a4cceea7a401a73fefafd1a21fedbd4694124a82";
-      sha256 = "1b23izdgxlz010qrqgazm5yg0bc3pkni1qdf8n3z3xcn58hcx2yg";
-    };
-  }
-  {
-    goPackagePath = "github.com/golang/protobuf";
-    fetch = {
-      type = "git";
-      url = "https://github.com/golang/protobuf";
-      rev = "2c1988e8c18d14b142c0b472624f71647cf39adb";
-      sha256 = "176x3yv6l0i49ddv73r9v6w9qcmgrfzy8db26r01yk7sczq75nd5";
-    };
-  }
-  {
-    goPackagePath = "github.com/google/btree";
-    fetch = {
-      type = "git";
-      url = "https://github.com/google/btree";
-      rev = "7d79101e329e5a3adf994758c578dab82b90c017";
-      sha256 = "1c1hsy5s2pfawg3l9954jmqmy4yc2zp3f7i87m00km2yqgb8xpd0";
-    };
-  }
-  {
-    goPackagePath = "github.com/grpc-ecosystem/grpc-gateway";
-    fetch = {
-      type = "git";
-      url = "https://github.com/grpc-ecosystem/grpc-gateway";
-      rev = "ccd4e6b091a44f9f6b32848ffc63b3e8f8e26092";
-      sha256 = "0nl9hddmxw2s4cqpg70k1913fna101lxrha6dgplw8g8rjikfna4";
-    };
-  }
-  {
-    goPackagePath = "github.com/julienschmidt/httprouter";
-    fetch = {
-      type = "git";
-      url = "https://github.com/julienschmidt/httprouter";
-      rev = "d8ff598a019f2c7bad0980917a588193cf26666e";
-      sha256 = "11sdd5fi2w0szk850n4y35x4v2ndy62c3ss9alha5xcj4jh1j0yq";
-    };
-  }
-  {
-    goPackagePath = "github.com/kr/pretty";
-    fetch = {
-      type = "git";
-      url = "https://github.com/kr/pretty";
-      rev = "737b74a46c4bf788349f72cb256fed10aea4d0ac";
-      sha256 = "13bip4vamvij8dx0v0nhrikz6qhsimd0w4i55424c76ws6ph84i8";
-    };
-  }
-  {
-    goPackagePath = "github.com/kr/text";
-    fetch = {
-      type = "git";
-      url = "https://github.com/kr/text";
-      rev = "7cafcd837844e784b526369c9bce262804aebc60";
-      sha256 = "0br693pf6vdr1sfvzdz6zxq7hjpdgci0il4wj0v636r8lyy21vsx";
-    };
-  }
-  {
-    goPackagePath = "github.com/lib/pq";
-    fetch = {
-      type = "git";
-      url = "https://github.com/lib/pq";
-      rev = "80f8150043c80fb52dee6bc863a709cdac7ec8f8";
-      sha256 = "0brk4di63f56x9fsidn8dk7c2azan1kjzrli79h262j9pd17c3jm";
-    };
-  }
-  {
-    goPackagePath = "github.com/lightstep/lightstep-tracer-go";
-    fetch = {
-      type = "git";
-      url = "https://github.com/lightstep/lightstep-tracer-go";
-      rev = "f3c66066ce6023ad1bd721cfbd9fbd6292eb08cc";
-      sha256 = "1ci38j6d3spy2279l6anxxvm7k85h4fr08pdfw9ghrv96ajmaizb";
-    };
-  }
-  {
-    goPackagePath = "github.com/mattn/go-isatty";
-    fetch = {
-      type = "git";
-      url = "https://github.com/mattn/go-isatty";
-      rev = "66b8e73f3f5cda9f96b69efd03dd3d7fc4a5cdb8";
-      sha256 = "17lf13ndnai9a6dlmykqkdyzf1z04q7kffs0l7kvd78wpv3l6rm5";
-    };
-  }
-  {
-    goPackagePath = "github.com/mattn/go-runewidth";
-    fetch = {
-      type = "git";
-      url = "https://github.com/mattn/go-runewidth";
-      rev = "d6bea18f789704b5f83375793155289da36a3c7f";
-      sha256 = "1hnigpn7rjbwd1ircxkyx9hvi0xmxr32b2jdy2jzw6b3jmcnz1fs";
-    };
-  }
-  {
-    goPackagePath = "github.com/matttproud/golang_protobuf_extensions";
-    fetch = {
-      type = "git";
-      url = "https://github.com/matttproud/golang_protobuf_extensions";
-      rev = "c12348ce28de40eed0136aa2b644d0ee0650e56c";
-      sha256 = "1d0c1isd2lk9pnfq2nk0aih356j30k3h1gi2w0ixsivi5csl7jya";
-    };
-  }
-  {
-    goPackagePath = "github.com/olekukonko/tablewriter";
-    fetch = {
-      type = "git";
-      url = "https://github.com/olekukonko/tablewriter";
-      rev = "daf2955e742cf123959884fdff4685aa79b63135";
-      sha256 = "1fvl251ms7qmzfbi853kdgghqkrmyy6n1605mfy50nhgvw03z203";
-    };
-  }
-  {
-    goPackagePath = "github.com/opentracing/basictracer-go";
-    fetch = {
-      type = "git";
-      url = "https://github.com/opentracing/basictracer-go";
-      rev = "c7c0202a8a77f658aeb2193a27b6c0cfcc821038";
-      sha256 = "09mh7dlhr3lyw8kwpa07ywjzr3bg7847ky4hvx551lhyqk0bfv0l";
-    };
-  }
-  {
-    goPackagePath = "github.com/opentracing/opentracing-go";
-    fetch = {
-      type = "git";
-      url = "https://github.com/opentracing/opentracing-go";
-      rev = "855519783f479520497c6b3445611b05fc42f009";
-      sha256 = "15amxprc5n0dgr42jd1lkcn697m7pcvmksps9g1gw38ahyicxq8g";
-    };
-  }
-  {
-    goPackagePath = "github.com/petermattis/goid";
-    fetch = {
-      type = "git";
-      url = "https://github.com/petermattis/goid";
-      rev = "208e1c5be6bf38853827abdc6290b5f6a0c404d5";
-      sha256 = "0d511pdyrv9lkzq04agnm7019c1769vmdq8kyh66pq2np1x6jsl2";
-    };
-  }
-  {
-    goPackagePath = "github.com/pkg/errors";
-    fetch = {
-      type = "git";
-      url = "https://github.com/pkg/errors";
-      rev = "a22138067af1c4942683050411a841ade67fe1eb";
-      sha256 = "0fay1zxi8y4kj1q33mqxdsbicg9cplknnmzz87c9saq7rb4k6f36";
-    };
-  }
-  {
-    goPackagePath = "github.com/prometheus/client_model";
-    fetch = {
-      type = "git";
-      url = "https://github.com/prometheus/client_model";
-      rev = "fa8ad6fec33561be4280a8f0514318c79d7f6cb6";
-      sha256 = "11a7v1fjzhhwsl128znjcf5v7v6129xjgkdpym2lial4lac1dhm9";
-    };
-  }
-  {
-    goPackagePath = "github.com/prometheus/common";
-    fetch = {
-      type = "git";
-      url = "https://github.com/prometheus/common";
-      rev = "ebdfc6da46522d58825777cf1f90490a5b1ef1d8";
-      sha256 = "0js62pj8600773wx6labpd772yyhz5ivim7dnl7b862wblbmc8mq";
-    };
-  }
-  {
-    goPackagePath = "github.com/rcrowley/go-metrics";
-    fetch = {
-      type = "git";
-      url = "https://github.com/rcrowley/go-metrics";
-      rev = "bdb33529eca3e55eac7328e07c57012a797af602";
-      sha256 = "146hfddgdi8rkg25v1f25klz3sy5slp0gny2lwjyi63jwly07512";
-    };
-  }
-  {
-    goPackagePath = "github.com/rubyist/circuitbreaker";
-    fetch = {
-      type = "git";
-      url = "https://github.com/rubyist/circuitbreaker";
-      rev = "7e3e7fbe9c62b943d487af023566a79d9eb22d3b";
-      sha256 = "01fshh514bq2bk7f6xv7zr781m23d3k1mla1lh8azqw5874m7a07";
-    };
-  }
-  {
-    goPackagePath = "github.com/russross/blackfriday";
-    fetch = {
-      type = "git";
-      url = "https://github.com/russross/blackfriday";
-      rev = "93622da34e54fb6529bfb7c57e710f37a8d9cbd8";
-      sha256 = "19y4cx4afm3fjj7w83g0wklbzqdjm7m1j5nq64l4yq8bi50y2iv2";
-    };
-  }
-  {
-    goPackagePath = "github.com/satori/go.uuid";
-    fetch = {
-      type = "git";
-      url = "https://github.com/satori/go.uuid";
-      rev = "0aa62d5ddceb50dbcb909d790b5345affd3669b6";
-      sha256 = "1vfzfcspanxcbpdpv49580rh6kamzcs3lm70xnx724mkwi41zi8w";
-    };
-  }
-  {
-    goPackagePath = "github.com/shurcooL/sanitized_anchor_name";
-    fetch = {
-      type = "git";
-      url = "https://github.com/shurcooL/sanitized_anchor_name";
-      rev = "10ef21a441db47d8b13ebcc5fd2310f636973c77";
-      sha256 = "1cnbzcf47cn796rcjpph1s64qrabhkv5dn9sbynsy7m9zdwr5f01";
-    };
-  }
-  {
-    goPackagePath = "github.com/spf13/cobra";
-    fetch = {
-      type = "git";
-      url = "https://github.com/spf13/cobra";
-      rev = "7c674d9e72017ed25f6d2b5e497a1368086b6a6f";
-      sha256 = "0an935r7lc11a744mvdrsy56rs2w0ah3gdclvr4gzd5iqr9ap3dr";
-    };
-  }
-  {
-    goPackagePath = "github.com/spf13/pflag";
-    fetch = {
-      type = "git";
-      url = "https://github.com/spf13/pflag";
-      rev = "f676131e2660dc8cd88de99f7486d34aa8172635";
-      sha256 = "0gj4fpary501n32ag49mkd0vymqw01am0lv78l9db9dvd2im0i4m";
-    };
-  }
-  {
-    goPackagePath = "golang.org/x/crypto";
-    fetch = {
-      type = "git";
-      url = "https://go.googlesource.com/crypto";
-      rev = "a548aac93ed489257b9d959b40fe1e8c1e20778c";
-      sha256 = "022vl9s6hf8qzdrxfivzd3dg1gsr1vns0j3a3xfdkgv5z9qyvy83";
-    };
-  }
-  {
-    goPackagePath = "golang.org/x/net";
-    fetch = {
-      type = "git";
-      url = "https://go.googlesource.com/net";
-      rev = "07b51741c1d6423d4a6abab1c49940ec09cb1aaf";
-      sha256 = "12lvdj0k2gww4hw5f79qb9yswqpy4i3bgv1likmf3mllgdxfm20w";
-    };
-  }
-  {
-    goPackagePath = "golang.org/x/sys";
-    fetch = {
-      type = "git";
-      url = "https://go.googlesource.com/sys";
-      rev = "a646d33e2ee3172a661fc09bca23bb4889a41bc8";
-      sha256 = "1jniqg2nv5zhdzfm9gwfx0s9q8mwxrgcxdbkd6cddk9w0qgji9dc";
-    };
-  }
-  {
-    goPackagePath = "golang.org/x/text";
-    fetch = {
-      type = "git";
-      url = "https://go.googlesource.com/text";
-      rev = "2910a502d2bf9e43193af9d68ca516529614eed3";
-      sha256 = "1h2bxzsnqksnvrk2lplpqzzpp9m9zmd6f2aajyahc56bxb1804jq";
-    };
-  }
-  {
-    goPackagePath = "google.golang.org/grpc";
-    fetch = {
-      type = "git";
-      url = "https://github.com/grpc/grpc-go";
-      rev = "79b7c349179cdd6efd8bac4a1ce7f01b98c16e9b";
-      sha256 = "0w2g3pcxxgnp3fk0qy7ail8mxdxv3cf1yavdx8rrjn9idyd261df";
-    };
-  }
-  {
-    goPackagePath = "gopkg.in/inf.v0";
-    fetch = {
-      type = "git";
-      url = "https://gopkg.in/inf.v0";
-      rev = "3887ee99ecf07df5b447e9b00d9c0b2adaa9f3e4";
-      sha256 = "0rf3vwyb8aqnac9x9d6ax7z5526c45a16yjm2pvkijr6qgqz8b82";
-    };
-  }
-  {
-    goPackagePath = "gopkg.in/yaml.v1";
-    fetch = {
-      type = "git";
-      url = "https://gopkg.in/yaml.v1";
-      rev = "9f9df34309c04878acc86042b16630b0f696e1de";
-      sha256 = "1r8d346szqa9x8q03wiycik5qy3d6w8qq4hs99z1p64q5lm0g7gm";
-    };
-  }
-]
diff --git a/pkgs/shells/rssh/default.nix b/pkgs/shells/rssh/default.nix
index b84f5f26685b..d3ce1ff1cc2d 100644
--- a/pkgs/shells/rssh/default.nix
+++ b/pkgs/shells/rssh/default.nix
@@ -59,6 +59,12 @@ stdenv.mkDerivation rec {
     })
   ];
 
+  # Run this after to avoid conflict with patches above
+  postPatch = ''
+    sed -i '/chmod u+s/d' Makefile.in
+  '';
+
+
   buildInputs = [ openssh rsync cvs ];
 
   configureFlags = [
diff --git a/pkgs/tools/admin/cli53/default.nix b/pkgs/tools/admin/cli53/default.nix
index bdb9fd2d4772..4e284c461932 100644
--- a/pkgs/tools/admin/cli53/default.nix
+++ b/pkgs/tools/admin/cli53/default.nix
@@ -1,24 +1,30 @@
-{ lib, python2Packages, fetchurl }:
+{ stdenv, buildGoPackage, fetchFromGitHub }:
 
-python2Packages.buildPythonApplication rec {
+buildGoPackage rec {
   name = "cli53-${version}";
-  version = "0.4.4";
+  version = "0.8.8";
 
-  src = fetchurl {
-    url = "mirror://pypi/c/cli53/${name}.tar.gz";
-    sha256 = "0s9jzigq6a16m2c3qklssx2lz16cf13g5zh80vh24kxazaxqzbig";
+  goPackagePath = "github.com/barnybug/cli53";
+
+  src = fetchFromGitHub {
+    owner = "barnybug";
+    repo = "cli53";
+    rev = version;
+    sha256 = "1hbx64rn25qzp2xlfwv8xaqyfcax9b6pl30j9vciw7cb346i84gc";
   };
 
-  propagatedBuildInputs = with python2Packages; [
-    argparse
-    boto
-    dns
-  ];
+  buildPhase = ''
+    pushd go/src/${goPackagePath}/cmd/cli53
+    go get .
+    popd
+  '';
+
+  goDeps = ./deps.nix;
 
-  meta = {
+  meta = with stdenv.lib; {
     description = "CLI tool for the Amazon Route 53 DNS service";
     homepage = https://github.com/barnybug/cli53;
-    license = lib.licenses.mit;
-    maintainers = with lib.maintainers; [ benley ];
+    license = licenses.mit;
+    maintainers = with maintainers; [ benley ];
   };
 }
diff --git a/pkgs/tools/admin/cli53/deps.nix b/pkgs/tools/admin/cli53/deps.nix
new file mode 100644
index 000000000000..0cb0360e499d
--- /dev/null
+++ b/pkgs/tools/admin/cli53/deps.nix
@@ -0,0 +1,3 @@
+# This file was generated by https://github.com/kamilchm/go2nix v1.2.0
+[
+]
diff --git a/pkgs/tools/audio/qastools/default.nix b/pkgs/tools/audio/qastools/default.nix
index 3456f0986488..d86a0b09c269 100644
--- a/pkgs/tools/audio/qastools/default.nix
+++ b/pkgs/tools/audio/qastools/default.nix
@@ -1,11 +1,10 @@
-{ stdenv, fetchurl, cmake, alsaLib, udev, qtbase,
-  qtsvg, qttools, makeQtWrapper }:
+{ mkDerivation, lib, fetchurl, cmake, alsaLib, udev, qtbase, qtsvg, qttools }:
 
 let
   version = "0.21.0";
 in
 
-stdenv.mkDerivation {
+mkDerivation {
   name = "qastools-${version}";
 
   src = fetchurl {
@@ -14,15 +13,15 @@ stdenv.mkDerivation {
   };
 
   buildInputs = [
-    cmake alsaLib udev qtbase qtsvg qttools makeQtWrapper
+    alsaLib udev qtbase qtsvg qttools
   ];
+  nativeBuildInputs = [ cmake ];
 
   cmakeFlags = [
-    "-DCMAKE_INSALL_PREFIX=$out"
     "-DALSA_INCLUDE=${alsaLib.dev}/include/alsa/version.h"
   ];
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Collection of desktop applications for ALSA configuration";
     license = licenses.gpl3;
     platforms = platforms.linux;
diff --git a/pkgs/tools/backup/amazon-glacier-cmd-interface/default.nix b/pkgs/tools/backup/amazon-glacier-cmd-interface/default.nix
index d5f47f9a6c0d..472b4a6508f2 100644
--- a/pkgs/tools/backup/amazon-glacier-cmd-interface/default.nix
+++ b/pkgs/tools/backup/amazon-glacier-cmd-interface/default.nix
@@ -11,8 +11,12 @@ python2Packages.buildPythonApplication rec {
     sha256 = "1k5z8kda9v6klr4536pf5qbq9zklxvyysv7nc48gllschl09jywc";
   };
 
+  # argparse is part of the standardlib
+  prePatch = ''
+    substituteInPlace setup.py --replace "'argparse'," ""
+  '';
+
   propagatedBuildInputs = with python2Packages; [
-    argparse
     boto
     dateutil
     prettytable
diff --git a/pkgs/tools/filesystems/glusterfs/default.nix b/pkgs/tools/filesystems/glusterfs/default.nix
index 60e49486454b..af76e429d31c 100644
--- a/pkgs/tools/filesystems/glusterfs/default.nix
+++ b/pkgs/tools/filesystems/glusterfs/default.nix
@@ -65,6 +65,10 @@ rec {
   inherit (s) name version;
   inherit buildInputs propagatedBuildInputs;
 
+  postPatch = ''
+    sed -e '/chmod u+s/d' -i contrib/fuse-util/Makefile.am
+  '';
+
   patches = [
     ./glusterfs-use-PATH-instead-of-hardcodes.patch
     ./glusterfs-fix-unsubstituted-autoconf-macros.patch
diff --git a/pkgs/tools/misc/antimicro/default.nix b/pkgs/tools/misc/antimicro/default.nix
index 02d65597f749..ee0accac2d9b 100644
--- a/pkgs/tools/misc/antimicro/default.nix
+++ b/pkgs/tools/misc/antimicro/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, cmake, pkgconfig, SDL2, qtbase, qttools, makeQtWrapper, xorg, fetchFromGitHub }:
+{ mkDerivation, lib, cmake, pkgconfig, SDL2, qtbase, qttools, xorg, fetchFromGitHub }:
 
-stdenv.mkDerivation rec {
+mkDerivation rec {
   name = "antimicro-${version}";
   version = "2.23";
 
@@ -11,15 +11,12 @@ stdenv.mkDerivation rec {
     sha256 = "1q40ayxwwyq85lc89cnj1cm2nar625h4vhh8dvmb2qcxczaggf4v";
   };
 
+  nativeBuildInputs = [ cmake pkgconfig ];
   buildInputs = [
-    cmake pkgconfig SDL2 qtbase qttools xorg.libXtst makeQtWrapper
+    SDL2 qtbase qttools xorg.libXtst
   ];
 
-  postInstall = ''
-    wrapQtProgram $out/bin/antimicro
-  '';
-
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "GUI for mapping keyboard and mouse controls to a gamepad";
     inherit (src.meta) homepage;
     maintainers = with maintainers; [ jb55 ];
diff --git a/pkgs/tools/misc/ckb/default.nix b/pkgs/tools/misc/ckb/default.nix
index b90adfd5852c..41116288e533 100644
--- a/pkgs/tools/misc/ckb/default.nix
+++ b/pkgs/tools/misc/ckb/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, libudev, pkgconfig, qtbase, qmakeHook, zlib }:
+{ stdenv, fetchFromGitHub, libudev, pkgconfig, qtbase, qmake, zlib }:
 
 stdenv.mkDerivation rec {
   version = "0.2.6";
@@ -19,7 +19,7 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [
     pkgconfig
-    qmakeHook
+    qmake
   ];
 
   patches = [
diff --git a/pkgs/tools/misc/clipster/default.nix b/pkgs/tools/misc/clipster/default.nix
index 547cc289c3cd..e34f4bc8f2f2 100644
--- a/pkgs/tools/misc/clipster/default.nix
+++ b/pkgs/tools/misc/clipster/default.nix
@@ -1,14 +1,14 @@
 {fetchFromGitHub , stdenv, makeWrapper, python3, gtk3, libwnck3 }:
 
 stdenv.mkDerivation  rec {
-  name = "clipster-unstable-${version}";
-  version = "2017-02-27";
+  name = "clipster-${version}";
+  version = "1.0.1";
 
   src = fetchFromGitHub {
     owner = "mrichar1";
     repo = "clipster";
-    rev = "dfa75b52ee3a41fff7534aca165dc0e6a24a3680";
-    sha256 = "0d7ak6wpvvgz7cwvfzy2shkfiw6gr8l703xyjpiayjbnr2s79k5j";
+    rev = "${version}";
+    sha256 = "0y0igi5r5x2gxglm0aarn2mhdfn6whakm6359i3h0wkn6qw1p1l2";
   };
 
   pythonEnv = python3.withPackages(ps: with ps; [ pygobject3 ]);
diff --git a/pkgs/tools/misc/ddcutil/default.nix b/pkgs/tools/misc/ddcutil/default.nix
new file mode 100644
index 000000000000..c45c85e4271d
--- /dev/null
+++ b/pkgs/tools/misc/ddcutil/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig
+, glib, i2c-tools, udev, libgudev, libusb, libdrm, xorg }:
+
+stdenv.mkDerivation rec {
+  name = "ddcutil-${version}";
+  version = "0.8.2";
+
+  src = fetchFromGitHub {
+    owner  = "rockowitz";
+    repo   = "ddcutil";
+    rev    = "v${version}";
+    sha256 = "1hcdg54xyb1pfl03iqll14y9yglwmyvxyvhbql87hd9q0dywah6m";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [
+    i2c-tools udev libgudev
+    glib libusb libdrm xorg.libXrandr
+  ];
+
+  meta = with stdenv.lib; {
+    homepage    = http://www.ddcutil.com/;
+    description = "Query and change Linux monitor settings using DDC/CI and USB";
+    license     = licenses.gpl2;
+    maintainer  = with maintainers; [ rnhmjoj ];
+  };
+}
+
diff --git a/pkgs/tools/misc/kronometer/default.nix b/pkgs/tools/misc/kronometer/default.nix
index 5ba2543e273d..6db3278fade0 100644
--- a/pkgs/tools/misc/kronometer/default.nix
+++ b/pkgs/tools/misc/kronometer/default.nix
@@ -1,29 +1,25 @@
 {
-  kdeDerivation, kdeWrapper, fetchurl, lib,
-  extra-cmake-modules, kdoctools,
+  mkDerivation, fetchurl, lib,
+  extra-cmake-modules, kdoctools, wrapGAppsHook,
   kconfig, kinit
 }:
 
 let
   pname = "kronometer";
   version = "2.1.3";
-  unwrapped = kdeDerivation rec {
-    name = "${pname}-${version}";
+in
+mkDerivation rec {
+  name = "${pname}-${version}";
 
-    src = fetchurl {
-      url = "mirror://kde/stable/${pname}/${version}/src/${name}.tar.xz";
-      sha256 = "1z06gvaacm3d3a9smlmgg2vf0jdab5kqxx24r6v7iprqzgdpsn4i";
-    };
+  src = fetchurl {
+    url = "mirror://kde/stable/${pname}/${version}/src/${name}.tar.xz";
+    sha256 = "1z06gvaacm3d3a9smlmgg2vf0jdab5kqxx24r6v7iprqzgdpsn4i";
+  };
 
-    meta = with lib; {
-      license = licenses.gpl2;
-      maintainers = with maintainers; [ peterhoeg ];
-    };
-    nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-    propagatedBuildInputs = [ kconfig kinit ];
+  meta = with lib; {
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ peterhoeg ];
   };
-in
-kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/kronometer" ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools wrapGAppsHook ];
+  propagatedBuildInputs = [ kconfig kinit ];
 }
diff --git a/pkgs/tools/misc/parallel/default.nix b/pkgs/tools/misc/parallel/default.nix
index 8097902b0d98..07326e7a8ed6 100644
--- a/pkgs/tools/misc/parallel/default.nix
+++ b/pkgs/tools/misc/parallel/default.nix
@@ -1,11 +1,11 @@
 { fetchurl, stdenv, perl, makeWrapper, procps }:
 
 stdenv.mkDerivation rec {
-  name = "parallel-20170422";
+  name = "parallel-20170522";
 
   src = fetchurl {
     url = "mirror://gnu/parallel/${name}.tar.bz2";
-    sha256 = "0afk1q8mqzz02h6imyykgi9gwk5gj08hzs6lwgd65ilj4slkh93s";
+    sha256 = "1k5wlcc0dr2fxna0vi48s0l6pvbyl4pbclbih4103f1155im23ca";
   };
 
   nativeBuildInputs = [ makeWrapper perl ];
diff --git a/pkgs/tools/misc/partition-manager/default.nix b/pkgs/tools/misc/partition-manager/default.nix
index dcea9c47aec7..52183a3fff35 100644
--- a/pkgs/tools/misc/partition-manager/default.nix
+++ b/pkgs/tools/misc/partition-manager/default.nix
@@ -1,32 +1,26 @@
-{ kdeDerivation, kdeWrapper, fetchurl, lib
-, ecm, kdoctools
+{ mkDerivation, fetchurl, lib
+, extra-cmake-modules, kdoctools, wrapGAppsHook
 , kconfig, kinit, kpmcore
 , eject, libatasmart }:
 
 let
   pname = "partitionmanager";
-  unwrapped = kdeDerivation rec {
-    name = "${pname}-${version}";
-    version = "3.0.1";
+in mkDerivation rec {
+  name = "${pname}-${version}";
+  version = "3.0.1";
 
-    src = fetchurl {
-      url = "mirror://kde/stable/${pname}/${version}/src/${name}.tar.xz";
-      sha256 = "08sb9xa7dvvgha3k2xm1srl339przxpxd2y5bh1lnx6k1x7dk410";
-    };
-
-    meta = with lib; {
-      description = "KDE Partition Manager";
-      license = licenses.gpl2;
-      maintainers = with maintainers; [ peterhoeg ];
-    };
-    nativeBuildInputs = [ ecm kdoctools ];
-    # refer to kpmcore for the use of eject
-    buildInputs = [ eject libatasmart ];
-    propagatedBuildInputs = [ kconfig kinit kpmcore ];
-    enableParallelBuilding = true;
+  src = fetchurl {
+    url = "mirror://kde/stable/${pname}/${version}/src/${name}.tar.xz";
+    sha256 = "08sb9xa7dvvgha3k2xm1srl339przxpxd2y5bh1lnx6k1x7dk410";
   };
 
-in kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/partitionmanager" ];
+  meta = with lib; {
+    description = "KDE Partition Manager";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ peterhoeg ];
+  };
+  nativeBuildInputs = [ extra-cmake-modules kdoctools wrapGAppsHook ];
+  # refer to kpmcore for the use of eject
+  buildInputs = [ eject libatasmart ];
+  propagatedBuildInputs = [ kconfig kinit kpmcore ];
 }
diff --git a/pkgs/tools/misc/peruse/default.nix b/pkgs/tools/misc/peruse/default.nix
index 1c7a28e29756..cd872fd966e5 100644
--- a/pkgs/tools/misc/peruse/default.nix
+++ b/pkgs/tools/misc/peruse/default.nix
@@ -1,6 +1,6 @@
 {
-  kdeDerivation, kdeWrapper, fetchFromGitHub, fetchurl, lib,
-  extra-cmake-modules, kdoctools,
+  mkDerivation, fetchFromGitHub, fetchurl, lib,
+  extra-cmake-modules, kdoctools, wrapGAppsHook,
   baloo, kconfig, kfilemetadata, kinit, kirigami, knewstuff, plasma-framework
 }:
 
@@ -13,33 +13,28 @@ let
     rev    = "d1be8c43a82a4320306c8e835a86fdb7b2574ca7";
     sha256 = "03ds5da69zipa25rsp76l6xqivrh3wcgygwyqa5x2rgcz3rjnlpr";
   };
-  unwrapped = kdeDerivation rec {
-    name = "${pname}-${version}";
+in mkDerivation rec {
+  name = "${pname}-${version}";
 
-    src = fetchurl {
-      url = "mirror://kde/stable/${pname}/${name}.tar.xz";
-      sha256 = "1ik2627xynkichsq9x28rkczqn3l3p06q6vw5jdafdh3hisccmjq";
-    };
-
-    nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  src = fetchurl {
+    url = "mirror://kde/stable/${pname}/${name}.tar.xz";
+    sha256 = "1ik2627xynkichsq9x28rkczqn3l3p06q6vw5jdafdh3hisccmjq";
+  };
 
-    propagatedBuildInputs = [ baloo kconfig kfilemetadata kinit kirigami knewstuff plasma-framework ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools wrapGAppsHook ];
 
-    pathsToLink = [ "/etc/xdg/peruse.knsrc"];
+  propagatedBuildInputs = [ baloo kconfig kfilemetadata kinit kirigami knewstuff plasma-framework ];
 
-    preConfigure = ''
-      rm -rf src/qtquick/karchive-rar/external/unarr
-      ln -s ${unarr} src/qtquick/karchive-rar/external/unarr
-    '';
+  pathsToLink = [ "/etc/xdg/peruse.knsrc"];
 
-    meta = with lib; {
-      license = licenses.gpl2;
-      maintainers = with maintainers; [ peterhoeg ];
-    };
+  preConfigure = ''
+    rm -rf src/qtquick/karchive-rar/external/unarr
+    ln -s ${unarr} src/qtquick/karchive-rar/external/unarr
+  '';
 
+  meta = with lib; {
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ peterhoeg ];
   };
 
-in kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/peruse" "bin/perusecreator" ];
 }
diff --git a/pkgs/tools/misc/qt5ct/default.nix b/pkgs/tools/misc/qt5ct/default.nix
index 016e9726ad99..86750518bb5a 100644
--- a/pkgs/tools/misc/qt5ct/default.nix
+++ b/pkgs/tools/misc/qt5ct/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, qtbase, qtsvg, qttools, qmakeHook, makeQtWrapper }:
+{ stdenv, fetchurl, qtbase, qtsvg, qttools, qmake }:
 
 stdenv.mkDerivation rec {
   name = "qt5ct-${version}";
@@ -9,16 +9,13 @@ stdenv.mkDerivation rec {
     sha256 = "0by0wz40rl9gxvwbd85j0y5xy9mjab1cya96rv48x677v95lhm9f";
   };
 
-  nativeBuildInputs = [ makeQtWrapper qmakeHook qttools ];
+  propagatedBuildInputs = [ qtbase qtsvg qttools ];
+  nativeBuildInputs = [ qmake ];
 
   buildInputs = [ qtbase qtsvg ];
 
   preConfigure = ''
-    qmakeFlags="$qmakeFlags PLUGINDIR=$out/lib/qt5/plugins"
-  '';
-
-  preFixup = ''
-    wrapQtProgram $out/bin/qt5ct
+    qmakeFlags="$qmakeFlags PLUGINDIR=$out/$qtPluginPrefix"
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/tools/misc/radeon-profile/default.nix b/pkgs/tools/misc/radeon-profile/default.nix
index ab60bd97b35a..63f32763f223 100644
--- a/pkgs/tools/misc/radeon-profile/default.nix
+++ b/pkgs/tools/misc/radeon-profile/default.nix
@@ -1,11 +1,11 @@
-{ stdenv, fetchFromGitHub, qtbase, qmakeHook, makeQtWrapper, libXrandr }:
+{ stdenv, fetchFromGitHub, qtbase, qmake, libXrandr }:
 
 stdenv.mkDerivation rec {
 
   name = "radeon-profile-${version}";
   version = "20161221";
 
-  nativeBuildInputs = [ qmakeHook makeQtWrapper ];
+  nativeBuildInputs = [ qmake ];
   buildInputs = [ qtbase libXrandr ];
 
   src = (fetchFromGitHub {
@@ -18,7 +18,6 @@ stdenv.mkDerivation rec {
   postInstall = ''
     mkdir -p $out/bin
     cp ./radeon-profile $out/bin/radeon-profile
-    wrapQtProgram  $out/bin/radeon-profile
   '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/tools/misc/rockbox-utility/default.nix b/pkgs/tools/misc/rockbox-utility/default.nix
index 2ec03094f9fb..f84b9563967f 100644
--- a/pkgs/tools/misc/rockbox-utility/default.nix
+++ b/pkgs/tools/misc/rockbox-utility/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, pkgconfig, libusb1
-, qtbase, qttools, makeQtWrapper, qmakeHook
+, qtbase, qttools, makeWrapper, qmake
 , withEspeak ? false, espeak ? null }:
 
 stdenv.mkDerivation  rec {
@@ -13,7 +13,7 @@ stdenv.mkDerivation  rec {
 
   buildInputs = [ libusb1 qtbase qttools ]
     ++ stdenv.lib.optional withEspeak espeak;
-  nativeBuildInputs = [ makeQtWrapper pkgconfig qmakeHook ];
+  nativeBuildInputs = [ makeWrapper pkgconfig qmake ];
 
   preConfigure = ''
     cd rbutil/rbutilqt
@@ -24,7 +24,7 @@ stdenv.mkDerivation  rec {
 
     install -Dm755 RockboxUtility $out/bin/rockboxutility
     ln -s $out/bin/rockboxutility $out/bin/RockboxUtility
-    wrapQtProgram $out/bin/rockboxutility \
+    wrapProgram $out/bin/rockboxutility \
     ${stdenv.lib.optionalString withEspeak ''
       --prefix PATH : ${espeak}/bin
     ''}
diff --git a/pkgs/tools/misc/rrdtool/default.nix b/pkgs/tools/misc/rrdtool/default.nix
index 3d2666add420..6d961c69b13d 100644
--- a/pkgs/tools/misc/rrdtool/default.nix
+++ b/pkgs/tools/misc/rrdtool/default.nix
@@ -2,11 +2,11 @@
 , tcl-8_5, darwin }:
 
 stdenv.mkDerivation rec {
-  name = "rrdtool-1.6.0";
+  name = "rrdtool-1.7.0";
 
   src = fetchurl {
     url = "http://oss.oetiker.ch/rrdtool/pub/${name}.tar.gz";
-    sha256 = "1msj1qsy3sdmx2g2rngp9a9qv50hz0ih7yx6nkx2b21drn4qx56d";
+    sha256 = "0ssjqpa0dwwzbylc0drmlbq922qcw8crffc0rpr805xr6n4k8zgr";
   };
 
   nativeBuildInputs = [ pkgconfig ];
diff --git a/pkgs/tools/misc/tmuxinator/default.nix b/pkgs/tools/misc/tmuxinator/default.nix
index 5e8966108661..5bf7dd49143e 100644
--- a/pkgs/tools/misc/tmuxinator/default.nix
+++ b/pkgs/tools/misc/tmuxinator/default.nix
@@ -8,8 +8,8 @@ buildRubyGem rec {
   inherit ruby;
   name = "${gemName}-${version}";
   gemName = "tmuxinator";
-  version = "0.8.1";
-  sha256 = "1cpmlfa684j9r1hjya70nfcl5lzdbzmbi9hqbs5nhxha97b77qs5";
+  version = "0.9.0";
+  sha256 = "13p8rvf1naknjin1n97370ifyj475lyyh60cbw2v6gczi9rs84p3";
 
   erubis = buildRubyGem rec {
     inherit ruby;
@@ -33,7 +33,7 @@ buildRubyGem rec {
     description = "Manage complex tmux sessions easily";
     homepage    = https://github.com/tmuxinator/tmuxinator;
     license     = licenses.mit;
-    maintainers = with maintainers; [ auntie ];
+    maintainers = with maintainers; [ auntie ericsagnes ];
     platforms   = platforms.unix;
   };
-}
\ No newline at end of file
+}
diff --git a/pkgs/tools/misc/ultrastar-creator/default.nix b/pkgs/tools/misc/ultrastar-creator/default.nix
index 0700c43b26e5..197c05366035 100644
--- a/pkgs/tools/misc/ultrastar-creator/default.nix
+++ b/pkgs/tools/misc/ultrastar-creator/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchFromGitHub
-, qmakeHook, qtbase, makeQtWrapper
+, qmake, qtbase, makeQtWrapper
 , pkgconfig, taglib, libbass, libbass_fx }:
 
 stdenv.mkDerivation rec {
@@ -29,7 +29,7 @@ stdenv.mkDerivation rec {
     cd src
   '';
 
-  nativeBuildInputs = [ qmakeHook makeQtWrapper pkgconfig ];
+  nativeBuildInputs = [ qmake makeQtWrapper pkgconfig ];
   buildInputs = [ qtbase taglib libbass libbass_fx ];
 
   meta = with stdenv.lib; {
diff --git a/pkgs/tools/misc/ultrastar-manager/default.nix b/pkgs/tools/misc/ultrastar-manager/default.nix
index 61b2c6aaa228..503ffe735fdd 100644
--- a/pkgs/tools/misc/ultrastar-manager/default.nix
+++ b/pkgs/tools/misc/ultrastar-manager/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, pkgconfig, symlinkJoin, qmakeHook, diffPlugins
+{ stdenv, fetchFromGitHub, pkgconfig, symlinkJoin, qmake, diffPlugins
 , qtbase, qtmultimedia, makeQtWrapper
 , taglib, libmediainfo, libzen, libbass }:
 
@@ -60,7 +60,7 @@ let
     name = "ultrastar-manager-${name}-plugin-${version}";
     src = patchedSrc;
 
-    buildInputs = [ qmakeHook ] ++ buildInputs;
+    buildInputs = [ qmake ] ++ buildInputs;
 
     postPatch = ''
       sed -e "s|DESTDIR = .*$|DESTDIR = $out|" \
diff --git a/pkgs/tools/misc/uucp/default.nix b/pkgs/tools/misc/uucp/default.nix
index 4ef050b409e5..acb42a7a8d27 100644
--- a/pkgs/tools/misc/uucp/default.nix
+++ b/pkgs/tools/misc/uucp/default.nix
@@ -10,6 +10,13 @@ stdenv.mkDerivation rec {
 
   hardeningDisable = [ "format" ];
 
+  prePatch = ''
+    # do not set sticky bit in nix store
+    substituteInPlace Makefile.in \
+      --replace 4555 0555
+    sed -i '/chown $(OWNER)/d' Makefile.in
+  '';
+
   meta = {
     description = "Unix-unix cp over serial line, also includes cu program";
 
diff --git a/pkgs/tools/misc/youtube-dl/default.nix b/pkgs/tools/misc/youtube-dl/default.nix
index 853f644634d4..0af3b72f6aff 100644
--- a/pkgs/tools/misc/youtube-dl/default.nix
+++ b/pkgs/tools/misc/youtube-dl/default.nix
@@ -15,11 +15,11 @@ with stdenv.lib;
 buildPythonApplication rec {
 
   name = "youtube-dl-${version}";
-  version = "2017.05.29";
+  version = "2017.06.18";
 
   src = fetchurl {
     url = "https://yt-dl.org/downloads/${version}/${name}.tar.gz";
-    sha256 = "11zh0h4hwwx39iv6qbkqbvf5a5mgj71ngj2kp7zmq7g0qh37x9rx";
+    sha256 = "16az9rwr71hvs2z2xagnk71xqs7si0nb8rkn63r7pfv4rb134ggm";
   };
 
   nativeBuildInputs = [ makeWrapper ];
diff --git a/pkgs/tools/networking/cmst/default.nix b/pkgs/tools/networking/cmst/default.nix
index e5d404d65e1d..8b99182242b6 100644
--- a/pkgs/tools/networking/cmst/default.nix
+++ b/pkgs/tools/networking/cmst/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, qtbase, qmakeHook, makeWrapper, libX11 }:
+{ stdenv, fetchFromGitHub, qtbase, qmake, makeWrapper, libX11 }:
 
 stdenv.mkDerivation rec {
   name = "cmst-${version}";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "0lsg8ya36df48ij0jawgli3f63hy6mn9zcla48whb1l4r7cih545";
   };
 
-  nativeBuildInputs = [ makeWrapper qmakeHook ];
+  nativeBuildInputs = [ makeWrapper qmake ];
 
   buildInputs = [ qtbase ];
 
diff --git a/pkgs/tools/security/kwalletcli/default.nix b/pkgs/tools/security/kwalletcli/default.nix
index c6217024f1b7..c655e9aecf8b 100644
--- a/pkgs/tools/security/kwalletcli/default.nix
+++ b/pkgs/tools/security/kwalletcli/default.nix
@@ -1,5 +1,5 @@
 {
-  kdeDerivation, kdeWrapper, fetchurl, lib,
+  mkDerivation, fetchurl, lib,
   pkgconfig,
   kcoreaddons, ki18n, kwallet,
   mksh
@@ -8,48 +8,42 @@
 let
   pname = "kwalletcli";
   version = "3.00";
+in
+mkDerivation rec {
+  name = "${pname}-${version}";
 
-  unwrapped = kdeDerivation rec {
-    name = "${pname}-${version}";
-
-    src = fetchurl {
-      url = "https://www.mirbsd.org/MirOS/dist/hosted/kwalletcli/${name}.tar.gz";
-      sha256 = "1q87nm7pkmgvkrml6hgbmv0ddx3871w7x86gn90sjc3vw59qfh98";
-    };
-
-    postPatch = ''
-      substituteInPlace GNUmakefile \
-        --replace '-I/usr/include/KF5/KCoreAddons' '-I${kcoreaddons.dev}/include/KF5/KCoreAddons' \
-        --replace '-I/usr/include/KF5/KI18n'       '-I${ki18n.dev}/include/KF5/KI18n' \
-        --replace '-I/usr/include/KF5/KWallet'     '-I${kwallet.dev}/include/KF5/KWallet' \
-        --replace /usr/bin                         $out/bin \
-        --replace /usr/share/man                   $out/share/man
-    '';
-
-    makeFlags = [ "KDE_VER=5" ];
-
-    # we need this when building against qt 5.8+
-    NIX_CFLAGS_COMPILE = [ "-std=c++11" ];
-
-    nativeBuildInputs = [ pkgconfig ];
-    # if using just kwallet, cmake will be added as a buildInput and fail the build
-    propagatedBuildInputs = [ kcoreaddons ki18n (lib.getLib kwallet) ];
-
-    preInstall = ''
-      mkdir -p $out/bin $out/share/man/man1
-    '';
-
-    meta = with lib; {
-      description = "Command-Line Interface to the KDE Wallet";
-      homepage = http://www.mirbsd.org/kwalletcli.htm;
-      license = licenses.miros;
-      maintainers = with maintainers; [ peterhoeg ];
-    };
+  src = fetchurl {
+    url = "https://www.mirbsd.org/MirOS/dist/hosted/kwalletcli/${name}.tar.gz";
+    sha256 = "1q87nm7pkmgvkrml6hgbmv0ddx3871w7x86gn90sjc3vw59qfh98";
   };
 
-in kdeWrapper {
-  inherit unwrapped;
-  targets = map (b: "bin/" + b)
-    [ "kwalletaskpass" "kwalletcli" "kwalletcli_getpin" "pinentry-kwallet" ];
-  paths = [ mksh ];
+  postPatch = ''
+    substituteInPlace GNUmakefile \
+      --replace '-I/usr/include/KF5/KCoreAddons' '-I${kcoreaddons.dev}/include/KF5/KCoreAddons' \
+      --replace '-I/usr/include/KF5/KI18n'       '-I${ki18n.dev}/include/KF5/KI18n' \
+      --replace '-I/usr/include/KF5/KWallet'     '-I${kwallet.dev}/include/KF5/KWallet' \
+      --replace /usr/bin                         $out/bin \
+      --replace /usr/share/man                   $out/share/man
+  '';
+
+  makeFlags = [ "KDE_VER=5" ];
+
+  # we need this when building against qt 5.8+
+  NIX_CFLAGS_COMPILE = [ "-std=c++11" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  # if using just kwallet, cmake will be added as a buildInput and fail the build
+  propagatedBuildInputs = [ kcoreaddons ki18n (lib.getLib kwallet) ];
+  propagatedUserEnvPkgs = [ mksh ];
+
+  preInstall = ''
+    mkdir -p $out/bin $out/share/man/man1
+  '';
+
+  meta = with lib; {
+    description = "Command-Line Interface to the KDE Wallet";
+    homepage = http://www.mirbsd.org/kwalletcli.htm;
+    license = licenses.miros;
+    maintainers = with maintainers; [ peterhoeg ];
+  };
 }
diff --git a/pkgs/tools/security/logkeys/default.nix b/pkgs/tools/security/logkeys/default.nix
index b856308712f8..2d58bcc9a230 100644
--- a/pkgs/tools/security/logkeys/default.nix
+++ b/pkgs/tools/security/logkeys/default.nix
@@ -15,6 +15,7 @@ stdenv.mkDerivation rec {
   postPatch = ''
     substituteInPlace src/Makefile.in --replace 'root' '$(id -u)'
     substituteInPlace configure --replace '/dev/input' '/tmp'
+    sed -i '/chmod u+s/d' src/Makefile.in
  '';
 
   meta = with stdenv.lib; {
diff --git a/pkgs/tools/security/nmap/default.nix b/pkgs/tools/security/nmap/default.nix
index aefa82128ac1..6495634da33b 100644
--- a/pkgs/tools/security/nmap/default.nix
+++ b/pkgs/tools/security/nmap/default.nix
@@ -19,11 +19,11 @@ let
 
 in stdenv.mkDerivation rec {
   name = "nmap${optionalString graphicalSupport "-graphical"}-${version}";
-  version = "7.40";
+  version = "7.50";
 
   src = fetchurl {
     url = "https://nmap.org/dist/nmap-${version}.tar.bz2";
-    sha256 = "121i9mgyc28ra2825akd0ix5qyssv4xc2qlx296mam6hzxgnc54y";
+    sha256 = "1ckl2qxqxkrfa2qxdrqyaa4k1hhj273aqckrc46fijdz0a76mag9";
   };
 
   patches = ./zenmap.patch;
diff --git a/pkgs/tools/security/sudo/default.nix b/pkgs/tools/security/sudo/default.nix
index 785ba93f1371..840d24f6e67d 100644
--- a/pkgs/tools/security/sudo/default.nix
+++ b/pkgs/tools/security/sudo/default.nix
@@ -14,6 +14,11 @@ stdenv.mkDerivation rec {
     sha256 = "07fvh8qy0l1h93lccc625f48d8yp0pkp5rjjykq13pb07ar0x64y";
   };
 
+  prePatch = ''
+    # do not set sticky bit in nix store
+    substituteInPlace src/Makefile.in --replace 04755 0755
+  '';
+
   configureFlags = [
     "--with-env-editor"
     "--with-editor=/run/current-system/sw/bin/nano"
diff --git a/pkgs/tools/security/super/default.nix b/pkgs/tools/security/super/default.nix
index abfdf8eedca5..866e1f41028b 100644
--- a/pkgs/tools/security/super/default.nix
+++ b/pkgs/tools/security/super/default.nix
@@ -9,6 +9,13 @@ stdenv.mkDerivation rec {
     sha256 = "0k476f83w7f45y9jpyxwr00ikv1vhjiq0c26fgjch9hnv18icvwy";
   };
 
+  prePatch = ''
+    # do not set sticky bit in nix store
+    substituteInPlace Makefile.in \
+      --replace "-o root" "" \
+      --replace 04755 755
+  '';
+
   patches = [
    (fetchpatch { url = http://anonscm.debian.org/cgit/users/robert/super.git/plain/debian/patches/14-Fix-unchecked-setuid-call.patch;
                  sha256 = "08m9hw4kyfjv0kqns1cqha4v5hkgp4s4z0q1rgif1fnk14xh7wqh";
diff --git a/pkgs/tools/security/vulnix/requirements.nix b/pkgs/tools/security/vulnix/requirements.nix
index 952dc1ce652f..c1cbf9c4d3b0 100644
--- a/pkgs/tools/security/vulnix/requirements.nix
+++ b/pkgs/tools/security/vulnix/requirements.nix
@@ -26,6 +26,7 @@ rec {
       url = "https://pypi.python.org/packages/52/b3/a96d62711a26d8cfbe546519975dc9ed54d2eb50b3238d2e6de045764796/ZConfig-3.1.0.tar.gz";
       sha256 = "c21fa3a073a56925a8098036d46717392994a92cffea1b3cda3176b70c0a842e";
     };
+    propagatedBuildInputs = [ pythonPackages.zope_testrunner ];
     meta = with stdenv.lib; {
       homepage = "";
       license = licenses.zpt21;
diff --git a/pkgs/tools/system/at/install.patch b/pkgs/tools/system/at/install.patch
index 0297d680aa46..35be4af875a3 100644
--- a/pkgs/tools/system/at/install.patch
+++ b/pkgs/tools/system/at/install.patch
@@ -20,7 +20,7 @@
 +	$(INSTALL) -m 755 -d $(IROOT)$(sbindir)
 +	$(INSTALL) -m 755 -d $(IROOT)$(docdir)
 +	$(INSTALL) -m 755 -d $(IROOT)$(atdocdir)
-+	$(INSTALL) -m 6755 -s at $(IROOT)$(bindir)
++	$(INSTALL) -m 0755 -s at $(IROOT)$(bindir)
  	$(LN_S) -f at $(IROOT)$(bindir)/atq
  	$(LN_S) -f at $(IROOT)$(bindir)/atrm
 -	$(INSTALL) -g root -o root -m 755 batch $(IROOT)$(bindir)
diff --git a/pkgs/tools/system/cron/default.nix b/pkgs/tools/system/cron/default.nix
index 910bee727bb9..4a8babfd6302 100644
--- a/pkgs/tools/system/cron/default.nix
+++ b/pkgs/tools/system/cron/default.nix
@@ -12,7 +12,8 @@ stdenv.mkDerivation {
   hardeningEnable = [ "pie" ];
 
   preBuild = ''
-    substituteInPlace Makefile --replace ' -o root' ' ' --replace 111 755
+    # do not set sticky bit in /nix/store 
+    substituteInPlace Makefile --replace ' -o root' ' ' --replace 111 755 --replace 4755 0755
     makeFlags="DESTROOT=$out CC=cc"
 
     # We want to ignore the $glibc/include/paths.h definition of
diff --git a/pkgs/tools/system/fakeroot/default.nix b/pkgs/tools/system/fakeroot/default.nix
index 5286b6b2cbc9..eca3977f459f 100644
--- a/pkgs/tools/system/fakeroot/default.nix
+++ b/pkgs/tools/system/fakeroot/default.nix
@@ -9,8 +9,9 @@ stdenv.mkDerivation rec {
     sha256 = "0313xb2j6a4wihrw9gfd4rnyqw7zzv6wf3rfh2gglgnv356ic2kw";
   };
 
+  patches = stdenv.lib.optional stdenv.isLinux ./einval.patch
   # patchset from brew
-  patches = stdenv.lib.optionals stdenv.isDarwin [
+  ++ stdenv.lib.optionals stdenv.isDarwin [
     (fetchpatch {
       name = "0001-Implement-openat-2-wrapper-which-handles-optional-ar.patch";
       url = "https://bugs.debian.org/cgi-bin/bugreport.cgi?msg=5;filename=0001-Implement-openat-2-wrapper-which-handles-optional-ar.patch;att=1;bug=766649";
@@ -26,7 +27,7 @@ stdenv.mkDerivation rec {
       url = "https://bugs.debian.org/cgi-bin/bugreport.cgi?att=2;bug=766649;filename=fakeroot-always-pass-mode.patch;msg=20";
       sha256 = "0i3zaca1v449dm9m1cq6wq4dy6hc2y04l05m9gg8d4y4swld637p";
     })
-    ];
+  ];
 
   buildInputs = [ getopt ]
     ++ stdenv.lib.optional (!stdenv.isDarwin) libcap
diff --git a/pkgs/tools/system/fakeroot/einval.patch b/pkgs/tools/system/fakeroot/einval.patch
new file mode 100644
index 000000000000..f8d4fb83d137
--- /dev/null
+++ b/pkgs/tools/system/fakeroot/einval.patch
@@ -0,0 +1,47 @@
+Ignore EINVAL errors.  This matters within user namespaces.
+
+See:
+https://github.com/NixOS/nixpkgs/issues/25901
+https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=802612
+https://github.com/NixOS/nixpkgs/issues/10496
+
+diff --git a/libfakeroot.c b/libfakeroot.c
+index 68a95fb..70da8bc 100644
+--- a/libfakeroot.c
++++ b/libfakeroot.c
+@@ -792,7 +792,7 @@ int chown(const char *path, uid_t owner, gid_t group){
+     r=next_lchown(path,owner,group);
+   else
+     r=0;
+-  if(r&&(errno==EPERM))
++  if(r&&(errno==EPERM||errno==EINVAL))
+     r=0;
+
+   return r;
+@@ -819,7 +819,7 @@ int lchown(const char *path, uid_t owner, gid_t group){
+     r=next_lchown(path,owner,group);
+   else
+     r=0;
+-  if(r&&(errno==EPERM))
++  if(r&&(errno==EPERM||errno==EINVAL))
+     r=0;
+
+   return r;
+@@ -843,7 +843,7 @@ int fchown(int fd, uid_t owner, gid_t group){
+   else
+     r=0;
+
+-  if(r&&(errno==EPERM))
++  if(r&&(errno==EPERM||errno==EINVAL))
+     r=0;
+
+   return r;
+@@ -870,7 +870,7 @@ int fchownat(int dir_fd, const char *path, uid_t owner, gid_t group, int flags)
+   else
+     r=0;
+
+-  if(r&&(errno==EPERM))
++  if(r&&(errno==EPERM||errno==EINVAL))
+     r=0;
+
+   return r;
diff --git a/pkgs/tools/system/logcheck/default.nix b/pkgs/tools/system/logcheck/default.nix
index 40cee73dcd29..f27a0cbcb999 100644
--- a/pkgs/tools/system/logcheck/default.nix
+++ b/pkgs/tools/system/logcheck/default.nix
@@ -10,6 +10,11 @@ stdenv.mkDerivation rec {
     sha256 = "1x4skb5nmv2xj8cygj8pq1rd1ws4m2fsibw54yslgdyjri4r2yq7";
   };
 
+  prePatch = ''
+    # do not set sticky bit in nix store.
+    substituteInPlace Makefile --replace 2750 0750
+  '';
+
   preConfigure = ''
     substituteInPlace src/logtail --replace "/usr/bin/perl" "${perl}/bin/perl"
     substituteInPlace src/logtail2 --replace "/usr/bin/perl" "${perl}/bin/perl"
diff --git a/pkgs/tools/system/ps_mem/default.nix b/pkgs/tools/system/ps_mem/default.nix
new file mode 100644
index 000000000000..bbac78f4864b
--- /dev/null
+++ b/pkgs/tools/system/ps_mem/default.nix
@@ -0,0 +1,23 @@
+{ stdenv, pythonPackages, fetchFromGitHub }:
+
+let
+  version = "3.9";
+  pname = "ps_mem";
+in pythonPackages.buildPythonApplication rec {
+  name = "${pname}-${version}";
+
+  src = fetchFromGitHub {
+    owner = "pixelb";
+    repo = "${pname}";
+    rev = "f0891def54f1edb78a70006603d2b025236b830f";
+    sha256 = "1vy0z5nhia61hpqndf7kkjm12mgi0kh33jx5g1glggy45ymcisif";
+  };
+
+  meta = with stdenv.lib; {
+    description = "A utility to accurately report the in core memory usage for a program";
+    homepage = https://github.com/pixelb/ps_mem;
+    license = licenses.lgpl21;
+    maintainers = [ maintainers.gnidorah ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/tools/text/kdiff3/default.nix b/pkgs/tools/text/kdiff3/default.nix
index 124855525ac6..e1a2f157085f 100644
--- a/pkgs/tools/text/kdiff3/default.nix
+++ b/pkgs/tools/text/kdiff3/default.nix
@@ -1,51 +1,44 @@
 {
-  kdeDerivation, kdeWrapper, lib, fetchgit, fetchpatch,
-  extra-cmake-modules, kdoctools, kconfig, kinit, kparts
+  mkDerivation, lib, fetchgit, fetchpatch,
+  extra-cmake-modules, kdoctools, wrapGAppsHook,
+  kconfig, kinit, kparts
 }:
 
-let
-  unwrapped = kdeDerivation rec {
-    name = "kdiff3-${version}";
-    version = "1.7.0-2017-02-19";
-
-    src = fetchgit {
-      # gitlab is outdated
-      url = https://anongit.kde.org/scratch/thomasfischer/kdiff3.git;
-      sha256 = "0znlk9m844a6qsskbd898w4yk48dkg5bkqlkd5abvyrk1jipzyy8";
-      rev = "0d2ac328164e3cbe2db35875d3df3a86187ae84f";
-    };
-
-    setSourceRoot = ''sourceRoot="$(echo */kdiff3/)"'';
-
-    patches = [
-      (fetchpatch {
-        name = "git-mergetool.diff"; # see https://gitlab.com/tfischer/kdiff3/merge_requests/2
-        url = "https://gitlab.com/vcunat/kdiff3/commit/6106126216.patch";
-        sha256 = "16xqc24y8bg8gzkdbwapiwi68rzqnkpz4hgn586mi01ngig2fd7y";
-      })
-    ];
-    patchFlags = "-p 2";
-
-    postPatch = ''
-      sed -re "s/(p\\[[^]]+] *== *)('([^']|\\\\')+')/\\1QChar(\\2)/g" -i src/diff.cpp
-    '';
-
-    nativeBuildInputs = [ extra-cmake-modules kdoctools ];
-
-    propagatedBuildInputs = [ kconfig kinit kparts ];
-
-    enableParallelBuilding = true;
-
-    meta = with lib; {
-      homepage = http://kdiff3.sourceforge.net/;
-      license = licenses.gpl2Plus;
-      description = "Compares and merges 2 or 3 files or directories";
-      maintainers = with maintainers; [ viric peterhoeg ];
-      platforms = with platforms; linux;
-    };
+mkDerivation rec {
+  name = "kdiff3-${version}";
+  version = "1.7.0-2017-02-19";
+
+  src = fetchgit {
+    # gitlab is outdated
+    url = https://anongit.kde.org/scratch/thomasfischer/kdiff3.git;
+    sha256 = "0znlk9m844a6qsskbd898w4yk48dkg5bkqlkd5abvyrk1jipzyy8";
+    rev = "0d2ac328164e3cbe2db35875d3df3a86187ae84f";
   };
 
-in kdeWrapper {
-  inherit unwrapped;
-  targets = [ "bin/kdiff3" ];
+  setSourceRoot = ''sourceRoot="$(echo */kdiff3/)"'';
+
+  patches = [
+    (fetchpatch {
+      name = "git-mergetool.diff"; # see https://gitlab.com/tfischer/kdiff3/merge_requests/2
+      url = "https://gitlab.com/vcunat/kdiff3/commit/6106126216.patch";
+      sha256 = "16xqc24y8bg8gzkdbwapiwi68rzqnkpz4hgn586mi01ngig2fd7y";
+    })
+  ];
+  patchFlags = "-p 2";
+
+  postPatch = ''
+    sed -re "s/(p\\[[^]]+] *== *)('([^']|\\\\')+')/\\1QChar(\\2)/g" -i src/diff.cpp
+  '';
+
+  nativeBuildInputs = [ extra-cmake-modules kdoctools wrapGAppsHook ];
+
+  propagatedBuildInputs = [ kconfig kinit kparts ];
+
+  meta = with lib; {
+    homepage = http://kdiff3.sourceforge.net/;
+    license = licenses.gpl2Plus;
+    description = "Compares and merges 2 or 3 files or directories";
+    maintainers = with maintainers; [ viric peterhoeg ];
+    platforms = with platforms; linux;
+  };
 }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index d929c23dd8cd..bf94bb7045ae 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -292,13 +292,6 @@ with pkgs;
       inherit kernel rootModules allowMissing;
     };
 
-  kdeDerivation = makeOverridable (import ../build-support/kde/derivation.nix)
-    { inherit stdenv lib; };
-
-  kdeWrapper = callPackage ../build-support/kde/wrapper.nix {
-    inherit (gnome3) dconf;
-  };
-
   nixBufferBuilders = import ../build-support/emacs/buffer.nix { inherit (pkgs) lib writeText; inherit (emacsPackagesNg) inherit-local; };
 
   pathsFromGraph = ../build-support/kernel/paths-from-graph.pl;
@@ -1066,6 +1059,8 @@ with pkgs;
 
   playerctl = callPackage ../tools/audio/playerctl { };
 
+  ps_mem = callPackage ../tools/system/ps_mem { };
+
   socklog = callPackage ../tools/system/socklog { };
 
   staccato = callPackage ../tools/text/staccato { };
@@ -1542,6 +1537,8 @@ with pkgs;
 
   ddccontrol-db = callPackage ../data/misc/ddccontrol-db { };
 
+  ddcutil = callPackage ../tools/misc/ddcutil { };
+
   ddclient = callPackage ../tools/networking/ddclient { };
 
   dd_rescue = callPackage ../tools/system/dd_rescue { };
@@ -2965,6 +2962,8 @@ with pkgs;
 
   lshw = callPackage ../tools/system/lshw { };
 
+  ltris = callPackage ../games/ltris { };
+
   lxc = callPackage ../os-specific/linux/lxc { };
   lxcfs = callPackage ../os-specific/linux/lxcfs { };
   lxd = callPackage ../tools/admin/lxd { };
@@ -4045,7 +4044,7 @@ with pkgs;
   };
 
   quazip_qt4 = libsForQt5.quazip.override {
-    qtbase = qt4; qmakeHook = qmake4Hook;
+    qtbase = qt4; qmake = qmake4Hook;
   };
 
   scrot = callPackage ../tools/graphics/scrot { };
@@ -6787,6 +6786,7 @@ with pkgs;
   gradle = self.gradleGen.gradle_latest;
   gradle_2_14 = self.gradleGen.gradle_2_14;
   gradle_2_5 = self.gradleGen.gradle_2_5;
+  gradle_3_5 = self.gradleGen.gradle_3_5;
 
   gperf = callPackage ../development/tools/misc/gperf { };
   # 3.1 changed some parameters from int to size_t, leading to mismatches.
@@ -7062,6 +7062,7 @@ with pkgs;
   scons = callPackage ../development/tools/build-managers/scons { };
 
   sbt = callPackage ../development/tools/build-managers/sbt { };
+  sbt-with-scala-native = callPackage ../development/tools/build-managers/sbt/scala-native.nix { };
   simpleBuildTool = sbt;
 
   shards = callPackage ../development/tools/build-managers/shards { };
@@ -8227,7 +8228,7 @@ with pkgs;
       mkFrameworks = import ../development/libraries/kde-frameworks;
       attrs = {
         inherit libsForQt5;
-        inherit kdeDerivation lib fetchurl;
+        inherit lib fetchurl;
       };
     in
       recurseIntoAttrs (makeOverridable mkFrameworks attrs);
@@ -9755,7 +9756,7 @@ with pkgs;
       knotifyconfig kpackage kparts kpeople kplotting kpty kross krunner
       kservice ktexteditor ktextwidgets kunitconversion kwallet kwayland
       kwidgetsaddons kwindowsystem kxmlgui kxmlrpcclient modemmanager-qt
-      networkmanager-qt plasma-framework solid sonnet syntax-highlighting
+      networkmanager-qt plasma-framework prison solid sonnet syntax-highlighting
       threadweaver;
 
     ### KDE PLASMA 5
@@ -9774,6 +9775,8 @@ with pkgs;
 
     fcitx-qt5 = callPackage ../tools/inputmethods/fcitx/fcitx-qt5.nix { };
 
+    qgpgme = callPackage ../development/libraries/gpgme { };
+
     grantlee = callPackage ../development/libraries/grantlee/5.x.nix { };
 
     inherit (callPackage ../development/libraries/kirigami { })
@@ -11542,9 +11545,7 @@ with pkgs;
 
   cifs-utils = callPackage ../os-specific/linux/cifs-utils { };
 
-  cockroachdb = callPackage ../servers/sql/cockroachdb {
-    gcc = gcc6; # needs gcc 6.0 and above
-  };
+  cockroachdb = callPackage ../servers/sql/cockroachdb { };
 
   conky = callPackage ../os-specific/linux/conky ({
     lua = lua5_1; # conky can use 5.2, but toluapp can not
@@ -12008,6 +12009,8 @@ with pkgs;
     nvidia_x11_beta      = nvidiaPackages.beta;
     nvidia_x11           = nvidiaPackages.stable;
 
+    ply = callPackage ../os-specific/linux/ply { };
+
     rtl8723bs = callPackage ../os-specific/linux/rtl8723bs { };
 
     rtl8812au = callPackage ../os-specific/linux/rtl8812au { };
@@ -14614,17 +14617,17 @@ with pkgs;
       mkApplications = import ../applications/kde;
       attrs = {
         inherit stdenv lib libsForQt5 fetchurl recurseIntoAttrs;
-        inherit kdeDerivation plasma5;
+        inherit plasma5;
         inherit attica phonon;
       };
     in
       recurseIntoAttrs (makeOverridable mkApplications attrs);
 
   inherit (kdeApplications)
-    akonadi ark dolphin ffmpegthumbs filelight gwenview kate
-    kdenlive kcalc kcolorchooser kcontacts kgpg khelpcenter kig
-    kolourpaint konsole krfb marble
-    okteta okular spectacle;
+    akonadi ark dolphin ffmpegthumbs filelight gwenview kate kdenlive
+    kcachegrind kcalc kcolorchooser kcontacts kdf kgpg khelpcenter kig kmix
+    kolourpaint kompare konsole krfb kwalletmanager marble okteta okular
+    spectacle;
 
   kdeconnect = libsForQt5.callPackage ../applications/misc/kdeconnect { };
 
@@ -15535,6 +15538,8 @@ with pkgs;
   # 0.5.7 segfaults when opening the main panel with qt 5.7 and fails to compile with qt 5.8
   qsyncthingtray = libsForQt56.callPackage ../applications/misc/qsyncthingtray { };
 
+  qstopmotion = callPackage ../applications/video/qstopmotion { };
+
   qsynth = callPackage ../applications/audio/qsynth { };
 
   qtbitcointrader = callPackage ../applications/misc/qtbitcointrader { };
@@ -15657,7 +15662,7 @@ with pkgs;
 
   rofi-menugen = callPackage ../applications/misc/rofi-menugen { };
 
-  rstudio = callPackage ../applications/editors/rstudio { };
+  rstudio = libsForQt5.callPackage ../applications/editors/rstudio { };
 
   rsync = callPackage ../applications/networking/sync/rsync {
     enableACLs = !(stdenv.isDarwin || stdenv.isSunOS || stdenv.isFreeBSD);
@@ -15865,16 +15870,7 @@ with pkgs;
 
   printrun = callPackage ../applications/misc/printrun { };
 
-  sddm = libsForQt5.callPackage ../applications/display-managers/sddm {
-    themes = [];  # extra themes, etc.
-  };
-
-  sddmPlasma5 = sddm.override {
-    themes = [
-      plasma5.plasma-workspace
-      pkgs.breeze-icons
-    ];
-  };
+  sddm = libsForQt5.callPackage ../applications/display-managers/sddm { };
 
   skrooge = libsForQt5.callPackage ../applications/office/skrooge {};
 
@@ -17562,7 +17558,7 @@ with pkgs;
     let
       mkPlasma5 = import ../desktops/plasma-5;
       attrs = {
-        inherit libsForQt5 kdeDerivation lib fetchurl;
+        inherit libsForQt5 lib fetchurl;
         inherit (gnome3) gconf;
       };
     in
diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix
index 2f21d2a5d74a..099e45f10226 100644
--- a/pkgs/top-level/haskell-packages.nix
+++ b/pkgs/top-level/haskell-packages.nix
@@ -68,6 +68,13 @@ in rec {
       inherit (bootPkgs) hscolour;
       sphinx = pkgs.python27Packages.sphinx;
     };
+    ghc821 = callPackage ../development/compilers/ghc/8.2.1.nix rec {
+      bootPkgs = packages.ghc802;
+      inherit (bootPkgs) hscolour alex happy;
+      inherit buildPlatform targetPlatform;
+      sphinx = pkgs.python3Packages.sphinx;
+      selfPkgs = packages.ghc821;
+    };
     ghcHEAD = callPackage ../development/compilers/ghc/head.nix rec {
       bootPkgs = packages.ghc7103;
       inherit (bootPkgs) alex happy;
@@ -156,6 +163,10 @@ in rec {
       ghc = compiler.ghc802;
       compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.0.x.nix { };
     };
+    ghc821 = callPackage ../development/haskell-modules {
+      ghc = compiler.ghc821;
+      compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { };
+    };
     ghcHEAD = callPackage ../development/haskell-modules {
       ghc = compiler.ghcHEAD;
       compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { };
@@ -165,6 +176,10 @@ in rec {
       ghc = compiler.ghcHEAD.crossCompiler;
       compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { };
     };
+    ghcCross821 = callPackage ../development/haskell-modules {
+      ghc = compiler.ghc821.crossCompiler;
+      compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { };
+    };
     ghcjs = callPackage ../development/haskell-modules {
       ghc = compiler.ghcjs;
       compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { };
diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix
index e182abf1c113..d93a3a012c1d 100644
--- a/pkgs/top-level/python-packages.nix
+++ b/pkgs/top-level/python-packages.nix
@@ -2516,10 +2516,10 @@ in {
   defusedxml = buildPythonPackage rec {
     name = "${pname}-${version}";
     pname = "defusedxml";
-    version = "0.4.1";
+    version = "0.5.0";
     src = pkgs.fetchurl {
       url = "mirror://pypi/d/${pname}/${name}.tar.gz";
-      sha256 = "0y147zy3jqmk6ly7fbhqmzn1hf41xcb53f2vcc3m8x4ba5d1smfd";
+      sha256 = "1x54n0h8hl92vvwyymx883fbqpqjwn2mc8fb383bcg3z9zwz5mr4";
     };
   };
 
@@ -11654,14 +11654,14 @@ in {
 
   glances = buildPythonPackage rec {
     name = "glances-${version}";
-    version = "2.9.1";
+    version = "2.10";
     disabled = isPyPy;
 
     src = pkgs.fetchFromGitHub {
       owner = "nicolargo";
       repo = "glances";
       rev = "v${version}";
-      sha256 = "13pnim8zxqbw5b1jkl1ggqn2rg5kfwhznw42ckizrhg73ngy9yyp";
+      sha256 = "0hxs9bplxvj6grq9dqinr4f5ip6ray6mrw54scrcaqal8f3c8ah2";
     };
 
     doCheck = false;
@@ -11914,26 +11914,7 @@ in {
 
   guessit = callPackage ../development/python-modules/guessit { };
 
-  rebulk = buildPythonPackage rec {
-    version = "0.8.2";
-    name = "rebulk-${version}";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/r/rebulk/${name}.tar.gz";
-      sha256 = "8c09901bda7b79a21d46faf489d67d017aa54d38bdabdb53f824068a6640401a";
-    };
-
-    # Some kind of trickery with imports that doesn't work.
-    doCheck = false;
-    buildInputs = with self; [ pytest pytestrunner ];
-    propagatedBuildInputs = with self; [ six regex ];
-
-    meta = {
-      homepage = "https://github.com/Toilal/rebulk/";
-      license = licenses.mit;
-      description = "Advanced string matching from simple patterns";
-    };
-  };
+  rebulk = callPackage ../development/python-modules/rebulk { };
 
   gunicorn = callPackage ../development/python-modules/gunicorn.nix { };
 
@@ -17006,21 +16987,7 @@ in {
     '';
   };
 
-  oslo-config = buildPythonPackage rec {
-    name = "oslo.config-${version}";
-    version = "2.5.0";
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/o/oslo.config/${name}.tar.gz";
-      sha256 = "043mavrzj7vjn7kh1dddci4sf67qwqnnn6cm0k1d19alks9hismz";
-    };
-
-    propagatedBuildInputs = with self; [ argparse pbr six netaddr stevedore ];
-    buildInputs = [ self.mock ];
-
-    # TODO: circular import on oslo-i18n
-    doCheck = false;
-  };
+  oslo-config = callPackage ../development/python-modules/oslo-config { };
 
   oslotest = buildPythonPackage rec {
     name = "oslotest-${version}";
@@ -17060,24 +17027,7 @@ in {
     '';
   };
 
-  keystoneauth1 = buildPythonPackage rec {
-    name = "keystoneauth1-${version}";
-    version = "1.1.0";
-    disabled = isPyPy; # a test fails
-
-    src = pkgs.fetchurl {
-      url = "mirror://pypi/k/keystoneauth1/${name}.tar.gz";
-      sha256 = "05fc6xsp5mal52ijvj84sf7mrw706ihadfdf5mnq9zxn7pfl4118";
-    };
-
-    buildInputs = with self; [ pbr testtools testresources testrepository mock
-                               pep8 fixtures mox3 requests-mock ];
-    propagatedBuildInputs = with self; [ argparse iso8601 requests six stevedore
-                                         webob oslo-config ];
-    patchPhase = ''
-      sed -i 's@python@${python.interpreter}@' .testr.conf
-    '';
-  };
+  keystoneauth1 = callPackage ../development/python-modules/keystoneauth1 {};
 
   requests-mock = buildPythonPackage rec {
     name = "requests-mock-${version}";
diff --git a/pkgs/top-level/rust-packages.nix b/pkgs/top-level/rust-packages.nix
index 2fa9ac926d75..45e4d8e812e7 100644
--- a/pkgs/top-level/rust-packages.nix
+++ b/pkgs/top-level/rust-packages.nix
@@ -7,9 +7,9 @@
 { runCommand, fetchFromGitHub, git }:
 
 let
-  version = "2017-05-31";
-  rev = "d85037df75a945b5a368d6ceaa7e030b67473a51";
-  sha256 = "0567lfjxvbn4pb39557yfdq1nm4ssgbvzvzkrdqnx9sx5xyx7n4s";
+  version = "2017-06-16";
+  rev = "cda0f689f844710a3d73c7ff459efa64997f73b5";
+  sha256 = "1b3brl9nn3qqaysd8lx9gaazd863grqx547iw7y9j6mkcc7sakvc";
 
   src = fetchFromGitHub {
       inherit rev;