nixpkgs/nixos/modules/services/x11/desktop-managers/plasma5.nix

232 lines
6.4 KiB
Nix
Raw Normal View History

2015-01-19 17:39:23 +00:00
{ config, lib, pkgs, ... }:
with lib;
let
xcfg = config.services.xserver;
cfg = xcfg.desktopManager.plasma5;
2015-01-19 17:39:23 +00:00
inherit (pkgs) kdeApplications plasma5 libsForQt5 qt5;
2015-01-19 17:39:23 +00:00
in
{
options = {
services.xserver.desktopManager.plasma5 = {
2015-01-19 17:39:23 +00:00
enable = mkOption {
type = types.bool;
default = false;
description = "Enable the Plasma 5 (KDE 5) desktop environment.";
};
2016-11-14 15:59:22 +00:00
enableQt4Support = mkOption {
type = types.bool;
default = true;
description = ''
2017-12-22 12:32:25 +00:00
Enable support for Qt 4-based applications. Particularly, install a
default backend for Phonon.
2016-11-14 15:59:22 +00:00
'';
};
2015-01-19 17:39:23 +00:00
};
};
config = mkMerge [
(mkIf (xcfg.enable && cfg.enable) {
services.xserver.desktopManager.session = singleton {
name = "plasma5";
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 22:34:45 +01: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
exec "${getBin plasma5.plasma-workspace}/bin/startkde"
'';
};
2015-01-19 17:39:23 +00:00
2017-01-29 07:58:12 +00:00
security.wrappers = {
kcheckpass.source = "${lib.getBin plasma5.kscreenlocker}/lib/libexec/kcheckpass";
"start_kdeinit".source = "${lib.getBin pkgs.kinit}/lib/libexec/kf5/start_kdeinit";
2018-02-08 06:03:33 +00:00
kwin_wayland = {
source = "${lib.getBin plasma5.kwin}/bin/kwin_wayland";
capabilities = "cap_sys_nice+ep";
};
2017-01-29 07:58:12 +00:00
};
2015-12-11 12:58:28 +00:00
environment.systemPackages = with pkgs; with qt5; with libsForQt5; with plasma5; with kdeApplications;
[
frameworkintegration
kactivities
kauth
kcmutils
kconfig
kconfigwidgets
kcoreaddons
kdoctools
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 16:56:41 +01:00
dolphin
dolphin-plugins
ffmpegthumbs
kdegraphics-thumbnailers
2017-05-16 16:56:41 +01:00
khelpcenter
kio-extras
2017-05-16 16:56:41 +01:00
konsole
oxygen
print-manager
breeze-icons
pkgs.hicolor-icon-theme
kde-gtk-config breeze-gtk
qtvirtualkeyboard
libsForQt56.phonon-backend-gstreamer
libsForQt5.phonon-backend-gstreamer
]
2017-12-22 12:32:25 +00:00
++ lib.optionals cfg.enableQt4Support [ pkgs.phonon-backend-gstreamer ]
# Optional hardware support features
++ 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 ];
environment.pathsToLink = [
# FIXME: modules should link subdirs of `/share` rather than relying on this
"/share"
];
environment.etc = singleton {
source = xcfg.xkbDir;
target = "X11/xkb";
};
2015-01-19 17:39:23 +00:00
Use a NixOS module for generating the gdk-pixbuf loaders cache. Fixes issue #33231 and makes it possible to enable Plasma and KDE at the same time. Previously, this worked like this: - The gdk-pixbuf package comes with a cache file covering the modules bundled with gdk-pixbuf. - The librsvg package comes with a cache covering modules from gdk-pixbuf as well as librsvg. - plasma5 and xfce modules set the environment variable GDK_PIXBUF_MODULE_FILE to the one from librsvg, so that SVG was supported in addition to the formats supported by gdk-pixbuf. However if both were enabled a configuration conflict would result (despite setting to the same value). While this sort of worked (ignoring the conflict which perhaps could be hacked around), it is unscalable and a hack, as there would be a real problem when one wanted to add a third package that supports additional image formats. A new NixOS module (gdk-pixbuf) is added with a configuration option (modulePackages) that other modules use to request specific packages to be included in the loaders cache. When any package is present in the list, the module generates a system-wide loaders cache which includes the requested packages (and always gdk-pixbuf itself), and sets the environment variable GDK_PIXBUF_MODULE_FILE to point to the generated cache file. The plasma5 and xfce modules are updated to add librsvg to modulePackages instead of setting GDK_PIXBUF_MODULE_FILE. Note that many packages create wrappers that set GDK_PIXBUF_MODULE_FILE, some directly to the one from librsvg. Therefore this change does not change the existing hack in the librsvg package which ensures that file is generated. This change aims only to solve the conflict in the global environent variable configuration.
2018-06-25 13:11:59 +01:00
# Enable GTK applications to load SVG icons
services.xserver.gdk-pixbuf.modulePackages = [ pkgs.librsvg ];
fonts.fonts = with pkgs; [ noto-fonts hack-font ];
fonts.fontconfig.defaultFonts = {
monospace = [ "Hack" "Noto Mono" ];
sansSerif = [ "Noto Sans" ];
serif = [ "Noto Serif" ];
};
programs.ssh.askPassword = mkDefault "${plasma5.ksshaskpass.out}/bin/ksshaskpass";
# Enable helpful DBus services.
services.udisks2.enable = true;
services.upower.enable = config.powerManagement.enable;
services.dbus.packages =
mkIf config.services.printing.enable [ pkgs.system-config-printer ];
# Extra UDEV rules used by Solid
services.udev.packages = [
pkgs.libmtp
pkgs.media-player-info
2015-12-11 12:58:28 +00:00
];
services.xserver.displayManager.sddm = {
theme = mkDefault "breeze";
};
2015-01-19 17:39:23 +00:00
security.pam.services.kde = { allowNullPassword = true; };
# 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;
# Update the start menu for each user that is currently logged in
system.userActivationScripts.plasmaSetup = "${pkgs.libsForQt5.kservice}/bin/kbuildsycoca5";
})
];
2015-01-19 17:39:23 +00:00
}