about summary refs log tree commit diff
path: root/nixpkgs/pkgs/kde/plasma
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/kde/plasma')
-rw-r--r--nixpkgs/pkgs/kde/plasma/bluedevil/default.nix9
-rw-r--r--nixpkgs/pkgs/kde/plasma/breeze-grub/default.nix17
-rw-r--r--nixpkgs/pkgs/kde/plasma/breeze-gtk/0001-fix-add-executable-bit.patch25
-rw-r--r--nixpkgs/pkgs/kde/plasma/breeze-gtk/default.nix14
-rw-r--r--nixpkgs/pkgs/kde/plasma/breeze-plymouth/default.nix52
-rw-r--r--nixpkgs/pkgs/kde/plasma/breeze-plymouth/install-paths.patch19
-rw-r--r--nixpkgs/pkgs/kde/plasma/breeze/default.nix44
-rw-r--r--nixpkgs/pkgs/kde/plasma/default.nix65
-rw-r--r--nixpkgs/pkgs/kde/plasma/discover/default.nix14
-rw-r--r--nixpkgs/pkgs/kde/plasma/drkonqi/default.nix41
-rw-r--r--nixpkgs/pkgs/kde/plasma/drkonqi/gdb-path.patch28
-rw-r--r--nixpkgs/pkgs/kde/plasma/flatpak-kcm/default.nix12
-rw-r--r--nixpkgs/pkgs/kde/plasma/kactivitymanagerd/default.nix10
-rw-r--r--nixpkgs/pkgs/kde/plasma/kde-cli-tools/default.nix9
-rw-r--r--nixpkgs/pkgs/kde/plasma/kde-gtk-config/0001-gsettings-schemas-path.patch21
-rw-r--r--nixpkgs/pkgs/kde/plasma/kde-gtk-config/default.nix24
-rw-r--r--nixpkgs/pkgs/kde/plasma/kdecoration/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/kdeplasma-addons/default.nix9
-rw-r--r--nixpkgs/pkgs/kde/plasma/kgamma/default.nix9
-rw-r--r--nixpkgs/pkgs/kde/plasma/kglobalacceld/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/kinfocenter/0001-tool-paths.patch51
-rw-r--r--nixpkgs/pkgs/kde/plasma/kinfocenter/default.nix29
-rw-r--r--nixpkgs/pkgs/kde/plasma/kmenuedit/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/kpipewire/default.nix15
-rw-r--r--nixpkgs/pkgs/kde/plasma/kscreen/default.nix15
-rw-r--r--nixpkgs/pkgs/kde/plasma/kscreenlocker/default.nix10
-rw-r--r--nixpkgs/pkgs/kde/plasma/ksshaskpass/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/ksystemstats/default.nix16
-rw-r--r--nixpkgs/pkgs/kde/plasma/kwallet-pam/default.nix16
-rw-r--r--nixpkgs/pkgs/kde/plasma/kwayland-integration/default.nix6
-rw-r--r--nixpkgs/pkgs/kde/plasma/kwayland/default.nix12
-rw-r--r--nixpkgs/pkgs/kde/plasma/kwin/0001-NixOS-Unwrap-executable-name-for-.desktop-search.patch114
-rw-r--r--nixpkgs/pkgs/kde/plasma/kwin/0001-follow-symlinks.patch25
-rw-r--r--nixpkgs/pkgs/kde/plasma/kwin/0003-plugins-qpa-allow-using-nixos-wrapper.patch26
-rw-r--r--nixpkgs/pkgs/kde/plasma/kwin/default.nix54
-rw-r--r--nixpkgs/pkgs/kde/plasma/kwrited/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/layer-shell-qt/default.nix13
-rw-r--r--nixpkgs/pkgs/kde/plasma/libkscreen/default.nix12
-rw-r--r--nixpkgs/pkgs/kde/plasma/libksysguard/default.nix14
-rw-r--r--nixpkgs/pkgs/kde/plasma/libplasma/default.nix13
-rw-r--r--nixpkgs/pkgs/kde/plasma/lightdm-greeter-kde/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/milou/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/ocean-sound-theme/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/oxygen-sounds/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/oxygen/default.nix6
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-activities-stats/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-activities/default.nix10
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-browser-integration/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-desktop/default.nix67
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-desktop/hwclock-path.patch24
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-desktop/kcm-access.patch13
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-desktop/no-discover-shortcut.patch13
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-desktop/tzdir.patch18
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-disks/default.nix16
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-disks/smartctl-path.patch13
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-firewall/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-integration/default.nix67
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-integration/qml-path.patch12
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-mobile/default.nix11
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-nano/default.nix9
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-nm/0002-openvpn-binary-path.patch13
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-nm/default.nix26
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-pa/default.nix12
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-sdk/default.nix9
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-systemmonitor/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-thunderbolt/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-vault/0001-encfs-path.patch31
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-vault/0002-cryfs-path.patch25
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-vault/0003-fusermount-path.patch25
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-vault/0004-gocryptfs-path.patch13
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-vault/default.nix29
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-welcome/default.nix10
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-workspace-wallpapers/default.nix9
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-workspace/default.nix54
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-workspace/tool-paths.patch68
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma-workspace/wallpaper-paths.patch9
-rw-r--r--nixpkgs/pkgs/kde/plasma/plasma5support/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/plymouth-kcm/default.nix11
-rw-r--r--nixpkgs/pkgs/kde/plasma/polkit-kde-agent-1/default.nix9
-rw-r--r--nixpkgs/pkgs/kde/plasma/powerdevil/default.nix11
-rw-r--r--nixpkgs/pkgs/kde/plasma/print-manager/default.nix10
-rw-r--r--nixpkgs/pkgs/kde/plasma/qqc2-breeze-style/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/sddm-kcm/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/systemsettings/default.nix4
-rw-r--r--nixpkgs/pkgs/kde/plasma/wacomtablet/default.nix12
-rw-r--r--nixpkgs/pkgs/kde/plasma/xdg-desktop-portal-kde/default.nix14
86 files changed, 1614 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/kde/plasma/bluedevil/default.nix b/nixpkgs/pkgs/kde/plasma/bluedevil/default.nix
new file mode 100644
index 000000000000..993d121d1f37
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/bluedevil/default.nix
@@ -0,0 +1,9 @@
+{
+  mkKdeDerivation,
+  shared-mime-info,
+}:
+mkKdeDerivation {
+  pname = "bluedevil";
+
+  extraNativeBuildInputs = [shared-mime-info];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/breeze-grub/default.nix b/nixpkgs/pkgs/kde/plasma/breeze-grub/default.nix
new file mode 100644
index 000000000000..a5fe01b4cad7
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/breeze-grub/default.nix
@@ -0,0 +1,17 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "breeze-grub";
+
+  # doesn't actually use cmake or anything
+  nativeBuildInputs = [];
+  buildInputs = [];
+
+  installPhase = ''
+    runHook preInstall
+
+    mkdir -p "$out/grub/themes"
+    mv breeze "$out/grub/themes"
+
+    runHook postInstall
+  '';
+}
diff --git a/nixpkgs/pkgs/kde/plasma/breeze-gtk/0001-fix-add-executable-bit.patch b/nixpkgs/pkgs/kde/plasma/breeze-gtk/0001-fix-add-executable-bit.patch
new file mode 100644
index 000000000000..8ed822220598
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/breeze-gtk/0001-fix-add-executable-bit.patch
@@ -0,0 +1,25 @@
+From da6a4651f74625f4c7f3c31f1125cfa4e774780b Mon Sep 17 00:00:00 2001
+From: Yaroslav Bolyukin <iam@lach.pw>
+Date: Mon, 27 Sep 2021 22:45:58 +0300
+Subject: [PATCH] fix: add executable bit
+
+Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>
+---
+ src/CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 79ff12d..4f3d746 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -2,7 +2,7 @@ file(GLOB_RECURSE SCSS_SOURCES "*.scss")
+ file(GLOB CSS_SOURCES "*.css")
+ file(GLOB_RECURSE GTK2_SOURCES "gtk2/*")
+ 
+-configure_file(build_theme.sh.cmake ${CMAKE_CURRENT_BINARY_DIR}/build_theme.sh @ONLY)
++configure_file(build_theme.sh.cmake ${CMAKE_CURRENT_BINARY_DIR}/build_theme.sh FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE @ONLY)
+ 
+ set(SOURCES
+     ${SCSS_SOURCES}
+-- 
+2.33.0
diff --git a/nixpkgs/pkgs/kde/plasma/breeze-gtk/default.nix b/nixpkgs/pkgs/kde/plasma/breeze-gtk/default.nix
new file mode 100644
index 000000000000..fc0bc4759d48
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/breeze-gtk/default.nix
@@ -0,0 +1,14 @@
+{
+  mkKdeDerivation,
+  sass,
+  python3,
+  python3Packages,
+}:
+mkKdeDerivation {
+  pname = "breeze-gtk";
+
+  # FIXME(later): upstream
+  patches = [./0001-fix-add-executable-bit.patch];
+
+  extraNativeBuildInputs = [sass python3 python3Packages.pycairo];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/breeze-plymouth/default.nix b/nixpkgs/pkgs/kde/plasma/breeze-plymouth/default.nix
new file mode 100644
index 000000000000..7551eca94e3a
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/breeze-plymouth/default.nix
@@ -0,0 +1,52 @@
+{
+  lib,
+  mkKdeDerivation,
+  pkg-config,
+  plymouth,
+  imagemagick,
+  netpbm,
+  perl,
+  logoName ? null,
+  logoFile ? null,
+  osName ? null,
+  osVersion ? null,
+  topColor ? "black",
+  bottomColor ? "black",
+}: let
+  validColors = ["black" "cardboard_grey" "charcoal_grey" "icon_blue" "paper_white" "plasma_blue" "neon_blue" "neon_green"];
+  resolvedLogoName =
+    if (logoFile != null && logoName == null)
+    then lib.strings.removeSuffix ".png" (baseNameOf (toString logoFile))
+    else logoName;
+in
+  assert lib.asserts.assertOneOf "topColor" topColor validColors;
+  assert lib.asserts.assertOneOf "bottomColor" bottomColor validColors;
+    mkKdeDerivation {
+      pname = "breeze-plymouth";
+
+      # FIXME(later): discuss with upstream
+      patches = [./install-paths.patch];
+
+      extraNativeBuildInputs = [pkg-config] ++ lib.optionals (logoFile != null) [imagemagick netpbm perl];
+      extraBuildInputs = [plymouth];
+
+      extraCmakeFlags =
+        []
+        ++ lib.optional (osName != null) "-DDISTRO_NAME=${osName}"
+        ++ lib.optional (osVersion != null) "-DDISTRO_VERSION=${osVersion}"
+        ++ lib.optional (logoName != null) "-DDISTRO_LOGO=${logoName}"
+        ++ lib.optional (topColor != null) "-DBACKGROUND_TOP_COLOR=${topColor}"
+        ++ lib.optional (bottomColor != null) "-DBACKGROUND_BOTTOM_COLOR=${bottomColor}";
+
+      postPatch =
+        ''
+          substituteInPlace cmake/FindPlymouth.cmake --subst-var out
+        ''
+        + lib.optionalString (logoFile != null) ''
+          cp ${logoFile} breeze/images/${resolvedLogoName}.logo.png
+
+          # conversion for 16bit taken from the breeze-plymouth readme
+          convert ${logoFile} -alpha Background -background "#000000" -fill "#000000" -flatten tmp.png
+          pngtopnm tmp.png | pnmquant 16 | pnmtopng > breeze/images/16bit/${resolvedLogoName}.logo.png
+        '';
+    }
diff --git a/nixpkgs/pkgs/kde/plasma/breeze-plymouth/install-paths.patch b/nixpkgs/pkgs/kde/plasma/breeze-plymouth/install-paths.patch
new file mode 100644
index 000000000000..5d5856d122dd
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/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/kde/plasma/breeze/default.nix b/nixpkgs/pkgs/kde/plasma/breeze/default.nix
new file mode 100644
index 000000000000..72dcbcae91f4
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/breeze/default.nix
@@ -0,0 +1,44 @@
+{
+  mkKdeDerivation,
+  qtbase,
+  libsForQt5,
+}:
+mkKdeDerivation {
+  pname = "breeze";
+
+  outputs = ["out" "dev" "qt5"];
+
+  # We can't add qt5 stuff to dependencies or the hooks blow up,
+  # so manually point everything to everything. Oof.
+  extraCmakeFlags = [
+    "-DQt5_DIR=${libsForQt5.qtbase.dev}/lib/cmake/Qt5"
+    "-DQt5Core_DIR=${libsForQt5.qtbase.dev}/lib/cmake/Qt5Core"
+    "-DQt5DBus_DIR=${libsForQt5.qtbase.dev}/lib/cmake/Qt5DBus"
+    "-DQt5Gui_DIR=${libsForQt5.qtbase.dev}/lib/cmake/Qt5Gui"
+    "-DQt5Network_DIR=${libsForQt5.qtbase.dev}/lib/cmake/Qt5Network"
+    "-DQt5Qml_DIR=${libsForQt5.qtdeclarative.dev}/lib/cmake/Qt5Qml"
+    "-DQt5QmlModels_DIR=${libsForQt5.qtdeclarative.dev}/lib/cmake/Qt5QmlModels"
+    "-DQt5Quick_DIR=${libsForQt5.qtdeclarative.dev}/lib/cmake/Qt5Quick"
+    "-DQt5Widgets_DIR=${libsForQt5.qtbase.dev}/lib/cmake/Qt5Widgets"
+    "-DQt5X11Extras_DIR=${libsForQt5.qtx11extras.dev}/lib/cmake/Qt5X11Extras"
+    "-DQt5Xml_DIR=${libsForQt5.qtbase.dev}/lib/cmake/Qt5Xml"
+
+    "-DKF5Auth_DIR=${libsForQt5.kauth.dev}/lib/cmake/KF5Auth"
+    "-DKF5Codecs_DIR=${libsForQt5.kcodecs.dev}/lib/cmake/KF5Codecs"
+    "-DKF5Config_DIR=${libsForQt5.kconfig.dev}/lib/cmake/KF5Config"
+    "-DKF5ConfigWidgets_DIR=${libsForQt5.kconfigwidgets.dev}/lib/cmake/KF5ConfigWidgets"
+    "-DKF5CoreAddons_DIR=${libsForQt5.kcoreaddons.dev}/lib/cmake/KF5CoreAddons"
+    "-DKF5FrameworkIntegration_DIR=${libsForQt5.frameworkintegration.dev}/lib/cmake/KF5FrameworkIntegration"
+    "-DKF5GuiAddons_DIR=${libsForQt5.kguiaddons.dev}/lib/cmake/KF5GuiAddons"
+    "-DKF5IconThemes_DIR=${libsForQt5.kiconthemes.dev}/lib/cmake/KF5IconThemes"
+    "-DKF5Kirigami2_DIR=${libsForQt5.kirigami2.dev}/lib/cmake/KF5Kirigami2"
+    "-DKF5WidgetsAddons_DIR=${libsForQt5.kwidgetsaddons.dev}/lib/cmake/KF5WidgetsAddons"
+    "-DKF5WindowSystem_DIR=${libsForQt5.kwindowsystem.dev}/lib/cmake/KF5WindowSystem"
+  ];
+
+  # Move Qt5 plugin to Qt5 plugin path
+  postInstall = ''
+    mkdir -p $qt5/${libsForQt5.qtbase.qtPluginPrefix}/styles
+    mv $out/${qtbase.qtPluginPrefix}/styles/breeze5.so $qt5/${libsForQt5.qtbase.qtPluginPrefix}/styles
+  '';
+}
diff --git a/nixpkgs/pkgs/kde/plasma/default.nix b/nixpkgs/pkgs/kde/plasma/default.nix
new file mode 100644
index 000000000000..b50dc05b2fa4
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/default.nix
@@ -0,0 +1,65 @@
+{callPackage}: {
+  bluedevil = callPackage ./bluedevil {};
+  breeze = callPackage ./breeze {};
+  breeze-grub = callPackage ./breeze-grub {};
+  breeze-gtk = callPackage ./breeze-gtk {};
+  breeze-plymouth = callPackage ./breeze-plymouth {};
+  discover = callPackage ./discover {};
+  drkonqi = callPackage ./drkonqi {};
+  flatpak-kcm = callPackage ./flatpak-kcm {};
+  kactivitymanagerd = callPackage ./kactivitymanagerd {};
+  kde-cli-tools = callPackage ./kde-cli-tools {};
+  kdecoration = callPackage ./kdecoration {};
+  kde-gtk-config = callPackage ./kde-gtk-config {};
+  kdeplasma-addons = callPackage ./kdeplasma-addons {};
+  kgamma = callPackage ./kgamma {};
+  kglobalacceld = callPackage ./kglobalacceld {};
+  kinfocenter = callPackage ./kinfocenter {};
+  kmenuedit = callPackage ./kmenuedit {};
+  kpipewire = callPackage ./kpipewire {};
+  kscreen = callPackage ./kscreen {};
+  kscreenlocker = callPackage ./kscreenlocker {};
+  ksshaskpass = callPackage ./ksshaskpass {};
+  ksystemstats = callPackage ./ksystemstats {};
+  kwallet-pam = callPackage ./kwallet-pam {};
+  kwayland = callPackage ./kwayland {};
+  kwayland-integration = callPackage ./kwayland-integration {};
+  kwin = callPackage ./kwin {};
+  kwrited = callPackage ./kwrited {};
+  layer-shell-qt = callPackage ./layer-shell-qt {};
+  libkscreen = callPackage ./libkscreen {};
+  libksysguard = callPackage ./libksysguard {};
+  libplasma = callPackage ./libplasma {};
+  milou = callPackage ./milou {};
+  ocean-sound-theme = callPackage ./ocean-sound-theme {};
+  oxygen = callPackage ./oxygen {};
+  oxygen-sounds = callPackage ./oxygen-sounds {};
+  plasma5support = callPackage ./plasma5support {};
+  plasma-activities = callPackage ./plasma-activities {};
+  plasma-activities-stats = callPackage ./plasma-activities-stats {};
+  plasma-browser-integration = callPackage ./plasma-browser-integration {};
+  plasma-desktop = callPackage ./plasma-desktop {};
+  plasma-disks = callPackage ./plasma-disks {};
+  plasma-firewall = callPackage ./plasma-firewall {};
+  plasma-integration = callPackage ./plasma-integration {};
+  plasma-mobile = callPackage ./plasma-mobile {};
+  plasma-nano = callPackage ./plasma-nano {};
+  plasma-nm = callPackage ./plasma-nm {};
+  plasma-pa = callPackage ./plasma-pa {};
+  plasma-sdk = callPackage ./plasma-sdk {};
+  plasma-systemmonitor = callPackage ./plasma-systemmonitor {};
+  plasma-thunderbolt = callPackage ./plasma-thunderbolt {};
+  plasma-vault = callPackage ./plasma-vault {};
+  plasma-welcome = callPackage ./plasma-welcome {};
+  plasma-workspace = callPackage ./plasma-workspace {};
+  plasma-workspace-wallpapers = callPackage ./plasma-workspace-wallpapers {};
+  plymouth-kcm = callPackage ./plymouth-kcm {};
+  polkit-kde-agent-1 = callPackage ./polkit-kde-agent-1 {};
+  powerdevil = callPackage ./powerdevil {};
+  print-manager = callPackage ./print-manager {};
+  qqc2-breeze-style = callPackage ./qqc2-breeze-style {};
+  sddm-kcm = callPackage ./sddm-kcm {};
+  systemsettings = callPackage ./systemsettings {};
+  wacomtablet = callPackage ./wacomtablet {};
+  xdg-desktop-portal-kde = callPackage ./xdg-desktop-portal-kde {};
+}
diff --git a/nixpkgs/pkgs/kde/plasma/discover/default.nix b/nixpkgs/pkgs/kde/plasma/discover/default.nix
new file mode 100644
index 000000000000..2795f3d1414e
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/discover/default.nix
@@ -0,0 +1,14 @@
+{
+  mkKdeDerivation,
+  qtwebview,
+  pkg-config,
+  discount,
+  flatpak,
+  fwupd,
+}:
+mkKdeDerivation {
+  pname = "discover";
+
+  extraNativeBuildInputs = [pkg-config];
+  extraBuildInputs = [qtwebview discount flatpak fwupd];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/drkonqi/default.nix b/nixpkgs/pkgs/kde/plasma/drkonqi/default.nix
new file mode 100644
index 000000000000..392e1fae71e9
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/drkonqi/default.nix
@@ -0,0 +1,41 @@
+{
+  mkKdeDerivation,
+  pkg-config,
+  systemd,
+  gdb,
+  python3,
+  substituteAll,
+  coreutils,
+}: let
+  gdb' = gdb.override {
+    hostCpuOnly = true;
+    python3 = python3.withPackages (ps: [
+      ps.psutil
+      ps.pygdbmi
+      ps.sentry-sdk
+    ]);
+  };
+in
+  mkKdeDerivation {
+    pname = "drkonqi";
+
+    patches = [
+      (substituteAll {
+        src = ./gdb-path.patch;
+        gdb = "${gdb'}/bin/gdb";
+      })
+    ];
+
+    postPatch = ''
+      substituteInPlace src/coredump/processor/drkonqi-coredump-pickup.service.cmake \
+        --replace /usr/bin/sleep ${coreutils}/bin/sleep
+    '';
+
+    extraNativeBuildInputs = [pkg-config];
+    extraBuildInputs = [systemd];
+
+    extraCmakeFlags = [
+      "-DWITH_GDB12=1"
+      "-DWITH_PYTHON_VENDORING=0"
+    ];
+  }
diff --git a/nixpkgs/pkgs/kde/plasma/drkonqi/gdb-path.patch b/nixpkgs/pkgs/kde/plasma/drkonqi/gdb-path.patch
new file mode 100644
index 000000000000..a49816d96f7b
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/drkonqi/gdb-path.patch
@@ -0,0 +1,28 @@
+diff --git a/src/data/debuggers/internal/gdbrc b/src/data/debuggers/internal/gdbrc
+index 9a5c8fee..c32b1510 100644
+--- a/src/data/debuggers/internal/gdbrc
++++ b/src/data/debuggers/internal/gdbrc
+@@ -72,17 +72,18 @@ Name[wa]=gdb
+ Name[x-test]=xxgdbxx
+ Name[zh_CN]=gdb
+ Name[zh_TW]=gdb
+-TryExec=gdb
++TryExec=@gdb@
++CodeName=gdb
+ Backends=KCrash|coredump-core
+ 
+ [KCrash]
+-Exec=gdb -nw -n -batch -x %preamblefile -x %tempfile -p %pid %execpath
+-ExecWithSymbolResolution=gdb -nw -n -batch --init-eval-command='set debuginfod enabled on' -x %preamblefile -x %tempfile -p %pid %execpath
++Exec=@gdb@ -nw -n -batch -x %preamblefile -x %tempfile -p %pid %execpath
++ExecWithSymbolResolution=@gdb@ -nw -n -batch --init-eval-command='set debuginfod enabled on' -x %preamblefile -x %tempfile -p %pid %execpath
+ PreambleCommands=set width 200\nsource %drkonqi_datadir/python/gdb_preamble/preamble.py\npy print_preamble()
+ BatchCommands=thread\nthread apply all bt
+ 
+ [coredump-core]
+-Exec=gdb --nw --nx --batch --command=%preamblefile --command=%tempfile --core=%corefile %execpath
+-ExecWithSymbolResolution=gdb --nw --nx --batch --init-eval-command='set debuginfod enabled on' --command=%preamblefile --command=%tempfile --core=%corefile %execpath
++Exec=@gdb@ --nw --nx --batch --command=%preamblefile --command=%tempfile --core=%corefile %execpath
++ExecWithSymbolResolution=@gdb@ --nw --nx --batch --init-eval-command='set debuginfod enabled on' --command=%preamblefile --command=%tempfile --core=%corefile %execpath
+ PreambleCommands=set width 200\nsource %drkonqi_datadir/python/gdb_preamble/preamble.py\npy print_preamble()
+ BatchCommands=thread\nthread apply all bt
diff --git a/nixpkgs/pkgs/kde/plasma/flatpak-kcm/default.nix b/nixpkgs/pkgs/kde/plasma/flatpak-kcm/default.nix
new file mode 100644
index 000000000000..a43447a15413
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/flatpak-kcm/default.nix
@@ -0,0 +1,12 @@
+{
+  mkKdeDerivation,
+  pkg-config,
+  qtsvg,
+  flatpak,
+}:
+mkKdeDerivation {
+  pname = "flatpak-kcm";
+
+  extraNativeBuildInputs = [pkg-config];
+  extraBuildInputs = [flatpak qtsvg];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/kactivitymanagerd/default.nix b/nixpkgs/pkgs/kde/plasma/kactivitymanagerd/default.nix
new file mode 100644
index 000000000000..b0d2fea109cc
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kactivitymanagerd/default.nix
@@ -0,0 +1,10 @@
+{
+  mkKdeDerivation,
+  qt5compat,
+  boost,
+}:
+mkKdeDerivation {
+  pname = "kactivitymanagerd";
+
+  extraBuildInputs = [qt5compat boost];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/kde-cli-tools/default.nix b/nixpkgs/pkgs/kde/plasma/kde-cli-tools/default.nix
new file mode 100644
index 000000000000..cbaddad84169
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kde-cli-tools/default.nix
@@ -0,0 +1,9 @@
+{
+  mkKdeDerivation,
+  qtsvg,
+}:
+mkKdeDerivation {
+  pname = "kde-cli-tools";
+
+  extraBuildInputs = [qtsvg];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/kde-gtk-config/0001-gsettings-schemas-path.patch b/nixpkgs/pkgs/kde/plasma/kde-gtk-config/0001-gsettings-schemas-path.patch
new file mode 100644
index 000000000000..2fe4672f6757
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kde-gtk-config/0001-gsettings-schemas-path.patch
@@ -0,0 +1,21 @@
+diff --git a/kded/gtkconfig.cpp b/kded/gtkconfig.cpp
+index 5303636..199c4d5 100644
+--- a/kded/gtkconfig.cpp
++++ b/kded/gtkconfig.cpp
+@@ -41,6 +41,16 @@ GtkConfig::GtkConfig(QObject *parent, const QVariantList&) :
+     kdeglobalsConfigWatcher(KConfigWatcher::create(KSharedConfig::openConfig(QStringLiteral("kdeglobals")))),
+     kwinConfigWatcher(KConfigWatcher::create(KSharedConfig::openConfig(QStringLiteral("kwinrc"))))
+ {
++    // 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);
++
+     QDBusConnection dbus = QDBusConnection::sessionBus();
+     dbus.registerService(QStringLiteral("org.kde.GtkConfig"));
+     dbus.registerObject(QStringLiteral("/GtkConfig"), this, QDBusConnection::ExportScriptableSlots);
diff --git a/nixpkgs/pkgs/kde/plasma/kde-gtk-config/default.nix b/nixpkgs/pkgs/kde/plasma/kde-gtk-config/default.nix
new file mode 100644
index 000000000000..0101a56e93c6
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kde-gtk-config/default.nix
@@ -0,0 +1,24 @@
+{
+  mkKdeDerivation,
+  pkg-config,
+  wrapGAppsHook,
+  sass,
+  qtsvg,
+  gsettings-desktop-schemas,
+}:
+mkKdeDerivation {
+  pname = "kde-gtk-config";
+
+  # The gtkconfig KDED module will crash the daemon if the GSettings schemas
+  # aren't found.
+  patches = [./0001-gsettings-schemas-path.patch];
+  preConfigure = ''
+    NIX_CFLAGS_COMPILE+=" -DGSETTINGS_SCHEMAS_PATH=\"$GSETTINGS_SCHEMAS_PATH\""
+  '';
+
+  extraNativeBuildInputs = [pkg-config wrapGAppsHook sass];
+  extraBuildInputs = [qtsvg];
+  dontWrapGApps = true; # There is nothing to wrap
+
+  extraCmakeFlags = ["-DGLIB_SCHEMAS_DIR=${gsettings-desktop-schemas.out}/"];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/kdecoration/default.nix b/nixpkgs/pkgs/kde/plasma/kdecoration/default.nix
new file mode 100644
index 000000000000..9f879b1cea17
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kdecoration/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "kdecoration";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/kdeplasma-addons/default.nix b/nixpkgs/pkgs/kde/plasma/kdeplasma-addons/default.nix
new file mode 100644
index 000000000000..afb0708e8e6b
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kdeplasma-addons/default.nix
@@ -0,0 +1,9 @@
+{
+  mkKdeDerivation,
+  qtwebengine,
+}:
+mkKdeDerivation {
+  pname = "kdeplasma-addons";
+
+  extraBuildInputs = [qtwebengine];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/kgamma/default.nix b/nixpkgs/pkgs/kde/plasma/kgamma/default.nix
new file mode 100644
index 000000000000..dcd119ace8ec
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kgamma/default.nix
@@ -0,0 +1,9 @@
+{
+  mkKdeDerivation,
+  xorg,
+}:
+mkKdeDerivation {
+  pname = "kgamma";
+
+  extraBuildInputs = [xorg.libXxf86vm];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/kglobalacceld/default.nix b/nixpkgs/pkgs/kde/plasma/kglobalacceld/default.nix
new file mode 100644
index 000000000000..caafb6c91347
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kglobalacceld/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "kglobalacceld";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/kinfocenter/0001-tool-paths.patch b/nixpkgs/pkgs/kde/plasma/kinfocenter/0001-tool-paths.patch
new file mode 100644
index 000000000000..543aecdec43f
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kinfocenter/0001-tool-paths.patch
@@ -0,0 +1,51 @@
+diff --git a/Modules/kwinsupportinfo/kcm_kwinsupportinfo.json.in b/Modules/kwinsupportinfo/kcm_kwinsupportinfo.json.in
+index 0de6973e..30035768 100644
+--- a/Modules/kwinsupportinfo/kcm_kwinsupportinfo.json.in
++++ b/Modules/kwinsupportinfo/kcm_kwinsupportinfo.json.in
+@@ -85,6 +85,6 @@
+         "Name[zh_CN]": "窗口管理器",
+         "Name[zh_TW]": "視窗管理員"
+     },
+-    "TryExec": "@QtBinariesDir@/qdbus",
++    "TryExec": "@qdbus@",
+     "X-KDE-KInfoCenter-Category": "graphical_information"
+ }
+diff --git a/Modules/kwinsupportinfo/main.cpp b/Modules/kwinsupportinfo/main.cpp
+index 6ae168b5..89d0a2ff 100644
+--- a/Modules/kwinsupportinfo/main.cpp
++++ b/Modules/kwinsupportinfo/main.cpp
+@@ -18,7 +18,7 @@ public:
+     explicit KCMKWinSupportInfo(QObject *parent, const KPluginMetaData &data)
+         : KQuickConfigModule(parent, data)
+     {
+-        m_outputContext = new CommandOutputContext(QLibraryInfo::location(QLibraryInfo::BinariesPath) + QStringLiteral("/qdbus"),
++        m_outputContext = new CommandOutputContext(QStringLiteral("@qdbus@"),
+                                                    {QStringLiteral("org.kde.KWin"), QStringLiteral("/KWin"), QStringLiteral("supportInformation")},
+                                                    parent);
+     }
+diff --git a/Modules/xserver/kcm_xserver.json b/Modules/xserver/kcm_xserver.json
+index b3f1ce24..dc610932 100644
+--- a/Modules/xserver/kcm_xserver.json
++++ b/Modules/xserver/kcm_xserver.json
+@@ -141,7 +141,7 @@
+         "Name[zh_CN]": "X 服务器",
+         "Name[zh_TW]": "X 伺服器"
+     },
+-    "TryExec": "xdpyinfo",
++    "TryExec": "@xdpyinfo@",
+     "X-DocPath": "kinfocenter/graphical.html#xserver",
+     "X-KDE-KInfoCenter-Category": "graphical_information",
+     "X-KDE-Keywords": "X,X-Server,XServer,XFree86,Display,VideoCard,System Information",
+diff --git a/Modules/xserver/main.cpp b/Modules/xserver/main.cpp
+index 6d4d1e25..d39fe19e 100644
+--- a/Modules/xserver/main.cpp
++++ b/Modules/xserver/main.cpp
+@@ -16,7 +16,7 @@ public:
+     explicit KCMXServer(QObject *parent, const KPluginMetaData &data)
+         : KQuickConfigModule(parent, data)
+     {
+-        m_outputContext = new CommandOutputContext(QStringLiteral("xdpyinfo"), {}, parent);
++        m_outputContext = new CommandOutputContext(QStringLiteral("@xdpyinfo@"), {}, parent);
+     }
+     CommandOutputContext *outputContext() const
+     {
diff --git a/nixpkgs/pkgs/kde/plasma/kinfocenter/default.nix b/nixpkgs/pkgs/kde/plasma/kinfocenter/default.nix
new file mode 100644
index 000000000000..cc216dd22a7b
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kinfocenter/default.nix
@@ -0,0 +1,29 @@
+{
+  lib,
+  mkKdeDerivation,
+  substituteAll,
+  qttools,
+  xdpyinfo,
+  systemsettings,
+  libusb1,
+}:
+mkKdeDerivation {
+  pname = "kinfocenter";
+
+  patches = [
+    (substituteAll {
+      src = ./0001-tool-paths.patch;
+      qdbus = "${lib.getBin qttools}/bin/qdbus";
+      xdpyinfo = lib.getExe xdpyinfo;
+    })
+  ];
+
+  # fix wrong symlink of infocenter pointing to a 'systemsettings5' binary in
+  # the same directory, while it is actually located in a completely different
+  # store path
+  preFixup = ''
+    ln -sf ${systemsettings}/bin/systemsettings $out/bin/kinfocenter
+  '';
+
+  extraBuildInputs = [libusb1];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/kmenuedit/default.nix b/nixpkgs/pkgs/kde/plasma/kmenuedit/default.nix
new file mode 100644
index 000000000000..2cfd932af1bf
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kmenuedit/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "kmenuedit";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/kpipewire/default.nix b/nixpkgs/pkgs/kde/plasma/kpipewire/default.nix
new file mode 100644
index 000000000000..c79bfc792d51
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kpipewire/default.nix
@@ -0,0 +1,15 @@
+{
+  mkKdeDerivation,
+  qtquick3d,
+  pkg-config,
+  pipewire,
+  ffmpeg,
+  mesa,
+  libva,
+}:
+mkKdeDerivation {
+  pname = "kpipewire";
+
+  extraNativeBuildInputs = [pkg-config];
+  extraBuildInputs = [qtquick3d pipewire ffmpeg mesa libva];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/kscreen/default.nix b/nixpkgs/pkgs/kde/plasma/kscreen/default.nix
new file mode 100644
index 000000000000..480912fe7fcb
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kscreen/default.nix
@@ -0,0 +1,15 @@
+{
+  mkKdeDerivation,
+  qtsensors,
+  dbus,
+}:
+mkKdeDerivation {
+  pname = "kscreen";
+
+  extraBuildInputs = [qtsensors];
+
+  postFixup = ''
+    substituteInPlace $out/share/kglobalaccel/org.kde.kscreen.desktop \
+      --replace-fail dbus-send ${dbus}/bin/dbus-send
+  '';
+}
diff --git a/nixpkgs/pkgs/kde/plasma/kscreenlocker/default.nix b/nixpkgs/pkgs/kde/plasma/kscreenlocker/default.nix
new file mode 100644
index 000000000000..e7ee0a18b8e5
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kscreenlocker/default.nix
@@ -0,0 +1,10 @@
+{
+  mkKdeDerivation,
+  pam,
+  qqc2-breeze-style,
+}:
+mkKdeDerivation {
+  pname = "kscreenlocker";
+
+  extraBuildInputs = [pam qqc2-breeze-style];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/ksshaskpass/default.nix b/nixpkgs/pkgs/kde/plasma/ksshaskpass/default.nix
new file mode 100644
index 000000000000..86834f8fa7c2
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/ksshaskpass/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "ksshaskpass";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/ksystemstats/default.nix b/nixpkgs/pkgs/kde/plasma/ksystemstats/default.nix
new file mode 100644
index 000000000000..1d098b10b023
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/ksystemstats/default.nix
@@ -0,0 +1,16 @@
+{
+  mkKdeDerivation,
+  pkg-config,
+  libksysguard,
+  networkmanager-qt,
+  lm_sensors,
+  libnl,
+}:
+mkKdeDerivation {
+  pname = "ksystemstats";
+
+  extraNativeBuildInputs = [pkg-config];
+  extraBuildInputs = [networkmanager-qt lm_sensors libnl];
+
+  cmakeFlags = ["-DSYSTEMSTATS_DBUS_INTERFACE=${libksysguard}/share/dbus-1/interfaces/org.kde.ksystemstats1.xml"];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/kwallet-pam/default.nix b/nixpkgs/pkgs/kde/plasma/kwallet-pam/default.nix
new file mode 100644
index 000000000000..4b3cdd678dee
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kwallet-pam/default.nix
@@ -0,0 +1,16 @@
+{
+  lib,
+  mkKdeDerivation,
+  pam,
+  libgcrypt,
+  socat,
+}:
+mkKdeDerivation {
+  pname = "kwallet-pam";
+
+  postPatch = ''
+    sed -i pam_kwallet_init -e "s|socat|${lib.getBin socat}/bin/socat|"
+  '';
+
+  extraBuildInputs = [pam libgcrypt];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/kwayland-integration/default.nix b/nixpkgs/pkgs/kde/plasma/kwayland-integration/default.nix
new file mode 100644
index 000000000000..0274068f7f79
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kwayland-integration/default.nix
@@ -0,0 +1,6 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "kwayland-integration";
+  # FIXME(qt5)
+  meta.broken = true;
+}
diff --git a/nixpkgs/pkgs/kde/plasma/kwayland/default.nix b/nixpkgs/pkgs/kde/plasma/kwayland/default.nix
new file mode 100644
index 000000000000..341fd8d35608
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kwayland/default.nix
@@ -0,0 +1,12 @@
+{
+  mkKdeDerivation,
+  pkg-config,
+  qtwayland,
+  wayland-protocols,
+}:
+mkKdeDerivation {
+  pname = "kwayland";
+
+  extraNativeBuildInputs = [pkg-config];
+  extraBuildInputs = [qtwayland wayland-protocols];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/kwin/0001-NixOS-Unwrap-executable-name-for-.desktop-search.patch b/nixpkgs/pkgs/kde/plasma/kwin/0001-NixOS-Unwrap-executable-name-for-.desktop-search.patch
new file mode 100644
index 000000000000..896c5dcff20b
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kwin/0001-NixOS-Unwrap-executable-name-for-.desktop-search.patch
@@ -0,0 +1,114 @@
+From 29ec6fada935ef966e5859082435ed57daa9522d Mon Sep 17 00:00:00 2001
+From: Samuel Dionne-Riel <samuel@dionne-riel.com>
+Date: Tue, 16 Mar 2021 15:03:59 -0400
+Subject: [PATCH] [NixOS] Unwrap executable name for .desktop search
+
+Why is this necessary even though -a "$0" is used in the wrapper?
+Because it's completely bypassing argv0! This looks at the executable
+file in-use according to the kernel!
+
+Wrappers cannot affect the `/proc/.../exe` symlink!
+
+Co-authored-by: Yaroslav Bolyukin <iam@lach.pw>
+---
+ src/nixos_utils.h     | 41 +++++++++++++++++++++++++++++++++++++++++
+ src/service_utils.h   |  4 +++-
+ src/waylandwindow.cpp |  5 ++++-
+ 3 files changed, 48 insertions(+), 2 deletions(-)
+ create mode 100644 src/nixos_utils.h
+
+diff --git a/src/nixos_utils.h b/src/nixos_utils.h
+new file mode 100644
+index 0000000..726065d
+--- /dev/null
++++ b/src/nixos_utils.h
+@@ -0,0 +1,41 @@
++#ifndef NIXOS_UTILS_H
++#define NIXOS_UTILS_H
++
++// kwin
++// #include <kwinglobals.h>
++
++namespace KWin
++{
++
++static QString unwrapExecutablePath(const QString &in_executablePath)
++{
++    // NixOS fixes many packaging issues through "wrapper" scripts that manipulates the environment or does
++    // miscellaneous trickeries and mischievous things to make the programs work.
++    // In turn, programs often employs different mischievous schemes and trickeries to do *other things.
++    // It often happens that they conflict.
++    // Here, `kwin` tries to detect the .desktop file for a given process.
++    // `kwin` followed the process `/proc/.../exe` up to the actual binary running.
++    // It normally would be fine, e.g. /usr/bin/foobar is what's in the desktop file.
++    // But it's not the truth here! It's extremely likely the resolved path is /nix/store/.../bin/.foobar-wrapped
++    // rather than what the desktop file points to, something like /nix/store/.../bin/foobar !!
++    // Since the wrappers for Nixpkgs *always* prepend a dot and append -wrapped, we assume here that we can keep
++    // `/^(.*)\/\.([^/]*)-wrapped/` until the (equivalent) regex does not match.
++    // This should canonicalize the wrapper name to the expected name to look for in the desktop file.
++
++    // Use a copy of the const string
++    QString executablePath(in_executablePath);
++
++    // While the parts needed are present, "unwrap" one layer of wrapper names.
++    while (executablePath.endsWith("-wrapped") && executablePath[executablePath.lastIndexOf("/")+1] == QChar('.')) {
++        // Approximately equivalent to s/-wrapped$//
++        executablePath.remove(executablePath.length() - 8, 8);
++        // Approximately equivalent to s;/\.;/;
++        executablePath.remove(executablePath.lastIndexOf("/")+1, 1);
++    }
++
++    return executablePath;
++}
++
++}// namespace
++
++#endif // NIXOS_UTILS_H
+diff --git a/src/utils/serviceutils.h b/src/utils/serviceutils.h
+index 8a70c1f..475b15d 100644
+--- a/src/utils/serviceutils.h
++++ b/src/utils/serviceutils.h
+@@ -19,6 +19,7 @@
+ #include <QLoggingCategory>
+ //KF
+ #include <KApplicationTrader>
++#include "nixos_utils.h"
+ 
+ namespace KWin
+ {
+@@ -26,8 +27,9 @@ namespace KWin
+ const static QString s_waylandInterfaceName = QStringLiteral("X-KDE-Wayland-Interfaces");
+ const static QString s_dbusRestrictedInterfaceName = QStringLiteral("X-KDE-DBUS-Restricted-Interfaces");
+ 
+-static QStringList fetchProcessServiceField(const QString &executablePath, const QString &fieldName)
++static QStringList fetchProcessServiceField(const QString &in_executablePath, const QString &fieldName)
+ {
++    const QString executablePath = unwrapExecutablePath(in_executablePath);
+     // needed to be able to use the logging category in a header static function
+     static QLoggingCategory KWIN_UTILS ("KWIN_UTILS", QtWarningMsg);
+     const auto servicesFound = KApplicationTrader::query([&executablePath] (const KService::Ptr &service) {
+diff --git a/src/waylandwindow.cpp b/src/waylandwindow.cpp
+index fd2c0c1..ae8cf96 100644
+--- a/src/waylandwindow.cpp
++++ b/src/waylandwindow.cpp
+@@ -10,6 +10,7 @@
+ #include "screens.h"
+ #include "wayland_server.h"
+ #include "workspace.h"
++#include "nixos_utils.h"
+ 
+ #include <KWaylandServer/display.h>
+ #include <KWaylandServer/clientbuffer.h>
+@@ -173,7 +174,9 @@ void WaylandWindow::updateIcon()
+ 
+ void WaylandWindow::updateResourceName()
+ {
+-    const QFileInfo fileInfo(surface()->client()->executablePath());
++    const QString in_path = surface()->client()->executablePath();
++    const QString path = unwrapExecutablePath(in_path);
++    const QFileInfo fileInfo(path);
+     if (fileInfo.exists()) {
+         const QByteArray executableFileName = fileInfo.fileName().toUtf8();
+         setResourceClass(executableFileName, executableFileName);
+-- 
+2.32.0
diff --git a/nixpkgs/pkgs/kde/plasma/kwin/0001-follow-symlinks.patch b/nixpkgs/pkgs/kde/plasma/kwin/0001-follow-symlinks.patch
new file mode 100644
index 000000000000..efde4f4dcf04
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kwin/0001-follow-symlinks.patch
@@ -0,0 +1,25 @@
+From af569c9ed8079169b524b31461e2789baa09ef7a Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Mon, 27 Jan 2020 05:31:13 -0600
+Subject: [PATCH 1/3] follow symlinks
+
+---
+ src/plugins/kdecorations/aurorae/src/aurorae.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/plugins/kdecorations/aurorae/src/aurorae.cpp b/src/plugins/kdecorations/aurorae/src/aurorae.cpp
+index 5242cb7..2e4ddae 100644
+--- a/src/plugins/kdecorations/aurorae/src/aurorae.cpp
++++ b/src/plugins/kdecorations/aurorae/src/aurorae.cpp
+@@ -201,7 +201,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();
+-- 
+2.29.2
+
diff --git a/nixpkgs/pkgs/kde/plasma/kwin/0003-plugins-qpa-allow-using-nixos-wrapper.patch b/nixpkgs/pkgs/kde/plasma/kwin/0003-plugins-qpa-allow-using-nixos-wrapper.patch
new file mode 100644
index 000000000000..d0be721b044c
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kwin/0003-plugins-qpa-allow-using-nixos-wrapper.patch
@@ -0,0 +1,26 @@
+From 8d49f5ef8692c352a62f4f8b1bc68e6e210bbee6 Mon Sep 17 00:00:00 2001
+From: Yaroslav  Bolyukin <iam@lach.pw>
+Date: Wed, 23 Dec 2020 18:02:14 +0300
+Subject: [PATCH 3/3] plugins/qpa: allow using nixos wrapper
+
+Signed-off-by: Yaroslav  Bolyukin <iam@lach.pw>
+---
+ src/plugins/qpa/main.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/plugins/qpa/main.cpp b/src/plugins/qpa/main.cpp
+index efd236b..a69c046 100644
+--- a/src/plugins/qpa/main.cpp
++++ b/src/plugins/qpa/main.cpp
+@@ -23,7 +23,7 @@ public:
+
+ QPlatformIntegration *KWinIntegrationPlugin::create(const QString &system, const QStringList &paramList)
+ {
+-    if (!QCoreApplication::applicationFilePath().endsWith(QLatin1String("kwin_wayland")) && !qEnvironmentVariableIsSet("KWIN_FORCE_OWN_QPA")) {
++    if (!QCoreApplication::applicationFilePath().endsWith(QLatin1String("kwin_wayland")) && !QCoreApplication::applicationFilePath().endsWith(QLatin1String(".kwin_wayland-wrapped")) && !qEnvironmentVariableIsSet("KWIN_FORCE_OWN_QPA")) {
+         // Not KWin
+         return nullptr;
+     }
+-- 
+2.29.2
+
diff --git a/nixpkgs/pkgs/kde/plasma/kwin/default.nix b/nixpkgs/pkgs/kde/plasma/kwin/default.nix
new file mode 100644
index 000000000000..fc5f00991d9e
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kwin/default.nix
@@ -0,0 +1,54 @@
+{
+  mkKdeDerivation,
+  pkg-config,
+  qtquick3d,
+  qtsensors,
+  qttools,
+  qtvirtualkeyboard,
+  qtwayland,
+  libinput,
+  xorg,
+  libdisplay-info,
+  mesa,
+  lcms2,
+  libcap,
+  pipewire,
+  krunner,
+  python3,
+}:
+mkKdeDerivation {
+  pname = "kwin";
+
+  patches = [
+    # Follow symlinks when searching for aurorae configs
+    # FIXME(later): upstream?
+    ./0001-follow-symlinks.patch
+    # The rest are NixOS-specific hacks
+    ./0003-plugins-qpa-allow-using-nixos-wrapper.patch
+    ./0001-NixOS-Unwrap-executable-name-for-.desktop-search.patch
+  ];
+
+  postPatch = ''
+    patchShebangs src/plugins/strip-effect-metadata.py
+  '';
+
+  extraNativeBuildInputs = [pkg-config python3];
+  extraBuildInputs = [
+    qtquick3d
+    qtsensors
+    qttools
+    qtvirtualkeyboard
+    qtwayland
+
+    krunner
+
+    mesa # libgbm
+    lcms2
+    libcap
+    libdisplay-info
+    libinput
+    pipewire
+
+    xorg.libxcvt
+  ];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/kwrited/default.nix b/nixpkgs/pkgs/kde/plasma/kwrited/default.nix
new file mode 100644
index 000000000000..262f3b7c6493
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/kwrited/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "kwrited";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/layer-shell-qt/default.nix b/nixpkgs/pkgs/kde/plasma/layer-shell-qt/default.nix
new file mode 100644
index 000000000000..9783220cddf2
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/layer-shell-qt/default.nix
@@ -0,0 +1,13 @@
+{
+  mkKdeDerivation,
+  qtwayland,
+  pkg-config,
+  wayland,
+  wayland-protocols,
+}:
+mkKdeDerivation {
+  pname = "layer-shell-qt";
+
+  extraNativeBuildInputs = [pkg-config];
+  extraBuildInputs = [qtwayland wayland wayland-protocols];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/libkscreen/default.nix b/nixpkgs/pkgs/kde/plasma/libkscreen/default.nix
new file mode 100644
index 000000000000..d6fdd87c7e9b
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/libkscreen/default.nix
@@ -0,0 +1,12 @@
+{
+  mkKdeDerivation,
+  qtwayland,
+  qttools,
+  jq,
+}:
+mkKdeDerivation {
+  pname = "libkscreen";
+
+  extraNativeBuildInputs = [qttools qtwayland jq];
+  extraBuildInputs = [qtwayland];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/libksysguard/default.nix b/nixpkgs/pkgs/kde/plasma/libksysguard/default.nix
new file mode 100644
index 000000000000..9dae888737ab
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/libksysguard/default.nix
@@ -0,0 +1,14 @@
+{
+  mkKdeDerivation,
+  qtwebchannel,
+  qtwebengine,
+  qttools,
+  libpcap,
+  libnl,
+  lm_sensors,
+}:
+mkKdeDerivation {
+  pname = "libksysguard";
+
+  extraBuildInputs = [qtwebchannel qtwebengine qttools libpcap libnl lm_sensors];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/libplasma/default.nix b/nixpkgs/pkgs/kde/plasma/libplasma/default.nix
new file mode 100644
index 000000000000..1ff05b92ef0e
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/libplasma/default.nix
@@ -0,0 +1,13 @@
+{
+  mkKdeDerivation,
+  qtsvg,
+  qtwayland,
+  wayland,
+  pkg-config,
+}:
+mkKdeDerivation {
+  pname = "libplasma";
+
+  extraNativeBuildInputs = [pkg-config];
+  extraBuildInputs = [qtsvg qtwayland wayland];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/lightdm-greeter-kde/default.nix b/nixpkgs/pkgs/kde/plasma/lightdm-greeter-kde/default.nix
new file mode 100644
index 000000000000..9d508409f9d3
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/lightdm-greeter-kde/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "lightdm-greeter-kde";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/milou/default.nix b/nixpkgs/pkgs/kde/plasma/milou/default.nix
new file mode 100644
index 000000000000..555c7cbee2c7
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/milou/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "milou";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/ocean-sound-theme/default.nix b/nixpkgs/pkgs/kde/plasma/ocean-sound-theme/default.nix
new file mode 100644
index 000000000000..72adf43e3604
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/ocean-sound-theme/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "ocean-sound-theme";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/oxygen-sounds/default.nix b/nixpkgs/pkgs/kde/plasma/oxygen-sounds/default.nix
new file mode 100644
index 000000000000..68ee47d20eb8
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/oxygen-sounds/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "oxygen-sounds";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/oxygen/default.nix b/nixpkgs/pkgs/kde/plasma/oxygen/default.nix
new file mode 100644
index 000000000000..5b5de64af90f
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/oxygen/default.nix
@@ -0,0 +1,6 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "oxygen";
+  # FIXME(qt5)
+  meta.broken = true;
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-activities-stats/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-activities-stats/default.nix
new file mode 100644
index 000000000000..dff496e4f631
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-activities-stats/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "plasma-activities-stats";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-activities/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-activities/default.nix
new file mode 100644
index 000000000000..9ddd163e9fbb
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-activities/default.nix
@@ -0,0 +1,10 @@
+{
+  mkKdeDerivation,
+  qtdeclarative,
+  boost,
+}:
+mkKdeDerivation {
+  pname = "plasma-activities";
+
+  extraBuildInputs = [qtdeclarative boost];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-browser-integration/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-browser-integration/default.nix
new file mode 100644
index 000000000000..6277071f9a76
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-browser-integration/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "plasma-browser-integration";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-desktop/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-desktop/default.nix
new file mode 100644
index 000000000000..8ee90dee3a67
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-desktop/default.nix
@@ -0,0 +1,67 @@
+{
+  lib,
+  mkKdeDerivation,
+  runCommandLocal,
+  makeWrapper,
+  glib,
+  gsettings-desktop-schemas,
+  substituteAll,
+  util-linux,
+  pkg-config,
+  qtsvg,
+  qtwayland,
+  kaccounts-integration,
+  SDL2,
+  xkeyboard_config,
+  xorg,
+  libcanberra,
+  libxkbfile,
+  ibus,
+}: let
+  # run gsettings with desktop schemas for using in "kcm_access" kcm
+  # and in kaccess
+  gsettings-wrapper = runCommandLocal "gsettings-wrapper" {nativeBuildInputs = [makeWrapper];} ''
+    mkdir -p $out/bin
+    makeWrapper ${glib}/bin/gsettings $out/bin/gsettings --prefix XDG_DATA_DIRS : ${gsettings-desktop-schemas.out}/share/gsettings-schemas/${gsettings-desktop-schemas.name}
+  '';
+in
+  mkKdeDerivation {
+    pname = "plasma-desktop";
+
+    patches = [
+      (substituteAll {
+        src = ./hwclock-path.patch;
+        hwclock = "${lib.getBin util-linux}/bin/hwclock";
+      })
+      (substituteAll {
+        src = ./kcm-access.patch;
+        gsettings = "${gsettings-wrapper}/bin/gsettings";
+      })
+      ./tzdir.patch
+      ./no-discover-shortcut.patch
+    ];
+
+    extraNativeBuildInputs = [pkg-config];
+    extraBuildInputs = [
+      qtsvg
+      qtwayland
+
+      kaccounts-integration
+
+      SDL2
+      libcanberra
+      libxkbfile
+      xkeyboard_config
+
+      xorg.libXcursor
+      xorg.libXft
+      xorg.xf86inputlibinput
+      xorg.xf86inputevdev
+      xorg.xorgserver
+
+      ibus
+    ];
+
+    # wrap kaccess with wrapped gsettings so it can access accessibility schemas
+    qtWrapperArgs = ["--prefix PATH : ${lib.makeBinPath [gsettings-wrapper]}"];
+  }
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-desktop/hwclock-path.patch b/nixpkgs/pkgs/kde/plasma/plasma-desktop/hwclock-path.patch
new file mode 100644
index 000000000000..4c0891db97a6
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/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/types.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 = QStandardPaths::findExecutable(QStringLiteral("hwclock"), exePath.split(QLatin1Char(':')));
++    QString hwclock = QLatin1String("@hwclock@");
+     if (!hwclock.isEmpty()) {
+         KProcess::execute(hwclock, QStringList() << QStringLiteral("--systohc"));
+     }
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-desktop/kcm-access.patch b/nixpkgs/pkgs/kde/plasma/plasma-desktop/kcm-access.patch
new file mode 100644
index 000000000000..91f5847e88a5
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-desktop/kcm-access.patch
@@ -0,0 +1,13 @@
+diff --git a/kcms/access/kcmaccess.cpp b/kcms/access/kcmaccess.cpp
+index 4f8d3e2..a96f755 100644
+--- a/kcms/access/kcmaccess.cpp
++++ b/kcms/access/kcmaccess.cpp
+@@ -176,7 +176,7 @@ void KAccessConfig::launchOrcaConfiguration()
+                                       QStringLiteral("screen-reader-enabled"),
+                                       QStringLiteral("true")};
+ 
+-    int ret = QProcess::execute(QStringLiteral("gsettings"), gsettingArgs);
++    int ret = QProcess::execute(QStringLiteral("@gsettings@"), gsettingArgs);
+     if (ret) {
+         const QString errorStr = QLatin1String("gsettings ") + gsettingArgs.join(QLatin1Char(' '));
+         setOrcaLaunchFeedback(i18n("Could not set gsettings for Orca: \"%1\" failed", errorStr));
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-desktop/no-discover-shortcut.patch b/nixpkgs/pkgs/kde/plasma/plasma-desktop/no-discover-shortcut.patch
new file mode 100644
index 000000000000..f186671c9cc5
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-desktop/no-discover-shortcut.patch
@@ -0,0 +1,13 @@
+diff --git a/applets/taskmanager/package/contents/config/main.xml b/applets/taskmanager/package/contents/config/main.xml
+index 6bb27695d..25e621810 100644
+--- a/applets/taskmanager/package/contents/config/main.xml
++++ b/applets/taskmanager/package/contents/config/main.xml
+@@ -85,7 +85,7 @@
+     </entry>
+     <entry name="launchers" type="StringList">
+       <label>The list of launcher tasks on the widget. Usually .desktop file or executable URLs. Special URLs such as preferred://browser that expand to default applications are supported.</label>
+-      <default>applications:systemsettings.desktop,applications:org.kde.discover.desktop,preferred://filemanager,preferred://browser</default>
++      <default>applications:systemsettings.desktop,preferred://filemanager,preferred://browser</default>
+     </entry>
+     <entry name="middleClickAction" type="Enum">
+       <label>What to do on middle-mouse click on a task button.</label>
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-desktop/tzdir.patch b/nixpkgs/pkgs/kde/plasma/plasma-desktop/tzdir.patch
new file mode 100644
index 000000000000..97504b330fed
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/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/kde/plasma/plasma-disks/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-disks/default.nix
new file mode 100644
index 000000000000..5941fe0dec54
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-disks/default.nix
@@ -0,0 +1,16 @@
+{
+  mkKdeDerivation,
+  lib,
+  substituteAll,
+  smartmontools,
+}:
+mkKdeDerivation {
+  pname = "plasma-disks";
+
+  patches = [
+    (substituteAll {
+      smartctl = lib.getExe smartmontools;
+      src = ./smartctl-path.patch;
+    })
+  ];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-disks/smartctl-path.patch b/nixpkgs/pkgs/kde/plasma/plasma-disks/smartctl-path.patch
new file mode 100644
index 000000000000..71d4c5e7f8f5
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-disks/smartctl-path.patch
@@ -0,0 +1,13 @@
+diff --git a/src/helper.cpp b/src/helper.cpp
+index 102ebc5..4cde9da 100644
+--- a/src/helper.cpp
++++ b/src/helper.cpp
+@@ -69,7 +69,7 @@ ActionReply SMARTHelper::smartctl(const QVariantMap &args)
+     // PATH is super minimal when invoked through dbus
+     setenv("PATH", "/usr/sbin:/sbin:/usr/local/sbin", 1);
+ 
+-    const QString command = QStringLiteral("smartctl");
++    const QString command = QStringLiteral("@smartctl@");
+     const QString all = QStringLiteral("--all");
+ 
+     // JSON output.
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-firewall/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-firewall/default.nix
new file mode 100644
index 000000000000..202d3ea089b2
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-firewall/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "plasma-firewall";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-integration/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-integration/default.nix
new file mode 100644
index 000000000000..a626b9447934
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-integration/default.nix
@@ -0,0 +1,67 @@
+{
+  mkKdeDerivation,
+  qtbase,
+  qtwayland,
+  libsForQt5,
+  xorg,
+}:
+mkKdeDerivation {
+  pname = "plasma-integration";
+
+  # force it to check our custom import path too
+  patches = [./qml-path.patch];
+
+  outputs = ["out" "dev" "qt5"];
+
+  # We can't add qt5 stuff to dependencies or the hooks blow up,
+  # so manually point everything to everything. Oof.
+  extraCmakeFlags = [
+    "-DQt5_DIR=${libsForQt5.qtbase.dev}/lib/cmake/Qt5"
+    "-DQt5Concurrent_DIR=${libsForQt5.qtbase.dev}/lib/cmake/Qt5Concurrent"
+    "-DQt5Core_DIR=${libsForQt5.qtbase.dev}/lib/cmake/Qt5Core"
+    "-DQt5DBus_DIR=${libsForQt5.qtbase.dev}/lib/cmake/Qt5DBus"
+    "-DQt5Gui_DIR=${libsForQt5.qtbase.dev}/lib/cmake/Qt5Gui"
+    "-DQt5Network_DIR=${libsForQt5.qtbase.dev}/lib/cmake/Qt5Network"
+    "-DQt5Qml_DIR=${libsForQt5.qtdeclarative.dev}/lib/cmake/Qt5Qml"
+    "-DQt5QmlModels_DIR=${libsForQt5.qtdeclarative.dev}/lib/cmake/Qt5QmlModels"
+    "-DQt5Quick_DIR=${libsForQt5.qtdeclarative.dev}/lib/cmake/Qt5Quick"
+    "-DQt5QuickControls2_DIR=${libsForQt5.qtquickcontrols2.dev}/lib/cmake/Qt5QuickControls2"
+    "-DQt5ThemeSupport_LIBRARY=${libsForQt5.qtbase.out}/lib/libQt5ThemeSupport.a"
+    "-DQt5ThemeSupport_INCLUDE_DIR=${libsForQt5.qtbase.dev}/include/QtThemeSupport/${libsForQt5.qtbase.version}"
+    "-DQt5WaylandClient_DIR=${libsForQt5.qtwayland.dev}/lib/cmake/Qt5WaylandClient"
+    "-DQt5WaylandScanner_EXECUTABLE=${libsForQt5.qtwayland.dev}/bin/qtwaylandscanner"
+    "-DQt5Widgets_DIR=${libsForQt5.qtbase.dev}/lib/cmake/Qt5Widgets"
+    "-DQt5X11Extras_DIR=${libsForQt5.qtx11extras.dev}/lib/cmake/Qt5X11Extras"
+    "-DQt5Xml_DIR=${libsForQt5.qtbase.dev}/lib/cmake/Qt5Xml"
+    "-DQtWaylandScanner_EXECUTABLE=${libsForQt5.qtwayland.dev}/bin/qtwaylandscanner"
+
+    "-DKF5Auth_DIR=${libsForQt5.kauth.dev}/lib/cmake/KF5Auth"
+    "-DKF5Bookmarks_DIR=${libsForQt5.kbookmarks.dev}/lib/cmake/KF5Bookmarks"
+    "-DKF5Codecs_DIR=${libsForQt5.kcodecs.dev}/lib/cmake/KF5Codecs"
+    "-DKF5Completion_DIR=${libsForQt5.kcompletion.dev}/lib/cmake/KF5Completion"
+    "-DKF5Config_DIR=${libsForQt5.kconfig.dev}/lib/cmake/KF5Config"
+    "-DKF5ConfigWidgets_DIR=${libsForQt5.kconfigwidgets.dev}/lib/cmake/KF5ConfigWidgets"
+    "-DKF5CoreAddons_DIR=${libsForQt5.kcoreaddons.dev}/lib/cmake/KF5CoreAddons"
+    "-DKF5GuiAddons_DIR=${libsForQt5.kguiaddons.dev}/lib/cmake/KF5GuiAddons"
+    "-DKF5I18n_DIR=${libsForQt5.ki18n.dev}/lib/cmake/KF5I18n"
+    "-DKF5IconThemes_DIR=${libsForQt5.kiconthemes.dev}/lib/cmake/KF5IconThemes"
+    "-DKF5ItemViews_DIR=${libsForQt5.kitemviews.dev}/lib/cmake/KF5ItemViews"
+    "-DKF5JobWidgets_DIR=${libsForQt5.kjobwidgets.dev}/lib/cmake/KF5JobWidgets"
+    "-DKF5KIO_DIR=${libsForQt5.kio.dev}/lib/cmake/KF5KIO"
+    "-DKF5Notifications_DIR=${libsForQt5.knotifications.dev}/lib/cmake/KF5Notifications"
+    "-DKF5Service_DIR=${libsForQt5.kservice.dev}/lib/cmake/KF5Service"
+    "-DKF5Solid_DIR=${libsForQt5.solid.dev}/lib/cmake/KF5Solid"
+    "-DKF5Wayland_DIR=${libsForQt5.kwayland.dev}/lib/cmake/KF5Wayland"
+    "-DKF5WidgetsAddons_DIR=${libsForQt5.kwidgetsaddons.dev}/lib/cmake/KF5WidgetsAddons"
+    "-DKF5WindowSystem_DIR=${libsForQt5.kwindowsystem.dev}/lib/cmake/KF5WindowSystem"
+    "-DKF5XmlGui_DIR=${libsForQt5.kxmlgui.dev}/lib/cmake/KF5XmlGui"
+  ];
+
+  extraBuildInputs = [qtwayland xorg.libXcursor];
+
+  # Move Qt5 plugin to Qt5 plugin path
+  postInstall = ''
+    mkdir -p $qt5/${libsForQt5.qtbase.qtPluginPrefix}/platformthemes
+    mv $out/${qtbase.qtPluginPrefix}/platformthemes/KDEPlasmaPlatformTheme5.so $qt5/${libsForQt5.qtbase.qtPluginPrefix}/platformthemes
+  '';
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-integration/qml-path.patch b/nixpkgs/pkgs/kde/plasma/plasma-integration/qml-path.patch
new file mode 100644
index 000000000000..33af3fe9d8ea
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-integration/qml-path.patch
@@ -0,0 +1,12 @@
+diff --git a/qt6/src/platformtheme/kdeplatformtheme.cpp b/qt6/src/platformtheme/kdeplatformtheme.cpp
+index fea04b5..7efafd1 100644
+--- a/qt6/src/platformtheme/kdeplatformtheme.cpp
++++ b/qt6/src/platformtheme/kdeplatformtheme.cpp
+@@ -551,6 +551,7 @@ bool KdePlatformTheme::checkIfThemeExists(const QString &themePath)
+     // QML_IMPORT_PATH is the new one, but QML2_IMPORT_PATH is still used
+     checkEnvironmentVariable("QML2_IMPORT_PATH");
+     checkEnvironmentVariable("QML_IMPORT_PATH");
++    checkEnvironmentVariable("NIXPKGS_QT6_QML_IMPORT_PATH");
+ 
+     for (const QString &path : moduleSearchPaths) {
+         if (QDir(path + themePath).exists()) {
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-mobile/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-mobile/default.nix
new file mode 100644
index 000000000000..92bb1d66d5e3
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-mobile/default.nix
@@ -0,0 +1,11 @@
+{
+  mkKdeDerivation,
+  pkg-config,
+  qtsensors,
+}:
+mkKdeDerivation {
+  pname = "plasma-mobile";
+
+  extraNativeBuildInputs = [pkg-config];
+  extraBuildInputs = [qtsensors];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-nano/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-nano/default.nix
new file mode 100644
index 000000000000..9cdb24f013e7
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-nano/default.nix
@@ -0,0 +1,9 @@
+{
+  mkKdeDerivation,
+  qtsvg,
+}:
+mkKdeDerivation {
+  pname = "plasma-nano";
+
+  extraBuildInputs = [qtsvg];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-nm/0002-openvpn-binary-path.patch b/nixpkgs/pkgs/kde/plasma/plasma-nm/0002-openvpn-binary-path.patch
new file mode 100644
index 000000000000..c32e73bc2c6c
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/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/kde/plasma/plasma-nm/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-nm/default.nix
new file mode 100644
index 000000000000..a53ec99a8bed
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-nm/default.nix
@@ -0,0 +1,26 @@
+{
+  mkKdeDerivation,
+  substituteAll,
+  pkg-config,
+  qtwebengine,
+  mobile-broadband-provider-info,
+  openconnect,
+  openvpn,
+}:
+mkKdeDerivation {
+  pname = "plasma-nm";
+
+  patches = [
+    (substituteAll {
+      src = ./0002-openvpn-binary-path.patch;
+      inherit openvpn;
+    })
+  ];
+
+  extraNativeBuildInputs = [pkg-config];
+  extraBuildInputs = [
+    qtwebengine
+    mobile-broadband-provider-info
+    openconnect
+  ];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-pa/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-pa/default.nix
new file mode 100644
index 000000000000..4d721ecc711b
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-pa/default.nix
@@ -0,0 +1,12 @@
+{
+  mkKdeDerivation,
+  pkg-config,
+  libcanberra,
+  pulseaudio,
+}:
+mkKdeDerivation {
+  pname = "plasma-pa";
+
+  extraNativeBuildInputs = [pkg-config];
+  extraBuildInputs = [libcanberra pulseaudio];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-sdk/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-sdk/default.nix
new file mode 100644
index 000000000000..68f5a30fc936
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-sdk/default.nix
@@ -0,0 +1,9 @@
+{
+  mkKdeDerivation,
+  qtsvg,
+}:
+mkKdeDerivation {
+  pname = "plasma-sdk";
+
+  extraBuildInputs = [qtsvg];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-systemmonitor/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-systemmonitor/default.nix
new file mode 100644
index 000000000000..8a8bff96ecff
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-systemmonitor/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "plasma-systemmonitor";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-thunderbolt/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-thunderbolt/default.nix
new file mode 100644
index 000000000000..5b1b682ac9bc
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-thunderbolt/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "plasma-thunderbolt";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-vault/0001-encfs-path.patch b/nixpkgs/pkgs/kde/plasma/plasma-vault/0001-encfs-path.patch
new file mode 100644
index 000000000000..a5e9d8c531e1
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-vault/0001-encfs-path.patch
@@ -0,0 +1,31 @@
+From fef6bfe87db4411e3dda2f96741cd8204fe41d85 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 2 Nov 2021 05:57:50 -0500
+Subject: [PATCH 1/3] encfs path
+
+---
+ kded/engine/backends/encfs/encfsbackend.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/kded/engine/backends/encfs/encfsbackend.cpp b/kded/engine/backends/encfs/encfsbackend.cpp
+index 2d15fa2..3f49867 100644
+--- a/kded/engine/backends/encfs/encfsbackend.cpp
++++ b/kded/engine/backends/encfs/encfsbackend.cpp
+@@ -101,12 +101,12 @@ QProcess *EncFsBackend::encfs(const QStringList &arguments) const
+     auto config = KSharedConfig::openConfig(PLASMAVAULT_CONFIG_FILE);
+     KConfigGroup backendConfig(config, "EncfsBackend");
+ 
+-    return process("encfs", arguments + backendConfig.readEntry("extraMountOptions", QStringList{}), {});
++    return process(NIXPKGS_ENCFS, arguments + backendConfig.readEntry("extraMountOptions", QStringList{}), {});
+ }
+ 
+ QProcess *EncFsBackend::encfsctl(const QStringList &arguments) const
+ {
+-    return process("encfsctl", arguments, {});
++    return process(NIXPKGS_ENCFSCTL, arguments, {});
+ }
+ 
+ } // namespace PlasmaVault
+-- 
+2.33.1
+
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-vault/0002-cryfs-path.patch b/nixpkgs/pkgs/kde/plasma/plasma-vault/0002-cryfs-path.patch
new file mode 100644
index 000000000000..4c7567b15076
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-vault/0002-cryfs-path.patch
@@ -0,0 +1,25 @@
+From a89a0d3f9088d272c01ccb9b730d1dbb500f9cb8 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 2 Nov 2021 05:59:34 -0500
+Subject: [PATCH 2/3] cryfs path
+
+---
+ kded/engine/backends/cryfs/cryfsbackend.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/kded/engine/backends/cryfs/cryfsbackend.cpp b/kded/engine/backends/cryfs/cryfsbackend.cpp
+index 64138b6..1a9fde2 100644
+--- a/kded/engine/backends/cryfs/cryfsbackend.cpp
++++ b/kded/engine/backends/cryfs/cryfsbackend.cpp
+@@ -207,7 +207,7 @@ QProcess *CryFsBackend::cryfs(const QStringList &arguments) const
+     auto config = KSharedConfig::openConfig(PLASMAVAULT_CONFIG_FILE);
+     KConfigGroup backendConfig(config, "CryfsBackend");
+ 
+-    return process("cryfs", arguments + backendConfig.readEntry("extraMountOptions", QStringList{}), {{"CRYFS_FRONTEND", "noninteractive"}});
++    return process(NIXPKGS_CRYFS, arguments + backendConfig.readEntry("extraMountOptions", QStringList{}), {{"CRYFS_FRONTEND", "noninteractive"}});
+ }
+ 
+ } // namespace PlasmaVault
+-- 
+2.33.1
+
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-vault/0003-fusermount-path.patch b/nixpkgs/pkgs/kde/plasma/plasma-vault/0003-fusermount-path.patch
new file mode 100644
index 000000000000..0d4481c70541
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-vault/0003-fusermount-path.patch
@@ -0,0 +1,25 @@
+From 63571e28c65935f32567c0b179a096d62726b778 Mon Sep 17 00:00:00 2001
+From: Thomas Tuegel <ttuegel@mailbox.org>
+Date: Tue, 2 Nov 2021 06:00:32 -0500
+Subject: [PATCH 3/3] fusermount path
+
+---
+ kded/engine/fusebackend_p.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/kded/engine/fusebackend_p.cpp b/kded/engine/fusebackend_p.cpp
+index 91f3523..1c19d88 100644
+--- a/kded/engine/fusebackend_p.cpp
++++ b/kded/engine/fusebackend_p.cpp
+@@ -86,7 +86,7 @@ QProcess *FuseBackend::process(const QString &executable, const QStringList &arg
+ 
+ QProcess *FuseBackend::fusermount(const QStringList &arguments) const
+ {
+-    return process("fusermount", arguments, {});
++    return process(NIXPKGS_FUSERMOUNT, arguments, {});
+ }
+ 
+ FutureResult<> FuseBackend::initialize(const QString &name, const Device &device, const MountPoint &mountPoint, const Vault::Payload &payload)
+-- 
+2.33.1
+
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-vault/0004-gocryptfs-path.patch b/nixpkgs/pkgs/kde/plasma/plasma-vault/0004-gocryptfs-path.patch
new file mode 100644
index 000000000000..8790f877ff07
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-vault/0004-gocryptfs-path.patch
@@ -0,0 +1,13 @@
+diff --git a/kded/engine/backends/gocryptfs/gocryptfsbackend.cpp b/kded/engine/backends/gocryptfs/gocryptfsbackend.cpp
+index 2d6df94..3e8ec9a 100644
+--- a/kded/engine/backends/gocryptfs/gocryptfsbackend.cpp
++++ b/kded/engine/backends/gocryptfs/gocryptfsbackend.cpp
+@@ -202,7 +202,7 @@ QProcess *GocryptfsBackend::gocryptfs(const QStringList &arguments) const
+     auto config = KSharedConfig::openConfig(PLASMAVAULT_CONFIG_FILE);
+     KConfigGroup backendConfig(config, "GocryptfsBackend");
+ 
+-    return process("gocryptfs", arguments + backendConfig.readEntry("extraMountOptions", QStringList{}), {});
++    return process(NIXPKGS_GOCRYPTFS, arguments + backendConfig.readEntry("extraMountOptions", QStringList{}), {});
+ }
+ 
+ QString GocryptfsBackend::getConfigFilePath(const Device &device) const
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-vault/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-vault/default.nix
new file mode 100644
index 000000000000..9ab545ab87b8
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-vault/default.nix
@@ -0,0 +1,29 @@
+{
+  lib,
+  mkKdeDerivation,
+  pkg-config,
+  gocryptfs,
+  fuse,
+  cryfs,
+  encfs,
+}:
+mkKdeDerivation {
+  pname = "plasma-vault";
+
+  patches = [
+    ./0001-encfs-path.patch
+    ./0002-cryfs-path.patch
+    ./0003-fusermount-path.patch
+    ./0004-gocryptfs-path.patch
+  ];
+
+  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\"''
+    ''-DNIXPKGS_GOCRYPTFS=\"${lib.getBin gocryptfs}/bin/gocryptfs\"''
+  ];
+
+  extraNativeBuildInputs = [pkg-config];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-welcome/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-welcome/default.nix
new file mode 100644
index 000000000000..976a788a16e9
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-welcome/default.nix
@@ -0,0 +1,10 @@
+{
+  mkKdeDerivation,
+  qtsvg,
+  kuserfeedback,
+}:
+mkKdeDerivation {
+  pname = "plasma-welcome";
+
+  extraBuildInputs = [qtsvg kuserfeedback];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-workspace-wallpapers/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-workspace-wallpapers/default.nix
new file mode 100644
index 000000000000..af8c89249274
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-workspace-wallpapers/default.nix
@@ -0,0 +1,9 @@
+{
+  mkKdeDerivation,
+  extra-cmake-modules,
+}:
+mkKdeDerivation {
+  pname = "plasma-workspace-wallpapers";
+
+  extraBuildInputs = [extra-cmake-modules];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-workspace/default.nix b/nixpkgs/pkgs/kde/plasma/plasma-workspace/default.nix
new file mode 100644
index 000000000000..24e41b971cf0
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-workspace/default.nix
@@ -0,0 +1,54 @@
+{
+  lib,
+  mkKdeDerivation,
+  substituteAll,
+  xorg,
+  pkg-config,
+  spirv-tools,
+  qtsvg,
+  qtwayland,
+  libcanberra,
+  libqalculate,
+  pipewire,
+  breeze,
+  qttools,
+  qqc2-breeze-style,
+  gpsd,
+}:
+mkKdeDerivation {
+  pname = "plasma-workspace";
+
+  patches = [
+    (substituteAll {
+      src = ./tool-paths.patch;
+      xmessage = "${lib.getBin xorg.xmessage}/bin/xmessage";
+      xsetroot = "${lib.getBin xorg.xsetroot}/bin/xsetroot";
+      qdbus = "${lib.getBin qttools}/bin/qdbus";
+    })
+    (substituteAll {
+      src = ./wallpaper-paths.patch;
+      wallpapers = "${lib.getBin breeze}/share/wallpapers";
+    })
+  ];
+
+  extraNativeBuildInputs = [pkg-config spirv-tools];
+  extraBuildInputs = [
+    qtsvg
+    qtwayland
+
+    qqc2-breeze-style
+
+    libcanberra
+    libqalculate
+    pipewire
+
+    xorg.libSM
+    xorg.libXcursor
+    xorg.libXtst
+    xorg.libXft
+
+    gpsd
+  ];
+
+  passthru.providedSessions = ["plasma" "plasmax11"];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-workspace/tool-paths.patch b/nixpkgs/pkgs/kde/plasma/plasma-workspace/tool-paths.patch
new file mode 100644
index 000000000000..d750028200b2
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-workspace/tool-paths.patch
@@ -0,0 +1,68 @@
+diff --git a/kcms/krdb/krdb.cpp b/kcms/krdb/krdb.cpp
+index 46363ddcb..d787f9993 100644
+--- a/kcms/krdb/krdb.cpp
++++ b/kcms/krdb/krdb.cpp
+@@ -468,7 +468,7 @@ void runRdb(unsigned int flags)
+     proc.execute();
+ 
+     // Needed for applications that don't set their own cursor.
+-    QProcess::execute(QStringLiteral("xsetroot"), {QStringLiteral("-cursor_name"), QStringLiteral("left_ptr")});
++    QProcess::execute(QStringLiteral("@xsetroot@"), {QStringLiteral("-cursor_name"), QStringLiteral("left_ptr")});
+ 
+     applyGtkStyles(1);
+     applyGtkStyles(2);
+diff --git a/startkde/startplasma.cpp b/startkde/startplasma.cpp
+index b0158c97d..c8f7fe223 100644
+--- a/startkde/startplasma.cpp
++++ b/startkde/startplasma.cpp
+@@ -50,7 +50,7 @@ void sigtermHandler(int signalNumber)
+ void messageBox(const QString &text)
+ {
+     out << text;
+-    runSync(QStringLiteral("xmessage"), {QStringLiteral("-geometry"), QStringLiteral("500x100"), text});
++    runSync(QStringLiteral("@xmessage@"), {QStringLiteral("-geometry"), QStringLiteral("500x100"), text});
+ }
+ 
+ QStringList allServices(const QLatin1String &prefix)
+@@ -484,7 +484,7 @@ QProcess *setupKSplash()
+         if (ksplashCfg.readEntry("Engine", QStringLiteral("KSplashQML")) == QLatin1String("KSplashQML")) {
+             p = new QProcess;
+             p->setProcessChannelMode(QProcess::ForwardedChannels);
+-            p->start(QStringLiteral("ksplashqml"), {ksplashCfg.readEntry("Theme", QStringLiteral("Breeze"))});
++            p->start(QStringLiteral(CMAKE_INSTALL_FULL_BINDIR "/ksplashqml"), {ksplashCfg.readEntry("Theme", QStringLiteral("Breeze"))});
+         }
+     }
+     return p;
+diff --git a/ksmserver/plasma-restoresession.service.in b/ksmserver/plasma-restoresession.service.in
+index 2c52a4b87..fd7fdc8ac 100644
+--- a/ksmserver/plasma-restoresession.service.in
++++ b/ksmserver/plasma-restoresession.service.in
+@@ -5,5 +5,5 @@ RefuseManualStart=yes
+
+ [Service]
+ Type=oneshot
+-ExecStart=-@QtBinariesDir@/qdbus org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.restoreSession
++ExecStart=-@qdbus@ org.kde.ksmserver /KSMServer org.kde.KSMServerInterface.restoreSession
+ Slice=session.slice
+diff --git a/startkde/kcminit/plasma-kcminit-phase1.service.in b/startkde/kcminit/plasma-kcminit-phase1.service.in
+index 7218628ce..9126475ea 100644
+--- a/startkde/kcminit/plasma-kcminit-phase1.service.in
++++ b/startkde/kcminit/plasma-kcminit-phase1.service.in
+@@ -6,5 +6,5 @@ PartOf=graphical-session.target
+
+ [Service]
+ Type=oneshot
+-ExecStart=@QtBinariesDir@/qdbus org.kde.kcminit /kcminit org.kde.KCMInit.runPhase1
++ExecStart=@qdbus@ org.kde.kcminit /kcminit org.kde.KCMInit.runPhase1
+ Slice=session.slice
+diff --git a/startkde/systemd/plasma-ksplash-ready.service.in b/startkde/systemd/plasma-ksplash-ready.service.in
+index 3f6744f37..c51266794 100644
+--- a/startkde/systemd/plasma-ksplash-ready.service.in
++++ b/startkde/systemd/plasma-ksplash-ready.service.in
+@@ -6,5 +6,5 @@ PartOf=graphical-session.target
+
+ [Service]
+ Type=oneshot
+-ExecStart=-@QtBinariesDir@/qdbus org.kde.KSplash /KSplash org.kde.KSplash.setStage ready
++ExecStart=-@qdbus@ org.kde.KSplash /KSplash org.kde.KSplash.setStage ready
+ Slice=session.slice
diff --git a/nixpkgs/pkgs/kde/plasma/plasma-workspace/wallpaper-paths.patch b/nixpkgs/pkgs/kde/plasma/plasma-workspace/wallpaper-paths.patch
new file mode 100644
index 000000000000..050200a8411f
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma-workspace/wallpaper-paths.patch
@@ -0,0 +1,9 @@
+--- a/lookandfeel/sddm-theme/theme.conf.cmake
++++ b/lookandfeel/sddm-theme/theme.conf.cmake
+@@ -4,5 +4,5 @@ logo=${KDE_INSTALL_FULL_DATADIR}/sddm/themes/breeze/default-logo.svg
+ type=image
+ color=#1d99f3
+ fontSize=10
+-background=${KDE_INSTALL_FULL_WALLPAPERDIR}/Next/contents/images/5120x2880.png
++background=@wallpapers@/Next/contents/images/5120x2880.png
+ needsFullUserModel=false
diff --git a/nixpkgs/pkgs/kde/plasma/plasma5support/default.nix b/nixpkgs/pkgs/kde/plasma/plasma5support/default.nix
new file mode 100644
index 000000000000..385626aeedc0
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plasma5support/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "plasma5support";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/plymouth-kcm/default.nix b/nixpkgs/pkgs/kde/plasma/plymouth-kcm/default.nix
new file mode 100644
index 000000000000..dcf339dd9b2e
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/plymouth-kcm/default.nix
@@ -0,0 +1,11 @@
+{
+  mkKdeDerivation,
+  pkg-config,
+  plymouth,
+}:
+mkKdeDerivation {
+  pname = "plymouth-kcm";
+
+  extraNativeBuildInputs = [pkg-config];
+  extraBuildInputs = [plymouth];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/polkit-kde-agent-1/default.nix b/nixpkgs/pkgs/kde/plasma/polkit-kde-agent-1/default.nix
new file mode 100644
index 000000000000..6c4bf0653f09
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/polkit-kde-agent-1/default.nix
@@ -0,0 +1,9 @@
+{
+  mkKdeDerivation,
+  qtdeclarative,
+}:
+mkKdeDerivation {
+  pname = "polkit-kde-agent-1";
+
+  extraBuildInputs = [qtdeclarative];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/powerdevil/default.nix b/nixpkgs/pkgs/kde/plasma/powerdevil/default.nix
new file mode 100644
index 000000000000..8b0c270e85c6
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/powerdevil/default.nix
@@ -0,0 +1,11 @@
+{
+  mkKdeDerivation,
+  pkg-config,
+  libcap,
+}:
+mkKdeDerivation {
+  pname = "powerdevil";
+
+  extraNativeBuildInputs = [pkg-config];
+  extraBuildInputs = [libcap];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/print-manager/default.nix b/nixpkgs/pkgs/kde/plasma/print-manager/default.nix
new file mode 100644
index 000000000000..fce60dcb968b
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/print-manager/default.nix
@@ -0,0 +1,10 @@
+{
+  mkKdeDerivation,
+  cups,
+}:
+mkKdeDerivation {
+  pname = "print-manager";
+
+  # FIXME: cups-smb?
+  extraBuildInputs = [cups];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/qqc2-breeze-style/default.nix b/nixpkgs/pkgs/kde/plasma/qqc2-breeze-style/default.nix
new file mode 100644
index 000000000000..2d950f63e0c5
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/qqc2-breeze-style/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "qqc2-breeze-style";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/sddm-kcm/default.nix b/nixpkgs/pkgs/kde/plasma/sddm-kcm/default.nix
new file mode 100644
index 000000000000..d60c5e4e6ff7
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/sddm-kcm/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "sddm-kcm";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/systemsettings/default.nix b/nixpkgs/pkgs/kde/plasma/systemsettings/default.nix
new file mode 100644
index 000000000000..2dd529b9380e
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/systemsettings/default.nix
@@ -0,0 +1,4 @@
+{mkKdeDerivation}:
+mkKdeDerivation {
+  pname = "systemsettings";
+}
diff --git a/nixpkgs/pkgs/kde/plasma/wacomtablet/default.nix b/nixpkgs/pkgs/kde/plasma/wacomtablet/default.nix
new file mode 100644
index 000000000000..c24e8739f746
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/wacomtablet/default.nix
@@ -0,0 +1,12 @@
+{
+  mkKdeDerivation,
+  pkg-config,
+  libwacom,
+  xf86_input_wacom,
+}:
+mkKdeDerivation {
+  pname = "wacomtablet";
+
+  extraNativeBuildInputs = [pkg-config];
+  extraBuildInputs = [libwacom xf86_input_wacom];
+}
diff --git a/nixpkgs/pkgs/kde/plasma/xdg-desktop-portal-kde/default.nix b/nixpkgs/pkgs/kde/plasma/xdg-desktop-portal-kde/default.nix
new file mode 100644
index 000000000000..9d5be65fe097
--- /dev/null
+++ b/nixpkgs/pkgs/kde/plasma/xdg-desktop-portal-kde/default.nix
@@ -0,0 +1,14 @@
+{
+  mkKdeDerivation,
+  pkg-config,
+  qtwayland,
+  wayland,
+  wayland-protocols,
+  cups,
+}:
+mkKdeDerivation {
+  pname = "xdg-desktop-portal-kde";
+
+  extraNativeBuildInputs = [pkg-config];
+  extraBuildInputs = [qtwayland wayland wayland-protocols cups];
+}