summary refs log tree commit diff
path: root/pkgs/desktops
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@gmail.com>2015-01-19 11:38:34 -0600
committerThomas Tuegel <ttuegel@gmail.com>2015-01-26 20:59:52 -0600
commit62bfe75d425b797dc299cecb1fba42580e86a5b1 (patch)
tree2ea0b9d6180729ad86de99cc7378c841ac02477d /pkgs/desktops
parent1b884b49a6ab4521acfeba62e09a48ab7663413b (diff)
downloadnixlib-62bfe75d425b797dc299cecb1fba42580e86a5b1.tar
nixlib-62bfe75d425b797dc299cecb1fba42580e86a5b1.tar.gz
nixlib-62bfe75d425b797dc299cecb1fba42580e86a5b1.tar.bz2
nixlib-62bfe75d425b797dc299cecb1fba42580e86a5b1.tar.lz
nixlib-62bfe75d425b797dc299cecb1fba42580e86a5b1.tar.xz
nixlib-62bfe75d425b797dc299cecb1fba42580e86a5b1.tar.zst
nixlib-62bfe75d425b797dc299cecb1fba42580e86a5b1.zip
add plasma-5.1.2
Diffstat (limited to 'pkgs/desktops')
-rw-r--r--pkgs/desktops/plasma-5.1/default.nix129
-rw-r--r--pkgs/desktops/plasma-5.1/dependencies.nix220
-rwxr-xr-xpkgs/desktops/plasma-5.1/dependencies.sh22
-rw-r--r--pkgs/desktops/plasma-5.1/kwin/kwin-import-plugin-follow-symlinks.patch13
-rw-r--r--pkgs/desktops/plasma-5.1/libkscreen/libkscreen-backend-path.patch130
-rw-r--r--pkgs/desktops/plasma-5.1/manifest.nix166
-rwxr-xr-xpkgs/desktops/plasma-5.1/manifest.sh15
-rw-r--r--pkgs/desktops/plasma-5.1/plasma-desktop/plasma-desktop-hwclock.patch24
-rw-r--r--pkgs/desktops/plasma-5.1/plasma-desktop/plasma-desktop-zoneinfo.patch18
-rw-r--r--pkgs/desktops/plasma-5.1/renames.nix24
-rw-r--r--pkgs/desktops/plasma-5.1/setup-hook.sh1
-rw-r--r--pkgs/desktops/plasma-5.1/startkde/default.nix29
-rw-r--r--pkgs/desktops/plasma-5.1/startkde/kdeglobals11
-rw-r--r--pkgs/desktops/plasma-5.1/startkde/startkde.in361
-rw-r--r--pkgs/desktops/plasma-5.1/startkde/startupconfigkeys5
15 files changed, 1168 insertions, 0 deletions
diff --git a/pkgs/desktops/plasma-5.1/default.nix b/pkgs/desktops/plasma-5.1/default.nix
new file mode 100644
index 000000000000..3c72cbb32be4
--- /dev/null
+++ b/pkgs/desktops/plasma-5.1/default.nix
@@ -0,0 +1,129 @@
+{ autonix, kf55, pkgs, stdenv, debug ? false }:
+
+with stdenv.lib; with autonix;
+
+let
+
+  kf5 = kf55.override { inherit debug; };
+
+  mirror = "mirror://kde";
+
+  renames =
+    builtins.removeAttrs
+      (import ./renames.nix {})
+      ["Backend" "CTest" "KF5Wayland"];
+
+  scope =
+    # packages in this collection
+    (mapAttrs (dep: name: plasma5."${name}") renames) //
+    # packages from KDE Frameworks 5
+    kf5.scope //
+    # packages pinned to this version of Qt 5
+    {
+      PopplerQt5 = (pkgs.poppler.override { inherit (kf5) qt5; }).poppler_qt5;
+    } //
+    # packages from nixpkgs
+    (with pkgs;
+      {
+        inherit epoxy;
+        Epub = ebook_tools;
+        Exiv2 = exiv2;
+        FFmpeg = ffmpeg;
+        FONTFORGE_EXECUTABLE = fontforge;
+        Freetype = freetype;
+        LibSSH = libssh;
+        ModemManager = modemmanager;
+        NetworkManager = networkmanager;
+        PulseAudio = pulseaudio;
+        Taglib = taglib;
+        Xapian = xapian;
+      }
+    );
+
+  preResolve = super:
+    fold (f: x: f x) super
+      [
+        (userEnvPkg "SharedMimeInfo")
+        (userEnvPkg "SharedDesktopOntologies")
+        (blacklist ["kwayland"])
+      ];
+
+  postResolve = super:
+    (builtins.removeAttrs super ["breeze"]) // {
+
+      breeze-qt4 = with pkgs; super.breeze // {
+        name = "breeze-qt4-" + (builtins.parseDrvName super.breeze.name).version;
+        buildInputs = [ xlibs.xproto kde4.kdelibs qt4 ];
+        nativeBuildInputs = [ cmake pkgconfig ];
+        cmakeFlags =
+          [
+            "-DUSE_KDE4=ON"
+            "-DQT_QMAKE_EXECUTABLE=${qt4}/bin/qmake"
+          ];
+      };
+
+      breeze-qt5 = with pkgs; super.breeze // {
+        name = "breeze-qt5-" + (builtins.parseDrvName super.breeze.name).version;
+        buildInputs = with kf5;
+          [
+            kcompletion kconfig kconfigwidgets kcoreaddons frameworkintegration
+            ki18n kwindowsystem qt5
+          ];
+        nativeBuildInputs = [ cmake kf5.extra-cmake-modules pkgconfig ];
+        cmakeFlags = [ "-DUSE_KDE4=OFF" ];
+      };
+
+      kwin = with pkgs; super.kwin // {
+        buildInputs = with xlibs;
+          super.kwin.buildInputs ++ [ libICE libSM libXcursor ];
+        patches = [ ./kwin/kwin-import-plugin-follow-symlinks.patch ];
+      };
+
+      libkscreen = with pkgs; super.libkscreen // {
+        buildInputs = with xlibs;
+          super.libkscreen.buildInputs ++ [libXrandr];
+        patches = [ ./libkscreen/libkscreen-backend-path.patch ];
+      };
+
+      plasma-desktop = with pkgs; super.plasma-desktop // {
+        buildInputs = with xlibs;
+          super.plasma-desktop.buildInputs ++
+          [ pkgs.libcanberra libxkbfile libXcursor ];
+        patches = [
+          ./plasma-desktop/plasma-desktop-hwclock.patch
+          ./plasma-desktop/plasma-desktop-zoneinfo.patch
+        ];
+        preConfigure = ''
+          substituteInPlace kcms/dateandtime/helper.cpp \
+            --subst-var-by hwclock "${utillinux}/sbin/hwclock"
+        '';
+      };
+
+      plasma-workspace = with pkgs; super.plasma-workspace // {
+        buildInputs = with xlibs;
+          super.plasma-workspace.buildInputs ++ [ libSM libXcursor pam ];
+        postInstall = ''
+          # We use a custom startkde script
+          rm $out/bin/startkde
+        '';
+      };
+
+      powerdevil = with pkgs; super.powerdevil // {
+        buildInputs = with xlibs; super.powerdevil.buildInputs ++ [libXrandr];
+      };
+
+    };
+
+  plasma5 = generateCollection ./. {
+    inherit (kf5) mkDerivation;
+    inherit mirror preResolve postResolve scope;
+  };
+
+in
+  plasma5 // {
+    inherit scope;
+    startkde = pkgs.callPackage ./startkde {
+      inherit (kf5) kconfig kinit kservice;
+      inherit (plasma5) plasma-desktop plasma-workspace;
+    };
+  }
diff --git a/pkgs/desktops/plasma-5.1/dependencies.nix b/pkgs/desktops/plasma-5.1/dependencies.nix
new file mode 100644
index 000000000000..9402857e2487
--- /dev/null
+++ b/pkgs/desktops/plasma-5.1/dependencies.nix
@@ -0,0 +1,220 @@
+# DO NOT EDIT! This file is generated automatically.
+{ }:
+{
+  baloo = {
+    buildInputs = [ "ECM" "KF5" "KF5Abc" "KF5Akonadi" "KF5AkonadiMime" "KF5AkonadiServer" "KF5Auth" "KF5CalendarCore" "KF5Config" "KF5Crash" "KF5FileMetaData" "KF5I18n" "KF5IdleTime" "KF5KCMUtils" "KF5KDELibs4Support" "KF5KIO" "KF5Mime" "KF5PimUtils" "KF5Solid" "Qt5" "Qt5Test" "Xapian" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [ "KF5CoreAddons" "KF5FileMetaData" "Qt5Core" "Xapian" ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  breeze = {
+    buildInputs = [ "ECM" "KDE4" "KDecorations" "KF5" "KF5Completion" "KF5Config" "KF5ConfigWidgets" "KF5CoreAddons" "KF5FrameworkIntegration" "KF5I18n" "KF5WindowSystem" "PkgConfig" "Qt5" "XCB" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  kde-cli-tools = {
+    buildInputs = [ "ECM" "KF5" "KF5Config" "KF5I18n" "KF5IconThemes" "KF5KCMUtils" "KF5KDE4Support" "KF5Su" "KF5WindowSystem" "Qt5" "Qt5Test" "Qt5X11Extras" "X11" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  kdeplasma-addons = {
+    buildInputs = [ "ECM" "GIO" "GLIB2" "GObject" "IBus" "KDE4" "KF5" "KF5Config" "KF5ConfigWidgets" "KF5CoreAddons" "KF5I18n" "KF5KCMUtils" "KF5KDELibs4Support" "KF5KIO" "KF5Plasma" "KF5Runner" "KF5Service" "KF5UnitConversion" "KdepimLibs" "Kexiv2" "Lancelot" "Lancelot-Datamodels" "Qt5" "SCIM" "SharedMimeInfo" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [ "SharedMimeInfo" ];
+  };
+
+  kfilemetadata = {
+    buildInputs = [ "ECM" "EPub" "Exiv2" "FFmpeg" "KF5" "KF5Archive" "KF5I18n" "PopplerQt5" "QMobipocket" "Qt5" "Taglib" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [ "Qt5Core" ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  khelpcenter = {
+    buildInputs = [ "ECM" "KF5" "KF5Config" "KF5I18n" "KF5Init" "KF5KCMUtils" "KF5KDE4Support" "KF5KHtml" "Qt5" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  khotkeys = {
+    buildInputs = [ "ECM" "KF5" "KF5DBusAddons" "KF5GlobalAccel" "KF5I18n" "KF5KCMUtils" "KF5KDE4Support" "KF5KIO" "KF5Plasma" "KF5XmlGui" "LibKWorkspace" "Qt5" "X11" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  kinfocenter = {
+    buildInputs = [ "ECM" "EGL" "KF5" "KF5Completion" "KF5Config" "KF5ConfigWidgets" "KF5CoreAddons" "KF5DBusAddons" "KF5DocTools" "KF5I18n" "KF5IconThemes" "KF5KCMUtils" "KF5KDELibs4Support" "KF5KIO" "KF5Service" "KF5Solid" "KF5Wayland" "KF5WidgetsAddons" "KF5XmlGui" "OpenGL" "OpenGLES" "PCIUTILS" "Qt5" "RAW1394" "X11" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  kio-extras = {
+    buildInputs = [ "ECM" "Exiv2" "JPEG" "KF5" "KF5Archive" "KF5Config" "KF5ConfigWidgets" "KF5CoreAddons" "KF5DBusAddons" "KF5DNSSD" "KF5DocTools" "KF5I18n" "KF5IconThemes" "KF5KDE4Support" "KF5KHtml" "KF5KIO" "KF5Solid" "LibSSH" "OpenEXR" "Phonon4Qt5" "Qt5" "Qt5Test" "SLP" "Samba" "SharedMimeInfo" ];
+    nativeBuildInputs = [ "MD5SUM_EXECUTABLE" "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [ "SharedMimeInfo" ];
+  };
+
+  kmenuedit = {
+    buildInputs = [ "ECM" "KF5" "KF5DBusAddons" "KF5I18n" "KF5IconThemes" "KF5KDELibs4Support" "KF5KIO" "KF5Sonnet" "KF5XmlGui" "KHotKeysDBusInterface" "Qt5" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  ksysguard = {
+    buildInputs = [ "ECM" "KF5" "KF5Config" "KF5CoreAddons" "KF5I18n" "KF5IconThemes" "KF5ItemViews" "KF5KDE4Support" "KF5NewStuff" "KF5SysGuard" "Qt5" "Sensors" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  kwayland = {
+    buildInputs = [ "ECM" "Qt5" "Wayland" ];
+    nativeBuildInputs = [ "WAYLAND_SCANNER_EXECUTABLE" "cmake" ];
+    propagatedBuildInputs = [ "Qt5Gui" ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  kwin = {
+    buildInputs = [ "ECM" "EGL" "KF5" "KF5Activities" "KF5Completion" "KF5Config" "KF5ConfigWidgets" "KF5CoreAddons" "KF5Crash" "KF5Declarative" "KF5DocTools" "KF5GlobalAccel" "KF5I18n" "KF5Init" "KF5KCMUtils" "KF5KIO" "KF5NewStuff" "KF5Notifications" "KF5Plasma" "KF5Service" "KF5Wayland" "KF5WidgetsAddons" "KF5WindowSystem" "KF5XmlGui" "OpenGL" "OpenGLES" "Qt5" "Qt5Multimedia" "Qt5Test" "Wayland" "X11" "XCB" "XKB" "epoxy" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [ "KF5Config" "KF5Service" "KF5WindowSystem" ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  kwrited = {
+    buildInputs = [ "ECM" "KF5" "KF5DBusAddons" "KF5KDE4Support" "KF5Pty" "Qt5" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  libkscreen = {
+    buildInputs = [ "Doxygen" "ECM" "Qt5" "X11" "XCB" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [ "Qt5Core" ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  libksysguard = {
+    buildInputs = [ "ECM" "KF5" "KF5Config" "KF5I18n" "KF5KDE4Support" "KF5Plasma" "Qt5" "Qt5X11Extras" "X11" "ZLIB" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [ "Qt5DBus" ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  libmm-qt = {
+    buildInputs = [ "ECM" "KF5ModemManagerQt" "ModemManager" "Qt4" "Qt5" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [ "Qt5Core" ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  libnm-qt = {
+    buildInputs = [ "ECM" "KF5NetworkManagerQt" "NetworkManager" "Qt4" "Qt5" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [ "Qt5Core" ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  milou = {
+    buildInputs = [ "ECM" "KF5" "KF5Declarative" "KF5I18n" "KF5Plasma" "KF5Runner" "KdepimLibs" "Qt5" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  oxygen = {
+    buildInputs = [ "ECM" "KDE4" "KDE4Workspace" "KDecorations" "KF5" "KF5Completion" "KF5Config" "KF5FrameworkIntegration" "KF5GuiAddons" "KF5I18n" "KF5Service" "KF5WidgetsAddons" "KF5WindowSystem" "PkgConfig" "Qt5" "XCB" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  oxygen-fonts = {
+    buildInputs = [ "ECM" ];
+    nativeBuildInputs = [ "FONTFORGE_EXECUTABLE" "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  plasma-desktop = {
+    buildInputs = [ "ECM" "Fontconfig" "Freetype" "GLIB2" "KDE4" "KDecorations" "KF5" "KF5Activities" "KF5Attica" "KF5Auth" "KF5DocTools" "KF5Emoticons" "KF5I18n" "KF5ItemModels" "KF5KCMUtils" "KF5KDELibs4Support" "KF5NewStuff" "KF5NotifyConfig" "KF5Plasma" "KF5PlasmaQuick" "KF5Runner" "KF5Wallet" "KRunnerAppDBusInterface" "KSMServerDBusInterface" "KWinDBusInterface" "LibKWorkspace" "LibTaskManager" "OpenGL" "OpenGLES" "PackageKitQt5" "Phonon4Qt5" "PulseAudio" "Qt4" "Qt5" "ScreenSaverDBusInterface" "Strigi" "USB" "X11" "XCB" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  plasma-nm = {
+    buildInputs = [ "ECM" "KF5" "KF5Completion" "KF5ConfigWidgets" "KF5CoreAddons" "KF5DBusAddons" "KF5Declarative" "KF5I18n" "KF5IconThemes" "KF5Init" "KF5ItemViews" "KF5KDELibs4Support" "KF5KIO" "KF5ModemManagerQt" "KF5NetworkManagerQt" "KF5Notifications" "KF5Plasma" "KF5Service" "KF5Solid" "KF5Wallet" "KF5WidgetsAddons" "KF5WindowSystem" "KF5XmlGui" "MobileBroadbandProviderInfo" "ModemManager" "NetworkManager" "OpenConnect" "OpenSSL" "Qt5" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  plasma-workspace = {
+    buildInputs = [ "ECM" "KF5" "KF5Activities" "KF5Baloo" "KF5Config" "KF5CoreAddons" "KF5Crash" "KF5DBusAddons" "KF5Declarative" "KF5DocTools" "KF5I18n" "KF5IdleTime" "KF5JsEmbed" "KF5KCMUtils" "KF5KDELibs4Support" "KF5KIO" "KF5NO_MODULE" "KF5NewStuff" "KF5NotifyConfig" "KF5Plasma" "KF5PlasmaQuick" "KF5Runner" "KF5Screen" "KF5Solid" "KF5Su" "KF5SysGuard" "KF5TextEditor" "KF5TextWidgets" "KF5Wallet" "KF5WebKit" "KWinDBusInterface" "Phonon4Qt5" "Prison" "Qalculate" "Qt5" "Qt5DBus" "Qt5Qml" "Qt5Quick" "Qt5Script" "Qt5Test" "X11" "XCB" "ZLIB" "dbusmenu-qt5" "libgps" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [ "KF5KIO" "KF5SysGuard" ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  plasma-workspace-wallpapers = {
+    buildInputs = [ "ECM" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  powerdevil = {
+    buildInputs = [ "ECM" "KF5" "KF5Auth" "KF5Config" "KF5GlobalAccel" "KF5I18n" "KF5IdleTime" "KF5KDELibs4Support" "KF5KIO" "KF5NotifyConfig" "KF5Solid" "LibKWorkspace" "Qt5" "ScreenSaverDBusInterface" "UDev" "X11" "XCB" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+  systemsettings = {
+    buildInputs = [ "ECM" "KF5" "KF5Config" "KF5DBusAddons" "KF5I18n" "KF5IconThemes" "KF5ItemViews" "KF5KCMUtils" "KF5KDELibs4Support" "KF5KHtml" "KF5KIO" "KF5Service" "KF5WindowSystem" "KF5XmlGui" "Qt5" ];
+    nativeBuildInputs = [ "cmake" ];
+    propagatedBuildInputs = [  ];
+    propagatedNativeBuildInputs = [  ];
+    propagatedUserEnvPkgs = [  ];
+  };
+
+}
diff --git a/pkgs/desktops/plasma-5.1/dependencies.sh b/pkgs/desktops/plasma-5.1/dependencies.sh
new file mode 100755
index 000000000000..e614efc54759
--- /dev/null
+++ b/pkgs/desktops/plasma-5.1/dependencies.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+# This script rebuilds dependencies.nix.
+# You must run manifest.sh first to download the packages.
+
+# Without arguments, this will use the version of autonix-deps-kf5 in nixpkgs.
+# If you are working on the packages, this is probably what you want.
+
+# You can also pass the path to a source tree where you have built
+# autonix-deps-kf5 yourself. If you are working on autonix-deps-kf5, this is
+# probably what you want.
+
+manifestXML=$(nix-build -E 'with (import ../../.. {}); autonix.writeManifestXML ./manifest.nix')
+
+autonixDepsKf5=""
+if [[ -z $1 ]]; then
+    autonixDepsKF5=$(nix-build ../../.. -A haskellngPackages.autonix-deps-kf5)/bin
+else
+    autonixDepsKF5="$1/dist/build/kf5-deps"
+fi
+
+exec ${autonixDepsKF5}/kf5-deps "${manifestXML}"
diff --git a/pkgs/desktops/plasma-5.1/kwin/kwin-import-plugin-follow-symlinks.patch b/pkgs/desktops/plasma-5.1/kwin/kwin-import-plugin-follow-symlinks.patch
new file mode 100644
index 000000000000..fd1f35d717e3
--- /dev/null
+++ b/pkgs/desktops/plasma-5.1/kwin/kwin-import-plugin-follow-symlinks.patch
@@ -0,0 +1,13 @@
+diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp
+index 26b44a9..d14e226 100644
+--- a/clients/aurorae/src/aurorae.cpp
++++ b/clients/aurorae/src/aurorae.cpp
+@@ -73,7 +73,7 @@ void AuroraeFactory::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/pkgs/desktops/plasma-5.1/libkscreen/libkscreen-backend-path.patch b/pkgs/desktops/plasma-5.1/libkscreen/libkscreen-backend-path.patch
new file mode 100644
index 000000000000..d5797924d233
--- /dev/null
+++ b/pkgs/desktops/plasma-5.1/libkscreen/libkscreen-backend-path.patch
@@ -0,0 +1,130 @@
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 460022f..422a708 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -1,5 +1,7 @@
+ include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${QT_INCLUDES})
+ 
++configure_file(config-libkscreen.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-libkscreen.h)
++
+ set(libkscreen_SRCS
+     backendloader.cpp
+     config.cpp
+diff --git a/src/backendloader.cpp b/src/backendloader.cpp
+index b93e469..8aebc14 100644
+--- a/src/backendloader.cpp
++++ b/src/backendloader.cpp
+@@ -16,6 +16,7 @@
+  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA       *
+  *************************************************************************************/
+ 
++#include "config-libkscreen.h"
+ #include "backendloader.h"
+ #include "debug_p.h"
+ #include "backends/abstractbackend.h"
+@@ -40,55 +41,54 @@ bool BackendLoader::init()
+     const QString backend = qgetenv("KSCREEN_BACKEND").constData();
+     const QString backendFilter = QString::fromLatin1("KSC_%1*").arg(backend);
+ 
+-    const QStringList paths = QCoreApplication::libraryPaths();
+-    Q_FOREACH (const QString &path, paths) {
+-        const QDir dir(path + QDir::separator() + QLatin1String("/kf5/kscreen/"),
+-                       backendFilter,
+-                       QDir::SortFlags(QDir::QDir::NoSort),
+-                       QDir::NoDotAndDotDot | QDir::Files);
+-        const QFileInfoList finfos = dir.entryInfoList();
+-        Q_FOREACH (const QFileInfo &finfo, finfos) {
+-            // Skip "Fake" backend unless explicitly specified via KSCREEN_BACKEND
+-            if (backend.isEmpty() && finfo.fileName().contains(QLatin1String("KSC_Fake"))) {
+-                continue;
+-            }
++    QString path = QFile::decodeName(CMAKE_INSTALL_PREFIX "/" PLUGIN_INSTALL_DIR "/");
+ 
+-            // When on X11, skip the QScreen backend, instead use the XRandR backend,
+-            // if not specified in KSCREEN_BACKEND
+-            if (backend.isEmpty() &&
+-                    finfo.fileName().contains(QLatin1String("KSC_QScreen")) &&
+-                    QX11Info::isPlatformX11()) {
+-                continue;
+-            }
++    const QDir dir(path + QDir::separator() + QLatin1String("/kf5/kscreen/"),
++                   backendFilter,
++                   QDir::SortFlags(QDir::QDir::NoSort),
++                   QDir::NoDotAndDotDot | QDir::Files);
++    const QFileInfoList finfos = dir.entryInfoList();
++    Q_FOREACH (const QFileInfo &finfo, finfos) {
++        // Skip "Fake" backend unless explicitly specified via KSCREEN_BACKEND
++        if (backend.isEmpty() && finfo.fileName().contains(QLatin1String("KSC_Fake"))) {
++            continue;
++        }
+ 
+-            // When not on X11, skip the XRandR backend, and fall back to QSCreen
+-            // if not specified in KSCREEN_BACKEND
+-            if (backend.isEmpty() &&
+-                    finfo.fileName().contains(QLatin1String("KSC_XRandR")) &&
+-                    !QX11Info::isPlatformX11()) {
+-                continue;
+-            }
++        // When on X11, skip the QScreen backend, instead use the XRandR backend,
++        // if not specified in KSCREEN_BACKEND
++        if (backend.isEmpty() &&
++                finfo.fileName().contains(QLatin1String("KSC_QScreen")) &&
++                QX11Info::isPlatformX11()) {
++            continue;
++        }
++
++        // When not on X11, skip the XRandR backend, and fall back to QSCreen
++        // if not specified in KSCREEN_BACKEND
++        if (backend.isEmpty() &&
++                finfo.fileName().contains(QLatin1String("KSC_XRandR")) &&
++                !QX11Info::isPlatformX11()) {
++            continue;
++        }
+ 
+-            QPluginLoader loader(finfo.filePath());
+-            loader.load();
+-            QObject *instance = loader.instance();
+-            if (!instance) {
++        QPluginLoader loader(finfo.filePath());
++        loader.load();
++        QObject *instance = loader.instance();
++        if (!instance) {
++            loader.unload();
++            continue;
++        }
++
++        s_backend = qobject_cast< AbstractBackend* >(instance);
++        if (s_backend) {
++            if (!s_backend->isValid()) {
++                qCDebug(KSCREEN) << "Skipping" << s_backend->name() << "backend";
++                delete s_backend;
++                s_backend = 0;
+                 loader.unload();
+                 continue;
+             }
+-
+-            s_backend = qobject_cast< AbstractBackend* >(instance);
+-            if (s_backend) {
+-                if (!s_backend->isValid()) {
+-                    qCDebug(KSCREEN) << "Skipping" << s_backend->name() << "backend";
+-                    delete s_backend;
+-                    s_backend = 0;
+-                    loader.unload();
+-                    continue;
+-                }
+-                qCDebug(KSCREEN) << "Loading" << s_backend->name() << "backend";
+-                return true;
+-            }
++            qCDebug(KSCREEN) << "Loading" << s_backend->name() << "backend";
++            return true;
+         }
+     }
+ 
+diff --git a/src/config-libkscreen.h.cmake b/src/config-libkscreen.h.cmake
+new file mode 100644
+index 0000000..a99f3d1
+--- /dev/null
++++ b/src/config-libkscreen.h.cmake
+@@ -0,0 +1,2 @@
++#define CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}"
++#define PLUGIN_INSTALL_DIR "${PLUGIN_INSTALL_DIR}"
diff --git a/pkgs/desktops/plasma-5.1/manifest.nix b/pkgs/desktops/plasma-5.1/manifest.nix
new file mode 100644
index 000000000000..20290d0bd078
--- /dev/null
+++ b/pkgs/desktops/plasma-5.1/manifest.nix
@@ -0,0 +1,166 @@
+# This file is generated automatically. DO NOT EDIT!
+{ mirror }:
+[
+  {
+    url = "${mirror}/stable/plasma/5.1.2/kwayland-5.1.2.tar.xz";
+    sha256 = "0v57gdbhbqq9nm8y6f8xlwwsfib8v8wbh32bb38aa22wkcqbnqh5";
+    name = "kwayland-5.1.2.tar.xz";
+    store = "/nix/store/r4bjs61x7ad3ff1iy4j111japxzn8gdm-kwayland-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/milou-5.1.2.tar.xz";
+    sha256 = "0dawmwzdxb289gblnbxw4ryqj45c1rmws7mm0cmqlnxh2ykysska";
+    name = "milou-5.1.2.tar.xz";
+    store = "/nix/store/d90rryiyw3haw0mlcxzs57b0vsmq2c3g-milou-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/plasma-workspace-5.1.2.tar.xz";
+    sha256 = "03gwkikxmmbiglyf2cbhm79wri1vfsibpr0qsyydcnqf2bja4adk";
+    name = "plasma-workspace-5.1.2.tar.xz";
+    store = "/nix/store/9b2pcs64kvdnb0mf7g1gyjgygi8pfrk1-plasma-workspace-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/kdeplasma-addons-5.1.2.tar.xz";
+    sha256 = "0jfrnvrn4x5cjd3yp21sr53rddcaxw3l05xkcq99lb29jx7x831f";
+    name = "kdeplasma-addons-5.1.2.tar.xz";
+    store = "/nix/store/9f7154m5aq35lfwj6rfq7ra4c2b0xs4r-kdeplasma-addons-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/khotkeys-5.1.2.tar.xz";
+    sha256 = "0kyjvrfpf8zqv8milbzdj0y6i37413qmvdhkxy2phqwrnwj4x69q";
+    name = "khotkeys-5.1.2.tar.xz";
+    store = "/nix/store/lq1v4haiag93w5g6pqwp5r9w8n3xvh1n-khotkeys-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/kde-cli-tools-5.1.2.tar.xz";
+    sha256 = "1akgj042i52b6mzd0lq8xgrqnwi63wc7k82g8r4kfy8611vxw6wb";
+    name = "kde-cli-tools-5.1.2.tar.xz";
+    store = "/nix/store/byjdh6cmqimk3i314h3y57s2z3nvpfnw-kde-cli-tools-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/libnm-qt-5.1.2.tar.xz";
+    sha256 = "1gm3yjlb5iq2l0rm8wqg0hs1f66ca5j8zvw6rrn3z4f2hsw9b8vm";
+    name = "libnm-qt-5.1.2.tar.xz";
+    store = "/nix/store/yx6jhazzb32580ax7dw4jdzncj1lpx4a-libnm-qt-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/oxygen-fonts-5.1.2.tar.xz";
+    sha256 = "05f06fsgp6xjv5azs546cq5653k3cyyidbdkggf20yrwlybypg2w";
+    name = "oxygen-fonts-5.1.2.tar.xz";
+    store = "/nix/store/ppzbxx7vkpymjgvi3skrch2dlx3mwhjg-oxygen-fonts-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/khelpcenter-5.1.2.tar.xz";
+    sha256 = "0fgwabsvbg4xzzli8k28hqw6rw5wzmp77fpb7qxiaks2qxd6xfvl";
+    name = "khelpcenter-5.1.2.tar.xz";
+    store = "/nix/store/nq86gdfz5fgkxcndk4knnb3n59y9b17x-khelpcenter-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/kmenuedit-5.1.2.tar.xz";
+    sha256 = "1f09m8ki1qib0rfvbkd1nqszq5mglc802rz9b7s9hfi0n5la05cj";
+    name = "kmenuedit-5.1.2.tar.xz";
+    store = "/nix/store/8l7agrg12ghva4103iwm1xdzhqk3iwxp-kmenuedit-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/kinfocenter-5.1.2.tar.xz";
+    sha256 = "1yp08z0sirm1i21ix27c72l1pygndrh4gnb5rl4r6rj0rymy4xn0";
+    name = "kinfocenter-5.1.2.tar.xz";
+    store = "/nix/store/jl3s4kimn0xamxc4yhc1jsrz9j0cmws1-kinfocenter-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/kwrited-5.1.2.tar.xz";
+    sha256 = "0bsm3dkl1zi1h16cd1pc9qcbv2jpjpzcw7m6cg9gbk7icjymn065";
+    name = "kwrited-5.1.2.tar.xz";
+    store = "/nix/store/ishi0y744yapvf2yf0hm5gam3z5j2687-kwrited-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/kio-extras-5.1.2.tar.xz";
+    sha256 = "0d4yyssiddcabrfr94ylf4p2f7l5mpg353m67w2x4rdlc7bgc00z";
+    name = "kio-extras-5.1.2.tar.xz";
+    store = "/nix/store/6pqx9daq9bx7in8dghy041vfn5x829g2-kio-extras-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/systemsettings-5.1.2.tar.xz";
+    sha256 = "102s7l1xaxqzsswzcsr6qx2mizi1fw85ickj8sm4ql493m3iy0vy";
+    name = "systemsettings-5.1.2.tar.xz";
+    store = "/nix/store/c56khxzyh8gzi5nxy8i3n2vlwbsmblsz-systemsettings-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/powerdevil-5.1.2.tar.xz";
+    sha256 = "0bq042phd1rv42qf21672l74mlygzvqknqd0vhfay7lz5hihd3np";
+    name = "powerdevil-5.1.2.tar.xz";
+    store = "/nix/store/5p6j6949gv1s03cm1yn1v0i18clma3cw-powerdevil-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/plasma-desktop-5.1.2.tar.xz";
+    sha256 = "0nn1fcb8b4cmh6wzfar7dzmc6r830n6nq78icsbqkl2yi631vmv7";
+    name = "plasma-desktop-5.1.2.tar.xz";
+    store = "/nix/store/nnk00ddkr0rqbmk6i1q17wimvb6n79m6-plasma-desktop-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/libmm-qt-5.1.2.tar.xz";
+    sha256 = "1jx3zq5j7dm27k74ayibg0d82f7nm7r40mj92sk0drgzaj0q2wv4";
+    name = "libmm-qt-5.1.2.tar.xz";
+    store = "/nix/store/z3f23bansr6yqvc8pwcavwy828ykf85z-libmm-qt-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/breeze-5.1.2.tar.xz";
+    sha256 = "1c7bfr2zdhh84bik5ksyfxvng8c23slasf6lbr86f0mmvwssqhc4";
+    name = "breeze-5.1.2.tar.xz";
+    store = "/nix/store/h0ra9f62jj3lqsg5hhqsb8cq05fqaq0c-breeze-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/ksysguard-5.1.2.tar.xz";
+    sha256 = "03bngwq0dpgffcr7dkzk44n995kcawk1fgxf38zkik4qrr2m8xmz";
+    name = "ksysguard-5.1.2.tar.xz";
+    store = "/nix/store/vrgl460m4h0bzwhakgkj9sddn2pr6057-ksysguard-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/kwin-5.1.2.tar.xz";
+    sha256 = "1sjb9w8yaicypjdlcnn6a8zaa03fmgn9bsbbr1xfh3kcjm0p2hjf";
+    name = "kwin-5.1.2.tar.xz";
+    store = "/nix/store/0lcmq4bl3kc48gcps703bby99z0zdl7q-kwin-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/oxygen-5.1.2.tar.xz";
+    sha256 = "0dwlqc57qwp09bbmknakjndqgajfp948kri8ysakj50qbfzq22ly";
+    name = "oxygen-5.1.2.tar.xz";
+    store = "/nix/store/al4whqd4gdnyym26kd2yp3c1slyll0bw-oxygen-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/libkscreen-5.1.2.tar.xz";
+    sha256 = "1kbs042anmc8mifmbxwi7sw0n74kcpf5hpbld5a7nclhm0xpyzb9";
+    name = "libkscreen-5.1.2.tar.xz";
+    store = "/nix/store/rkmydih2fss2gm84j8rgpd3ybz7pyz5p-libkscreen-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/libksysguard-5.1.2.tar.xz";
+    sha256 = "061jjqh6i70g5f8qh47znk295wh1j7z3i9imppdlxhymm2sdix5k";
+    name = "libksysguard-5.1.2.tar.xz";
+    store = "/nix/store/dyipim22aisn9cnk3d9431bi393qsi38-libksysguard-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/plasma-workspace-wallpapers-5.1.2.tar.xz";
+    sha256 = "18my7r17b6c0wm545knpy68bcgawmr6x1h383br1a3jrahb9smfx";
+    name = "plasma-workspace-wallpapers-5.1.2.tar.xz";
+    store = "/nix/store/inqv621x6l2yz1kj71d824kc0labpss7-plasma-workspace-wallpapers-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/kfilemetadata-5.1.2.tar.xz";
+    sha256 = "0ssz2v9dm09ig20m5c2gcgi0dhkbijs7580j75kyabcyxyq33gdi";
+    name = "kfilemetadata-5.1.2.tar.xz";
+    store = "/nix/store/84jqp15fclxia88dmbr2zpq50m6xzwib-kfilemetadata-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/plasma-nm-5.1.2.tar.xz";
+    sha256 = "1ifwjbzdjsfcq2vbq58fnx1r8m11wbmcwchnn7ihabbcgj5admp7";
+    name = "plasma-nm-5.1.2.tar.xz";
+    store = "/nix/store/2czga7b7i36841rs4mnfzd7j7s3rfanv-plasma-nm-5.1.2.tar.xz";
+  }
+  {
+    url = "${mirror}/stable/plasma/5.1.2/baloo-5.1.2.tar.xz";
+    sha256 = "1ynd3amry3wjk8sjlb5knpvjshn0gvs2m1gpbr7r7528ckkv0gpv";
+    name = "baloo-5.1.2.tar.xz";
+    store = "/nix/store/lcrrxz5yjf88cgifz3zjcq5skdp4jxkk-baloo-5.1.2.tar.xz";
+  }
+]
diff --git a/pkgs/desktops/plasma-5.1/manifest.sh b/pkgs/desktops/plasma-5.1/manifest.sh
new file mode 100755
index 000000000000..5191f4f7d876
--- /dev/null
+++ b/pkgs/desktops/plasma-5.1/manifest.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+if [ $# -eq 0 ]; then
+
+  # The extra slash at the end of the URL is necessary to stop wget
+  # from recursing over the whole server! (No, it's not a bug.)
+  $(nix-build ../../.. -A autonix.manifest) \
+      http://download.kde.org/stable/plasma/5.1.2/ \
+      -A '*.tar.xz'
+
+else
+
+  $(nix-build ../../.. -A autonix.manifest) -A '*.tar.xz' "$@"
+
+fi
diff --git a/pkgs/desktops/plasma-5.1/plasma-desktop/plasma-desktop-hwclock.patch b/pkgs/desktops/plasma-5.1/plasma-desktop/plasma-desktop-hwclock.patch
new file mode 100644
index 000000000000..53bd43d38e2c
--- /dev/null
+++ b/pkgs/desktops/plasma-5.1/plasma-desktop/plasma-desktop-hwclock.patch
@@ -0,0 +1,24 @@
+diff --git a/kcms/dateandtime/helper.cpp b/kcms/dateandtime/helper.cpp
+index cec5ab8..fc4a6b9 100644
+--- a/kcms/dateandtime/helper.cpp
++++ b/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 = QLatin1String("/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("hwclock", exePath);
++    QString hwclock = "@hwclock@";
+     if (!hwclock.isEmpty()) {
+         KProcess::execute(hwclock, QStringList() << "--systohc");
+     }
diff --git a/pkgs/desktops/plasma-5.1/plasma-desktop/plasma-desktop-zoneinfo.patch b/pkgs/desktops/plasma-5.1/plasma-desktop/plasma-desktop-zoneinfo.patch
new file mode 100644
index 000000000000..e924207054d1
--- /dev/null
+++ b/pkgs/desktops/plasma-5.1/plasma-desktop/plasma-desktop-zoneinfo.patch
@@ -0,0 +1,18 @@
+diff --git a/kcms/dateandtime/helper.cpp b/kcms/dateandtime/helper.cpp
+index fc4a6b9..7b64d05 100644
+--- a/kcms/dateandtime/helper.cpp
++++ b/kcms/dateandtime/helper.cpp
+@@ -181,7 +181,12 @@ int ClockHelper::tz( const QString& selectedzone )
+ 
+     val = selectedzone;
+ #else
+-    QString tz = "/usr/share/zoneinfo/" + selectedzone;
++    // NixOS-specific path
++    QString tz = "/etc/zoneinfo/" + selectedzone;
++    if (!QFile::exists(tz)) {
++      // Standard Linux path
++      tz = "/usr/share/zoneinfo/" + selectedzone;
++    }
+ 
+     if (QFile::exists(tz)) { // make sure the new TZ really exists
+         QFile::remove("/etc/localtime");
diff --git a/pkgs/desktops/plasma-5.1/renames.nix b/pkgs/desktops/plasma-5.1/renames.nix
new file mode 100644
index 000000000000..be50cacdc185
--- /dev/null
+++ b/pkgs/desktops/plasma-5.1/renames.nix
@@ -0,0 +1,24 @@
+# DO NOT EDIT! This file is generated automatically.
+{ }:
+{
+"Backend" = "powerdevil";
+"CTest" = "kdeplasma-addons";
+"ECM" = "extra-cmake-modules";
+"KDecorations" = "kwin";
+"KF5Baloo" = "baloo";
+"KF5FileMetaData" = "kfilemetadata";
+"KF5ModemManagerQt" = "libmm-qt";
+"KF5NetworkManagerQt" = "libnm-qt";
+"KF5Screen" = "libkscreen";
+"KF5SysGuard" = "libksysguard";
+"KF5Wayland" = "kwayland";
+"KF5XmlRpcClientPrivate" = "plasma-workspace";
+"KHotKeysDBusInterface" = "khotkeys";
+"KRunnerAppDBusInterface" = "plasma-workspace";
+"KSMServerDBusInterface" = "plasma-workspace";
+"KWinDBusInterface" = "kwin";
+"LibKWorkspace" = "plasma-workspace";
+"LibTaskManager" = "plasma-workspace";
+"OxygenFont" = "oxygen-fonts";
+"ScreenSaverDBusInterface" = "plasma-workspace";
+}
diff --git a/pkgs/desktops/plasma-5.1/setup-hook.sh b/pkgs/desktops/plasma-5.1/setup-hook.sh
new file mode 100644
index 000000000000..a8d9b7e0e36f
--- /dev/null
+++ b/pkgs/desktops/plasma-5.1/setup-hook.sh
@@ -0,0 +1 @@
+addToSearchPath XDG_DATA_DIRS @out@/share
diff --git a/pkgs/desktops/plasma-5.1/startkde/default.nix b/pkgs/desktops/plasma-5.1/startkde/default.nix
new file mode 100644
index 000000000000..9f7f7f202743
--- /dev/null
+++ b/pkgs/desktops/plasma-5.1/startkde/default.nix
@@ -0,0 +1,29 @@
+{ stdenv, bash, dbus, gnused, gnugrep, kconfig, kinit, kservice, plasma-desktop
+, plasma-workspace, qt5, socat, xorg }:
+
+let startkde = ./startkde.in; in
+
+stdenv.mkDerivation {
+  name = "startkde-0.1";
+  phases = "installPhase";
+
+  inherit bash gnused gnugrep kconfig kinit kservice qt5 socat;
+  inherit (xorg) mkfontdir xmessage xprop xrdb xset xsetroot;
+  dbus_tools = dbus.tools;
+  plasmaWorkspace = plasma-workspace;
+  plasmaDesktop = plasma-desktop;
+  startupconfigkeys = ./startupconfigkeys;
+  kdeglobals = ./kdeglobals;
+
+  installPhase = ''
+    mkdir -p $out/bin
+    substituteAll ${startkde} $out/bin/startkde
+    chmod +x $out/bin/startkde
+  '';
+
+  meta = {
+    description = "Custom startkde script for Nixpkgs";
+    maintainers = with stdenv.lib.maintainers; [ ttuegel ];
+    license = with stdenv.lib.licenses; [ gpl2Plus ];
+  };
+}
diff --git a/pkgs/desktops/plasma-5.1/startkde/kdeglobals b/pkgs/desktops/plasma-5.1/startkde/kdeglobals
new file mode 100644
index 000000000000..bfa610712ede
--- /dev/null
+++ b/pkgs/desktops/plasma-5.1/startkde/kdeglobals
@@ -0,0 +1,11 @@
+[General]
+XftAntialias=true
+XftHintStyle=hintmedium
+XftSubPixel=none
+desktopFont=Oxygen-Sans,10,-1,5,50,0,0,0,0,0
+fixed=Oxygen Mono,9,-1,5,50,0,0,0,0,0
+font=Oxygen-Sans,10,-1,5,50,0,0,0,0,0
+menuFont=Oxygen-Sans,10,-1,5,50,0,0,0,0,0
+smallestReadableFont=Oxygen-Sans,8,-1,5,50,0,0,0,0,0
+taskbarFont=Oxygen-Sans,10,-1,5,50,0,0,0,0,0
+toolBarFont=Oxygen-Sans,9,-1,5,50,0,0,0,0,0
\ No newline at end of file
diff --git a/pkgs/desktops/plasma-5.1/startkde/startkde.in b/pkgs/desktops/plasma-5.1/startkde/startkde.in
new file mode 100644
index 000000000000..74d162bf44f8
--- /dev/null
+++ b/pkgs/desktops/plasma-5.1/startkde/startkde.in
@@ -0,0 +1,361 @@
+#!@bash@/bin/bash -x
+#
+#  NIXOS KDE STARTUP SCRIPT
+#
+
+if test "x$1" = x--failsafe; then
+    KDE_FAILSAFE=1 # General failsafe flag
+    KWIN_COMPOSE=N # Disable KWin's compositing
+    export KWIN_COMPOSE KDE_FAILSAFE
+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
+
+# 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
+@plasmaWorkspace@/bin/kcheckrunning
+kcheckrunning_result=$?
+if test $kcheckrunning_result -eq 0 ; then
+  @xmessage@/bin/xmessage -geometry 500x100 "KDE seems to be already running on this display."
+	exit 1
+elif test $kcheckrunning_result -eq 2 ; then
+	echo "\$DISPLAY is not set or cannot connect to the X server."
+  exit 1
+fi
+
+# Boot sequence:
+#
+# kdeinit is used to fork off processes which improves memory usage
+# and startup time.
+#
+# * kdeinit starts klauncher first.
+# * Then kded is started. kded is responsible for keeping the sycoca
+#   database up to date. When an up to date database is present it goes
+#   into the background and the startup continues.
+# * Then kdeinit starts kcminit. kcminit performs initialisation of
+#   certain devices according to the user's settings
+#
+# * 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
+  # This is the default
+  # http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
+  configDir=${HOME}/.config;
+fi
+
+mkdir -p $configDir
+
+# This is basically setting defaults so we can use them with kstartupconfig5
+cat @startupconfigkeys@ >$configDir/startupconfigkeys
+
+# preload the user's locale on first start
+plasmalocalerc=$configDir/plasma-localerc
+test -f $plasmalocalerc || {
+cat >$plasmalocalerc <<EOF
+[Formats]
+LANG=$LANG
+EOF
+}
+
+# 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
+[ -f $exportformatssettings ] && . $exportformatssettings
+
+# Write a default kdeglobals file to set up the font
+kdeglobalsfile=$configDir/kdeglobals
+[ -f $kdeglobalsfile ] || cat @kdeglobals@ >$kdeglobalsfile
+
+@plasmaWorkspace@/bin/kstartupconfig5
+returncode=$?
+if test $returncode -ne 0; then
+    @xmessage@/bin/xmessage -geometry 500x100 "kstartupconfig5 exited with $returncode"
+    exit 1
+fi
+[ -r $configDir/startupconfig ] && . $configDir/startupconfig
+
+XCURSOR_PATH=~/.icons:$(echo "$XDG_DATA_DIRS" | tr ":" "\n" | @gnused@/bin/sed 's,$,/icons,g' | tr "\n" ":")
+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
+
+    @plasmaDesktop@/bin/kapplymousetheme "$kcminputrc_mouse_cursortheme" "$kcminputrc_mouse_cursorsize"
+    if test $? -eq 10; then
+        XCURSOR_THEME=default
+        export XCURSOR_THEME
+    elif test -n "$kcminputrc_mouse_cursortheme"; then
+        XCURSOR_THEME="$kcminputrc_mouse_cursortheme"
+        export XCURSOR_THEME
+    fi
+    if test -n "$kcminputrc_mouse_cursorsize"; then
+        XCURSOR_SIZE="$kcminputrc_mouse_cursorsize"
+        export XCURSOR_SIZE
+    fi
+fi
+
+# 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
+# minutes until anything appears on the screen.
+#
+# If the user has overwritten fonts, the cursor font may be different now
+# so don't move this up.
+#
+@xsetroot@/bin/xsetroot -cursor_name left_ptr
+
+dl=$DESKTOP_LOCKED
+unset DESKTOP_LOCKED # Don't want it in the environment
+
+# Make sure that D-Bus is running
+# D-Bus autolaunch is broken
+if test -z "$DBUS_SESSION_BUS_ADDRESS" ; then
+    eval `@dbus_tools@/bin/dbus-launch --sh-syntax --exit-with-session`
+fi
+if @qt5@/bin/qdbus >/dev/null 2>/dev/null; then
+    : # ok
+else
+    echo 'startkde: Could not start D-Bus. Can you call qdbus?'  1>&2
+    test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
+    @xmessage@/bin/xmessage -geometry 500x100 "Could not start D-Bus. Can you call qdbus?"
+    exit 1
+fi
+
+ksplash_pid=
+if test -z "$dl"; then
+  # the splashscreen and progress indicator
+  case "$ksplashrc_ksplash_engine" in
+    KSplashQML)
+      ksplash_pid=`@plasmaWorkspace@/bin/ksplashqml "${ksplashrc_ksplash_theme}" --pid`
+      ;;
+    None)
+      ;;
+    *)
+      ;;
+  esac
+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.
+
+# TODO: Use GenericConfigLocation once we depend on Qt 5.4
+scriptpath=`@qt5@/bin/qtpaths --paths ConfigLocation | tr ':' '\n' | @gnused@/bin/sed 's,$,/plasma-workspace,g'`
+
+# Add /env/ to the directory to locate the scripts to be sourced
+for prefix in `echo $scriptpath`; do
+  for file in "$prefix"/env/*.sh; do
+    test -r "$file" && . "$file"
+  done
+done
+
+# Set the path for Qt plugins provided by KDE
+QT_PLUGIN_PATH=${QT_PLUGIN_PATH+$QT_PLUGIN_PATH:}`@qt5@/bin/qtpaths --plugin-dir`
+# TODO: Do we really need this?
+QT_PLUGIN_PATH=$QT_PLUGIN_PATH:$kdehome/lib/kde5/plugins/
+export QT_PLUGIN_PATH
+
+# 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" | @gnused@/bin/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@/bin/xset +fp "$sys_odir"
+test -d "$usr_odir" && ( @mkfontdir@/bin/mkfontdir "$usr_odir" ; @xset@/bin/xset +fp "$usr_odir" )
+test -d "$usr_fdir" && ( @mkfontdir@/bin/mkfontdir "$usr_fdir" ; @xset@/bin/xset fp+ "$usr_fdir" )
+test -d "$sys_fdir" && @xset@/bin/xset fp+ "$sys_fdir"
+
+# Ask X11 to rebuild its font list.
+@xset@/bin/xset fp rehash
+
+# 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
+
+echo 'startkde: Starting up...'  1>&2
+
+
+# Mark that full KDE session is running (e.g. Konqueror preloading works only
+# with full KDE running). The KDE_FULL_SESSION property can be detected by
+# any X client connected to the same X session, even if not launched
+# directly from the KDE session but e.g. using "ssh -X", kdesu. $KDE_FULL_SESSION
+# however guarantees that the application is launched in the same environment
+# like the KDE session and that e.g. KDE utilities/libraries are available.
+# KDE_FULL_SESSION property is also only available since KDE 3.5.5.
+# The matching tests are:
+#   For $KDE_FULL_SESSION:
+#     if test -n "$KDE_FULL_SESSION"; then ... whatever
+#   For KDE_FULL_SESSION property:
+#     xprop -root | grep "^KDE_FULL_SESSION" >/dev/null 2>/dev/null
+#     if test $? -eq 0; then ... whatever
+#
+# Additionally there is (since KDE 3.5.7) $KDE_SESSION_UID with the uid
+# of the user running the KDE session. It should be rarely needed (e.g.
+# after sudo to prevent desktop-wide functionality in the new user's kded).
+#
+# Since KDE4 there is also KDE_SESSION_VERSION, containing the major version number.
+# Note that this didn't exist in KDE3, which can be detected by its absense and
+# the presence of KDE_FULL_SESSION.
+#
+KDE_FULL_SESSION=true
+export KDE_FULL_SESSION
+@xprop@/bin/xprop -root -f KDE_FULL_SESSION 8t -set KDE_FULL_SESSION true
+
+KDE_SESSION_VERSION=5
+export KDE_SESSION_VERSION
+@xprop@/bin/xprop -root -f KDE_SESSION_VERSION 32c -set KDE_SESSION_VERSION 5
+
+KDE_SESSION_UID=`id -ru`
+export KDE_SESSION_UID
+
+XDG_CURRENT_DESKTOP=KDE
+export XDG_CURRENT_DESKTOP
+
+# At this point all the environment is ready, let's send it to kwalletd if running
+if test -n "$PAM_KWALLET_LOGIN" ; then
+    env | @socat@/bin/socat STDIN UNIX-CONNECT:$PAM_KWALLET_LOGIN
+fi
+
+# At this point all environment variables are set, let's send it to the DBus
+# session server to update the activation environment
+@plasmaWorkspace@/lib/libexec/ksyncdbusenv
+if test $? -ne 0; then
+  # Startup error
+  echo 'startkde: Could not sync environment to dbus.'  1>&2
+  test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
+  @xmessage@/bin/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 @kinit@/lib/libexec/kf5/start_kdeinit_wrapper --kded +kcminit_startup
+if test $? -ne 0; then
+  # Startup error
+  echo 'startkde: Could not start kdeinit5.'  1>&2
+  test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
+  @xmessage@/bin/xmessage -geometry 500x100 "Could not start kdeinit5."
+  exit 1
+fi
+
+# (NixOS) We run kbuildsycoca5 before starting the user session because things
+# may be missing or moved if they have run nixos-rebuild and it may not be
+# possible for them to start Konsole to run it manually!
+@kservice@/bin/kbuildsycoca5
+
+# finally, give the session control to the session manager
+# see kdebase/ksmserver for the description of the rest of the startup sequence
+# if the KDEWM environment variable has been set, then it will be used as KDE's
+# window manager instead of kwin.
+# if KDEWM is not set, ksmserver will ensure kwin is started.
+# kwrapper5 is used to reduce startup time and memory usage
+# kwrapper5 does not return useful error codes such as the exit code of ksmserver.
+# 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 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"
+@kinit@/bin/kwrapper5 @plasmaWorkspace@/bin/ksmserver $KDEWM $KSMSERVEROPTIONS
+if test $? -eq 255; then
+  # Startup error
+  echo 'startkde: Could not start ksmserver.'  1>&2
+  test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
+  @xmessage@/bin/xmessage -geometry 500x100 "Could not start ksmserver."
+fi
+
+wait_drkonqi=`@kconfig@/bin/kreadconfig5 --file startkderc --group WaitForDrKonqi --key Enabled --default true`
+
+if test x"$wait_drkonqi"x = x"true"x ; then
+    # wait for remaining drkonqi instances with timeout (in seconds)
+    wait_drkonqi_timeout=`@kconfig@/bin/kreadconfig5 --file startkderc --group WaitForDrKonqi --key Timeout --default 900`
+    wait_drkonqi_counter=0
+    while @qt5@/bin/qdbus | @gnugrep@/bin/grep "^[^w]*org.kde.drkonqi" > /dev/null ; do
+        sleep 5
+        wait_drkonqi_counter=$((wait_drkonqi_counter+5))
+        if test "$wait_drkonqi_counter" -ge "$wait_drkonqi_timeout" ; then
+            # ask remaining drkonqis to die in a graceful way
+            @qt5@/bin/qdbus | @gnugrep@/bin/grep 'org.kde.drkonqi-' | while read address ; do
+                @qt5@/bin/qdbus "$address" "/MainApplication" "quit"
+            done
+            break
+        fi
+    done
+fi
+
+echo 'startkde: Shutting down...'  1>&2
+# just in case
+test -n "$ksplash_pid" && kill "$ksplash_pid" 2>/dev/null
+
+# Clean up
+@kinit@/bin/kdeinit5_shutdown
+
+echo 'startkde: Running shutdown scripts...'  1>&2
+
+# Run scripts found in <config locations>/plasma-workspace/shutdown
+for prefix in `echo "$scriptpath"`; do
+  for file in `ls "$prefix"/shutdown 2> /dev/null | @gnugrep@/bin/egrep -v '(~|\.bak)$'`; do
+    test -x "$prefix$file" && "$prefix$file"
+  done
+done
+
+unset KDE_FULL_SESSION
+@xprop@/bin/xprop -root -remove KDE_FULL_SESSION
+unset KDE_SESSION_VERSION
+@xprop@/bin/xprop -root -remove KDE_SESSION_VERSION
+unset KDE_SESSION_UID
+
+echo 'startkde: Done.'  1>&2
diff --git a/pkgs/desktops/plasma-5.1/startkde/startupconfigkeys b/pkgs/desktops/plasma-5.1/startkde/startupconfigkeys
new file mode 100644
index 000000000000..0fc92cff8a53
--- /dev/null
+++ b/pkgs/desktops/plasma-5.1/startkde/startupconfigkeys
@@ -0,0 +1,5 @@
+kcminputrc Mouse cursorTheme 'breeze_cursors'
+kcminputrc Mouse cursorSize ''
+ksplashrc KSplash Theme Breeze
+ksplashrc KSplash Engine KSplashQML
+kcmfonts General forceFontDPI 0