summary refs log tree commit diff
diff options
context:
space:
mode:
authorThomas Tuegel2017-02-27 11:58:53 -0600
committerGitHub2017-02-27 11:58:53 -0600
commit7ef26640f604f7745d07fde71aaa401a3c211149 (patch)
tree902e6583e0340635f17a59d556d7e0ef6602026d
parent6018cf4a692b5e12e433cc332f8d8f79ccd57ba1 (diff)
parente02b544e4d131d0f8223a84b56b146361d4be838 (diff)
Merge pull request #23239 from ttuegel/shuffle-kde
Organize KDE packages correctly
-rw-r--r--doc/languages-frameworks/qt.xml62
-rw-r--r--lib/customisation.nix7
-rw-r--r--nixos/modules/i18n/input-method/ibus.nix2
-rw-r--r--nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix2
-rw-r--r--nixos/modules/rename.nix3
-rw-r--r--nixos/modules/security/pam.nix8
-rw-r--r--nixos/modules/services/x11/desktop-managers/default.nix4
-rw-r--r--nixos/modules/services/x11/desktop-managers/kde5.nix258
-rw-r--r--nixos/modules/services/x11/desktop-managers/lumina.nix4
-rw-r--r--nixos/modules/services/x11/desktop-managers/plasma5.nix241
-rw-r--r--pkgs/applications/audio/i-score/default.nix4
-rw-r--r--pkgs/applications/editors/kile/default.nix82
-rw-r--r--pkgs/applications/editors/kile/frameworks.nix68
-rw-r--r--pkgs/applications/graphics/digikam/default.nix4
-rw-r--r--pkgs/applications/graphics/kipi-plugins/default.nix4
-rw-r--r--pkgs/applications/kde/akonadi-contacts.nix (renamed from pkgs/desktops/kde-5/applications/akonadi-contacts.nix)4
-rw-r--r--pkgs/applications/kde/akonadi-mime.nix (renamed from pkgs/desktops/kde-5/applications/akonadi-mime.nix)4
-rw-r--r--pkgs/applications/kde/akonadi.nix (renamed from pkgs/desktops/kde-5/applications/akonadi.nix)4
-rw-r--r--pkgs/applications/kde/ark/default.nix (renamed from pkgs/desktops/kde-5/applications/ark/default.nix)20
-rw-r--r--pkgs/applications/kde/baloo-widgets.nix (renamed from pkgs/desktops/kde-5/applications/baloo-widgets.nix)4
-rw-r--r--pkgs/applications/kde/build-support/application.nix (renamed from pkgs/desktops/kde-5/applications/kde-app.nix)0
-rw-r--r--pkgs/applications/kde/default.nix93
-rw-r--r--pkgs/applications/kde/dolphin-plugins.nix (renamed from pkgs/desktops/kde-5/applications/dolphin-plugins.nix)4
-rw-r--r--pkgs/applications/kde/dolphin.nix (renamed from pkgs/desktops/kde-5/applications/dolphin.nix)4
-rw-r--r--pkgs/applications/kde/fetch.sh (renamed from pkgs/desktops/kde-5/applications/fetch.sh)0
-rw-r--r--pkgs/applications/kde/ffmpegthumbs.nix (renamed from pkgs/desktops/kde-5/applications/ffmpegthumbs.nix)4
-rw-r--r--pkgs/applications/kde/filelight.nix (renamed from pkgs/desktops/kde-5/applications/filelight.nix)4
-rw-r--r--pkgs/applications/kde/gwenview.nix (renamed from pkgs/desktops/kde-5/applications/gwenview.nix)4
-rw-r--r--pkgs/applications/kde/kate.nix (renamed from pkgs/desktops/kde-5/applications/kate.nix)4
-rw-r--r--pkgs/applications/kde/kcalc.nix (renamed from pkgs/desktops/kde-5/applications/kcalc.nix)4
-rw-r--r--pkgs/applications/kde/kcolorchooser.nix (renamed from pkgs/desktops/kde-5/applications/kcolorchooser.nix)4
-rw-r--r--pkgs/applications/kde/kcontacts.nix (renamed from pkgs/desktops/kde-5/applications/kcontacts.nix)4
-rw-r--r--pkgs/applications/kde/kde-locale-4.nix (renamed from pkgs/desktops/kde-5/applications/kde-locale-4.nix)0
-rw-r--r--pkgs/applications/kde/kde-locale-5.nix (renamed from pkgs/desktops/kde-5/applications/kde-locale-5.nix)4
-rw-r--r--pkgs/applications/kde/kdegraphics-mobipocket.nix (renamed from pkgs/desktops/kde-5/applications/kdegraphics-mobipocket.nix)4
-rw-r--r--pkgs/applications/kde/kdegraphics-thumbnailers.nix (renamed from pkgs/desktops/kde-5/applications/kdegraphics-thumbnailers.nix)4
-rw-r--r--pkgs/applications/kde/kdelibs/0001-old-kde4-cmake-policies.patch (renamed from pkgs/desktops/kde-5/applications/kdelibs/0001-old-kde4-cmake-policies.patch)0
-rw-r--r--pkgs/applications/kde/kdelibs/0002-polkit-install-path.patch (renamed from pkgs/desktops/kde-5/applications/kdelibs/0002-polkit-install-path.patch)0
-rw-r--r--pkgs/applications/kde/kdelibs/0003-remove_xdg_impurities.patch (renamed from pkgs/desktops/kde-5/applications/kdelibs/0003-remove_xdg_impurities.patch)0
-rw-r--r--pkgs/applications/kde/kdelibs/default.nix (renamed from pkgs/desktops/kde-5/applications/kdelibs/default.nix)2
-rw-r--r--pkgs/applications/kde/kdenetwork-filesharing.nix (renamed from pkgs/desktops/kde-5/applications/kdenetwork-filesharing.nix)4
-rw-r--r--pkgs/applications/kde/kdenlive.nix (renamed from pkgs/desktops/kde-5/applications/kdenlive.nix)0
-rw-r--r--pkgs/applications/kde/kdf.nix (renamed from pkgs/desktops/kde-5/applications/kdf.nix)4
-rw-r--r--pkgs/applications/kde/kgpg.nix (renamed from pkgs/desktops/kde-5/applications/kgpg.nix)4
-rw-r--r--pkgs/applications/kde/khelpcenter.nix (renamed from pkgs/desktops/kde-5/applications/khelpcenter.nix)4
-rw-r--r--pkgs/applications/kde/kig.nix (renamed from pkgs/desktops/kde-5/applications/kig.nix)4
-rw-r--r--pkgs/applications/kde/kio-extras.nix (renamed from pkgs/desktops/kde-5/applications/kio-extras.nix)4
-rw-r--r--pkgs/applications/kde/kmime.nix (renamed from pkgs/desktops/kde-5/applications/kmime.nix)4
-rw-r--r--pkgs/applications/kde/kmix.nix (renamed from pkgs/desktops/kde-5/applications/kmix.nix)4
-rw-r--r--pkgs/applications/kde/kompare.nix (renamed from pkgs/desktops/kde-5/applications/kompare.nix)4
-rw-r--r--pkgs/applications/kde/konsole.nix (renamed from pkgs/desktops/kde-5/applications/konsole.nix)4
-rw-r--r--pkgs/applications/kde/kwalletmanager.nix (renamed from pkgs/desktops/kde-5/applications/kwalletmanager.nix)4
-rw-r--r--pkgs/applications/kde/l10n.nix (renamed from pkgs/desktops/kde-5/applications/l10n.nix)4
-rw-r--r--pkgs/applications/kde/libkdcraw.nix (renamed from pkgs/desktops/kde-5/applications/libkdcraw.nix)5
-rw-r--r--pkgs/applications/kde/libkexiv2.nix (renamed from pkgs/desktops/kde-5/applications/libkexiv2.nix)5
-rw-r--r--pkgs/applications/kde/libkipi.nix (renamed from pkgs/desktops/kde-5/applications/libkipi.nix)4
-rw-r--r--pkgs/applications/kde/libkomparediff2.nix7
-rw-r--r--pkgs/applications/kde/marble.nix (renamed from pkgs/desktops/kde-5/applications/marble.nix)4
-rw-r--r--pkgs/applications/kde/okteta.nix (renamed from pkgs/desktops/kde-5/applications/okteta.nix)4
-rw-r--r--pkgs/applications/kde/okular.nix (renamed from pkgs/desktops/kde-5/applications/okular.nix)4
-rw-r--r--pkgs/applications/kde/print-manager.nix (renamed from pkgs/desktops/kde-5/applications/print-manager.nix)4
-rw-r--r--pkgs/applications/kde/spectacle.nix (renamed from pkgs/desktops/kde-5/applications/spectacle.nix)4
-rw-r--r--pkgs/applications/kde/srcs.nix (renamed from pkgs/desktops/kde-5/applications/srcs.nix)0
-rw-r--r--pkgs/applications/misc/krename/default.nix4
-rw-r--r--pkgs/applications/misc/redshift-plasma-applet/default.nix4
-rw-r--r--pkgs/applications/misc/yakuake/default.nix4
-rw-r--r--pkgs/applications/networking/irc/konversation/default.nix4
-rw-r--r--pkgs/applications/networking/p2p/ktorrent/default.nix4
-rw-r--r--pkgs/applications/networking/sniffers/wireshark/default.nix4
-rw-r--r--pkgs/applications/office/calligra/default.nix4
-rw-r--r--pkgs/applications/office/skrooge/default.nix4
-rw-r--r--pkgs/build-support/kde/derivation.nix17
-rw-r--r--pkgs/build-support/kde/wrapper.nix (renamed from pkgs/development/libraries/kde-frameworks/kde-wrapper.nix)0
-rw-r--r--pkgs/desktops/kde-5/applications/default.nix93
-rw-r--r--pkgs/desktops/kde-5/applications/libkomparediff2.nix7
-rw-r--r--pkgs/desktops/kde-5/plasma/breeze-qt4.nix24
-rw-r--r--pkgs/desktops/kde-5/plasma/default.nix99
-rw-r--r--pkgs/desktops/kde-5/plasma/fetch.sh1
-rw-r--r--pkgs/desktops/kde-5/plasma/kdecoration.nix6
-rw-r--r--pkgs/desktops/kde-5/plasma/kgamma5.nix9
-rw-r--r--pkgs/desktops/kde-5/plasma/khotkeys.nix22
-rw-r--r--pkgs/desktops/kde-5/plasma/kwallet-pam.nix11
-rw-r--r--pkgs/desktops/kde-5/plasma/srcs.nix325
-rw-r--r--pkgs/desktops/lumina/default.nix18
-rw-r--r--pkgs/desktops/lxqt/base/liblxqt/default.nix15
-rw-r--r--pkgs/desktops/lxqt/core/libfm-qt/default.nix15
-rw-r--r--pkgs/desktops/lxqt/core/lxqt-about/default.nix18
-rw-r--r--pkgs/desktops/lxqt/core/lxqt-admin/default.nix18
-rw-r--r--pkgs/desktops/lxqt/core/lxqt-config/default.nix22
-rw-r--r--pkgs/desktops/lxqt/core/lxqt-globalkeys/default.nix20
-rw-r--r--pkgs/desktops/lxqt/core/lxqt-notificationd/default.nix18
-rw-r--r--pkgs/desktops/lxqt/core/lxqt-openssh-askpass/default.nix18
-rw-r--r--pkgs/desktops/lxqt/core/lxqt-panel/default.nix41
-rw-r--r--pkgs/desktops/lxqt/core/lxqt-policykit/default.nix24
-rw-r--r--pkgs/desktops/lxqt/core/lxqt-powermanagement/default.nix22
-rw-r--r--pkgs/desktops/lxqt/core/lxqt-qtplugin/default.nix22
-rw-r--r--pkgs/desktops/lxqt/core/lxqt-runner/default.nix20
-rw-r--r--pkgs/desktops/lxqt/core/lxqt-session/default.nix18
-rw-r--r--pkgs/desktops/lxqt/core/lxqt-sudo/default.nix18
-rw-r--r--pkgs/desktops/lxqt/default.nix20
-rw-r--r--pkgs/desktops/lxqt/optional/compton-conf/default.nix6
-rw-r--r--pkgs/desktops/lxqt/optional/screengrab/default.nix14
-rw-r--r--pkgs/desktops/plasma-5/bluedevil.nix (renamed from pkgs/desktops/kde-5/plasma/bluedevil.nix)4
-rw-r--r--pkgs/desktops/plasma-5/breeze-grub.nix (renamed from pkgs/desktops/kde-5/plasma/breeze-grub.nix)0
-rw-r--r--pkgs/desktops/plasma-5/breeze-gtk.nix (renamed from pkgs/desktops/kde-5/plasma/breeze-gtk.nix)6
-rw-r--r--pkgs/desktops/plasma-5/breeze-plymouth/default.nix (renamed from pkgs/desktops/kde-5/plasma/breeze-plymouth/default.nix)4
-rw-r--r--pkgs/desktops/plasma-5/breeze-plymouth/install-paths.patch (renamed from pkgs/desktops/kde-5/plasma/breeze-plymouth/install-paths.patch)0
-rw-r--r--pkgs/desktops/plasma-5/breeze-plymouth/series (renamed from pkgs/desktops/kde-5/plasma/breeze-plymouth/series)0
-rw-r--r--pkgs/desktops/plasma-5/breeze-qt4.nix16
-rw-r--r--pkgs/desktops/plasma-5/breeze-qt5.nix (renamed from pkgs/desktops/kde-5/plasma/breeze-qt5.nix)4
-rw-r--r--pkgs/desktops/plasma-5/build-support/package.nix27
-rw-r--r--pkgs/desktops/plasma-5/default.nix81
-rw-r--r--pkgs/desktops/plasma-5/fetch.sh1
-rw-r--r--pkgs/desktops/plasma-5/kactivitymanagerd.nix (renamed from pkgs/desktops/kde-5/plasma/kactivitymanagerd.nix)4
-rw-r--r--pkgs/desktops/plasma-5/kde-cli-tools.nix (renamed from pkgs/desktops/kde-5/plasma/kde-cli-tools.nix)4
-rw-r--r--pkgs/desktops/plasma-5/kde-gtk-config/0001-follow-symlinks.patch (renamed from pkgs/desktops/kde-5/plasma/kde-gtk-config/0001-follow-symlinks.patch)0
-rw-r--r--pkgs/desktops/plasma-5/kde-gtk-config/default.nix (renamed from pkgs/desktops/kde-5/plasma/kde-gtk-config/default.nix)4
-rw-r--r--pkgs/desktops/plasma-5/kdecoration.nix7
-rw-r--r--pkgs/desktops/plasma-5/kdeplasma-addons.nix (renamed from pkgs/desktops/kde-5/plasma/kdeplasma-addons.nix)4
-rw-r--r--pkgs/desktops/plasma-5/kgamma5.nix9
-rw-r--r--pkgs/desktops/plasma-5/khotkeys.nix14
-rw-r--r--pkgs/desktops/plasma-5/kinfocenter.nix (renamed from pkgs/desktops/kde-5/plasma/kinfocenter.nix)4
-rw-r--r--pkgs/desktops/plasma-5/kmenuedit.nix (renamed from pkgs/desktops/kde-5/plasma/kmenuedit.nix)4
-rw-r--r--pkgs/desktops/plasma-5/kscreen.nix (renamed from pkgs/desktops/kde-5/plasma/kscreen.nix)4
-rw-r--r--pkgs/desktops/plasma-5/kscreenlocker.nix (renamed from pkgs/desktops/kde-5/plasma/kscreenlocker.nix)4
-rw-r--r--pkgs/desktops/plasma-5/ksshaskpass.nix (renamed from pkgs/desktops/kde-5/plasma/ksshaskpass.nix)4
-rw-r--r--pkgs/desktops/plasma-5/ksysguard.nix (renamed from pkgs/desktops/kde-5/plasma/ksysguard.nix)4
-rw-r--r--pkgs/desktops/plasma-5/kwallet-pam.nix11
-rw-r--r--pkgs/desktops/plasma-5/kwayland-integration.nix (renamed from pkgs/desktops/kde-5/plasma/kwayland-integration.nix)4
-rw-r--r--pkgs/desktops/plasma-5/kwin/default.nix (renamed from pkgs/desktops/kde-5/plasma/kwin/default.nix)4
-rw-r--r--pkgs/desktops/plasma-5/kwin/follow-symlinks.patch (renamed from pkgs/desktops/kde-5/plasma/kwin/follow-symlinks.patch)0
-rw-r--r--pkgs/desktops/plasma-5/kwin/series (renamed from pkgs/desktops/kde-5/plasma/kwin/series)0
-rw-r--r--pkgs/desktops/plasma-5/kwin/xwayland.patch (renamed from pkgs/desktops/kde-5/plasma/kwin/xwayland.patch)0
-rw-r--r--pkgs/desktops/plasma-5/kwrited.nix (renamed from pkgs/desktops/kde-5/plasma/kwrited.nix)4
-rw-r--r--pkgs/desktops/plasma-5/libkscreen.nix (renamed from pkgs/desktops/kde-5/plasma/libkscreen.nix)4
-rw-r--r--pkgs/desktops/plasma-5/libksysguard/0001-qdiriterator-follow-symlinks.patch (renamed from pkgs/desktops/kde-5/plasma/libksysguard/0001-qdiriterator-follow-symlinks.patch)0
-rw-r--r--pkgs/desktops/plasma-5/libksysguard/default.nix (renamed from pkgs/desktops/kde-5/plasma/libksysguard/default.nix)4
-rw-r--r--pkgs/desktops/plasma-5/milou.nix (renamed from pkgs/desktops/kde-5/plasma/milou.nix)4
-rw-r--r--pkgs/desktops/plasma-5/oxygen.nix (renamed from pkgs/desktops/kde-5/plasma/oxygen.nix)4
-rw-r--r--pkgs/desktops/plasma-5/plasma-desktop/default.nix (renamed from pkgs/desktops/kde-5/plasma/plasma-desktop/default.nix)4
-rw-r--r--pkgs/desktops/plasma-5/plasma-desktop/hwclock-path.patch (renamed from pkgs/desktops/kde-5/plasma/plasma-desktop/hwclock-path.patch)0
-rw-r--r--pkgs/desktops/plasma-5/plasma-desktop/ibus.patch (renamed from pkgs/desktops/kde-5/plasma/plasma-desktop/ibus.patch)0
-rw-r--r--pkgs/desktops/plasma-5/plasma-desktop/qml-import-paths.patch (renamed from pkgs/desktops/kde-5/plasma/plasma-desktop/qml-import-paths.patch)0
-rw-r--r--pkgs/desktops/plasma-5/plasma-desktop/series (renamed from pkgs/desktops/kde-5/plasma/plasma-desktop/series)0
-rw-r--r--pkgs/desktops/plasma-5/plasma-desktop/tzdir.patch (renamed from pkgs/desktops/kde-5/plasma/plasma-desktop/tzdir.patch)0
-rw-r--r--pkgs/desktops/plasma-5/plasma-integration.nix (renamed from pkgs/desktops/kde-5/plasma/plasma-integration.nix)4
-rw-r--r--pkgs/desktops/plasma-5/plasma-nm/0001-mobile-broadband-provider-info-path.patch (renamed from pkgs/desktops/kde-5/plasma/plasma-nm/0001-mobile-broadband-provider-info-path.patch)0
-rw-r--r--pkgs/desktops/plasma-5/plasma-nm/default.nix (renamed from pkgs/desktops/kde-5/plasma/plasma-nm/default.nix)4
-rw-r--r--pkgs/desktops/plasma-5/plasma-pa.nix (renamed from pkgs/desktops/kde-5/plasma/plasma-pa.nix)4
-rw-r--r--pkgs/desktops/plasma-5/plasma-workspace-wallpapers.nix (renamed from pkgs/desktops/kde-5/plasma/plasma-workspace-wallpapers.nix)4
-rw-r--r--pkgs/desktops/plasma-5/plasma-workspace/default.nix (renamed from pkgs/desktops/kde-5/plasma/plasma-workspace/default.nix)4
-rw-r--r--pkgs/desktops/plasma-5/plasma-workspace/qml-import-path.patch (renamed from pkgs/desktops/kde-5/plasma/plasma-workspace/qml-import-path.patch)0
-rw-r--r--pkgs/desktops/plasma-5/plasma-workspace/series (renamed from pkgs/desktops/kde-5/plasma/plasma-workspace/series)0
-rw-r--r--pkgs/desktops/plasma-5/polkit-kde-agent.nix (renamed from pkgs/desktops/kde-5/plasma/polkit-kde-agent.nix)4
-rw-r--r--pkgs/desktops/plasma-5/powerdevil.nix (renamed from pkgs/desktops/kde-5/plasma/powerdevil.nix)4
-rw-r--r--pkgs/desktops/plasma-5/srcs.nix325
-rw-r--r--pkgs/desktops/plasma-5/startkde/default.nix (renamed from pkgs/desktops/kde-5/plasma/startkde/default.nix)0
-rwxr-xr-xpkgs/desktops/plasma-5/startkde/startkde.sh (renamed from pkgs/desktops/kde-5/plasma/startkde/startkde.sh)0
-rw-r--r--pkgs/desktops/plasma-5/systemsettings.nix (renamed from pkgs/desktops/kde-5/plasma/systemsettings.nix)4
-rw-r--r--pkgs/development/libraries/kde-frameworks/attica.nix5
-rw-r--r--pkgs/development/libraries/kde-frameworks/baloo.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/bluez-qt.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/breeze-icons.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/build-support/framework.nix24
-rw-r--r--pkgs/development/libraries/kde-frameworks/default.nix215
-rw-r--r--pkgs/development/libraries/kde-frameworks/extra-cmake-modules/default.nix12
-rw-r--r--pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh (renamed from pkgs/development/libraries/kde-frameworks/setup-hook.sh)4
-rw-r--r--pkgs/development/libraries/kde-frameworks/frameworkintegration.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kactivities-stats.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kactivities.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kapidox.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/karchive.nix5
-rw-r--r--pkgs/development/libraries/kde-frameworks/kauth/default.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kbookmarks.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kcmutils/default.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kcodecs.nix5
-rw-r--r--pkgs/development/libraries/kde-frameworks/kcompletion.nix5
-rw-r--r--pkgs/development/libraries/kde-frameworks/kconfig.nix5
-rw-r--r--pkgs/development/libraries/kde-frameworks/kconfigwidgets/default.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kcoreaddons.nix5
-rw-r--r--pkgs/development/libraries/kde-frameworks/kcrash.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdbusaddons.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdeclarative.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kded.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdelibs4support/default.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdesignerplugin.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdesu.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdnssd.nix7
-rw-r--r--pkgs/development/libraries/kde-frameworks/kdoctools/default.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kemoticons.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kfilemetadata/default.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kglobalaccel.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kguiaddons.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/khtml.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/ki18n.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kiconthemes/default.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kidletime.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kimageformats.nix8
-rw-r--r--pkgs/development/libraries/kde-frameworks/kinit/default.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kio/default.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kitemmodels.nix5
-rw-r--r--pkgs/development/libraries/kde-frameworks/kitemviews.nix5
-rw-r--r--pkgs/development/libraries/kde-frameworks/kjobwidgets.nix6
-rw-r--r--pkgs/development/libraries/kde-frameworks/kjs.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kjsembed.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kmediaplayer.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/knewstuff.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/knotifications.nix6
-rw-r--r--pkgs/development/libraries/kde-frameworks/knotifyconfig.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kpackage/default.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kparts.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kpeople.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kplotting.nix5
-rw-r--r--pkgs/development/libraries/kde-frameworks/kpty.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kross.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/krunner.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kservice/default.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/ktexteditor.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/ktextwidgets.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kunitconversion.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kwallet.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kwayland.nix7
-rw-r--r--pkgs/development/libraries/kde-frameworks/kwidgetsaddons.nix5
-rw-r--r--pkgs/development/libraries/kde-frameworks/kwindowsystem.nix6
-rw-r--r--pkgs/development/libraries/kde-frameworks/kxmlgui.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/kxmlrpcclient.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/modemmanager-qt.nix7
-rw-r--r--pkgs/development/libraries/kde-frameworks/networkmanager-qt.nix7
-rw-r--r--pkgs/development/libraries/kde-frameworks/oxygen-icons5.nix5
-rw-r--r--pkgs/development/libraries/kde-frameworks/plasma-framework.nix4
-rw-r--r--pkgs/development/libraries/kde-frameworks/solid.nix6
-rw-r--r--pkgs/development/libraries/kde-frameworks/sonnet.nix8
-rw-r--r--pkgs/development/libraries/kde-frameworks/syntax-highlighting.nix5
-rw-r--r--pkgs/development/libraries/kde-frameworks/threadweaver.nix5
-rw-r--r--pkgs/development/libraries/kirigami/default.nix4
-rw-r--r--pkgs/development/libraries/kirigami/v2.nix5
-rw-r--r--pkgs/development/libraries/libktorrent/default.nix4
-rw-r--r--pkgs/development/libraries/phonon/default.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.5/default.nix33
-rw-r--r--pkgs/development/libraries/qt-5/5.6/default.nix56
-rw-r--r--pkgs/development/libraries/qt-5/5.6/qtquickcontrols2.nix6
-rw-r--r--pkgs/development/libraries/qt-5/5.7/default.nix33
-rw-r--r--pkgs/development/libraries/quazip/default.nix4
-rw-r--r--pkgs/development/tools/profiling/heaptrack/default.nix15
-rw-r--r--pkgs/development/tools/tora/default.nix4
-rw-r--r--pkgs/tools/misc/kdecoration-viewer/default.nix4
-rw-r--r--pkgs/tools/misc/kronometer/default.nix4
-rw-r--r--pkgs/tools/misc/peruse/default.nix4
-rw-r--r--pkgs/tools/text/kdiff3/default.nix4
-rw-r--r--pkgs/top-level/aliases.nix16
-rw-r--r--pkgs/top-level/all-packages.nix413
251 files changed, 1955 insertions, 1887 deletions
diff --git a/doc/languages-frameworks/qt.xml b/doc/languages-frameworks/qt.xml
index 093c33c25a17..b6c8f0e899e6 100644
--- a/doc/languages-frameworks/qt.xml
+++ b/doc/languages-frameworks/qt.xml
@@ -2,67 +2,31 @@
          xmlns:xlink="http://www.w3.org/1999/xlink"
          xml:id="sec-language-qt">
 
-<title>Qt</title>
+<title>Qt and KDE</title>
 
-<para>The information in this section applies to Qt 5.5 and later.</para>
-
-<para>Qt is an application development toolkit for C++. Although it is
-not a distinct programming language, there are special considerations
-for packaging Qt-based programs and libraries. A small set of tools
-and conventions has grown out of these considerations.</para>
+<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>Packages that provide libraries should be listed in
-<varname>qt5LibsFun</varname> so that the library is built with each
-Qt version. A set of packages is provided for each version of Qt; for
-example, <varname>qt5Libs</varname> always provides libraries built
-with the latest version, <varname>qt55Libs</varname> provides
-libraries built with Qt 5.5, and so on. To avoid version conflicts, no
-top-level attributes are created for these packages.</para>
+<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>
 
 </section>
 
-<section xml:id="ssec-qt-programs"><title>Programs</title>
-
-<para>Application packages do not need to be built with every Qt
-version. To ensure consistency between the package's dependencies,
-call the package with <literal>qt5Libs.callPackage</literal> instead
-of the usual <literal>callPackage</literal>. An older version may be
-selected in case of incompatibility. For example, to build with Qt
-5.5, call the package with
-<literal>qt55Libs.callPackage</literal>.</para>
-
-<para>Several environment variables must be set at runtime for Qt
-applications to function correctly, including:</para>
-
-<itemizedlist>
-  <listitem><para><envar>QT_PLUGIN_PATH</envar></para></listitem>
-  <listitem><para><envar>QML_IMPORT_PATH</envar></para></listitem>
-  <listitem><para><envar>QML2_IMPORT_PATH</envar></para></listitem>
-  <listitem><para><envar>XDG_DATA_DIRS</envar></para></listitem>
-</itemizedlist>
-
-<para>To ensure that these are set correctly, the program must be wrapped by
-invoking <literal>wrapQtProgram <replaceable>program</replaceable></literal>
-during installation (for example, during
-<literal>fixupPhase</literal>). <literal>wrapQtProgram</literal>
-accepts the same options as <literal>makeWrapper</literal>.
-</para>
+<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>Many of the considerations above also apply to KDE packages,
-especially the need to set the correct environment variables at
-runtime. To ensure that this is done, invoke <literal>wrapKDEProgram
-<replaceable>program</replaceable></literal> during
-installation. <literal>wrapKDEProgram</literal> also generates a
-<literal>ksycoca</literal> database so that required data and services
-can be found. Like its Qt counterpart,
-<literal>wrapKDEProgram</literal> accepts the same options as
-<literal>makeWrapper</literal>.</para>
+<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>
 
diff --git a/lib/customisation.nix b/lib/customisation.nix
index bedb91af7735..a6c24f083a5b 100644
--- a/lib/customisation.nix
+++ b/lib/customisation.nix
@@ -177,9 +177,10 @@ rec {
     let self = f self // {
           newScope = scope: newScope (self // scope);
           callPackage = self.newScope {};
-          override = g: makeScope newScope (self_:
-            let super = f self_;
-            in super // g super self_);
+          override = g:
+            makeScope newScope
+            (self_: let super = f self_; in super // g super self_);
+          packages = f;
         };
     in self;
 
diff --git a/nixos/modules/i18n/input-method/ibus.nix b/nixos/modules/i18n/input-method/ibus.nix
index a5bbe6bcb559..f8e021f551e8 100644
--- a/nixos/modules/i18n/input-method/ibus.nix
+++ b/nixos/modules/i18n/input-method/ibus.nix
@@ -44,7 +44,7 @@ in
       panel = mkOption {
         type = with types; nullOr path;
         default = null;
-        example = literalExample "''${pkgs.kde5.plasma-desktop}/lib/libexec/kimpanel-ibus-panel";
+        example = literalExample "''${pkgs.plasma5.plasma-desktop}/lib/libexec/kimpanel-ibus-panel";
         description = "Replace the IBus panel with another panel.";
       };
     };
diff --git a/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix b/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix
index c44dff3bb60d..b15aef885369 100644
--- a/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix
+++ b/nixos/modules/installer/cd-dvd/installation-cd-graphical-kde.nix
@@ -66,7 +66,7 @@ with lib;
   in ''
     mkdir -p /root/Desktop
     ln -sfT ${desktopFile} /root/Desktop/nixos-manual.desktop
-    ln -sfT ${pkgs.kde5.konsole}/share/applications/org.kde.konsole.desktop /root/Desktop/org.kde.konsole.desktop
+    ln -sfT ${pkgs.kdeApplications.konsole}/share/applications/org.kde.konsole.desktop /root/Desktop/org.kde.konsole.desktop
     ln -sfT ${pkgs.gparted}/share/applications/gparted.desktop /root/Desktop/gparted.desktop
   '';
 
diff --git a/nixos/modules/rename.nix b/nixos/modules/rename.nix
index ee68f8bff81a..ff3654737afd 100644
--- a/nixos/modules/rename.nix
+++ b/nixos/modules/rename.nix
@@ -178,6 +178,9 @@ with lib;
     (mkRenamedOptionModule [ "services" "nfs" "lockdPort" ] [ "services" "nfs" "server" "lockdPort" ])
     (mkRenamedOptionModule [ "services" "nfs" "statdPort" ] [ "services" "nfs" "server" "statdPort" ])
 
+    # KDE Plasma 5
+    (mkRenamedOptionModule [ "services" "xserver" "desktopManager" "kde5" ] [ "services" "xserver" "desktopManager" "plasma5" ])
+
     # Options that are obsolete and have no replacement.
     (mkRemovedOptionModule [ "boot" "initrd" "luks" "enable" ] "")
     (mkRemovedOptionModule [ "programs" "bash" "enable" ] "")
diff --git a/nixos/modules/security/pam.nix b/nixos/modules/security/pam.nix
index b51c8b4996be..5632500df2e0 100644
--- a/nixos/modules/security/pam.nix
+++ b/nixos/modules/security/pam.nix
@@ -280,8 +280,8 @@ let
               ${optionalString cfg.pamMount
                 "auth optional ${pkgs.pam_mount}/lib/security/pam_mount.so"}
               ${optionalString cfg.enableKwallet
-                ("auth optional ${pkgs.kde5.kwallet-pam}/lib/security/pam_kwallet5.so" +
-                 " kwalletd=${pkgs.kde5.kwallet}/bin/kwalletd5")}
+                ("auth optional ${pkgs.plasma5.kwallet-pam}/lib/security/pam_kwallet5.so" +
+                 " kwalletd=${pkgs.libsForQt5.kwallet}/bin/kwalletd5")}
             '') + ''
           ${optionalString cfg.unixAuth
               "auth sufficient pam_unix.so ${optionalString cfg.allowNullPassword "nullok"} likeauth try_first_pass"}
@@ -349,8 +349,8 @@ let
           ${optionalString (cfg.enableAppArmor && config.security.apparmor.enable)
               "session optional ${pkgs.apparmor-pam}/lib/security/pam_apparmor.so order=user,group,default debug"}
           ${optionalString (cfg.enableKwallet)
-              ("session optional ${pkgs.kde5.kwallet-pam}/lib/security/pam_kwallet5.so" +
-               " kwalletd=${pkgs.kde5.kwallet}/bin/kwalletd5")}
+              ("session optional ${pkgs.plasma5.kwallet-pam}/lib/security/pam_kwallet5.so" +
+               " kwalletd=${pkgs.libsForQt5.kwallet}/bin/kwalletd5")}
         '');
     };
 
diff --git a/nixos/modules/services/x11/desktop-managers/default.nix b/nixos/modules/services/x11/desktop-managers/default.nix
index 1f7a925ed054..af01f6acad18 100644
--- a/nixos/modules/services/x11/desktop-managers/default.nix
+++ b/nixos/modules/services/x11/desktop-managers/default.nix
@@ -16,9 +16,9 @@ in
 {
   # Note: the order in which desktop manager modules are imported here
   # determines the default: later modules (if enabled) are preferred.
-  # E.g., if KDE is enabled, it supersedes xterm.
+  # E.g., if Plasma 5 is enabled, it supersedes xterm.
   imports = [
-    ./none.nix ./xterm.nix ./xfce.nix ./kde5.nix ./lumina.nix
+    ./none.nix ./xterm.nix ./xfce.nix ./plasma5.nix ./lumina.nix
     ./lxqt.nix ./enlightenment.nix ./gnome3.nix ./kodi.nix
   ];
 
diff --git a/nixos/modules/services/x11/desktop-managers/kde5.nix b/nixos/modules/services/x11/desktop-managers/kde5.nix
deleted file mode 100644
index 12408abd20ad..000000000000
--- a/nixos/modules/services/x11/desktop-managers/kde5.nix
+++ /dev/null
@@ -1,258 +0,0 @@
-{ config, lib, pkgs, ... }:
-
-with lib;
-
-let
-
-  xcfg = config.services.xserver;
-  cfg = xcfg.desktopManager.kde5;
-  xorg = pkgs.xorg;
-
-  kde5 = pkgs.kde5;
-
-in
-
-{
-  options = {
-
-    services.xserver.desktopManager.kde5 = {
-      enable = mkOption {
-        type = types.bool;
-        default = false;
-        description = "Enable the Plasma 5 (KDE 5) desktop environment.";
-      };
-
-      enableQt4Support = mkOption {
-        type = types.bool;
-        default = true;
-        description = ''
-          Enable support for Qt 4-based applications. Particularly, install the
-          Qt 4 version of the Breeze theme and a default backend for Phonon.
-        '';
-      };
-
-      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 = [ (kde5.kdeWrapper cfg.extraPackages) ];
-    })
-
-    (mkIf (xcfg.enable && cfg.enable) {
-      services.xserver.desktopManager.session = singleton {
-        name = "kde5";
-        bgSupport = true;
-        start = ''
-          # Load PulseAudio module for routing support.
-          # See http://colin.guthr.ie/2009/10/so-how-does-the-kde-pulseaudio-support-work-anyway/
-          ${optionalString config.hardware.pulseaudio.enable ''
-            ${getBin config.hardware.pulseaudio.package}/bin/pactl load-module module-device-manager "do_routing=1"
-          ''}
-
-          exec "${kde5.startkde}"
-        '';
-      };
-
-      security.wrappers = {
-        kcheckpass.source = "${kde5.plasma-workspace.out}/lib/libexec/kcheckpass";
-        "start_kdeinit".source = "${kde5.kinit.out}/lib/libexec/kf5/start_kdeinit";
-      };
-
-      environment.systemPackages =
-        [
-          kde5.frameworkintegration
-          kde5.kactivities
-          kde5.kauth
-          kde5.kcmutils
-          kde5.kconfig
-          kde5.kconfigwidgets
-          kde5.kcoreaddons
-          kde5.kdbusaddons
-          kde5.kdeclarative
-          kde5.kded
-          kde5.kdesu
-          kde5.kdnssd
-          kde5.kemoticons
-          kde5.kfilemetadata
-          kde5.kglobalaccel
-          kde5.kguiaddons
-          kde5.kiconthemes
-          kde5.kidletime
-          kde5.kimageformats
-          kde5.kinit
-          kde5.kio
-          kde5.kjobwidgets
-          kde5.knewstuff
-          kde5.knotifications
-          kde5.knotifyconfig
-          kde5.kpackage
-          kde5.kparts
-          kde5.kpeople
-          kde5.krunner
-          kde5.kservice
-          kde5.ktextwidgets
-          kde5.kwallet
-          kde5.kwallet-pam
-          kde5.kwalletmanager
-          kde5.kwayland
-          kde5.kwidgetsaddons
-          kde5.kxmlgui
-          kde5.kxmlrpcclient
-          kde5.plasma-framework
-          kde5.solid
-          kde5.sonnet
-          kde5.threadweaver
-
-          kde5.breeze-qt5
-          kde5.kactivitymanagerd
-          kde5.kde-cli-tools
-          kde5.kdecoration
-          kde5.kdeplasma-addons
-          kde5.kgamma5
-          kde5.khotkeys
-          kde5.kinfocenter
-          kde5.kmenuedit
-          kde5.kscreen
-          kde5.kscreenlocker
-          kde5.ksysguard
-          kde5.kwayland
-          kde5.kwin
-          kde5.kwrited
-          kde5.libkscreen
-          kde5.libksysguard
-          kde5.milou
-          kde5.plasma-integration
-          kde5.polkit-kde-agent
-          kde5.systemsettings
-
-          kde5.plasma-desktop
-          kde5.plasma-workspace
-          kde5.plasma-workspace-wallpapers
-
-          kde5.dolphin-plugins
-          kde5.ffmpegthumbs
-          kde5.kdegraphics-thumbnailers
-          kde5.kio-extras
-          kde5.print-manager
-
-          # Install Breeze icons if available
-          (kde5.breeze-icons or kde5.oxygen-icons5 or kde5.oxygen-icons)
-          pkgs.hicolor_icon_theme
-
-          kde5.kde-gtk-config kde5.breeze-gtk
-
-          pkgs.qt5.phonon-backend-gstreamer
-        ]
-
-        # Plasma 5.5 and later has a Breeze GTK theme.
-        # If it is not available, Orion is very similar to Breeze.
-        ++ lib.optional (!(lib.hasAttr "breeze-gtk" kde5)) pkgs.orion
-
-        # Install activity manager if available
-        ++ lib.optional (lib.hasAttr "kactivitymanagerd" kde5) kde5.kactivitymanagerd
-
-        # frameworkintegration was split with plasma-integration in Plasma 5.6
-        ++ lib.optional (lib.hasAttr "plasma-integration" kde5) kde5.plasma-integration
-
-        ++ lib.optionals cfg.enableQt4Support [ kde5.breeze-qt4 pkgs.phonon-backend-gstreamer ]
-
-        # Optional hardware support features
-        ++ lib.optional config.hardware.bluetooth.enable kde5.bluedevil
-        ++ lib.optional config.networking.networkmanager.enable kde5.plasma-nm
-        ++ lib.optional config.hardware.pulseaudio.enable kde5.plasma-pa
-        ++ lib.optional config.powerManagement.enable kde5.powerdevil
-        ++ lib.optional config.services.colord.enable pkgs.colord-kde
-        ++ lib.optionals config.services.samba.enable [ kde5.kdenetwork-filesharing pkgs.samba ];
-
-      services.xserver.desktopManager.kde5.extraPackages =
-        [
-          kde5.khelpcenter
-          kde5.oxygen
-
-          kde5.dolphin
-          kde5.konsole
-        ];
-
-      environment.pathsToLink = [ "/share" ];
-
-      environment.etc = singleton {
-        source = "${pkgs.xkeyboard_config}/etc/X11/xkb";
-        target = "X11/xkb";
-      };
-
-      environment.variables =
-        {
-          # Enable GTK applications to load SVG icons
-          GST_PLUGIN_SYSTEM_PATH_1_0 =
-            lib.makeSearchPath "/lib/gstreamer-1.0"
-            (builtins.map (pkg: pkg.out) (with pkgs.gst_all_1; [
-              gstreamer
-              gst-plugins-base
-              gst-plugins-good
-              gst-plugins-ugly
-              gst-plugins-bad
-              gst-libav # for mp3 playback
-            ]));
-        }
-        // (if (lib.hasAttr "breeze-icons" kde5)
-            then { GDK_PIXBUF_MODULE_FILE = "${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"; }
-            else { });
-
-      fonts.fonts = [
-        (kde5.oxygen-fonts or pkgs.noto-fonts)
-        pkgs.hack-font
-      ];
-
-      programs.ssh.askPassword = "${kde5.ksshaskpass.out}/bin/ksshaskpass";
-
-      # Enable helpful DBus services.
-      services.udisks2.enable = true;
-      services.upower.enable = config.powerManagement.enable;
-      services.dbus.packages =
-        mkIf config.services.printing.enable [ pkgs.system-config-printer ];
-
-      # Extra UDEV rules used by Solid
-      services.udev.packages = [
-        pkgs.libmtp
-        pkgs.media-player-info
-      ];
-
-      services.xserver.displayManager.sddm = {
-        theme = "breeze";
-        themes = [
-          kde5.ecm # for the setup-hook
-          kde5.plasma-workspace
-          kde5.breeze-icons
-        ];
-      };
-
-      security.pam.services.kde = { allowNullPassword = true; };
-
-      # Doing these one by one seems silly, but we currently lack a better
-      # construct for handling common pam configs.
-      security.pam.services.gdm.enableKwallet = true;
-      security.pam.services.kdm.enableKwallet = true;
-      security.pam.services.lightdm.enableKwallet = true;
-      security.pam.services.sddm.enableKwallet = true;
-      security.pam.services.slim.enableKwallet = true;
-
-      # use kimpanel as the default IBus panel
-      i18n.inputMethod.ibus.panel =
-        lib.mkDefault
-        "${pkgs.kde5.plasma-desktop}/lib/libexec/kimpanel-ibus-panel";
-
-    })
-  ];
-
-}
diff --git a/nixos/modules/services/x11/desktop-managers/lumina.nix b/nixos/modules/services/x11/desktop-managers/lumina.nix
index f0b31a2acb01..ed5ad4a2a001 100644
--- a/nixos/modules/services/x11/desktop-managers/lumina.nix
+++ b/nixos/modules/services/x11/desktop-managers/lumina.nix
@@ -32,8 +32,8 @@ in
 
     environment.systemPackages = [
       pkgs.fluxbox
-      pkgs.kde5.kwindowsystem
-      pkgs.kde5.oxygen-icons5
+      pkgs.qt5.kwindowsystem
+      pkgs.qt5.oxygen-icons5
       pkgs.lumina
       pkgs.numlockx
       pkgs.qt5.qtsvg
diff --git a/nixos/modules/services/x11/desktop-managers/plasma5.nix b/nixos/modules/services/x11/desktop-managers/plasma5.nix
new file mode 100644
index 000000000000..24225308ffb3
--- /dev/null
+++ b/nixos/modules/services/x11/desktop-managers/plasma5.nix
@@ -0,0 +1,241 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+  xcfg = config.services.xserver;
+  cfg = xcfg.desktopManager.plasma5;
+
+  inherit (pkgs) kdeWrapper kdeApplications plasma5 libsForQt5 qt5 xorg;
+
+in
+
+{
+  options = {
+
+    services.xserver.desktopManager.plasma5 = {
+      enable = mkOption {
+        type = types.bool;
+        default = false;
+        description = "Enable the Plasma 5 (KDE 5) desktop environment.";
+      };
+
+      enableQt4Support = mkOption {
+        type = types.bool;
+        default = true;
+        description = ''
+          Enable support for Qt 4-based applications. Particularly, install the
+          Qt 4 version of the Breeze theme and a default backend for Phonon.
+        '';
+      };
+
+      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";
+        bgSupport = true;
+        start = ''
+          # Load PulseAudio module for routing support.
+          # See http://colin.guthr.ie/2009/10/so-how-does-the-kde-pulseaudio-support-work-anyway/
+          ${optionalString config.hardware.pulseaudio.enable ''
+            ${getBin config.hardware.pulseaudio.package}/bin/pactl load-module module-device-manager "do_routing=1"
+          ''}
+
+          exec "${plasma5.startkde}"
+        '';
+      };
+
+      security.wrappers = {
+        kcheckpass.source = "${plasma5.plasma-workspace.out}/lib/libexec/kcheckpass";
+        "start_kdeinit".source = "${pkgs.kinit.out}/lib/libexec/kf5/start_kdeinit";
+      };
+
+      environment.systemPackages = with pkgs; with qt5; with libsForQt5; with plasma5; with kdeApplications;
+        [
+          frameworkintegration
+          kactivities
+          kauth
+          kcmutils
+          kconfig
+          kconfigwidgets
+          kcoreaddons
+          kdbusaddons
+          kdeclarative
+          kded
+          kdesu
+          kdnssd
+          kemoticons
+          kfilemetadata
+          kglobalaccel
+          kguiaddons
+          kiconthemes
+          kidletime
+          kimageformats
+          kinit
+          kio
+          kjobwidgets
+          knewstuff
+          knotifications
+          knotifyconfig
+          kpackage
+          kparts
+          kpeople
+          krunner
+          kservice
+          ktextwidgets
+          kwallet
+          kwallet-pam
+          kwalletmanager
+          kwayland
+          kwidgetsaddons
+          kxmlgui
+          kxmlrpcclient
+          plasma-framework
+          solid
+          sonnet
+          threadweaver
+
+          breeze-qt5
+          kactivitymanagerd
+          kde-cli-tools
+          kdecoration
+          kdeplasma-addons
+          kgamma5
+          khotkeys
+          kinfocenter
+          kmenuedit
+          kscreen
+          kscreenlocker
+          ksysguard
+          kwayland
+          kwin
+          kwrited
+          libkscreen
+          libksysguard
+          milou
+          plasma-integration
+          polkit-kde-agent
+          systemsettings
+
+          plasma-desktop
+          plasma-workspace
+          plasma-workspace-wallpapers
+
+          dolphin-plugins
+          ffmpegthumbs
+          kdegraphics-thumbnailers
+          kio-extras
+          print-manager
+
+          breeze-icons
+          pkgs.hicolor_icon_theme
+
+          kde-gtk-config breeze-gtk
+
+          phonon-backend-gstreamer
+        ]
+
+        ++ lib.optionals cfg.enableQt4Support [ breeze-qt4 pkgs.phonon-backend-gstreamer ]
+
+        # Optional hardware support features
+        ++ lib.optional config.hardware.bluetooth.enable bluedevil
+        ++ lib.optional config.networking.networkmanager.enable plasma-nm
+        ++ lib.optional config.hardware.pulseaudio.enable plasma-pa
+        ++ lib.optional config.powerManagement.enable powerdevil
+        ++ 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 {
+        source = "${pkgs.xkeyboard_config}/etc/X11/xkb";
+        target = "X11/xkb";
+      };
+
+      environment.variables = {
+        # Enable GTK applications to load SVG icons
+        GST_PLUGIN_SYSTEM_PATH_1_0 =
+          lib.makeSearchPath "/lib/gstreamer-1.0"
+          (builtins.map (pkg: pkg.out) (with pkgs.gst_all_1; [
+            gstreamer
+            gst-plugins-base
+            gst-plugins-good
+            gst-plugins-ugly
+            gst-plugins-bad
+            gst-libav # for mp3 playback
+          ]));
+        GDK_PIXBUF_MODULE_FILE = "${pkgs.librsvg.out}/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache";
+      };
+
+      fonts.fonts = with pkgs; [ noto-fonts hack-font ];
+
+      programs.ssh.askPassword = "${plasma5.ksshaskpass.out}/bin/ksshaskpass";
+
+      # Enable helpful DBus services.
+      services.udisks2.enable = true;
+      services.upower.enable = config.powerManagement.enable;
+      services.dbus.packages =
+        mkIf config.services.printing.enable [ pkgs.system-config-printer ];
+
+      # Extra UDEV rules used by Solid
+      services.udev.packages = [
+        pkgs.libmtp
+        pkgs.media-player-info
+      ];
+
+      services.xserver.displayManager.sddm = {
+        theme = "breeze";
+        themes = [
+          pkgs.extra-cmake-modules # for the setup-hook
+          plasma5.plasma-workspace
+          pkgs.breeze-icons
+        ];
+      };
+
+      security.pam.services.kde = { allowNullPassword = true; };
+
+      # Doing these one by one seems silly, but we currently lack a better
+      # construct for handling common pam configs.
+      security.pam.services.gdm.enableKwallet = true;
+      security.pam.services.kdm.enableKwallet = true;
+      security.pam.services.lightdm.enableKwallet = true;
+      security.pam.services.sddm.enableKwallet = true;
+      security.pam.services.slim.enableKwallet = true;
+
+      # use kimpanel as the default IBus panel
+      i18n.inputMethod.ibus.panel =
+        lib.mkDefault
+        "${plasma5.plasma-desktop}/lib/libexec/kimpanel-ibus-panel";
+
+    })
+  ];
+
+}
diff --git a/pkgs/applications/audio/i-score/default.nix b/pkgs/applications/audio/i-score/default.nix
index e3ebc5fde08e..1a47b74e21c7 100644
--- a/pkgs/applications/audio/i-score/default.nix
+++ b/pkgs/applications/audio/i-score/default.nix
@@ -6,7 +6,7 @@
   gcc,
   ginac,
   jamomacore,
-  kde5,
+  kdnssd,
   libsndfile,
   ninja,
   portaudio,
@@ -39,7 +39,7 @@ stdenv.mkDerivation rec {
     ginac
     gcc
     jamomacore
-    kde5.kdnssd
+    kdnssd
     libsndfile
     ninja
     portaudio
diff --git a/pkgs/applications/editors/kile/default.nix b/pkgs/applications/editors/kile/default.nix
index 7f7b22dfa134..a5914c92e8f9 100644
--- a/pkgs/applications/editors/kile/default.nix
+++ b/pkgs/applications/editors/kile/default.nix
@@ -1,28 +1,68 @@
-{ stdenv, fetchurl, automoc4, cmake, gettext, perl, pkgconfig
-, shared_mime_info, kdelibs
+{ kdeDerivation
+, lib
+, fetchgit
+, extra-cmake-modules
+, kdoctools
+, kdeWrapper
+, qtscript
+, kconfig
+, kcrash
+, kdbusaddons
+, kdelibs4support
+, kguiaddons
+, kiconthemes
+, kinit
+, khtml
+, konsole
+, kparts
+, ktexteditor
+, kwindowsystem
+, poppler
 }:
 
-stdenv.mkDerivation rec {
-  name = "kile-2.1.3";
+let
+  unwrapped =
+    kdeDerivation rec {
+      name = "kile-${version}";
+      version = "2017-02-09";
 
-  src = fetchurl {
-    url = "mirror://sourceforge/kile/${name}.tar.bz2";
-    sha256 = "18nfi37s46v9xav7vyki3phasddgcy4m7nywzxis198vr97yqqx0";
-  };
+      src = fetchgit {
+        url = git://anongit.kde.org/kile.git;
+        rev = "f77f6e627487c152f111e307ad6dc71699ade746";
+        sha256 = "0wpqaix9ssa28cm7qqjj0zfrscjgk8s3kmi5b4kk8h583gsrikib";
 
-  nativeBuildInputs = [
-    automoc4 cmake gettext perl pkgconfig shared_mime_info
-  ];
-  buildInputs = [ kdelibs ];
+      };
 
-  # for KDE 4.7 the nl translations fail since kile-2.1.2
-  preConfigure = "rm -r translations/nl";
+      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
 
-  meta = {
-    description = "An integrated LaTeX editor for KDE";
-    homepage = http://kile.sourceforge.net;
-    maintainers = [ stdenv.lib.maintainers.urkud ];
-    license = stdenv.lib.licenses.gpl2Plus;
-    inherit (kdelibs.meta) platforms;
-  };
+      buildInputs = [
+        kconfig
+        kcrash
+        kdbusaddons
+        kdelibs4support
+        kdoctools
+        kguiaddons
+        kiconthemes
+        kinit
+        khtml
+        kparts
+        ktexteditor
+        kwindowsystem
+        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 ];
 }
diff --git a/pkgs/applications/editors/kile/frameworks.nix b/pkgs/applications/editors/kile/frameworks.nix
deleted file mode 100644
index ad3300b9221f..000000000000
--- a/pkgs/applications/editors/kile/frameworks.nix
+++ /dev/null
@@ -1,68 +0,0 @@
-{ kdeDerivation
-, lib
-, fetchgit
-, ecm
-, kdoctools
-, kdeWrapper
-, qtscript
-, kconfig
-, kcrash
-, kdbusaddons
-, kdelibs4support
-, kguiaddons
-, kiconthemes
-, kinit
-, khtml
-, konsole
-, kparts
-, ktexteditor
-, kwindowsystem
-, poppler
-}:
-
-let
-  unwrapped =
-    kdeDerivation rec {
-      name = "kile-${version}";
-      version = "2017-02-09";
-
-      src = fetchgit {
-        url = git://anongit.kde.org/kile.git;
-        rev = "f77f6e627487c152f111e307ad6dc71699ade746";
-        sha256 = "0wpqaix9ssa28cm7qqjj0zfrscjgk8s3kmi5b4kk8h583gsrikib";
-
-      };
-
-      nativeBuildInputs = [ ecm kdoctools ];
-
-      buildInputs = [
-        kconfig
-        kcrash
-        kdbusaddons
-        kdelibs4support
-        kdoctools
-        kguiaddons
-        kiconthemes
-        kinit
-        khtml
-        kparts
-        ktexteditor
-        kwindowsystem
-        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 ];
-}
diff --git a/pkgs/applications/graphics/digikam/default.nix b/pkgs/applications/graphics/digikam/default.nix
index a9d7d357ad71..00c0da7a78e3 100644
--- a/pkgs/applications/graphics/digikam/default.nix
+++ b/pkgs/applications/graphics/digikam/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, ecm, makeQtWrapper
+{ stdenv, fetchurl, cmake, extra-cmake-modules, makeQtWrapper
 
 # For `digitaglinktree`
 , perl, sqlite
@@ -52,7 +52,7 @@ stdenv.mkDerivation rec {
     sha256 = "0dgsgji14l5zvxny36hrfsp889fsfrsbbn9bg57m18404xp903kg";
   };
 
-  nativeBuildInputs = [ cmake ecm makeQtWrapper ];
+  nativeBuildInputs = [ cmake extra-cmake-modules makeQtWrapper ];
 
   patches = [ ./0001-Disable-fno-operator-names.patch ];
 
diff --git a/pkgs/applications/graphics/kipi-plugins/default.nix b/pkgs/applications/graphics/kipi-plugins/default.nix
index 2f6cc8e4ece0..d27fdb8b53be 100644
--- a/pkgs/applications/graphics/kipi-plugins/default.nix
+++ b/pkgs/applications/graphics/kipi-plugins/default.nix
@@ -1,6 +1,6 @@
 {
   stdenv, fetchurl,
-  ecm,
+  extra-cmake-modules,
   karchive, kconfig, ki18n, kiconthemes, kio, kservice, kwindowsystem, kxmlgui,
   libkipi, qtbase, qtsvg, qtxmlpatterns
 }:
@@ -18,7 +18,7 @@ stdenv.mkDerivation rec {
     cd extra/kipi-plugins
   '';
 
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   buildInputs = [
     karchive kconfig ki18n kiconthemes kio kservice kwindowsystem kxmlgui libkipi
     qtbase qtsvg qtxmlpatterns
diff --git a/pkgs/desktops/kde-5/applications/akonadi-contacts.nix b/pkgs/applications/kde/akonadi-contacts.nix
index 7acfa3a230b3..830c9e6899ea 100644
--- a/pkgs/desktops/kde-5/applications/akonadi-contacts.nix
+++ b/pkgs/applications/kde/akonadi-contacts.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib,
-  ecm,
+  extra-cmake-modules,
   akonadi-mime, grantlee, kcontacts, kio, kitemmodels, kmime, qtwebengine,
   akonadi
 }:
@@ -11,7 +11,7 @@ kdeApp {
     license = with lib.licenses; [ gpl2 lgpl21 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   buildInputs = [
     akonadi-mime grantlee kcontacts kio kitemmodels kmime qtwebengine
   ];
diff --git a/pkgs/desktops/kde-5/applications/akonadi-mime.nix b/pkgs/applications/kde/akonadi-mime.nix
index 26e1559c779e..ba4b4b50242c 100644
--- a/pkgs/desktops/kde-5/applications/akonadi-mime.nix
+++ b/pkgs/applications/kde/akonadi-mime.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib,
-  ecm,
+  extra-cmake-modules,
   akonadi, kdbusaddons, kio, kitemmodels, kmime
 }:
 
@@ -10,6 +10,6 @@ kdeApp {
     license = with lib.licenses; [ gpl2 lgpl21 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   buildInputs = [ akonadi kdbusaddons kio kitemmodels kmime ];
 }
diff --git a/pkgs/desktops/kde-5/applications/akonadi.nix b/pkgs/applications/kde/akonadi.nix
index 03483e5ec0d1..284ed60a9cbd 100644
--- a/pkgs/desktops/kde-5/applications/akonadi.nix
+++ b/pkgs/applications/kde/akonadi.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib,
-  ecm,
+  extra-cmake-modules,
   kcompletion, kconfigwidgets, kdbusaddons, kdesignerplugin, kiconthemes,
   kio,
   boost, kitemmodels
@@ -12,7 +12,7 @@ kdeApp {
     license = [ lib.licenses.lgpl21 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   buildInputs = [
     kcompletion kconfigwidgets kdbusaddons kdesignerplugin kiconthemes kio
   ];
diff --git a/pkgs/desktops/kde-5/applications/ark/default.nix b/pkgs/applications/kde/ark/default.nix
index 6b471614f5a6..e1e25b2acf24 100644
--- a/pkgs/desktops/kde-5/applications/ark/default.nix
+++ b/pkgs/applications/kde/ark/default.nix
@@ -1,13 +1,16 @@
 {
-  kdeApp, lib, kdeWrapper,
+  kdeApp, lib, config, kdeWrapper,
 
-  ecm, kdoctools, makeWrapper,
+  extra-cmake-modules, kdoctools, makeWrapper,
 
   karchive, kconfig, kcrash, kdbusaddons, ki18n, kiconthemes, khtml, kio,
   kservice, kpty, kwidgetsaddons, libarchive,
 
   # Archive tools
-  p7zip, unrar, unzipNLS, zip
+  p7zip, unzipNLS, zip,
+
+  # Unfree tools
+  unfreeEnableUnrar ? false, unrar,
 }:
 
 let
@@ -15,7 +18,7 @@ let
     kdeApp {
       name = "ark";
       nativeBuildInputs = [
-        ecm kdoctools makeWrapper
+        extra-cmake-modules kdoctools makeWrapper
       ];
       propagatedBuildInputs = [
         khtml ki18n kio karchive kconfig kcrash kdbusaddons kiconthemes kservice
@@ -23,15 +26,16 @@ let
       ];
       postInstall =
         let
-          PATH = lib.makeBinPath [
-            p7zip unrar unzipNLS zip
-          ];
+          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 ];
+        license = with lib.licenses;
+          [ gpl2 lgpl3 ] ++ lib.optional unfreeEnableUnrar unfree;
         maintainers = [ lib.maintainers.ttuegel ];
       };
     };
diff --git a/pkgs/desktops/kde-5/applications/baloo-widgets.nix b/pkgs/applications/kde/baloo-widgets.nix
index f6f3a7ce14ea..bb6803057096 100644
--- a/pkgs/desktops/kde-5/applications/baloo-widgets.nix
+++ b/pkgs/applications/kde/baloo-widgets.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   baloo, kconfig, kdelibs4support, kfilemetadata, ki18n, kio, kservice
 }:
 
@@ -10,7 +10,7 @@ kdeApp {
     license = [ lib.licenses.lgpl21 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
     baloo kconfig kdelibs4support kfilemetadata ki18n kio kservice
   ];
diff --git a/pkgs/desktops/kde-5/applications/kde-app.nix b/pkgs/applications/kde/build-support/application.nix
index 92fdb439330d..92fdb439330d 100644
--- a/pkgs/desktops/kde-5/applications/kde-app.nix
+++ b/pkgs/applications/kde/build-support/application.nix
diff --git a/pkgs/applications/kde/default.nix b/pkgs/applications/kde/default.nix
new file mode 100644
index 000000000000..fff0df35d052
--- /dev/null
+++ b/pkgs/applications/kde/default.nix
@@ -0,0 +1,93 @@
+/*
+
+# New packages
+
+READ THIS FIRST
+
+This module is for official packages in the KDE Applications Bundle. All
+available packages are listed in `./srcs.nix`, although some are not yet
+packaged in Nixpkgs (see below).
+
+IF YOUR PACKAGE IS NOT LISTED IN `./srcs.nix`, IT DOES NOT GO HERE.
+
+Many of the packages released upstream are not yet built in Nixpkgs due to lack
+of demand. To add a Nixpkgs build for an upstream package, copy one of the
+existing packages here and modify it as necessary. A simple example package that
+still shows most of the available features is in `./gwenview.nix`.
+
+# Updates
+
+1. Update the URL in `./fetch.sh`.
+2. Run `./maintainers/scripts/fetch-kde-qt.sh pkgs/desktops/kde-5/applications`
+   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.
+
+*/
+
+{
+  stdenv, lib, libsForQt5, fetchurl, recurseIntoAttrs,
+  kdeDerivation, plasma5,
+  attica, phonon,
+  debug ? false,
+}:
+
+let
+  mirror = "mirror://kde";
+  srcs = import ./srcs.nix { inherit fetchurl mirror; };
+in
+
+let
+
+  packages = self: with self;
+    let
+      callPackage = self.newScope {
+        kdeApp = import ./build-support/application.nix {
+          inherit lib kdeDerivation;
+          inherit debug srcs;
+        };
+      };
+    in {
+      kdelibs = callPackage ./kdelibs { inherit attica phonon; };
+      akonadi = callPackage ./akonadi.nix {};
+      akonadi-contacts = callPackage ./akonadi-contacts.nix {};
+      akonadi-mime = callPackage ./akonadi-mime.nix {};
+      ark = callPackage ./ark/default.nix {};
+      baloo-widgets = callPackage ./baloo-widgets.nix {};
+      dolphin = callPackage ./dolphin.nix {};
+      dolphin-plugins = callPackage ./dolphin-plugins.nix {};
+      ffmpegthumbs = callPackage ./ffmpegthumbs.nix { };
+      filelight = callPackage ./filelight.nix {};
+      gwenview = callPackage ./gwenview.nix {};
+      kate = callPackage ./kate.nix {};
+      kdenlive = callPackage ./kdenlive.nix {};
+      kcalc = callPackage ./kcalc.nix {};
+      kcolorchooser = callPackage ./kcolorchooser.nix {};
+      kcontacts = callPackage ./kcontacts.nix {};
+      kdegraphics-mobipocket = callPackage ./kdegraphics-mobipocket.nix {};
+      kdegraphics-thumbnailers = callPackage ./kdegraphics-thumbnailers.nix {};
+      kdenetwork-filesharing = callPackage ./kdenetwork-filesharing.nix {};
+      kdf = callPackage ./kdf.nix {};
+      kgpg = callPackage ./kgpg.nix {};
+      khelpcenter = callPackage ./khelpcenter.nix {};
+      kig = callPackage ./kig.nix {};
+      kio-extras = callPackage ./kio-extras.nix {};
+      kmime = callPackage ./kmime.nix {};
+      kmix = callPackage ./kmix.nix {};
+      kompare = callPackage ./kompare.nix {};
+      konsole = callPackage ./konsole.nix {};
+      kwalletmanager = callPackage ./kwalletmanager.nix {};
+      libkdcraw = callPackage ./libkdcraw.nix {};
+      libkexiv2 = callPackage ./libkexiv2.nix {};
+      libkipi = callPackage ./libkipi.nix {};
+      libkomparediff2 = callPackage ./libkomparediff2.nix {};
+      marble = callPackage ./marble.nix {};
+      okteta = callPackage ./okteta.nix {};
+      okular = callPackage ./okular.nix {};
+      print-manager = callPackage ./print-manager.nix {};
+      spectacle = callPackage ./spectacle.nix {};
+
+      l10n = recurseIntoAttrs (import ./l10n.nix { inherit callPackage lib recurseIntoAttrs; });
+    };
+
+in lib.makeScope libsForQt5.newScope packages
diff --git a/pkgs/desktops/kde-5/applications/dolphin-plugins.nix b/pkgs/applications/kde/dolphin-plugins.nix
index e9932adc5dca..7f436c7a55a9 100644
--- a/pkgs/desktops/kde-5/applications/dolphin-plugins.nix
+++ b/pkgs/applications/kde/dolphin-plugins.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   dolphin, kdelibs4support, ki18n, kio, kxmlgui
 }:
 
@@ -10,7 +10,7 @@ kdeApp {
     license = [ lib.licenses.gpl2 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
     dolphin.unwrapped kdelibs4support ki18n kio kxmlgui
   ];
diff --git a/pkgs/desktops/kde-5/applications/dolphin.nix b/pkgs/applications/kde/dolphin.nix
index 9be40e9439b6..6515c230c284 100644
--- a/pkgs/desktops/kde-5/applications/dolphin.nix
+++ b/pkgs/applications/kde/dolphin.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib, kdeWrapper,
-  ecm, kdoctools, makeQtWrapper,
+  extra-cmake-modules, kdoctools, makeQtWrapper,
   baloo, baloo-widgets, dolphin-plugins, kactivities, kbookmarks, kcmutils,
   kcompletion, kconfig, kcoreaddons, kdelibs4support, kdbusaddons,
   kfilemetadata, ki18n, kiconthemes, kinit, kio, knewstuff, knotifications,
@@ -15,7 +15,7 @@ let
         license = with lib.licenses; [ gpl2 fdl12 ];
         maintainers = [ lib.maintainers.ttuegel ];
       };
-      nativeBuildInputs = [ ecm kdoctools makeQtWrapper ];
+      nativeBuildInputs = [ extra-cmake-modules kdoctools makeQtWrapper ];
       propagatedBuildInputs = [
         baloo baloo-widgets kactivities kbookmarks kcmutils kcompletion kconfig
         kcoreaddons kdelibs4support kdbusaddons kfilemetadata ki18n kiconthemes
diff --git a/pkgs/desktops/kde-5/applications/fetch.sh b/pkgs/applications/kde/fetch.sh
index 607a16eb45b1..607a16eb45b1 100644
--- a/pkgs/desktops/kde-5/applications/fetch.sh
+++ b/pkgs/applications/kde/fetch.sh
diff --git a/pkgs/desktops/kde-5/applications/ffmpegthumbs.nix b/pkgs/applications/kde/ffmpegthumbs.nix
index c063b1e6035b..5dde6d8a64ea 100644
--- a/pkgs/desktops/kde-5/applications/ffmpegthumbs.nix
+++ b/pkgs/applications/kde/ffmpegthumbs.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib,
-  ecm,
+  extra-cmake-modules,
   ffmpeg, kio
 }:
 
@@ -10,6 +10,6 @@ kdeApp {
     license = with lib.licenses; [ gpl2 bsd3 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ ffmpeg kio ];
 }
diff --git a/pkgs/desktops/kde-5/applications/filelight.nix b/pkgs/applications/kde/filelight.nix
index e3d9172145c8..71ab51320ab1 100644
--- a/pkgs/desktops/kde-5/applications/filelight.nix
+++ b/pkgs/applications/kde/filelight.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib, kdeWrapper,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   kio, kparts, kxmlgui, qtscript, solid
 }:
 
@@ -12,7 +12,7 @@ let
         license = with lib.licenses; [ gpl2 ];
         maintainers = with lib.maintainers; [ fridh vcunat ];
       };
-      nativeBuildInputs = [ ecm kdoctools ];
+      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
       propagatedBuildInputs = [
         kio kparts kxmlgui qtscript solid
       ];
diff --git a/pkgs/desktops/kde-5/applications/gwenview.nix b/pkgs/applications/kde/gwenview.nix
index 37a1605fe70a..0fa06ed0fbe2 100644
--- a/pkgs/desktops/kde-5/applications/gwenview.nix
+++ b/pkgs/applications/kde/gwenview.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib, kdeWrapper,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   baloo, exiv2, kactivities, kdelibs4support, kio, kipi-plugins, lcms2,
   libkdcraw, libkipi, phonon, qtimageformats, qtsvg, qtx11extras
 }:
@@ -13,7 +13,7 @@ let
         license = with lib.licenses; [ gpl2 fdl12 ];
         maintainers = [ lib.maintainers.ttuegel ];
       };
-      nativeBuildInputs = [ ecm kdoctools ];
+      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
       propagatedBuildInputs = [
         baloo kactivities kdelibs4support kio exiv2 lcms2 libkdcraw
         libkipi phonon qtimageformats qtsvg qtx11extras
diff --git a/pkgs/desktops/kde-5/applications/kate.nix b/pkgs/applications/kde/kate.nix
index 03cc0e1fe33b..cd320afd8d3b 100644
--- a/pkgs/desktops/kde-5/applications/kate.nix
+++ b/pkgs/applications/kde/kate.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib, kdeWrapper,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   kactivities, kconfig, kcrash, kdbusaddons, kguiaddons, kiconthemes, ki18n,
   kinit, kio, kitemmodels, kjobwidgets, knewstuff, knotifications, konsole,
   kparts, ktexteditor, kwindowsystem, kwallet, kxmlgui, libgit2,
@@ -15,7 +15,7 @@ let
         license = with lib.licenses; [ gpl3 lgpl3 lgpl2 ];
         maintainers = [ lib.maintainers.ttuegel ];
       };
-      nativeBuildInputs = [ ecm kdoctools ];
+      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
       propagatedBuildInputs = [
         kactivities ki18n kio ktexteditor kwindowsystem plasma-framework
         qtscript kconfig kcrash kguiaddons kiconthemes kinit kjobwidgets kparts
diff --git a/pkgs/desktops/kde-5/applications/kcalc.nix b/pkgs/applications/kde/kcalc.nix
index 10164692f770..8ec7591460e7 100644
--- a/pkgs/desktops/kde-5/applications/kcalc.nix
+++ b/pkgs/applications/kde/kcalc.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib, kdeWrapper,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   kconfig, kconfigwidgets, kguiaddons, kinit, knotifications, gmp
 }:
 
@@ -12,7 +12,7 @@ let
         license = with lib.licenses; [ gpl2 ];
         maintainers = [ lib.maintainers.fridh ];
       };
-      nativeBuildInputs = [ ecm kdoctools ];
+      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
       propagatedBuildInputs = [
         gmp kconfig kconfigwidgets kguiaddons kinit knotifications
       ];
diff --git a/pkgs/desktops/kde-5/applications/kcolorchooser.nix b/pkgs/applications/kde/kcolorchooser.nix
index 1dc6ccbc44c4..c1266009b686 100644
--- a/pkgs/desktops/kde-5/applications/kcolorchooser.nix
+++ b/pkgs/applications/kde/kcolorchooser.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib, kdeWrapper,
-  ecm, ki18n, kwidgetsaddons, kxmlgui
+  extra-cmake-modules, ki18n, kwidgetsaddons, kxmlgui
 }:
 
 let
@@ -11,7 +11,7 @@ let
         license = with lib.licenses; [ mit ];
         maintainers = [ lib.maintainers.ttuegel ];
       };
-      nativeBuildInputs = [ ecm ];
+      nativeBuildInputs = [ extra-cmake-modules ];
       propagatedBuildInputs = [ ki18n kwidgetsaddons kxmlgui ];
     };
 in
diff --git a/pkgs/desktops/kde-5/applications/kcontacts.nix b/pkgs/applications/kde/kcontacts.nix
index 441d73d363d9..5143df60ef44 100644
--- a/pkgs/desktops/kde-5/applications/kcontacts.nix
+++ b/pkgs/applications/kde/kcontacts.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib,
-  ecm, ki18n,
+  extra-cmake-modules, ki18n,
   kcoreaddons, kconfig, kcodecs
 }:
 
@@ -10,6 +10,6 @@ kdeApp {
     license = [ lib.licenses.lgpl21 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  nativeBuildInputs = [ ecm ki18n ];
+  nativeBuildInputs = [ extra-cmake-modules ki18n ];
   buildInputs = [ kcoreaddons kconfig kcodecs ];
 }
diff --git a/pkgs/desktops/kde-5/applications/kde-locale-4.nix b/pkgs/applications/kde/kde-locale-4.nix
index e83794c60d81..e83794c60d81 100644
--- a/pkgs/desktops/kde-5/applications/kde-locale-4.nix
+++ b/pkgs/applications/kde/kde-locale-4.nix
diff --git a/pkgs/desktops/kde-5/applications/kde-locale-5.nix b/pkgs/applications/kde/kde-locale-5.nix
index 2b9cc0e35eb0..772ebe37e44f 100644
--- a/pkgs/desktops/kde-5/applications/kde-locale-5.nix
+++ b/pkgs/applications/kde/kde-locale-5.nix
@@ -1,6 +1,6 @@
 name: args:
 
-{ kdeApp, cmake, ecm, gettext, kdoctools }:
+{ kdeApp, cmake, extra-cmake-modules, gettext, kdoctools }:
 
 kdeApp (args // {
   sname = "kde-l10n-${name}";
@@ -9,7 +9,7 @@ kdeApp (args // {
   outputs = [ "out" ];
 
   nativeBuildInputs =
-    [ cmake ecm gettext kdoctools ]
+    [ cmake extra-cmake-modules gettext kdoctools ]
     ++ (args.nativeBuildInputs or []);
 
   preConfigure = ''
diff --git a/pkgs/desktops/kde-5/applications/kdegraphics-mobipocket.nix b/pkgs/applications/kde/kdegraphics-mobipocket.nix
index 984524dc1b2b..e50c92f88848 100644
--- a/pkgs/desktops/kde-5/applications/kdegraphics-mobipocket.nix
+++ b/pkgs/applications/kde/kdegraphics-mobipocket.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib,
-  ecm,
+  extra-cmake-modules,
   kio
 }:
 
@@ -10,6 +10,6 @@ kdeApp {
     license = [ lib.licenses.gpl2Plus ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   buildInputs = [ kio ];
 }
diff --git a/pkgs/desktops/kde-5/applications/kdegraphics-thumbnailers.nix b/pkgs/applications/kde/kdegraphics-thumbnailers.nix
index c3947226690f..5aa974a9c960 100644
--- a/pkgs/desktops/kde-5/applications/kdegraphics-thumbnailers.nix
+++ b/pkgs/applications/kde/kdegraphics-thumbnailers.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib,
-  ecm, kio, libkexiv2, libkdcraw
+  extra-cmake-modules, kio, libkexiv2, libkdcraw
 }:
 
 kdeApp {
@@ -9,6 +9,6 @@ kdeApp {
     license = [ lib.licenses.lgpl21 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ kio libkexiv2 libkdcraw ];
 }
diff --git a/pkgs/desktops/kde-5/applications/kdelibs/0001-old-kde4-cmake-policies.patch b/pkgs/applications/kde/kdelibs/0001-old-kde4-cmake-policies.patch
index b7d7300e9a84..b7d7300e9a84 100644
--- a/pkgs/desktops/kde-5/applications/kdelibs/0001-old-kde4-cmake-policies.patch
+++ b/pkgs/applications/kde/kdelibs/0001-old-kde4-cmake-policies.patch
diff --git a/pkgs/desktops/kde-5/applications/kdelibs/0002-polkit-install-path.patch b/pkgs/applications/kde/kdelibs/0002-polkit-install-path.patch
index ff0306ea1488..ff0306ea1488 100644
--- a/pkgs/desktops/kde-5/applications/kdelibs/0002-polkit-install-path.patch
+++ b/pkgs/applications/kde/kdelibs/0002-polkit-install-path.patch
diff --git a/pkgs/desktops/kde-5/applications/kdelibs/0003-remove_xdg_impurities.patch b/pkgs/applications/kde/kdelibs/0003-remove_xdg_impurities.patch
index a79d7b2b7d16..a79d7b2b7d16 100644
--- a/pkgs/desktops/kde-5/applications/kdelibs/0003-remove_xdg_impurities.patch
+++ b/pkgs/applications/kde/kdelibs/0003-remove_xdg_impurities.patch
diff --git a/pkgs/desktops/kde-5/applications/kdelibs/default.nix b/pkgs/applications/kde/kdelibs/default.nix
index c7c8c250a838..0292b51a48d4 100644
--- a/pkgs/desktops/kde-5/applications/kdelibs/default.nix
+++ b/pkgs/applications/kde/kdelibs/default.nix
@@ -1,5 +1,5 @@
 {
-  kdeApp, lib, src, version,
+  kdeApp, 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,
diff --git a/pkgs/desktops/kde-5/applications/kdenetwork-filesharing.nix b/pkgs/applications/kde/kdenetwork-filesharing.nix
index 4aa119675285..20f81563c3b4 100644
--- a/pkgs/desktops/kde-5/applications/kdenetwork-filesharing.nix
+++ b/pkgs/applications/kde/kdenetwork-filesharing.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   kcoreaddons, ki18n, kio, kwidgetsaddons, samba
 }:
 
@@ -10,6 +10,6 @@ kdeApp {
     license = [ lib.licenses.gpl2 lib.licenses.lgpl21 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [ kcoreaddons ki18n kio kwidgetsaddons samba ];
 }
diff --git a/pkgs/desktops/kde-5/applications/kdenlive.nix b/pkgs/applications/kde/kdenlive.nix
index 071ec21bbd01..071ec21bbd01 100644
--- a/pkgs/desktops/kde-5/applications/kdenlive.nix
+++ b/pkgs/applications/kde/kdenlive.nix
diff --git a/pkgs/desktops/kde-5/applications/kdf.nix b/pkgs/applications/kde/kdf.nix
index c73eadc1df44..97e74eb2e125 100644
--- a/pkgs/desktops/kde-5/applications/kdf.nix
+++ b/pkgs/applications/kde/kdf.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib, kdeWrapper,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   kcmutils
 }:
 
@@ -12,7 +12,7 @@ let
         license = with lib.licenses; [ gpl2 ];
         maintainers = [ lib.maintainers.peterhoeg ];
       };
-      nativeBuildInputs = [ ecm kdoctools ];
+      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
       propagatedBuildInputs = [
         kcmutils
       ];
diff --git a/pkgs/desktops/kde-5/applications/kgpg.nix b/pkgs/applications/kde/kgpg.nix
index cd462acdf2b0..c44285982293 100644
--- a/pkgs/desktops/kde-5/applications/kgpg.nix
+++ b/pkgs/applications/kde/kgpg.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib,
-  ecm, kdoctools, ki18n,
+  extra-cmake-modules, kdoctools, ki18n,
   akonadi-contacts, gpgme, karchive, kcodecs, kcontacts, kcoreaddons, kcrash,
   kdbusaddons, kiconthemes, kjobwidgets, kio, knotifications, kservice,
   ktextwidgets, kxmlgui, kwidgetsaddons, kwindowsystem
@@ -8,7 +8,7 @@
 
 kdeApp {
   name = "kgpg";
-  nativeBuildInputs = [ ecm kdoctools ki18n ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ki18n ];
   buildInputs = [
     akonadi-contacts gpgme karchive kcodecs kcontacts kcoreaddons kcrash kdbusaddons
     kiconthemes kjobwidgets kio knotifications kservice ktextwidgets kxmlgui
diff --git a/pkgs/desktops/kde-5/applications/khelpcenter.nix b/pkgs/applications/kde/khelpcenter.nix
index 3f13d131c77a..0579faa72a01 100644
--- a/pkgs/desktops/kde-5/applications/khelpcenter.nix
+++ b/pkgs/applications/kde/khelpcenter.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, kdeWrapper,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   grantlee, kconfig, kcoreaddons, kdbusaddons, ki18n, kinit, kcmutils,
   kdelibs4support, khtml, kservice, xapian
 }:
@@ -9,7 +9,7 @@ let
   unwrapped =
     kdeApp {
       name = "khelpcenter";
-      nativeBuildInputs = [ ecm kdoctools ];
+      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
       buildInputs = [
         grantlee kdelibs4support khtml ki18n kconfig kcoreaddons kdbusaddons
         kinit kcmutils kservice xapian
diff --git a/pkgs/desktops/kde-5/applications/kig.nix b/pkgs/applications/kde/kig.nix
index 9636f82974b3..9f38079316fa 100644
--- a/pkgs/desktops/kde-5/applications/kig.nix
+++ b/pkgs/applications/kde/kig.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib, kdeWrapper
-  , ecm, kdoctools, kparts
+  , extra-cmake-modules, kdoctools, kparts
   , qtsvg, qtxmlpatterns, ktexteditor, boost
 }:
 
@@ -12,7 +12,7 @@ let
         license = with lib.licenses; [ gpl2 ];
         maintainers = with lib.maintainers; [ raskin ];
       };
-      nativeBuildInputs = [ ecm kdoctools ];
+      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
       buildInputs = [
         kparts qtsvg qtxmlpatterns ktexteditor boost
       ];
diff --git a/pkgs/desktops/kde-5/applications/kio-extras.nix b/pkgs/applications/kde/kio-extras.nix
index fe3e3fad200b..77f795167fc0 100644
--- a/pkgs/desktops/kde-5/applications/kio-extras.nix
+++ b/pkgs/applications/kde/kio-extras.nix
@@ -1,5 +1,5 @@
 {
-  kdeApp, lib, ecm, kdoctools, shared_mime_info,
+  kdeApp, 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,
@@ -12,7 +12,7 @@ kdeApp {
     license = with lib.licenses; [ gpl2 lgpl21 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  nativeBuildInputs = [ ecm kdoctools shared_mime_info ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools shared_mime_info ];
   propagatedBuildInputs = [
     exiv2 kactivities karchive kbookmarks kconfig kconfigwidgets kcoreaddons
     kdbusaddons kguiaddons kdnssd kiconthemes ki18n kio khtml kdelibs4support
diff --git a/pkgs/desktops/kde-5/applications/kmime.nix b/pkgs/applications/kde/kmime.nix
index d60909ec7bc9..c17b3fdcd8e9 100644
--- a/pkgs/desktops/kde-5/applications/kmime.nix
+++ b/pkgs/applications/kde/kmime.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib,
-  ecm, ki18n,
+  extra-cmake-modules, ki18n,
   kcodecs
 }:
 
@@ -10,6 +10,6 @@ kdeApp {
     license = [ lib.licenses.lgpl21 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  nativeBuildInputs = [ ecm ki18n ];
+  nativeBuildInputs = [ extra-cmake-modules ki18n ];
   buildInputs = [ kcodecs ];
 }
diff --git a/pkgs/desktops/kde-5/applications/kmix.nix b/pkgs/applications/kde/kmix.nix
index 46a67e06ee0b..6ab653cfce06 100644
--- a/pkgs/desktops/kde-5/applications/kmix.nix
+++ b/pkgs/applications/kde/kmix.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib, kdeWrapper,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   kglobalaccel, kxmlgui, kcoreaddons, kdelibs4support,
   plasma-framework, libpulseaudio, alsaLib, libcanberra_kde
 }:
@@ -13,7 +13,7 @@ let
         license = with lib.licenses; [ gpl2 lgpl21 fdl12 ];
         maintainers = [ lib.maintainers.rongcuid ];
       };
-      nativeBuildInputs = [ ecm kdoctools ];
+      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
       buildInputs = [ libpulseaudio alsaLib libcanberra_kde ];
       propagatedBuildInputs = [
         kglobalaccel kxmlgui kcoreaddons kdelibs4support
diff --git a/pkgs/desktops/kde-5/applications/kompare.nix b/pkgs/applications/kde/kompare.nix
index 45789edbfcc8..660090dc84ae 100644
--- a/pkgs/desktops/kde-5/applications/kompare.nix
+++ b/pkgs/applications/kde/kompare.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib, kdeWrapper,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   kparts, ktexteditor, kwidgetsaddons, libkomparediff2
 }:
 
@@ -9,7 +9,7 @@ let
     kdeApp {
       name = "kompare";
       meta = { license = with lib.licenses; [ gpl2 ]; };
-      nativeBuildInputs = [ ecm kdoctools ];
+      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
       propagatedBuildInputs = [
         kparts ktexteditor kwidgetsaddons libkomparediff2
       ];
diff --git a/pkgs/desktops/kde-5/applications/konsole.nix b/pkgs/applications/kde/konsole.nix
index 2dfd305b46b2..15b6373bdb02 100644
--- a/pkgs/desktops/kde-5/applications/konsole.nix
+++ b/pkgs/applications/kde/konsole.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib, kdeWrapper,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   kbookmarks, kcompletion, kconfig, kconfigwidgets, kcoreaddons, kguiaddons,
   ki18n, kiconthemes, kinit, kdelibs4support, kio, knotifications,
   knotifyconfig, kparts, kpty, kservice, ktextwidgets, kwidgetsaddons,
@@ -15,7 +15,7 @@ let
         license = with lib.licenses; [ gpl2 lgpl21 fdl12 ];
         maintainers = [ lib.maintainers.ttuegel ];
       };
-      nativeBuildInputs = [ ecm kdoctools ];
+      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
       propagatedBuildInputs = [
         kdelibs4support ki18n kwindowsystem qtscript kbookmarks kcompletion
         kconfig kconfigwidgets kcoreaddons kguiaddons kiconthemes kinit kio
diff --git a/pkgs/desktops/kde-5/applications/kwalletmanager.nix b/pkgs/applications/kde/kwalletmanager.nix
index 03c2ab3853a1..afa870d90a54 100644
--- a/pkgs/desktops/kde-5/applications/kwalletmanager.nix
+++ b/pkgs/applications/kde/kwalletmanager.nix
@@ -1,7 +1,7 @@
 { lib
 , kdeApp
 , kdeWrapper
-, ecm
+, extra-cmake-modules
 , kdoctools
 , kauth
 , kcmutils
@@ -19,7 +19,7 @@ let
       license = with lib.licenses; [ gpl2 ];
       maintainers = with lib.maintainers; [ fridh ];
     };
-    nativeBuildInputs = [ ecm kdoctools ];
+    nativeBuildInputs = [ extra-cmake-modules kdoctools ];
     propagatedBuildInputs = [
       kauth
       kcmutils
diff --git a/pkgs/desktops/kde-5/applications/l10n.nix b/pkgs/applications/kde/l10n.nix
index f2e5f843b5d9..87e7a82ce466 100644
--- a/pkgs/desktops/kde-5/applications/l10n.nix
+++ b/pkgs/applications/kde/l10n.nix
@@ -1,4 +1,4 @@
-{ callPackage, pkgs, lib }:
+{ callPackage, recurseIntoAttrs, lib }:
 
 let
 
@@ -7,7 +7,7 @@ let
 
 in
 
-lib.mapAttrs (name: attr: pkgs.recurseIntoAttrs attr) {
+lib.mapAttrs (name: attr: recurseIntoAttrs attr) {
   ar = {
     qt4 = callPackage (kdeLocale4 "ar" {}) {};
     qt5 = callPackage (kdeLocale5 "ar" {}) {};
diff --git a/pkgs/desktops/kde-5/applications/libkdcraw.nix b/pkgs/applications/kde/libkdcraw.nix
index 421f7dbb4cfe..179e9f414dc3 100644
--- a/pkgs/desktops/kde-5/applications/libkdcraw.nix
+++ b/pkgs/applications/kde/libkdcraw.nix
@@ -1,4 +1,4 @@
-{ kdeApp, lib, ecm, libraw }:
+{ kdeApp, lib, extra-cmake-modules, libraw, qtbase }:
 
 kdeApp {
   name = "libkdcraw";
@@ -6,6 +6,7 @@ kdeApp {
     license = with lib.licenses; [ gpl2 lgpl21 bsd3 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtbase ];
   propagatedBuildInputs = [ libraw ];
 }
diff --git a/pkgs/desktops/kde-5/applications/libkexiv2.nix b/pkgs/applications/kde/libkexiv2.nix
index 0fac0759ab6b..0991c5df5ab4 100644
--- a/pkgs/desktops/kde-5/applications/libkexiv2.nix
+++ b/pkgs/applications/kde/libkexiv2.nix
@@ -1,4 +1,4 @@
-{ kdeApp, lib, exiv2, ecm }:
+{ kdeApp, lib, exiv2, extra-cmake-modules, qtbase }:
 
 kdeApp {
   name = "libkexiv2";
@@ -6,6 +6,7 @@ kdeApp {
     license = with lib.licenses; [ gpl2 lgpl21 bsd3 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtbase ];
   propagatedBuildInputs = [ exiv2 ];
 }
diff --git a/pkgs/desktops/kde-5/applications/libkipi.nix b/pkgs/applications/kde/libkipi.nix
index fa9dcc8323d1..32eeb171ff89 100644
--- a/pkgs/desktops/kde-5/applications/libkipi.nix
+++ b/pkgs/applications/kde/libkipi.nix
@@ -1,4 +1,4 @@
-{ kdeApp, lib, ecm, kconfig, ki18n, kservice, kxmlgui }:
+{ kdeApp, lib, extra-cmake-modules, kconfig, ki18n, kservice, kxmlgui }:
 
 kdeApp {
   name = "libkipi";
@@ -6,6 +6,6 @@ kdeApp {
     license = with lib.licenses; [ gpl2 lgpl21 bsd3 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ kconfig ki18n kservice kxmlgui ];
 }
diff --git a/pkgs/applications/kde/libkomparediff2.nix b/pkgs/applications/kde/libkomparediff2.nix
new file mode 100644
index 000000000000..aacc89a0efe3
--- /dev/null
+++ b/pkgs/applications/kde/libkomparediff2.nix
@@ -0,0 +1,7 @@
+{ kdeApp, lib, extra-cmake-modules, ki18n, kxmlgui, kcodecs, kio }:
+
+kdeApp {
+  name = "libkomparediff2";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  propagatedBuildInputs = [ kcodecs ki18n kxmlgui kio ];
+}
diff --git a/pkgs/desktops/kde-5/applications/marble.nix b/pkgs/applications/kde/marble.nix
index 5b8a82dbf098..c151396f2476 100644
--- a/pkgs/desktops/kde-5/applications/marble.nix
+++ b/pkgs/applications/kde/marble.nix
@@ -1,5 +1,5 @@
 { kdeApp, lib, kdeWrapper
-, ecm, qtscript, qtsvg, qtquickcontrols
+, extra-cmake-modules, qtscript, qtsvg, qtquickcontrols
 , gpsd
 }:
 
@@ -9,7 +9,7 @@ let
       name = "marble";
       meta.license = with lib.licenses; [ lgpl21 gpl3 ];
 
-      nativeBuildInputs = [ ecm ];
+      nativeBuildInputs = [ extra-cmake-modules ];
       propagatedBuildInputs = [
         qtscript qtsvg qtquickcontrols
         gpsd
diff --git a/pkgs/desktops/kde-5/applications/okteta.nix b/pkgs/applications/kde/okteta.nix
index 6683b9876fcb..59520e285327 100644
--- a/pkgs/desktops/kde-5/applications/okteta.nix
+++ b/pkgs/applications/kde/okteta.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib, kdeWrapper,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   kconfig, kinit,
   kcmutils, kconfigwidgets, knewstuff, kparts, qca-qt5
 }:
@@ -13,7 +13,7 @@ let
         license = with lib.licenses; [ gpl2 ];
         maintainers = with lib.maintainers; [ peterhoeg ];
       };
-      nativeBuildInputs = [ ecm kdoctools ];
+      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
       propagatedBuildInputs = [
         kconfig kinit
         kcmutils kconfigwidgets knewstuff kparts qca-qt5
diff --git a/pkgs/desktops/kde-5/applications/okular.nix b/pkgs/applications/kde/okular.nix
index 499e8cc93681..f5b3e38ca7c7 100644
--- a/pkgs/desktops/kde-5/applications/okular.nix
+++ b/pkgs/applications/kde/okular.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib, kdeWrapper,
-  ecm, kdoctools,
+  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,
@@ -10,7 +10,7 @@
 let
   unwrapped = kdeApp {
     name = "okular";
-    nativeBuildInputs = [ ecm kdoctools ];
+    nativeBuildInputs = [ extra-cmake-modules kdoctools ];
     propagatedBuildInputs = [
       djvulibre ebook_tools kactivities karchive kbookmarks kcompletion kconfig
       kconfigwidgets kcoreaddons kdbusaddons kdegraphics-mobipocket kiconthemes
diff --git a/pkgs/desktops/kde-5/applications/print-manager.nix b/pkgs/applications/kde/print-manager.nix
index c4a82780b448..0a3d311eb27a 100644
--- a/pkgs/desktops/kde-5/applications/print-manager.nix
+++ b/pkgs/applications/kde/print-manager.nix
@@ -1,5 +1,5 @@
 {
-  kdeApp, lib, ecm,
+  kdeApp, lib, extra-cmake-modules,
   cups, kconfig, kconfigwidgets, kdbusaddons, kiconthemes, ki18n, kcmutils, kio,
   knotifications, kwidgetsaddons, kwindowsystem, kitemviews, plasma-framework,
   qtdeclarative
@@ -11,7 +11,7 @@ kdeApp {
     license = [ lib.licenses.gpl2 ];
     maintainers = [ lib.maintainers.ttuegel ];
   };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     cups kconfig kconfigwidgets kdbusaddons kiconthemes kcmutils knotifications
     kwidgetsaddons kitemviews ki18n kio kwindowsystem plasma-framework
diff --git a/pkgs/desktops/kde-5/applications/spectacle.nix b/pkgs/applications/kde/spectacle.nix
index 4c3a5246b2e7..30abfc23e834 100644
--- a/pkgs/desktops/kde-5/applications/spectacle.nix
+++ b/pkgs/applications/kde/spectacle.nix
@@ -1,6 +1,6 @@
 {
   kdeApp, lib, kdeWrapper,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   kconfig, kcoreaddons, kdbusaddons, kdeclarative, ki18n, kio, kipi-plugins,
   knotifications, kscreen, kwidgetsaddons, kwindowsystem, kxmlgui, libkipi,
   xcb-util-cursor
@@ -11,7 +11,7 @@ let
     kdeApp {
       name = "spectacle";
       meta = with lib; { maintainers = with maintainers; [ ttuegel ]; };
-      nativeBuildInputs = [ ecm kdoctools ];
+      nativeBuildInputs = [ extra-cmake-modules kdoctools ];
       propagatedBuildInputs = [
         kconfig kcoreaddons kdbusaddons kdeclarative ki18n kio knotifications
         kscreen kwidgetsaddons kwindowsystem kxmlgui libkipi xcb-util-cursor
diff --git a/pkgs/desktops/kde-5/applications/srcs.nix b/pkgs/applications/kde/srcs.nix
index 60c412e55fda..60c412e55fda 100644
--- a/pkgs/desktops/kde-5/applications/srcs.nix
+++ b/pkgs/applications/kde/srcs.nix
diff --git a/pkgs/applications/misc/krename/default.nix b/pkgs/applications/misc/krename/default.nix
index a2137060ef64..8ce74850e1a4 100644
--- a/pkgs/applications/misc/krename/default.nix
+++ b/pkgs/applications/misc/krename/default.nix
@@ -1,6 +1,6 @@
 {
   kdeDerivation, kdeWrapper, fetchFromGitHub, lib,
-  ecm, kdoctools, kconfig, kinit, kjsembed,
+  extra-cmake-modules, kdoctools, kconfig, kinit, kjsembed,
   taglib, exiv2, podofo
 }:
 
@@ -25,7 +25,7 @@ let
     };
 
     buildInputs = [ taglib exiv2 podofo ];
-    nativeBuildInputs = [ ecm kdoctools ];
+    nativeBuildInputs = [ extra-cmake-modules kdoctools ];
     propagatedBuildInputs = [ kconfig kinit kjsembed ];
   };
 
diff --git a/pkgs/applications/misc/redshift-plasma-applet/default.nix b/pkgs/applications/misc/redshift-plasma-applet/default.nix
index 3cf6f7d754be..fe09f7ff16ea 100644
--- a/pkgs/applications/misc/redshift-plasma-applet/default.nix
+++ b/pkgs/applications/misc/redshift-plasma-applet/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, cmake, kde5, redshift, fetchFromGitHub, ... }:
+{ stdenv, cmake, plasma-framework, redshift, fetchFromGitHub, }:
 
 let version = "1.0.17"; in
 
@@ -26,7 +26,7 @@ stdenv.mkDerivation {
 
   buildInputs = [
     cmake
-    kde5.plasma-framework
+    plasma-framework
   ];
 
 
diff --git a/pkgs/applications/misc/yakuake/default.nix b/pkgs/applications/misc/yakuake/default.nix
index 8bce26deefc3..0d9f3834c615 100644
--- a/pkgs/applications/misc/yakuake/default.nix
+++ b/pkgs/applications/misc/yakuake/default.nix
@@ -3,7 +3,7 @@
 , fetchurl
 , kdoctools
 , kdeWrapper
-, ecm
+, extra-cmake-modules
 , karchive
 , kcrash
 , kdbusaddons
@@ -43,7 +43,7 @@ let
     ];
 
     nativeBuildInputs = [
-      ecm kdoctools
+      extra-cmake-modules kdoctools
     ];
 
     meta = {
diff --git a/pkgs/applications/networking/irc/konversation/default.nix b/pkgs/applications/networking/irc/konversation/default.nix
index 9724ae5f4bf0..6f4bc2af79f2 100644
--- a/pkgs/applications/networking/irc/konversation/default.nix
+++ b/pkgs/applications/networking/irc/konversation/default.nix
@@ -1,7 +1,7 @@
 { kdeDerivation
 , lib
 , fetchurl
-, ecm
+, extra-cmake-modules
 , kbookmarks
 , karchive
 , kconfig
@@ -64,7 +64,7 @@ let
     ];
 
     nativeBuildInputs = [
-      ecm
+      extra-cmake-modules
       kdoctools
     ];
 
diff --git a/pkgs/applications/networking/p2p/ktorrent/default.nix b/pkgs/applications/networking/p2p/ktorrent/default.nix
index 7e47838c4f98..73cd26b2a6e8 100644
--- a/pkgs/applications/networking/p2p/ktorrent/default.nix
+++ b/pkgs/applications/networking/p2p/ktorrent/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchurl, cmake
-, ecm, qtbase, qtscript
+, extra-cmake-modules, qtbase, qtscript
 , ki18n, kio, knotifications, knotifyconfig, kdoctools, kross, kcmutils, kdelibs4support
 , libktorrent, boost, taglib
 }:
@@ -22,7 +22,7 @@ stdenv.mkDerivation rec {
       })
     ];
 
-  nativeBuildInputs = [ kdoctools ecm ];
+  nativeBuildInputs = [ kdoctools extra-cmake-modules ];
 
   buildInputs =
     [ cmake qtbase qtscript
diff --git a/pkgs/applications/networking/sniffers/wireshark/default.nix b/pkgs/applications/networking/sniffers/wireshark/default.nix
index 7315b84d7f37..fd709aa76603 100644
--- a/pkgs/applications/networking/sniffers/wireshark/default.nix
+++ b/pkgs/applications/networking/sniffers/wireshark/default.nix
@@ -1,6 +1,6 @@
 { stdenv, lib, fetchurl, pkgconfig, pcre, perl, flex, bison, gettext, libpcap, libnl, c-ares
 , gnutls, libgcrypt, libgpgerror, geoip, openssl, lua5, makeDesktopItem, python, libcap, glib
-, libssh, zlib, cmake, ecm
+, libssh, zlib, cmake, extra-cmake-modules
 , withGtk ? false, gtk3 ? null, pango ? null, cairo ? null, gdk_pixbuf ? null
 , withQt ? false, qt5 ? null
 , ApplicationServices, SystemConfiguration, gmp
@@ -24,7 +24,7 @@ in stdenv.mkDerivation {
   };
 
   buildInputs = [
-    bison cmake ecm flex gettext pcre perl pkgconfig libpcap lua5 libssh openssl libgcrypt libgpgerror gnutls
+    bison cmake extra-cmake-modules flex gettext pcre perl pkgconfig libpcap lua5 libssh openssl libgcrypt libgpgerror gnutls
     geoip c-ares python glib zlib
   ] ++ (optionals withQt  (with qt5; [ qtbase qtmultimedia qtsvg qttools ]))
     ++ (optionals withGtk [ gtk3 pango cairo gdk_pixbuf ])
diff --git a/pkgs/applications/office/calligra/default.nix b/pkgs/applications/office/calligra/default.nix
index ad9cb9e5ff01..154ff33c8449 100644
--- a/pkgs/applications/office/calligra/default.nix
+++ b/pkgs/applications/office/calligra/default.nix
@@ -2,7 +2,7 @@
 , exiv2, boost, sqlite, icu, vc, shared_mime_info, librevenge, libodfgen, libwpg
 , libwpd, poppler_qt4, ilmbase, gsl, qca2, marble, libvisio, libmysql, postgresql
 , freetds, fftw, glew, libkdcraw, pstoedit, opencolorio, kdepimlibs
-, kactivities, okular, git, oxygen_icons, makeWrapper
+, kactivities, okular, git, oxygen-icons5, makeWrapper
 # TODO: not found
 #, xbase, openjpeg
 # TODO: package libWPS, Spnav, m2mml, LibEtonyek
@@ -32,7 +32,7 @@ stdenv.mkDerivation rec {
     for i in $out/bin/*; do
       wrapProgram $i \
         --prefix PATH ':' "${pstoedit.out}/bin" \
-        --prefix XDG_DATA_DIRS ':' "${oxygen_icons}/share"
+        --prefix XDG_DATA_DIRS ':' "${oxygen-icons5}/share"
     done
   '';
 
diff --git a/pkgs/applications/office/skrooge/default.nix b/pkgs/applications/office/skrooge/default.nix
index 42cc9b0c6eb1..acf60bd03755 100644
--- a/pkgs/applications/office/skrooge/default.nix
+++ b/pkgs/applications/office/skrooge/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, ecm, makeQtWrapper, qtwebkit, qtscript, grantlee,
+{ stdenv, fetchurl, cmake, extra-cmake-modules, makeQtWrapper, qtwebkit, qtscript, grantlee,
   kxmlgui, kwallet, kparts, kdoctools, kjobwidgets, kdesignerplugin,
   kiconthemes, knewstuff, sqlcipher, qca-qt5, kdelibs4support, kactivities,
   knotifyconfig, krunner, libofx }:
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
     sha256 = "1xrh9nal122rzlv4m0x8qah6zpqb6891al3351piarpk2xgjgj4x";
   };
 
-  nativeBuildInputs = [ cmake ecm makeQtWrapper ];
+  nativeBuildInputs = [ cmake extra-cmake-modules makeQtWrapper ];
 
   buildInputs = [ qtwebkit qtscript grantlee kxmlgui kwallet kparts kdoctools
     kjobwidgets kdesignerplugin kiconthemes knewstuff sqlcipher qca-qt5
diff --git a/pkgs/build-support/kde/derivation.nix b/pkgs/build-support/kde/derivation.nix
new file mode 100644
index 000000000000..2e29a0a661e1
--- /dev/null
+++ b/pkgs/build-support/kde/derivation.nix
@@ -0,0 +1,17 @@
+{ 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/development/libraries/kde-frameworks/kde-wrapper.nix b/pkgs/build-support/kde/wrapper.nix
index f5add12e8eca..f5add12e8eca 100644
--- a/pkgs/development/libraries/kde-frameworks/kde-wrapper.nix
+++ b/pkgs/build-support/kde/wrapper.nix
diff --git a/pkgs/desktops/kde-5/applications/default.nix b/pkgs/desktops/kde-5/applications/default.nix
deleted file mode 100644
index 3284b2709c86..000000000000
--- a/pkgs/desktops/kde-5/applications/default.nix
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
-
-# New packages
-
-READ THIS FIRST
-
-This module is for official packages in the KDE Applications Bundle. All
-available packages are listed in `./srcs.nix`, although some are not yet
-packaged in Nixpkgs (see below).
-
-IF YOUR PACKAGE IS NOT LISTED IN `./srcs.nix`, IT DOES NOT GO HERE.
-
-Many of the packages released upstream are not yet built in Nixpkgs due to lack
-of demand. To add a Nixpkgs build for an upstream package, copy one of the
-existing packages here and modify it as necessary. A simple example package that
-still shows most of the available features is in `./gwenview.nix`.
-
-# Updates
-
-1. Update the URL in `./fetch.sh`.
-2. Run `./maintainers/scripts/fetch-kde-qt.sh pkgs/desktops/kde-5/applications`
-   from the top of the Nixpkgs tree.
-3. Invoke `nix-build -A kde5` and ensure that everything builds.
-4. Commit the changes and open a pull request.
-
-*/
-
-{ pkgs, debug ? false }:
-
-let
-
-  inherit (pkgs) lib stdenv;
-
-  mirror = "mirror://kde";
-  srcs = import ./srcs.nix { inherit (pkgs) fetchurl; inherit mirror; };
-
-  packages = self: with self; {
-
-    kdeApp = import ./kde-app.nix {
-      inherit lib;
-      inherit debug srcs;
-      inherit kdeDerivation;
-    };
-
-    kdelibs = callPackage ./kdelibs {
-      inherit (srcs.kdelibs) src version;
-      inherit (pkgs) attica phonon;
-    };
-
-    akonadi = callPackage ./akonadi.nix {};
-    akonadi-contacts = callPackage ./akonadi-contacts.nix {};
-    akonadi-mime = callPackage ./akonadi-mime.nix {};
-    ark = callPackage ./ark/default.nix {};
-    baloo-widgets = callPackage ./baloo-widgets.nix {};
-    dolphin = callPackage ./dolphin.nix {};
-    dolphin-plugins = callPackage ./dolphin-plugins.nix {};
-    ffmpegthumbs = callPackage ./ffmpegthumbs.nix {
-      ffmpeg = pkgs.ffmpeg_2;
-    };
-    filelight = callPackage ./filelight.nix {};
-    gwenview = callPackage ./gwenview.nix {};
-    kate = callPackage ./kate.nix {};
-    kdenlive = callPackage ./kdenlive.nix {};
-    kcalc = callPackage ./kcalc.nix {};
-    kcolorchooser = callPackage ./kcolorchooser.nix {};
-    kcontacts = callPackage ./kcontacts.nix {};
-    kdegraphics-mobipocket = callPackage ./kdegraphics-mobipocket.nix {};
-    kdegraphics-thumbnailers = callPackage ./kdegraphics-thumbnailers.nix {};
-    kdenetwork-filesharing = callPackage ./kdenetwork-filesharing.nix {};
-    kdf = callPackage ./kdf.nix {};
-    kgpg = callPackage ./kgpg.nix {};
-    khelpcenter = callPackage ./khelpcenter.nix {};
-    kig = callPackage ./kig.nix {};
-    kio-extras = callPackage ./kio-extras.nix {};
-    kmime = callPackage ./kmime.nix {};
-    kmix = callPackage ./kmix.nix {};
-    kompare = callPackage ./kompare.nix {};
-    konsole = callPackage ./konsole.nix {};
-    kwalletmanager = callPackage ./kwalletmanager.nix {};
-    libkdcraw = callPackage ./libkdcraw.nix {};
-    libkexiv2 = callPackage ./libkexiv2.nix {};
-    libkipi = callPackage ./libkipi.nix {};
-    libkomparediff2 = callPackage ./libkomparediff2.nix {};
-    marble = callPackage ./marble.nix {};
-    okteta = callPackage ./okteta.nix {};
-    okular = callPackage ./okular.nix {};
-    print-manager = callPackage ./print-manager.nix {};
-    spectacle = callPackage ./spectacle.nix {};
-
-    l10n = pkgs.recurseIntoAttrs (import ./l10n.nix { inherit callPackage lib pkgs; });
-  };
-
-in packages
diff --git a/pkgs/desktops/kde-5/applications/libkomparediff2.nix b/pkgs/desktops/kde-5/applications/libkomparediff2.nix
deleted file mode 100644
index 91b469fed3c7..000000000000
--- a/pkgs/desktops/kde-5/applications/libkomparediff2.nix
+++ /dev/null
@@ -1,7 +0,0 @@
-{ kdeApp, lib, ecm, ki18n, kxmlgui, kcodecs, kio }:
-
-kdeApp {
-  name = "libkomparediff2";
-  nativeBuildInputs = [ ecm ];
-  propagatedBuildInputs = [ kcodecs ki18n kxmlgui kio ];
-}
diff --git a/pkgs/desktops/kde-5/plasma/breeze-qt4.nix b/pkgs/desktops/kde-5/plasma/breeze-qt4.nix
deleted file mode 100644
index ad98a41e81dd..000000000000
--- a/pkgs/desktops/kde-5/plasma/breeze-qt4.nix
+++ /dev/null
@@ -1,24 +0,0 @@
-{
-  stdenv, lib, src, version,
-  automoc4, cmake, perl, pkgconfig,
-  kdelibs, qt4, xproto
-}:
-
-stdenv.mkDerivation {
-  name = "breeze-qt4-${version}";
-  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";
-  };
-  inherit src;
-  buildInputs = [ kdelibs qt4 xproto ];
-  nativeBuildInputs = [ automoc4 cmake perl pkgconfig ];
-  cmakeFlags = [
-    "-DUSE_KDE4=ON"
-    "-DQT_QMAKE_EXECUTABLE=${qt4}/bin/qmake"
-  ];
-}
diff --git a/pkgs/desktops/kde-5/plasma/default.nix b/pkgs/desktops/kde-5/plasma/default.nix
deleted file mode 100644
index 3ac1c51848e9..000000000000
--- a/pkgs/desktops/kde-5/plasma/default.nix
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-
-# New packages
-
-READ THIS FIRST
-
-This module is for official packages in KDE Plasma 5. All available packages are
-listed in `./srcs.nix`, although a few are not yet packaged in Nixpkgs (see
-below).
-
-IF YOUR PACKAGE IS NOT LISTED IN `./srcs.nix`, IT DOES NOT GO HERE.
-
-Many of the packages released upstream are not yet built in Nixpkgs due to lack
-of demand. To add a Nixpkgs build for an upstream package, copy one of the
-existing packages here and modify it as necessary.
-
-# Updates
-
-1. Update the URL in `./fetch.sh`.
-2. Run `./maintainers/scripts/fetch-kde-qt.sh pkgs/desktops/kde-5/plasma`
-   from the top of the Nixpkgs tree.
-3. Invoke `nix-build -A kde5` and ensure that everything builds.
-4. Commit the changes and open a pull request.
-
-*/
-
-{ pkgs, debug ? false }:
-
-let
-
-  inherit (pkgs) lib makeSetupHook stdenv symlinkJoin;
-
-  mirror = "mirror://kde";
-  srcs = import ./srcs.nix { inherit (pkgs) fetchurl; inherit mirror; };
-
-  packages = self: with self; {
-    plasmaPackage = 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 {});
-      });
-
-    bluedevil = callPackage ./bluedevil.nix {};
-    breeze-gtk = callPackage ./breeze-gtk.nix {};
-    breeze-qt4 = callPackage ./breeze-qt4.nix {
-      inherit (srcs.breeze) src version;
-    };
-    breeze-qt5 = callPackage ./breeze-qt5.nix {};
-    breeze-grub = callPackage ./breeze-grub.nix {};
-    breeze-plymouth = callPackage ./breeze-plymouth {};
-    kactivitymanagerd = callPackage ./kactivitymanagerd.nix {};
-    kde-cli-tools = callPackage ./kde-cli-tools.nix {};
-    kde-gtk-config = callPackage ./kde-gtk-config {};
-    kdecoration = callPackage ./kdecoration.nix {};
-    kdeplasma-addons = callPackage ./kdeplasma-addons.nix {};
-    kgamma5 = callPackage ./kgamma5.nix {};
-    khotkeys = callPackage ./khotkeys.nix {};
-    kinfocenter = callPackage ./kinfocenter.nix {};
-    kmenuedit = callPackage ./kmenuedit.nix {};
-    kscreen = callPackage ./kscreen.nix {};
-    kscreenlocker = callPackage ./kscreenlocker.nix {};
-    ksshaskpass = callPackage ./ksshaskpass.nix {};
-    ksysguard = callPackage ./ksysguard.nix {};
-    kwallet-pam = callPackage ./kwallet-pam.nix {};
-    kwayland-integration = callPackage ./kwayland-integration.nix {};
-    kwin = callPackage ./kwin {};
-    kwrited = callPackage ./kwrited.nix {};
-    libkscreen = callPackage ./libkscreen.nix {};
-    libksysguard = callPackage ./libksysguard {};
-    milou = callPackage ./milou.nix {};
-    oxygen = callPackage ./oxygen.nix {};
-    plasma-desktop = callPackage ./plasma-desktop {};
-    plasma-integration = callPackage ./plasma-integration.nix {};
-    plasma-nm = callPackage ./plasma-nm {};
-    plasma-pa = callPackage ./plasma-pa.nix {
-      inherit (pkgs.gnome3) gconf;
-    };
-    plasma-workspace = callPackage ./plasma-workspace {};
-    plasma-workspace-wallpapers = callPackage ./plasma-workspace-wallpapers.nix {};
-    polkit-kde-agent = callPackage ./polkit-kde-agent.nix {};
-    powerdevil = callPackage ./powerdevil.nix {};
-    startkde = callPackage ./startkde {};
-    systemsettings = callPackage ./systemsettings.nix {};
-  };
-
-in packages
diff --git a/pkgs/desktops/kde-5/plasma/fetch.sh b/pkgs/desktops/kde-5/plasma/fetch.sh
deleted file mode 100644
index 76f05bad0a77..000000000000
--- a/pkgs/desktops/kde-5/plasma/fetch.sh
+++ /dev/null
@@ -1 +0,0 @@
-WGET_ARGS=( http://download.kde.org/stable/plasma/5.8.5/ -A '*.tar.xz' )
diff --git a/pkgs/desktops/kde-5/plasma/kdecoration.nix b/pkgs/desktops/kde-5/plasma/kdecoration.nix
deleted file mode 100644
index a0f9d93e60b0..000000000000
--- a/pkgs/desktops/kde-5/plasma/kdecoration.nix
+++ /dev/null
@@ -1,6 +0,0 @@
-{ plasmaPackage, ecm }:
-
-plasmaPackage {
-  name = "kdecoration";
-  nativeBuildInputs = [ ecm ];
-}
diff --git a/pkgs/desktops/kde-5/plasma/kgamma5.nix b/pkgs/desktops/kde-5/plasma/kgamma5.nix
deleted file mode 100644
index 70d7cc17a1ca..000000000000
--- a/pkgs/desktops/kde-5/plasma/kgamma5.nix
+++ /dev/null
@@ -1,9 +0,0 @@
-{ plasmaPackage, ecm, kdoctools, kdelibs4support
-, qtx11extras
-}:
-
-plasmaPackage {
-  name = "kgamma5";
-  nativeBuildInputs = [ ecm kdoctools ];
-  propagatedBuildInputs = [ kdelibs4support qtx11extras ];
-}
diff --git a/pkgs/desktops/kde-5/plasma/khotkeys.nix b/pkgs/desktops/kde-5/plasma/khotkeys.nix
deleted file mode 100644
index f23a17e5479e..000000000000
--- a/pkgs/desktops/kde-5/plasma/khotkeys.nix
+++ /dev/null
@@ -1,22 +0,0 @@
-{ plasmaPackage, ecm, kdoctools, kcmutils
-, kdbusaddons, kdelibs4support, kglobalaccel, ki18n, kio, kxmlgui
-, plasma-framework, plasma-workspace, qtx11extras
-, fetchpatch
-}:
-
-plasmaPackage {
-  name = "khotkeys";
-  nativeBuildInputs = [ ecm kdoctools ];
-
-  patches = [
-    # Patch is in 5.9 and up.
-    (fetchpatch {
-      url = "https://cgit.kde.org/khotkeys.git/patch/?id=f8f7eaaf41e2b95ebfa4b2e35c6ee252524a471b";
-      sha256 = "1wxx3qv16jd623jh728xcda8i4y1daq25skwilhv4cfvqxyzk7nn";
-    })
-  ];
-  propagatedBuildInputs = [
-    kdelibs4support kglobalaccel ki18n kio plasma-framework plasma-workspace
-    qtx11extras kcmutils kdbusaddons kxmlgui
-  ];
-}
diff --git a/pkgs/desktops/kde-5/plasma/kwallet-pam.nix b/pkgs/desktops/kde-5/plasma/kwallet-pam.nix
deleted file mode 100644
index 86ba52292f9e..000000000000
--- a/pkgs/desktops/kde-5/plasma/kwallet-pam.nix
+++ /dev/null
@@ -1,11 +0,0 @@
-{ plasmaPackage, ecm, pam, socat, libgcrypt
-}:
-
-plasmaPackage {
-  name = "kwallet-pam";
-
-  nativeBuildInputs = [ ecm ];
-
-  buildInputs = [ pam socat libgcrypt ];
-
-}
diff --git a/pkgs/desktops/kde-5/plasma/srcs.nix b/pkgs/desktops/kde-5/plasma/srcs.nix
deleted file mode 100644
index 03ee867453b6..000000000000
--- a/pkgs/desktops/kde-5/plasma/srcs.nix
+++ /dev/null
@@ -1,325 +0,0 @@
-# DO NOT EDIT! This file is generated automatically by fetch-kde-qt.sh
-{ fetchurl, mirror }:
-
-{
-  bluedevil = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/bluedevil-5.8.5.tar.xz";
-      sha256 = "07gj3m5f0rk26n0xm4yddsfny6l2sh0airm45hb33p7m5inaqzgv";
-      name = "bluedevil-5.8.5.tar.xz";
-    };
-  };
-  breeze = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/breeze-5.8.5.tar.xz";
-      sha256 = "1gcns00iq7a5f1a0w6vf8zck669gzcd785fiybnvc6s6q8x4bp61";
-      name = "breeze-5.8.5.tar.xz";
-    };
-  };
-  breeze-grub = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/breeze-grub-5.8.5.tar.xz";
-      sha256 = "12ynrxdfcraphbwv9yrfhvwf3xkzrw0raqvgi7ksz5cvh78kl5qf";
-      name = "breeze-grub-5.8.5.tar.xz";
-    };
-  };
-  breeze-gtk = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/breeze-gtk-5.8.5.tar.xz";
-      sha256 = "15dx5hl9w9fiash30vgkbww6h7hck0dr42hh8gzysn0xyf0fzpgd";
-      name = "breeze-gtk-5.8.5.tar.xz";
-    };
-  };
-  breeze-plymouth = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/breeze-plymouth-5.8.5.tar.xz";
-      sha256 = "1ryb2jrzw0bzpi7ig4h5k0i33d2qviqsjxw7mnqxcb9q49a4ziq1";
-      name = "breeze-plymouth-5.8.5.tar.xz";
-    };
-  };
-  discover = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/discover-5.8.5.tar.xz";
-      sha256 = "0fr6mksqw46aghfzj78nlq3f89xd63vq2hr4c3gb4vkl5y8v08hg";
-      name = "discover-5.8.5.tar.xz";
-    };
-  };
-  kactivitymanagerd = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/kactivitymanagerd-5.8.5.tar.xz";
-      sha256 = "07cqnbyznn5wy7vrqyid8h5ah7h3sb3pb30qlm83b4m29bkhggwh";
-      name = "kactivitymanagerd-5.8.5.tar.xz";
-    };
-  };
-  kde-cli-tools = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/kde-cli-tools-5.8.5.tar.xz";
-      sha256 = "1ig9x5h9xkzis9izggkjpiiy4sm77pk347jdngx01qpacz68iyp7";
-      name = "kde-cli-tools-5.8.5.tar.xz";
-    };
-  };
-  kdecoration = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/kdecoration-5.8.5.tar.xz";
-      sha256 = "1vhw57pj9i5224i9irk4qmingvkg5bip11vsqiwhmn5307bpnfiq";
-      name = "kdecoration-5.8.5.tar.xz";
-    };
-  };
-  kde-gtk-config = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/kde-gtk-config-5.8.5.tar.xz";
-      sha256 = "1j0mzmmdhqd3a8papps6cad0gqn081mc4kqzi2hjai7038l6951r";
-      name = "kde-gtk-config-5.8.5.tar.xz";
-    };
-  };
-  kdeplasma-addons = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/kdeplasma-addons-5.8.5.tar.xz";
-      sha256 = "181kagb4nbl9a7akk79slwkb7m2j4vyhabagih0z8l45wl5wrz9d";
-      name = "kdeplasma-addons-5.8.5.tar.xz";
-    };
-  };
-  kgamma5 = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/kgamma5-5.8.5.tar.xz";
-      sha256 = "073z4w4i2hwsqqgxcfl0w8d57nhzc069h9zwp7fv93aaw4mgzci2";
-      name = "kgamma5-5.8.5.tar.xz";
-    };
-  };
-  khotkeys = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/khotkeys-5.8.5.tar.xz";
-      sha256 = "1fh0z9vfb908nbwj3snkf9z55jbcb5id87k5sa0v8dhazmp91ylh";
-      name = "khotkeys-5.8.5.tar.xz";
-    };
-  };
-  kinfocenter = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/kinfocenter-5.8.5.tar.xz";
-      sha256 = "1fksnb9klbcrr9ly6dd2yx5y1ngcwcln43zykpc76pr4i49jpggp";
-      name = "kinfocenter-5.8.5.tar.xz";
-    };
-  };
-  kmenuedit = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/kmenuedit-5.8.5.tar.xz";
-      sha256 = "1vq5f69w75lj81nz75db88lqxc4zvhicd5w7r6k7amggnwxm9f3m";
-      name = "kmenuedit-5.8.5.tar.xz";
-    };
-  };
-  kscreen = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/kscreen-5.8.5.tar.xz";
-      sha256 = "069x3vsfqirmq8r7yfa68srhjvygdwsxcj0b4vvb7zivs29zn1mh";
-      name = "kscreen-5.8.5.tar.xz";
-    };
-  };
-  kscreenlocker = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/kscreenlocker-5.8.5.tar.xz";
-      sha256 = "11b2v3chhk1ma5kjbmf35qahfr8gbaw78mcqs8vw5m9x74vlimkj";
-      name = "kscreenlocker-5.8.5.tar.xz";
-    };
-  };
-  ksshaskpass = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/ksshaskpass-5.8.5.tar.xz";
-      sha256 = "1gr48f4akrn0yhlnjw4yaas6ah5z40fb8iz06gi1dzry5axfmaxh";
-      name = "ksshaskpass-5.8.5.tar.xz";
-    };
-  };
-  ksysguard = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/ksysguard-5.8.5.tar.xz";
-      sha256 = "1gd81y2a459j5k1mpikfrvwcz7v09m526nrl7kpr4l4a1ps8zfy9";
-      name = "ksysguard-5.8.5.tar.xz";
-    };
-  };
-  kwallet-pam = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/kwallet-pam-5.8.5.tar.xz";
-      sha256 = "0310vr3p9fxl3vwdgklk0acx6w31pcpq8mi9yldahg1mkjqf7l44";
-      name = "kwallet-pam-5.8.5.tar.xz";
-    };
-  };
-  kwayland-integration = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/kwayland-integration-5.8.5.tar.xz";
-      sha256 = "11f63mq7crsbrpdib16q8xg0hk8jr5x1cyv43q8qdqm0591cglli";
-      name = "kwayland-integration-5.8.5.tar.xz";
-    };
-  };
-  kwin = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/kwin-5.8.5.tar.xz";
-      sha256 = "182z17d4sad9j15qagx9yz13wwzcyy6hlgpy5nlx6dlfcb8s00x7";
-      name = "kwin-5.8.5.tar.xz";
-    };
-  };
-  kwrited = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/kwrited-5.8.5.tar.xz";
-      sha256 = "1nsr244niyq2bk29s0cqq1p2qj0h1hx4nl13nc3x3aycfhfkjfkr";
-      name = "kwrited-5.8.5.tar.xz";
-    };
-  };
-  libkscreen = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/libkscreen-5.8.5.tar.xz";
-      sha256 = "1zj2nzyl0nmg5za3iwr4q4nzfv69f35f0394b6k0g3dgh1zxmby9";
-      name = "libkscreen-5.8.5.tar.xz";
-    };
-  };
-  libksysguard = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/libksysguard-5.8.5.tar.xz";
-      sha256 = "1acp4kzdjhipsqw90n3rc1ydbkqhb12afwdsfl25fibv0c39avwp";
-      name = "libksysguard-5.8.5.tar.xz";
-    };
-  };
-  milou = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/milou-5.8.5.tar.xz";
-      sha256 = "0lj5cb43jkqs8qg2acs39dkfwskbw135ap65vxiv27ivxscyvz3d";
-      name = "milou-5.8.5.tar.xz";
-    };
-  };
-  oxygen = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/oxygen-5.8.5.tar.xz";
-      sha256 = "199jcn6qzyihxmw38b1cl0ah0rzn7f574khx72n9x5y9143p9lh7";
-      name = "oxygen-5.8.5.tar.xz";
-    };
-  };
-  plasma-desktop = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/plasma-desktop-5.8.5.tar.xz";
-      sha256 = "045990fvhqpwhfi6jqpkzhgbhc3lwvwhkia1y77m12n1djbynpnr";
-      name = "plasma-desktop-5.8.5.tar.xz";
-    };
-  };
-  plasma-integration = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/plasma-integration-5.8.5.tar.xz";
-      sha256 = "1sm7027ywz8xxqfsjv6jvk8zx11kx83rx88bb8cy31qfjipsakfb";
-      name = "plasma-integration-5.8.5.tar.xz";
-    };
-  };
-  plasma-nm = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/plasma-nm-5.8.5.tar.xz";
-      sha256 = "1g1yyzc8y2hsgycficvavpl5yizd54ns93cdky9cgsrnxlkfwbvc";
-      name = "plasma-nm-5.8.5.tar.xz";
-    };
-  };
-  plasma-pa = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/plasma-pa-5.8.5.tar.xz";
-      sha256 = "0vg1dyxfg8rxzyh0xnk41c95zp8rdbx1w462llrwchzp29p3xg1b";
-      name = "plasma-pa-5.8.5.tar.xz";
-    };
-  };
-  plasma-sdk = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/plasma-sdk-5.8.5.tar.xz";
-      sha256 = "13lyb5x4a8aq4fykvdv1137yvc4s4q31fdxhxppza1wkw8lvbvpd";
-      name = "plasma-sdk-5.8.5.tar.xz";
-    };
-  };
-  plasma-tests = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/plasma-tests-5.8.5.tar.xz";
-      sha256 = "0wgqyqlqygi3z0cccpfrpi259jp4yhh2g4x3mqcxisv58mbjrj1b";
-      name = "plasma-tests-5.8.5.tar.xz";
-    };
-  };
-  plasma-workspace = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/plasma-workspace-5.8.5.tar.xz";
-      sha256 = "18bf5wmyb198jnbpivjjwsk65sksrvzlvykx3mr3wvj30mr0f9bd";
-      name = "plasma-workspace-5.8.5.tar.xz";
-    };
-  };
-  plasma-workspace-wallpapers = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/plasma-workspace-wallpapers-5.8.5.tar.xz";
-      sha256 = "116s9qw888lbgxc9ggxf7fa99vggixr2ig1715xb5zmqm14yznyz";
-      name = "plasma-workspace-wallpapers-5.8.5.tar.xz";
-    };
-  };
-  polkit-kde-agent = {
-    version = "1-5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/polkit-kde-agent-1-5.8.5.tar.xz";
-      sha256 = "1dwk848wljcd9bi0h58h0ljnjlz1qq50rd7i38f3cb848iipisw7";
-      name = "polkit-kde-agent-1-5.8.5.tar.xz";
-    };
-  };
-  powerdevil = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/powerdevil-5.8.5.tar.xz";
-      sha256 = "0lj7jcaqfsipiwi7x4q684p4pfsqzflvddr7hrhirfl1p62bc704";
-      name = "powerdevil-5.8.5.tar.xz";
-    };
-  };
-  sddm-kcm = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/sddm-kcm-5.8.5.tar.xz";
-      sha256 = "0dcvk3f3cqq4z5hc63ccpxyl3kknjvd8jsnx7r2hfrwsw0y90fqc";
-      name = "sddm-kcm-5.8.5.tar.xz";
-    };
-  };
-  systemsettings = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/systemsettings-5.8.5.tar.xz";
-      sha256 = "0pkwmgbjglbyc8i22hivh5gnaj742df3ff3f998k66k81mfjkwga";
-      name = "systemsettings-5.8.5.tar.xz";
-    };
-  };
-  user-manager = {
-    version = "5.8.5";
-    src = fetchurl {
-      url = "${mirror}/stable/plasma/5.8.5/user-manager-5.8.5.tar.xz";
-      sha256 = "1ck8x860q3aqgbbgiwfdhs0i0bs2nhqqva19kl9x1b015p64gl5z";
-      name = "user-manager-5.8.5.tar.xz";
-    };
-  };
-}
diff --git a/pkgs/desktops/lumina/default.nix b/pkgs/desktops/lumina/default.nix
index f593bd144374..2c80f5157b66 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, qt5, kde5
+{ stdenv, fetchFromGitHub, fluxbox, xscreensaver, desktop_file_utils, numlockx,
+  xorg, qtbase, qtsvg, qtmultimedia, qtx11extras, qmakeHook, qttools, oxygen-icons5
 }:
 
 stdenv.mkDerivation rec {
@@ -14,19 +14,19 @@ stdenv.mkDerivation rec {
   };
 
   nativeBuildInputs = [
-    qt5.qmakeHook
-    qt5.qttools
+    qmakeHook
+    qttools
   ];
 
   buildInputs = [
     xorg.libxcb
     xorg.xcbutilwm
     xorg.xcbutilimage
-    qt5.qtbase
-    qt5.qtsvg
-    qt5.qtmultimedia
-    qt5.qtx11extras
-    kde5.oxygen-icons5
+    qtbase
+    qtsvg
+    qtmultimedia
+    qtx11extras
+    oxygen-icons5
     fluxbox
     xscreensaver
     desktop_file_utils
diff --git a/pkgs/desktops/lxqt/base/liblxqt/default.nix b/pkgs/desktops/lxqt/base/liblxqt/default.nix
index 2d4faee5cf33..9363dba86699 100644
--- a/pkgs/desktops/lxqt/base/liblxqt/default.nix
+++ b/pkgs/desktops/lxqt/base/liblxqt/default.nix
@@ -1,4 +1,5 @@
-{ stdenv, fetchFromGitHub, cmake, qt5, kde5, lxqt, xorg }:
+{ stdenv, fetchFromGitHub, cmake, lxqt-build-tools,
+  qtx11extras, qttools, qtsvg, libqtxdg, kwindowsystem, xorg }:
 
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
@@ -14,15 +15,15 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [
     cmake
-    lxqt.lxqt-build-tools
+    lxqt-build-tools
   ];
 
   buildInputs = [
-    qt5.qtx11extras
-    qt5.qttools
-    qt5.qtsvg
-    kde5.kwindowsystem
-    lxqt.libqtxdg
+    qtx11extras
+    qttools
+    qtsvg
+    kwindowsystem
+    libqtxdg
     xorg.libXScrnSaver
   ];
 
diff --git a/pkgs/desktops/lxqt/core/libfm-qt/default.nix b/pkgs/desktops/lxqt/core/libfm-qt/default.nix
index 4c7ecbc1804d..78c0a926b9c8 100644
--- a/pkgs/desktops/lxqt/core/libfm-qt/default.nix
+++ b/pkgs/desktops/lxqt/core/libfm-qt/default.nix
@@ -1,5 +1,8 @@
-{ stdenv, fetchFromGitHub, cmake, pkgconfig, qt5, kde5, lxqt, xorg,
-libfm, menu-cache }:
+{
+  stdenv, fetchFromGitHub, cmake, pkgconfig, lxqt-build-tools,
+  xorg, libfm, menu-cache,
+  qtx11extras, qttools
+}:
 
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
@@ -16,18 +19,18 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [
     cmake
     pkgconfig
-    lxqt.lxqt-build-tools
+    lxqt-build-tools
   ];
 
   buildInputs = [
-    qt5.qtx11extras
-    qt5.qttools
+    qtx11extras
+    qttools
     libfm
     menu-cache
   ];
 
   cmakeFlags = [ "-DPULL_TRANSLATIONS=NO" ];
-   
+
   meta = with stdenv.lib; {
     description = "Core library of PCManFM-Qt (Qt binding for libfm)";
     homepage = https://github.com/lxde/libfm-qt;
diff --git a/pkgs/desktops/lxqt/core/lxqt-about/default.nix b/pkgs/desktops/lxqt/core/lxqt-about/default.nix
index 34491d0414bc..ac81391af1d9 100644
--- a/pkgs/desktops/lxqt/core/lxqt-about/default.nix
+++ b/pkgs/desktops/lxqt/core/lxqt-about/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, qt5, kde5, lxqt }:
+{ stdenv, fetchFromGitHub, cmake, lxqt-build-tools, standardPatch, qtx11extras, qttools, qtsvg, kwindowsystem, liblxqt, libqtxdg }:
 
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
@@ -14,21 +14,21 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [
     cmake
-    lxqt.lxqt-build-tools
+    lxqt-build-tools
   ];
 
   buildInputs = [
-    qt5.qtx11extras
-    qt5.qttools
-    qt5.qtsvg
-    kde5.kwindowsystem
-    lxqt.liblxqt
-    lxqt.libqtxdg
+    qtx11extras
+    qttools
+    qtsvg
+    kwindowsystem
+    liblxqt
+    libqtxdg
   ];
 
   cmakeFlags = [ "-DPULL_TRANSLATIONS=NO" ];
 
-  postPatch = lxqt.standardPatch;
+  postPatch = standardPatch;
 
   meta = with stdenv.lib; {
     description = "Dialogue window providing information about LXQt and the system it's running on";
diff --git a/pkgs/desktops/lxqt/core/lxqt-admin/default.nix b/pkgs/desktops/lxqt/core/lxqt-admin/default.nix
index 2e6ae9858ad3..23b142f352f0 100644
--- a/pkgs/desktops/lxqt/core/lxqt-admin/default.nix
+++ b/pkgs/desktops/lxqt/core/lxqt-admin/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, qt5, kde5, lxqt, polkit }:
+{ stdenv, fetchFromGitHub, cmake, lxqt-build-tools, standardPatch, qtx11extras, qttools, qtsvg, kwindowsystem, liblxqt, libqtxdg, polkit }:
 
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
@@ -14,22 +14,22 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [
     cmake
-    lxqt.lxqt-build-tools
+    lxqt-build-tools
   ];
 
   buildInputs = [
-    qt5.qtx11extras
-    qt5.qttools
-    qt5.qtsvg
-    kde5.kwindowsystem
-    lxqt.liblxqt
-    lxqt.libqtxdg
+    qtx11extras
+    qttools
+    qtsvg
+    kwindowsystem
+    liblxqt
+    libqtxdg
     polkit
   ];
 
   cmakeFlags = [ "-DPULL_TRANSLATIONS=NO" ];
 
-  postPatch = lxqt.standardPatch;
+  postPatch = standardPatch;
 
   meta = with stdenv.lib; {
     description = "LXQt system administration tool";
diff --git a/pkgs/desktops/lxqt/core/lxqt-config/default.nix b/pkgs/desktops/lxqt/core/lxqt-config/default.nix
index a16fcd21f68f..7b38d2eec6fd 100644
--- a/pkgs/desktops/lxqt/core/lxqt-config/default.nix
+++ b/pkgs/desktops/lxqt/core/lxqt-config/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkgconfig, qt5, kde5, lxqt, xorg }:
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, lxqt-build-tools, standardPatch, qtbase, qtx11extras, qttools, qtsvg, kwindowsystem, libkscreen, liblxqt, libqtxdg, libpthreadstubs, xorg }:
 
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
@@ -15,18 +15,18 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [
     cmake
     pkgconfig
-    lxqt.lxqt-build-tools
+    lxqt-build-tools
   ];
 
   buildInputs = [
-    qt5.qtbase
-    qt5.qtx11extras
-    qt5.qttools
-    qt5.qtsvg
-    kde5.kwindowsystem
-    kde5.libkscreen
-    lxqt.liblxqt
-    lxqt.libqtxdg
+    qtbase
+    qtx11extras
+    qttools
+    qtsvg
+    kwindowsystem
+    libkscreen
+    liblxqt
+    libqtxdg
     xorg.libpthreadstubs
     xorg.libXdmcp
     xorg.libXScrnSaver
@@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-DPULL_TRANSLATIONS=NO" ];
 
-  postPatch = lxqt.standardPatch;
+  postPatch = standardPatch;
 
   meta = with stdenv.lib; {
     description = "Tools to configure LXQt and the underlying operating system";
diff --git a/pkgs/desktops/lxqt/core/lxqt-globalkeys/default.nix b/pkgs/desktops/lxqt/core/lxqt-globalkeys/default.nix
index a23bff6e8d1d..73248da1ef80 100644
--- a/pkgs/desktops/lxqt/core/lxqt-globalkeys/default.nix
+++ b/pkgs/desktops/lxqt/core/lxqt-globalkeys/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, qt5, kde5, lxqt }:
+{ stdenv, fetchFromGitHub, cmake, lxqt-build-tools, standardPatch, qtbase, qttools, qtx11extras, qtsvg, kwindowsystem, liblxqt, libqtxdg }:
 
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
@@ -14,22 +14,22 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [
     cmake
-    lxqt.lxqt-build-tools
+    lxqt-build-tools
   ];
 
   buildInputs = [
-    qt5.qtbase
-    qt5.qttools
-    qt5.qtx11extras
-    qt5.qtsvg
-    kde5.kwindowsystem
-    lxqt.liblxqt
-    lxqt.libqtxdg
+    qtbase
+    qttools
+    qtx11extras
+    qtsvg
+    kwindowsystem
+    liblxqt
+    libqtxdg
   ];
 
   cmakeFlags = [ "-DPULL_TRANSLATIONS=NO" ];
 
-  postPatch = lxqt.standardPatch;
+  postPatch = standardPatch;
 
   meta = with stdenv.lib; {
     description = "Daemon used to register global keyboard shortcuts";
diff --git a/pkgs/desktops/lxqt/core/lxqt-notificationd/default.nix b/pkgs/desktops/lxqt/core/lxqt-notificationd/default.nix
index 3646a461c830..cb10df5a1b72 100644
--- a/pkgs/desktops/lxqt/core/lxqt-notificationd/default.nix
+++ b/pkgs/desktops/lxqt/core/lxqt-notificationd/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, qt5, kde5, lxqt }:
+{ stdenv, fetchFromGitHub, cmake, lxqt-build-tools, qtbase, qttools, qtsvg, kwindowsystem, liblxqt, libqtxdg, lxqt-common }:
 
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
@@ -14,17 +14,17 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [
     cmake
-    lxqt.lxqt-build-tools
+    lxqt-build-tools
   ];
 
   buildInputs = [
-    qt5.qtbase
-    qt5.qttools
-    qt5.qtsvg
-    kde5.kwindowsystem
-    lxqt.liblxqt
-    lxqt.libqtxdg
-    lxqt.lxqt-common
+    qtbase
+    qttools
+    qtsvg
+    kwindowsystem
+    liblxqt
+    libqtxdg
+    lxqt-common
   ];
 
   cmakeFlags = [ "-DPULL_TRANSLATIONS=NO" ];
diff --git a/pkgs/desktops/lxqt/core/lxqt-openssh-askpass/default.nix b/pkgs/desktops/lxqt/core/lxqt-openssh-askpass/default.nix
index 9190718fde4f..a52ce02cd14b 100644
--- a/pkgs/desktops/lxqt/core/lxqt-openssh-askpass/default.nix
+++ b/pkgs/desktops/lxqt/core/lxqt-openssh-askpass/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, qt5, kde5, lxqt }:
+{ stdenv, fetchFromGitHub, cmake, lxqt-build-tools, qtbase, qttools, qtsvg, qtx11extras, kwindowsystem, liblxqt, libqtxdg }:
 
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
@@ -14,17 +14,17 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [
     cmake
-    lxqt.lxqt-build-tools
+    lxqt-build-tools
   ];
 
   buildInputs = [
-    qt5.qtbase
-    qt5.qttools
-    qt5.qtx11extras
-    qt5.qtsvg
-    kde5.kwindowsystem
-    lxqt.liblxqt
-    lxqt.libqtxdg
+    qtbase
+    qttools
+    qtx11extras
+    qtsvg
+    kwindowsystem
+    liblxqt
+    libqtxdg
   ];
 
   cmakeFlags = [ "-DPULL_TRANSLATIONS=NO" ];
diff --git a/pkgs/desktops/lxqt/core/lxqt-panel/default.nix b/pkgs/desktops/lxqt/core/lxqt-panel/default.nix
index 0c899c67dad5..dfbd39acaa35 100644
--- a/pkgs/desktops/lxqt/core/lxqt-panel/default.nix
+++ b/pkgs/desktops/lxqt/core/lxqt-panel/default.nix
@@ -1,6 +1,11 @@
-{ stdenv, fetchFromGitHub, cmake, pkgconfig, qt5, kde5, lxqt, xorg,
-libstatgrab, lm_sensors, libpulseaudio, alsaLib, menu-cache,
-lxmenu-data }:
+{
+  stdenv, fetchFromGitHub, standardPatch,
+  cmake, pkgconfig, lxqt-build-tools,
+  qtbase, qttools, qtx11extras, qtsvg, libdbusmenu, kwindowsystem, solid,
+  kguiaddons, liblxqt, libqtxdg, lxqt-common, lxqt-globalkeys, libsysstat,
+  xorg, libstatgrab, lm_sensors, libpulseaudio, alsaLib, menu-cache,
+  lxmenu-data
+}:
 
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
@@ -17,23 +22,23 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [
     cmake
     pkgconfig
-    lxqt.lxqt-build-tools
+    lxqt-build-tools
   ];
 
   buildInputs = [
-    qt5.qtbase
-    qt5.qttools
-    qt5.qtx11extras
-    qt5.qtsvg
-    qt5.libdbusmenu
-    kde5.kwindowsystem
-    kde5.solid
-    kde5.kguiaddons
-    lxqt.liblxqt
-    lxqt.libqtxdg
-    lxqt.lxqt-common
-    lxqt.lxqt-globalkeys
-    lxqt.libsysstat
+    qtbase
+    qttools
+    qtx11extras
+    qtsvg
+    libdbusmenu
+    kwindowsystem
+    solid
+    kguiaddons
+    liblxqt
+    libqtxdg
+    lxqt-common
+    lxqt-globalkeys
+    libsysstat
     xorg.libpthreadstubs
     xorg.libXdmcp
     libstatgrab
@@ -46,7 +51,7 @@ stdenv.mkDerivation rec {
 
   cmakeFlags = [ "-DPULL_TRANSLATIONS=NO" ];
 
-  postPatch = lxqt.standardPatch;
+  postPatch = standardPatch;
 
   meta = with stdenv.lib; {
     description = "The LXQt desktop panel";
diff --git a/pkgs/desktops/lxqt/core/lxqt-policykit/default.nix b/pkgs/desktops/lxqt/core/lxqt-policykit/default.nix
index f4351a9598d7..bdcc0a4d606e 100644
--- a/pkgs/desktops/lxqt/core/lxqt-policykit/default.nix
+++ b/pkgs/desktops/lxqt/core/lxqt-policykit/default.nix
@@ -1,4 +1,8 @@
-{ stdenv, fetchFromGitHub, cmake, pkgconfig, qt5, kde5, lxqt }:
+{
+  stdenv, fetchFromGitHub, cmake, pkgconfig, lxqt-build-tools,
+  qtbase, qttools, qtx11extras, qtsvg, polkit-qt, kwindowsystem, liblxqt,
+  libqtxdg,
+}:
 
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
@@ -15,18 +19,18 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [
     cmake
     pkgconfig
-    lxqt.lxqt-build-tools
+    lxqt-build-tools
   ];
 
   buildInputs = [
-    qt5.qtbase
-    qt5.qttools
-    qt5.qtx11extras
-    qt5.qtsvg
-    qt5.polkit-qt
-    kde5.kwindowsystem
-    lxqt.liblxqt
-    lxqt.libqtxdg
+    qtbase
+    qttools
+    qtx11extras
+    qtsvg
+    polkit-qt
+    kwindowsystem
+    liblxqt
+    libqtxdg
   ];
 
   cmakeFlags = [ "-DPULL_TRANSLATIONS=NO" ];
diff --git a/pkgs/desktops/lxqt/core/lxqt-powermanagement/default.nix b/pkgs/desktops/lxqt/core/lxqt-powermanagement/default.nix
index b7321c646686..d3793a9d9286 100644
--- a/pkgs/desktops/lxqt/core/lxqt-powermanagement/default.nix
+++ b/pkgs/desktops/lxqt/core/lxqt-powermanagement/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, qt5, kde5, lxqt }:
+{ stdenv, fetchFromGitHub, cmake, lxqt-build-tools, qtbase, qttools, qtx11extras, qtsvg, kwindowsystem, solid, kidletime, liblxqt, libqtxdg }:
 
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
@@ -14,19 +14,19 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [
     cmake
-    lxqt.lxqt-build-tools
+    lxqt-build-tools
   ];
 
   buildInputs = [
-    qt5.qtbase
-    qt5.qttools
-    qt5.qtx11extras
-    qt5.qtsvg
-    kde5.kwindowsystem
-    kde5.solid
-    kde5.kidletime
-    lxqt.liblxqt
-    lxqt.libqtxdg
+    qtbase
+    qttools
+    qtx11extras
+    qtsvg
+    kwindowsystem
+    solid
+    kidletime
+    liblxqt
+    libqtxdg
   ];
 
   cmakeFlags = [ "-DPULL_TRANSLATIONS=NO" ];
diff --git a/pkgs/desktops/lxqt/core/lxqt-qtplugin/default.nix b/pkgs/desktops/lxqt/core/lxqt-qtplugin/default.nix
index 49fa7c616335..d5b8987bbb82 100644
--- a/pkgs/desktops/lxqt/core/lxqt-qtplugin/default.nix
+++ b/pkgs/desktops/lxqt/core/lxqt-qtplugin/default.nix
@@ -1,4 +1,8 @@
-{ stdenv, fetchFromGitHub, cmake, qt5, lxqt }:
+{
+  stdenv, fetchFromGitHub, standardPatch,
+  cmake, lxqt-build-tools,
+  qtbase, qtx11extras, qttools, qtsvg, libdbusmenu, libqtxdg,
+}:
 
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
@@ -14,21 +18,21 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [
     cmake
-    lxqt.lxqt-build-tools
+    lxqt-build-tools
   ];
 
   buildInputs = [
-    qt5.qtbase
-    qt5.qtx11extras
-    qt5.qttools
-    qt5.qtsvg
-    qt5.libdbusmenu
-    lxqt.libqtxdg
+    qtbase
+    qtx11extras
+    qttools
+    qtsvg
+    libdbusmenu
+    libqtxdg
   ];
 
   cmakeFlags = [ "-DPULL_TRANSLATIONS=NO" ];
 
-  postPatch = lxqt.standardPatch;
+  postPatch = standardPatch;
 
   meta = with stdenv.lib; {
     description = "LXQt Qt platform integration plugin";
diff --git a/pkgs/desktops/lxqt/core/lxqt-runner/default.nix b/pkgs/desktops/lxqt/core/lxqt-runner/default.nix
index f420e9e410ae..550025f8e87b 100644
--- a/pkgs/desktops/lxqt/core/lxqt-runner/default.nix
+++ b/pkgs/desktops/lxqt/core/lxqt-runner/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkgconfig, qt5, kde5, lxqt,
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, lxqt-build-tools, qtbase, qttools, qtsvg, kwindowsystem, liblxqt, libqtxdg, lxqt-common, lxqt-globalkeys,
 menu-cache, muparser }:
 
 stdenv.mkDerivation rec {
@@ -16,18 +16,18 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [
     cmake
     pkgconfig
-    lxqt.lxqt-build-tools
+    lxqt-build-tools
   ];
 
   buildInputs = [
-    qt5.qtbase
-    qt5.qttools
-    qt5.qtsvg
-    kde5.kwindowsystem
-    lxqt.liblxqt
-    lxqt.libqtxdg
-    lxqt.lxqt-common
-    lxqt.lxqt-globalkeys
+    qtbase
+    qttools
+    qtsvg
+    kwindowsystem
+    liblxqt
+    libqtxdg
+    lxqt-common
+    lxqt-globalkeys
     menu-cache
     muparser
   ];
diff --git a/pkgs/desktops/lxqt/core/lxqt-session/default.nix b/pkgs/desktops/lxqt/core/lxqt-session/default.nix
index 1dfdd303a720..35879af28e88 100644
--- a/pkgs/desktops/lxqt/core/lxqt-session/default.nix
+++ b/pkgs/desktops/lxqt/core/lxqt-session/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkgconfig, qt5, kde5, lxqt, xorg, xdg-user-dirs }:
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, lxqt-build-tools, qtbase, qttools, qtsvg, kwindowsystem, liblxqt, libqtxdg, lxqt-common, xorg, xdg-user-dirs }:
 
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
@@ -15,17 +15,17 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [
     cmake
     pkgconfig
-    lxqt.lxqt-build-tools
+    lxqt-build-tools
   ];
 
   buildInputs = [
-    qt5.qtbase
-    qt5.qttools
-    qt5.qtsvg
-    kde5.kwindowsystem
-    lxqt.liblxqt
-    lxqt.libqtxdg
-    lxqt.lxqt-common
+    qtbase
+    qttools
+    qtsvg
+    kwindowsystem
+    liblxqt
+    libqtxdg
+    lxqt-common
     xorg.libpthreadstubs
     xorg.libXdmcp
     xdg-user-dirs
diff --git a/pkgs/desktops/lxqt/core/lxqt-sudo/default.nix b/pkgs/desktops/lxqt/core/lxqt-sudo/default.nix
index 83b16587523d..1e235af3c900 100644
--- a/pkgs/desktops/lxqt/core/lxqt-sudo/default.nix
+++ b/pkgs/desktops/lxqt/core/lxqt-sudo/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, qt5, kde5, lxqt, sudo }:
+{ stdenv, fetchFromGitHub, cmake, lxqt-build-tools, qtbase, qttools, qtx11extras, qtsvg, kwindowsystem, liblxqt, libqtxdg, sudo }:
 
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
@@ -14,17 +14,17 @@ stdenv.mkDerivation rec {
 
   nativeBuildInputs = [
     cmake
-    lxqt.lxqt-build-tools
+    lxqt-build-tools
   ];
 
   buildInputs = [
-    qt5.qtbase
-    qt5.qttools
-    qt5.qtx11extras
-    qt5.qtsvg
-    kde5.kwindowsystem
-    lxqt.liblxqt
-    lxqt.libqtxdg
+    qtbase
+    qttools
+    qtx11extras
+    qtsvg
+    kwindowsystem
+    liblxqt
+    libqtxdg
     sudo
   ];
 
diff --git a/pkgs/desktops/lxqt/default.nix b/pkgs/desktops/lxqt/default.nix
index 3cd8fdf22123..71eff8a1b0fa 100644
--- a/pkgs/desktops/lxqt/default.nix
+++ b/pkgs/desktops/lxqt/default.nix
@@ -1,13 +1,11 @@
-{ pkgs, newScope, fetchFromGitHub }:
+{ pkgs, makeScope, libsForQt5, fetchFromGitHub }:
 
 let
-  callPackage = newScope self;
-
-  self = rec {
+  packages = self: with self; {
 
     # For compiling information, see:
     # - https://github.com/lxde/lxqt/wiki/Building-from-source
-  
+
     standardPatch = ''
       for file in $(find . -name CMakeLists.txt); do
         substituteInPlace $file \
@@ -57,7 +55,7 @@ let
 
     ### OPTIONAL
     qterminal = callPackage ./optional/qterminal { };
-    compton-conf = callPackage ./optional/compton-conf { };
+    compton-conf = pkgs.qt5.callPackage ./optional/compton-conf { };
     obconf-qt = callPackage ./optional/obconf-qt { };
     lximage-qt = callPackage ./optional/lximage-qt { };
     qps = callPackage ./optional/qps { };
@@ -66,14 +64,14 @@ let
 
     preRequisitePackages = [
       pkgs.gvfs # virtual file systems support for PCManFM-QT
-      pkgs.kde5.kwindowsystem # provides some QT5 plugins needed by lxqt-panel
-      pkgs.kde5.libkscreen # provides plugins for screen management software
+      pkgs.libsForQt5.kwindowsystem # provides some QT5 plugins needed by lxqt-panel
+      pkgs.libsForQt5.libkscreen # provides plugins for screen management software
       pkgs.libfm
       pkgs.libfm-extra
       pkgs.lxmenu-data
       pkgs.menu-cache
       pkgs.openbox # default window manager
-      pkgs.qt5.qtsvg # provides QT5 plugins for svg icons
+      qt5.qtsvg # provides QT5 plugins for svg icons
     ];
 
     corePackages = [
@@ -120,7 +118,7 @@ let
       qlipper
 
       ### Default icon theme
-      pkgs.kde5.oxygen-icons5
+      pkgs.oxygen-icons5
 
       ### Screen saver
       pkgs.xscreensaver
@@ -128,4 +126,4 @@ let
 
   };
 
-in self
+in makeScope libsForQt5.newScope packages
diff --git a/pkgs/desktops/lxqt/optional/compton-conf/default.nix b/pkgs/desktops/lxqt/optional/compton-conf/default.nix
index c25ee10bd255..6e1ea1288539 100644
--- a/pkgs/desktops/lxqt/optional/compton-conf/default.nix
+++ b/pkgs/desktops/lxqt/optional/compton-conf/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkgconfig, qt5, kde5, lxqt, libconfig }:
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, qtbase, qttools, lxqt, libconfig }:
 
 stdenv.mkDerivation rec {
   name = "${pname}-${version}";
@@ -19,8 +19,8 @@ stdenv.mkDerivation rec {
   ];
 
   buildInputs = [
-    qt5.qtbase
-    qt5.qttools
+    qtbase
+    qttools
     libconfig
   ];
 
diff --git a/pkgs/desktops/lxqt/optional/screengrab/default.nix b/pkgs/desktops/lxqt/optional/screengrab/default.nix
index b3524d36777c..e8cc7c30fa15 100644
--- a/pkgs/desktops/lxqt/optional/screengrab/default.nix
+++ b/pkgs/desktops/lxqt/optional/screengrab/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchFromGitHub, cmake, pkgconfig, qt5, kde5, lxqt, xorg }:
+{ stdenv, fetchFromGitHub, cmake, pkgconfig, qtbase, qttools, qtx11extras, qtsvg, kwindowsystem, libqtxdg, xorg }:
 
 stdenv.mkDerivation rec {
   name = "screengrab-unstable-2017-02-18";
@@ -13,12 +13,12 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ cmake pkgconfig ];
 
   buildInputs = [
-    qt5.qtbase
-    qt5.qttools
-    qt5.qtx11extras
-    qt5.qtsvg
-    kde5.kwindowsystem
-    lxqt.libqtxdg
+    qtbase
+    qttools
+    qtx11extras
+    qtsvg
+    kwindowsystem
+    libqtxdg
     xorg.libpthreadstubs
     xorg.libXdmcp
   ];
diff --git a/pkgs/desktops/kde-5/plasma/bluedevil.nix b/pkgs/desktops/plasma-5/bluedevil.nix
index 1deef241a62f..d0e784998132 100644
--- a/pkgs/desktops/kde-5/plasma/bluedevil.nix
+++ b/pkgs/desktops/plasma-5/bluedevil.nix
@@ -1,12 +1,12 @@
 {
-  plasmaPackage, ecm, shared_mime_info,
+  plasmaPackage, extra-cmake-modules, shared_mime_info,
   bluez-qt, kcoreaddons, kdbusaddons, kded, ki18n, kiconthemes, kio,
   knotifications, kwidgetsaddons, kwindowsystem, plasma-framework, qtdeclarative
 }:
 
 plasmaPackage {
   name = "bluedevil";
-  nativeBuildInputs = [ ecm shared_mime_info ];
+  nativeBuildInputs = [ extra-cmake-modules shared_mime_info ];
   propagatedBuildInputs = [
     bluez-qt ki18n kio kwindowsystem plasma-framework qtdeclarative kcoreaddons
     kdbusaddons kded kiconthemes knotifications kwidgetsaddons
diff --git a/pkgs/desktops/kde-5/plasma/breeze-grub.nix b/pkgs/desktops/plasma-5/breeze-grub.nix
index da0fb6f73ad7..da0fb6f73ad7 100644
--- a/pkgs/desktops/kde-5/plasma/breeze-grub.nix
+++ b/pkgs/desktops/plasma-5/breeze-grub.nix
diff --git a/pkgs/desktops/kde-5/plasma/breeze-gtk.nix b/pkgs/desktops/plasma-5/breeze-gtk.nix
index 57de2fa2d474..4048d98431db 100644
--- a/pkgs/desktops/kde-5/plasma/breeze-gtk.nix
+++ b/pkgs/desktops/plasma-5/breeze-gtk.nix
@@ -1,9 +1,11 @@
 { plasmaPackage
-, ecm
+, extra-cmake-modules
+, qtbase
 }:
 
 plasmaPackage {
   name = "breeze-gtk";
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   cmakeFlags = [ "-DWITH_GTK3_VERSION=3.20" ];
+  buildInputs = [ qtbase ];
 }
diff --git a/pkgs/desktops/kde-5/plasma/breeze-plymouth/default.nix b/pkgs/desktops/plasma-5/breeze-plymouth/default.nix
index 0de1ca1f6802..dfbdf48165aa 100644
--- a/pkgs/desktops/kde-5/plasma/breeze-plymouth/default.nix
+++ b/pkgs/desktops/plasma-5/breeze-plymouth/default.nix
@@ -1,12 +1,12 @@
 {
   plasmaPackage, lib, copyPathsToStore,
-  ecm,
+  extra-cmake-modules,
   plymouth
 }:
 
 plasmaPackage {
   name = "breeze-plymouth";
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   buildInputs = [ plymouth ];
   outputs = [ "out" ];
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
diff --git a/pkgs/desktops/kde-5/plasma/breeze-plymouth/install-paths.patch b/pkgs/desktops/plasma-5/breeze-plymouth/install-paths.patch
index 5d5856d122dd..5d5856d122dd 100644
--- a/pkgs/desktops/kde-5/plasma/breeze-plymouth/install-paths.patch
+++ b/pkgs/desktops/plasma-5/breeze-plymouth/install-paths.patch
diff --git a/pkgs/desktops/kde-5/plasma/breeze-plymouth/series b/pkgs/desktops/plasma-5/breeze-plymouth/series
index 8920e7ca5189..8920e7ca5189 100644
--- a/pkgs/desktops/kde-5/plasma/breeze-plymouth/series
+++ b/pkgs/desktops/plasma-5/breeze-plymouth/series
diff --git a/pkgs/desktops/plasma-5/breeze-qt4.nix b/pkgs/desktops/plasma-5/breeze-qt4.nix
new file mode 100644
index 000000000000..adcc6110c4d7
--- /dev/null
+++ b/pkgs/desktops/plasma-5/breeze-qt4.nix
@@ -0,0 +1,16 @@
+{
+  plasmaPackage, lib,
+  automoc4, cmake, perl, pkgconfig,
+  kdelibs4, qt4, xproto
+}:
+
+plasmaPackage {
+  name = "breeze-qt4";
+  sname = "breeze";
+  buildInputs = [ kdelibs4 qt4 xproto ];
+  nativeBuildInputs = [ automoc4 cmake perl pkgconfig ];
+  cmakeFlags = [
+    "-DUSE_KDE4=ON"
+    "-DQT_QMAKE_EXECUTABLE=${qt4}/bin/qmake"
+  ];
+}
diff --git a/pkgs/desktops/kde-5/plasma/breeze-qt5.nix b/pkgs/desktops/plasma-5/breeze-qt5.nix
index ea2776a13c59..a1b64a4656cb 100644
--- a/pkgs/desktops/kde-5/plasma/breeze-qt5.nix
+++ b/pkgs/desktops/plasma-5/breeze-qt5.nix
@@ -1,6 +1,6 @@
 {
   plasmaPackage,
-  ecm,
+  extra-cmake-modules,
   frameworkintegration, kcmutils, kconfigwidgets, kcoreaddons, kdecoration,
   kguiaddons, ki18n, kwayland, kwindowsystem, plasma-framework, qtx11extras
 }:
@@ -8,7 +8,7 @@
 plasmaPackage {
   name = "breeze-qt5";
   sname = "breeze";
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     frameworkintegration kcmutils kconfigwidgets kcoreaddons kdecoration
     kguiaddons ki18n kwayland kwindowsystem plasma-framework qtx11extras
diff --git a/pkgs/desktops/plasma-5/build-support/package.nix b/pkgs/desktops/plasma-5/build-support/package.nix
new file mode 100644
index 000000000000..1e9ba016c471
--- /dev/null
+++ b/pkgs/desktops/plasma-5/build-support/package.nix
@@ -0,0 +1,27 @@
+{ 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
new file mode 100644
index 000000000000..0cb25a315d6e
--- /dev/null
+++ b/pkgs/desktops/plasma-5/default.nix
@@ -0,0 +1,81 @@
+/*
+
+# New packages
+
+READ THIS FIRST
+
+This module is for official packages in KDE Plasma 5. All available packages are
+listed in `./srcs.nix`, although a few are not yet packaged in Nixpkgs (see
+below).
+
+IF YOUR PACKAGE IS NOT LISTED IN `./srcs.nix`, IT DOES NOT GO HERE.
+
+Many of the packages released upstream are not yet built in Nixpkgs due to lack
+of demand. To add a Nixpkgs build for an upstream package, copy one of the
+existing packages here and modify it as necessary.
+
+# Updates
+
+1. Update the URL in `./fetch.sh`.
+2. Run `./maintainers/scripts/fetch-kde-qt.sh pkgs/desktops/plasma-5`
+   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.
+
+*/
+
+{
+  libsForQt5, kdeDerivation, lib, fetchurl,
+  gconf,
+  debug ? false,
+}:
+
+let
+  packages = self: with self;
+    let
+      callPackage = self.newScope {
+        plasmaPackage = import ./build-support/package.nix {
+          inherit kdeDerivation lib fetchurl;
+        };
+      };
+    in {
+      bluedevil = callPackage ./bluedevil.nix {};
+      breeze-gtk = callPackage ./breeze-gtk.nix {};
+      breeze-qt4 = callPackage ./breeze-qt4.nix {};
+      breeze-qt5 = callPackage ./breeze-qt5.nix {};
+      breeze-grub = callPackage ./breeze-grub.nix {};
+      breeze-plymouth = callPackage ./breeze-plymouth {};
+      kactivitymanagerd = callPackage ./kactivitymanagerd.nix {};
+      kde-cli-tools = callPackage ./kde-cli-tools.nix {};
+      kde-gtk-config = callPackage ./kde-gtk-config {};
+      kdecoration = callPackage ./kdecoration.nix {};
+      kdeplasma-addons = callPackage ./kdeplasma-addons.nix {};
+      kgamma5 = callPackage ./kgamma5.nix {};
+      khotkeys = callPackage ./khotkeys.nix {};
+      kinfocenter = callPackage ./kinfocenter.nix {};
+      kmenuedit = callPackage ./kmenuedit.nix {};
+      kscreen = callPackage ./kscreen.nix {};
+      kscreenlocker = callPackage ./kscreenlocker.nix {};
+      ksshaskpass = callPackage ./ksshaskpass.nix {};
+      ksysguard = callPackage ./ksysguard.nix {};
+      kwallet-pam = callPackage ./kwallet-pam.nix {};
+      kwayland-integration = callPackage ./kwayland-integration.nix {};
+      kwin = callPackage ./kwin {};
+      kwrited = callPackage ./kwrited.nix {};
+      libkscreen = callPackage ./libkscreen.nix {};
+      libksysguard = callPackage ./libksysguard {};
+      milou = callPackage ./milou.nix {};
+      oxygen = callPackage ./oxygen.nix {};
+      plasma-desktop = callPackage ./plasma-desktop {};
+      plasma-integration = callPackage ./plasma-integration.nix {};
+      plasma-nm = callPackage ./plasma-nm {};
+      plasma-pa = callPackage ./plasma-pa.nix { inherit gconf; };
+      plasma-workspace = callPackage ./plasma-workspace {};
+      plasma-workspace-wallpapers = callPackage ./plasma-workspace-wallpapers.nix {};
+      polkit-kde-agent = callPackage ./polkit-kde-agent.nix {};
+      powerdevil = callPackage ./powerdevil.nix {};
+      startkde = callPackage ./startkde {};
+      systemsettings = callPackage ./systemsettings.nix {};
+    };
+in
+lib.makeScope libsForQt5.newScope packages
diff --git a/pkgs/desktops/plasma-5/fetch.sh b/pkgs/desktops/plasma-5/fetch.sh
new file mode 100644
index 000000000000..7d127211956b
--- /dev/null
+++ b/pkgs/desktops/plasma-5/fetch.sh
@@ -0,0 +1 @@
+WGET_ARGS=( http://download.kde.org/stable/plasma/5.8.6/ -A '*.tar.xz' )
diff --git a/pkgs/desktops/kde-5/plasma/kactivitymanagerd.nix b/pkgs/desktops/plasma-5/kactivitymanagerd.nix
index bb90fd6d3ab0..282e58ecf9e6 100644
--- a/pkgs/desktops/kde-5/plasma/kactivitymanagerd.nix
+++ b/pkgs/desktops/plasma-5/kactivitymanagerd.nix
@@ -1,12 +1,12 @@
 { plasmaPackage
-, ecm
+, extra-cmake-modules
 , boost, kconfig, kcoreaddons, kdbusaddons, ki18n, kio, kglobalaccel
 , kwindowsystem, kxmlgui
 }:
 
 plasmaPackage {
   name = "kactivitymanagerd";
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     boost kconfig kcoreaddons kdbusaddons kglobalaccel ki18n kio kwindowsystem
     kxmlgui
diff --git a/pkgs/desktops/kde-5/plasma/kde-cli-tools.nix b/pkgs/desktops/plasma-5/kde-cli-tools.nix
index 33a7340cb85f..87a46703997a 100644
--- a/pkgs/desktops/kde-5/plasma/kde-cli-tools.nix
+++ b/pkgs/desktops/plasma-5/kde-cli-tools.nix
@@ -1,12 +1,12 @@
 {
-  plasmaPackage, ecm,
+  plasmaPackage, extra-cmake-modules,
   kcmutils, kconfig, kdelibs4support, kdesu, kdoctools, ki18n, kiconthemes,
   kwindowsystem, qtsvg, qtx11extras
 }:
 
 plasmaPackage {
   name = "kde-cli-tools";
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
     kcmutils kconfig kdesu kdelibs4support ki18n kiconthemes kwindowsystem qtsvg
     qtx11extras
diff --git a/pkgs/desktops/kde-5/plasma/kde-gtk-config/0001-follow-symlinks.patch b/pkgs/desktops/plasma-5/kde-gtk-config/0001-follow-symlinks.patch
index d610d19eedd2..d610d19eedd2 100644
--- a/pkgs/desktops/kde-5/plasma/kde-gtk-config/0001-follow-symlinks.patch
+++ b/pkgs/desktops/plasma-5/kde-gtk-config/0001-follow-symlinks.patch
diff --git a/pkgs/desktops/kde-5/plasma/kde-gtk-config/default.nix b/pkgs/desktops/plasma-5/kde-gtk-config/default.nix
index 10e55f0d6980..f482f2a6a3f3 100644
--- a/pkgs/desktops/kde-5/plasma/kde-gtk-config/default.nix
+++ b/pkgs/desktops/plasma-5/kde-gtk-config/default.nix
@@ -1,5 +1,5 @@
 { plasmaPackage
-, ecm
+, extra-cmake-modules
 , glib
 , gtk2
 , gtk3
@@ -15,7 +15,7 @@
 plasmaPackage {
   name = "kde-gtk-config";
   patches = [ ./0001-follow-symlinks.patch ];
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     ki18n kio glib gtk2 gtk3 karchive kcmutils kconfigwidgets kiconthemes
     knewstuff
diff --git a/pkgs/desktops/plasma-5/kdecoration.nix b/pkgs/desktops/plasma-5/kdecoration.nix
new file mode 100644
index 000000000000..546f72c3f384
--- /dev/null
+++ b/pkgs/desktops/plasma-5/kdecoration.nix
@@ -0,0 +1,7 @@
+{ plasmaPackage, extra-cmake-modules, qtbase }:
+
+plasmaPackage {
+  name = "kdecoration";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtbase ];
+}
diff --git a/pkgs/desktops/kde-5/plasma/kdeplasma-addons.nix b/pkgs/desktops/plasma-5/kdeplasma-addons.nix
index a2805f5d804b..3371e17beaf8 100644
--- a/pkgs/desktops/kde-5/plasma/kdeplasma-addons.nix
+++ b/pkgs/desktops/plasma-5/kdeplasma-addons.nix
@@ -1,4 +1,4 @@
-{ plasmaPackage, ecm, kdoctools
+{ plasmaPackage, extra-cmake-modules, kdoctools
 , kconfig, kconfigwidgets, kcoreaddons, kcmutils, kdelibs4support, ki18n
 , kio, knewstuff, kross, krunner, kservice, ksysguard, kunitconversion
 , plasma-framework, plasma-workspace, qtdeclarative, qtx11extras
@@ -8,7 +8,7 @@
 plasmaPackage {
   name = "kdeplasma-addons";
   nativeBuildInputs = [
-    ecm
+    extra-cmake-modules
     kdoctools
   ];
   propagatedBuildInputs = [
diff --git a/pkgs/desktops/plasma-5/kgamma5.nix b/pkgs/desktops/plasma-5/kgamma5.nix
new file mode 100644
index 000000000000..965c33e6eef8
--- /dev/null
+++ b/pkgs/desktops/plasma-5/kgamma5.nix
@@ -0,0 +1,9 @@
+{ plasmaPackage, extra-cmake-modules, kdoctools, kdelibs4support
+, qtx11extras
+}:
+
+plasmaPackage {
+  name = "kgamma5";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  propagatedBuildInputs = [ kdelibs4support qtx11extras ];
+}
diff --git a/pkgs/desktops/plasma-5/khotkeys.nix b/pkgs/desktops/plasma-5/khotkeys.nix
new file mode 100644
index 000000000000..2b02e5916b9f
--- /dev/null
+++ b/pkgs/desktops/plasma-5/khotkeys.nix
@@ -0,0 +1,14 @@
+{ plasmaPackage, extra-cmake-modules, kdoctools, kcmutils
+, kdbusaddons, kdelibs4support, kglobalaccel, ki18n, kio, kxmlgui
+, plasma-framework, plasma-workspace, qtx11extras
+, fetchpatch
+}:
+
+plasmaPackage {
+  name = "khotkeys";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  propagatedBuildInputs = [
+    kdelibs4support kglobalaccel ki18n kio plasma-framework plasma-workspace
+    qtx11extras kcmutils kdbusaddons kxmlgui
+  ];
+}
diff --git a/pkgs/desktops/kde-5/plasma/kinfocenter.nix b/pkgs/desktops/plasma-5/kinfocenter.nix
index 939e4fa62a9c..b4c8dc99adcb 100644
--- a/pkgs/desktops/kde-5/plasma/kinfocenter.nix
+++ b/pkgs/desktops/plasma-5/kinfocenter.nix
@@ -1,6 +1,6 @@
 {
   plasmaPackage,
-  ecm, kdoctools,
+  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
@@ -8,7 +8,7 @@
 
 plasmaPackage {
   name = "kinfocenter";
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
     kcmutils kcompletion kconfig kconfigwidgets kcoreaddons kdbusaddons
     kdeclarative kdelibs4support ki18n kiconthemes kio kpackage kservice
diff --git a/pkgs/desktops/kde-5/plasma/kmenuedit.nix b/pkgs/desktops/plasma-5/kmenuedit.nix
index f10bf6bb3cdd..a27dc5dd92a8 100644
--- a/pkgs/desktops/kde-5/plasma/kmenuedit.nix
+++ b/pkgs/desktops/plasma-5/kmenuedit.nix
@@ -1,13 +1,13 @@
 {
   plasmaPackage,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   kdbusaddons, kdelibs4support, khotkeys, ki18n, kiconthemes, kio, kxmlgui,
   sonnet
 }:
 
 plasmaPackage {
   name = "kmenuedit";
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
     kdbusaddons kdelibs4support khotkeys ki18n kiconthemes kio kxmlgui sonnet
   ];
diff --git a/pkgs/desktops/kde-5/plasma/kscreen.nix b/pkgs/desktops/plasma-5/kscreen.nix
index ecbd88c2146d..e0fbea5d7467 100644
--- a/pkgs/desktops/kde-5/plasma/kscreen.nix
+++ b/pkgs/desktops/plasma-5/kscreen.nix
@@ -1,11 +1,11 @@
-{ plasmaPackage, ecm, kconfig, kconfigwidgets
+{ plasmaPackage, extra-cmake-modules, kconfig, kconfigwidgets
 , kdbusaddons, kglobalaccel, ki18n, kwidgetsaddons, kxmlgui
 , libkscreen, qtdeclarative, qtgraphicaleffects
 }:
 
 plasmaPackage {
   name = "kscreen";
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     kglobalaccel ki18n libkscreen qtdeclarative qtgraphicaleffects kconfig
     kconfigwidgets kdbusaddons kwidgetsaddons kxmlgui
diff --git a/pkgs/desktops/kde-5/plasma/kscreenlocker.nix b/pkgs/desktops/plasma-5/kscreenlocker.nix
index 3c5d7b374724..3551feab76fc 100644
--- a/pkgs/desktops/kde-5/plasma/kscreenlocker.nix
+++ b/pkgs/desktops/plasma-5/kscreenlocker.nix
@@ -1,13 +1,13 @@
 {
   plasmaPackage,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   kcmutils, kcrash, kdeclarative, kdelibs4support, kglobalaccel, kidletime,
   kwayland, libXcursor, pam, plasma-framework, qtdeclarative, wayland
 }:
 
 plasmaPackage {
   name = "kscreenlocker";
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
     kcmutils kcrash kdeclarative kdelibs4support kglobalaccel kidletime kwayland
     libXcursor pam plasma-framework qtdeclarative wayland
diff --git a/pkgs/desktops/kde-5/plasma/ksshaskpass.nix b/pkgs/desktops/plasma-5/ksshaskpass.nix
index 80b529a66685..f1a6b82ae93c 100644
--- a/pkgs/desktops/kde-5/plasma/ksshaskpass.nix
+++ b/pkgs/desktops/plasma-5/ksshaskpass.nix
@@ -1,9 +1,9 @@
-{ plasmaPackage, ecm, kdoctools, kcoreaddons
+{ plasmaPackage, extra-cmake-modules, kdoctools, kcoreaddons
 , ki18n, kwallet, kwidgetsaddons
 }:
 
 plasmaPackage {
   name = "ksshaskpass";
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [ kcoreaddons ki18n kwallet kwidgetsaddons ];
 }
diff --git a/pkgs/desktops/kde-5/plasma/ksysguard.nix b/pkgs/desktops/plasma-5/ksysguard.nix
index f7e5cced708a..366b154cae70 100644
--- a/pkgs/desktops/kde-5/plasma/ksysguard.nix
+++ b/pkgs/desktops/plasma-5/ksysguard.nix
@@ -1,6 +1,6 @@
 {
   plasmaPackage,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   lm_sensors,
   kconfig, kcoreaddons, kdelibs4support, ki18n, kiconthemes, kitemviews,
   knewstuff, libksysguard, qtwebkit
@@ -8,7 +8,7 @@
 
 plasmaPackage {
   name = "ksysguard";
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   buildInputs = [ lm_sensors ];
   propagatedBuildInputs = [
     kconfig kcoreaddons kitemviews knewstuff kiconthemes libksysguard
diff --git a/pkgs/desktops/plasma-5/kwallet-pam.nix b/pkgs/desktops/plasma-5/kwallet-pam.nix
new file mode 100644
index 000000000000..2789499c50a2
--- /dev/null
+++ b/pkgs/desktops/plasma-5/kwallet-pam.nix
@@ -0,0 +1,11 @@
+{ plasmaPackage, extra-cmake-modules, pam, socat, libgcrypt
+}:
+
+plasmaPackage {
+  name = "kwallet-pam";
+
+  nativeBuildInputs = [ extra-cmake-modules ];
+
+  buildInputs = [ pam socat libgcrypt ];
+
+}
diff --git a/pkgs/desktops/kde-5/plasma/kwayland-integration.nix b/pkgs/desktops/plasma-5/kwayland-integration.nix
index 376e8ed7cbda..9045227a51a9 100644
--- a/pkgs/desktops/kde-5/plasma/kwayland-integration.nix
+++ b/pkgs/desktops/plasma-5/kwayland-integration.nix
@@ -1,5 +1,5 @@
 { plasmaPackage
-, ecm
+, extra-cmake-modules
 , kidletime
 , kwayland
 , kwindowsystem
@@ -8,7 +8,7 @@
 plasmaPackage {
   name = "kwayland-integration";
   nativeBuildInputs = [
-    ecm
+    extra-cmake-modules
   ];
   propagatedBuildInputs = [
     kidletime kwindowsystem kwayland
diff --git a/pkgs/desktops/kde-5/plasma/kwin/default.nix b/pkgs/desktops/plasma-5/kwin/default.nix
index 73e40cdb114c..3555cf91e005 100644
--- a/pkgs/desktops/kde-5/plasma/kwin/default.nix
+++ b/pkgs/desktops/plasma-5/kwin/default.nix
@@ -1,6 +1,6 @@
 {
   plasmaPackage, lib, copyPathsToStore,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   breeze-qt5, epoxy, kactivities, kcompletion, kcmutils, kconfig,
   kconfigwidgets, kcoreaddons, kcrash, kdeclarative, kdecoration, kglobalaccel,
   ki18n, kiconthemes, kidletime, kinit, kio, knewstuff, knotifications,
@@ -12,7 +12,7 @@
 plasmaPackage {
   name = "kwin";
   nativeBuildInputs = [
-    ecm
+    extra-cmake-modules
     kdoctools
   ];
   propagatedBuildInputs = [
diff --git a/pkgs/desktops/kde-5/plasma/kwin/follow-symlinks.patch b/pkgs/desktops/plasma-5/kwin/follow-symlinks.patch
index 60b8f5ef541f..60b8f5ef541f 100644
--- a/pkgs/desktops/kde-5/plasma/kwin/follow-symlinks.patch
+++ b/pkgs/desktops/plasma-5/kwin/follow-symlinks.patch
diff --git a/pkgs/desktops/kde-5/plasma/kwin/series b/pkgs/desktops/plasma-5/kwin/series
index 9dbc88f49975..9dbc88f49975 100644
--- a/pkgs/desktops/kde-5/plasma/kwin/series
+++ b/pkgs/desktops/plasma-5/kwin/series
diff --git a/pkgs/desktops/kde-5/plasma/kwin/xwayland.patch b/pkgs/desktops/plasma-5/kwin/xwayland.patch
index 5fde01d08bf3..5fde01d08bf3 100644
--- a/pkgs/desktops/kde-5/plasma/kwin/xwayland.patch
+++ b/pkgs/desktops/plasma-5/kwin/xwayland.patch
diff --git a/pkgs/desktops/kde-5/plasma/kwrited.nix b/pkgs/desktops/plasma-5/kwrited.nix
index 8dd814f783d0..29498e93404d 100644
--- a/pkgs/desktops/kde-5/plasma/kwrited.nix
+++ b/pkgs/desktops/plasma-5/kwrited.nix
@@ -1,9 +1,9 @@
-{ plasmaPackage, ecm, kcoreaddons, ki18n, kpty
+{ plasmaPackage, extra-cmake-modules, kcoreaddons, ki18n, kpty
 , knotifications, kdbusaddons
 }:
 
 plasmaPackage {
   name = "kwrited";
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ kcoreaddons ki18n kpty knotifications kdbusaddons ];
 }
diff --git a/pkgs/desktops/kde-5/plasma/libkscreen.nix b/pkgs/desktops/plasma-5/libkscreen.nix
index 838ab6ef0e5c..4e04fd5ed1d9 100644
--- a/pkgs/desktops/kde-5/plasma/libkscreen.nix
+++ b/pkgs/desktops/plasma-5/libkscreen.nix
@@ -1,5 +1,5 @@
 { plasmaPackage
-, ecm
+, extra-cmake-modules
 , kwayland, libXrandr
 , qtx11extras
 }:
@@ -7,7 +7,7 @@
 plasmaPackage {
   name = "libkscreen";
   nativeBuildInputs = [
-    ecm
+    extra-cmake-modules
   ];
   propagatedBuildInputs = [
     kwayland libXrandr qtx11extras
diff --git a/pkgs/desktops/kde-5/plasma/libksysguard/0001-qdiriterator-follow-symlinks.patch b/pkgs/desktops/plasma-5/libksysguard/0001-qdiriterator-follow-symlinks.patch
index fbbb11ae7556..fbbb11ae7556 100644
--- a/pkgs/desktops/kde-5/plasma/libksysguard/0001-qdiriterator-follow-symlinks.patch
+++ b/pkgs/desktops/plasma-5/libksysguard/0001-qdiriterator-follow-symlinks.patch
diff --git a/pkgs/desktops/kde-5/plasma/libksysguard/default.nix b/pkgs/desktops/plasma-5/libksysguard/default.nix
index 2d81d061f4c7..b67e041a7821 100644
--- a/pkgs/desktops/kde-5/plasma/libksysguard/default.nix
+++ b/pkgs/desktops/plasma-5/libksysguard/default.nix
@@ -1,6 +1,6 @@
 {
   plasmaPackage,
-  ecm,
+  extra-cmake-modules,
   kauth, kcompletion, kconfig, kconfigwidgets, kcoreaddons, ki18n, kiconthemes,
   kservice, kwidgetsaddons, kwindowsystem, plasma-framework, qtscript, qtwebkit,
   qtx11extras
@@ -11,7 +11,7 @@ plasmaPackage {
   patches = [
     ./0001-qdiriterator-follow-symlinks.patch
   ];
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     kauth kconfig ki18n kiconthemes kwindowsystem kcompletion kconfigwidgets
     kcoreaddons kservice kwidgetsaddons plasma-framework qtscript qtx11extras
diff --git a/pkgs/desktops/kde-5/plasma/milou.nix b/pkgs/desktops/plasma-5/milou.nix
index dbf9d0b9e537..43f78d9e2a97 100644
--- a/pkgs/desktops/kde-5/plasma/milou.nix
+++ b/pkgs/desktops/plasma-5/milou.nix
@@ -1,4 +1,4 @@
-{ plasmaPackage, ecm, qtscript, qtdeclarative
+{ plasmaPackage, extra-cmake-modules, qtscript, qtdeclarative
 , kcoreaddons, ki18n, kdeclarative, kservice, plasma-framework
 , krunner
 }:
@@ -6,7 +6,7 @@
 plasmaPackage {
   name = "milou";
   nativeBuildInputs = [
-    ecm
+    extra-cmake-modules
   ];
   propagatedBuildInputs = [
     kdeclarative ki18n krunner plasma-framework qtdeclarative qtscript
diff --git a/pkgs/desktops/kde-5/plasma/oxygen.nix b/pkgs/desktops/plasma-5/oxygen.nix
index ca63c8d7a377..b4ff775264f8 100644
--- a/pkgs/desktops/kde-5/plasma/oxygen.nix
+++ b/pkgs/desktops/plasma-5/oxygen.nix
@@ -1,6 +1,6 @@
 {
   plasmaPackage, kdeWrapper,
-  ecm,
+  extra-cmake-modules,
   frameworkintegration, kcmutils, kcompletion, kconfig, kdecoration, kguiaddons,
   ki18n, kwidgetsaddons, kservice, kwayland, kwindowsystem, qtx11extras
 }:
@@ -8,7 +8,7 @@
 let
   unwrapped = plasmaPackage {
     name = "oxygen";
-    nativeBuildInputs = [ ecm ];
+    nativeBuildInputs = [ extra-cmake-modules ];
     propagatedBuildInputs = [
       frameworkintegration kcmutils kcompletion kconfig kdecoration kguiaddons
       ki18n kservice kwayland kwidgetsaddons kwindowsystem qtx11extras
diff --git a/pkgs/desktops/kde-5/plasma/plasma-desktop/default.nix b/pkgs/desktops/plasma-5/plasma-desktop/default.nix
index 21ceec25d53f..1ac257057309 100644
--- a/pkgs/desktops/kde-5/plasma/plasma-desktop/default.nix
+++ b/pkgs/desktops/plasma-5/plasma-desktop/default.nix
@@ -1,6 +1,6 @@
 {
   plasmaPackage, lib, copyPathsToStore,
-  ecm, kdoctools,
+  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,
@@ -13,7 +13,7 @@
 
 plasmaPackage rec {
   name = "plasma-desktop";
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   buildInputs = [
     attica boost fontconfig ibus kcmutils kdbusaddons kded kitemmodels knewstuff
     knotifications knotifyconfig kwallet libcanberra_kde libXcursor
diff --git a/pkgs/desktops/kde-5/plasma/plasma-desktop/hwclock-path.patch b/pkgs/desktops/plasma-5/plasma-desktop/hwclock-path.patch
index 5623de84668f..5623de84668f 100644
--- a/pkgs/desktops/kde-5/plasma/plasma-desktop/hwclock-path.patch
+++ b/pkgs/desktops/plasma-5/plasma-desktop/hwclock-path.patch
diff --git a/pkgs/desktops/kde-5/plasma/plasma-desktop/ibus.patch b/pkgs/desktops/plasma-5/plasma-desktop/ibus.patch
index d5ac4b250875..d5ac4b250875 100644
--- a/pkgs/desktops/kde-5/plasma/plasma-desktop/ibus.patch
+++ b/pkgs/desktops/plasma-5/plasma-desktop/ibus.patch
diff --git a/pkgs/desktops/kde-5/plasma/plasma-desktop/qml-import-paths.patch b/pkgs/desktops/plasma-5/plasma-desktop/qml-import-paths.patch
index def5b577b972..def5b577b972 100644
--- a/pkgs/desktops/kde-5/plasma/plasma-desktop/qml-import-paths.patch
+++ b/pkgs/desktops/plasma-5/plasma-desktop/qml-import-paths.patch
diff --git a/pkgs/desktops/kde-5/plasma/plasma-desktop/series b/pkgs/desktops/plasma-5/plasma-desktop/series
index 36778cd1c560..36778cd1c560 100644
--- a/pkgs/desktops/kde-5/plasma/plasma-desktop/series
+++ b/pkgs/desktops/plasma-5/plasma-desktop/series
diff --git a/pkgs/desktops/kde-5/plasma/plasma-desktop/tzdir.patch b/pkgs/desktops/plasma-5/plasma-desktop/tzdir.patch
index 97504b330fed..97504b330fed 100644
--- a/pkgs/desktops/kde-5/plasma/plasma-desktop/tzdir.patch
+++ b/pkgs/desktops/plasma-5/plasma-desktop/tzdir.patch
diff --git a/pkgs/desktops/kde-5/plasma/plasma-integration.nix b/pkgs/desktops/plasma-5/plasma-integration.nix
index e8680fea930a..97d30dcd7732 100644
--- a/pkgs/desktops/kde-5/plasma/plasma-integration.nix
+++ b/pkgs/desktops/plasma-5/plasma-integration.nix
@@ -1,4 +1,4 @@
-{ plasmaPackage, ecm
+{ plasmaPackage, extra-cmake-modules
 , breeze-qt5, kconfig, kconfigwidgets, kiconthemes, kio, kwayland
 , libXcursor
 }:
@@ -8,7 +8,7 @@
 plasmaPackage {
   name = "plasma-integration";
   nativeBuildInputs = [
-    ecm
+    extra-cmake-modules
   ];
   buildInputs = [
     breeze-qt5 kconfig kconfigwidgets kiconthemes kio kwayland
diff --git a/pkgs/desktops/kde-5/plasma/plasma-nm/0001-mobile-broadband-provider-info-path.patch b/pkgs/desktops/plasma-5/plasma-nm/0001-mobile-broadband-provider-info-path.patch
index 79b5cfb437e2..79b5cfb437e2 100644
--- a/pkgs/desktops/kde-5/plasma/plasma-nm/0001-mobile-broadband-provider-info-path.patch
+++ b/pkgs/desktops/plasma-5/plasma-nm/0001-mobile-broadband-provider-info-path.patch
diff --git a/pkgs/desktops/kde-5/plasma/plasma-nm/default.nix b/pkgs/desktops/plasma-5/plasma-nm/default.nix
index b6d18dbf91d9..da57653bb083 100644
--- a/pkgs/desktops/kde-5/plasma/plasma-nm/default.nix
+++ b/pkgs/desktops/plasma-5/plasma-nm/default.nix
@@ -1,4 +1,4 @@
-{ plasmaPackage, substituteAll, ecm, kdoctools
+{ plasmaPackage, substituteAll, extra-cmake-modules, kdoctools
 , kcompletion, kconfigwidgets, kcoreaddons, kdbusaddons, kdeclarative
 , kdelibs4support, ki18n, kiconthemes, kinit, kio, kitemviews
 , knotifications, kservice, kwallet, kwidgetsaddons, kwindowsystem
@@ -15,7 +15,7 @@ plasmaPackage {
       inherit mobile_broadband_provider_info;
     })
   ];
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
     kdeclarative kdelibs4support ki18n kio kwindowsystem plasma-framework
     qtdeclarative kcompletion kconfigwidgets kcoreaddons kdbusaddons kiconthemes
diff --git a/pkgs/desktops/kde-5/plasma/plasma-pa.nix b/pkgs/desktops/plasma-5/plasma-pa.nix
index 7bf97d745fe4..f398e1a9efc0 100644
--- a/pkgs/desktops/kde-5/plasma/plasma-pa.nix
+++ b/pkgs/desktops/plasma-5/plasma-pa.nix
@@ -1,6 +1,6 @@
 {
   plasmaPackage,
-  ecm,
+  extra-cmake-modules,
   gconf, glib, kdoctools, kconfigwidgets, kcoreaddons, kdeclarative, kglobalaccel,
   ki18n, libcanberra_gtk3, libpulseaudio, plasma-framework
 }:
@@ -8,7 +8,7 @@
 plasmaPackage {
   name = "plasma-pa";
   nativeBuildInputs = [
-    ecm kdoctools
+    extra-cmake-modules kdoctools
   ];
   propagatedBuildInputs = [
     gconf glib kconfigwidgets kcoreaddons kdeclarative
diff --git a/pkgs/desktops/kde-5/plasma/plasma-workspace-wallpapers.nix b/pkgs/desktops/plasma-5/plasma-workspace-wallpapers.nix
index 6ffdb17cbeab..8af9caaa5795 100644
--- a/pkgs/desktops/kde-5/plasma/plasma-workspace-wallpapers.nix
+++ b/pkgs/desktops/plasma-5/plasma-workspace-wallpapers.nix
@@ -1,11 +1,11 @@
 { plasmaPackage
-, ecm
+, extra-cmake-modules
 }:
 
 plasmaPackage {
   name = "plasma-workspace-wallpapers";
   outputs = [ "out" ];
   nativeBuildInputs = [
-    ecm
+    extra-cmake-modules
   ];
 }
diff --git a/pkgs/desktops/kde-5/plasma/plasma-workspace/default.nix b/pkgs/desktops/plasma-5/plasma-workspace/default.nix
index 1e38c0c74dd4..19d530da1a60 100644
--- a/pkgs/desktops/kde-5/plasma/plasma-workspace/default.nix
+++ b/pkgs/desktops/plasma-5/plasma-workspace/default.nix
@@ -1,7 +1,7 @@
 {
   plasmaPackage, lib, copyPathsToStore,
 
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
 
   baloo, kactivities, kcmutils, kconfig, kcrash, kdbusaddons, kdeclarative,
   kdelibs4support, kdesu, kglobalaccel, kidletime, kjsembed, knewstuff,
@@ -14,7 +14,7 @@
 plasmaPackage {
   name = "plasma-workspace";
 
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   buildInputs = [
     baloo kactivities kcmutils kconfig kcrash kdbusaddons kdeclarative
     kdelibs4support kdesu kglobalaccel kidletime kjsembed knewstuff
diff --git a/pkgs/desktops/kde-5/plasma/plasma-workspace/qml-import-path.patch b/pkgs/desktops/plasma-5/plasma-workspace/qml-import-path.patch
index 12eb65caa717..12eb65caa717 100644
--- a/pkgs/desktops/kde-5/plasma/plasma-workspace/qml-import-path.patch
+++ b/pkgs/desktops/plasma-5/plasma-workspace/qml-import-path.patch
diff --git a/pkgs/desktops/kde-5/plasma/plasma-workspace/series b/pkgs/desktops/plasma-5/plasma-workspace/series
index b9081298bd69..b9081298bd69 100644
--- a/pkgs/desktops/kde-5/plasma/plasma-workspace/series
+++ b/pkgs/desktops/plasma-5/plasma-workspace/series
diff --git a/pkgs/desktops/kde-5/plasma/polkit-kde-agent.nix b/pkgs/desktops/plasma-5/polkit-kde-agent.nix
index 002c2bb10ff3..1d7d20a7ffbf 100644
--- a/pkgs/desktops/kde-5/plasma/polkit-kde-agent.nix
+++ b/pkgs/desktops/plasma-5/polkit-kde-agent.nix
@@ -1,12 +1,12 @@
 {
-  plasmaPackage, ecm,
+  plasmaPackage, extra-cmake-modules,
   kcoreaddons, kconfig, kcrash, kdbusaddons, ki18n, kiconthemes, knotifications,
   kwidgetsaddons, kwindowsystem, polkit-qt
 }:
 
 plasmaPackage {
   name = "polkit-kde-agent";
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     kdbusaddons kwidgetsaddons kcoreaddons kcrash kconfig ki18n kiconthemes
     knotifications kwindowsystem polkit-qt
diff --git a/pkgs/desktops/kde-5/plasma/powerdevil.nix b/pkgs/desktops/plasma-5/powerdevil.nix
index c0c18a6eae6c..c3469cc2ebc8 100644
--- a/pkgs/desktops/kde-5/plasma/powerdevil.nix
+++ b/pkgs/desktops/plasma-5/powerdevil.nix
@@ -1,4 +1,4 @@
-{ plasmaPackage, ecm, kdoctools, bluez-qt, kactivities
+{ 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
@@ -6,7 +6,7 @@
 
 plasmaPackage {
   name = "powerdevil";
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
     kconfig kdbusaddons knotifyconfig solid udev bluez-qt kactivities kauth
     kdelibs4support kglobalaccel ki18n kio kidletime kwayland libkscreen
diff --git a/pkgs/desktops/plasma-5/srcs.nix b/pkgs/desktops/plasma-5/srcs.nix
new file mode 100644
index 000000000000..aaaea8708ae6
--- /dev/null
+++ b/pkgs/desktops/plasma-5/srcs.nix
@@ -0,0 +1,325 @@
+# DO NOT EDIT! This file is generated automatically by fetch-kde-qt.sh
+{ fetchurl, mirror }:
+
+{
+  bluedevil = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/bluedevil-5.8.6.tar.xz";
+      sha256 = "0qz9v5wrx72s3r1shi3m77931kl7sx7p89dk3h9w1hy61bx0azlj";
+      name = "bluedevil-5.8.6.tar.xz";
+    };
+  };
+  breeze = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/breeze-5.8.6.tar.xz";
+      sha256 = "16wxrmnlk359kapa6zj8hfcjjdffvmqc7ibzdxdd8xpdva01p7sm";
+      name = "breeze-5.8.6.tar.xz";
+    };
+  };
+  breeze-grub = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/breeze-grub-5.8.6.tar.xz";
+      sha256 = "1ywlczid32a8z4rrjxc6c3b8q3l02a3b7scbxyljgfv7xzggj1fm";
+      name = "breeze-grub-5.8.6.tar.xz";
+    };
+  };
+  breeze-gtk = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/breeze-gtk-5.8.6.tar.xz";
+      sha256 = "1ppxsf868d2v9kmdz18hnbdwwqbs0xhpn7pc3bdxxj4gk87dpxpl";
+      name = "breeze-gtk-5.8.6.tar.xz";
+    };
+  };
+  breeze-plymouth = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/breeze-plymouth-5.8.6.tar.xz";
+      sha256 = "0cdrl0ri4b5zbld8wb3hkmsncac6qn3mswvb7zp63br3jiqfg7v8";
+      name = "breeze-plymouth-5.8.6.tar.xz";
+    };
+  };
+  discover = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/discover-5.8.6.tar.xz";
+      sha256 = "04smq3n0prs2bjq6sn5kd5mp4aay58nr2fg10yq39sgyp2qkls0r";
+      name = "discover-5.8.6.tar.xz";
+    };
+  };
+  kactivitymanagerd = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/kactivitymanagerd-5.8.6.tar.xz";
+      sha256 = "0cxpf3aj22ap6m24gm1ybjykwv10ryqhpd4bv6wr748ckj5zsgh4";
+      name = "kactivitymanagerd-5.8.6.tar.xz";
+    };
+  };
+  kde-cli-tools = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/kde-cli-tools-5.8.6.tar.xz";
+      sha256 = "08j6mpn6g4mrdwiljfm5rqvyfjgd3wd4kpwmpmvrprqrd755m0cs";
+      name = "kde-cli-tools-5.8.6.tar.xz";
+    };
+  };
+  kdecoration = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/kdecoration-5.8.6.tar.xz";
+      sha256 = "0nbh0phgfzc5j1l1adnq3gn5fkazgk2pg2iiqjkfbax6a7r9wwny";
+      name = "kdecoration-5.8.6.tar.xz";
+    };
+  };
+  kde-gtk-config = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/kde-gtk-config-5.8.6.tar.xz";
+      sha256 = "07in78awn7kqg47zbypj5lb2i9yibrmpzkljjy67wwcwax5zlm2d";
+      name = "kde-gtk-config-5.8.6.tar.xz";
+    };
+  };
+  kdeplasma-addons = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/kdeplasma-addons-5.8.6.tar.xz";
+      sha256 = "0yvh2n736apbfzqc5kdf3b0a9jyvlzcaamall1paa8jb8cg706px";
+      name = "kdeplasma-addons-5.8.6.tar.xz";
+    };
+  };
+  kgamma5 = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/kgamma5-5.8.6.tar.xz";
+      sha256 = "1kk9bygihnggm4kmgxf1bbd0wc92ijmzvm9k5cmkm3v0pc975viz";
+      name = "kgamma5-5.8.6.tar.xz";
+    };
+  };
+  khotkeys = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/khotkeys-5.8.6.tar.xz";
+      sha256 = "0x6z025vzpccz0yql7nafcarq6rpw3p7d7wjffdck3lym8vkalxj";
+      name = "khotkeys-5.8.6.tar.xz";
+    };
+  };
+  kinfocenter = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/kinfocenter-5.8.6.tar.xz";
+      sha256 = "1d8h5h01dy7s1yaapamcz4dzf0pjdykf7jn8y34hc0djxww29k4b";
+      name = "kinfocenter-5.8.6.tar.xz";
+    };
+  };
+  kmenuedit = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/kmenuedit-5.8.6.tar.xz";
+      sha256 = "0zvircfmggc4vwz6520i67s1yfv34zkx8ydj1vfhaabpsn7nqn1w";
+      name = "kmenuedit-5.8.6.tar.xz";
+    };
+  };
+  kscreen = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/kscreen-5.8.6.tar.xz";
+      sha256 = "15k8pm1k2ylxqb3x4b75zi68firsxq56qfn39xddxnzncbsqp54r";
+      name = "kscreen-5.8.6.tar.xz";
+    };
+  };
+  kscreenlocker = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/kscreenlocker-5.8.6.tar.xz";
+      sha256 = "1cql5wq4zh8sdwlgwibnyyx169g79948nhdqslw08ddw61f9llgd";
+      name = "kscreenlocker-5.8.6.tar.xz";
+    };
+  };
+  ksshaskpass = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/ksshaskpass-5.8.6.tar.xz";
+      sha256 = "0y912dcvdx6gih0brnxnd3cysw0rj5pw7684xswaqz5i8iimw68g";
+      name = "ksshaskpass-5.8.6.tar.xz";
+    };
+  };
+  ksysguard = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/ksysguard-5.8.6.tar.xz";
+      sha256 = "0c0bxv5m0kziyqzwr6x46g4x2kahmq6n95kgcbihv74yvnn6v049";
+      name = "ksysguard-5.8.6.tar.xz";
+    };
+  };
+  kwallet-pam = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/kwallet-pam-5.8.6.tar.xz";
+      sha256 = "1ii1035w8xqvkbm0ckj5iq4qq7fnbix7vyvwmdjm8m4xm0rr7g33";
+      name = "kwallet-pam-5.8.6.tar.xz";
+    };
+  };
+  kwayland-integration = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/kwayland-integration-5.8.6.tar.xz";
+      sha256 = "0bd8hnqr6sqlzk0qrymk6jdxnl2niamb1a08m8d27qdybm0ga56v";
+      name = "kwayland-integration-5.8.6.tar.xz";
+    };
+  };
+  kwin = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/kwin-5.8.6.tar.xz";
+      sha256 = "1p9dgh6d25h41bgnx9jiyb9qg7jyc61kbzh9j9vy9j5kd97dsjg5";
+      name = "kwin-5.8.6.tar.xz";
+    };
+  };
+  kwrited = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/kwrited-5.8.6.tar.xz";
+      sha256 = "08frbgzfzqhi4si3v024lx4dypxvm60mdz2xzyyx482iqjny97d5";
+      name = "kwrited-5.8.6.tar.xz";
+    };
+  };
+  libkscreen = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/libkscreen-5.8.6.tar.xz";
+      sha256 = "0210lyvsk9wm7svj3bkaa9j0n57lfzs56jplasdqdia1450n7dmf";
+      name = "libkscreen-5.8.6.tar.xz";
+    };
+  };
+  libksysguard = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/libksysguard-5.8.6.tar.xz";
+      sha256 = "0i325hzl9zsknkr1dcdg64r4msrnvbb4b9rmjysygnpyll6n9bm8";
+      name = "libksysguard-5.8.6.tar.xz";
+    };
+  };
+  milou = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/milou-5.8.6.tar.xz";
+      sha256 = "00svi7f9pa1m6gxkkf8vngyf4jzv7k88pbcnlvik38zws17j4vbs";
+      name = "milou-5.8.6.tar.xz";
+    };
+  };
+  oxygen = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/oxygen-5.8.6.tar.xz";
+      sha256 = "1dspmzjmymnnv6blz2sfw0ynpqbw6cqzvhlnmzakf3xq8jd99k0m";
+      name = "oxygen-5.8.6.tar.xz";
+    };
+  };
+  plasma-desktop = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/plasma-desktop-5.8.6.tar.xz";
+      sha256 = "10qz1r777wr8wdr5lb7fph8ny8sxbm9vlq6njpn9rxxwr0nhlp6y";
+      name = "plasma-desktop-5.8.6.tar.xz";
+    };
+  };
+  plasma-integration = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/plasma-integration-5.8.6.tar.xz";
+      sha256 = "0v07i95xxv5rp0lis2xm0p66qicbigqjlx3sxyvcj3llf73jpcnc";
+      name = "plasma-integration-5.8.6.tar.xz";
+    };
+  };
+  plasma-nm = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/plasma-nm-5.8.6.tar.xz";
+      sha256 = "162756r2rif415w8x6x67h8bwjvvmfv56s84p7a4k5zisyr1j678";
+      name = "plasma-nm-5.8.6.tar.xz";
+    };
+  };
+  plasma-pa = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/plasma-pa-5.8.6.tar.xz";
+      sha256 = "173w2ks2nm4sp96vj3pkax1d8asshd9y39m5cwq8mgzgpz6ldjp8";
+      name = "plasma-pa-5.8.6.tar.xz";
+    };
+  };
+  plasma-sdk = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/plasma-sdk-5.8.6.tar.xz";
+      sha256 = "1vadfwv23r33f5byaf3zj8m12a84r4qk24ak7qyq869m9gznyw8r";
+      name = "plasma-sdk-5.8.6.tar.xz";
+    };
+  };
+  plasma-tests = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/plasma-tests-5.8.6.tar.xz";
+      sha256 = "0baqfn861jy7kmaqka79k6nkr7vivzymk8jy3glkh21rm4yl8gvh";
+      name = "plasma-tests-5.8.6.tar.xz";
+    };
+  };
+  plasma-workspace = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/plasma-workspace-5.8.6.tar.xz";
+      sha256 = "14h1lmyyb4rxnww7vyn9wnsi56v9ydhpbwmk9sv3zj1k9igqpasi";
+      name = "plasma-workspace-5.8.6.tar.xz";
+    };
+  };
+  plasma-workspace-wallpapers = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/plasma-workspace-wallpapers-5.8.6.tar.xz";
+      sha256 = "11s2sc37xni78fyb0yvnhlkw6ahhx4pkynqr06bmd9vq6c3133id";
+      name = "plasma-workspace-wallpapers-5.8.6.tar.xz";
+    };
+  };
+  polkit-kde-agent = {
+    version = "1-5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/polkit-kde-agent-1-5.8.6.tar.xz";
+      sha256 = "10bglbr7svm9bfl4a5kfyvj5zpyk46hsyh2rq9z9qy9ds76fh9w2";
+      name = "polkit-kde-agent-1-5.8.6.tar.xz";
+    };
+  };
+  powerdevil = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/powerdevil-5.8.6.tar.xz";
+      sha256 = "0cmyx267z917qqpndpzqzlgzx1hf54430644rhr7cf9iqqilvnv4";
+      name = "powerdevil-5.8.6.tar.xz";
+    };
+  };
+  sddm-kcm = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/sddm-kcm-5.8.6.tar.xz";
+      sha256 = "0xd8137pb0409vfiwv5n1vzzwa1vcvf3rgc36fid5hnlrdc15ilc";
+      name = "sddm-kcm-5.8.6.tar.xz";
+    };
+  };
+  systemsettings = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/systemsettings-5.8.6.tar.xz";
+      sha256 = "1zy037pb8w9xbzg316hbqfmfm39aylqngb5v08yn5hcnvxcll71v";
+      name = "systemsettings-5.8.6.tar.xz";
+    };
+  };
+  user-manager = {
+    version = "5.8.6";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.8.6/user-manager-5.8.6.tar.xz";
+      sha256 = "1z0aj5cvl5rxikbbvrvg0dq6y68jxm34ssf3gvhkd0jqlyqdl7ip";
+      name = "user-manager-5.8.6.tar.xz";
+    };
+  };
+}
diff --git a/pkgs/desktops/kde-5/plasma/startkde/default.nix b/pkgs/desktops/plasma-5/startkde/default.nix
index 516d651cec25..516d651cec25 100644
--- a/pkgs/desktops/kde-5/plasma/startkde/default.nix
+++ b/pkgs/desktops/plasma-5/startkde/default.nix
diff --git a/pkgs/desktops/kde-5/plasma/startkde/startkde.sh b/pkgs/desktops/plasma-5/startkde/startkde.sh
index a403e8e05e6e..a403e8e05e6e 100755
--- a/pkgs/desktops/kde-5/plasma/startkde/startkde.sh
+++ b/pkgs/desktops/plasma-5/startkde/startkde.sh
diff --git a/pkgs/desktops/kde-5/plasma/systemsettings.nix b/pkgs/desktops/plasma-5/systemsettings.nix
index 407d0e916264..32ea83d9d507 100644
--- a/pkgs/desktops/kde-5/plasma/systemsettings.nix
+++ b/pkgs/desktops/plasma-5/systemsettings.nix
@@ -1,12 +1,12 @@
 {
-  plasmaPackage, ecm, kdoctools, makeQtWrapper,
+  plasmaPackage, extra-cmake-modules, kdoctools, makeQtWrapper,
   kcmutils, kconfig, kdbusaddons, khtml, ki18n, kiconthemes, kio, kitemviews,
   kservice, kwindowsystem, kxmlgui, qtquickcontrols
 }:
 
 plasmaPackage {
   name = "systemsettings";
-  nativeBuildInputs = [ ecm kdoctools makeQtWrapper ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools makeQtWrapper ];
   propagatedBuildInputs = [
     kcmutils kconfig kdbusaddons khtml ki18n kiconthemes kio kitemviews kservice
     kwindowsystem kxmlgui qtquickcontrols
diff --git a/pkgs/development/libraries/kde-frameworks/attica.nix b/pkgs/development/libraries/kde-frameworks/attica.nix
index d34b3f3a2c5f..6533a05b1602 100644
--- a/pkgs/development/libraries/kde-frameworks/attica.nix
+++ b/pkgs/development/libraries/kde-frameworks/attica.nix
@@ -1,7 +1,8 @@
-{ kdeFramework, lib, ecm }:
+{ kdeFramework, lib, extra-cmake-modules, qtbase }:
 
 kdeFramework {
   name = "attica";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/baloo.nix b/pkgs/development/libraries/kde-frameworks/baloo.nix
index 9c803fdc7176..dc7b6af193bc 100644
--- a/pkgs/development/libraries/kde-frameworks/baloo.nix
+++ b/pkgs/development/libraries/kde-frameworks/baloo.nix
@@ -1,4 +1,4 @@
-{ kdeFramework, lib, ecm, kauth, kconfig
+{ kdeFramework, lib, extra-cmake-modules, kauth, kconfig
 , kcoreaddons, kcrash, kdbusaddons, kfilemetadata, ki18n, kidletime
 , kio, lmdb, qtbase, solid
 }:
@@ -6,7 +6,7 @@
 kdeFramework {
   name = "baloo";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     kauth kconfig kcoreaddons kcrash kdbusaddons kfilemetadata ki18n kio
     kidletime lmdb qtbase solid
diff --git a/pkgs/development/libraries/kde-frameworks/bluez-qt.nix b/pkgs/development/libraries/kde-frameworks/bluez-qt.nix
index 7ab82bdc1ef5..93c945b58ca4 100644
--- a/pkgs/development/libraries/kde-frameworks/bluez-qt.nix
+++ b/pkgs/development/libraries/kde-frameworks/bluez-qt.nix
@@ -1,12 +1,12 @@
 { kdeFramework, lib
-, ecm
+, extra-cmake-modules
 , qtdeclarative
 }:
 
 kdeFramework {
   name = "bluez-qt";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ qtdeclarative ];
   preConfigure = ''
     substituteInPlace CMakeLists.txt \
diff --git a/pkgs/development/libraries/kde-frameworks/breeze-icons.nix b/pkgs/development/libraries/kde-frameworks/breeze-icons.nix
index c87ba75b2b46..9a18ade96a80 100644
--- a/pkgs/development/libraries/kde-frameworks/breeze-icons.nix
+++ b/pkgs/development/libraries/kde-frameworks/breeze-icons.nix
@@ -1,10 +1,10 @@
-{ kdeFramework, lib, ecm, qtsvg }:
+{ kdeFramework, lib, extra-cmake-modules, qtsvg }:
 
 kdeFramework {
   name = "breeze-icons";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   outputs = [ "out" ];
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   buildInputs = [ qtsvg ];
   propagatedUserEnvPkgs = [ qtsvg.out ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/build-support/framework.nix b/pkgs/development/libraries/kde-frameworks/build-support/framework.nix
new file mode 100644
index 000000000000..5b6f2cc4b26d
--- /dev/null
+++ b/pkgs/development/libraries/kde-frameworks/build-support/framework.nix
@@ -0,0 +1,24 @@
+{ 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 ee7614bbcf10..2906dc788865 100644
--- a/pkgs/development/libraries/kde-frameworks/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/default.nix
@@ -19,143 +19,94 @@ 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/kde-frameworks`
    from the top of the Nixpkgs tree.
-3. Invoke `nix-build -A kde5` and ensure that everything builds.
+3. Use `nox-review wip` to check that everything builds.
 4. Commit the changes and open a pull request.
 
 */
 
-{ pkgs, debug ? false }:
+{ libsForQt5, kdeDerivation, lib, fetchurl }:
 
 let
-
-  inherit (pkgs) lib makeSetupHook stdenv;
-
-  mirror = "mirror://kde";
-  srcs = import ./srcs.nix { inherit (pkgs) fetchurl; inherit mirror; };
-
-  packages = self: with self; {
-
-    kdeDerivation = args:
-      let
-      in 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";
-
-      });
-
-    kdeFramework = let
-      broken = builtins.compareVersions self.qtbase.version "5.6.0" < 0;
-    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";
-          inherit broken;
-        } // (args.meta or {});
-      });
-
-    kdeWrapper = import ./kde-wrapper.nix {
-      inherit (pkgs) stdenv lib makeWrapper buildEnv;
-    };
-
-    attica = callPackage ./attica.nix {};
-    baloo = callPackage ./baloo.nix {};
-    bluez-qt = callPackage ./bluez-qt.nix {};
-    breeze-icons = callPackage ./breeze-icons.nix {};
-    # FIXME: this collides with the "ecm" package.
-    ecm =
-      let drv = { cmake, ecmNoHooks, pkgconfig, qtbase, qttools }:
-            makeSetupHook
-            { deps = lib.chooseDevOutputs [ cmake ecmNoHooks pkgconfig qtbase qttools ]; }
-            ./setup-hook.sh;
-      in callPackage drv {};
-    ecmNoHooks = callPackage ./extra-cmake-modules {
-      inherit (srcs.extra-cmake-modules) src version;
+  packages = self: with self;
+    let
+      callPackage = self.newScope {
+        kdeFramework = import ./build-support/framework.nix {
+          inherit kdeDerivation lib fetchurl;
+        };
+      };
+    in {
+      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 {};
+      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.nix {};
+      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 {};
     };
-    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 {};
-    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.nix {};
-    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 {};
-  };
 
-in packages
+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 d2f1688e330b..b2e3a371e965 100644
--- a/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/default.nix
@@ -1,15 +1,15 @@
-{ stdenv, lib, copyPathsToStore, src, version, cmake }:
+{ kdeFramework, lib, copyPathsToStore, cmake, pkgconfig }:
 
-stdenv.mkDerivation {
-  name = "extra-cmake-modules-${version}";
-
-  inherit src;
+kdeFramework {
+  name = "extra-cmake-modules";
 
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
 
   outputs = [ "out" ];  # this package has no runtime components
 
-  nativeBuildInputs = [ cmake ];
+  propagatedNativeBuildInputs = [ cmake pkgconfig ];
+
+  setupHook = ./setup-hook.sh;
 
   meta = with lib; {
     platforms = lib.platforms.linux;
diff --git a/pkgs/development/libraries/kde-frameworks/setup-hook.sh b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh
index a1638ca541be..9ee9ef90a44b 100644
--- a/pkgs/development/libraries/kde-frameworks/setup-hook.sh
+++ b/pkgs/development/libraries/kde-frameworks/extra-cmake-modules/setup-hook.sh
@@ -1,6 +1,6 @@
 _ecmSetXdgDirs() {
-    addToSearchPathOnce XDG_DATA_DIRS "$1/share"
-    addToSearchPathOnce XDG_CONFIG_DIRS "$1/etc/xdg"
+    addToSearchPath XDG_DATA_DIRS "$1/share"
+    addToSearchPath XDG_CONFIG_DIRS "$1/etc/xdg"
 }
 
 envHooks+=(_ecmSetXdgDirs)
diff --git a/pkgs/development/libraries/kde-frameworks/frameworkintegration.nix b/pkgs/development/libraries/kde-frameworks/frameworkintegration.nix
index 029a661601df..325758bf91db 100644
--- a/pkgs/development/libraries/kde-frameworks/frameworkintegration.nix
+++ b/pkgs/development/libraries/kde-frameworks/frameworkintegration.nix
@@ -1,6 +1,6 @@
 {
   kdeFramework, lib,
-  ecm,
+  extra-cmake-modules,
   kbookmarks, kcompletion, kconfig, kconfigwidgets, ki18n, kiconthemes, kio,
   knewstuff, knotifications, kpackage, kwidgetsaddons, libXcursor, qtx11extras
 }:
@@ -8,7 +8,7 @@
 kdeFramework {
   name = "frameworkintegration";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     kbookmarks kcompletion kconfig kconfigwidgets ki18n kio kiconthemes
     knewstuff knotifications kpackage kwidgetsaddons libXcursor qtx11extras
diff --git a/pkgs/development/libraries/kde-frameworks/kactivities-stats.nix b/pkgs/development/libraries/kde-frameworks/kactivities-stats.nix
index 4f406376faa7..25188b009b62 100644
--- a/pkgs/development/libraries/kde-frameworks/kactivities-stats.nix
+++ b/pkgs/development/libraries/kde-frameworks/kactivities-stats.nix
@@ -1,8 +1,8 @@
-{ kdeFramework, lib, ecm, boost, kactivities, kconfig }:
+{ kdeFramework, lib, extra-cmake-modules, boost, kactivities, kconfig }:
 
 kdeFramework {
   name = "kactivities-stats";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ boost kactivities kconfig ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kactivities.nix b/pkgs/development/libraries/kde-frameworks/kactivities.nix
index a2cacd4b257d..167c3f15bbda 100644
--- a/pkgs/development/libraries/kde-frameworks/kactivities.nix
+++ b/pkgs/development/libraries/kde-frameworks/kactivities.nix
@@ -1,4 +1,4 @@
-{ kdeFramework, lib, ecm, boost, kcmutils, kconfig
+{ kdeFramework, lib, extra-cmake-modules, boost, kcmutils, kconfig
 , kcoreaddons, kdbusaddons, kdeclarative, kglobalaccel, ki18n
 , kio, kservice, kwindowsystem, kxmlgui, qtdeclarative
 }:
@@ -6,7 +6,7 @@
 kdeFramework {
   name = "kactivities";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     boost kcmutils kconfig kcoreaddons kdbusaddons kdeclarative kglobalaccel
     ki18n kio kservice kwindowsystem kxmlgui qtdeclarative
diff --git a/pkgs/development/libraries/kde-frameworks/kapidox.nix b/pkgs/development/libraries/kde-frameworks/kapidox.nix
index f6c60b7731e1..749cf9b29709 100644
--- a/pkgs/development/libraries/kde-frameworks/kapidox.nix
+++ b/pkgs/development/libraries/kde-frameworks/kapidox.nix
@@ -1,7 +1,7 @@
-{ kdeFramework, lib, ecm, python }:
+{ kdeFramework, lib, extra-cmake-modules, python }:
 
 kdeFramework {
   name = "kapidox";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm python ];
+  nativeBuildInputs = [ extra-cmake-modules python ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/karchive.nix b/pkgs/development/libraries/kde-frameworks/karchive.nix
index 265df45800f1..ca3321bef849 100644
--- a/pkgs/development/libraries/kde-frameworks/karchive.nix
+++ b/pkgs/development/libraries/kde-frameworks/karchive.nix
@@ -1,7 +1,8 @@
-{ kdeFramework, lib, ecm }:
+{ kdeFramework, lib, extra-cmake-modules, qtbase }:
 
 kdeFramework {
   name = "karchive";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kauth/default.nix b/pkgs/development/libraries/kde-frameworks/kauth/default.nix
index f2a1c7717d5d..7561575ae84e 100644
--- a/pkgs/development/libraries/kde-frameworks/kauth/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kauth/default.nix
@@ -1,9 +1,9 @@
-{ kdeFramework, lib, copyPathsToStore, ecm, kcoreaddons, polkit-qt }:
+{ kdeFramework, lib, copyPathsToStore, extra-cmake-modules, kcoreaddons, polkit-qt, qttools }:
 
 kdeFramework {
   name = "kauth";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
   propagatedBuildInputs = [ kcoreaddons polkit-qt ];
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kbookmarks.nix b/pkgs/development/libraries/kde-frameworks/kbookmarks.nix
index 50cec5a39c86..36ea74058429 100644
--- a/pkgs/development/libraries/kde-frameworks/kbookmarks.nix
+++ b/pkgs/development/libraries/kde-frameworks/kbookmarks.nix
@@ -1,12 +1,12 @@
 {
-  kdeFramework, lib, ecm,
+  kdeFramework, lib, extra-cmake-modules,
   kcodecs, kconfig, kconfigwidgets, kcoreaddons, kiconthemes, kxmlgui
 }:
 
 kdeFramework {
   name = "kbookmarks";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     kcodecs kconfig kconfigwidgets kcoreaddons kiconthemes kxmlgui
   ];
diff --git a/pkgs/development/libraries/kde-frameworks/kcmutils/default.nix b/pkgs/development/libraries/kde-frameworks/kcmutils/default.nix
index dd1af737d68e..fdf55174548e 100644
--- a/pkgs/development/libraries/kde-frameworks/kcmutils/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kcmutils/default.nix
@@ -1,4 +1,4 @@
-{ kdeFramework, lib, ecm, kconfigwidgets
+{ kdeFramework, lib, extra-cmake-modules, kconfigwidgets
 , kcoreaddons, kdeclarative, ki18n, kiconthemes, kitemviews
 , kpackage, kservice, kxmlgui
 }:
@@ -6,7 +6,7 @@
 kdeFramework {
   name = "kcmutils";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     kconfigwidgets kcoreaddons kdeclarative ki18n kiconthemes kitemviews
     kpackage kservice kxmlgui
diff --git a/pkgs/development/libraries/kde-frameworks/kcodecs.nix b/pkgs/development/libraries/kde-frameworks/kcodecs.nix
index a3fcd3023f52..482c30b7b57e 100644
--- a/pkgs/development/libraries/kde-frameworks/kcodecs.nix
+++ b/pkgs/development/libraries/kde-frameworks/kcodecs.nix
@@ -1,7 +1,8 @@
-{ kdeFramework, lib, ecm }:
+{ kdeFramework, lib, extra-cmake-modules, qtbase, qttools }:
 
 kdeFramework {
   name = "kcodecs";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
+  buildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kcompletion.nix b/pkgs/development/libraries/kde-frameworks/kcompletion.nix
index 893f374933ea..f143524889ad 100644
--- a/pkgs/development/libraries/kde-frameworks/kcompletion.nix
+++ b/pkgs/development/libraries/kde-frameworks/kcompletion.nix
@@ -1,8 +1,9 @@
-{ kdeFramework, lib, ecm, kconfig, kwidgetsaddons }:
+{ kdeFramework, lib, extra-cmake-modules, kconfig, kwidgetsaddons, qtbase, qttools }:
 
 kdeFramework {
   name = "kcompletion";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
+  buildInputs = [ qtbase ];
   propagatedBuildInputs = [ kconfig kwidgetsaddons ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kconfig.nix b/pkgs/development/libraries/kde-frameworks/kconfig.nix
index 0f003f8ea97e..981256e75bf6 100644
--- a/pkgs/development/libraries/kde-frameworks/kconfig.nix
+++ b/pkgs/development/libraries/kde-frameworks/kconfig.nix
@@ -1,7 +1,8 @@
-{ kdeFramework, lib, ecm }:
+{ kdeFramework, lib, extra-cmake-modules, qtbase, qttools }:
 
 kdeFramework {
   name = "kconfig";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
+  buildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kconfigwidgets/default.nix b/pkgs/development/libraries/kde-frameworks/kconfigwidgets/default.nix
index b88308b634c0..c44473bb915e 100644
--- a/pkgs/development/libraries/kde-frameworks/kconfigwidgets/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kconfigwidgets/default.nix
@@ -1,12 +1,12 @@
 {
-  kdeFramework, lib, ecm,
+  kdeFramework, lib, extra-cmake-modules,
   kauth, kcodecs, kconfig, kdoctools, kguiaddons, ki18n, kwidgetsaddons
 }:
 
 kdeFramework {
   name = "kconfigwidgets";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
     kauth kconfig kcodecs kguiaddons ki18n kwidgetsaddons
   ];
diff --git a/pkgs/development/libraries/kde-frameworks/kcoreaddons.nix b/pkgs/development/libraries/kde-frameworks/kcoreaddons.nix
index ca8c521894bd..f5d04a30b1ae 100644
--- a/pkgs/development/libraries/kde-frameworks/kcoreaddons.nix
+++ b/pkgs/development/libraries/kde-frameworks/kcoreaddons.nix
@@ -1,8 +1,9 @@
-{ kdeFramework, lib, fetchurl, ecm, shared_mime_info }:
+{ kdeFramework, lib, fetchurl, extra-cmake-modules, qtbase, qttools, shared_mime_info }:
 
 kdeFramework {
   name = "kcoreaddons";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
+  buildInputs = [ qtbase ];
   propagatedBuildInputs = [ shared_mime_info ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kcrash.nix b/pkgs/development/libraries/kde-frameworks/kcrash.nix
index 2fcadc828cf4..bd008c732af7 100644
--- a/pkgs/development/libraries/kde-frameworks/kcrash.nix
+++ b/pkgs/development/libraries/kde-frameworks/kcrash.nix
@@ -1,8 +1,8 @@
-{ kdeFramework, lib, ecm, kcoreaddons, kwindowsystem, qtx11extras }:
+{ kdeFramework, lib, extra-cmake-modules, kcoreaddons, kwindowsystem, qtx11extras }:
 
 kdeFramework {
   name = "kcrash";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ kcoreaddons kwindowsystem qtx11extras ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kdbusaddons.nix b/pkgs/development/libraries/kde-frameworks/kdbusaddons.nix
index 663200516604..bc5aeff556d8 100644
--- a/pkgs/development/libraries/kde-frameworks/kdbusaddons.nix
+++ b/pkgs/development/libraries/kde-frameworks/kdbusaddons.nix
@@ -1,8 +1,8 @@
-{ kdeFramework, lib, ecm, qtx11extras }:
+{ kdeFramework, lib, extra-cmake-modules, qttools, qtx11extras }:
 
 kdeFramework {
   name = "kdbusaddons";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
   propagatedBuildInputs = [ qtx11extras ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kdeclarative.nix b/pkgs/development/libraries/kde-frameworks/kdeclarative.nix
index a90a419d9b84..05eaffb9fbf6 100644
--- a/pkgs/development/libraries/kde-frameworks/kdeclarative.nix
+++ b/pkgs/development/libraries/kde-frameworks/kdeclarative.nix
@@ -1,5 +1,5 @@
 {
-  kdeFramework, lib, ecm,
+  kdeFramework, lib, extra-cmake-modules,
   epoxy, kconfig, kglobalaccel, kguiaddons, ki18n, kiconthemes, kio, kpackage,
   kwidgetsaddons, kwindowsystem, pkgconfig, qtdeclarative
 }:
@@ -7,7 +7,7 @@
 kdeFramework {
   name = "kdeclarative";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     epoxy kconfig kglobalaccel kguiaddons ki18n kiconthemes kio kpackage
     kwidgetsaddons kwindowsystem qtdeclarative
diff --git a/pkgs/development/libraries/kde-frameworks/kded.nix b/pkgs/development/libraries/kde-frameworks/kded.nix
index d8fe820518d3..2da1bac8f39c 100644
--- a/pkgs/development/libraries/kde-frameworks/kded.nix
+++ b/pkgs/development/libraries/kde-frameworks/kded.nix
@@ -1,12 +1,12 @@
 {
-  kdeFramework, lib, ecm,
+  kdeFramework, lib, extra-cmake-modules,
   kconfig, kcoreaddons, kcrash, kdbusaddons, kdoctools, kinit, kservice
 }:
 
 kdeFramework {
   name = "kded";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
     kconfig kcoreaddons kcrash kdbusaddons kinit kservice
   ];
diff --git a/pkgs/development/libraries/kde-frameworks/kdelibs4support/default.nix b/pkgs/development/libraries/kde-frameworks/kdelibs4support/default.nix
index f3fd315e5500..1174972917e4 100644
--- a/pkgs/development/libraries/kde-frameworks/kdelibs4support/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kdelibs4support/default.nix
@@ -1,5 +1,5 @@
 { kdeFramework, lib, copyPathsToStore
-, ecm, docbook_xml_dtd_45, kauth
+, 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
@@ -15,7 +15,7 @@ kdeFramework {
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
   setupHook = ./setup-hook.sh;
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
     kauth karchive kcompletion kconfig kconfigwidgets kcoreaddons kcrash
     kdbusaddons kded kdesignerplugin kemoticons kglobalaccel kguiaddons ki18n
diff --git a/pkgs/development/libraries/kde-frameworks/kdesignerplugin.nix b/pkgs/development/libraries/kde-frameworks/kdesignerplugin.nix
index e87bb5bf9d01..8e17a1a60c8d 100644
--- a/pkgs/development/libraries/kde-frameworks/kdesignerplugin.nix
+++ b/pkgs/development/libraries/kde-frameworks/kdesignerplugin.nix
@@ -1,5 +1,5 @@
 { kdeFramework, lib
-, ecm
+, extra-cmake-modules
 , kcompletion
 , kconfig
 , kconfigwidgets
@@ -18,7 +18,7 @@
 kdeFramework {
   name = "kdesignerplugin";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
     kcompletion kconfig kconfigwidgets kcoreaddons kiconthemes kio
     kitemviews kplotting ktextwidgets kwidgetsaddons kxmlgui sonnet
diff --git a/pkgs/development/libraries/kde-frameworks/kdesu.nix b/pkgs/development/libraries/kde-frameworks/kdesu.nix
index 0c5cb85cc494..fcccea9161f1 100644
--- a/pkgs/development/libraries/kde-frameworks/kdesu.nix
+++ b/pkgs/development/libraries/kde-frameworks/kdesu.nix
@@ -1,10 +1,10 @@
-{ kdeFramework, lib, ecm, kcoreaddons, ki18n, kpty
+{ kdeFramework, lib, extra-cmake-modules, kcoreaddons, ki18n, kpty
 , kservice
 }:
 
 kdeFramework {
   name = "kdesu";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ kcoreaddons ki18n kpty kservice ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kdnssd.nix b/pkgs/development/libraries/kde-frameworks/kdnssd.nix
index 49fd368fccbf..ad86b660c747 100644
--- a/pkgs/development/libraries/kde-frameworks/kdnssd.nix
+++ b/pkgs/development/libraries/kde-frameworks/kdnssd.nix
@@ -1,11 +1,12 @@
 { kdeFramework, lib
-, ecm
-, avahi
+, extra-cmake-modules, qttools
+, avahi, qtbase
 }:
 
 kdeFramework {
   name = "kdnssd";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
   propagatedBuildInputs = [ avahi ];
+  buildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix b/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix
index 4a31ea5396df..99fc4c7d023c 100644
--- a/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kdoctools/default.nix
@@ -1,11 +1,11 @@
-{ kdeFramework, lib, ecm, docbook_xml_dtd_45
+{ kdeFramework, lib, extra-cmake-modules, docbook_xml_dtd_45
 , docbook5_xsl, karchive, ki18n, perl, perlPackages
 }:
 
 kdeFramework {
   name = "kdoctools";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ karchive ki18n ];
   propagatedNativeBuildInputs = [ perl perlPackages.URI ];
   cmakeFlags = [
diff --git a/pkgs/development/libraries/kde-frameworks/kemoticons.nix b/pkgs/development/libraries/kde-frameworks/kemoticons.nix
index cdffbd503576..1e31277172d7 100644
--- a/pkgs/development/libraries/kde-frameworks/kemoticons.nix
+++ b/pkgs/development/libraries/kde-frameworks/kemoticons.nix
@@ -1,5 +1,5 @@
 { kdeFramework, lib
-, ecm
+, extra-cmake-modules
 , karchive
 , kconfig
 , kcoreaddons
@@ -9,6 +9,6 @@
 kdeFramework {
   name = "kemoticons";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ karchive kconfig kcoreaddons kservice ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kfilemetadata/default.nix b/pkgs/development/libraries/kde-frameworks/kfilemetadata/default.nix
index 31f692deca64..bc7349e7453f 100644
--- a/pkgs/development/libraries/kde-frameworks/kfilemetadata/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kfilemetadata/default.nix
@@ -1,4 +1,4 @@
-{ kdeFramework, lib, copyPathsToStore, ecm
+{ kdeFramework, lib, copyPathsToStore, extra-cmake-modules
 , attr, ebook_tools, exiv2, ffmpeg, karchive, ki18n, poppler, qtbase, taglib
 }:
 
@@ -6,7 +6,7 @@ kdeFramework {
   name = "kfilemetadata";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     attr ebook_tools exiv2 ffmpeg karchive ki18n poppler qtbase taglib
   ];
diff --git a/pkgs/development/libraries/kde-frameworks/kglobalaccel.nix b/pkgs/development/libraries/kde-frameworks/kglobalaccel.nix
index bbb480c31658..1c1336dd4d0f 100644
--- a/pkgs/development/libraries/kde-frameworks/kglobalaccel.nix
+++ b/pkgs/development/libraries/kde-frameworks/kglobalaccel.nix
@@ -1,5 +1,5 @@
 {
-  kdeFramework, lib, ecm,
+  kdeFramework, lib, extra-cmake-modules,
   kconfig, kcoreaddons, kcrash, kdbusaddons, kservice, kwindowsystem,
   qtx11extras
 }:
@@ -7,7 +7,7 @@
 kdeFramework {
   name = "kglobalaccel";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     kconfig kcoreaddons kcrash kdbusaddons kservice kwindowsystem qtx11extras
   ];
diff --git a/pkgs/development/libraries/kde-frameworks/kguiaddons.nix b/pkgs/development/libraries/kde-frameworks/kguiaddons.nix
index 9f20ecd598a4..6ebfd1104f70 100644
--- a/pkgs/development/libraries/kde-frameworks/kguiaddons.nix
+++ b/pkgs/development/libraries/kde-frameworks/kguiaddons.nix
@@ -1,11 +1,11 @@
 { kdeFramework, lib
-, ecm
+, extra-cmake-modules
 , qtx11extras
 }:
 
 kdeFramework {
   name = "kguiaddons";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ qtx11extras ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/khtml.nix b/pkgs/development/libraries/kde-frameworks/khtml.nix
index be1094b7cf5a..99f6fe31e0d7 100644
--- a/pkgs/development/libraries/kde-frameworks/khtml.nix
+++ b/pkgs/development/libraries/kde-frameworks/khtml.nix
@@ -1,4 +1,4 @@
-{ kdeFramework, lib, ecm, giflib, karchive
+{ kdeFramework, lib, extra-cmake-modules, giflib, karchive
 , kcodecs, kglobalaccel, ki18n, kiconthemes, kio, kjs
 , knotifications, kparts, ktextwidgets, kwallet, kwidgetsaddons
 , kwindowsystem, kxmlgui, perl, phonon, qtx11extras, sonnet
@@ -7,7 +7,7 @@
 kdeFramework {
   name = "khtml";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm perl ];
+  nativeBuildInputs = [ extra-cmake-modules perl ];
   propagatedBuildInputs = [
     giflib karchive kcodecs kglobalaccel ki18n kiconthemes kio kjs
     knotifications kparts ktextwidgets kwallet kwidgetsaddons kwindowsystem
diff --git a/pkgs/development/libraries/kde-frameworks/ki18n.nix b/pkgs/development/libraries/kde-frameworks/ki18n.nix
index cf2212413bd2..2698a97fd33f 100644
--- a/pkgs/development/libraries/kde-frameworks/ki18n.nix
+++ b/pkgs/development/libraries/kde-frameworks/ki18n.nix
@@ -1,5 +1,5 @@
 { kdeFramework, lib
-, ecm
+, extra-cmake-modules
 , gettext
 , python
 , qtdeclarative
@@ -9,7 +9,7 @@
 kdeFramework {
   name = "ki18n";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ qtdeclarative qtscript ];
   propagatedNativeBuildInputs = [ gettext python ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kiconthemes/default.nix b/pkgs/development/libraries/kde-frameworks/kiconthemes/default.nix
index 6141db849efe..6102bb0d4b56 100644
--- a/pkgs/development/libraries/kde-frameworks/kiconthemes/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kiconthemes/default.nix
@@ -1,5 +1,5 @@
 { kdeFramework, lib, copyPathsToStore
-, ecm
+, extra-cmake-modules
 , karchive, kconfigwidgets, ki18n, breeze-icons, kitemviews, qtsvg
 }:
 
@@ -7,6 +7,6 @@ kdeFramework {
   name = "kiconthemes";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ breeze-icons kconfigwidgets karchive ki18n kitemviews qtsvg ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kidletime.nix b/pkgs/development/libraries/kde-frameworks/kidletime.nix
index d3f46512db23..758260517e7d 100644
--- a/pkgs/development/libraries/kde-frameworks/kidletime.nix
+++ b/pkgs/development/libraries/kde-frameworks/kidletime.nix
@@ -1,5 +1,5 @@
 { kdeFramework, lib
-, ecm
+, extra-cmake-modules
 , qtbase
 , qtx11extras
 }:
@@ -7,6 +7,6 @@
 kdeFramework {
   name = "kidletime";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ qtbase qtx11extras ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kimageformats.nix b/pkgs/development/libraries/kde-frameworks/kimageformats.nix
index 631cac4217c8..2a8e825893bf 100644
--- a/pkgs/development/libraries/kde-frameworks/kimageformats.nix
+++ b/pkgs/development/libraries/kde-frameworks/kimageformats.nix
@@ -1,14 +1,14 @@
 {
   kdeFramework, lib,
-  ecm,
-  ilmbase, karchive
+  extra-cmake-modules,
+  ilmbase, karchive, qtbase
 }:
 
 kdeFramework {
   name = "kimageformats";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
-  buildInputs = [ ilmbase ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ ilmbase qtbase ];
   propagatedBuildInputs = [ karchive ];
   NIX_CFLAGS_COMPILE = "-I${ilmbase.dev}/include/OpenEXR";
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kinit/default.nix b/pkgs/development/libraries/kde-frameworks/kinit/default.nix
index 032bdd30d9ec..b965f761e922 100644
--- a/pkgs/development/libraries/kde-frameworks/kinit/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kinit/default.nix
@@ -1,13 +1,13 @@
 {
   kdeFramework, lib, copyPathsToStore,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   kconfig, kcrash, ki18n, kio, kservice, kwindowsystem
 }:
 
 kdeFramework {
   name = "kinit";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
     kconfig kcrash ki18n kio kservice kwindowsystem
   ];
diff --git a/pkgs/development/libraries/kde-frameworks/kio/default.nix b/pkgs/development/libraries/kde-frameworks/kio/default.nix
index 7623e44a0761..cb67c8459034 100644
--- a/pkgs/development/libraries/kde-frameworks/kio/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kio/default.nix
@@ -1,5 +1,5 @@
 { kdeFramework, lib, copyPathsToStore
-, ecm, acl, karchive
+, extra-cmake-modules, acl, karchive
 , kbookmarks, kcompletion, kconfig, kconfigwidgets, kcoreaddons
 , kdbusaddons, kdoctools, ki18n, kiconthemes, kitemviews
 , kjobwidgets, knotifications, kservice, ktextwidgets, kwallet
@@ -10,7 +10,7 @@
 kdeFramework {
   name = "kio";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
     acl karchive kbookmarks kcompletion kconfig kconfigwidgets kcoreaddons
     kdbusaddons ki18n kiconthemes kitemviews kjobwidgets knotifications kservice
diff --git a/pkgs/development/libraries/kde-frameworks/kitemmodels.nix b/pkgs/development/libraries/kde-frameworks/kitemmodels.nix
index 0a474dfdb7d7..d6538e57698c 100644
--- a/pkgs/development/libraries/kde-frameworks/kitemmodels.nix
+++ b/pkgs/development/libraries/kde-frameworks/kitemmodels.nix
@@ -1,9 +1,10 @@
 { kdeFramework, lib
-, ecm
+, extra-cmake-modules, qtbase
 }:
 
 kdeFramework {
   name = "kitemmodels";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kitemviews.nix b/pkgs/development/libraries/kde-frameworks/kitemviews.nix
index 0af3de5770a9..f114c007038b 100644
--- a/pkgs/development/libraries/kde-frameworks/kitemviews.nix
+++ b/pkgs/development/libraries/kde-frameworks/kitemviews.nix
@@ -1,9 +1,10 @@
 { kdeFramework, lib
-, ecm
+, extra-cmake-modules, qtbase, qttools
 }:
 
 kdeFramework {
   name = "kitemviews";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
+  buildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kjobwidgets.nix b/pkgs/development/libraries/kde-frameworks/kjobwidgets.nix
index 1337f4109c2d..ddc66d2eb20a 100644
--- a/pkgs/development/libraries/kde-frameworks/kjobwidgets.nix
+++ b/pkgs/development/libraries/kde-frameworks/kjobwidgets.nix
@@ -1,13 +1,13 @@
 { kdeFramework, lib
-, ecm
+, extra-cmake-modules
 , kcoreaddons
 , kwidgetsaddons
-, qtx11extras
+, qttools, qtx11extras
 }:
 
 kdeFramework {
   name = "kjobwidgets";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
   propagatedBuildInputs = [ kcoreaddons kwidgetsaddons qtx11extras ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kjs.nix b/pkgs/development/libraries/kde-frameworks/kjs.nix
index 12852e6a1e77..abdc15ce8df6 100644
--- a/pkgs/development/libraries/kde-frameworks/kjs.nix
+++ b/pkgs/development/libraries/kde-frameworks/kjs.nix
@@ -1,10 +1,10 @@
 { kdeFramework, lib
-, ecm
+, extra-cmake-modules
 , kdoctools
 }:
 
 kdeFramework {
   name = "kjs";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kjsembed.nix b/pkgs/development/libraries/kde-frameworks/kjsembed.nix
index 20c8b2eea162..95bc02422f1b 100644
--- a/pkgs/development/libraries/kde-frameworks/kjsembed.nix
+++ b/pkgs/development/libraries/kde-frameworks/kjsembed.nix
@@ -1,10 +1,10 @@
-{ kdeFramework, lib, ecm, kdoctools, ki18n, kjs
+{ kdeFramework, lib, extra-cmake-modules, kdoctools, ki18n, kjs
 , qtsvg
 }:
 
 kdeFramework {
   name = "kjsembed";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [ ki18n kjs qtsvg ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kmediaplayer.nix b/pkgs/development/libraries/kde-frameworks/kmediaplayer.nix
index 360d8e90daf2..93a6b450f762 100644
--- a/pkgs/development/libraries/kde-frameworks/kmediaplayer.nix
+++ b/pkgs/development/libraries/kde-frameworks/kmediaplayer.nix
@@ -1,5 +1,5 @@
 { kdeFramework, lib
-, ecm
+, extra-cmake-modules
 , kparts
 , kxmlgui
 }:
@@ -7,6 +7,6 @@
 kdeFramework {
   name = "kmediaplayer";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ kparts kxmlgui ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/knewstuff.nix b/pkgs/development/libraries/kde-frameworks/knewstuff.nix
index b6a84e2539d2..002418c65ad0 100644
--- a/pkgs/development/libraries/kde-frameworks/knewstuff.nix
+++ b/pkgs/development/libraries/kde-frameworks/knewstuff.nix
@@ -1,4 +1,4 @@
-{ kdeFramework, lib, ecm, attica, karchive
+{ kdeFramework, lib, extra-cmake-modules, attica, karchive
 , kcompletion, kconfig, kcoreaddons, ki18n, kiconthemes, kio
 , kitemviews, kservice, ktextwidgets, kwidgetsaddons, kxmlgui
 }:
@@ -6,7 +6,7 @@
 kdeFramework {
   name = "knewstuff";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     attica karchive kcompletion kconfig kcoreaddons ki18n kiconthemes kio
     kitemviews kservice ktextwidgets kwidgetsaddons kxmlgui
diff --git a/pkgs/development/libraries/kde-frameworks/knotifications.nix b/pkgs/development/libraries/kde-frameworks/knotifications.nix
index 061a5d8d142a..c1c079578725 100644
--- a/pkgs/development/libraries/kde-frameworks/knotifications.nix
+++ b/pkgs/development/libraries/kde-frameworks/knotifications.nix
@@ -1,15 +1,15 @@
 { kdeFramework, lib
-, ecm
+, extra-cmake-modules
 , kcodecs, kconfig, kcoreaddons, kwindowsystem
 , libdbusmenu
 , phonon
-, qtx11extras
+, qttools, qtx11extras
 }:
 
 kdeFramework {
   name = "knotifications";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
   propagatedBuildInputs = [
     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 b64f109f08b1..0e357aecb999 100644
--- a/pkgs/development/libraries/kde-frameworks/knotifyconfig.nix
+++ b/pkgs/development/libraries/kde-frameworks/knotifyconfig.nix
@@ -1,10 +1,10 @@
-{ kdeFramework, lib, ecm, kcompletion, kconfig
+{ kdeFramework, lib, extra-cmake-modules, kcompletion, kconfig
 , ki18n, kio, phonon
 }:
 
 kdeFramework {
   name = "knotifyconfig";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ kcompletion kconfig ki18n kio phonon ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kpackage/default.nix b/pkgs/development/libraries/kde-frameworks/kpackage/default.nix
index 86ca5935a75d..2953aea9a557 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,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   karchive, kconfig, kcoreaddons, ki18n
 }:
 
 kdeFramework {
   name = "kpackage";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [ karchive kconfig kcoreaddons ki18n ];
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kparts.nix b/pkgs/development/libraries/kde-frameworks/kparts.nix
index a46fa210b276..ad6ea2dbc305 100644
--- a/pkgs/development/libraries/kde-frameworks/kparts.nix
+++ b/pkgs/development/libraries/kde-frameworks/kparts.nix
@@ -1,4 +1,4 @@
-{ kdeFramework, lib, ecm, kconfig, kcoreaddons
+{ kdeFramework, lib, extra-cmake-modules, kconfig, kcoreaddons
 , ki18n, kiconthemes, kio, kjobwidgets, knotifications, kservice
 , ktextwidgets, kwidgetsaddons, kxmlgui
 }:
@@ -6,7 +6,7 @@
 kdeFramework {
   name = "kparts";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     kconfig kcoreaddons ki18n kiconthemes kio kjobwidgets knotifications
     kservice ktextwidgets kwidgetsaddons kxmlgui
diff --git a/pkgs/development/libraries/kde-frameworks/kpeople.nix b/pkgs/development/libraries/kde-frameworks/kpeople.nix
index 4ca9bc7fdbf9..6acb5e2eed51 100644
--- a/pkgs/development/libraries/kde-frameworks/kpeople.nix
+++ b/pkgs/development/libraries/kde-frameworks/kpeople.nix
@@ -1,11 +1,11 @@
-{ kdeFramework, lib, ecm, kcoreaddons, ki18n
+{ kdeFramework, lib, extra-cmake-modules, kcoreaddons, ki18n
 , kitemviews, kservice, kwidgetsaddons, qtdeclarative
 }:
 
 kdeFramework {
   name = "kpeople";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     kcoreaddons ki18n kitemviews kservice kwidgetsaddons qtdeclarative
   ];
diff --git a/pkgs/development/libraries/kde-frameworks/kplotting.nix b/pkgs/development/libraries/kde-frameworks/kplotting.nix
index 6eda06445dc5..3fa8283d06c4 100644
--- a/pkgs/development/libraries/kde-frameworks/kplotting.nix
+++ b/pkgs/development/libraries/kde-frameworks/kplotting.nix
@@ -1,9 +1,10 @@
 { kdeFramework, lib
-, ecm
+, extra-cmake-modules, qtbase
 }:
 
 kdeFramework {
   name = "kplotting";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kpty.nix b/pkgs/development/libraries/kde-frameworks/kpty.nix
index d42f96fb92c5..8bdaacb85f82 100644
--- a/pkgs/development/libraries/kde-frameworks/kpty.nix
+++ b/pkgs/development/libraries/kde-frameworks/kpty.nix
@@ -1,8 +1,8 @@
-{ kdeFramework, lib, ecm, kcoreaddons, ki18n }:
+{ kdeFramework, lib, extra-cmake-modules, kcoreaddons, ki18n }:
 
 kdeFramework {
   name = "kpty";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ kcoreaddons ki18n ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kross.nix b/pkgs/development/libraries/kde-frameworks/kross.nix
index ae098654eb11..0e66d95b5cce 100644
--- a/pkgs/development/libraries/kde-frameworks/kross.nix
+++ b/pkgs/development/libraries/kde-frameworks/kross.nix
@@ -1,4 +1,4 @@
-{ kdeFramework, lib, ecm, kcompletion, kcoreaddons
+{ kdeFramework, lib, extra-cmake-modules, kcompletion, kcoreaddons
 , kdoctools, ki18n, kiconthemes, kio, kparts, kwidgetsaddons
 , kxmlgui, qtscript
 }:
@@ -6,7 +6,7 @@
 kdeFramework {
   name = "kross";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
     kcompletion kcoreaddons ki18n kiconthemes kio kparts kwidgetsaddons kxmlgui
     qtscript
diff --git a/pkgs/development/libraries/kde-frameworks/krunner.nix b/pkgs/development/libraries/kde-frameworks/krunner.nix
index 064a89e08067..ec9ab7abe9f9 100644
--- a/pkgs/development/libraries/kde-frameworks/krunner.nix
+++ b/pkgs/development/libraries/kde-frameworks/krunner.nix
@@ -1,4 +1,4 @@
-{ kdeFramework, lib, ecm, kconfig, kcoreaddons
+{ kdeFramework, lib, extra-cmake-modules, kconfig, kcoreaddons
 , ki18n, kio, kservice, plasma-framework, solid
 , threadweaver
 }:
@@ -6,7 +6,7 @@
 kdeFramework {
   name = "krunner";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     kconfig kcoreaddons ki18n kio kservice plasma-framework solid
     threadweaver
diff --git a/pkgs/development/libraries/kde-frameworks/kservice/default.nix b/pkgs/development/libraries/kde-frameworks/kservice/default.nix
index ca840fc8b71a..2751a7f5d6e0 100644
--- a/pkgs/development/libraries/kde-frameworks/kservice/default.nix
+++ b/pkgs/development/libraries/kde-frameworks/kservice/default.nix
@@ -1,13 +1,13 @@
 {
   kdeFramework, lib, copyPathsToStore,
-  bison, ecm, flex,
+  bison, extra-cmake-modules, flex,
   kconfig, kcoreaddons, kcrash, kdbusaddons, kdoctools, ki18n, kwindowsystem
 }:
 
 kdeFramework {
   name = "kservice";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  propagatedNativeBuildInputs = [ bison ecm flex ];
+  propagatedNativeBuildInputs = [ bison extra-cmake-modules flex ];
   nativeBuildInputs = [ kdoctools ];
   propagatedBuildInputs = [ kconfig kcoreaddons kcrash kdbusaddons ki18n kwindowsystem ];
   patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
diff --git a/pkgs/development/libraries/kde-frameworks/ktexteditor.nix b/pkgs/development/libraries/kde-frameworks/ktexteditor.nix
index 0e444cc8db68..fbd73c65eff6 100644
--- a/pkgs/development/libraries/kde-frameworks/ktexteditor.nix
+++ b/pkgs/development/libraries/kde-frameworks/ktexteditor.nix
@@ -1,5 +1,5 @@
 { kdeFramework, lib, copyPathsToStore
-, ecm, perl
+, extra-cmake-modules, perl
 , karchive, kconfig, kguiaddons, kiconthemes, kparts
 , libgit2
 , qtscript, qtxmlpatterns
@@ -9,7 +9,7 @@
 kdeFramework {
   name = "ktexteditor";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm perl ];
+  nativeBuildInputs = [ extra-cmake-modules perl ];
   propagatedBuildInputs = [
     karchive kconfig kguiaddons ki18n kiconthemes kio kparts libgit2 qtscript
     qtxmlpatterns sonnet syntax-highlighting
diff --git a/pkgs/development/libraries/kde-frameworks/ktextwidgets.nix b/pkgs/development/libraries/kde-frameworks/ktextwidgets.nix
index 3a1258e9a37b..25954c603971 100644
--- a/pkgs/development/libraries/kde-frameworks/ktextwidgets.nix
+++ b/pkgs/development/libraries/kde-frameworks/ktextwidgets.nix
@@ -1,4 +1,4 @@
-{ kdeFramework, lib, ecm, kcompletion, kconfig
+{ kdeFramework, lib, extra-cmake-modules, kcompletion, kconfig
 , kconfigwidgets, ki18n, kiconthemes, kservice, kwindowsystem
 , sonnet
 }:
@@ -6,7 +6,7 @@
 kdeFramework {
   name = "ktextwidgets";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     kcompletion kconfig kconfigwidgets ki18n kiconthemes kservice kwindowsystem
     sonnet
diff --git a/pkgs/development/libraries/kde-frameworks/kunitconversion.nix b/pkgs/development/libraries/kde-frameworks/kunitconversion.nix
index 136587cc682e..c04ded722aa4 100644
--- a/pkgs/development/libraries/kde-frameworks/kunitconversion.nix
+++ b/pkgs/development/libraries/kde-frameworks/kunitconversion.nix
@@ -1,8 +1,8 @@
-{ kdeFramework, lib, ecm, ki18n }:
+{ kdeFramework, lib, extra-cmake-modules, ki18n }:
 
 kdeFramework {
   name = "kunitconversion";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ ki18n ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kwallet.nix b/pkgs/development/libraries/kde-frameworks/kwallet.nix
index fb801f48b119..f02c6138df77 100644
--- a/pkgs/development/libraries/kde-frameworks/kwallet.nix
+++ b/pkgs/development/libraries/kde-frameworks/kwallet.nix
@@ -1,4 +1,4 @@
-{ kdeFramework, lib, ecm, kconfig, kconfigwidgets
+{ kdeFramework, lib, extra-cmake-modules, kconfig, kconfigwidgets
 , kcoreaddons , kdbusaddons, kdoctools, ki18n, kiconthemes
 , knotifications , kservice, kwidgetsaddons, kwindowsystem, libgcrypt
 }:
@@ -6,7 +6,7 @@
 kdeFramework {
   name = "kwallet";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
     kconfig kconfigwidgets kcoreaddons kdbusaddons ki18n kiconthemes
     knotifications kservice kwidgetsaddons kwindowsystem libgcrypt
diff --git a/pkgs/development/libraries/kde-frameworks/kwayland.nix b/pkgs/development/libraries/kde-frameworks/kwayland.nix
index c530bf80a90e..b5255022a86d 100644
--- a/pkgs/development/libraries/kde-frameworks/kwayland.nix
+++ b/pkgs/development/libraries/kde-frameworks/kwayland.nix
@@ -1,13 +1,14 @@
 { kdeFramework
-, ecm
-, wayland
+, extra-cmake-modules
+, qtbase, wayland
 }:
 
 kdeFramework {
   name = "kwayland";
   nativeBuildInputs = [
-    ecm
+    extra-cmake-modules
   ];
+  buildInputs = [ qtbase ];
   propagatedBuildInputs = [
     wayland
   ];
diff --git a/pkgs/development/libraries/kde-frameworks/kwidgetsaddons.nix b/pkgs/development/libraries/kde-frameworks/kwidgetsaddons.nix
index ae34e60c4c12..c5c0063c4634 100644
--- a/pkgs/development/libraries/kde-frameworks/kwidgetsaddons.nix
+++ b/pkgs/development/libraries/kde-frameworks/kwidgetsaddons.nix
@@ -1,9 +1,10 @@
 { kdeFramework, lib
-, ecm
+, extra-cmake-modules, qtbase, qttools
 }:
 
 kdeFramework {
   name = "kwidgetsaddons";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
+  buildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kwindowsystem.nix b/pkgs/development/libraries/kde-frameworks/kwindowsystem.nix
index 64186a30eadc..e55c4021b9ed 100644
--- a/pkgs/development/libraries/kde-frameworks/kwindowsystem.nix
+++ b/pkgs/development/libraries/kde-frameworks/kwindowsystem.nix
@@ -1,11 +1,11 @@
 { kdeFramework, lib
-, ecm
-, qtx11extras
+, extra-cmake-modules
+, qttools, qtx11extras
 }:
 
 kdeFramework {
   name = "kwindowsystem";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
   propagatedBuildInputs = [ qtx11extras ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/kxmlgui.nix b/pkgs/development/libraries/kde-frameworks/kxmlgui.nix
index c48fc9efdfad..ea800bf58ae0 100644
--- a/pkgs/development/libraries/kde-frameworks/kxmlgui.nix
+++ b/pkgs/development/libraries/kde-frameworks/kxmlgui.nix
@@ -1,4 +1,4 @@
-{ kdeFramework, lib, ecm, attica, kconfig
+{ kdeFramework, lib, extra-cmake-modules, attica, kconfig
 , kconfigwidgets, kglobalaccel, ki18n, kiconthemes, kitemviews
 , ktextwidgets, kwindowsystem, sonnet
 }:
@@ -6,7 +6,7 @@
 kdeFramework {
   name = "kxmlgui";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [
     attica kconfig kconfigwidgets kglobalaccel ki18n kiconthemes kitemviews
     ktextwidgets kwindowsystem sonnet
diff --git a/pkgs/development/libraries/kde-frameworks/kxmlrpcclient.nix b/pkgs/development/libraries/kde-frameworks/kxmlrpcclient.nix
index 31301875351f..f20f4a223945 100644
--- a/pkgs/development/libraries/kde-frameworks/kxmlrpcclient.nix
+++ b/pkgs/development/libraries/kde-frameworks/kxmlrpcclient.nix
@@ -1,8 +1,8 @@
-{ kdeFramework, lib, ecm, ki18n, kio }:
+{ kdeFramework, lib, extra-cmake-modules, ki18n, kio }:
 
 kdeFramework {
   name = "kxmlrpcclient";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
   propagatedBuildInputs = [ ki18n kio ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/modemmanager-qt.nix b/pkgs/development/libraries/kde-frameworks/modemmanager-qt.nix
index bf3487dcb391..b4d05678dc2f 100644
--- a/pkgs/development/libraries/kde-frameworks/modemmanager-qt.nix
+++ b/pkgs/development/libraries/kde-frameworks/modemmanager-qt.nix
@@ -1,11 +1,12 @@
 { kdeFramework, lib
-, ecm
-, modemmanager
+, extra-cmake-modules
+, modemmanager, qtbase
 }:
 
 kdeFramework {
   name = "modemmanager-qt";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtbase ];
   propagatedBuildInputs = [ modemmanager ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/networkmanager-qt.nix b/pkgs/development/libraries/kde-frameworks/networkmanager-qt.nix
index bb5968635388..9d765eac95cc 100644
--- a/pkgs/development/libraries/kde-frameworks/networkmanager-qt.nix
+++ b/pkgs/development/libraries/kde-frameworks/networkmanager-qt.nix
@@ -1,11 +1,12 @@
 { kdeFramework, lib
-, ecm
-, networkmanager
+, extra-cmake-modules
+, qtbase, networkmanager
 }:
 
 kdeFramework {
   name = "networkmanager-qt";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtbase ];
   propagatedBuildInputs = [ networkmanager ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/oxygen-icons5.nix b/pkgs/development/libraries/kde-frameworks/oxygen-icons5.nix
index 42978b46992d..1d45b51274c5 100644
--- a/pkgs/development/libraries/kde-frameworks/oxygen-icons5.nix
+++ b/pkgs/development/libraries/kde-frameworks/oxygen-icons5.nix
@@ -1,6 +1,6 @@
 { kdeFramework
 , lib
-, ecm
+, extra-cmake-modules, qtbase
 }:
 
 kdeFramework {
@@ -10,5 +10,6 @@ kdeFramework {
     maintainers = [ lib.maintainers.ttuegel ];
   };
   outputs = [ "out" ];
-  nativeBuildInputs = [ ecm ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/plasma-framework.nix b/pkgs/development/libraries/kde-frameworks/plasma-framework.nix
index 963e93227279..2fd667af0dc1 100644
--- a/pkgs/development/libraries/kde-frameworks/plasma-framework.nix
+++ b/pkgs/development/libraries/kde-frameworks/plasma-framework.nix
@@ -1,4 +1,4 @@
-{ kdeFramework, lib, fetchurl, ecm, kactivities, karchive
+{ 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
@@ -8,7 +8,7 @@
 kdeFramework {
   name = "plasma-framework";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm kdoctools ];
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
   propagatedBuildInputs = [
     kactivities karchive kconfig kconfigwidgets kcoreaddons kdbusaddons
     kdeclarative kglobalaccel kguiaddons ki18n kiconthemes kio knotifications
diff --git a/pkgs/development/libraries/kde-frameworks/solid.nix b/pkgs/development/libraries/kde-frameworks/solid.nix
index de10a7345581..330b64035a12 100644
--- a/pkgs/development/libraries/kde-frameworks/solid.nix
+++ b/pkgs/development/libraries/kde-frameworks/solid.nix
@@ -1,12 +1,12 @@
 {
   kdeFramework, lib,
-  bison, ecm, flex,
-  qtdeclarative
+  bison, extra-cmake-modules, flex,
+  qtdeclarative, qttools
 }:
 
 kdeFramework {
   name = "solid";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ bison ecm flex ];
+  nativeBuildInputs = [ bison extra-cmake-modules flex qttools ];
   propagatedBuildInputs = [ qtdeclarative ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/sonnet.nix b/pkgs/development/libraries/kde-frameworks/sonnet.nix
index 8b1cf6a2cd11..190f2bae1b82 100644
--- a/pkgs/development/libraries/kde-frameworks/sonnet.nix
+++ b/pkgs/development/libraries/kde-frameworks/sonnet.nix
@@ -1,11 +1,11 @@
 { kdeFramework, lib
-, ecm
-, hunspell
+, extra-cmake-modules
+, hunspell, qtbase, qttools
 }:
 
 kdeFramework {
   name = "sonnet";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm ];
-  buildInputs = [ hunspell ];
+  nativeBuildInputs = [ extra-cmake-modules qttools ];
+  buildInputs = [ hunspell qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/syntax-highlighting.nix b/pkgs/development/libraries/kde-frameworks/syntax-highlighting.nix
index 24b1bbc4f674..155e9fb8961b 100644
--- a/pkgs/development/libraries/kde-frameworks/syntax-highlighting.nix
+++ b/pkgs/development/libraries/kde-frameworks/syntax-highlighting.nix
@@ -1,9 +1,10 @@
 { kdeFramework, lib
-, ecm, perl
+, extra-cmake-modules, perl, qtbase, qttools
 }:
 
 kdeFramework {
   name = "syntax-highlighting";
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
-  nativeBuildInputs = [ ecm perl ];
+  nativeBuildInputs = [ extra-cmake-modules perl qttools ];
+  buildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kde-frameworks/threadweaver.nix b/pkgs/development/libraries/kde-frameworks/threadweaver.nix
index 6d3dff604132..bf36a21e9ec6 100644
--- a/pkgs/development/libraries/kde-frameworks/threadweaver.nix
+++ b/pkgs/development/libraries/kde-frameworks/threadweaver.nix
@@ -1,9 +1,10 @@
 { kdeFramework, lib
-, ecm
+, extra-cmake-modules, qtbase
 }:
 
 kdeFramework {
   name = "threadweaver";
-  nativeBuildInputs = [ ecm ];
   meta = { maintainers = [ lib.maintainers.ttuegel ]; };
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtbase ];
 }
diff --git a/pkgs/development/libraries/kirigami/default.nix b/pkgs/development/libraries/kirigami/default.nix
index 0fd80d7fa538..66e67e6b8538 100644
--- a/pkgs/development/libraries/kirigami/default.nix
+++ b/pkgs/development/libraries/kirigami/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, ecm, pkgconfig, plasma-framework, qtbase, qtquickcontrols }:
+{ stdenv, fetchurl, cmake, extra-cmake-modules, pkgconfig, plasma-framework, qtbase, qtquickcontrols }:
 
 stdenv.mkDerivation rec {
   pname = "kirigami";
@@ -12,7 +12,7 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ qtbase qtquickcontrols plasma-framework ];
 
-  nativeBuildInputs = [ cmake pkgconfig ecm ];
+  nativeBuildInputs = [ cmake pkgconfig extra-cmake-modules ];
 
   meta = with stdenv.lib; {
     license = licenses.lgpl2;
diff --git a/pkgs/development/libraries/kirigami/v2.nix b/pkgs/development/libraries/kirigami/v2.nix
index 8476eebfd501..0b332d40329d 100644
--- a/pkgs/development/libraries/kirigami/v2.nix
+++ b/pkgs/development/libraries/kirigami/v2.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, ecm, pkgconfig, plasma-framework, qtbase, qtquickcontrols2 }:
+{ stdenv, fetchurl, cmake, extra-cmake-modules, pkgconfig, plasma-framework, qtbase, qtquickcontrols2 }:
 
 stdenv.mkDerivation rec {
   pname = "kirigami";
@@ -12,12 +12,13 @@ stdenv.mkDerivation rec {
 
   buildInputs = [ qtbase qtquickcontrols2 plasma-framework ];
 
-  nativeBuildInputs = [ cmake pkgconfig ecm ];
+  nativeBuildInputs = [ cmake pkgconfig extra-cmake-modules ];
 
   meta = with stdenv.lib; {
     license = licenses.lgpl2;
     homepage = http://www.kde.org;
     maintainers = with maintainers; [ ttuegel peterhoeg ];
     platforms = platforms.unix;
+    broken = builtins.compareVersions qtbase.version "5.7.0" < 0;
   };
 }
diff --git a/pkgs/development/libraries/libktorrent/default.nix b/pkgs/development/libraries/libktorrent/default.nix
index e5406d3a2a58..8b9778b269d1 100644
--- a/pkgs/development/libraries/libktorrent/default.nix
+++ b/pkgs/development/libraries/libktorrent/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, fetchurl, cmake, ecm
+{ stdenv, fetchurl, cmake, extra-cmake-modules
 , karchive, kcrash, ki18n, kio, solid
 , boost, gmp, qca-qt5, libgcrypt
 }:
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
 
   outputs = [ "out" "dev" ];
 
-  nativeBuildInputs = [ cmake ecm ];
+  nativeBuildInputs = [ cmake extra-cmake-modules ];
   buildInputs = [ karchive kcrash ki18n kio solid qca-qt5 libgcrypt ];
 
   propagatedBuildInputs = [ gmp boost ];
diff --git a/pkgs/development/libraries/phonon/default.nix b/pkgs/development/libraries/phonon/default.nix
index 4bbe05fea6ee..defeb8db490f 100644
--- a/pkgs/development/libraries/phonon/default.nix
+++ b/pkgs/development/libraries/phonon/default.nix
@@ -1,5 +1,5 @@
 { stdenv, lib, fetchurl, cmake, mesa, pkgconfig, libpulseaudio
-, qt4 ? null, extra-cmake-modules, qtbase ? null, qttools ? null
+, qt4 ? null, extra-cmake-modules ? null, qtbase ? null, qttools ? null
 , withQt5 ? false
 , debug ? false }:
 
@@ -32,7 +32,9 @@ stdenv.mkDerivation rec {
     [ mesa libpulseaudio ]
     ++ (if withQt5 then [ qtbase qttools ] else [ qt4 ]);
 
-  nativeBuildInputs = [ cmake pkgconfig ] ++ optional withQt5 extra-cmake-modules;
+  nativeBuildInputs =
+    [ cmake pkgconfig ]
+    ++ optional withQt5 extra-cmake-modules;
 
   NIX_CFLAGS_COMPILE = "-fPIC";
 
diff --git a/pkgs/development/libraries/qt-5/5.5/default.nix b/pkgs/development/libraries/qt-5/5.5/default.nix
index 6d27ed5a0d32..b7e8fb33387e 100644
--- a/pkgs/development/libraries/qt-5/5.5/default.nix
+++ b/pkgs/development/libraries/qt-5/5.5/default.nix
@@ -16,27 +16,30 @@
 
 */
 
-{ pkgs
-
-# options
-, developerBuild ? false
-, decryptSslTraffic ? false
+{
+  newScope,
+  stdenv, fetchurl, makeSetupHook, makeWrapper,
+  bison, cups ? null, harfbuzz, mesa, perl,
+  libgnomeui, GConf, gnome_vfs,
+  gstreamer, gst-plugins-base,
+
+  # options
+  developerBuild ? false,
+  decryptSslTraffic ? false,
 }:
 
-let inherit (pkgs) makeSetupHook makeWrapper stdenv; in
-
 with stdenv.lib;
 
 let
 
   mirror = "http://download.qt.io";
-  srcs = import ./srcs.nix { inherit mirror; inherit (pkgs) fetchurl; };
+  srcs = import ./srcs.nix { inherit mirror; inherit fetchurl; };
 
   qtSubmodule = args:
     let
       inherit (args) name;
       inherit (srcs."${args.name}") version src;
-      inherit (pkgs.stdenv) mkDerivation;
+      inherit (stdenv) mkDerivation;
     in mkDerivation (args // {
       name = "${name}-${version}";
       inherit src;
@@ -62,12 +65,9 @@ let
     in {
 
       qtbase = callPackage ./qtbase {
-        mesa = pkgs.mesa_noglu;
-        harfbuzz = pkgs.harfbuzz-icu;
-        cups = if stdenv.isLinux then pkgs.cups else null;
+        inherit bison cups harfbuzz mesa;
         # GNOME dependencies are not used unless gtkStyle == true
-        inherit (pkgs.gnome2) libgnomeui GConf gnome_vfs;
-        bison = pkgs.bison2; # error: too few arguments to function 'int yylex(...
+        inherit libgnomeui GConf gnome_vfs;
         inherit developerBuild decryptSslTraffic;
       };
 
@@ -84,10 +84,11 @@ let
       qtlocation = callPackage ./qtlocation.nix {};
       /* qtmacextras = not packaged */
       qtmultimedia = callPackage ./qtmultimedia.nix {
-        inherit (pkgs.gst_all_1) gstreamer gst-plugins-base;
+        inherit gstreamer gst-plugins-base;
       };
       qtquick1 = callPackage ./qtquick1 {};
       qtquickcontrols = callPackage ./qtquickcontrols.nix {};
+      qtquickcontrols2 = null;
       qtscript = callPackage ./qtscript {};
       qtsensors = callPackage ./qtsensors.nix {};
       qtserialport = callPackage ./qtserialport {};
@@ -124,6 +125,6 @@ let
 
     };
 
-   self = makeScope pkgs.newScope addPackages;
+   self = makeScope newScope addPackages;
 
 in self
diff --git a/pkgs/development/libraries/qt-5/5.6/default.nix b/pkgs/development/libraries/qt-5/5.6/default.nix
index 687708d98efa..37b6eb7f3d3c 100644
--- a/pkgs/development/libraries/qt-5/5.6/default.nix
+++ b/pkgs/development/libraries/qt-5/5.6/default.nix
@@ -1,41 +1,52 @@
 /*
 
-# Updates
+# New packages
+
+READ THIS FIRST
+
+This module is for official packages in Qt 5. All available packages are listed
+in `./srcs.nix`, although a few are not yet packaged in Nixpkgs (see below).
+
+IF YOUR PACKAGE IS NOT LISTED IN `./srcs.nix`, IT DOES NOT GO HERE.
 
-Before a major version update, make a copy of this directory. (We like to
-keep the old version around for a short time after major updates.) Add a
-top-level attribute to `top-level/all-packages.nix`.
+Many of the packages released upstream are not yet built in Nixpkgs due to lack
+of demand. To add a Nixpkgs build for an upstream package, copy one of the
+existing packages here and modify it as necessary.
 
-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.
+# Updates
+
+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.
 
 */
 
-{ pkgs
+{
+  newScope,
+  stdenv, fetchurl, makeSetupHook, makeWrapper,
+  bison, cups ? null, harfbuzz, mesa, perl,
+  gstreamer, gst-plugins-base,
 
-# options
-, developerBuild ? false
-, decryptSslTraffic ? false
+  # options
+  developerBuild ? false,
+  decryptSslTraffic ? false,
 }:
 
-let inherit (pkgs) makeSetupHook makeWrapper stdenv; in
-
 with stdenv.lib;
 
 let
 
   mirror = "http://download.qt.io";
-  srcs = import ./srcs.nix { inherit (pkgs) fetchurl; inherit mirror; };
+  srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; };
 
   qtSubmodule = args:
     let
       inherit (args) name;
       version = args.version or srcs."${name}".version;
       src = args.src or srcs."${name}".src;
-      inherit (pkgs.stdenv) mkDerivation;
+      inherit (stdenv) mkDerivation;
     in mkDerivation (args // {
       name = "${name}-${version}";
       inherit src;
@@ -43,7 +54,7 @@ let
       propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or []);
       nativeBuildInputs =
         (args.nativeBuildInputs or [])
-        ++ [ pkgs.perl self.qmakeHook ];
+        ++ [ perl self.qmakeHook ];
 
       NIX_QT_SUBMODULE = args.NIX_QT_SUBMODULE or true;
 
@@ -63,10 +74,7 @@ let
     in {
 
       qtbase = callPackage ./qtbase {
-        mesa = pkgs.mesa_noglu;
-        harfbuzz = pkgs.harfbuzz-icu;
-        cups = if stdenv.isLinux then pkgs.cups else null;
-        bison = pkgs.bison2; # error: too few arguments to function 'int yylex(...
+        inherit bison cups harfbuzz mesa;
         inherit developerBuild decryptSslTraffic;
       };
 
@@ -83,9 +91,11 @@ let
       qtlocation = callPackage ./qtlocation.nix {};
       /* qtmacextras = not packaged */
       qtmultimedia = callPackage ./qtmultimedia.nix {
-        inherit (pkgs.gst_all_1) gstreamer gst-plugins-base;
+        inherit gstreamer gst-plugins-base;
       };
+      qtquick1 = null;
       qtquickcontrols = callPackage ./qtquickcontrols.nix {};
+      qtquickcontrols2 = callPackage ./qtquickcontrols2.nix {};
       qtscript = callPackage ./qtscript {};
       qtsensors = callPackage ./qtsensors.nix {};
       qtserialport = callPackage ./qtserialport {};
@@ -120,6 +130,6 @@ let
         (if stdenv.isDarwin then ../qmake-hook-darwin.sh else ../qmake-hook.sh);
     };
 
-   self = makeScope pkgs.newScope addPackages;
+   self = makeScope newScope addPackages;
 
 in self
diff --git a/pkgs/development/libraries/qt-5/5.6/qtquickcontrols2.nix b/pkgs/development/libraries/qt-5/5.6/qtquickcontrols2.nix
new file mode 100644
index 000000000000..19750f2fd99d
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.6/qtquickcontrols2.nix
@@ -0,0 +1,6 @@
+{ qtSubmodule, qtdeclarative }:
+
+qtSubmodule {
+  name = "qtquickcontrols2";
+  qtInputs = [ qtdeclarative ];
+}
diff --git a/pkgs/development/libraries/qt-5/5.7/default.nix b/pkgs/development/libraries/qt-5/5.7/default.nix
index d62bd3d1b51d..85b38c6fc6ce 100644
--- a/pkgs/development/libraries/qt-5/5.7/default.nix
+++ b/pkgs/development/libraries/qt-5/5.7/default.nix
@@ -14,28 +14,30 @@ top-level attribute to `top-level/all-packages.nix`.
 
 */
 
-{ pkgs
-
-# options
-, developerBuild ? false
-, decryptSslTraffic ? false
+{
+  newScope,
+  stdenv, fetchurl, makeSetupHook, makeWrapper,
+  bison, cups ? null, harfbuzz, mesa, perl,
+  gstreamer, gst-plugins-base,
+
+  # options
+  developerBuild ? false,
+  decryptSslTraffic ? false,
 }:
 
-let inherit (pkgs) makeSetupHook makeWrapper stdenv; in
-
 with stdenv.lib;
 
 let
 
   mirror = "http://download.qt.io";
-  srcs = import ./srcs.nix { inherit (pkgs) fetchurl; inherit mirror; };
+  srcs = import ./srcs.nix { inherit fetchurl; inherit mirror; };
 
   qtSubmodule = args:
     let
       inherit (args) name;
       version = args.version or srcs."${name}".version;
       src = args.src or srcs."${name}".src;
-      inherit (pkgs.stdenv) mkDerivation;
+      inherit (stdenv) mkDerivation;
     in mkDerivation (args // {
       name = "${name}-${version}";
       inherit src;
@@ -43,7 +45,7 @@ let
       propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or []);
       nativeBuildInputs =
         (args.nativeBuildInputs or [])
-        ++ [ pkgs.perl self.qmakeHook ];
+        ++ [ perl self.qmakeHook ];
 
       NIX_QT_SUBMODULE = args.NIX_QT_SUBMODULE or true;
 
@@ -64,11 +66,7 @@ let
 
       qtbase = callPackage ./qtbase {
         inherit (srcs.qtbase) src version;
-        mesa = pkgs.mesa_noglu;
-        harfbuzz = pkgs.harfbuzz-icu;
-        cups = if stdenv.isLinux then pkgs.cups else null;
-        # GNOME dependencies are not used unless gtkStyle == true
-        bison = pkgs.bison2; # error: too few arguments to function 'int yylex(...
+        inherit bison cups harfbuzz mesa;
         inherit developerBuild decryptSslTraffic;
       };
 
@@ -79,8 +77,9 @@ let
       qtimageformats = callPackage ./qtimageformats.nix {};
       qtlocation = callPackage ./qtlocation.nix {};
       qtmultimedia = callPackage ./qtmultimedia.nix {
-        inherit (pkgs.gst_all_1) gstreamer gst-plugins-base;
+        inherit gstreamer gst-plugins-base;
       };
+      qtquick1 = null;
       qtquickcontrols = callPackage ./qtquickcontrols.nix {};
       qtquickcontrols2 = callPackage ./qtquickcontrols2.nix {};
       qtscript = callPackage ./qtscript {};
@@ -117,6 +116,6 @@ let
 
     };
 
-   self = makeScope pkgs.newScope addPackages;
+   self = makeScope newScope addPackages;
 
 in self
diff --git a/pkgs/development/libraries/quazip/default.nix b/pkgs/development/libraries/quazip/default.nix
index a1eb2ad7084c..7fbbf27c8eba 100644
--- a/pkgs/development/libraries/quazip/default.nix
+++ b/pkgs/development/libraries/quazip/default.nix
@@ -1,4 +1,4 @@
-{ fetchurl, stdenv, zip, zlib, qt, qmakeHook }:
+{ fetchurl, stdenv, zip, zlib, qtbase, qmakeHook }:
 
 stdenv.mkDerivation rec {
   name = "quazip-0.7.1";
@@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
 
   preConfigure = "cd quazip";
 
-  buildInputs = [ zlib qt ];
+  buildInputs = [ zlib qtbase ];
   nativeBuildInputs = [ qmakeHook ];
 
   meta = {
diff --git a/pkgs/development/tools/profiling/heaptrack/default.nix b/pkgs/development/tools/profiling/heaptrack/default.nix
index 378073d16c00..69aa84951a4e 100644
--- a/pkgs/development/tools/profiling/heaptrack/default.nix
+++ b/pkgs/development/tools/profiling/heaptrack/default.nix
@@ -1,5 +1,8 @@
-{ stdenv, fetchFromGitHub, cmake, zlib, boost162, libunwind,
-  elfutils, qt5, kde5, sparsehash }:
+{
+  stdenv, fetchFromGitHub, cmake, extra-cmake-modules,
+  zlib, boost162, libunwind, elfutils, sparsehash,
+  qtbase, kio, kitemmodels, threadweaver, kconfigwidgets, kcoreaddons,
+}:
 
 stdenv.mkDerivation rec {
   name = "heaptrack-${version}";
@@ -12,9 +15,11 @@ stdenv.mkDerivation rec {
     sha256 = "0dqchd2r4khv9gzj4n0qjii2nqygkj5jclkji8jbvivx5qwsqznc";
   };
 
-  buildInputs = [ cmake zlib boost162 libunwind elfutils sparsehash
-                  qt5.ecm qt5.qtbase kde5.kio kde5.kitemmodels
-                  kde5.threadweaver kde5.kconfigwidgets kde5.kcoreaddons ];
+  nativeBuildInputs = [ cmake extra-cmake-modules ];
+  buildInputs = [
+    zlib boost162 libunwind elfutils sparsehash
+    qtbase kio kitemmodels threadweaver kconfigwidgets kcoreaddons
+  ];
 
   meta = with stdenv.lib; {
     description = "Heap memory profiler for Linux";
diff --git a/pkgs/development/tools/tora/default.nix b/pkgs/development/tools/tora/default.nix
index 9f8f2df358a5..350cda4e2630 100644
--- a/pkgs/development/tools/tora/default.nix
+++ b/pkgs/development/tools/tora/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchFromGitHub, cmake, ecm, makeQtWrapper
+{ stdenv, lib, fetchFromGitHub, cmake, extra-cmake-modules, makeQtWrapper
 , boost, doxygen, openssl, mysql, postgresql, graphviz, loki, qscintilla, qtbase }:
 
 let
@@ -18,7 +18,7 @@ in stdenv.mkDerivation rec {
   enableParallelBuilding = true;
 
   buildInputs = [
-    cmake ecm makeQtWrapper
+    cmake extra-cmake-modules makeQtWrapper
     boost doxygen graphviz loki mysql openssl postgresql qscintillaLib qtbase
   ];
 
diff --git a/pkgs/tools/misc/kdecoration-viewer/default.nix b/pkgs/tools/misc/kdecoration-viewer/default.nix
index c32a814f2328..33ccf28cb0da 100644
--- a/pkgs/tools/misc/kdecoration-viewer/default.nix
+++ b/pkgs/tools/misc/kdecoration-viewer/default.nix
@@ -1,5 +1,5 @@
 { stdenv, fetchFromGitHub
-, cmake, ecm, qtquickcontrols, kconfigwidgets, kdeclarative, kdecoration }:
+, cmake, extra-cmake-modules, qtquickcontrols, kconfigwidgets, kdeclarative, kdecoration }:
 
 stdenv.mkDerivation rec {
   name = "kdecoration-viewer-2015-08-20";
@@ -11,7 +11,7 @@ stdenv.mkDerivation rec {
     sha256 = "1cc4xxv72a82p1w9r76090xba7g069r41bi4zx32k4gz3vyl1am6";
   };
 
-  buildInputs = [ cmake ecm qtquickcontrols kconfigwidgets kdeclarative kdecoration ];
+  buildInputs = [ cmake extra-cmake-modules qtquickcontrols kconfigwidgets kdeclarative kdecoration ];
 
   meta = with stdenv.lib; {
     description = "Allows to preview a KDecoration plugin";
diff --git a/pkgs/tools/misc/kronometer/default.nix b/pkgs/tools/misc/kronometer/default.nix
index 598d01266233..5ba2543e273d 100644
--- a/pkgs/tools/misc/kronometer/default.nix
+++ b/pkgs/tools/misc/kronometer/default.nix
@@ -1,6 +1,6 @@
 {
   kdeDerivation, kdeWrapper, fetchurl, lib,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   kconfig, kinit
 }:
 
@@ -19,7 +19,7 @@ let
       license = licenses.gpl2;
       maintainers = with maintainers; [ peterhoeg ];
     };
-    nativeBuildInputs = [ ecm kdoctools ];
+    nativeBuildInputs = [ extra-cmake-modules kdoctools ];
     propagatedBuildInputs = [ kconfig kinit ];
   };
 in
diff --git a/pkgs/tools/misc/peruse/default.nix b/pkgs/tools/misc/peruse/default.nix
index 61e9fae906b5..1c7a28e29756 100644
--- a/pkgs/tools/misc/peruse/default.nix
+++ b/pkgs/tools/misc/peruse/default.nix
@@ -1,6 +1,6 @@
 {
   kdeDerivation, kdeWrapper, fetchFromGitHub, fetchurl, lib,
-  ecm, kdoctools,
+  extra-cmake-modules, kdoctools,
   baloo, kconfig, kfilemetadata, kinit, kirigami, knewstuff, plasma-framework
 }:
 
@@ -21,7 +21,7 @@ let
       sha256 = "1ik2627xynkichsq9x28rkczqn3l3p06q6vw5jdafdh3hisccmjq";
     };
 
-    nativeBuildInputs = [ ecm kdoctools ];
+    nativeBuildInputs = [ extra-cmake-modules kdoctools ];
 
     propagatedBuildInputs = [ baloo kconfig kfilemetadata kinit kirigami knewstuff plasma-framework ];
 
diff --git a/pkgs/tools/text/kdiff3/default.nix b/pkgs/tools/text/kdiff3/default.nix
index f1ae958ed637..b53d619d837c 100644
--- a/pkgs/tools/text/kdiff3/default.nix
+++ b/pkgs/tools/text/kdiff3/default.nix
@@ -1,6 +1,6 @@
 {
   kdeDerivation, kdeWrapper, lib, fetchgit,
-  ecm, kdoctools, kconfig, kinit, kparts
+  extra-cmake-modules, kdoctools, kconfig, kinit, kparts
 }:
 
 let
@@ -18,7 +18,7 @@ let
 
     preConfigure = "cd kdiff3";
 
-    nativeBuildInputs = [ ecm kdoctools ];
+    nativeBuildInputs = [ extra-cmake-modules kdoctools ];
 
     propagatedBuildInputs = [ kconfig kinit kparts ];
 
diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix
index eaf6813263af..318415b7512f 100644
--- a/pkgs/top-level/aliases.nix
+++ b/pkgs/top-level/aliases.nix
@@ -17,7 +17,7 @@ in
   ### Deprecated aliases - for backward compatibility
 
 doNotDisplayTwice rec {
-  accounts-qt = qt5.accounts-qt;  # added 2015-12-19
+  accounts-qt = libsForQt5.accounts-qt;  # added 2015-12-19
   adobeReader = adobe-reader;
   aircrackng = aircrack-ng; # added 2016-01-14
   arduino_core = arduino-core;  # added 2015-02-04
@@ -51,7 +51,7 @@ doNotDisplayTwice rec {
   gettextWithExpat = gettext; # 2016-02-19
   git-hub = gitAndTools.git-hub; # added 2016-04-29
   googleAuthenticator = google-authenticator; # added 2016-10-16
-  grantlee5 = qt5.grantlee;  # added 2015-12-19
+  grantlee5 = libsForQt5.grantlee;  # added 2015-12-19
   gst_ffmpeg = gst-ffmpeg;  # added 2017-02
   gst_plugins_base = gst-plugins-base;  # added 2017-02
   gst_plugins_good = gst-plugins-good;  # added 2017-02
@@ -71,7 +71,7 @@ doNotDisplayTwice rec {
   keybase-go = keybase;  # added 2016-08-24
   krename-qt5 = krename; # added 2017-02-18
   letsencrypt = certbot; # added 2016-05-16
-  libdbusmenu_qt5 = qt5.libdbusmenu;  # added 2015-12-19
+  libdbusmenu_qt5 = libsForQt5.libdbusmenu;  # added 2015-12-19
   libcap_manpages = libcap.doc; # added 2016-04-29
   libcap_pam = if stdenv.isLinux then libcap.pam else null; # added 2016-04-29
   libcap_progs = libcap.out; # added 2016-04-29
@@ -83,7 +83,7 @@ doNotDisplayTwice rec {
   manpages = man-pages; # added 2015-12-06
   man_db = man-db; # added 2016-05
   midoriWrapper = midori; # added 2015-01
-  mlt-qt5 = qt5.mlt;  # added 2015-12-19
+  mlt-qt5 = libsForQt5.mlt;  # added 2015-12-19
   module_init_tools = kmod; # added 2016-04-22
   mssys = ms-sys; # added 2015-12-13
   multipath_tools = multipath-tools;  # added 2016-01-21
@@ -96,13 +96,13 @@ doNotDisplayTwice rec {
   owncloudclient = owncloud-client;  # added 2016-08
   pidgin-with-plugins = pidgin; # added 2016-06
   pidginlatexSF = pidginlatex; # added 2014-11-02
-  poppler_qt5 = qt5.poppler;  # added 2015-12-19
-  qca-qt5 = qt5.qca-qt5;  # added 2015-12-19
+  poppler_qt5 = libsForQt5.poppler;  # added 2015-12-19
+  qca-qt5 = libsForQt5.qca-qt5;  # added 2015-12-19
   QmidiNet = qmidinet;  # added 2016-05-22
   qt_gstreamer = qt-gstreamer;  # added 2017-02
   qt_gstreamer1 = qt-gstreamer1;  # added 2017-02
   quake3game = ioquake3; # added 2016-01-14
-  qwt6 = qt5.qwt;  # added 2015-12-19
+  qwt6 = libsForQt5.qwt;  # added 2015-12-19
   rdiff_backup = rdiff-backup;  # added 2014-11-23
   rssglx = rss-glx; #added 2015-03-25
   rubygems = throw "deprecated 2016-03-02: rubygems is now bundled with ruby";
@@ -119,7 +119,7 @@ doNotDisplayTwice rec {
   sqliteInteractive = sqlite-interactive;  # added 2014-12-06
   sshfsFuse = sshfs-fuse; # added 2016-09
   system_config_printer = system-config-printer;  # added 2016-01-03
-  telepathy_qt5 = qt5.telepathy;  # added 2015-12-19
+  telepathy_qt5 = libsForQt5.telepathy;  # added 2015-12-19
   tftp_hpa = tftp-hpa; # added 2015-04-03
   ucsFonts = ucs-fonts; # added 2016-07-15
   usb_modeswitch = usb-modeswitch; # added 2016-05-10
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 73d418355ff4..b477a9df8320 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -269,6 +269,12 @@ with pkgs;
       inherit kernel rootModules allowMissing;
     };
 
+  kdeDerivation = import ../build-support/kde/derivation.nix { inherit stdenv lib; };
+
+  kdeWrapper = import ../build-support/kde/wrapper.nix {
+    inherit stdenv lib makeWrapper buildEnv;
+  };
+
   nixBufferBuilders = import ../build-support/emacs/buffer.nix { inherit (pkgs) lib writeText; inherit (emacsPackagesNg) inherit-local; };
 
   pathsFromGraph = ../build-support/kernel/paths-from-graph.pl;
@@ -381,7 +387,7 @@ with pkgs;
 
   aj-snapshot  = callPackage ../applications/audio/aj-snapshot { };
 
-  albert = qt5.callPackage ../applications/misc/albert {};
+  albert = libsForQt5.callPackage ../applications/misc/albert {};
 
   amazon-glacier-cmd-interface = callPackage ../tools/backup/amazon-glacier-cmd-interface { };
 
@@ -420,7 +426,7 @@ with pkgs;
     withGui = false;
   };
 
-  apitrace = qt55.callPackage ../applications/graphics/apitrace {};
+  apitrace = libsForQt55.callPackage ../applications/graphics/apitrace {};
 
   argus = callPackage ../tools/networking/argus {};
 
@@ -746,7 +752,7 @@ with pkgs;
 
   clib = callPackage ../tools/package-management/clib { };
 
-  colord-kde = qt5.callPackage ../tools/misc/colord-kde {};
+  colord-kde = libsForQt5.callPackage ../tools/misc/colord-kde {};
 
   consul = callPackage ../servers/consul { };
 
@@ -1094,7 +1100,7 @@ with pkgs;
 
   davix = callPackage ../tools/networking/davix { };
 
-  cantata = qt5.callPackage ../applications/audio/cantata {
+  cantata = libsForQt5.callPackage ../applications/audio/cantata {
     ffmpeg = ffmpeg_2;
   };
 
@@ -1160,7 +1166,7 @@ with pkgs;
 
   citrix_receiver = callPackage ../applications/networking/remote/citrix-receiver { };
 
-  cmst = qt5.callPackage ../tools/networking/cmst { };
+  cmst = libsForQt5.callPackage ../tools/networking/cmst { };
 
   colord = callPackage ../tools/misc/colord { };
 
@@ -1291,7 +1297,7 @@ with pkgs;
 
   cloud-utils = callPackage ../tools/misc/cloud-utils { };
 
-  ckb = qt5.callPackage ../tools/misc/ckb { };
+  ckb = libsForQt5.callPackage ../tools/misc/ckb { };
 
   compass = callPackage ../development/tools/compass { };
 
@@ -1299,7 +1305,7 @@ with pkgs;
 
   convoy = callPackage ../tools/filesystems/convoy { };
 
-  cool-retro-term = qt55.callPackage ../applications/misc/cool-retro-term { };
+  cool-retro-term = libsForQt55.callPackage ../applications/misc/cool-retro-term { };
 
   coreutils = callPackage ../tools/misc/coreutils {
     aclSupport = stdenv.isLinux;
@@ -2202,7 +2208,7 @@ with pkgs;
 
   hecate = callPackage ../applications/editors/hecate { };
 
-  heaptrack = callPackage ../development/tools/profiling/heaptrack {};
+  heaptrack = libsForQt5.callPackage ../development/tools/profiling/heaptrack {};
 
   heimdall = callPackage ../tools/misc/heimdall { };
 
@@ -2252,11 +2258,11 @@ with pkgs;
 
   i2pd = callPackage ../tools/networking/i2pd {};
 
-  i-score = qt5.callPackage ../applications/audio/i-score { };
+  i-score = libsForQt5.callPackage ../applications/audio/i-score { };
 
   iasl = callPackage ../development/compilers/iasl { };
 
-  iannix = qt5.callPackage ../applications/audio/iannix { };
+  iannix = libsForQt5.callPackage ../applications/audio/iannix { };
 
   icecast = callPackage ../servers/icecast { };
 
@@ -2455,15 +2461,15 @@ with pkgs;
 
   kpcli = callPackage ../tools/security/kpcli { };
 
-  krename = qt5.callPackage ../applications/misc/krename { };
+  krename = libsForQt5.callPackage ../applications/misc/krename { };
 
-  kronometer = qt5.callPackage ../tools/misc/kronometer { };
+  kronometer = libsForQt5.callPackage ../tools/misc/kronometer { };
 
-  kdiff3 = qt5.callPackage ../tools/text/kdiff3 { };
+  kdiff3 = libsForQt5.callPackage ../tools/text/kdiff3 { };
 
-  peruse = qt5.callPackage ../tools/misc/peruse { };
+  peruse = libsForQt5.callPackage ../tools/misc/peruse { };
 
-  kst = qt5.callPackage ../tools/graphics/kst { gsl = gsl_1; };
+  kst = libsForQt5.callPackage ../tools/graphics/kst { gsl = gsl_1; };
 
   kytea = callPackage ../tools/text/kytea { };
 
@@ -2862,7 +2868,7 @@ with pkgs;
 
   mfoc = callPackage ../tools/security/mfoc { };
 
-  mgba = qt5.callPackage ../misc/emulators/mgba { };
+  mgba = libsForQt5.callPackage ../misc/emulators/mgba { };
 
   mimeo = callPackage ../tools/misc/mimeo { };
 
@@ -3409,7 +3415,7 @@ with pkgs;
     inherit qt4;
   };
 
-  pinentry_qt5 = qt5.callPackage ../tools/security/pinentry/qt5.nix {
+  pinentry_qt5 = libsForQt5.callPackage ../tools/security/pinentry/qt5.nix {
     libcap = if stdenv.isDarwin then null else libcap;
   };
 
@@ -3558,10 +3564,10 @@ with pkgs;
 
   qalculate-gtk = callPackage ../applications/science/math/qalculate-gtk { };
 
-  qastools = qt5.callPackage ../tools/audio/qastools { };
+  qastools = libsForQt5.callPackage ../tools/audio/qastools { };
 
-  qesteidutil = qt5.callPackage ../tools/security/qesteidutil { } ;
-  qdigidoc = qt5.callPackage ../tools/security/qdigidoc { } ;
+  qesteidutil = libsForQt5.callPackage ../tools/security/qesteidutil { } ;
+  qdigidoc = libsForQt5.callPackage ../tools/security/qdigidoc { } ;
   esteidfirefoxplugin = callPackage ../applications/networking/browsers/mozilla-plugins/esteidfirefoxplugin { };
 
 
@@ -3778,7 +3784,9 @@ with pkgs;
     quazip = quazip_qt4;
   };
 
-  quazip_qt4 = self.qt5.quazip.override { qt = qt4; qmakeHook = qmake4Hook; };
+  quazip_qt4 = libsForQt5.quazip.override {
+    qtbase = qt4; qmakeHook = qmake4Hook;
+  };
 
   scrot = callPackage ../tools/graphics/scrot { };
 
@@ -3820,7 +3828,7 @@ with pkgs;
 
   siege = callPackage ../tools/networking/siege {};
 
-  sigil = qt55.callPackage ../applications/editors/sigil { };
+  sigil = libsForQt55.callPackage ../applications/editors/sigil { };
 
   # aka., gpg-tools
   signing-party = callPackage ../tools/security/signing-party { };
@@ -3928,7 +3936,7 @@ with pkgs;
 
   su-exec = callPackage ../tools/security/su-exec {};
 
-  subsurface = qt5.callPackage ../applications/misc/subsurface { };
+  subsurface = libsForQt5.callPackage ../applications/misc/subsurface { };
 
   sudo = callPackage ../tools/security/sudo { };
 
@@ -4060,7 +4068,7 @@ with pkgs;
 
   thin-provisioning-tools = callPackage ../tools/misc/thin-provisioning-tools {  };
 
-  tiled = qt5.callPackage ../applications/editors/tiled { };
+  tiled = libsForQt5.callPackage ../applications/editors/tiled { };
 
   timemachine = callPackage ../applications/audio/timemachine { };
 
@@ -6284,7 +6292,7 @@ with pkgs;
   cmakeWithGui = cmakeCurses.override { useQt4 = true; };
 
   # Does not actually depend on Qt 5
-  extra-cmake-modules = qt5.ecmNoHooks;
+  inherit (kdeFrameworks) extra-cmake-modules kapidox kdoctools;
 
   coccinelle = callPackage ../development/tools/misc/coccinelle {
     ocamlPackages = ocamlPackages_4_01_0;
@@ -6663,7 +6671,7 @@ with pkgs;
 
   premake = premake4;
 
-  qtcreator = qt5.callPackage ../development/qtcreator { };
+  qtcreator = libsForQt5.callPackage ../development/qtcreator { };
 
   r10k = callPackage ../tools/system/r10k { };
 
@@ -7844,7 +7852,17 @@ with pkgs;
 
   judy = callPackage ../development/libraries/judy { };
 
-  kdelibs4 = kde5.applications.kdelibs;
+  kdeFrameworks =
+    let
+      mkFrameworks = import ../development/libraries/kde-frameworks;
+      attrs = {
+        inherit libsForQt5;
+        inherit kdeDerivation lib fetchurl;
+      };
+    in
+      recurseIntoAttrs (makeOverridable mkFrameworks attrs);
+
+  kdelibs4 = kdeApplications.kdelibs;
 
   keybinder = callPackage ../development/libraries/keybinder {
     automake = automake111x;
@@ -9288,33 +9306,79 @@ with pkgs;
     developerBuild = true;
   });
 
-  qt55 =
-    let imported = import ../development/libraries/qt-5/5.5 { inherit pkgs; };
-        # Libraries that cannot be built with newer versions of Qt 5
-        qt55Only = self: with self; {
-          # Requires Qt Quick (deprecated in Qt 5.5, removed from Qt 5.6)
-          qmltermwidget = callPackage ../development/libraries/qmltermwidget { };
-        };
-    in recurseIntoAttrs (imported.override (super: self: qt5LibsFun self // qt55Only self));
+  qt55 = recurseIntoAttrs (import ../development/libraries/qt-5/5.5 {
+    inherit newScope;
+    inherit stdenv fetchurl makeSetupHook makeWrapper;
+    bison = bison2; # error: too few arguments to function 'int yylex(...
+    cups = if stdenv.isLinux then cups else null;
+    harfbuzz = harfbuzz-icu;
+    mesa = mesa_noglu;
+    inherit perl;
+    inherit (gnome2) libgnomeui GConf gnome_vfs;
+    inherit (gst_all_1) gstreamer gst-plugins-base;
+  });
+
+  libsForQt55 = recurseIntoAttrs (lib.makeScope qt55.newScope mkLibsForQt5);
 
-  qt56 =
-    let imported = import ../development/libraries/qt-5/5.6 { inherit pkgs; };
-    in recurseIntoAttrs (imported.override (super: qt5LibsFun));
+  qt56 = recurseIntoAttrs (import ../development/libraries/qt-5/5.6 {
+    inherit newScope;
+    inherit stdenv fetchurl makeSetupHook makeWrapper;
+    bison = bison2; # error: too few arguments to function 'int yylex(...
+    cups = if stdenv.isLinux then cups else null;
+    harfbuzz = harfbuzz-icu;
+    mesa = mesa_noglu;
+    inherit perl;
+    inherit (gst_all_1) gstreamer gst-plugins-base;
+  });
 
-  qt57 =
-    let imported = import ../development/libraries/qt-5/5.7 { inherit pkgs; };
-    in recurseIntoAttrs (imported.override (super: qt5LibsFun));
+  libsForQt56 = recurseIntoAttrs (lib.makeScope qt56.newScope mkLibsForQt5);
 
-  qt5 = qt56;
+  qt57 = recurseIntoAttrs (import ../development/libraries/qt-5/5.7 {
+    inherit newScope;
+    inherit stdenv fetchurl makeSetupHook makeWrapper;
+    bison = bison2; # error: too few arguments to function 'int yylex(...
+    cups = if stdenv.isLinux then cups else null;
+    harfbuzz = harfbuzz-icu;
+    mesa = mesa_noglu;
+    inherit perl;
+    inherit (gst_all_1) gstreamer gst-plugins-base;
+  });
 
-  qt5ct = qt5.callPackage ../tools/misc/qt5ct { };
+  libsForQt57 = recurseIntoAttrs (lib.makeScope qt57.newScope mkLibsForQt5);
 
-  qt5LibsFun = self: with self;
-    let kdeFrameworks =
-          import ../development/libraries/kde-frameworks { inherit pkgs; } self;
-    in {
+  qt5 = qt57;
+  libsForQt5 = libsForQt57;
+
+  qt5ct = libsForQt5.callPackage ../tools/misc/qt5ct { };
+
+  mkLibsForQt5 = self: with self; {
+
+    ### KDE FRAMEWORKS
+
+    inherit (kdeFrameworks.override { libsForQt5 = self; })
+      attica baloo bluez-qt kactivities kactivities-stats
+      karchive kauth kbookmarks kcmutils kcodecs kcompletion kconfig
+      kconfigwidgets kcoreaddons kcrash kdbusaddons kdeclarative kdelibs4support
+      kdesignerplugin kdnssd kemoticons kfilemetadata kglobalaccel kguiaddons
+      khtml ki18n kiconthemes kidletime kimageformats kio kitemmodels kitemviews
+      kjobwidgets kjs kjsembed kmediaplayer knewstuff knotifications
+      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
+      threadweaver;
 
-    inherit kdeFrameworks;
+    ### KDE PLASMA 5
+
+    inherit (plasma5.override { libsForQt5 = self; })
+      kdecoration khotkeys libkscreen libksysguard;
+
+    ### KDE APPLICATIONS
+
+    inherit (kdeApplications.override { libsForQt5 = self; })
+      libkdcraw libkexiv2 libkipi libkomparediff2;
+
+    ### LIBRARIES
 
     accounts-qt = callPackage ../development/libraries/accounts-qt { };
 
@@ -9324,10 +9388,7 @@ with pkgs;
 
     kirigami_1 = callPackage ../development/libraries/kirigami { };
 
-    kirigami_2 = callPackage ../development/libraries/kirigami/v2.nix {
-      # kirigami v2 requires qt 5.7 and above
-      inherit (qt57) qtbase qtquickcontrols2;
-    };
+    kirigami_2 = callPackage ../development/libraries/kirigami/v2.nix { };
 
     kirigami = kirigami_1;
 
@@ -9367,6 +9428,8 @@ with pkgs;
 
     qca-qt5 = callPackage ../development/libraries/qca-qt5 { };
 
+    qmltermwidget = callPackage ../development/libraries/qmltermwidget { };
+
     qscintilla = callPackage ../development/libraries/qscintilla {
       withQt5 = true;
     };
@@ -9377,9 +9440,7 @@ with pkgs;
 
     qtstyleplugins = callPackage ../development/libraries/qtstyleplugins { };
 
-    quazip = callPackage ../development/libraries/quazip {
-      qt = qtbase;
-    };
+    quazip = callPackage ../development/libraries/quazip { };
 
     qwt = callPackage ../development/libraries/qwt/6.nix { };
 
@@ -9393,7 +9454,7 @@ with pkgs;
 
     qtwebkit-plugins = callPackage ../development/libraries/qtwebkit-plugins { };
 
-  } // kdeFrameworks;
+  };
 
   qtEnv = qt5.env;
   qt5Full = qt5.full;
@@ -12107,6 +12168,8 @@ with pkgs;
 
   bgnet = callPackage ../data/documentation/bgnet { };
 
+  inherit (kdeFrameworks) breeze-icons;
+
   cacert = callPackage ../data/misc/cacert { };
 
   caladea = callPackage ../data/fonts/caladea {};
@@ -12343,6 +12406,8 @@ with pkgs;
 
   oxygenfonts = callPackage ../data/fonts/oxygenfonts { };
 
+  inherit (kdeFrameworks) oxygen-icons5;
+
   paper-icon-theme = callPackage ../data/icons/paper-icon-theme { };
 
   pecita = callPackage ../data/fonts/pecita {};
@@ -12474,7 +12539,7 @@ with pkgs;
 
   xlsx2csv = pythonPackages.xlsx2csv;
 
-  zeal = qt5.callPackage ../data/documentation/zeal { };
+  zeal = libsForQt5.callPackage ../data/documentation/zeal { };
 
 
   ### APPLICATIONS
@@ -12568,13 +12633,13 @@ with pkgs;
 
   antfs-cli = callPackage ../applications/misc/antfs-cli {};
 
-  antimony = qt5.callPackage ../applications/graphics/antimony {};
+  antimony = libsForQt5.callPackage ../applications/graphics/antimony {};
 
   antiword = callPackage ../applications/office/antiword {};
 
   ao = callPackage ../applications/graphics/ao {};
 
-  aqemu = qt5.callPackage ../applications/virtualization/aqemu { };
+  aqemu = libsForQt5.callPackage ../applications/virtualization/aqemu { };
 
   ardour = callPackage ../applications/audio/ardour {
     inherit (gnome2) libgnomecanvas libgnomecanvasmm;
@@ -12600,7 +12665,7 @@ with pkgs;
   astroid = callPackage ../applications/networking/mailreaders/astroid { };
 
   audacious = callPackage ../applications/audio/audacious { };
-  audaciousQt5 = qt5.callPackage ../applications/audio/audacious/qt-5.nix { };
+  audaciousQt5 = libsForQt5.callPackage ../applications/audio/audacious/qt-5.nix { };
 
   audacity = callPackage ../applications/audio/audacity { };
 
@@ -12662,7 +12727,7 @@ with pkgs;
   };
   awesome = awesome-4-0;
 
-  awesomebump = qt5.callPackage ../applications/graphics/awesomebump { };
+  awesomebump = libsForQt5.callPackage ../applications/graphics/awesomebump { };
 
   inherit (gnome3) baobab;
 
@@ -12733,7 +12798,7 @@ with pkgs;
 
   bluejeans = callPackage ../applications/networking/browsers/mozilla-plugins/bluejeans { };
 
-  bomi = qt5.callPackage ../applications/video/bomi {
+  bomi = libsForQt5.callPackage ../applications/video/bomi {
     youtube-dl = pythonPackages.youtube-dl;
     pulseSupport = config.pulseaudio or true;
     ffmpeg = ffmpeg_2;
@@ -12761,11 +12826,10 @@ with pkgs;
 
   calcurse = callPackage ../applications/misc/calcurse { };
 
-  calibre = qt5.callPackage ../applications/misc/calibre { };
+  calibre = libsForQt5.callPackage ../applications/misc/calibre { };
 
   calligra = kde4.callPackage ../applications/office/calligra {
     vc = vc_0_7;
-    oxygen_icons = kde5.oxygen-icons5;
   };
 
   camlistore = callPackage ../applications/misc/camlistore { };
@@ -12782,7 +12846,7 @@ with pkgs;
 
   cava = callPackage ../applications/audio/cava { };
 
-  cb2bib = qt5.callPackage ../applications/office/cb2bib { };
+  cb2bib = libsForQt5.callPackage ../applications/office/cb2bib { };
 
   cbatticon = callPackage ../applications/misc/cbatticon { };
 
@@ -12857,7 +12921,7 @@ with pkgs;
 
   cni = callPackage ../applications/networking/cluster/cni {};
 
-  communi = qt5.callPackage ../applications/networking/irc/communi { };
+  communi = libsForQt5.callPackage ../applications/networking/irc/communi { };
 
   compiz = callPackage ../applications/window-managers/compiz {
     inherit (gnome2) GConf ORBit2 metacity;
@@ -12904,7 +12968,7 @@ with pkgs;
   cutecom = callPackage ../tools/misc/cutecom { };
 
   cutegram =
-    let callpkg = qt55.callPackage;
+    let callpkg = libsForQt55.callPackage;
     in callpkg ../applications/networking/instant-messengers/telegram/cutegram rec {
       libqtelegram-aseman-edition = callpkg ../applications/networking/instant-messengers/telegram/libqtelegram-aseman-edition { };
       telegram-qml = callpkg ../applications/networking/instant-messengers/telegram/telegram-qml {
@@ -12954,9 +13018,9 @@ with pkgs;
     plugins = [];
   };
 
-  dfasma = qt5.callPackage ../applications/audio/dfasma { };
+  dfasma = libsForQt5.callPackage ../applications/audio/dfasma { };
 
-  dfilemanager = qt5.callPackage ../applications/misc/dfilemanager { };
+  dfilemanager = libsForQt5.callPackage ../applications/misc/dfilemanager { };
 
   dia = callPackage ../applications/graphics/dia {
     inherit (pkgs.gnome2) libart_lgpl libgnomeui;
@@ -13304,7 +13368,7 @@ with pkgs;
 
   keepassx = callPackage ../applications/misc/keepassx { };
   keepassx2 = callPackage ../applications/misc/keepassx/2.0.nix { };
-  keepassx-community = qt5.callPackage ../applications/misc/keepassx/community.nix { };
+  keepassx-community = libsForQt5.callPackage ../applications/misc/keepassx/community.nix { };
 
   inherit (gnome3) evince;
   evolution_data_server = gnome3.evolution_data_server;
@@ -13339,7 +13403,7 @@ with pkgs;
      inherit (darwin.apple_sdk.frameworks) CoreServices CoreAudio AudioUnit;
   };
 
-  fmit = qt5.callPackage ../applications/audio/fmit { };
+  fmit = libsForQt5.callPackage ../applications/audio/fmit { };
 
   fmsynth = callPackage ../applications/audio/fmsynth { };
 
@@ -13357,7 +13421,7 @@ with pkgs;
 
   fribid = callPackage ../applications/networking/browsers/mozilla-plugins/fribid { };
 
-  fritzing = qt5.callPackage ../applications/science/electronics/fritzing { };
+  fritzing = libsForQt5.callPackage ../applications/science/electronics/fritzing { };
 
   fvwm = callPackage ../applications/window-managers/fvwm { };
 
@@ -13388,7 +13452,7 @@ with pkgs;
 
   gnuradio-osmosdr = callPackage ../applications/misc/gnuradio-osmosdr { };
 
-  goldendict = qt55.callPackage ../applications/misc/goldendict { };
+  goldendict = libsForQt55.callPackage ../applications/misc/goldendict { };
 
   inherit (ocamlPackages) google-drive-ocamlfuse;
 
@@ -13496,7 +13560,7 @@ with pkgs;
     desktopName = "Firefox Beta";
   };
 
-  firestr = qt5.callPackage ../applications/networking/p2p/firestr
+  firestr = libsForQt5.callPackage ../applications/networking/p2p/firestr
     { boost = boost155;
     };
 
@@ -13647,7 +13711,7 @@ with pkgs;
 
   libquvi = callPackage ../applications/video/quvi/library.nix { };
 
-  linssid = qt5.callPackage ../applications/networking/linssid { };
+  linssid = libsForQt5.callPackage ../applications/networking/linssid { };
 
   manuskript = callPackage ../applications/editors/manuskript { };
 
@@ -13734,7 +13798,7 @@ with pkgs;
 
   gosmore = callPackage ../applications/misc/gosmore { };
 
-  gpsbabel = qt5.callPackage ../applications/misc/gpsbabel { };
+  gpsbabel = libsForQt5.callPackage ../applications/misc/gpsbabel { };
 
   gpscorrelate = callPackage ../applications/misc/gpscorrelate { };
 
@@ -13742,7 +13806,7 @@ with pkgs;
 
   gpsprune = callPackage ../applications/misc/gpsprune { };
 
-  gpxsee = qt5.callPackage ../applications/misc/gpxsee { };
+  gpxsee = libsForQt5.callPackage ../applications/misc/gpxsee { };
 
   gtk2fontsel = callPackage ../applications/misc/gtk2fontsel {
     inherit (gnome2) gtk;
@@ -13948,7 +14012,7 @@ with pkgs;
     lua = lua5_1;
   };
 
-  ipe = qt5.callPackage ../applications/graphics/ipe {
+  ipe = libsForQt5.callPackage ../applications/graphics/ipe {
     ghostscript = ghostscriptX;
     texlive = texlive.combine { inherit (texlive) scheme-small; };
   };
@@ -14016,31 +14080,49 @@ with pkgs;
 
   k3b = kde4.callPackage ../applications/misc/k3b/wrapper.nix { };
 
-  k9copy = qt5.callPackage ../applications/video/k9copy {};
+  k9copy = libsForQt5.callPackage ../applications/video/k9copy {};
 
   kadu = kde4.callPackage ../applications/networking/instant-messengers/kadu { };
 
   kde-telepathy = kde4.callPackage ../applications/networking/instant-messengers/telepathy/kde {};
 
-  kdeconnect = qt5.callPackage ../applications/misc/kdeconnect { };
+  kdeApplications =
+    let
+      mkApplications = import ../applications/kde;
+      attrs = {
+        inherit stdenv lib libsForQt5 fetchurl recurseIntoAttrs;
+        inherit kdeDerivation 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 konsole marble
+    okteta okular spectacle;
+
+  kdeconnect = libsForQt5.callPackage ../applications/misc/kdeconnect { };
 
-  kdecoration-viewer = kde5.callPackage ../tools/misc/kdecoration-viewer {};
+  kdecoration-viewer = libsForQt5.callPackage ../tools/misc/kdecoration-viewer { };
 
-  kdevelop-pg-qt = kde5.callPackage ../applications/editors/kdevelop5/kdevelop-pg-qt.nix {};
+  inherit (kdeFrameworks) kdesu;
 
-  kdevelop = kde5.callPackage ../applications/editors/kdevelop5/kdevelop.nix {
+  kdevelop-pg-qt = libsForQt5.callPackage ../applications/editors/kdevelop5/kdevelop-pg-qt.nix {};
+
+  kdevelop = libsForQt5.callPackage ../applications/editors/kdevelop5/kdevelop.nix {
     llvmPackages = llvmPackages_38;
   };
 
-  kdevplatform = kde5.callPackage ../applications/editors/kdevelop5/kdevplatform.nix {};
+  kdevplatform = libsForQt5.callPackage ../applications/editors/kdevelop5/kdevplatform.nix { };
 
   keepnote = callPackage ../applications/office/keepnote { };
 
   kermit = callPackage ../tools/misc/kermit { };
 
-  keyfinder = qt5.callPackage ../applications/audio/keyfinder { };
+  keyfinder = libsForQt5.callPackage ../applications/audio/keyfinder { };
 
-  keyfinder-cli = qt5.callPackage ../applications/audio/keyfinder-cli { };
+  keyfinder-cli = libsForQt5.callPackage ../applications/audio/keyfinder-cli { };
 
   keymon = callPackage ../applications/video/key-mon { };
 
@@ -14054,14 +14136,14 @@ with pkgs;
     qt = qt4;
   };
 
-  kile = kde5.callPackage ../applications/editors/kile { };
+  kile = libsForQt5.callPackage ../applications/editors/kile { };
 
   kino = callPackage ../applications/video/kino {
     inherit (gnome2) libglade;
     ffmpeg = ffmpeg_2;
   };
 
-  kipi-plugins = kde5.callPackage ../applications/graphics/kipi-plugins {};
+  kipi-plugins = libsForQt5.callPackage ../applications/graphics/kipi-plugins { };
 
   kiwix = callPackage ../applications/misc/kiwix {
     stdenv = overrideCC stdenv gcc49;
@@ -14069,9 +14151,9 @@ with pkgs;
 
   kmplayer = kde4.callPackage ../applications/video/kmplayer { };
 
-  konversation = qt5.callPackage ../applications/networking/irc/konversation { };
+  konversation = libsForQt5.callPackage ../applications/networking/irc/konversation { };
 
-  krita = qt5.callPackage ../applications/graphics/krita {
+  krita = libsForQt5.callPackage ../applications/graphics/krita {
     vc = vc_0_7;
     openjpeg = openjpeg_1;
   };
@@ -14080,7 +14162,7 @@ with pkgs;
 
   ksuperkey = callPackage ../tools/X11/ksuperkey { };
 
-  ktorrent = qt5.callPackage ../applications/networking/p2p/ktorrent { };
+  ktorrent = libsForQt5.callPackage ../applications/networking/p2p/ktorrent { };
 
   kubernetes = callPackage ../applications/networking/cluster/kubernetes {
     go = go_1_6;
@@ -14204,7 +14286,7 @@ with pkgs;
 
   lrzsz = callPackage ../tools/misc/lrzsz { };
 
-  luminanceHDR = qt55.callPackage ../applications/graphics/luminance-hdr { };
+  luminanceHDR = libsForQt55.callPackage ../applications/graphics/luminance-hdr { };
 
   lxdvdrip = callPackage ../applications/video/lxdvdrip { };
 
@@ -14223,7 +14305,7 @@ with pkgs;
 
   lynx = callPackage ../applications/networking/browsers/lynx { };
 
-  lyx = qt5.callPackage ../applications/misc/lyx { };
+  lyx = libsForQt5.callPackage ../applications/misc/lyx { };
 
   mail-notification = callPackage ../desktops/gnome-2/desktop/mail-notification {};
 
@@ -14454,7 +14536,7 @@ with pkgs;
       else null;
   };
 
-  musescore = qt55.callPackage ../applications/audio/musescore { };
+  musescore = libsForQt55.callPackage ../applications/audio/musescore { };
 
   mutt = callPackage ../applications/networking/mailreaders/mutt { };
   mutt-with-sidebar = callPackage ../applications/networking/mailreaders/mutt {
@@ -14502,11 +14584,11 @@ with pkgs;
 
   scudcloud = callPackage ../applications/networking/instant-messengers/scudcloud { };
 
-  shotcut = qt5.callPackage ../applications/video/shotcut { };
+  shotcut = libsForQt5.callPackage ../applications/video/shotcut { };
 
-  smplayer = qt5.callPackage ../applications/video/smplayer { };
+  smplayer = libsForQt5.callPackage ../applications/video/smplayer { };
 
-  smtube = qt55.callPackage ../applications/video/smtube {};
+  smtube = libsForQt55.callPackage ../applications/video/smtube {};
 
   sudolikeaboss = callPackage ../tools/security/sudolikeaboss { };
 
@@ -14609,7 +14691,7 @@ with pkgs;
 
   oblogout = callPackage ../tools/X11/oblogout { };
 
-  obs-studio = qt5.callPackage ../applications/video/obs-studio {
+  obs-studio = libsForQt5.callPackage ../applications/video/obs-studio {
     alsaSupport = stdenv.isLinux;
     pulseaudioSupport = config.pulseaudio or true;
   };
@@ -14709,9 +14791,9 @@ with pkgs;
 
   pflask = callPackage ../os-specific/linux/pflask {};
 
-  photoqt = qt5.callPackage ../applications/graphics/photoqt { };
+  photoqt = libsForQt5.callPackage ../applications/graphics/photoqt { };
 
-  phototonic = qt5.callPackage ../applications/graphics/phototonic { };
+  phototonic = libsForQt5.callPackage ../applications/graphics/phototonic { };
 
   phrasendrescher = callPackage ../tools/security/phrasendrescher { };
 
@@ -14843,7 +14925,7 @@ with pkgs;
 
   pythonmagick = callPackage ../applications/graphics/PythonMagick { };
 
-  qbittorrent = qt5.callPackage ../applications/networking/p2p/qbittorrent {
+  qbittorrent = libsForQt5.callPackage ../applications/networking/p2p/qbittorrent {
     boost = boost;
     libtorrentRasterbar = libtorrentRasterbar_1_0;
   };
@@ -14857,15 +14939,15 @@ with pkgs;
 
   qgis = callPackage ../applications/gis/qgis {};
 
-  qgroundcontrol = qt55.callPackage ../applications/science/robotics/qgroundcontrol { };
+  qgroundcontrol = libsForQt55.callPackage ../applications/science/robotics/qgroundcontrol { };
 
-  qjackctl = qt5.callPackage ../applications/audio/qjackctl { };
+  qjackctl = libsForQt5.callPackage ../applications/audio/qjackctl { };
 
   qmidinet = callPackage ../applications/audio/qmidinet { };
 
   qmidiroute = callPackage ../applications/audio/qmidiroute { };
 
-  qmmp = qt5.callPackage ../applications/audio/qmmp { };
+  qmmp = libsForQt5.callPackage ../applications/audio/qmmp { };
 
   qnotero = callPackage ../applications/office/qnotero { };
 
@@ -14877,15 +14959,15 @@ with pkgs;
     qt = qt4;
   };
 
-  qsyncthingtray = qt5.callPackage ../applications/misc/qsyncthingtray { };
+  qsyncthingtray = libsForQt5.callPackage ../applications/misc/qsyncthingtray { };
 
   qsynth = callPackage ../applications/audio/qsynth { };
 
   qtbitcointrader = callPackage ../applications/misc/qtbitcointrader { };
 
-  qtox = qt5.callPackage ../applications/networking/instant-messengers/qtox { };
+  qtox = libsForQt5.callPackage ../applications/networking/instant-messengers/qtox { };
 
-  qtpass = qt5.callPackage ../applications/misc/qtpass { };
+  qtpass = libsForQt5.callPackage ../applications/misc/qtpass { };
 
   qtpfsgui = callPackage ../applications/graphics/qtpfsgui { };
 
@@ -14893,7 +14975,7 @@ with pkgs;
 
   qtscrobbler = callPackage ../applications/audio/qtscrobbler { };
 
-  quassel = qt5.callPackage ../applications/networking/irc/quassel {
+  quassel = libsForQt5.callPackage ../applications/networking/irc/quassel {
     monolithic = true;
     daemon = false;
     client = false;
@@ -14919,7 +15001,7 @@ with pkgs;
 
   quirc = callPackage ../tools/graphics/quirc {};
 
-  quiterss = qt5.callPackage ../applications/networking/newsreaders/quiterss {};
+  quiterss = libsForQt5.callPackage ../applications/networking/newsreaders/quiterss {};
 
   quodlibet-without-gst-plugins = callPackage ../applications/audio/quodlibet { };
 
@@ -14928,7 +15010,7 @@ with pkgs;
     gst-plugins-bad = null;
   };
 
-  qutebrowser = qt5.callPackage ../applications/networking/browsers/qutebrowser {
+  qutebrowser = libsForQt5.callPackage ../applications/networking/browsers/qutebrowser {
     inherit (python3Packages) buildPythonApplication pyqt5 jinja2 pygments pyyaml pypeg2 cssutils;
     inherit (gst_all_1) gst-plugins-base gst-plugins-good gst-plugins-bad gst-plugins-ugly gst-libav;
   };
@@ -14947,7 +15029,7 @@ with pkgs;
     demo = false;
   };
 
-  rapcad = qt55.callPackage ../applications/graphics/rapcad { boost = boost159; };
+  rapcad = libsForQt55.callPackage ../applications/graphics/rapcad { boost = boost159; };
 
   rapidsvn = callPackage ../applications/version-management/rapidsvn { };
 
@@ -14989,7 +15071,7 @@ with pkgs;
 
   retroshare06 = lowPrio (callPackage ../applications/networking/p2p/retroshare/0.6.nix { });
 
-  ricochet = qt55.callPackage ../applications/networking/instant-messengers/ricochet { };
+  ricochet = libsForQt55.callPackage ../applications/networking/instant-messengers/ricochet { };
 
   ripser = callPackage ../applications/science/math/ripser { };
 
@@ -15169,13 +15251,13 @@ with pkgs;
   bittorrentSync14 = callPackage ../applications/networking/bittorrentsync/1.4.x.nix { };
   bittorrentSync20 = callPackage ../applications/networking/bittorrentsync/2.0.x.nix { };
 
-  dropbox = qt5.callPackage ../applications/networking/dropbox { };
+  dropbox = libsForQt5.callPackage ../applications/networking/dropbox { };
 
   dropbox-cli = callPackage ../applications/networking/dropbox-cli { };
 
   insync = callPackage ../applications/networking/insync { };
 
-  lightdm = qt5.callPackage ../applications/display-managers/lightdm {
+  lightdm = libsForQt5.callPackage ../applications/display-managers/lightdm {
     qt4 = null;
     withQt5 = false;
   };
@@ -15196,11 +15278,11 @@ with pkgs;
 
   printrun = callPackage ../applications/misc/printrun { };
 
-  sddm = qt5.callPackage ../applications/display-managers/sddm {
+  sddm = libsForQt5.callPackage ../applications/display-managers/sddm {
     themes = [];  # extra themes, etc.
   };
 
-  skrooge = qt5.callPackage ../applications/office/skrooge {};
+  skrooge = libsForQt5.callPackage ../applications/office/skrooge {};
 
   slim = callPackage ../applications/display-managers/slim {
     libpng = libpng12;
@@ -15222,7 +15304,7 @@ with pkgs;
 
   sipp = callPackage ../development/tools/misc/sipp { };
 
-  sonic-visualiser = qt5.callPackage ../applications/audio/sonic-visualiser {
+  sonic-visualiser = libsForQt5.callPackage ../applications/audio/sonic-visualiser {
     inherit (pkgs.vamp) vampSDK;
   };
 
@@ -15337,7 +15419,7 @@ with pkgs;
     gconf = gnome2.GConf;
   };
 
-  teamspeak_client = qt55.callPackage ../applications/networking/instant-messengers/teamspeak/client.nix { };
+  teamspeak_client = libsForQt55.callPackage ../applications/networking/instant-messengers/teamspeak/client.nix { };
   teamspeak_server = callPackage ../applications/networking/instant-messengers/teamspeak/server.nix { };
 
   taskjuggler-2 = callPackage ../applications/misc/taskjuggler/2.x { };
@@ -15482,7 +15564,7 @@ with pkgs;
     boost = boost160;
   };
 
-  twmn = qt5.callPackage ../applications/misc/twmn { };
+  twmn = libsForQt5.callPackage ../applications/misc/twmn { };
 
   umurmur = callPackage ../applications/networking/umurmur { };
 
@@ -15560,7 +15642,7 @@ with pkgs;
 
   neovim = callPackage ../applications/editors/neovim { };
 
-  neovim-qt = qt5.callPackage ../applications/editors/neovim/qt.nix { };
+  neovim-qt = libsForQt5.callPackage ../applications/editors/neovim/qt.nix { };
 
   neovim-pygui = pythonPackages.neovim_gui;
 
@@ -15648,7 +15730,7 @@ with pkgs;
     gtk = gtk2;
   };
 
-  vlc_qt5 = qt5.vlc;
+  vlc_qt5 = libsForQt5.vlc;
 
   vmpk = callPackage ../applications/audio/vmpk { };
 
@@ -15861,7 +15943,7 @@ with pkgs;
   };
   xbmc-retroarch-advanced-launchers = kodi-retroarch-advanced-launchers;
 
-  xca = qt5.callPackage ../applications/misc/xca { };
+  xca = libsForQt5.callPackage ../applications/misc/xca { };
 
   xcalib = callPackage ../tools/X11/xcalib { };
 
@@ -16024,7 +16106,9 @@ with pkgs;
 
   yabar = callPackage ../applications/window-managers/yabar { };
 
-  yakuake = kde5.callPackage ../applications/misc/yakuake {};
+  yakuake = libsForQt5.callPackage ../applications/misc/yakuake {
+    inherit (kdeApplications) konsole;
+  };
 
   yarp = callPackage ../applications/science/robotics/yarp {};
 
@@ -16147,13 +16231,13 @@ with pkgs;
 
   chessdb = callPackage ../games/chessdb { };
 
-  chessx = qt5.callPackage ../games/chessx { };
+  chessx = libsForQt5.callPackage ../games/chessx { };
 
   chocolateDoom = callPackage ../games/chocolate-doom { };
 
   ckan = callPackage ../games/ckan { };
 
-  cockatrice = qt5.callPackage ../games/cockatrice {  };
+  cockatrice = libsForQt5.callPackage ../games/cockatrice {  };
 
   commandergenius = callPackage ../games/commandergenius { };
 
@@ -16184,7 +16268,8 @@ with pkgs;
 
   dhewm3 = callPackage ../games/dhewm3 {};
 
-  digikam = kde5.callPackage ../applications/graphics/digikam {
+  digikam = libsForQt5.callPackage ../applications/graphics/digikam {
+    inherit (plasma5) oxygen;
     boost = boost160;
   };
 
@@ -16232,7 +16317,7 @@ with pkgs;
 
   fish-fillets-ng = callPackage ../games/fish-fillets-ng {};
 
-  flightgear = qt5.callPackage ../games/flightgear { };
+  flightgear = libsForQt5.callPackage ../games/flightgear { };
 
   freecell-solver = callPackage ../games/freecell-solver { };
 
@@ -16347,7 +16432,7 @@ with pkgs;
 
   minecraft-server = callPackage ../games/minecraft-server { };
 
-  multimc = qt5.callPackage ../games/multimc { };
+  multimc = libsForQt5.callPackage ../games/multimc { };
 
   minetest = callPackage ../games/minetest {
     libpng = libpng12;
@@ -16357,7 +16442,7 @@ with pkgs;
 
   mrrescue = callPackage ../games/mrrescue { };
 
-  mudlet = qt5.callPackage ../games/mudlet {
+  mudlet = libsForQt5.callPackage ../games/mudlet {
     inherit (lua51Packages) luafilesystem lrexlib luazip luasqlite3;
   };
 
@@ -16500,7 +16585,7 @@ with pkgs;
 
   solarus = callPackage ../games/solarus { };
 
-  solarus-quest-editor = qt5.callPackage ../development/tools/solarus-quest-editor { };
+  solarus-quest-editor = libsForQt5.callPackage ../development/tools/solarus-quest-editor { };
 
   # You still can override by passing more arguments.
   space-orbit = callPackage ../games/space-orbit { };
@@ -16633,7 +16718,7 @@ with pkgs;
 
   warsow = callPackage ../games/warsow { };
 
-  warzone2100 = qt5.callPackage ../games/warzone2100 { };
+  warzone2100 = libsForQt5.callPackage ../games/warzone2100 { };
 
   wesnoth = callPackage ../games/wesnoth { };
 
@@ -16753,9 +16838,12 @@ with pkgs;
       );
     in recurseIntoAttrs self;
 
-  lumina = callPackage ../desktops/lumina { };
+  lumina = libsForQt5.callPackage ../desktops/lumina { };
 
-  lxqt = recurseIntoAttrs (callPackage ../desktops/lxqt { });
+  lxqt = recurseIntoAttrs (import ../desktops/lxqt {
+    inherit pkgs libsForQt5 fetchFromGitHub;
+    inherit (lib) makeScope;
+  });
 
   mate = recurseIntoAttrs (callPackage ../desktops/mate {
     callPackage = newScope pkgs.mate;
@@ -16770,7 +16858,7 @@ with pkgs;
     inherit (python3Packages) python pygobject3 pyxdg;
   };
 
-  redshift-plasma-applet = callPackage ../applications/misc/redshift-plasma-applet { };
+  redshift-plasma-applet = libsForQt5.callPackage ../applications/misc/redshift-plasma-applet { };
 
   orion = callPackage ../misc/themes/orion {};
 
@@ -16784,22 +16872,6 @@ with pkgs;
 
   numix-gtk-theme = callPackage ../misc/themes/numix { };
 
-  kde5 =
-    let
-      plasma = import ../desktops/kde-5/plasma { inherit pkgs; };
-      applications = import ../desktops/kde-5/applications { inherit pkgs; };
-      merged = self:
-        {
-          plasma = plasma self;
-          frameworks = qt5.kdeFrameworks;
-          applications = applications self;
-        }
-        // qt5.kdeFrameworks
-        // plasma self
-        // applications self;
-    in
-      recurseIntoAttrs (lib.makeScope qt5.newScope merged);
-
   theme-vertex = callPackage ../misc/themes/vertex { };
 
   rox-filer = callPackage ../desktops/rox/rox-filer {
@@ -16811,6 +16883,29 @@ with pkgs;
 
   xrandr-invert-colors = callPackage ../applications/misc/xrandr-invert-colors { };
 
+  ### DESKTOP ENVIRONMENTS / PLASMA 5
+
+  plasma5 =
+    let
+      mkPlasma5 = import ../desktops/plasma-5;
+      attrs = {
+        inherit libsForQt5 kdeDerivation lib fetchurl;
+        inherit (gnome3) gconf;
+      };
+    in
+      recurseIntoAttrs (makeOverridable mkPlasma5 attrs);
+
+  inherit (kdeFrameworks) kded kinit frameworkintegration;
+
+  inherit (plasma5)
+    bluedevil breeze-gtk breeze-qt4 breeze-qt5 breeze-grub breeze-plymouth
+    kactivitymanagerd kde-cli-tools kde-gtk-config kdeplasma-addons kgamma5
+    kinfocenter kmenuedit kscreen kscreenlocker ksshaskpass ksysguard
+    kwallet-pam kwayland-integration kwin kwrited milou oxygen plasma-desktop
+    plasma-integration plasma-nm plasma-pa plasma-workspace
+    plasma-workspace-wallpapers polkit-kde-agent powerdevil startkde
+    systemsettings;
+
   ### SCIENCE
 
   ### SCIENCE/GEOMETRY
@@ -17305,7 +17400,7 @@ with pkgs;
 
   yacas = callPackage ../applications/science/math/yacas { };
 
-  speedcrunch = qt5.callPackage ../applications/science/math/speedcrunch { };
+  speedcrunch = libsForQt5.callPackage ../applications/science/math/speedcrunch { };
 
   ### SCIENCE / MISC
 
@@ -17336,7 +17431,7 @@ with pkgs;
 
   spyder = pythonPackages.spyder;
 
-  stellarium = qt5.callPackage ../applications/science/astronomy/stellarium { };
+  stellarium = libsForQt5.callPackage ../applications/science/astronomy/stellarium { };
 
   tulip = callPackage ../applications/science/misc/tulip {
     cmake = cmake_2_8;
@@ -17398,7 +17493,7 @@ with pkgs;
 
   ### MISC
 
-  antimicro = qt5.callPackage ../tools/misc/antimicro { };
+  antimicro = libsForQt5.callPackage ../tools/misc/antimicro { };
 
   atari800 = callPackage ../misc/emulators/atari800 { };
 
@@ -17668,9 +17763,9 @@ with pkgs;
     pcre = pcre-cpp;
   });
 
-  redis-desktop-manager = qt55.callPackage ../applications/misc/redis-desktop-manager { };
+  redis-desktop-manager = libsForQt55.callPackage ../applications/misc/redis-desktop-manager { };
 
-  robomongo = qt5.callPackage ../applications/misc/robomongo { };
+  robomongo = libsForQt5.callPackage ../applications/misc/robomongo { };
 
   rucksack = callPackage ../development/tools/rucksack { };
 
@@ -17872,7 +17967,7 @@ with pkgs;
   vips = callPackage ../tools/graphics/vips { };
   nip2 = callPackage ../tools/graphics/nip2 { };
 
-  vokoscreen = qt5.callPackage ../applications/video/vokoscreen { };
+  vokoscreen = libsForQt5.callPackage ../applications/video/vokoscreen { };
 
   wavegain = callPackage ../applications/audio/wavegain { };
 
@@ -18035,7 +18130,7 @@ with pkgs;
 
   discord = callPackage ../applications/networking/instant-messengers/discord { };
 
-  golden-cheetah = qt5.callPackage ../applications/misc/golden-cheetah {};
+  golden-cheetah = libsForQt5.callPackage ../applications/misc/golden-cheetah {};
 
   linkchecker = callPackage ../tools/networking/linkchecker { };
 
@@ -18057,9 +18152,9 @@ with pkgs;
 
   zuki-themes = callPackage ../misc/themes/zuki { };
 
-  zoom-us = qt55.callPackage ../applications/networking/instant-messengers/zoom-us {};
+  zoom-us = libsForQt55.callPackage ../applications/networking/instant-messengers/zoom-us {};
 
-  tora = qt5.callPackage ../development/tools/tora {};
+  tora = libsForQt5.callPackage ../development/tools/tora {};
 
   xulrunner = firefox-unwrapped;