8 cfg = config.services.desktopManager.plasma6;
10 inherit (pkgs) kdePackages;
11 inherit (lib) literalExpression mkDefault mkIf mkOption mkPackageOption types;
14 # will be rebuilt automatically
15 rm -fv $HOME/.cache/ksycoca*
19 services.desktopManager.plasma6 = {
23 description = "Enable the Plasma 6 (KDE 6) desktop environment.";
26 enableQt5Integration = mkOption {
29 description = "Enable Qt 5 integration (theming, etc). Disable for a pure Qt 6 system.";
32 notoPackage = mkPackageOption pkgs "Noto fonts - used for UI by default" {
33 default = ["noto-fonts"];
34 example = "noto-fonts-lgc-plus";
38 environment.plasma6.excludePackages = mkOption {
39 description = "List of default packages to exclude from the configuration";
40 type = types.listOf types.package;
42 example = literalExpression "[ pkgs.kdePackages.elisa ]";
47 (lib.mkRenamedOptionModule [ "services" "xserver" "desktopManager" "plasma6" "enable" ] [ "services" "desktopManager" "plasma6" "enable" ])
48 (lib.mkRenamedOptionModule [ "services" "xserver" "desktopManager" "plasma6" "enableQt5Integration" ] [ "services" "desktopManager" "plasma6" "enableQt5Integration" ])
49 (lib.mkRenamedOptionModule [ "services" "xserver" "desktopManager" "plasma6" "notoPackage" ] [ "services" "desktopManager" "plasma6" "notoPackage" ])
52 config = mkIf cfg.enable {
55 assertion = cfg.enable -> !config.services.xserver.desktopManager.plasma5.enable;
56 message = "Cannot enable plasma5 and plasma6 at the same time!";
61 environment.systemPackages = with kdePackages; let
63 qtwayland # Hack? To make everything run on Wayland
64 qtsvg # Needed to render SVG icons
66 # Frameworks with globally loadable bits
67 frameworkintegration # provides Qt plugin
68 kauth # provides helper service
69 kcoreaddons # provides extra mime type info
70 kded # provides helper service
71 kfilemetadata # provides Qt plugins
72 kguiaddons # provides geo URL handlers
73 kiconthemes # provides Qt plugins
74 kimageformats # provides Qt plugins
75 kio # provides helper service + a bunch of other stuff
76 kio-admin # managing files as admin
77 kio-extras # stuff for MTP, AFC, etc
78 kio-fuse # fuse interface for KIO
79 kpackage # provides kpackagetool tool
80 kservice # provides kbuildsycoca6 tool
81 kwallet # provides helper service
82 kwallet-pam # provides helper service
83 kwalletmanager # provides KCMs and stuff
84 plasma-activities # provides plasma-activities-cli tool
85 solid # provides solid-hardware6 tool
86 phonon-vlc # provides Phonon plugin
96 kglobalacceld # keyboard shortcut daemon
97 kwrited # wall message proxy, not to be confused with kwrite
98 baloo # system indexer
99 milou # search engine atop baloo
100 kdegraphics-thumbnailers # pdf etc thumbnailer
101 polkit-kde-agent-1 # polkit auth ui
104 drkonqi # crash handler
105 kde-inotify-survey # warns the user on low inotifywatch limits
107 # Application integration
108 libplasma # provides Kirigami platform theme
109 plasma-integration # provides Qt platform theme
110 kde-gtk-config # syncs KDE settings to GTK
117 plasma-workspace-wallpapers
118 pkgs.hicolor-icon-theme # fallback icons
124 pkgs.xdg-user-dirs # recommended upstream
136 plasma-browser-integration
138 (lib.getBin qttools) # Expose qdbus in PATH
146 baloo-widgets # baloo information in Dolphin
151 xwaylandvideobridge # exposes Wayland windows to X11 screen capture
152 ] ++ lib.optionals config.services.flatpak.enable [
153 # Since PackageKit Nix support is not there yet,
154 # only install discover if flatpak is enabled.
159 ++ utils.removePackagesByName optionalPackages config.environment.plasma6.excludePackages
160 ++ lib.optionals config.services.desktopManager.plasma6.enableQt5Integration [
162 plasma-integration.qt5
163 pkgs.plasma5Packages.kwayland-integration
165 # Only symlink the KIO plugins, so we don't accidentally pull any services
166 # like KCMs or kcookiejar
168 kioPluginPath = "${pkgs.plasma5Packages.qtbase.qtPluginPrefix}/kf5/kio";
169 inherit (pkgs.plasma5Packages) kio;
170 in pkgs.runCommand "kio5-plugins-only" {} ''
171 mkdir -p $out/${kioPluginPath}
172 ln -s ${kio}/${kioPluginPath}/* $out/${kioPluginPath}
177 # Optional and hardware support features
178 ++ lib.optionals config.hardware.bluetooth.enable [bluedevil bluez-qt pkgs.openobex pkgs.obexftp]
179 ++ lib.optional config.networking.networkmanager.enable plasma-nm
180 ++ lib.optional config.hardware.pulseaudio.enable plasma-pa
181 ++ lib.optional config.services.pipewire.pulse.enable plasma-pa
182 ++ lib.optional config.powerManagement.enable powerdevil
183 ++ lib.optional config.services.printing.enable print-manager
184 ++ lib.optional config.services.colord.enable colord-kde
185 ++ lib.optional config.services.hardware.bolt.enable plasma-thunderbolt
186 ++ lib.optional config.services.samba.enable kdenetwork-filesharing
187 ++ lib.optional config.services.xserver.wacom.enable wacomtablet
188 ++ lib.optional config.services.flatpak.enable flatpak-kcm;
190 environment.pathsToLink = [
191 # FIXME: modules should link subdirs of `/share` rather than relying on this
193 "/libexec" # for drkonqi
196 environment.etc."X11/xkb".source = config.services.xserver.xkb.dir;
198 # Add ~/.config/kdedefaults to XDG_CONFIG_DIRS for shells, since Plasma sets that.
199 # FIXME: maybe we should append to XDG_CONFIG_DIRS in /etc/set-environment instead?
200 environment.sessionVariables.XDG_CONFIG_DIRS = ["$HOME/.config/kdedefaults"];
202 # Needed for things that depend on other store.kde.org packages to install correctly,
203 # notably Plasma look-and-feel packages (a.k.a. Global Themes)
205 # FIXME: this is annoyingly impure and should really be fixed at source level somehow,
206 # but kpackage is a library so we can't just wrap the one thing invoking it and be done.
207 # This also means things won't work for people not on Plasma, but at least this way it
208 # works for SOME people.
209 environment.sessionVariables.KPACKAGE_DEP_RESOLVERS_PATH = "${kdePackages.frameworkintegration.out}/libexec/kf6/kpackagehandlers";
211 # Enable GTK applications to load SVG icons
212 programs.gdk-pixbuf.modulePackages = [pkgs.librsvg];
214 fonts.packages = [cfg.notoPackage pkgs.hack-font];
215 fonts.fontconfig.defaultFonts = {
216 monospace = ["Hack" "Noto Sans Mono"];
217 sansSerif = ["Noto Sans"];
218 serif = ["Noto Serif"];
221 programs.gnupg.agent.pinentryPackage = mkDefault pkgs.pinentry-qt;
222 programs.kde-pim.enable = mkDefault true;
223 programs.ssh.askPassword = mkDefault "${kdePackages.ksshaskpass.out}/bin/ksshaskpass";
225 # Enable helpful DBus services.
226 services.accounts-daemon.enable = true;
227 # when changing an account picture the accounts-daemon reads a temporary file containing the image which systemsettings5 may place under /tmp
228 systemd.services.accounts-daemon.serviceConfig.PrivateTmp = false;
230 services.power-profiles-daemon.enable = mkDefault true;
231 services.system-config-printer.enable = mkIf config.services.printing.enable (mkDefault true);
232 services.udisks2.enable = true;
233 services.upower.enable = config.powerManagement.enable;
234 services.libinput.enable = mkDefault true;
236 # Extra UDEV rules used by Solid
237 services.udev.packages = [
238 # libmtp has "bin", "dev", "out" outputs. UDEV rules file is in "out".
240 pkgs.media-player-info
243 # Set up Dr. Konqi as crash handler
244 systemd.packages = [kdePackages.drkonqi];
245 systemd.services."drkonqi-coredump-processor@".wantedBy = ["systemd-coredump@.service"];
247 xdg.icons.enable = true;
249 xdg.portal.enable = true;
250 xdg.portal.extraPortals = [
251 kdePackages.xdg-desktop-portal-kde
252 pkgs.xdg-desktop-portal-gtk
254 xdg.portal.configPackages = mkDefault [kdePackages.xdg-desktop-portal-kde];
255 services.pipewire.enable = mkDefault true;
257 # Enable screen reader by default
258 services.orca.enable = mkDefault true;
260 services.displayManager = {
261 sessionPackages = [kdePackages.plasma-workspace];
262 defaultSession = mkDefault "plasma";
264 services.displayManager.sddm = {
265 package = kdePackages.sddm;
266 theme = mkDefault "breeze";
267 wayland.compositor = "kwin";
268 extraPackages = with kdePackages; [
278 security.pam.services = {
281 package = kdePackages.kwallet-pam;
284 allowNullPassword = true;
287 package = kdePackages.kwallet-pam;
290 kde-fingerprint = lib.mkIf config.services.fprintd.enable { fprintAuth = true; };
291 kde-smartcard = lib.mkIf config.security.pam.p11.enable { p11Auth = true; };
294 security.wrappers = {
298 capabilities = "cap_sys_nice+ep";
299 source = "${lib.getBin pkgs.kdePackages.kwin}/bin/kwin_wayland";
303 programs.dconf.enable = true;
305 programs.firefox.nativeMessagingHosts.packages = [kdePackages.plasma-browser-integration];
307 programs.chromium = {
308 enablePlasmaBrowserIntegration = true;
309 plasmaBrowserIntegrationPackage = pkgs.kdePackages.plasma-browser-integration;
312 programs.kdeconnect.package = kdePackages.kdeconnect-kde;
313 programs.partition-manager.package = kdePackages.partitionmanager;
315 # FIXME: ugly hack. See #292632 for details.
316 system.userActivationScripts.rebuildSycoca = activationScript;
317 systemd.user.services.nixos-rebuild-sycoca = {
318 description = "Rebuild KDE system configuration cache";
319 wantedBy = [ "graphical-session-pre.target" ];
320 serviceConfig.Type = "oneshot";
321 script = activationScript;