| 
									
										
										
										
											2015-01-19 11:39:23 -06:00
										 |  |  | { config, lib, pkgs, ... }: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | with lib; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | let | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   xcfg = config.services.xserver; | 
					
						
							| 
									
										
										
										
											2017-02-25 14:43:13 -06:00
										 |  |  |   cfg = xcfg.desktopManager.plasma5; | 
					
						
							| 
									
										
										
										
											2015-01-19 11:39:23 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-07-20 19:36:12 +00:00
										 |  |  |   inherit (pkgs) kdeApplications plasma5 libsForQt5 qt5; | 
					
						
							| 
									
										
										
										
											2015-01-19 11:39:23 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | in | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   options = { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-25 14:43:13 -06:00
										 |  |  |     services.xserver.desktopManager.plasma5 = { | 
					
						
							| 
									
										
										
										
											2015-01-19 11:39:23 -06:00
										 |  |  |       enable = mkOption { | 
					
						
							|  |  |  |         type = types.bool; | 
					
						
							|  |  |  |         default = false; | 
					
						
							|  |  |  |         description = "Enable the Plasma 5 (KDE 5) desktop environment."; | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-14 09:59:22 -06:00
										 |  |  |       enableQt4Support = mkOption { | 
					
						
							|  |  |  |         type = types.bool; | 
					
						
							|  |  |  |         default = true; | 
					
						
							|  |  |  |         description = ''
 | 
					
						
							| 
									
										
										
										
											2017-12-22 15:32:25 +03:00
										 |  |  |           Enable support for Qt 4-based applications. Particularly, install a | 
					
						
							|  |  |  |           default backend for Phonon. | 
					
						
							| 
									
										
										
										
											2016-11-14 09:59:22 -06:00
										 |  |  |         '';
 | 
					
						
							|  |  |  |       }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-01-19 11:39:23 -06:00
										 |  |  |     }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-12-28 16:53:19 +03:00
										 |  |  |   config = mkMerge [ | 
					
						
							|  |  |  |     (mkIf (xcfg.enable && cfg.enable) { | 
					
						
							|  |  |  |       services.xserver.desktopManager.session = singleton { | 
					
						
							| 
									
										
										
										
											2017-02-25 14:43:13 -06:00
										 |  |  |         name = "plasma5"; | 
					
						
							| 
									
										
										
										
											2016-12-28 16:53:19 +03:00
										 |  |  |         bgSupport = true; | 
					
						
							|  |  |  |         start = ''
 | 
					
						
							|  |  |  |           # Load PulseAudio module for routing support. | 
					
						
							|  |  |  |           # See http://colin.guthr.ie/2009/10/so-how-does-the-kde-pulseaudio-support-work-anyway/ | 
					
						
							|  |  |  |           ${optionalString config.hardware.pulseaudio.enable ''
 | 
					
						
							|  |  |  |             ${getBin config.hardware.pulseaudio.package}/bin/pactl load-module module-device-manager "do_routing=1" | 
					
						
							|  |  |  |           ''}
 | 
					
						
							| 
									
										
										
										
											2016-04-14 16:34:45 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-02 06:30:25 -06:00
										 |  |  |           if [ -f "$HOME/.config/kdeglobals" ] | 
					
						
							|  |  |  |           then | 
					
						
							|  |  |  |               # Remove extraneous font style names. | 
					
						
							|  |  |  |               # See also: https://phabricator.kde.org/D9070 | 
					
						
							|  |  |  |               ${getBin pkgs.gnused}/bin/sed -i "$HOME/.config/kdeglobals" \ | 
					
						
							|  |  |  |                   -e '/^fixed=/ s/,Regular$//' \ | 
					
						
							|  |  |  |                   -e '/^font=/ s/,Regular$//' \ | 
					
						
							|  |  |  |                   -e '/^menuFont=/ s/,Regular$//' \ | 
					
						
							|  |  |  |                   -e '/^smallestReadableFont=/ s/,Regular$//' \ | 
					
						
							|  |  |  |                   -e '/^toolBarFont=/ s/,Regular$//' | 
					
						
							|  |  |  |           fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-19 18:22:03 -05:00
										 |  |  |           exec "${getBin plasma5.plasma-workspace}/bin/startkde" | 
					
						
							| 
									
										
										
										
											2016-12-28 16:53:19 +03:00
										 |  |  |         '';
 | 
					
						
							|  |  |  |       }; | 
					
						
							| 
									
										
										
										
											2015-01-19 11:39:23 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-29 01:58:12 -06:00
										 |  |  |       security.wrappers = { | 
					
						
							| 
									
										
										
										
											2018-10-04 10:17:40 +08:00
										 |  |  |         kcheckpass.source = "${lib.getBin plasma5.kscreenlocker}/lib/libexec/kcheckpass"; | 
					
						
							| 
									
										
										
										
											2017-05-22 13:49:07 -05:00
										 |  |  |         "start_kdeinit".source = "${lib.getBin pkgs.kinit}/lib/libexec/kf5/start_kdeinit"; | 
					
						
							| 
									
										
										
										
											2018-02-08 14:03:33 +08:00
										 |  |  |         kwin_wayland = { | 
					
						
							|  |  |  |           source = "${lib.getBin plasma5.kwin}/bin/kwin_wayland"; | 
					
						
							|  |  |  |           capabilities = "cap_sys_nice+ep"; | 
					
						
							|  |  |  |         }; | 
					
						
							| 
									
										
										
										
											2017-01-29 01:58:12 -06:00
										 |  |  |       }; | 
					
						
							| 
									
										
										
										
											2015-12-11 06:58:28 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-26 06:49:15 -06:00
										 |  |  |       environment.systemPackages = with pkgs; with qt5; with libsForQt5; with plasma5; with kdeApplications; | 
					
						
							| 
									
										
										
										
											2016-12-28 16:53:19 +03:00
										 |  |  |         [ | 
					
						
							| 
									
										
										
										
											2017-02-25 12:25:44 -06:00
										 |  |  |           frameworkintegration | 
					
						
							|  |  |  |           kactivities | 
					
						
							|  |  |  |           kauth | 
					
						
							|  |  |  |           kcmutils | 
					
						
							|  |  |  |           kconfig | 
					
						
							|  |  |  |           kconfigwidgets | 
					
						
							|  |  |  |           kcoreaddons | 
					
						
							| 
									
										
										
										
											2018-09-23 00:06:34 -05:00
										 |  |  |           kdoctools | 
					
						
							| 
									
										
										
										
											2017-02-25 12:25:44 -06:00
										 |  |  |           kdbusaddons | 
					
						
							|  |  |  |           kdeclarative | 
					
						
							|  |  |  |           kded | 
					
						
							|  |  |  |           kdesu | 
					
						
							|  |  |  |           kdnssd | 
					
						
							|  |  |  |           kemoticons | 
					
						
							|  |  |  |           kfilemetadata | 
					
						
							|  |  |  |           kglobalaccel | 
					
						
							|  |  |  |           kguiaddons | 
					
						
							|  |  |  |           kiconthemes | 
					
						
							|  |  |  |           kidletime | 
					
						
							|  |  |  |           kimageformats | 
					
						
							|  |  |  |           kinit | 
					
						
							|  |  |  |           kio | 
					
						
							|  |  |  |           kjobwidgets | 
					
						
							|  |  |  |           knewstuff | 
					
						
							|  |  |  |           knotifications | 
					
						
							|  |  |  |           knotifyconfig | 
					
						
							|  |  |  |           kpackage | 
					
						
							|  |  |  |           kparts | 
					
						
							|  |  |  |           kpeople | 
					
						
							|  |  |  |           krunner | 
					
						
							|  |  |  |           kservice | 
					
						
							|  |  |  |           ktextwidgets | 
					
						
							|  |  |  |           kwallet | 
					
						
							|  |  |  |           kwallet-pam | 
					
						
							|  |  |  |           kwalletmanager | 
					
						
							|  |  |  |           kwayland | 
					
						
							|  |  |  |           kwidgetsaddons | 
					
						
							|  |  |  |           kxmlgui | 
					
						
							|  |  |  |           kxmlrpcclient | 
					
						
							|  |  |  |           plasma-framework | 
					
						
							|  |  |  |           solid | 
					
						
							|  |  |  |           sonnet | 
					
						
							|  |  |  |           threadweaver | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           breeze-qt5 | 
					
						
							|  |  |  |           kactivitymanagerd | 
					
						
							|  |  |  |           kde-cli-tools | 
					
						
							|  |  |  |           kdecoration | 
					
						
							|  |  |  |           kdeplasma-addons | 
					
						
							|  |  |  |           kgamma5 | 
					
						
							|  |  |  |           khotkeys | 
					
						
							|  |  |  |           kinfocenter | 
					
						
							|  |  |  |           kmenuedit | 
					
						
							|  |  |  |           kscreen | 
					
						
							|  |  |  |           kscreenlocker | 
					
						
							|  |  |  |           ksysguard | 
					
						
							|  |  |  |           kwayland | 
					
						
							|  |  |  |           kwin | 
					
						
							|  |  |  |           kwrited | 
					
						
							|  |  |  |           libkscreen | 
					
						
							|  |  |  |           libksysguard | 
					
						
							|  |  |  |           milou | 
					
						
							|  |  |  |           plasma-integration | 
					
						
							|  |  |  |           polkit-kde-agent | 
					
						
							|  |  |  |           systemsettings | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           plasma-desktop | 
					
						
							|  |  |  |           plasma-workspace | 
					
						
							|  |  |  |           plasma-workspace-wallpapers | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-16 10:56:41 -05:00
										 |  |  |           dolphin | 
					
						
							| 
									
										
										
										
											2017-02-25 12:25:44 -06:00
										 |  |  |           dolphin-plugins | 
					
						
							|  |  |  |           ffmpegthumbs | 
					
						
							|  |  |  |           kdegraphics-thumbnailers | 
					
						
							| 
									
										
										
										
											2017-05-16 10:56:41 -05:00
										 |  |  |           khelpcenter | 
					
						
							| 
									
										
										
										
											2017-02-25 12:25:44 -06:00
										 |  |  |           kio-extras | 
					
						
							| 
									
										
										
										
											2017-05-16 10:56:41 -05:00
										 |  |  |           konsole | 
					
						
							|  |  |  |           oxygen | 
					
						
							| 
									
										
										
										
											2017-02-25 12:25:44 -06:00
										 |  |  |           print-manager | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |           breeze-icons | 
					
						
							| 
									
										
										
										
											2018-02-25 03:23:58 +01:00
										 |  |  |           pkgs.hicolor-icon-theme | 
					
						
							| 
									
										
										
										
											2016-12-28 16:53:19 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-25 12:25:44 -06:00
										 |  |  |           kde-gtk-config breeze-gtk | 
					
						
							| 
									
										
										
										
											2016-12-28 16:53:19 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-28 05:47:45 +08:00
										 |  |  |           qtvirtualkeyboard | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-11 18:29:23 -05:00
										 |  |  |           libsForQt56.phonon-backend-gstreamer | 
					
						
							|  |  |  |           libsForQt5.phonon-backend-gstreamer | 
					
						
							| 
									
										
										
										
											2016-12-28 16:53:19 +03:00
										 |  |  |         ] | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-12-22 15:32:25 +03:00
										 |  |  |         ++ lib.optionals cfg.enableQt4Support [ pkgs.phonon-backend-gstreamer ] | 
					
						
							| 
									
										
										
										
											2016-12-28 16:53:19 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |         # Optional hardware support features | 
					
						
							| 
									
										
										
										
											2017-02-25 12:25:44 -06:00
										 |  |  |         ++ lib.optional config.hardware.bluetooth.enable bluedevil | 
					
						
							|  |  |  |         ++ lib.optional config.networking.networkmanager.enable plasma-nm | 
					
						
							|  |  |  |         ++ lib.optional config.hardware.pulseaudio.enable plasma-pa | 
					
						
							|  |  |  |         ++ lib.optional config.powerManagement.enable powerdevil | 
					
						
							|  |  |  |         ++ lib.optional config.services.colord.enable colord-kde | 
					
						
							|  |  |  |         ++ lib.optionals config.services.samba.enable [ kdenetwork-filesharing pkgs.samba ]; | 
					
						
							| 
									
										
										
										
											2016-12-28 16:53:19 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-08-15 09:55:35 +01:00
										 |  |  |       environment.pathsToLink = [  | 
					
						
							|  |  |  |         # FIXME: modules should link subdirs of `/share` rather than relying on this | 
					
						
							|  |  |  |         "/share"  | 
					
						
							|  |  |  |       ]; | 
					
						
							| 
									
										
										
										
											2016-12-28 16:53:19 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-30 14:03:42 +01:00
										 |  |  |       environment.etc = singleton { | 
					
						
							| 
									
										
										
										
											2017-03-18 17:51:11 -04:00
										 |  |  |         source = xcfg.xkbDir; | 
					
						
							| 
									
										
										
										
											2017-01-30 14:03:42 +01:00
										 |  |  |         target = "X11/xkb"; | 
					
						
							|  |  |  |       }; | 
					
						
							| 
									
										
										
										
											2015-01-19 11:39:23 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-06-25 14:11:59 +02:00
										 |  |  |       # Enable GTK applications to load SVG icons | 
					
						
							|  |  |  |       services.xserver.gdk-pixbuf.modulePackages = [ pkgs.librsvg ]; | 
					
						
							| 
									
										
										
										
											2017-02-25 12:25:44 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  |       fonts.fonts = with pkgs; [ noto-fonts hack-font ]; | 
					
						
							| 
									
										
										
										
											2017-03-04 14:50:15 -06:00
										 |  |  |       fonts.fontconfig.defaultFonts = { | 
					
						
							|  |  |  |         monospace = [ "Hack" "Noto Mono" ]; | 
					
						
							|  |  |  |         sansSerif = [ "Noto Sans" ]; | 
					
						
							|  |  |  |         serif = [ "Noto Serif" ]; | 
					
						
							|  |  |  |       }; | 
					
						
							| 
									
										
										
										
											2016-12-28 16:53:19 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-21 23:03:34 +01:00
										 |  |  |       programs.ssh.askPassword = mkDefault "${plasma5.ksshaskpass.out}/bin/ksshaskpass"; | 
					
						
							| 
									
										
										
										
											2016-12-28 16:53:19 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |       # Enable helpful DBus services. | 
					
						
							|  |  |  |       services.udisks2.enable = true; | 
					
						
							|  |  |  |       services.upower.enable = config.powerManagement.enable; | 
					
						
							| 
									
										
										
										
											2017-01-18 19:50:04 +01:00
										 |  |  |       services.dbus.packages = | 
					
						
							|  |  |  |         mkIf config.services.printing.enable [ pkgs.system-config-printer ]; | 
					
						
							| 
									
										
										
										
											2016-12-28 16:53:19 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |       # Extra UDEV rules used by Solid | 
					
						
							|  |  |  |       services.udev.packages = [ | 
					
						
							|  |  |  |         pkgs.libmtp | 
					
						
							|  |  |  |         pkgs.media-player-info | 
					
						
							| 
									
										
										
										
											2015-12-11 06:58:28 -06:00
										 |  |  |       ]; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-12-28 16:53:19 +03:00
										 |  |  |       services.xserver.displayManager.sddm = { | 
					
						
							| 
									
										
										
										
											2017-10-21 23:03:34 +01:00
										 |  |  |         theme = mkDefault "breeze"; | 
					
						
							| 
									
										
										
										
											2016-12-28 16:53:19 +03:00
										 |  |  |       }; | 
					
						
							| 
									
										
										
										
											2015-01-19 11:39:23 -06:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-12-28 16:53:19 +03:00
										 |  |  |       security.pam.services.kde = { allowNullPassword = true; }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-02-14 19:38:52 -05:00
										 |  |  |       # Doing these one by one seems silly, but we currently lack a better | 
					
						
							|  |  |  |       # construct for handling common pam configs. | 
					
						
							|  |  |  |       security.pam.services.gdm.enableKwallet = true; | 
					
						
							|  |  |  |       security.pam.services.kdm.enableKwallet = true; | 
					
						
							|  |  |  |       security.pam.services.lightdm.enableKwallet = true; | 
					
						
							|  |  |  |       security.pam.services.sddm.enableKwallet = true; | 
					
						
							|  |  |  |       security.pam.services.slim.enableKwallet = true; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-04 11:57:55 +08:00
										 |  |  |       # Update the start menu for each user that is currently logged in | 
					
						
							|  |  |  |       system.userActivationScripts.plasmaSetup = "${pkgs.libsForQt5.kservice}/bin/kbuildsycoca5"; | 
					
						
							| 
									
										
										
										
											2016-12-28 16:53:19 +03:00
										 |  |  |     }) | 
					
						
							|  |  |  |   ]; | 
					
						
							| 
									
										
										
										
											2015-01-19 11:39:23 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | } |