about summary refs log tree commit diff
path: root/nixpkgs/pkgs/desktops/plasma-5
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/desktops/plasma-5')
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/bluedevil.nix14
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/breeze-grub.nix15
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/breeze-gtk.nix14
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/breeze-plymouth/default.nix44
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/breeze-plymouth/install-paths.patch19
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/breeze-plymouth/series1
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/breeze-qt5.nix20
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/default.nix142
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/fetch.sh1
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kactivitymanagerd.nix15
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kde-cli-tools.nix14
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kde-gtk-config/default.nix25
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kde-gtk-config/patches/follow-symlinks.patch49
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kde-gtk-config/patches/gsettings.patch21
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kde-gtk-config/patches/series2
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kdecoration.nix8
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kdeplasma-addons.nix17
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kgamma5.nix11
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/khotkeys.nix17
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kinfocenter.nix17
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kmenuedit.nix14
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kscreen.nix17
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kscreenlocker.nix17
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/ksshaskpass.nix11
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/ksysguard.nix16
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kwallet-pam.nix10
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kwayland-integration.nix11
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kwin/default.nix46
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kwin/follow-symlinks.patch13
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kwin/no-setcap-install.patch24
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kwin/series3
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kwin/xwayland.patch13
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/kwrited.nix11
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/libkscreen/default.nix17
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/libkscreen/libkscreen-backends-path.patch27
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/libkscreen/series1
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/libksysguard/0001-qdiriterator-follow-symlinks.patch25
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/libksysguard/default.nix21
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/milou.nix15
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/oxygen.nix18
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/plasma-browser-integration.nix11
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/plasma-desktop/default.nix51
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/plasma-desktop/hwclock-path.patch24
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/plasma-desktop/series2
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/plasma-desktop/tzdir.patch18
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/plasma-integration/default.nix17
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/plasma-nm/0001-mobile-broadband-provider-info-path.patch25
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/plasma-nm/0002-openvpn-binary-path.patch13
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/plasma-nm/default.nix31
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/plasma-pa.nix15
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/plasma-vault/cryfs-path.patch13
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/plasma-vault/default.nix40
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/plasma-vault/encfs-path.patch22
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/plasma-vault/fusermount-path.patch18
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/plasma-workspace-wallpapers.nix6
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/plasma-workspace/default.nix81
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/plasma-workspace/plasma-workspace.patch1079
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/polkit-kde-agent.nix15
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/powerdevil.nix17
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/sddm-kcm.nix16
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/srcs.nix365
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/systemsettings.nix17
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/user-manager.nix13
-rw-r--r--nixpkgs/pkgs/desktops/plasma-5/xdg-desktop-portal-kde.nix13
64 files changed, 2718 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/desktops/plasma-5/bluedevil.nix b/nixpkgs/pkgs/desktops/plasma-5/bluedevil.nix
new file mode 100644
index 000000000000..b5ff3f5dd05d
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/bluedevil.nix
@@ -0,0 +1,14 @@
+{
+  mkDerivation, extra-cmake-modules, shared-mime-info,
+  bluez-qt, kcoreaddons, kdbusaddons, kded, ki18n, kiconthemes, kio,
+  knotifications, kwidgetsaddons, kwindowsystem, plasma-framework, qtdeclarative
+}:
+
+mkDerivation {
+  name = "bluedevil";
+  nativeBuildInputs = [ extra-cmake-modules shared-mime-info ];
+  buildInputs = [
+    bluez-qt ki18n kio kwindowsystem plasma-framework qtdeclarative kcoreaddons
+    kdbusaddons kded kiconthemes knotifications kwidgetsaddons
+  ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/breeze-grub.nix b/nixpkgs/pkgs/desktops/plasma-5/breeze-grub.nix
new file mode 100644
index 000000000000..eed396b54375
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/breeze-grub.nix
@@ -0,0 +1,15 @@
+{
+  mkDerivation
+}:
+
+mkDerivation {
+  name = "breeze-grub";
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p "$out/grub/themes"
+    mv breeze "$out/grub/themes"
+
+    runHook postInstall
+  '';
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/breeze-gtk.nix b/nixpkgs/pkgs/desktops/plasma-5/breeze-gtk.nix
new file mode 100644
index 000000000000..cc51c4b0471c
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/breeze-gtk.nix
@@ -0,0 +1,14 @@
+{ mkDerivation, lib, extra-cmake-modules, gtk2, qtbase, }:
+
+let inherit (lib) getLib; in
+
+mkDerivation {
+  name = "breeze-gtk";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtbase ];
+  postPatch = ''
+    sed -i cmake/FindGTKEngine.cmake \
+      -e "s|\''${KDE_INSTALL_FULL_LIBDIR}|${getLib gtk2}/lib|"
+  '';
+  cmakeFlags = [ "-DWITH_GTK3_VERSION=3.22" ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/breeze-plymouth/default.nix b/nixpkgs/pkgs/desktops/plasma-5/breeze-plymouth/default.nix
new file mode 100644
index 000000000000..48b038325fec
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/breeze-plymouth/default.nix
@@ -0,0 +1,44 @@
+{
+  mkDerivation,
+  lib,
+  copyPathsToStore,
+  extra-cmake-modules,
+  plymouth,
+  nixos-icons,
+  imagemagick,
+  netpbm,
+  perl,
+  # these will typically need to be set via an override
+  # in a NixOS context
+  nixosBranding ? false,
+  nixosName ? "NixOS",
+  nixosVersion ? "",
+  topColor ? "black",
+  bottomColor ? "black"
+}:
+
+let
+  logoName = "nixos";
+in
+mkDerivation {
+  name = "breeze-plymouth";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ plymouth ] ++ lib.optionals nixosBranding [ imagemagick netpbm perl ];
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+  cmakeFlags = lib.optionals nixosBranding [
+    "-DDISTRO_NAME=${nixosName}"
+    "-DDISTRO_VERSION=${nixosVersion}"
+    "-DDISTRO_LOGO=${logoName}"
+    "-DBACKGROUND_TOP_COLOR=${topColor}"
+    "-DBACKGROUND_BOTTOM_COLOR=${bottomColor}"
+  ];
+  postPatch = ''
+      substituteInPlace cmake/FindPlymouth.cmake --subst-var out
+  '' + lib.optionalString nixosBranding ''
+      cp ${nixos-icons}/share/icons/hicolor/128x128/apps/nix-snowflake.png breeze/images/${logoName}.logo.png
+
+      # conversion for 16bit taken from the breeze-plymouth readme
+      convert ${nixos-icons}/share/icons/hicolor/128x128/apps/nix-snowflake.png -alpha Background -background "#000000" -fill "#000000" -flatten tmp.png
+      pngtopnm tmp.png | pnmquant 16 | pnmtopng > breeze/images/16bit/${logoName}.logo.png
+  '';
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/breeze-plymouth/install-paths.patch b/nixpkgs/pkgs/desktops/plasma-5/breeze-plymouth/install-paths.patch
new file mode 100644
index 000000000000..5d5856d122dd
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/breeze-plymouth/install-paths.patch
@@ -0,0 +1,19 @@
+Index: breeze-plymouth-5.7.3/cmake/FindPlymouth.cmake
+===================================================================
+--- breeze-plymouth-5.7.3.orig/cmake/FindPlymouth.cmake
++++ breeze-plymouth-5.7.3/cmake/FindPlymouth.cmake
+@@ -24,12 +24,8 @@
+ include(FindPkgConfig)
+ 
+ pkg_check_modules(Plymouth ply-boot-client ply-splash-core)
+-exec_program(${PKG_CONFIG_EXECUTABLE}
+-    ARGS ply-splash-core --variable=pluginsdir
+-    OUTPUT_VARIABLE Plymouth_PLUGINSDIR)
+-exec_program(${PKG_CONFIG_EXECUTABLE}
+-    ARGS ply-splash-core --variable=themesdir
+-    OUTPUT_VARIABLE Plymouth_THEMESDIR)
++set(Plymouth_PLUGINSDIR "@out@/lib/plymouth")
++set(Plymouth_THEMESDIR "@out@/share/plymouth/themes")
+ 
+ find_package_handle_standard_args(Plymouth
+     FOUND_VAR
diff --git a/nixpkgs/pkgs/desktops/plasma-5/breeze-plymouth/series b/nixpkgs/pkgs/desktops/plasma-5/breeze-plymouth/series
new file mode 100644
index 000000000000..8920e7ca5189
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/breeze-plymouth/series
@@ -0,0 +1 @@
+install-paths.patch
diff --git a/nixpkgs/pkgs/desktops/plasma-5/breeze-qt5.nix b/nixpkgs/pkgs/desktops/plasma-5/breeze-qt5.nix
new file mode 100644
index 000000000000..3f3222e05cdb
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/breeze-qt5.nix
@@ -0,0 +1,20 @@
+{
+  mkDerivation,
+  extra-cmake-modules,
+  frameworkintegration, kcmutils, kconfigwidgets, kcoreaddons, kdecoration,
+  kguiaddons, ki18n, kwayland, kwindowsystem, plasma-framework, qtdeclarative,
+  qtx11extras, fftw
+}:
+
+mkDerivation {
+  name = "breeze-qt5";
+  sname = "breeze";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  propagatedBuildInputs = [
+    frameworkintegration kcmutils kconfigwidgets kcoreaddons kdecoration
+    kguiaddons ki18n kwayland kwindowsystem plasma-framework qtdeclarative
+    qtx11extras fftw
+  ];
+  outputs = [ "bin" "dev" "out" ];
+  cmakeFlags = [ "-DUSE_Qt4=OFF" ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/default.nix b/nixpkgs/pkgs/desktops/plasma-5/default.nix
new file mode 100644
index 000000000000..2c99713bcd4a
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/default.nix
@@ -0,0 +1,142 @@
+/*
+
+# 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, lib, fetchurl,
+  gconf, gsettings-desktop-schemas
+}:
+
+let
+  srcs = import ./srcs.nix {
+    inherit fetchurl;
+    mirror = "mirror://kde";
+  };
+
+  mkDerivation = libsForQt5.callPackage ({ mkDerivation }: mkDerivation) {};
+
+  packages = self: with self;
+    let
+
+      propagate = out:
+        let setupHook = { writeScript }:
+              writeScript "setup-hook" ''
+                if [ "$hookName" != postHook ]; then
+                    postHooks+=("source @dev@/nix-support/setup-hook")
+                else
+                    # Propagate $${out} output
+                    propagatedUserEnvPkgs="$propagatedUserEnvPkgs @${out}@"
+
+                    if [ -z "$outputDev" ]; then
+                        echo "error: \$outputDev is unset!" >&2
+                        exit 1
+                    fi
+
+                    # Propagate $dev so that this setup hook is propagated
+                    # But only if there is a separate $dev output
+                    if [ "$outputDev" != out ]; then
+                        propagatedBuildInputs="$propagatedBuildInputs @dev@"
+                    fi
+                fi
+              '';
+        in callPackage setupHook {};
+
+      propagateBin = propagate "bin";
+
+      callPackage = self.newScope {
+        inherit propagate propagateBin;
+
+        mkDerivation = args:
+          let
+            inherit (args) name;
+            sname = args.sname or name;
+            inherit (srcs."${sname}") src version;
+
+            outputs = args.outputs or [ "out" ];
+            hasBin = lib.elem "bin" outputs;
+            hasDev = lib.elem "dev" outputs;
+
+            defaultSetupHook = if hasBin && hasDev then propagateBin else null;
+            setupHook = args.setupHook or defaultSetupHook;
+
+            meta = {
+              license = with lib.licenses; [
+                lgpl21Plus lgpl3Plus bsd2 mit gpl2Plus gpl3Plus fdl12
+              ];
+              platforms = lib.platforms.linux;
+              maintainers = with lib.maintainers; [ ttuegel ];
+              homepage = http://www.kde.org;
+            } // (args.meta or {});
+          in
+          mkDerivation (args // {
+            name = "${name}-${version}";
+            inherit meta outputs setupHook src;
+          });
+      };
+
+    in {
+      bluedevil = callPackage ./bluedevil.nix {};
+      breeze-gtk = callPackage ./breeze-gtk.nix {};
+      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 { inherit gsettings-desktop-schemas; };
+      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 {};
+      libksysguard = callPackage ./libksysguard {};
+      milou = callPackage ./milou.nix {};
+      oxygen = callPackage ./oxygen.nix {};
+      plasma-browser-integration = callPackage ./plasma-browser-integration.nix {};
+      plasma-desktop = callPackage ./plasma-desktop {};
+      plasma-integration = callPackage ./plasma-integration {};
+      plasma-nm = callPackage ./plasma-nm {};
+      plasma-pa = callPackage ./plasma-pa.nix { inherit gconf; };
+      plasma-vault = callPackage ./plasma-vault {};
+      plasma-workspace = callPackage ./plasma-workspace {};
+      plasma-workspace-wallpapers = callPackage ./plasma-workspace-wallpapers.nix {};
+      polkit-kde-agent = callPackage ./polkit-kde-agent.nix {};
+      powerdevil = callPackage ./powerdevil.nix {};
+      sddm-kcm = callPackage ./sddm-kcm.nix {};
+      systemsettings = callPackage ./systemsettings.nix {};
+      user-manager = callPackage ./user-manager.nix {};
+      xdg-desktop-portal-kde = callPackage ./xdg-desktop-portal-kde.nix {};
+    };
+in
+lib.makeScope libsForQt5.newScope packages
diff --git a/nixpkgs/pkgs/desktops/plasma-5/fetch.sh b/nixpkgs/pkgs/desktops/plasma-5/fetch.sh
new file mode 100644
index 000000000000..57b11f970f2c
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/fetch.sh
@@ -0,0 +1 @@
+WGET_ARGS=( https://download.kde.org/stable/plasma/5.14.4/ -A '*.tar.xz' )
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kactivitymanagerd.nix b/nixpkgs/pkgs/desktops/plasma-5/kactivitymanagerd.nix
new file mode 100644
index 000000000000..d2870c27e659
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kactivitymanagerd.nix
@@ -0,0 +1,15 @@
+{
+  mkDerivation,
+  extra-cmake-modules,
+  boost, kconfig, kcoreaddons, kdbusaddons, ki18n, kio, kglobalaccel,
+  kwindowsystem, kxmlgui, kcrash
+}:
+
+mkDerivation {
+  name = "kactivitymanagerd";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    boost kconfig kcoreaddons kdbusaddons kglobalaccel ki18n kio kwindowsystem
+    kxmlgui kcrash
+  ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kde-cli-tools.nix b/nixpkgs/pkgs/desktops/plasma-5/kde-cli-tools.nix
new file mode 100644
index 000000000000..3364ee2c0632
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kde-cli-tools.nix
@@ -0,0 +1,14 @@
+{
+  mkDerivation, extra-cmake-modules, kdoctools,
+  kcmutils, kconfig, kdesu, ki18n, kiconthemes, kinit, kio, kwindowsystem,
+  qtsvg, qtx11extras, kactivities, plasma-workspace
+}:
+
+mkDerivation {
+  name = "kde-cli-tools";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    kcmutils kconfig kdesu ki18n kiconthemes kinit kio kwindowsystem qtsvg
+    qtx11extras kactivities plasma-workspace
+  ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kde-gtk-config/default.nix b/nixpkgs/pkgs/desktops/plasma-5/kde-gtk-config/default.nix
new file mode 100644
index 000000000000..8cfc947d30bd
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kde-gtk-config/default.nix
@@ -0,0 +1,25 @@
+{
+  mkDerivation,
+  extra-cmake-modules, wrapGAppsHook,
+  glib, gtk2, gtk3, karchive, kcmutils, kconfigwidgets, ki18n, kiconthemes, kio,
+  knewstuff, gsettings-desktop-schemas
+}:
+
+mkDerivation {
+  name = "kde-gtk-config";
+  nativeBuildInputs = [ extra-cmake-modules wrapGAppsHook ];
+  dontWrapGApps = true;  # There is nothing to wrap
+  buildInputs = [
+    ki18n kio glib gtk2 gtk3 karchive kcmutils kconfigwidgets kiconthemes
+    knewstuff gsettings-desktop-schemas
+  ];
+  patches = [ ./patches/follow-symlinks.patch ./patches/gsettings.patch ];
+  cmakeFlags = [
+    "-DGTK2_GLIBCONFIG_INCLUDE_DIR=${glib.out}/lib/glib-2.0/include"
+    "-DGTK2_GDKCONFIG_INCLUDE_DIR=${gtk2.out}/lib/gtk-2.0/include"
+    "-DGLIB_SCHEMAS_DIR=${gsettings-desktop-schemas.out}/"
+  ];
+  preConfigure = ''
+    NIX_CFLAGS_COMPILE+=" -DGSETTINGS_SCHEMAS_PATH=\"$GSETTINGS_SCHEMAS_PATH\""
+  '';
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kde-gtk-config/patches/follow-symlinks.patch b/nixpkgs/pkgs/desktops/plasma-5/kde-gtk-config/patches/follow-symlinks.patch
new file mode 100644
index 000000000000..f30a0a4588fa
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kde-gtk-config/patches/follow-symlinks.patch
@@ -0,0 +1,49 @@
+From 33b25c2e3c7a002c7f726cd79fc4bab22b1299be Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Tue, 27 Oct 2015 18:07:54 -0500
+Subject: [PATCH] follow symlinks
+
+---
+ src/appearancegtk2.cpp  | 2 +-
+ src/iconthemesmodel.cpp | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+Index: kde-gtk-config-5.12.4/src/appearancegtk2.cpp
+===================================================================
+--- kde-gtk-config-5.12.4.orig/src/appearancegtk2.cpp
++++ kde-gtk-config-5.12.4/src/appearancegtk2.cpp
+@@ -69,7 +69,7 @@ QString AppearanceGTK2::themesGtkrcFile(
+     QStringList themes=installedThemes();
+     themes=themes.filter(QRegExp("/"+themeName+"/?$"));
+     if(themes.size()==1) {
+-        QDirIterator it(themes.first(), QDirIterator::Subdirectories);
++        QDirIterator it(themes.first(), QDirIterator::Subdirectories | QDirIterator::FollowSymlinks);
+         while(it.hasNext()) {
+             it.next();
+             if(it.fileName()=="gtkrc") {
+Index: kde-gtk-config-5.12.4/src/iconthemesmodel.cpp
+===================================================================
+--- kde-gtk-config-5.12.4.orig/src/iconthemesmodel.cpp
++++ kde-gtk-config-5.12.4/src/iconthemesmodel.cpp
+@@ -47,7 +47,7 @@ QList<QDir> IconThemesModel::installedTh
+ 
+     foreach(const QString& dir, dirs) {
+         QDir userIconsDir(dir);
+-        QDirIterator it(userIconsDir.path(), QDir::NoDotAndDotDot|QDir::AllDirs|QDir::NoSymLinks);
++        QDirIterator it(userIconsDir.path(), QDir::NoDotAndDotDot|QDir::AllDirs);
+         while(it.hasNext()) {
+             QString currentPath = it.next();
+             QDir dir(currentPath);
+Index: kde-gtk-config-5.12.4/src/cursorthemesmodel.cpp
+===================================================================
+--- kde-gtk-config-5.12.4.orig/src/cursorthemesmodel.cpp
++++ kde-gtk-config-5.12.4/src/cursorthemesmodel.cpp
+@@ -47,7 +47,7 @@ QList<QDir> CursorThemesModel::installed
+ 
+     foreach(const QString& dir, dirs) {
+         QDir userIconsDir(dir);
+-        QDirIterator it(userIconsDir.path(), QDir::NoDotAndDotDot|QDir::AllDirs|QDir::NoSymLinks);
++        QDirIterator it(userIconsDir.path(), QDir::NoDotAndDotDot|QDir::AllDirs);
+         while(it.hasNext()) {
+             QString currentPath = it.next();
+             QDir dir(currentPath);
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kde-gtk-config/patches/gsettings.patch b/nixpkgs/pkgs/desktops/plasma-5/kde-gtk-config/patches/gsettings.patch
new file mode 100644
index 000000000000..69f7bc4e56a0
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kde-gtk-config/patches/gsettings.patch
@@ -0,0 +1,21 @@
+diff --git a/src/gtkconfigkcmodule.cpp b/src/gtkconfigkcmodule.cpp
+index 7b82d50..96831d8 100644
+--- a/src/gtkconfigkcmodule.cpp
++++ b/src/gtkconfigkcmodule.cpp
+@@ -91,6 +91,16 @@ GTKConfigKCModule::GTKConfigKCModule(QWidget* parent, const QVariantList& args )
+     iconsProxyModel->sort(0);
+     ui->cb_icon->setModel(iconsProxyModel);
+     ui->cb_icon_fallback->setModel(iconsProxyModel);
++
++    // Add GSETTINGS_SCHEMAS_PATH to the front of XDG_DATA_DIRS.
++    // Normally this would be done by wrapGAppsHook, but this plugin
++    // (shared object) cannot be wrapped.
++    QByteArray xdgdata = qgetenv("XDG_DATA_DIRS");
++    if (!xdgdata.isEmpty()) {
++        xdgdata.push_front(":");
++    }
++    xdgdata.push_front(QByteArray(GSETTINGS_SCHEMAS_PATH));
++    qputenv("XDG_DATA_DIRS", xdgdata);
+     
+     m_tempGtk2Preview = QStandardPaths::writableLocation(QStandardPaths::TempLocation)+ "/gtkrc-2.0";
+     m_tempGtk3Preview = QStandardPaths::writableLocation(QStandardPaths::TempLocation)+ "/.config/gtk-3.0/settings.ini";
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kde-gtk-config/patches/series b/nixpkgs/pkgs/desktops/plasma-5/kde-gtk-config/patches/series
new file mode 100644
index 000000000000..7aad1acf6ac4
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kde-gtk-config/patches/series
@@ -0,0 +1,2 @@
+follow-symlinks.patch
+gsettings.patch
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kdecoration.nix b/nixpkgs/pkgs/desktops/plasma-5/kdecoration.nix
new file mode 100644
index 000000000000..569da3c70349
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kdecoration.nix
@@ -0,0 +1,8 @@
+{ mkDerivation, extra-cmake-modules, qtbase, ki18n }:
+
+mkDerivation {
+  name = "kdecoration";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ qtbase ki18n ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kdeplasma-addons.nix b/nixpkgs/pkgs/desktops/plasma-5/kdeplasma-addons.nix
new file mode 100644
index 000000000000..398fc356fc93
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kdeplasma-addons.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation,
+  extra-cmake-modules, kdoctools,
+  kconfig, kconfigwidgets, kcoreaddons, kcmutils, kdelibs4support, kio,
+  knewstuff, kross, krunner, kservice, ksysguard, kunitconversion, ibus,
+  plasma-framework, plasma-workspace, qtdeclarative, qtx11extras, kholidays
+}:
+
+mkDerivation {
+  name = "kdeplasma-addons";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    kconfig kconfigwidgets kcoreaddons kcmutils kdelibs4support kio knewstuff
+    kross krunner kservice ksysguard kunitconversion ibus plasma-framework
+    plasma-workspace qtdeclarative qtx11extras kholidays
+  ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kgamma5.nix b/nixpkgs/pkgs/desktops/plasma-5/kgamma5.nix
new file mode 100644
index 000000000000..ccbf3820b908
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kgamma5.nix
@@ -0,0 +1,11 @@
+{
+  mkDerivation,
+  extra-cmake-modules, kdoctools,
+  kconfig, kconfigwidgets, ki18n, qtx11extras, libXxf86vm
+}:
+
+mkDerivation {
+  name = "kgamma5";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ kconfig kconfigwidgets ki18n qtx11extras libXxf86vm ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/khotkeys.nix b/nixpkgs/pkgs/desktops/plasma-5/khotkeys.nix
new file mode 100644
index 000000000000..77763c5e203e
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/khotkeys.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation,
+  extra-cmake-modules, kdoctools,
+  kcmutils, kdbusaddons, kdelibs4support, kglobalaccel, ki18n, kio, kxmlgui,
+  plasma-framework, plasma-workspace, qtx11extras
+}:
+
+mkDerivation {
+  name = "khotkeys";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    kcmutils kdbusaddons kdelibs4support kglobalaccel ki18n kio kxmlgui
+    plasma-framework plasma-workspace qtx11extras
+  ];
+  outputs = [ "bin" "dev" "out" ];
+  enableParallelBuilding = false;
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kinfocenter.nix b/nixpkgs/pkgs/desktops/plasma-5/kinfocenter.nix
new file mode 100644
index 000000000000..b35493929ff3
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kinfocenter.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation,
+  extra-cmake-modules, kdoctools,
+  kcmutils, kcompletion, kconfig, kconfigwidgets, kcoreaddons, kdbusaddons,
+  kdeclarative, kdelibs4support, ki18n, kiconthemes, kio, kpackage, kservice,
+  kwayland, kwidgetsaddons, kxmlgui, libraw1394, libGLU, pciutils, solid
+}:
+
+mkDerivation {
+  name = "kinfocenter";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    kcmutils kcompletion kconfig kconfigwidgets kcoreaddons kdbusaddons
+    kdeclarative kdelibs4support ki18n kiconthemes kio kpackage kservice
+    kwayland kwidgetsaddons kxmlgui libraw1394 libGLU pciutils solid
+  ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kmenuedit.nix b/nixpkgs/pkgs/desktops/plasma-5/kmenuedit.nix
new file mode 100644
index 000000000000..016ea940d99b
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kmenuedit.nix
@@ -0,0 +1,14 @@
+{
+  mkDerivation,
+  extra-cmake-modules, kdoctools,
+  kdbusaddons, kdelibs4support, khotkeys, ki18n, kiconthemes, kio, kxmlgui,
+  sonnet
+}:
+
+mkDerivation {
+  name = "kmenuedit";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    kdbusaddons kdelibs4support khotkeys ki18n kiconthemes kio kxmlgui sonnet
+  ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kscreen.nix b/nixpkgs/pkgs/desktops/plasma-5/kscreen.nix
new file mode 100644
index 000000000000..422bb95c6059
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kscreen.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation,
+  extra-cmake-modules,
+  kconfig, kconfigwidgets, kdbusaddons, kglobalaccel, ki18n, kwidgetsaddons,
+  kxmlgui, libkscreen, qtdeclarative, qtgraphicaleffects, kwindowsystem, 
+  kdeclarative, plasma-framework
+}:
+
+mkDerivation {
+  name = "kscreen";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    kconfig kconfigwidgets kdbusaddons kglobalaccel ki18n kwidgetsaddons kxmlgui
+    libkscreen qtdeclarative qtgraphicaleffects kwindowsystem kdeclarative
+    plasma-framework
+  ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kscreenlocker.nix b/nixpkgs/pkgs/desktops/plasma-5/kscreenlocker.nix
new file mode 100644
index 000000000000..e748121132c1
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kscreenlocker.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation,
+  extra-cmake-modules, kdoctools,
+  kcmutils, kcrash, kdeclarative, kdelibs4support, kglobalaccel, kidletime,
+  kwayland, libXcursor, pam, plasma-framework, qtdeclarative, qtx11extras,
+  wayland,
+}:
+
+mkDerivation {
+  name = "kscreenlocker";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    kcmutils kcrash kdeclarative kdelibs4support kglobalaccel kidletime kwayland
+    libXcursor pam plasma-framework qtdeclarative qtx11extras wayland
+  ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/ksshaskpass.nix b/nixpkgs/pkgs/desktops/plasma-5/ksshaskpass.nix
new file mode 100644
index 000000000000..39e260f6c708
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/ksshaskpass.nix
@@ -0,0 +1,11 @@
+{
+  mkDerivation,
+  extra-cmake-modules, kdoctools,
+  kcoreaddons, ki18n, kwallet, kwidgetsaddons, qtbase,
+}:
+
+mkDerivation {
+  name = "ksshaskpass";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [ kcoreaddons ki18n kwallet kwidgetsaddons qtbase ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/ksysguard.nix b/nixpkgs/pkgs/desktops/plasma-5/ksysguard.nix
new file mode 100644
index 000000000000..150b97be50d7
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/ksysguard.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation,
+  extra-cmake-modules, kdoctools,
+  lm_sensors,
+  kconfig, kcoreaddons, kdelibs4support, ki18n, kiconthemes, kitemviews,
+  knewstuff, libksysguard, qtwebkit
+}:
+
+mkDerivation {
+  name = "ksysguard";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    kconfig kcoreaddons kitemviews knewstuff kiconthemes libksysguard
+    kdelibs4support ki18n lm_sensors qtwebkit
+  ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kwallet-pam.nix b/nixpkgs/pkgs/desktops/plasma-5/kwallet-pam.nix
new file mode 100644
index 000000000000..1cbfb87ea563
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kwallet-pam.nix
@@ -0,0 +1,10 @@
+{ mkDerivation, lib, extra-cmake-modules, pam, socat, libgcrypt, qtbase, }:
+
+mkDerivation {
+  name = "kwallet-pam";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ pam socat libgcrypt qtbase ];
+  postPatch = ''
+    sed -i pam_kwallet_init -e "s|socat|${lib.getBin socat}/bin/socat|"
+  '';
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kwayland-integration.nix b/nixpkgs/pkgs/desktops/plasma-5/kwayland-integration.nix
new file mode 100644
index 000000000000..1344b477f736
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kwayland-integration.nix
@@ -0,0 +1,11 @@
+{
+  mkDerivation,
+  extra-cmake-modules,
+  kidletime, kwayland, kwindowsystem, qtbase,
+}:
+
+mkDerivation {
+  name = "kwayland-integration";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ kidletime kwindowsystem kwayland qtbase ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kwin/default.nix b/nixpkgs/pkgs/desktops/plasma-5/kwin/default.nix
new file mode 100644
index 000000000000..b8f381e97149
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kwin/default.nix
@@ -0,0 +1,46 @@
+{
+  mkDerivation, lib, copyPathsToStore,
+  extra-cmake-modules, kdoctools,
+
+  epoxy,libICE, libSM, libinput, libxkbcommon, udev, wayland, xcb-util-cursor,
+  xwayland,
+
+  qtdeclarative, qtmultimedia, qtscript, qtx11extras,
+
+  breeze-qt5, kactivities, kcompletion, kcmutils, kconfig, kconfigwidgets,
+  kcoreaddons, kcrash, kdeclarative, kdecoration, kglobalaccel, ki18n,
+  kiconthemes, kidletime, kinit, kio, knewstuff, knotifications, kpackage,
+  kscreenlocker, kservice, kwayland, kwidgetsaddons, kwindowsystem, kxmlgui,
+  plasma-framework, qtsensors, libcap, libdrm
+}:
+
+mkDerivation {
+  name = "kwin";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    epoxy libICE libSM libinput libxkbcommon udev wayland xcb-util-cursor
+    xwayland
+
+    qtdeclarative qtmultimedia qtscript qtx11extras qtsensors
+
+    breeze-qt5 kactivities kcmutils kcompletion kconfig kconfigwidgets
+    kcoreaddons kcrash kdeclarative kdecoration kglobalaccel ki18n kiconthemes
+    kidletime kinit kio knewstuff knotifications kpackage kscreenlocker kservice
+    kwayland kwidgetsaddons kwindowsystem kxmlgui plasma-framework
+    libcap libdrm
+  ];
+  outputs = [ "bin" "dev" "out" ];
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+  CXXFLAGS = [
+    ''-DNIXPKGS_XWAYLAND=\"${lib.getBin xwayland}/bin/Xwayland\"''
+  ];
+  cmakeFlags = [ "-DCMAKE_SKIP_BUILD_RPATH=OFF" ];
+  postInstall = ''
+    # Some package(s) refer to these service types by the wrong name.
+    # I would prefer to patch those packages, but I cannot find them!
+    ln -s ''${!outputBin}/share/kservicetypes5/kwineffect.desktop \
+          ''${!outputBin}/share/kservicetypes5/kwin-effect.desktop
+    ln -s ''${!outputBin}/share/kservicetypes5/kwinscript.desktop \
+          ''${!outputBin}/share/kservicetypes5/kwin-script.desktop
+  '';
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kwin/follow-symlinks.patch b/nixpkgs/pkgs/desktops/plasma-5/kwin/follow-symlinks.patch
new file mode 100644
index 000000000000..60b8f5ef541f
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kwin/follow-symlinks.patch
@@ -0,0 +1,13 @@
+Index: kwin-5.7.3/plugins/kdecorations/aurorae/src/aurorae.cpp
+===================================================================
+--- kwin-5.7.3.orig/plugins/kdecorations/aurorae/src/aurorae.cpp
++++ kwin-5.7.3/plugins/kdecorations/aurorae/src/aurorae.cpp
+@@ -211,7 +211,7 @@ void Helper::init()
+     // so let's try to locate our plugin:
+     QString pluginPath;
+     for (const QString &path : m_engine->importPathList()) {
+-        QDirIterator it(path, QDirIterator::Subdirectories);
++        QDirIterator it(path, QDirIterator::Subdirectories | QDirIterator::FollowSymlinks);
+         while (it.hasNext()) {
+             it.next();
+             QFileInfo fileInfo = it.fileInfo();
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kwin/no-setcap-install.patch b/nixpkgs/pkgs/desktops/plasma-5/kwin/no-setcap-install.patch
new file mode 100644
index 000000000000..80aacacc6ca0
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kwin/no-setcap-install.patch
@@ -0,0 +1,24 @@
+Dont set capabilities on kwin_wayland executable at build time
+
+This is handled by security.wrappers on NixOS
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 48cbcdbfe..93b410ed8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -674,15 +674,6 @@ if (HAVE_LIBCAP)
+ endif()
+
+ install(TARGETS kwin_wayland         ${INSTALL_TARGETS_DEFAULT_ARGS} )
+-if (HAVE_LIBCAP)
+-    install(
+-    CODE "execute_process(
+-            COMMAND
+-                ${SETCAP_EXECUTABLE}
+-                CAP_SYS_NICE=+ep
+-                \$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/kwin_wayland)"
+-    )
+-endif()
+
+ add_subdirectory(platformsupport)
+ add_subdirectory(plugins)
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kwin/series b/nixpkgs/pkgs/desktops/plasma-5/kwin/series
new file mode 100644
index 000000000000..8efb74eabd67
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kwin/series
@@ -0,0 +1,3 @@
+follow-symlinks.patch
+xwayland.patch
+no-setcap-install.patch
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kwin/xwayland.patch b/nixpkgs/pkgs/desktops/plasma-5/kwin/xwayland.patch
new file mode 100644
index 000000000000..51f15c87d274
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kwin/xwayland.patch
@@ -0,0 +1,13 @@
+Index: kwin-5.7.3/main_wayland.cpp
+===================================================================
+--- kwin-5.7.3.orig/main_wayland.cpp
++++ kwin-5.7.3/main_wayland.cpp
+@@ -315,7 +315,7 @@ void ApplicationWayland::startXwaylandSe
+ 
+     m_xwaylandProcess = new Process(kwinApp());
+     m_xwaylandProcess->setProcessChannelMode(QProcess::ForwardedErrorChannel);
+-    m_xwaylandProcess->setProgram(QStringLiteral("Xwayland"));
++    m_xwaylandProcess->setProgram(QLatin1String(NIXPKGS_XWAYLAND));
+     QProcessEnvironment env = m_environment;
+     env.insert("WAYLAND_SOCKET", QByteArray::number(wlfd));
+     m_xwaylandProcess->setProcessEnvironment(env);
diff --git a/nixpkgs/pkgs/desktops/plasma-5/kwrited.nix b/nixpkgs/pkgs/desktops/plasma-5/kwrited.nix
new file mode 100644
index 000000000000..f6f6187e9462
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/kwrited.nix
@@ -0,0 +1,11 @@
+{
+  mkDerivation,
+  extra-cmake-modules,
+  kcoreaddons, kdbusaddons, ki18n, knotifications, kpty, qtbase,
+}:
+
+mkDerivation {
+  name = "kwrited";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ kcoreaddons kdbusaddons ki18n knotifications kpty qtbase ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/libkscreen/default.nix b/nixpkgs/pkgs/desktops/plasma-5/libkscreen/default.nix
new file mode 100644
index 000000000000..5625aa656ceb
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/libkscreen/default.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, lib, copyPathsToStore, propagate,
+  extra-cmake-modules,
+  kwayland, libXrandr, qtx11extras
+}:
+
+mkDerivation {
+  name = "libkscreen";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [ kwayland libXrandr qtx11extras ];
+  outputs = [ "out" "dev" ];
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+  preConfigure = ''
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_LIBKSCREEN_BACKENDS=\"''${!outputBin}/$qtPluginPrefix/kf5/kscreen\""
+  '';
+  setupHook = propagate "out";
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/libkscreen/libkscreen-backends-path.patch b/nixpkgs/pkgs/desktops/plasma-5/libkscreen/libkscreen-backends-path.patch
new file mode 100644
index 000000000000..48be0d037df5
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/libkscreen/libkscreen-backends-path.patch
@@ -0,0 +1,27 @@
+Index: libkscreen-5.9.4/src/backendmanager.cpp
+===================================================================
+--- libkscreen-5.9.4.orig/src/backendmanager.cpp
++++ libkscreen-5.9.4/src/backendmanager.cpp
+@@ -178,17 +178,11 @@ QFileInfo BackendManager::preferredBacke
+ QFileInfoList BackendManager::listBackends()
+ {
+     // Compile a list of installed backends first
+-    const QString backendFilter = QStringLiteral("KSC_*");
+-    const QStringList paths = QCoreApplication::libraryPaths();
+-    QFileInfoList finfos;
+-    for (const QString &path : paths) {
+-        const QDir dir(path + QLatin1String("/kf5/kscreen/"),
+-                       backendFilter,
+-                       QDir::SortFlags(QDir::QDir::Name),
+-                       QDir::NoDotAndDotDot | QDir::Files);
+-        finfos.append(dir.entryInfoList());
+-    }
+-    return finfos;
++    const QDir dir(QLatin1String(NIXPKGS_LIBKSCREEN_BACKENDS),
++                   QStringLiteral("KSC_*"),
++                   QDir::SortFlags(QDir::QDir::Name),
++                   QDir::NoDotAndDotDot | QDir::Files);
++    return dir.entryInfoList();
+ }
+ 
+ KScreen::AbstractBackend *BackendManager::loadBackendPlugin(QPluginLoader *loader, const QString &name,
diff --git a/nixpkgs/pkgs/desktops/plasma-5/libkscreen/series b/nixpkgs/pkgs/desktops/plasma-5/libkscreen/series
new file mode 100644
index 000000000000..86bf4ab10602
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/libkscreen/series
@@ -0,0 +1 @@
+libkscreen-backends-path.patch
diff --git a/nixpkgs/pkgs/desktops/plasma-5/libksysguard/0001-qdiriterator-follow-symlinks.patch b/nixpkgs/pkgs/desktops/plasma-5/libksysguard/0001-qdiriterator-follow-symlinks.patch
new file mode 100644
index 000000000000..fbbb11ae7556
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/libksysguard/0001-qdiriterator-follow-symlinks.patch
@@ -0,0 +1,25 @@
+From 46164a50de4102d02ae9d1d480acdd4b12303db8 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Wed, 14 Oct 2015 07:07:22 -0500
+Subject: [PATCH] qdiriterator follow symlinks
+
+---
+ processui/scripting.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/processui/scripting.cpp b/processui/scripting.cpp
+index efed8ff..841761a 100644
+--- a/processui/scripting.cpp
++++ b/processui/scripting.cpp
+@@ -167,7 +167,7 @@ void Scripting::loadContextMenu() {
+     QStringList scripts;
+     const QStringList dirs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "ksysguard/scripts/", QStandardPaths::LocateDirectory);
+     Q_FOREACH (const QString& dir, dirs) {
+-        QDirIterator it(dir, QStringList() << QStringLiteral("*.desktop"), QDir::NoFilter, QDirIterator::Subdirectories);
++        QDirIterator it(dir, QStringList() << QStringLiteral("*.desktop"), QDir::NoFilter, QDirIterator::Subdirectories | QDirIterator::FollowSymlinks);
+         while (it.hasNext()) {
+             scripts.append(it.next());
+         }
+-- 
+2.5.2
+
diff --git a/nixpkgs/pkgs/desktops/plasma-5/libksysguard/default.nix b/nixpkgs/pkgs/desktops/plasma-5/libksysguard/default.nix
new file mode 100644
index 000000000000..0f9fe40d73c3
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/libksysguard/default.nix
@@ -0,0 +1,21 @@
+{
+  mkDerivation,
+  extra-cmake-modules,
+  kauth, kcompletion, kconfig, kconfigwidgets, kcoreaddons, ki18n, kiconthemes,
+  kservice, kwidgetsaddons, kwindowsystem, plasma-framework, qtscript, qtwebkit,
+  qtx11extras
+}:
+
+mkDerivation {
+  name = "libksysguard";
+  patches = [
+    ./0001-qdiriterator-follow-symlinks.patch
+  ];
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    kauth kconfig ki18n kiconthemes kwindowsystem kcompletion kconfigwidgets
+    kcoreaddons kservice kwidgetsaddons plasma-framework qtscript qtx11extras
+    qtwebkit
+  ];
+  outputs = [ "bin" "dev" "out" ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/milou.nix b/nixpkgs/pkgs/desktops/plasma-5/milou.nix
new file mode 100644
index 000000000000..db019db358bb
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/milou.nix
@@ -0,0 +1,15 @@
+{
+  mkDerivation,
+  extra-cmake-modules,
+  kcoreaddons, kdeclarative, ki18n, krunner, kservice, plasma-framework,
+  qtscript, qtdeclarative
+}:
+
+mkDerivation {
+  name = "milou";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    kcoreaddons kdeclarative ki18n krunner kservice plasma-framework
+    qtdeclarative qtscript
+  ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/oxygen.nix b/nixpkgs/pkgs/desktops/plasma-5/oxygen.nix
new file mode 100644
index 000000000000..1b1f34f17b53
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/oxygen.nix
@@ -0,0 +1,18 @@
+{
+  mkDerivation,
+  extra-cmake-modules,
+  frameworkintegration, kcmutils, kcompletion, kconfig, kdecoration, kguiaddons,
+  ki18n, kwidgetsaddons, kservice, kwayland, kwindowsystem, qtdeclarative,
+  qtx11extras
+}:
+
+mkDerivation {
+  name = "oxygen";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  propagatedBuildInputs = [
+    frameworkintegration kcmutils kcompletion kconfig kdecoration kguiaddons
+    ki18n kservice kwayland kwidgetsaddons kwindowsystem qtdeclarative
+    qtx11extras
+  ];
+  outputs = [ "bin" "dev" "out" ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/plasma-browser-integration.nix b/nixpkgs/pkgs/desktops/plasma-5/plasma-browser-integration.nix
new file mode 100644
index 000000000000..e01efabe8a6a
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/plasma-browser-integration.nix
@@ -0,0 +1,11 @@
+{ mkDerivation, extra-cmake-modules, qtbase, kio, ki18n, kconfig
+, kdbusaddons, knotifications, krunner, kwindowsystem, kactivities
+}:
+
+mkDerivation {
+  name = "plasma-browser-integration";
+  nativeBuildInputs = [
+    extra-cmake-modules qtbase kio ki18n kconfig kdbusaddons
+    knotifications krunner kwindowsystem kactivities
+  ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/plasma-desktop/default.nix b/nixpkgs/pkgs/desktops/plasma-5/plasma-desktop/default.nix
new file mode 100644
index 000000000000..32bd5f3a9f28
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/plasma-desktop/default.nix
@@ -0,0 +1,51 @@
+{
+  mkDerivation, lib, copyPathsToStore,
+  extra-cmake-modules, kdoctools,
+
+  boost, fontconfig, ibus, libXcursor, libXft, libcanberra_kde, libpulseaudio,
+  libxkbfile, xf86inputevdev, xf86inputsynaptics, xinput, xkeyboard_config,
+  xorgserver, utillinux,
+
+  qtdeclarative, qtquickcontrols, qtquickcontrols2, qtsvg, qtx11extras,
+
+  attica, baloo, kactivities, kactivities-stats, kauth, kcmutils, kdbusaddons,
+  kdeclarative, kded, kdelibs4support, kemoticons, kglobalaccel, ki18n,
+  kitemmodels, knewstuff, knotifications, knotifyconfig, kpeople, krunner,
+  kscreenlocker, ksysguard, kwallet, kwin, phonon, plasma-framework,
+  plasma-workspace, xf86inputlibinput
+}:
+
+mkDerivation rec {
+  name = "plasma-desktop";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    boost fontconfig ibus libcanberra_kde libpulseaudio libXcursor libXft
+    libxkbfile phonon xf86inputevdev xf86inputsynaptics xinput xkeyboard_config
+
+    qtdeclarative qtquickcontrols qtquickcontrols2 qtsvg qtx11extras
+
+    attica baloo kactivities kactivities-stats kauth kcmutils kdbusaddons
+    kdeclarative kded kdelibs4support kemoticons kglobalaccel ki18n kitemmodels
+    knewstuff knotifications knotifyconfig kpeople krunner kscreenlocker
+    ksysguard kwallet kwin plasma-framework plasma-workspace
+  ];
+
+  patches = copyPathsToStore (lib.readPathsFromFile ./. ./series);
+  postPatch = ''
+    sed '1i#include <cmath>' -i kcms/touchpad/src/backends/x11/synapticstouchpad.cpp
+  '';
+  CXXFLAGS = [
+    "-I${lib.getDev xorgserver}/include/xorg"
+    ''-DNIXPKGS_HWCLOCK=\"${lib.getBin utillinux}/sbin/hwclock\"''
+  ];
+  cmakeFlags = [
+    "-DEvdev_INCLUDE_DIRS=${lib.getDev xf86inputevdev}/include/xorg"
+    "-DSynaptics_INCLUDE_DIRS=${lib.getDev xf86inputsynaptics}/include/xorg"
+    "-DXORGLIBINPUT_INCLUDE_DIRS=${lib.getDev xf86inputlibinput}/include/xorg"
+  ];
+  postInstall = ''
+    # Display ~/Desktop contents on the desktop by default.
+    sed -i "''${!outputBin}/share/plasma/shells/org.kde.plasma.desktop/contents/defaults" \
+        -e 's/Containment=org.kde.desktopcontainment/Containment=org.kde.plasma.folder/'
+  '';
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/plasma-desktop/hwclock-path.patch b/nixpkgs/pkgs/desktops/plasma-5/plasma-desktop/hwclock-path.patch
new file mode 100644
index 000000000000..a46212af10fb
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/plasma-desktop/hwclock-path.patch
@@ -0,0 +1,24 @@
+Index: plasma-desktop-5.8.5/kcms/dateandtime/helper.cpp
+===================================================================
+--- plasma-desktop-5.8.5.orig/kcms/dateandtime/helper.cpp
++++ plasma-desktop-5.8.5/kcms/dateandtime/helper.cpp
+@@ -48,10 +48,6 @@
+ #include <sys/stat.h>
+ #endif
+ 
+-// We cannot rely on the $PATH environment variable, because D-Bus activation
+-// clears it. So we have to use a reasonable default.
+-static const QString exePath = QStringLiteral("/usr/sbin:/usr/bin:/sbin:/bin");
+-
+ int ClockHelper::ntp( const QStringList& ntpServers, bool ntpEnabled )
+ {
+     int ret = 0;
+@@ -227,7 +223,7 @@ int ClockHelper::tzreset()
+ 
+ void ClockHelper::toHwclock()
+ {
+-    QString hwclock = KStandardDirs::findExe(QStringLiteral("hwclock"), exePath);
++    QString hwclock = QLatin1String(NIXPKGS_HWCLOCK);
+     if (!hwclock.isEmpty()) {
+         KProcess::execute(hwclock, QStringList() << QStringLiteral("--systohc"));
+     }
diff --git a/nixpkgs/pkgs/desktops/plasma-5/plasma-desktop/series b/nixpkgs/pkgs/desktops/plasma-5/plasma-desktop/series
new file mode 100644
index 000000000000..26517ba93565
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/plasma-desktop/series
@@ -0,0 +1,2 @@
+hwclock-path.patch
+tzdir.patch
diff --git a/nixpkgs/pkgs/desktops/plasma-5/plasma-desktop/tzdir.patch b/nixpkgs/pkgs/desktops/plasma-5/plasma-desktop/tzdir.patch
new file mode 100644
index 000000000000..97504b330fed
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/plasma-desktop/tzdir.patch
@@ -0,0 +1,18 @@
+Index: plasma-desktop-5.8.5/kcms/dateandtime/helper.cpp
+===================================================================
+--- plasma-desktop-5.8.5.orig/kcms/dateandtime/helper.cpp
++++ plasma-desktop-5.8.5/kcms/dateandtime/helper.cpp
+@@ -181,7 +181,12 @@ int ClockHelper::tz( const QString& sele
+ 
+     val = selectedzone;
+ #else
+-    QString tz = "/usr/share/zoneinfo/" + selectedzone;
++    QString tzdir = QString::fromLocal8Bit(qgetenv("TZDIR"));
++    QString tz = tzdir + "/" + selectedzone;
++    if (tzdir.isEmpty()) {
++      // Standard Linux path
++      tz = "/usr/share/zoneinfo/" + selectedzone;
++    }
+ 
+     if (QFile::exists(tz)) { // make sure the new TZ really exists
+         QFile::remove(QStringLiteral("/etc/localtime"));
diff --git a/nixpkgs/pkgs/desktops/plasma-5/plasma-integration/default.nix b/nixpkgs/pkgs/desktops/plasma-5/plasma-integration/default.nix
new file mode 100644
index 000000000000..f69644287624
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/plasma-integration/default.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation,
+  extra-cmake-modules,
+  breeze-qt5, kconfig, kconfigwidgets, kiconthemes, kio, knotifications,
+  kwayland, libXcursor, qtquickcontrols2
+}:
+
+# TODO: install Noto Sans and Oxygen Mono fonts with plasma-integration
+
+mkDerivation {
+  name = "plasma-integration";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  buildInputs = [
+    breeze-qt5 kconfig kconfigwidgets kiconthemes kio knotifications kwayland
+    libXcursor qtquickcontrols2
+  ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/plasma-nm/0001-mobile-broadband-provider-info-path.patch b/nixpkgs/pkgs/desktops/plasma-5/plasma-nm/0001-mobile-broadband-provider-info-path.patch
new file mode 100644
index 000000000000..79b5cfb437e2
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/plasma-nm/0001-mobile-broadband-provider-info-path.patch
@@ -0,0 +1,25 @@
+From faf13c97ff1192a201843b9d52f4002dbd9022af Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@gmail.com>
+Date: Sun, 25 Oct 2015 09:09:27 -0500
+Subject: [PATCH] mobile-broadband-provider-info path
+
+---
+ libs/editor/mobileproviders.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/libs/editor/mobileproviders.cpp b/libs/editor/mobileproviders.cpp
+index 568cb34..98a5992 100644
+--- a/libs/editor/mobileproviders.cpp
++++ b/libs/editor/mobileproviders.cpp
+@@ -26,7 +26,7 @@
+ 
+ #include <KLocale>
+ 
+-const QString MobileProviders::ProvidersFile = "/usr/share/mobile-broadband-provider-info/serviceproviders.xml";
++const QString MobileProviders::ProvidersFile = "@mobile_broadband_provider_info@/share/mobile-broadband-provider-info/serviceproviders.xml";
+ 
+ bool localeAwareCompare(const QString & one, const QString & two) {
+     return one.localeAwareCompare(two) < 0;
+-- 
+2.6.2
+
diff --git a/nixpkgs/pkgs/desktops/plasma-5/plasma-nm/0002-openvpn-binary-path.patch b/nixpkgs/pkgs/desktops/plasma-5/plasma-nm/0002-openvpn-binary-path.patch
new file mode 100644
index 000000000000..3bc871f09063
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/plasma-nm/0002-openvpn-binary-path.patch
@@ -0,0 +1,13 @@
+diff --git a/vpn/openvpn/openvpnadvancedwidget.cpp b/vpn/openvpn/openvpnadvancedwidget.cpp
+index 2f11ba1d..310f11b4 100644
+--- a/vpn/openvpn/openvpnadvancedwidget.cpp
++++ b/vpn/openvpn/openvpnadvancedwidget.cpp
+@@ -75,7 +75,7 @@ OpenVpnAdvancedWidget::OpenVpnAdvancedWidget(const NetworkManager::VpnSetting::P
+     connect(m_ui->cmbProxyType, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &OpenVpnAdvancedWidget::proxyTypeChanged);
+ 
+     // start openVPN process and get its cipher list
+-    const QString openVpnBinary = QStandardPaths::findExecutable("openvpn", QStringList() << "/sbin" << "/usr/sbin");
++    const QString openVpnBinary = "@openvpn@/bin/openvpn";
+     const QStringList ciphersArgs(QLatin1String("--show-ciphers"));
+     const QStringList versionArgs(QLatin1String("--version"));
+ 
diff --git a/nixpkgs/pkgs/desktops/plasma-5/plasma-nm/default.nix b/nixpkgs/pkgs/desktops/plasma-5/plasma-nm/default.nix
new file mode 100644
index 000000000000..8296d549782f
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/plasma-nm/default.nix
@@ -0,0 +1,31 @@
+{
+  mkDerivation, substituteAll,
+  extra-cmake-modules, kdoctools,
+  kcompletion, kconfigwidgets, kcoreaddons, kdbusaddons, kdeclarative,
+  kdelibs4support, ki18n, kiconthemes, kinit, kio, kitemviews, knotifications,
+  kservice, kwallet, kwidgetsaddons, kwindowsystem, kxmlgui,
+  mobile-broadband-provider-info, modemmanager-qt, networkmanager-qt,
+  openconnect, openvpn, plasma-framework, qca-qt5, qtdeclarative, qttools, solid
+}:
+
+mkDerivation {
+  name = "plasma-nm";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools qttools ];
+  buildInputs = [
+    kdeclarative kdelibs4support ki18n kio kwindowsystem plasma-framework
+    qtdeclarative kcompletion kconfigwidgets kcoreaddons kdbusaddons kiconthemes
+    kinit kitemviews knotifications kservice kwallet kwidgetsaddons kxmlgui
+    mobile-broadband-provider-info modemmanager-qt networkmanager-qt openconnect
+    qca-qt5 solid
+  ];
+  patches = [
+    (substituteAll {
+      src = ./0001-mobile-broadband-provider-info-path.patch;
+      mobile_broadband_provider_info = mobile-broadband-provider-info;
+    })
+    (substituteAll {
+      src = ./0002-openvpn-binary-path.patch;
+      inherit openvpn;
+    })
+  ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/plasma-pa.nix b/nixpkgs/pkgs/desktops/plasma-5/plasma-pa.nix
new file mode 100644
index 000000000000..b60b5298d6db
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/plasma-pa.nix
@@ -0,0 +1,15 @@
+{
+  mkDerivation,
+  extra-cmake-modules, kdoctools,
+  gconf, glib, kconfigwidgets, kcoreaddons, kdeclarative, kglobalaccel, ki18n,
+  libcanberra-gtk3, libpulseaudio, plasma-framework, qtdeclarative, kwindowsystem
+}:
+
+mkDerivation {
+  name = "plasma-pa";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    gconf glib kconfigwidgets kcoreaddons kdeclarative kglobalaccel ki18n
+    libcanberra-gtk3 libpulseaudio plasma-framework qtdeclarative kwindowsystem
+  ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/plasma-vault/cryfs-path.patch b/nixpkgs/pkgs/desktops/plasma-5/plasma-vault/cryfs-path.patch
new file mode 100644
index 000000000000..6bab35fe4a97
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/plasma-vault/cryfs-path.patch
@@ -0,0 +1,13 @@
+diff --git a/kded/engine/backends/cryfs/cryfsbackend.cpp b/kded/engine/backends/cryfs/cryfsbackend.cpp
+index 58a6929..7212980 100644
+--- a/kded/engine/backends/cryfs/cryfsbackend.cpp
++++ b/kded/engine/backends/cryfs/cryfsbackend.cpp
+@@ -241,7 +241,7 @@ QProcess *CryFsBackend::cryfs(const QStringList &arguments) const
+     auto config = KSharedConfig::openConfig(PLASMAVAULT_CONFIG_FILE);
+     KConfigGroup backendConfig(config, "CryfsBackend");
+ 
+-    return process("cryfs",
++    return process(NIXPKGS_CRYFS,
+                    arguments + backendConfig.readEntry("extraMountOptions", QStringList{}),
+                    { { "CRYFS_FRONTEND", "noninteractive" } });
+ }
diff --git a/nixpkgs/pkgs/desktops/plasma-5/plasma-vault/default.nix b/nixpkgs/pkgs/desktops/plasma-5/plasma-vault/default.nix
new file mode 100644
index 000000000000..e016944be456
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/plasma-vault/default.nix
@@ -0,0 +1,40 @@
+{
+  mkDerivation, lib,
+  extra-cmake-modules,
+
+  kactivities,
+  plasma-framework,
+  kwindowsystem,
+  networkmanager-qt,
+  libksysguard,
+
+  encfs,
+  cryfs,
+  fuse
+}:
+
+mkDerivation {
+  name = "plasma-vault";
+  nativeBuildInputs = [ extra-cmake-modules ];
+
+  patches = [
+    ./encfs-path.patch
+    ./cryfs-path.patch
+    ./fusermount-path.patch
+  ];
+
+  buildInputs = [
+    kactivities plasma-framework kwindowsystem libksysguard
+    networkmanager-qt
+  ];
+
+  CXXFLAGS = [
+    ''-DNIXPKGS_ENCFS=\"${lib.getBin encfs}/bin/encfs\"''
+    ''-DNIXPKGS_ENCFSCTL=\"${lib.getBin encfs}/bin/encfsctl\"''
+
+    ''-DNIXPKGS_CRYFS=\"${lib.getBin cryfs}/bin/cryfs\"''
+
+    ''-DNIXPKGS_FUSERMOUNT=\"${lib.getBin fuse}/bin/fusermount\"''
+  ];
+
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/plasma-vault/encfs-path.patch b/nixpkgs/pkgs/desktops/plasma-5/plasma-vault/encfs-path.patch
new file mode 100644
index 000000000000..e1c325e16934
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/plasma-vault/encfs-path.patch
@@ -0,0 +1,22 @@
+diff --git a/kded/engine/backends/encfs/encfsbackend.cpp b/kded/engine/backends/encfs/encfsbackend.cpp
+index 628af7b..6edd38e 100644
+--- a/kded/engine/backends/encfs/encfsbackend.cpp
++++ b/kded/engine/backends/encfs/encfsbackend.cpp
+@@ -137,7 +137,7 @@ QProcess *EncFsBackend::encfs(const QStringList &arguments) const
+     auto config = KSharedConfig::openConfig(PLASMAVAULT_CONFIG_FILE);
+     KConfigGroup backendConfig(config, "EncfsBackend");
+ 
+-    return process("encfs",
++    return process(NIXPKGS_ENCFS,
+                    arguments + backendConfig.readEntry("extraMountOptions", QStringList{}),
+                    {});
+ }
+@@ -146,7 +146,7 @@ QProcess *EncFsBackend::encfs(const QStringList &arguments) const
+ 
+ QProcess *EncFsBackend::encfsctl(const QStringList &arguments) const
+ {
+-    return process("encfsctl", arguments, {});
++    return process(NIXPKGS_ENCFSCTL, arguments, {});
+ }
+ 
+ 
diff --git a/nixpkgs/pkgs/desktops/plasma-5/plasma-vault/fusermount-path.patch b/nixpkgs/pkgs/desktops/plasma-5/plasma-vault/fusermount-path.patch
new file mode 100644
index 000000000000..b2a7866531bf
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/plasma-vault/fusermount-path.patch
@@ -0,0 +1,18 @@
+diff --git a/kded/engine/fusebackend_p.cpp b/kded/engine/fusebackend_p.cpp
+index d07e313..ea7d81c 100644
+--- a/kded/engine/fusebackend_p.cpp
++++ b/kded/engine/fusebackend_p.cpp
+@@ -106,7 +106,7 @@ QProcess *FuseBackend::process(const QString &executable,
+ 
+ QProcess *FuseBackend::fusermount(const QStringList &arguments) const
+ {
+-    return process("fusermount", arguments, {});
++    return process(NIXPKGS_FUSERMOUNT, arguments, {});
+ }
+ 
+ 
+@@ -279,4 +279,3 @@ bool FuseBackend::isOpened(const MountPoint &mountPoint) const
+ }
+ 
+ } // namespace PlasmaVault
+-
diff --git a/nixpkgs/pkgs/desktops/plasma-5/plasma-workspace-wallpapers.nix b/nixpkgs/pkgs/desktops/plasma-5/plasma-workspace-wallpapers.nix
new file mode 100644
index 000000000000..cb068166c1d9
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/plasma-workspace-wallpapers.nix
@@ -0,0 +1,6 @@
+{ mkDerivation , extra-cmake-modules }:
+
+mkDerivation {
+  name = "plasma-workspace-wallpapers";
+  nativeBuildInputs = [ extra-cmake-modules ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/plasma-workspace/default.nix b/nixpkgs/pkgs/desktops/plasma-5/plasma-workspace/default.nix
new file mode 100644
index 000000000000..2866cddbea18
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/plasma-workspace/default.nix
@@ -0,0 +1,81 @@
+{
+  mkDerivation, lib, fetchpatch,
+
+  extra-cmake-modules, kdoctools,
+
+  coreutils, dbus, gnugrep, gnused, isocodes, libdbusmenu, libSM, libXcursor,
+  libXtst, pam, wayland, xmessage, xprop, xrdb, xsetroot,
+
+  baloo, kactivities, kcmutils, kconfig, kcrash, kdbusaddons, kdeclarative,
+  kdelibs4support, kdesu, kglobalaccel, kidletime, kinit, kjsembed, knewstuff,
+  knotifyconfig, kpackage, krunner, kscreenlocker, ktexteditor, ktextwidgets,
+  kwallet, kwayland, kwin, kxmlrpcclient, libkscreen, libksysguard, libqalculate,
+  networkmanager-qt, phonon, plasma-framework, prison, solid, kholidays,
+  breeze-qt5,
+
+  qtgraphicaleffects, qtquickcontrols, qtquickcontrols2, qtscript, qttools,
+  qtwayland, qtx11extras,
+}:
+
+let inherit (lib) getBin getLib; in
+
+mkDerivation {
+  name = "plasma-workspace";
+
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    isocodes libdbusmenu libSM libXcursor libXtst pam wayland
+
+    baloo kactivities kcmutils kconfig kcrash kdbusaddons kdeclarative
+    kdelibs4support kdesu kglobalaccel kidletime kjsembed knewstuff
+    knotifyconfig kpackage krunner kscreenlocker ktexteditor ktextwidgets
+    kwallet kwayland kwin kxmlrpcclient libkscreen libksysguard libqalculate
+    networkmanager-qt phonon plasma-framework prison solid kholidays
+
+    qtgraphicaleffects qtquickcontrols qtquickcontrols2 qtscript qtwayland qtx11extras
+  ];
+  outputs = [ "bin" "dev" "out" ];
+
+  cmakeFlags = [
+    "-DNIXPKGS_XMESSAGE=${getBin xmessage}/bin/xmessage"
+    "-DNIXPKGS_MKDIR=${getBin coreutils}/bin/mkdir"
+    "-DNIXPKGS_XRDB=${getBin xrdb}/bin/xrdb"
+    "-DNIXPKGS_QTPATHS=${getBin qttools}/bin/qtpaths"
+    "-DNIXPKGS_XSETROOT=${getBin xsetroot}/bin/xsetroot"
+    "-DNIXPKGS_XPROP=${getBin xprop}/bin/xprop"
+    "-DNIXPKGS_ID=${getBin coreutils}/bin/id"
+    "-DNIXPKGS_DBUS_UPDATE_ACTIVATION_ENVIRONMENT=${getBin dbus}/bin/dbus-update-activation-environment"
+    "-DNIXPKGS_START_KDEINIT_WRAPPER=${getLib kinit}/lib/libexec/kf5/start_kdeinit_wrapper"
+    "-DNIXPKGS_QDBUS=${getBin qttools}/bin/qdbus"
+    "-DNIXPKGS_KWRAPPER5=${getBin kinit}/bin/kwrapper5"
+    "-DNIXPKGS_KREADCONFIG5=${getBin kconfig}/bin/kreadconfig5"
+    "-DNIXPKGS_GREP=${getBin gnugrep}/bin/grep"
+    "-DNIXPKGS_KDEINIT5_SHUTDOWN=${getBin kinit}/bin/kdeinit5_shutdown"
+    "-DNIXPKGS_SED=${getBin gnused}/bin/sed"
+    "-DNIXPKGS_WALLPAPER_INSTALL_DIR=${getBin breeze-qt5}/share/wallpapers/"
+  ];
+
+  # To regenerate ./plasma-workspace.patch,
+  #
+  # > git clone https://github.com/ttuegel/plasma-workspace
+  # > cd plasma-workspace
+  # > git checkout nixpkgs/$x.$y  # where $x.$y.$z == $version
+  # ... make some commits ...
+  # > git diff v$x.$y.$z
+  #
+  # Add upstream patches to the list below. For new patchs, particularly if not
+  # submitted upstream, please make a pull request and add it to
+  # ./plasma-workspace.patch.
+  patches = [
+    ./plasma-workspace.patch
+  ];
+
+  preConfigure = ''
+    NIX_CFLAGS_COMPILE+=" -DNIXPKGS_KDOSTARTUPCONFIG5=\"''${!outputBin}/bin/kdostartupconfig5\""
+    cmakeFlags+=" -DNIXPKGS_STARTPLASMA=''${!outputBin}/lib/libexec/startplasma"
+  '';
+
+  postInstall = ''
+    moveToOutput lib/libexec/startplasma ''${!outputBin}
+  '';
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/plasma-workspace/plasma-workspace.patch b/nixpkgs/pkgs/desktops/plasma-5/plasma-workspace/plasma-workspace.patch
new file mode 100644
index 000000000000..dd5f7321f0e2
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/plasma-workspace/plasma-workspace.patch
@@ -0,0 +1,1079 @@
+diff --git a/sddm-theme/theme.conf.cmake b/sddm-theme/theme.conf.cmake
+index 69d30705..52e91028 100644
+--- a/sddm-theme/theme.conf.cmake
++++ b/sddm-theme/theme.conf.cmake
+@@ -1,4 +1,4 @@
+ [General]
+ type=image
+ color=#1d99f3
+-background=${CMAKE_INSTALL_PREFIX}/${WALLPAPER_INSTALL_DIR}/Next/contents/images/3200x2000.png
++background=${NIXPKGS_WALLPAPER_INSTALL_DIR}/Next/contents/images/3200x2000.png
+diff --git a/startkde/CMakeLists.txt b/startkde/CMakeLists.txt
+index cb75aeca..247db953 100644
+--- a/startkde/CMakeLists.txt
++++ b/startkde/CMakeLists.txt
+@@ -3,11 +3,6 @@ add_subdirectory(kstartupconfig)
+ add_subdirectory(ksyncdbusenv)
+ add_subdirectory(waitforname)
+ 
+-#FIXME: reconsider, looks fishy
+-if(NOT CMAKE_INSTALL_PREFIX STREQUAL "/usr")
+-    set(EXPORT_XCURSOR_PATH "XCURSOR_PATH=${KDE_INSTALL_FULL_DATAROOTDIR}/icons:$XCURSOR_PATH\":~/.icons:/usr/share/icons:/usr/share/pixmaps:/usr/X11R6/lib/X11/icons\"; export XCURSOR_PATH")
+-endif()
+-
+ configure_file(startkde.cmake ${CMAKE_CURRENT_BINARY_DIR}/startkde  @ONLY)
+ configure_file(startplasmacompositor.cmake ${CMAKE_CURRENT_BINARY_DIR}/startplasmacompositor  @ONLY)
+ configure_file(startplasma.cmake ${CMAKE_CURRENT_BINARY_DIR}/startplasma  @ONLY)
+diff --git a/startkde/kstartupconfig/kstartupconfig.cpp b/startkde/kstartupconfig/kstartupconfig.cpp
+index 493218ea..d507aa55 100644
+--- a/startkde/kstartupconfig/kstartupconfig.cpp
++++ b/startkde/kstartupconfig/kstartupconfig.cpp
+@@ -147,5 +147,5 @@ int main()
+     fclose( keys );
+     fclose( config );
+   doit:
+-    return system( "kdostartupconfig5" );
++    return system( NIXPKGS_KDOSTARTUPCONFIG5 );
+     }
+diff --git a/startkde/startkde.cmake b/startkde/startkde.cmake
+index 714a9bf1..9733c612 100644
+--- a/startkde/startkde.cmake
++++ b/startkde/startkde.cmake
+@@ -1,22 +1,31 @@
+ #!/bin/sh
+ #
+-#  DEFAULT Plasma STARTUP SCRIPT ( @PROJECT_VERSION@ )
++#  NIXPKGS KDE STARTUP SCRIPT ( @PROJECT_VERSION@ )
+ #
+ 
++if test "x$1" = x--failsafe; then
++    KDE_FAILSAFE=1 # General failsafe flag
++    KWIN_COMPOSE=N # Disable KWin's compositing
++    QT_XCB_FORCE_SOFTWARE_OPENGL=1
++    export KWIN_COMPOSE KDE_FAILSAFE QT_XCB_FORCE_SOFTWARE_OPENGL
++fi
++
+ # When the X server dies we get a HUP signal from xinit. We must ignore it
+ # because we still need to do some cleanup.
+ trap 'echo GOT SIGHUP' HUP
+ 
+-# Check if a Plasma session already is running and whether it's possible to connect to X
+-kcheckrunning
++# we have to unset this for Darwin since it will screw up KDE's dynamic-loading
++unset DYLD_FORCE_FLAT_NAMESPACE
++
++# Check if a KDE session already is running and whether it's possible to connect to X
++@CMAKE_INSTALL_FULL_BINDIR@/kcheckrunning
+ kcheckrunning_result=$?
+-if test $kcheckrunning_result -eq 0 ; then
+-	echo "Plasma seems to be already running on this display."
+-	xmessage -geometry 500x100 "Plasma seems to be already running on this display." > /dev/null 2>/dev/null
+-	exit 1
+-elif test $kcheckrunning_result -eq 2 ; then
+-	echo "\$DISPLAY is not set or cannot connect to the X server."
+-        exit 1
++if [ $kcheckrunning_result -eq 0 ]; then
++    echo "KDE seems to be already running on this display."
++    exit 1
++elif [ $kcheckrunning_result -eq 2 ]; then
++    echo "\$DISPLAY is not set or cannot connect to the X server."
++    exit 1
+ fi
+ 
+ # Boot sequence:
+@@ -33,61 +42,133 @@ fi
+ #
+ # * Then ksmserver is started which takes control of the rest of the startup sequence
+ 
+-if [  ${XDG_CONFIG_HOME} ]; then
+-  configDir=$XDG_CONFIG_HOME;
+-else
+-  configDir=${HOME}/.config; #this is the default, http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
++export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
++@NIXPKGS_MKDIR@ -p "$XDG_CONFIG_HOME"
++
++# The KDE icon cache is supposed to update itself
++# automatically, but it uses the timestamp on the icon
++# theme directory as a trigger.  Since in Nix the
++# timestamp is always the same, this doesn't work.  So as
++# a workaround, nuke the icon cache on login.  This isn't
++# perfect, since it may require logging out after
++# installing new applications to update the cache.
++# See http://lists-archives.org/kde-devel/26175-what-when-will-icon-cache-refresh.html
++rm -fv $HOME/.cache/icon-cache.kcache
++
++# Qt writes a weird ‘libraryPath’ line to
++# ~/.config/Trolltech.conf that causes the KDE plugin
++# paths of previous KDE invocations to be searched.
++# Obviously using mismatching KDE libraries is potentially
++# disastrous, so here we nuke references to the Nix store
++# in Trolltech.conf.  A better solution would be to stop
++# Qt from doing this wackiness in the first place.
++if [ -e $XDG_CONFIG_HOME/Trolltech.conf ]; then
++    @NIXPKGS_SED@ -e '/nix\\store\|nix\/store/ d' -i $XDG_CONFIG_HOME/Trolltech.conf
+ fi
+ sysConfigDirs=${XDG_CONFIG_DIRS:-/etc/xdg}
+ 
+-# We need to create config folder so we can write startupconfigkeys
+-mkdir -p $configDir
++@NIXPKGS_KBUILDSYCOCA5@
++
++# Set the default GTK 2 theme
++gtkrc2="$HOME/.gtkrc-2.0"
++breeze_gtkrc2="/run/current-system/sw/share/themes/Breeze/gtk-2.0/gtkrc"
++if ! [ -e "$gtkrc2" ] && [ -e "$breeze_gtkrc2" ]; then
++    cat >"$gtkrc2" <<EOF
++# Default GTK+ 2 config for NixOS KDE 5
++include "$breeze_gtkrc2"
++style "user-font"
++{
++  font_name="Sans Serif Regular"
++}
++widget_class "*" style "user-font"
++gtk-font-name="Sans Serif Regular 10"
++gtk-theme-name="Breeze"
++gtk-icon-theme-name="breeze"
++gtk-fallback-icon-theme="hicolor"
++gtk-cursor-theme-name="breeze_cursors"
++gtk-toolbar-style=GTK_TOOLBAR_ICONS
++gtk-menu-images=1
++gtk-button-images=1
++EOF
++fi
++
++# Set the default GTK 3 theme
++gtk3_settings="$XDG_CONFIG_HOME/gtk-3.0/settings.ini"
++breeze_gtk3="/run/current-system/sw/share/themes/Breeze/gtk-3.0"
++if ! [ -e "$gtk3_settings" ] && [ -e "$breeze_gtk" ]; then
++    mkdir -p $(dirname "$gtk3_settings")
++    cat >"$gtk3_settings" <<EOF
++[Settings]
++gtk-font-name=Sans Serif Regular 10
++gtk-theme-name=Breeze
++gtk-icon-theme-name=breeze
++gtk-fallback-icon-theme=hicolor
++gtk-cursor-theme-name=breeze_cursors
++gtk-toolbar-style=GTK_TOOLBAR_ICONS
++gtk-menu-images=1
++gtk-button-images=1
++EOF
++fi
++
++kcminputrc="$XDG_CONFIG_HOME/kcminputrc"
++if ! [ -e "$kcminputrc" ]; then
++    cat >"$kcminputrc" <<EOF
++[Mouse]
++cursorTheme=breeze_cursors
++cursorSize=0
++EOF
++fi
+ 
+ #This is basically setting defaults so we can use them with kstartupconfig5
+-cat >$configDir/startupconfigkeys <<EOF
++cat >"$XDG_CONFIG_HOME/startupconfigkeys" <<EOF
+ kcminputrc Mouse cursorTheme 'breeze_cursors'
+ kcminputrc Mouse cursorSize ''
+-ksplashrc KSplash Theme Breeze
++ksplashrc KSplash Theme org.kde.breeze.desktop
+ ksplashrc KSplash Engine KSplashQML
+ kdeglobals KScreen ScreenScaleFactors ''
+ kcmfonts General forceFontDPI 0
++kcmfonts General dontChangeAASettings true
+ EOF
+ 
+ # preload the user's locale on first start
+-plasmalocalerc=$configDir/plasma-localerc
+-test -f $plasmalocalerc || {
+-cat >$plasmalocalerc <<EOF
++plasmalocalerc="$XDG_CONFIG_HOME/plasma-localerc"
++if ! [ -f "$plasmalocalerc" ]; then
++    cat >"$plasmalocalerc" <<EOF
+ [Formats]
+ LANG=$LANG
+ EOF
+-}
++fi
+ 
+ # export LC_* variables set by kcmshell5 formats into environment
+ # so it can be picked up by QLocale and friends.
+-exportformatssettings=$configDir/plasma-locale-settings.sh
+-test -f $exportformatssettings && {
+-    . $exportformatssettings
+-}
++exportformatssettings="$XDG_CONFIG_HOME/plasma-locale-settings.sh"
++if [ -r "$exportformatssettings" ]; then
++    . "$exportformatssettings"
++fi
+ 
+ # Write a default kdeglobals file to set up the font
+-kdeglobalsfile=$configDir/kdeglobals
+-test -f $kdeglobalsfile || {
+-cat >$kdeglobalsfile <<EOF
++kdeglobalsfile="$XDG_CONFIG_HOME/kdeglobals"
++if ! [ -f "$kdeglobalsfile" ]; then
++    cat >"$kdeglobalsfile" <<EOF
+ [General]
+-XftAntialias=true
+-XftHintStyle=hintmedium
+-XftSubPixel=none
++fixed=Monospace,10,-1,5,50,0,0,0,0,0,Regular
++font=Sans Serif,10,-1,5,50,0,0,0,0,0,Regular
++menuFont=Sans Serif,10,-1,5,50,0,0,0,0,0,Regular
++smallestReadableFont=Sans Serif,8,-1,5,50,0,0,0,0,0,Regular
++toolBarFont=Sans Serif,8,-1,5,50,0,0,0,0,0,Regular
++
++[WM]
++activeFont=Noto Sans,12,-1,5,50,0,0,0,0,0,Bold
+ EOF
+-}
++fi
+ 
+-kstartupconfig5
+-returncode=$?
+-if test $returncode -ne 0; then
+-    xmessage -geometry 500x100 "kstartupconfig5 does not exist or fails. The error code is $returncode. Check your installation."
++if ! @CMAKE_INSTALL_FULL_BINDIR@/kstartupconfig5; then
++    echo "kstartupconfig5 does not exist or fails. The error code is $returncode. Check your installation." 1>&2
+     exit 1
+ fi
+-[ -r $configDir/startupconfig ] && . $configDir/startupconfig
+-
++if [ -r "$XDG_CONFIG_HOME/startupconfig" ]; then
++    . "$XDG_CONFIG_HOME/startupconfig"
++fi
+ 
+ #Do not sync any of this section with the wayland versions as there scale factors are
+ #sent properly over wl_output
+@@ -99,26 +180,33 @@ fi
+ #otherwise apps that manually opt in for high DPI get auto scaled by the developer AND manually scaled by us
+ export QT_AUTO_SCREEN_SCALE_FACTOR=0
+ 
++#Set the QtQuickControls style to our own: for QtQuickControls1
++#it will fall back to Desktop, while it will use our own org.kde.desktop
++#for QtQuickControlsStyle and Kirigami
++export QT_QUICK_CONTROLS_STYLE=org.kde.desktop
++
++XCURSOR_PATH=~/.icons
++IFS=":" read -r -a xdgDirs <<< "$XDG_DATA_DIRS"
++for xdgDir in "${xdgDirs[@]}"; do
++    XCURSOR_PATH="$XCURSOR_PATH:$xdgDir/icons"
++done
++export XCURSOR_PATH
++
+ # XCursor mouse theme needs to be applied here to work even for kded or ksmserver
+ if test -n "$kcminputrc_mouse_cursortheme" -o -n "$kcminputrc_mouse_cursorsize" ; then
+-    @EXPORT_XCURSOR_PATH@
+-
+     kapplymousetheme "$kcminputrc_mouse_cursortheme" "$kcminputrc_mouse_cursorsize"
+-    if test $? -eq 10; then
+-        XCURSOR_THEME=breeze_cursors
+-        export XCURSOR_THEME
+-    elif test -n "$kcminputrc_mouse_cursortheme"; then
+-        XCURSOR_THEME="$kcminputrc_mouse_cursortheme"
+-        export XCURSOR_THEME
++    if [ $? -eq 10 ]; then
++        export XCURSOR_THEME=breeze_cursors
++    elif [ -n "$kcminputrc_mouse_cursortheme" ]; then
++        export XCURSOR_THEME="$kcminputrc_mouse_cursortheme"
+     fi
+-    if test -n "$kcminputrc_mouse_cursorsize"; then
+-        XCURSOR_SIZE="$kcminputrc_mouse_cursorsize"
+-        export XCURSOR_SIZE
++    if [ -n "$kcminputrc_mouse_cursorsize" ]; then
++        export XCURSOR_SIZE="$kcminputrc_mouse_cursorsize"
+     fi
+ fi
+ 
+-if test "$kcmfonts_general_forcefontdpi" -ne 0; then
+-    xrdb -quiet -merge -nocpp <<EOF
++if [ "${kcmfonts_general_forcefontdpi:-0}" -ne 0 ]; then
++    @NIXPKGS_XRDB@ -quiet -merge -nocpp <<EOF
+ Xft.dpi: $kcmfonts_general_forcefontdpi
+ EOF
+ fi
+@@ -127,11 +215,11 @@ dl=$DESKTOP_LOCKED
+ unset DESKTOP_LOCKED # Don't want it in the environment
+ 
+ ksplash_pid=
+-if test -z "$dl"; then
++if [ -z "$dl" ]; then
+   # the splashscreen and progress indicator
+   case "$ksplashrc_ksplash_engine" in
+     KSplashQML)
+-      ksplash_pid=`ksplashqml "${ksplashrc_ksplash_theme}" --pid`
++      ksplash_pid=$(@CMAKE_INSTALL_FULL_BINDIR@/ksplashqml "${ksplashrc_ksplash_theme}" --pid)
+       ;;
+     None)
+       ;;
+@@ -140,69 +228,6 @@ if test -z "$dl"; then
+   esac
+ fi
+ 
+-# Source scripts found in <config locations>/plasma-workspace/env/*.sh
+-# (where <config locations> correspond to the system and user's configuration
+-# directory.
+-#
+-# This is where you can define environment variables that will be available to
+-# all KDE programs, so this is where you can run agents using e.g. eval `ssh-agent`
+-# or eval `gpg-agent --daemon`.
+-# Note: if you do that, you should also put "ssh-agent -k" as a shutdown script
+-#
+-# (see end of this file).
+-# For anything else (that doesn't set env vars, or that needs a window manager),
+-# better use the Autostart folder.
+-
+-scriptpath=`echo "$configDir:$sysConfigDirs" | tr ':' '\n'`
+-
+-for prefix in `echo $scriptpath`; do
+-  for file in "$prefix"/plasma-workspace/env/*.sh; do
+-    test -r "$file" && . "$file" || true
+-  done
+-done
+-
+-# Activate the kde font directories.
+-#
+-# There are 4 directories that may be used for supplying fonts for KDE.
+-#
+-# There are two system directories. These belong to the administrator.
+-# There are two user directories, where the user may add her own fonts.
+-#
+-# The 'override' versions are for fonts that should come first in the list,
+-# i.e. if you have a font in your 'override' directory, it will be used in
+-# preference to any other.
+-#
+-# The preference order looks like this:
+-# user override, system override, X, user, system
+-#
+-# Where X is the original font database that was set up before this script
+-# runs.
+-
+-usr_odir=$HOME/.fonts/kde-override
+-usr_fdir=$HOME/.fonts
+-
+-if test -n "$KDEDIRS"; then
+-  kdedirs_first=`echo "$KDEDIRS"|sed -e 's/:.*//'`
+-  sys_odir=$kdedirs_first/share/fonts/override
+-  sys_fdir=$kdedirs_first/share/fonts
+-else
+-  sys_odir=$KDEDIR/share/fonts/override
+-  sys_fdir=$KDEDIR/share/fonts
+-fi
+-
+-# We run mkfontdir on the user's font dirs (if we have permission) to pick
+-# up any new fonts they may have installed. If mkfontdir fails, we still
+-# add the user's dirs to the font path, as they might simply have been made
+-# read-only by the administrator, for whatever reason.
+-
+-test -d "$sys_odir" && xset +fp "$sys_odir"
+-test -d "$usr_odir" && (mkfontdir "$usr_odir" ; xset +fp "$usr_odir")
+-test -d "$usr_fdir" && (mkfontdir "$usr_fdir" ; xset fp+ "$usr_fdir")
+-test -d "$sys_fdir" && xset fp+ "$sys_fdir"
+-
+-# Ask X11 to rebuild its font list.
+-xset fp rehash
+-
+ # Set a left cursor instead of the standard X11 "X" cursor, since I've heard
+ # from some users that they're confused and don't know what to do. This is
+ # especially necessary on slow machines, where starting KDE takes one or two
+@@ -257,44 +282,65 @@ export XDG_DATA_DIRS
+ #
+ KDE_FULL_SESSION=true
+ export KDE_FULL_SESSION
+-xprop -root -f KDE_FULL_SESSION 8t -set KDE_FULL_SESSION true
++@NIXPKGS_XPROP@ -root -f KDE_FULL_SESSION 8t -set KDE_FULL_SESSION true
+ 
+ KDE_SESSION_VERSION=5
+ export KDE_SESSION_VERSION
+-xprop -root -f KDE_SESSION_VERSION 32c -set KDE_SESSION_VERSION 5
++@NIXPKGS_XPROP@ -root -f KDE_SESSION_VERSION 32c -set KDE_SESSION_VERSION 5
+ 
+-KDE_SESSION_UID=`id -ru`
++KDE_SESSION_UID=$(@NIXPKGS_ID@ -ru)
+ export KDE_SESSION_UID
+ 
+ XDG_CURRENT_DESKTOP=KDE
+ export XDG_CURRENT_DESKTOP
+ 
++# Enforce xcb QPA. Helps switching between Wayland and X sessions.
++export QT_QPA_PLATFORM=xcb
++
++# Source scripts found in <config locations>/plasma-workspace/env/*.sh
++# (where <config locations> correspond to the system and user's configuration
++# directories, as identified by Qt's qtpaths,  e.g.  $HOME/.config
++# and /etc/xdg/ on Linux)
++#
++# This is where you can define environment variables that will be available to
++# all KDE programs, so this is where you can run agents using e.g. eval `ssh-agent`
++# or eval `gpg-agent --daemon`.
++# Note: if you do that, you should also put "ssh-agent -k" as a shutdown script
++#
++# (see end of this file).
++# For anything else (that doesn't set env vars, or that needs a window manager),
++# better use the Autostart folder.
++
++IFS=":" read -r -a scriptpath <<< $(@NIXPKGS_QTPATHS@ --paths GenericConfigLocation)
++# Add /env/ to the directory to locate the scripts to be sourced
++for prefix in "${scriptpath[@]}"; do
++    for file in "$prefix"/plasma-workspace/env/*.sh; do
++        if [ -r "$file" ]; then
++            . "$file"
++        fi
++    done
++done
++
+ # At this point all environment variables are set, let's send it to the DBus session server to update the activation environment
+-if which dbus-update-activation-environment >/dev/null 2>/dev/null ; then
+-    dbus-update-activation-environment --systemd --all
+-else
+-    @CMAKE_INSTALL_FULL_LIBEXECDIR@/ksyncdbusenv
+-fi
+-if test $? -ne 0; then
++
++if ! @NIXPKGS_DBUS_UPDATE_ACTIVATION_ENVIRONMENT@ --systemd --all; then
+   # Startup error
+   echo 'startkde: Could not sync environment to dbus.'  1>&2
+   test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
+-  xmessage -geometry 500x100 "Could not sync environment to dbus."
+   exit 1
+ fi
+ 
+ # We set LD_BIND_NOW to increase the efficiency of kdeinit.
+ # kdeinit unsets this variable before loading applications.
+-LD_BIND_NOW=true @CMAKE_INSTALL_FULL_LIBEXECDIR_KF5@/start_kdeinit_wrapper --kded +kcminit_startup
++LD_BIND_NOW=true @NIXPKGS_START_KDEINIT_WRAPPER@ --kded +kcminit_startup
+ if test $? -ne 0; then
+   # Startup error
+   echo 'startkde: Could not start kdeinit5. Check your installation.'  1>&2
+   test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
+-  xmessage -geometry 500x100 "Could not start kdeinit5. Check your installation."
+   exit 1
+ fi
+ 
+-qdbus org.kde.KSplash /KSplash org.kde.KSplash.setStage kinit &
++@NIXPKGS_QDBUS@ org.kde.KSplash /KSplash org.kde.KSplash.setStage kinit &
+ 
+ # finally, give the session control to the session manager
+ # see kdebase/ksmserver for the description of the rest of the startup sequence
+@@ -306,12 +352,16 @@ qdbus org.kde.KSplash /KSplash org.kde.KSplash.setStage kinit &
+ # We only check for 255 which means that the ksmserver process could not be
+ # started, any problems thereafter, e.g. ksmserver failing to initialize,
+ # will remain undetected.
+-test -n "$KDEWM" && KDEWM="--windowmanager $KDEWM"
++if [ -n "$KDEWM" ]; then
++    KDEWM="--windowmanager $KDEWM"
++fi
+ # If the session should be locked from the start (locked autologin),
+ # lock now and do the rest of the KDE startup underneath the locker.
+ KSMSERVEROPTIONS=""
+-test -n "$dl" && KSMSERVEROPTIONS=" --lockscreen"
+-kwrapper5 @CMAKE_INSTALL_FULL_BINDIR@/ksmserver $KDEWM $KSMSERVEROPTIONS
++if [ -n "$dl" ]; then
++    KSMSERVEROPTIONS=" --lockscreen"
++fi
++@NIXPKGS_KWRAPPER5@ @CMAKE_INSTALL_FULL_BINDIR@/ksmserver $KDEWM $KSMSERVEROPTIONS
+ if test $? -eq 255; then
+   # Startup error
+   echo 'startkde: Could not start ksmserver. Check your installation.'  1>&2
+@@ -322,36 +372,36 @@ fi
+ #Anything after here is logout
+ #It is not called after shutdown/restart
+ 
+-wait_drkonqi=`kreadconfig5 --file startkderc --group WaitForDrKonqi --key Enabled --default true`
++wait_drkonqi=$(@NIXPKGS_KREADCONFIG5@ --file startkderc --group WaitForDrKonqi --key Enabled --default true)
+ 
+-if test x"$wait_drkonqi"x = x"true"x ; then
++if [ x"$wait_drkonqi"x = x"true"x ]; then
+     # wait for remaining drkonqi instances with timeout (in seconds)
+-    wait_drkonqi_timeout=`kreadconfig5 --file startkderc --group WaitForDrKonqi --key Timeout --default 900`
++    wait_drkonqi_timeout=$(@NIXPKGS_KREADCONFIG5@ --file startkderc --group WaitForDrKonqi --key Timeout --default 900)
+     wait_drkonqi_counter=0
+-    while qdbus | grep "^[^w]*org.kde.drkonqi" > /dev/null ; do
++    while @NIXPKGS_QDBUS@ | @NIXPKGS_GREP@ -q "^[^w]*org.kde.drkonqi" ; do
+         sleep 5
+         wait_drkonqi_counter=$((wait_drkonqi_counter+5))
+-        if test "$wait_drkonqi_counter" -ge "$wait_drkonqi_timeout" ; then
++        if [ "$wait_drkonqi_counter" -ge "$wait_drkonqi_timeout" ]; then
+             # ask remaining drkonqis to die in a graceful way
+-            qdbus | grep 'org.kde.drkonqi-' | while read address ; do
+-                qdbus "$address" "/MainApplication" "quit"
+-            done
+-            break
++            @NIXPKGS_QDBUS@ | @NIXPKGS_GREP@ 'org.kde.drkonqi-' | while read address ; do
++                @NIXPKGS_QDBUS@ "$address" "/MainApplication" "quit"
+         fi
+     done
+ fi
+ 
+ echo 'startkde: Shutting down...'  1>&2
+ # just in case
+-test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
++if [ -n "$ksplash_pid" ]; then
++    kill "$ksplash_pid" 2>/dev/null
++fi
+ 
+ # Clean up
+-kdeinit5_shutdown
++@NIXPKGS_KDEINIT5_SHUTDOWN@
+ 
+ unset KDE_FULL_SESSION
+-xprop -root -remove KDE_FULL_SESSION
++@NIXPKGS_XPROP@ -root -remove KDE_FULL_SESSION
+ unset KDE_SESSION_VERSION
+-xprop -root -remove KDE_SESSION_VERSION
++@NIXPKGS_XPROP@ -root -remove KDE_SESSION_VERSION
+ unset KDE_SESSION_UID
+ 
+ echo 'startkde: Done.'  1>&2
+diff --git a/startkde/startplasma.cmake b/startkde/startplasma.cmake
+index de98541c..39c0b521 100644
+--- a/startkde/startplasma.cmake
++++ b/startkde/startplasma.cmake
+@@ -1,6 +1,6 @@
+ #!/bin/sh
+ #
+-#  DEFAULT Plasma STARTUP SCRIPT ( @PROJECT_VERSION@ )
++#  NIXPKGS Plasma STARTUP SCRIPT ( @PROJECT_VERSION@ )
+ #
+ 
+ # Boot sequence:
+@@ -17,28 +17,26 @@
+ #
+ # * Then ksmserver is started which takes control of the rest of the startup sequence
+ 
+-# We need to create config folder so we can write startupconfigkeys
+-if [  ${XDG_CONFIG_HOME} ]; then
+-  configDir=$XDG_CONFIG_HOME;
+-else
+-  configDir=${HOME}/.config; #this is the default, http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
++export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
++if [ -r "$XDG_CONFIG_HOME/startupconfig" ]; then
++    . "$XDG_CONFIG_HOME/startupconfig"
+ fi
+ 
+-[ -r $configDir/startupconfig ] && . $configDir/startupconfig
+-
+-xrdb -quiet -merge -nocpp <<EOF
++if [ "$kcmfonts_general_forcefontdpi" -ne 0 ]; then
++    @NIXPKGS_XRDB@ -quiet -merge -nocpp <<EOF
+ Xft.dpi: $QT_WAYLAND_FORCE_DPI
+ EOF
++fi
+ 
+ dl=$DESKTOP_LOCKED
+ unset DESKTOP_LOCKED # Don't want it in the environment
+ 
+ ksplash_pid=
+-if test -z "$dl"; then
++if [ -z "$dl" ]; then
+   # the splashscreen and progress indicator
+   case "$ksplashrc_ksplash_engine" in
+     KSplashQML)
+-      ksplash_pid=`ksplashqml "${ksplashrc_ksplash_theme}" --pid`
++      ksplash_pid=$(@CMAKE_INSTALL_FULL_BINDIR@/ksplashqml "${ksplashrc_ksplash_theme}" --pid)
+       ;;
+     None)
+       ;;
+@@ -50,48 +48,6 @@ fi
+ #In wayland we want Plasma to use Qt's scaling
+ export PLASMA_USE_QT_SCALING=1
+ 
+-# Activate the kde font directories.
+-#
+-# There are 4 directories that may be used for supplying fonts for KDE.
+-#
+-# There are two system directories. These belong to the administrator.
+-# There are two user directories, where the user may add her own fonts.
+-#
+-# The 'override' versions are for fonts that should come first in the list,
+-# i.e. if you have a font in your 'override' directory, it will be used in
+-# preference to any other.
+-#
+-# The preference order looks like this:
+-# user override, system override, X, user, system
+-#
+-# Where X is the original font database that was set up before this script
+-# runs.
+-
+-usr_odir=$HOME/.fonts/kde-override
+-usr_fdir=$HOME/.fonts
+-
+-if test -n "$KDEDIRS"; then
+-  kdedirs_first=`echo "$KDEDIRS"|sed -e 's/:.*//'`
+-  sys_odir=$kdedirs_first/share/fonts/override
+-  sys_fdir=$kdedirs_first/share/fonts
+-else
+-  sys_odir=$KDEDIR/share/fonts/override
+-  sys_fdir=$KDEDIR/share/fonts
+-fi
+-
+-# We run mkfontdir on the user's font dirs (if we have permission) to pick
+-# up any new fonts they may have installed. If mkfontdir fails, we still
+-# add the user's dirs to the font path, as they might simply have been made
+-# read-only by the administrator, for whatever reason.
+-
+-test -d "$sys_odir" && xset +fp "$sys_odir"
+-test -d "$usr_odir" && (mkfontdir "$usr_odir" ; xset +fp "$usr_odir")
+-test -d "$usr_fdir" && (mkfontdir "$usr_fdir" ; xset fp+ "$usr_fdir")
+-test -d "$sys_fdir" && xset fp+ "$sys_fdir"
+-
+-# Ask X11 to rebuild its font list.
+-xset fp rehash
+-
+ # Set a left cursor instead of the standard X11 "X" cursor, since I've heard
+ # from some users that they're confused and don't know what to do. This is
+ # especially necessary on slow machines, where starting KDE takes one or two
+@@ -100,22 +56,13 @@ xset fp rehash
+ # If the user has overwritten fonts, the cursor font may be different now
+ # so don't move this up.
+ #
+-xsetroot -cursor_name left_ptr
+-
+-# Get Ghostscript to look into user's KDE fonts dir for additional Fontmap
+-if test -n "$GS_LIB" ; then
+-    GS_LIB=$usr_fdir:$GS_LIB
+-    export GS_LIB
+-else
+-    GS_LIB=$usr_fdir
+-    export GS_LIB
+-fi
++@NIXPKGS_XSETROOT@ -cursor_name left_ptr
+ 
+ echo 'startplasma: Starting up...'  1>&2
+ 
+ # export our session variables to the Xwayland server
+-xprop -root -f KDE_FULL_SESSION 8t -set KDE_FULL_SESSION true
+-xprop -root -f KDE_SESSION_VERSION 32c -set KDE_SESSION_VERSION 5
++@NIXPKGS_XPROP@ -root -f KDE_FULL_SESSION 8t -set KDE_FULL_SESSION true
++@NIXPKGS_XPROP@ -root -f KDE_SESSION_VERSION 32c -set KDE_SESSION_VERSION 5
+ 
+ # At this point all environment variables are set, let's send it to the DBus session server to update the activation environment
+ if which dbus-update-activation-environment >/dev/null 2>/dev/null ; then
+@@ -131,16 +78,15 @@ fi
+ 
+ # We set LD_BIND_NOW to increase the efficiency of kdeinit.
+ # kdeinit unsets this variable before loading applications.
+-LD_BIND_NOW=true @CMAKE_INSTALL_FULL_LIBEXECDIR_KF5@/start_kdeinit_wrapper --kded +kcminit_startup
++LD_BIND_NOW=true @NIXPKGS_START_KDEINIT_WRAPPER@ --kded +kcminit_startup
+ if test $? -ne 0; then
+   # Startup error
+   echo 'startplasma: Could not start kdeinit5. Check your installation.'  1>&2
+   test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
+-  xmessage -geometry 500x100 "Could not start kdeinit5. Check your installation."
+   exit 1
+ fi
+ 
+-qdbus org.kde.KSplash /KSplash org.kde.KSplash.setStage kinit &
++@NIXPKGS_QDBUS@ org.kde.KSplash /KSplash org.kde.KSplash.setStage kinit &
+ 
+ # finally, give the session control to the session manager
+ # see kdebase/ksmserver for the description of the rest of the startup sequence
+@@ -166,19 +112,19 @@ fi
+ #Anything after here is logout
+ #It is not called after shutdown/restart
+ 
+-wait_drkonqi=`kreadconfig5 --file startkderc --group WaitForDrKonqi --key Enabled --default true`
+-
+-if test x"$wait_drkonqi"x = x"true"x ; then
++wait_drkonqi=$(@NIXPKGS_KREADCONFIG5@ --file startkderc --group WaitForDrKonqi --key Enabled --default true)
++ 
++if [ x"$wait_drkonqi"x = x"true"x ]; then
+     # wait for remaining drkonqi instances with timeout (in seconds)
+-    wait_drkonqi_timeout=`kreadconfig5 --file startkderc --group WaitForDrKonqi --key Timeout --default 900`
++    wait_drkonqi_timeout=$(@NIXPKGS_KREADCONFIG5@ --file startkderc --group WaitForDrKonqi --key Timeout --default 900)
+     wait_drkonqi_counter=0
+-    while qdbus | grep "^[^w]*org.kde.drkonqi" > /dev/null ; do
++    while @NIXPKGS_QDBUS@ | @NIXPKGS_GREP@ -q "^[^w]*org.kde.drkonqi" ; do
+         sleep 5
+         wait_drkonqi_counter=$((wait_drkonqi_counter+5))
+-        if test "$wait_drkonqi_counter" -ge "$wait_drkonqi_timeout" ; then
++        if [ "$wait_drkonqi_counter" -ge "$wait_drkonqi_timeout" ]; then
+             # ask remaining drkonqis to die in a graceful way
+-            qdbus | grep 'org.kde.drkonqi-' | while read address ; do
+-                qdbus "$address" "/MainApplication" "quit"
++            @NIXPKGS_QDBUS@ | @NIXPKGS_GREP@ 'org.kde.drkonqi-' | while read address ; do
++                @NIXPKGS_QDBUS@ "$address" "/MainApplication" "quit"
+             done
+             break
+         fi
+@@ -187,15 +133,17 @@ fi
+ 
+ echo 'startplasma: Shutting down...'  1>&2
+ # just in case
+-test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
++if [ -n "$ksplash_pid" ]; then
++ "$ksplash_pid" 2>/dev/null
++fi
+ 
+ # Clean up
+-kdeinit5_shutdown
++@NIXPKGS_KDEINIT5_SHUTDOWN@
+ 
+ unset KDE_FULL_SESSION
+-xprop -root -remove KDE_FULL_SESSION
++@NIXPKGS_XPROP@ -root -remove KDE_FULL_SESSION
+ unset KDE_SESSION_VERSION
+-xprop -root -remove KDE_SESSION_VERSION
++@NIXPKGS_XPROP@ -root -remove KDE_SESSION_VERSION
+ unset KDE_SESSION_UID
+ 
+ echo 'startplasma: Done.'  1>&2
+diff --git a/startkde/startplasmacompositor.cmake b/startkde/startplasmacompositor.cmake
+index dd9e304d..12132f9e 100644
+--- a/startkde/startplasmacompositor.cmake
++++ b/startkde/startplasmacompositor.cmake
+@@ -1,118 +1,165 @@
+ #!/bin/sh
+ #
+-#  DEFAULT Plasma STARTUP SCRIPT ( @PROJECT_VERSION@ )
++#  NIXPKGS Plasma STARTUP SCRIPT ( @PROJECT_VERSION@ )
+ #
+ 
+-# We need to create config folder so we can write startupconfigkeys
+-if [  ${XDG_CONFIG_HOME} ]; then
+-  configDir=$XDG_CONFIG_HOME;
+-else
+-  configDir=${HOME}/.config; #this is the default, http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
++# we have to unset this for Darwin since it will screw up KDE's dynamic-loading
++unset DYLD_FORCE_FLAT_NAMESPACE
++
++export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
++@NIXPKGS_MKDIR@ -p "$XDG_CONFIG_HOME"
++
++# The KDE icon cache is supposed to update itself
++# automatically, but it uses the timestamp on the icon
++# theme directory as a trigger.  Since in Nix the
++# timestamp is always the same, this doesn't work.  So as
++# a workaround, nuke the icon cache on login.  This isn't
++# perfect, since it may require logging out after
++# installing new applications to update the cache.
++# See http://lists-archives.org/kde-devel/26175-what-when-will-icon-cache-refresh.html
++rm -fv $HOME/.cache/icon-cache.kcache
++
++# Qt writes a weird ‘libraryPath’ line to
++# ~/.config/Trolltech.conf that causes the KDE plugin
++# paths of previous KDE invocations to be searched.
++# Obviously using mismatching KDE libraries is potentially
++# disastrous, so here we nuke references to the Nix store
++# in Trolltech.conf.  A better solution would be to stop
++# Qt from doing this wackiness in the first place.
++if [ -e $XDG_CONFIG_HOME/Trolltech.conf ]; then
++    @NIXPKGS_SED@ -e '/nix\\store\|nix\/store/ d' -i $XDG_CONFIG_HOME/Trolltech.conf
++fi
++
++@NIXPKGS_KBUILDSYCOCA5@
++
++# Set the default GTK 2 theme
++gtkrc2="$HOME/.gtkrc-2.0"
++breeze_gtkrc2="/run/current-system/sw/share/themes/Breeze/gtk-2.0/gtkrc"
++if ! [ -e "$gtkrc2" ] && [ -e "$breeze_gtkrc2" ]; then
++    cat >"$gtkrc2" <<EOF
++# Default GTK+ 2 config for NixOS KDE 5
++include "$breeze_gtkrc2"
++style "user-font"
++{
++  font_name="Sans Serif Regular"
++}
++widget_class "*" style "user-font"
++gtk-font-name="Sans Serif Regular 10"
++gtk-theme-name="Breeze"
++gtk-icon-theme-name="breeze"
++gtk-fallback-icon-theme="hicolor"
++gtk-cursor-theme-name="breeze_cursors"
++gtk-toolbar-style=GTK_TOOLBAR_ICONS
++gtk-menu-images=1
++gtk-button-images=1
++EOF
+ fi
+ sysConfigDirs=${XDG_CONFIG_DIRS:-/etc/xdg}
+ 
+-# We need to create config folder so we can write startupconfigkeys
+-mkdir -p $configDir
++# Set the default GTK 3 theme
++gtk3_settings="$XDG_CONFIG_HOME/gtk-3.0/settings.ini"
++breeze_gtk3="/run/current-system/sw/share/themes/Breeze/gtk-3.0"
++if ! [ -e "$gtk3_settings" ] && [ -e "$breeze_gtk" ]; then
++    mkdir -p $(dirname "$gtk3_settings")
++    cat >"$gtk3_settings" <<EOF
++[Settings]
++gtk-font-name=Sans Serif Regular 10
++gtk-theme-name=Breeze
++gtk-icon-theme-name=breeze
++gtk-fallback-icon-theme=hicolor
++gtk-cursor-theme-name=breeze_cursors
++gtk-toolbar-style=GTK_TOOLBAR_ICONS
++gtk-menu-images=1
++gtk-button-images=1
++EOF
++fi
++
++kcminputrc="$XDG_CONFIG_HOME/kcminputrc"
++if ! [ -e "$kcminputrc" ]; then
++    cat >"$kcminputrc" <<EOF
++[Mouse]
++cursorTheme=breeze_cursors
++cursorSize=0
++EOF
++fi
+ 
+ #This is basically setting defaults so we can use them with kstartupconfig5
+-cat >$configDir/startupconfigkeys <<EOF
++cat >"$XDG_CONFIG_HOME/startupconfigkeys" <<EOF
+ kcminputrc Mouse cursorTheme 'breeze_cursors'
+ kcminputrc Mouse cursorSize ''
+-ksplashrc KSplash Theme Breeze
++ksplashrc KSplash Theme org.kde.breeze.desktop
+ ksplashrc KSplash Engine KSplashQML
+-kcmfonts General forceFontDPIWayland 0
++kdeglobals KScreen ScreenScaleFactors ''
++kcmfonts General forceFontDPI 0
++kcmfonts General dontChangeAASettings true
+ EOF
+ 
+ # preload the user's locale on first start
+-plasmalocalerc=$configDir/plasma-localerc
+-test -f $plasmalocalerc || {
+-cat >$plasmalocalerc <<EOF
++plasmalocalerc="$XDG_CONFIG_HOME/plasma-localerc"
++if ! [ -f "$plasmalocalerc" ]; then
++    cat >"$plasmalocalerc" <<EOF
+ [Formats]
+ LANG=$LANG
+ EOF
+-}
++fi
+ 
+ # export LC_* variables set by kcmshell5 formats into environment
+ # so it can be picked up by QLocale and friends.
+-exportformatssettings=$configDir/plasma-locale-settings.sh
+-test -f $exportformatssettings && {
+-    . $exportformatssettings
+-}
++exportformatssettings="$XDG_CONFIG_HOME/plasma-locale-settings.sh"
++if [ -r "$exportformatssettings" ]; then
++    . "$exportformatssettings"
++fi
+ 
+ # Write a default kdeglobals file to set up the font
+-kdeglobalsfile=$configDir/kdeglobals
+-test -f $kdeglobalsfile || {
+-cat >$kdeglobalsfile <<EOF
++kdeglobalsfile="$XDG_CONFIG_HOME/kdeglobals"
++if ! [ -f "$kdeglobalsfile" ]; then
++    cat >"$kdeglobalsfile" <<EOF
+ [General]
+-XftAntialias=true
+-XftHintStyle=hintmedium
+-XftSubPixel=none
++fixed=Monospace,10,-1,5,50,0,0,0,0,0,Regular
++font=Sans Serif,10,-1,5,50,0,0,0,0,0,Regular
++menuFont=Sans Serif,10,-1,5,50,0,0,0,0,0,Regular
++smallestReadableFont=Sans Serif,8,-1,5,50,0,0,0,0,0,Regular
++toolBarFont=Sans Serif,8,-1,5,50,0,0,0,0,0,Regular
++
++[WM]
++activeFont=Noto Sans,12,-1,5,50,0,0,0,0,0,Bold
+ EOF
+-}
+-
+-# Make sure the Oxygen font is installed
+-# This is necessary for setups where CMAKE_INSTALL_PREFIX
+-# is not in /usr. fontconfig looks in /usr, ~/.fonts and
+-# $XDG_DATA_HOME for fonts. In this case, we symlink the
+-# Oxygen font under ${XDG_DATA_HOME} and make it known to
+-# fontconfig
+-
+-usr_share="/usr/share"
+-install_share="@KDE_INSTALL_FULL_DATADIR@"
+-
+-if [ ! $install_share = $usr_share ]; then
+-
+-    if [ ${XDG_DATA_HOME} ]; then
+-        fontsDir="${XDG_DATA_HOME}/fonts"
+-    else
+-        fontsDir="${HOME}/.fonts"
+-    fi
+-
+-    test -d $fontsDir || {
+-        mkdir -p $fontsDir
+-    }
+-
+-    oxygenDir=$fontsDir/truetype/oxygen
+-    prefixDir="@KDE_INSTALL_FULL_DATADIR@/fonts/truetype/oxygen"
+-
+-    # if the oxygen dir doesn't exist, create a symlink to be sure that the
+-    # Oxygen font is available to the user
+-    test -d $oxygenDir || test -d $prefixDir && {
+-        test -h $oxygenDir || ln -s $prefixDir $oxygenDir && fc-cache $oxygenDir
+-    }
+ fi
+ 
+-kstartupconfig5
++@CMAKE_INSTALL_FULL_BINDIR@/kstartupconfig5
+ returncode=$?
+ if test $returncode -ne 0; then
+     exit 1
+ fi
+-[ -r $configDir/startupconfig ] && . $configDir/startupconfig
++if [ -r "$XDG_CONFIG_HOME/startupconfig" ]; then
++    . "$XDG_CONFIG_HOME/startupconfig"
++fi
+ 
+ #Manually disable auto scaling because we are scaling above
+ #otherwise apps that manually opt in for high DPI get auto scaled by the developer AND scaled by the wl_output
+ export QT_AUTO_SCREEN_SCALE_FACTOR=0
+ 
+-# XCursor mouse theme needs to be applied here to work even for kded or ksmserver
+-if test -n "$kcminputrc_mouse_cursortheme" -o -n "$kcminputrc_mouse_cursorsize" ; then
+-    @EXPORT_XCURSOR_PATH@
++XCURSOR_PATH=~/.icons
++IFS=":" read -r -a xdgDirs <<< "$XDG_DATA_DIRS"
++for xdgDir in "${xdgDirs[@]}"; do
++    XCURSOR_PATH="$XCURSOR_PATH:$xdgDir/icons"
++done
++export XCURSOR_PATH
+ 
+-    # TODO: is kapplymousetheme a core app?
++# XCursor mouse theme needs to be applied here to work even for kded or ksmserver
++if [ -n "$kcminputrc_mouse_cursortheme" -o -n "$kcminputrc_mouse_cursorsize" ]; then
+     #kapplymousetheme "$kcminputrc_mouse_cursortheme" "$kcminputrc_mouse_cursorsize"
+-    if test $? -eq 10; then
+-        XCURSOR_THEME=breeze_cursors
+-        export XCURSOR_THEME
+-    elif test -n "$kcminputrc_mouse_cursortheme"; then
+-        XCURSOR_THEME="$kcminputrc_mouse_cursortheme"
+-        export XCURSOR_THEME
++    if [ $? -eq 10 ]; then
++        export XCURSOR_THEME=breeze_cursors
++    elif [ -n "$kcminputrc_mouse_cursortheme" ]; then
++        export XCURSOR_THEME="$kcminputrc_mouse_cursortheme"
+     fi
+-    if test -n "$kcminputrc_mouse_cursorsize"; then
+-        XCURSOR_SIZE="$kcminputrc_mouse_cursorsize"
+-        export XCURSOR_SIZE
++    if [ -n "$kcminputrc_mouse_cursorsize" ]; then
++        export XCURSOR_SIZE="$kcminputrc_mouse_cursorsize"
+     fi
+ fi
+ 
+-if test "$kcmfonts_general_forcefontdpiwayland" -ne 0; then
++if [ "${kcmfonts_general_forcefontdpiwayland:-0}" -ne 0 ]; then
+     export QT_WAYLAND_FORCE_DPI=$kcmfonts_general_forcefontdpiwayland
+ else
+     export QT_WAYLAND_FORCE_DPI=96
+@@ -120,12 +167,12 @@ fi
+ 
+ # Get a property value from org.freedesktop.locale1
+ queryLocale1() {
+-    qdbus --system org.freedesktop.locale1 /org/freedesktop/locale1 "$1"
++    @NIXPKGS_QDBUS@ --system org.freedesktop.locale1 /org/freedesktop/locale1 "$1"
+ }
+ 
+ # Query whether org.freedesktop.locale1 is available. If it is, try to
+ # set XKB_DEFAULT_{MODEL,LAYOUT,VARIANT,OPTIONS} accordingly.
+-if qdbus --system org.freedesktop.locale1 >/dev/null 2>/dev/null; then
++if @NIXPKGS_QDBUS@ --system org.freedesktop.locale1 >/dev/null 2>/dev/null; then
+     # Do not overwrite existing values. There is no point in setting only some
+     # of them as then they would not match anymore.
+     if [ -z "${XKB_DEFAULT_MODEL}" -a -z "${XKB_DEFAULT_LAYOUT}" -a \
+@@ -141,41 +188,10 @@ if qdbus --system org.freedesktop.locale1 >/dev/null 2>/dev/null; then
+     fi
+ fi
+ 
+-# Source scripts found in <config locations>/plasma-workspace/env/*.sh
+-# (where <config locations> correspond to the system and user's configuration
+-# directories, as identified by Qt's qtpaths,  e.g.  $HOME/.config
+-# and /etc/xdg/ on Linux)
+-#
+-# This is where you can define environment variables that will be available to
+-# all KDE programs, so this is where you can run agents using e.g. eval `ssh-agent`
+-# or eval `gpg-agent --daemon`.
+-# Note: if you do that, you should also put "ssh-agent -k" as a shutdown script
+-#
+-# (see end of this file).
+-# For anything else (that doesn't set env vars, or that needs a window manager),
+-# better use the Autostart folder.
+-
+-scriptpath=`echo "$configDir:$sysConfigDirs" | tr ':' '\n'`
+-
+-for prefix in `echo $scriptpath`; do
+-  for file in "$prefix"/plasma-workspace/env/*.sh; do
+-    test -r "$file" && . "$file" || true
+-  done
+-done
+-
+ echo 'startplasmacompositor: Starting up...'  1>&2
+ 
+-# Make sure that the KDE prefix is first in XDG_DATA_DIRS and that it's set at all.
+-# The spec allows XDG_DATA_DIRS to be not set, but X session startup scripts tend
+-# to set it to a list of paths *not* including the KDE prefix if it's not /usr or
+-# /usr/local.
+-if test -z "$XDG_DATA_DIRS"; then
+-XDG_DATA_DIRS="@KDE_INSTALL_FULL_DATADIR@:/usr/share:/usr/local/share"
+-fi
+-export XDG_DATA_DIRS
+-
+ # Make sure that D-Bus is running
+-if qdbus >/dev/null 2>/dev/null; then
++if @NIXPKGS_QDBUS@ >/dev/null 2>/dev/null; then
+     : # ok
+ else
+     echo 'startplasmacompositor: Could not start D-Bus. Can you call qdbus?'  1>&2
+@@ -212,26 +228,47 @@ export KDE_FULL_SESSION
+ KDE_SESSION_VERSION=5
+ export KDE_SESSION_VERSION
+ 
+-KDE_SESSION_UID=`id -ru`
++KDE_SESSION_UID=$(@NIXPKGS_ID@ -ru)
+ export KDE_SESSION_UID
+ 
+ XDG_CURRENT_DESKTOP=KDE
+ export XDG_CURRENT_DESKTOP
+ 
++# Source scripts found in <config locations>/plasma-workspace/env/*.sh
++# (where <config locations> correspond to the system and user's configuration
++# directories, as identified by Qt's qtpaths,  e.g.  $HOME/.config
++# and /etc/xdg/ on Linux)
++#
++# This is where you can define environment variables that will be available to
++# all KDE programs, so this is where you can run agents using e.g. eval `ssh-agent`
++# or eval `gpg-agent --daemon`.
++# Note: if you do that, you should also put "ssh-agent -k" as a shutdown script
++#
++# (see end of this file).
++# For anything else (that doesn't set env vars, or that needs a window manager),
++# better use the Autostart folder.
++
++IFS=":" read -r -a scriptpath <<< $(@NIXPKGS_QTPATHS@ --paths GenericConfigLocation)
++# Add /env/ to the directory to locate the scripts to be sourced
++for prefix in "${scriptpath[@]}"; do
++    for file in "$prefix"/plasma-workspace/env/*.sh; do
++        if [ -r "$file" ]; then
++            . "$file"
++        fi
++    done
++done
++
+ # kwin_wayland can possibly also start dbus-activated services which need env variables.
+ # In that case, the update in startplasma might be too late.
+-if which dbus-update-activation-environment >/dev/null 2>/dev/null ; then
+-    dbus-update-activation-environment --systemd --all
+-else
+-    @CMAKE_INSTALL_FULL_LIBEXECDIR@/ksyncdbusenv
+-fi
+-if test $? -ne 0; then
+-  # Startup error
+-  echo 'startplasmacompositor: Could not sync environment to dbus.'  1>&2
+-  exit 1
++if ! @NIXPKGS_DBUS_UPDATE_ACTIVATION_ENVIRONMENT@ --systemd --all; then
++    # Startup error
++    echo 'startkde: Could not sync environment to dbus.'  1>&2
++    test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
++    echo 'startplasmacompositor: Could not sync environment to dbus.'  1>&2
++    exit 1
+ fi
+ 
+-@KWIN_WAYLAND_BIN_PATH@ --xwayland --libinput --exit-with-session=@CMAKE_INSTALL_FULL_LIBEXECDIR@/startplasma
++@KWIN_WAYLAND_BIN_PATH@ --xwayland --libinput --exit-with-session=@NIXPKGS_STARTPLASMA@
+ 
+ echo 'startplasmacompositor: Shutting down...'  1>&2
+ 
diff --git a/nixpkgs/pkgs/desktops/plasma-5/polkit-kde-agent.nix b/nixpkgs/pkgs/desktops/plasma-5/polkit-kde-agent.nix
new file mode 100644
index 000000000000..c25b3d2744b7
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/polkit-kde-agent.nix
@@ -0,0 +1,15 @@
+{
+  mkDerivation, extra-cmake-modules,
+  kcoreaddons, kconfig, kcrash, kdbusaddons, ki18n, kiconthemes, knotifications,
+  kwidgetsaddons, kwindowsystem, polkit-qt
+}:
+
+mkDerivation {
+  name = "polkit-kde-agent";
+  nativeBuildInputs = [ extra-cmake-modules ];
+  propagatedBuildInputs = [
+    kdbusaddons kwidgetsaddons kcoreaddons kcrash kconfig ki18n kiconthemes
+    knotifications kwindowsystem polkit-qt
+  ];
+  outputs = [ "out" "dev" ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/powerdevil.nix b/nixpkgs/pkgs/desktops/plasma-5/powerdevil.nix
new file mode 100644
index 000000000000..65fc5446c16e
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/powerdevil.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation,
+  extra-cmake-modules, kdoctools,
+  bluez-qt, kactivities, kauth, kconfig, kdbusaddons, kdelibs4support,
+  kglobalaccel, ki18n, kidletime, kio, knotifyconfig, kwayland, libkscreen,
+  networkmanager-qt, plasma-workspace, qtx11extras, solid, udev
+}:
+
+mkDerivation {
+  name = "powerdevil";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    kconfig kdbusaddons knotifyconfig solid udev bluez-qt kactivities kauth
+    kdelibs4support kglobalaccel ki18n kio kidletime kwayland libkscreen
+    networkmanager-qt plasma-workspace qtx11extras
+  ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/sddm-kcm.nix b/nixpkgs/pkgs/desktops/plasma-5/sddm-kcm.nix
new file mode 100644
index 000000000000..6becf3bf420b
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/sddm-kcm.nix
@@ -0,0 +1,16 @@
+{
+  mkDerivation, extra-cmake-modules, shared-mime-info,
+  libpthreadstubs, libXcursor, libXdmcp,
+  qtquickcontrols2, qtx11extras,
+  karchive, ki18n, kio, knewstuff
+}:
+
+mkDerivation {
+  name = "sddm-kcm";
+  nativeBuildInputs = [ extra-cmake-modules shared-mime-info ];
+  buildInputs = [
+    libpthreadstubs libXcursor libXdmcp
+    qtquickcontrols2 qtx11extras
+    karchive ki18n kio knewstuff
+  ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/srcs.nix b/nixpkgs/pkgs/desktops/plasma-5/srcs.nix
new file mode 100644
index 000000000000..9fc1c7b6a9ab
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/srcs.nix
@@ -0,0 +1,365 @@
+# DO NOT EDIT! This file is generated automatically by fetch-kde-qt.sh
+{ fetchurl, mirror }:
+
+{
+  bluedevil = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/bluedevil-5.14.4.tar.xz";
+      sha256 = "04c7nwlmwkdmqjxxy9wz2sdb9nx40vzln150iyw6bpw8vix5wwkv";
+      name = "bluedevil-5.14.4.tar.xz";
+    };
+  };
+  breeze = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/breeze-5.14.4.tar.xz";
+      sha256 = "0xdnfnvkzy96wn4y670wq1xq4jla8pqr2pwy4z4flhck61a0s7nf";
+      name = "breeze-5.14.4.tar.xz";
+    };
+  };
+  breeze-grub = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/breeze-grub-5.14.4.tar.xz";
+      sha256 = "1q21frlacgjyl5r6x32ihzsy25rihdpc18hg0qdcar1zq5hmk7b1";
+      name = "breeze-grub-5.14.4.tar.xz";
+    };
+  };
+  breeze-gtk = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/breeze-gtk-5.14.4.tar.xz";
+      sha256 = "0aqj4ap1j9pajk211pbx7a692gm89kjdfh3lpbrrsi1bnq1rcq94";
+      name = "breeze-gtk-5.14.4.tar.xz";
+    };
+  };
+  breeze-plymouth = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/breeze-plymouth-5.14.4.tar.xz";
+      sha256 = "1q9z5d96rrm8m3kjg3vi82az7a4c7h5n4mj736867nbcy4slqwk7";
+      name = "breeze-plymouth-5.14.4.tar.xz";
+    };
+  };
+  discover = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/discover-5.14.4.tar.xz";
+      sha256 = "0pivys2ygpzyi3ykyqslnh1c429f722mk5raa4h4krl8aa5cwwni";
+      name = "discover-5.14.4.tar.xz";
+    };
+  };
+  drkonqi = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/drkonqi-5.14.4.tar.xz";
+      sha256 = "1fyz5wxmilar01x94i46mzfg5nvkqanx2xsw8bwkzqmnd8ndmnmi";
+      name = "drkonqi-5.14.4.tar.xz";
+    };
+  };
+  kactivitymanagerd = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/kactivitymanagerd-5.14.4.tar.xz";
+      sha256 = "1ahfsqqgwlcsfy5d86i35kz8m90iarldnmlhsqw2bqk9al0qnsgm";
+      name = "kactivitymanagerd-5.14.4.tar.xz";
+    };
+  };
+  kde-cli-tools = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/kde-cli-tools-5.14.4.tar.xz";
+      sha256 = "11gkplnn95c78rdr0qs2hr08qv6scplsrff2nrz0n3g8sdplz2yy";
+      name = "kde-cli-tools-5.14.4.tar.xz";
+    };
+  };
+  kdecoration = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/kdecoration-5.14.4.tar.xz";
+      sha256 = "10nqshn8jj5dvrmdzn2x62lpa99d3q9wq7pv9q7lkbianlic3zzk";
+      name = "kdecoration-5.14.4.tar.xz";
+    };
+  };
+  kde-gtk-config = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/kde-gtk-config-5.14.4.tar.xz";
+      sha256 = "1dmx9pd404jy03k7wgh0xjdpxn2nmz8mbg6ysjvw1z89ggm4dxy8";
+      name = "kde-gtk-config-5.14.4.tar.xz";
+    };
+  };
+  kdeplasma-addons = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/kdeplasma-addons-5.14.4.tar.xz";
+      sha256 = "0sdrkjsh4a4i7iv49m9s8rjp40bzarq8i3w4c64w6446jz66g4j9";
+      name = "kdeplasma-addons-5.14.4.tar.xz";
+    };
+  };
+  kgamma5 = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/kgamma5-5.14.4.tar.xz";
+      sha256 = "028alj0768pc2zb7h613vcxs8zsqgd6nn4lpni4c8l25n5wzyd11";
+      name = "kgamma5-5.14.4.tar.xz";
+    };
+  };
+  khotkeys = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/khotkeys-5.14.4.tar.xz";
+      sha256 = "033syji5mwd0il6d71p3r2dgqvs3lb5ybxkjb4m54sffbb0glrx2";
+      name = "khotkeys-5.14.4.tar.xz";
+    };
+  };
+  kinfocenter = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/kinfocenter-5.14.4.tar.xz";
+      sha256 = "1nh9dg37dnl2b11l400dswaf8qf8qspck0pdr7svrncv2yn3zirc";
+      name = "kinfocenter-5.14.4.tar.xz";
+    };
+  };
+  kmenuedit = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/kmenuedit-5.14.4.tar.xz";
+      sha256 = "09lafgcxv2v745m04ljgsqgflw3j3ydx17974c1c7qfgr255994g";
+      name = "kmenuedit-5.14.4.tar.xz";
+    };
+  };
+  kscreen = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/kscreen-5.14.4.tar.xz";
+      sha256 = "1cqlhi4r1qli2izrj64x07cwz1k0qxclr0ckgkfx2lzdgp00gc96";
+      name = "kscreen-5.14.4.tar.xz";
+    };
+  };
+  kscreenlocker = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/kscreenlocker-5.14.4.tar.xz";
+      sha256 = "1fpknd22d1lr63d203k1m7w09d2dxg80a5r83jhxs439y9winwz2";
+      name = "kscreenlocker-5.14.4.tar.xz";
+    };
+  };
+  ksshaskpass = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/ksshaskpass-5.14.4.tar.xz";
+      sha256 = "1cj6w9kqjg7qxq7xdn227xy6wnmpv72s08wdphhpv1lhpafgf0pm";
+      name = "ksshaskpass-5.14.4.tar.xz";
+    };
+  };
+  ksysguard = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/ksysguard-5.14.4.tar.xz";
+      sha256 = "0gqji22k1pvs89zr6f5y71v2rma3p2ypp9ld449jn6rlizyfski1";
+      name = "ksysguard-5.14.4.tar.xz";
+    };
+  };
+  kwallet-pam = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/kwallet-pam-5.14.4.tar.xz";
+      sha256 = "15656m50xly9x7j2min813pr5lk7ymyb82is2s1lmfggrxghqjiq";
+      name = "kwallet-pam-5.14.4.tar.xz";
+    };
+  };
+  kwayland-integration = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/kwayland-integration-5.14.4.tar.xz";
+      sha256 = "02w048f366mikpbqmjpliyrali7gd2flfjbv9nfgzhld9ixx1wwq";
+      name = "kwayland-integration-5.14.4.tar.xz";
+    };
+  };
+  kwin = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/kwin-5.14.4.tar.xz";
+      sha256 = "0g9j394q7a2fk6wb2np7rjr1icdz9sr6iqjsicr881j088vxsini";
+      name = "kwin-5.14.4.tar.xz";
+    };
+  };
+  kwrited = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/kwrited-5.14.4.tar.xz";
+      sha256 = "1c8zwvc672a1z4dj8qq1wma5a8lm0kvyxki4kacx7n9xfrh54njv";
+      name = "kwrited-5.14.4.tar.xz";
+    };
+  };
+  libkscreen = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/libkscreen-5.14.4.tar.xz";
+      sha256 = "1n56fb6sxjyh73lb17s44yjlfhyqx2n3q320vncjx2jxxh0an80z";
+      name = "libkscreen-5.14.4.tar.xz";
+    };
+  };
+  libksysguard = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/libksysguard-5.14.4.tar.xz";
+      sha256 = "1nflk9vr2s2mc8ddl0rjvvh9iks4vwvf8ahlskqc068xm8ja0cr2";
+      name = "libksysguard-5.14.4.tar.xz";
+    };
+  };
+  milou = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/milou-5.14.4.tar.xz";
+      sha256 = "1dkkr5zinia1zy439rm1sdz6r8hix1l4w8bw9rwwbk6yydvp2mkf";
+      name = "milou-5.14.4.tar.xz";
+    };
+  };
+  oxygen = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/oxygen-5.14.4.tar.xz";
+      sha256 = "1rdxisnrmyywbanvchs57fr37d3ilakg83b78v8z6ji0jiy1wk0z";
+      name = "oxygen-5.14.4.tar.xz";
+    };
+  };
+  plasma-browser-integration = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/plasma-browser-integration-5.14.4.tar.xz";
+      sha256 = "0gwdi6mqfmv7hpdbhklxcxy07awvm9k22vj4wmzca3h7k334l35m";
+      name = "plasma-browser-integration-5.14.4.tar.xz";
+    };
+  };
+  plasma-desktop = {
+    version = "5.14.4.1";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/plasma-desktop-5.14.4.1.tar.xz";
+      sha256 = "0qcmqm9dag6xjfdn5zlbcpksbc70z3bwpc0dg5s315bdv2jha8c4";
+      name = "plasma-desktop-5.14.4.1.tar.xz";
+    };
+  };
+  plasma-integration = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/plasma-integration-5.14.4.tar.xz";
+      sha256 = "0jjfb0gx51zglcn59xzz8306zm55b6nsd057vkwddinq5qi3x938";
+      name = "plasma-integration-5.14.4.tar.xz";
+    };
+  };
+  plasma-nm = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/plasma-nm-5.14.4.tar.xz";
+      sha256 = "14jjaaaqbsqgzzfpz7nqk7sw1jy4dc6sxrgz46hrdf0n04ga9kxk";
+      name = "plasma-nm-5.14.4.tar.xz";
+    };
+  };
+  plasma-pa = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/plasma-pa-5.14.4.tar.xz";
+      sha256 = "18mc1aagz4b3lmv1dmabqnc4xr64j9is597lqpjc0c28gm0rnqp3";
+      name = "plasma-pa-5.14.4.tar.xz";
+    };
+  };
+  plasma-sdk = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/plasma-sdk-5.14.4.tar.xz";
+      sha256 = "1mg1229xcv0zjx85a0418ypv38q0q87xxcmmzjdqgxmhk6dx5dys";
+      name = "plasma-sdk-5.14.4.tar.xz";
+    };
+  };
+  plasma-tests = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/plasma-tests-5.14.4.tar.xz";
+      sha256 = "17imxri9n4hv27z0d7nbwvdgvc45ql224aj1gcpxmrn4p4zfc8w7";
+      name = "plasma-tests-5.14.4.tar.xz";
+    };
+  };
+  plasma-vault = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/plasma-vault-5.14.4.tar.xz";
+      sha256 = "1fwa8w95n3d25mk823q1dzyhari4fzwnnx6jwny0spcqyhzr4xcr";
+      name = "plasma-vault-5.14.4.tar.xz";
+    };
+  };
+  plasma-workspace = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/plasma-workspace-5.14.4.tar.xz";
+      sha256 = "0dmgk26wcs69py9qd6q3hg8npkbkk25fl5l6nl88x0jh9mqiyff5";
+      name = "plasma-workspace-5.14.4.tar.xz";
+    };
+  };
+  plasma-workspace-wallpapers = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/plasma-workspace-wallpapers-5.14.4.tar.xz";
+      sha256 = "1kvc0v0rjixkf4zfr9gcpmyrs62xpccv96fyw534xiw4w5pr73i6";
+      name = "plasma-workspace-wallpapers-5.14.4.tar.xz";
+    };
+  };
+  plymouth-kcm = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/plymouth-kcm-5.14.4.tar.xz";
+      sha256 = "02c7s9js3943by7s0d3lalamliq98jm26syafmn6q1wz0msza40x";
+      name = "plymouth-kcm-5.14.4.tar.xz";
+    };
+  };
+  polkit-kde-agent = {
+    version = "1-5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/polkit-kde-agent-1-5.14.4.tar.xz";
+      sha256 = "1pvyxjg1p510v6ahrab017s2sqfq3zld0xjf2yh30x55hz6pvnmb";
+      name = "polkit-kde-agent-1-5.14.4.tar.xz";
+    };
+  };
+  powerdevil = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/powerdevil-5.14.4.tar.xz";
+      sha256 = "04qyz7jncnyj65rpdriaylarsnimqhk1va98im50bsdyiya5hj33";
+      name = "powerdevil-5.14.4.tar.xz";
+    };
+  };
+  sddm-kcm = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/sddm-kcm-5.14.4.tar.xz";
+      sha256 = "03xisf0z88385zfixmah09ry53cayc4kqjn92zlqnfrc9pqnmgcz";
+      name = "sddm-kcm-5.14.4.tar.xz";
+    };
+  };
+  systemsettings = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/systemsettings-5.14.4.tar.xz";
+      sha256 = "0glyk9798kaps0fdmclchb6phpr0p315n7w9c9p8ww4b8kj4jyly";
+      name = "systemsettings-5.14.4.tar.xz";
+    };
+  };
+  user-manager = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/user-manager-5.14.4.tar.xz";
+      sha256 = "110w6n8k1zjbillcmbqy3vc43lznimns60pwh84js8mgqrjx7psb";
+      name = "user-manager-5.14.4.tar.xz";
+    };
+  };
+  xdg-desktop-portal-kde = {
+    version = "5.14.4";
+    src = fetchurl {
+      url = "${mirror}/stable/plasma/5.14.4/xdg-desktop-portal-kde-5.14.4.tar.xz";
+      sha256 = "1p2h7rqgvwzlfk9jjhsifjcdl81d72d1d7zmgxy9alc4cqnlmbih";
+      name = "xdg-desktop-portal-kde-5.14.4.tar.xz";
+    };
+  };
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/systemsettings.nix b/nixpkgs/pkgs/desktops/plasma-5/systemsettings.nix
new file mode 100644
index 000000000000..9ff906f79745
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/systemsettings.nix
@@ -0,0 +1,17 @@
+{
+  mkDerivation, extra-cmake-modules, kdoctools,
+  kcmutils, kconfig, kdbusaddons, khtml, ki18n, kiconthemes, kio, kitemviews,
+  kservice, kwindowsystem, kxmlgui, qtquickcontrols, qtquickcontrols2,
+  kactivities, kactivities-stats, kirigami2, kcrash, plasma-workspace
+}:
+
+mkDerivation {
+  name = "systemsettings";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    kcmutils kconfig kdbusaddons khtml ki18n kiconthemes kio kitemviews kservice
+    kwindowsystem kxmlgui qtquickcontrols qtquickcontrols2
+    kactivities kactivities-stats kirigami2 kcrash plasma-workspace
+  ];
+  outputs = [ "bin" "dev" "out" ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/user-manager.nix b/nixpkgs/pkgs/desktops/plasma-5/user-manager.nix
new file mode 100644
index 000000000000..f46792fc48f7
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/user-manager.nix
@@ -0,0 +1,13 @@
+{
+  mkDerivation, extra-cmake-modules, kdoctools, kcmutils, kconfig, khtml,
+  ki18n, kiconthemes, kio, kwindowsystem, libpwquality
+}:
+
+mkDerivation {
+  name = "user-manager";
+  nativeBuildInputs = [ extra-cmake-modules kdoctools ];
+  buildInputs = [
+    kcmutils kconfig khtml ki18n kiconthemes kio kwindowsystem
+    libpwquality
+  ];
+}
diff --git a/nixpkgs/pkgs/desktops/plasma-5/xdg-desktop-portal-kde.nix b/nixpkgs/pkgs/desktops/plasma-5/xdg-desktop-portal-kde.nix
new file mode 100644
index 000000000000..5fdd6bea4640
--- /dev/null
+++ b/nixpkgs/pkgs/desktops/plasma-5/xdg-desktop-portal-kde.nix
@@ -0,0 +1,13 @@
+{
+  mkDerivation,
+  extra-cmake-modules, gettext, kdoctools, python,
+  kcoreaddons, knotifications, kwayland, kwidgetsaddons
+}:
+
+mkDerivation {
+  name = "xdg-desktop-portal-kde";
+  nativeBuildInputs = [ extra-cmake-modules gettext kdoctools python ];
+  buildInputs = [
+    kcoreaddons knotifications kwayland kwidgetsaddons
+  ];
+}