2022-06-12 11:33:30 +00:00
|
|
|
|
{ config, lib, pkgs, utils, ... }:
|
2015-01-19 17:39:23 +00:00
|
|
|
|
|
|
|
|
|
let
|
|
|
|
|
xcfg = config.services.xserver;
|
2017-02-25 20:43:13 +00:00
|
|
|
|
cfg = xcfg.desktopManager.plasma5;
|
2015-01-19 17:39:23 +00:00
|
|
|
|
|
2021-07-14 22:16:42 +00:00
|
|
|
|
# Use only for **internal** options.
|
|
|
|
|
# This is not exactly user-friendly.
|
|
|
|
|
kdeConfigurationType = with types;
|
|
|
|
|
let
|
|
|
|
|
valueTypes = (oneOf [
|
|
|
|
|
bool
|
|
|
|
|
float
|
|
|
|
|
int
|
|
|
|
|
str
|
|
|
|
|
]) // {
|
|
|
|
|
description = "KDE Configuration value";
|
|
|
|
|
emptyValue.value = "";
|
|
|
|
|
};
|
|
|
|
|
set = (nullOr (lazyAttrsOf valueTypes)) // {
|
|
|
|
|
description = "KDE Configuration set";
|
|
|
|
|
emptyValue.value = {};
|
|
|
|
|
};
|
|
|
|
|
in (lazyAttrsOf set) // {
|
|
|
|
|
description = "KDE Configuration file";
|
|
|
|
|
emptyValue.value = {};
|
|
|
|
|
};
|
|
|
|
|
|
2021-03-29 06:38:19 +00:00
|
|
|
|
inherit (lib)
|
2022-12-25 20:02:41 +00:00
|
|
|
|
getBin optionalAttrs literalExpression
|
2021-03-29 06:38:19 +00:00
|
|
|
|
mkRemovedOptionModule mkRenamedOptionModule
|
2023-11-30 18:03:14 +00:00
|
|
|
|
mkDefault mkIf mkMerge mkOption mkPackageOption types;
|
2021-03-29 06:38:19 +00:00
|
|
|
|
|
2020-02-08 15:25:14 +00:00
|
|
|
|
activationScript = ''
|
2020-02-27 15:48:36 +00:00
|
|
|
|
${set_XDG_CONFIG_HOME}
|
|
|
|
|
|
2020-02-08 15:25:14 +00:00
|
|
|
|
# The KDE icon cache is supposed to update itself automatically, but it uses
|
|
|
|
|
# the timestamp on the icon theme directory as a trigger. This doesn't work
|
|
|
|
|
# on NixOS because the timestamp never changes. As a workaround, delete the
|
|
|
|
|
# icon cache at login and session activation.
|
|
|
|
|
# See also: http://lists-archives.org/kde-devel/26175-what-when-will-icon-cache-refresh.html
|
|
|
|
|
rm -fv $HOME/.cache/icon-cache.kcache
|
|
|
|
|
|
|
|
|
|
# xdg-desktop-settings generates this empty file but
|
|
|
|
|
# it makes kbuildsyscoca5 fail silently. To fix this
|
|
|
|
|
# remove that menu if it exists.
|
2020-02-27 15:48:36 +00:00
|
|
|
|
rm -fv ''${XDG_CONFIG_HOME}/menus/applications-merged/xdg-desktop-menu-dummy.menu
|
2020-02-08 15:25:14 +00:00
|
|
|
|
|
|
|
|
|
# Qt writes a weird ‘libraryPath’ line to
|
|
|
|
|
# ~/.config/Trolltech.conf that causes the KDE plugin
|
|
|
|
|
# paths of previous KDE invocations to be searched.
|
|
|
|
|
# Obviously using mismatching KDE libraries is potentially
|
|
|
|
|
# disastrous, so here we nuke references to the Nix store
|
|
|
|
|
# in Trolltech.conf. A better solution would be to stop
|
|
|
|
|
# Qt from doing this wackiness in the first place.
|
2020-02-27 15:48:36 +00:00
|
|
|
|
trolltech_conf="''${XDG_CONFIG_HOME}/Trolltech.conf"
|
2020-02-08 15:25:14 +00:00
|
|
|
|
if [ -e "$trolltech_conf" ]; then
|
2021-10-31 15:54:21 +00:00
|
|
|
|
${getBin pkgs.gnused}/bin/sed -i "$trolltech_conf" -e '/nix\\store\|nix\/store/ d'
|
2020-02-08 15:25:14 +00:00
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# Remove the kbuildsyscoca5 cache. It will be regenerated
|
|
|
|
|
# immediately after. This is necessary for kbuildsyscoca5 to
|
|
|
|
|
# recognize that software that has been removed.
|
|
|
|
|
rm -fv $HOME/.cache/ksycoca*
|
|
|
|
|
|
2022-12-25 20:02:41 +00:00
|
|
|
|
${pkgs.plasma5Packages.kservice}/bin/kbuildsycoca5
|
2020-02-08 15:25:14 +00:00
|
|
|
|
'';
|
|
|
|
|
|
2020-02-27 15:48:36 +00:00
|
|
|
|
set_XDG_CONFIG_HOME = ''
|
2021-03-29 06:38:19 +00:00
|
|
|
|
# Set the default XDG_CONFIG_HOME if it is unset.
|
|
|
|
|
# Per the XDG Base Directory Specification:
|
|
|
|
|
# https://specifications.freedesktop.org/basedir-spec/latest
|
|
|
|
|
# 1. Never export this variable! If it is unset, then child processes are
|
|
|
|
|
# expected to set the default themselves.
|
|
|
|
|
# 2. Contaminate / if $HOME is unset; do not check if $HOME is set.
|
|
|
|
|
XDG_CONFIG_HOME=''${XDG_CONFIG_HOME:-$HOME/.config}
|
2020-02-27 15:48:36 +00:00
|
|
|
|
'';
|
|
|
|
|
|
2015-01-19 17:39:23 +00:00
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
{
|
2023-03-15 21:53:18 +00:00
|
|
|
|
options = {
|
|
|
|
|
services.xserver.desktopManager.plasma5 = {
|
|
|
|
|
enable = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
|
|
|
|
description = lib.mdDoc "Enable the Plasma 5 (KDE 5) desktop environment.";
|
|
|
|
|
};
|
2020-05-26 14:13:33 +00:00
|
|
|
|
|
2023-03-15 21:53:18 +00:00
|
|
|
|
phononBackend = mkOption {
|
|
|
|
|
type = types.enum [ "gstreamer" "vlc" ];
|
|
|
|
|
default = "vlc";
|
|
|
|
|
example = "gstreamer";
|
|
|
|
|
description = lib.mdDoc "Phonon audio backend to install.";
|
|
|
|
|
};
|
2015-01-19 17:39:23 +00:00
|
|
|
|
|
2023-03-15 21:53:18 +00:00
|
|
|
|
useQtScaling = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
|
|
|
|
description = lib.mdDoc "Enable HiDPI scaling in Qt.";
|
|
|
|
|
};
|
2021-07-14 22:16:42 +00:00
|
|
|
|
|
2023-03-15 21:53:18 +00:00
|
|
|
|
runUsingSystemd = mkOption {
|
|
|
|
|
description = lib.mdDoc "Use systemd to manage the Plasma session";
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = true;
|
|
|
|
|
};
|
2022-06-12 11:33:30 +00:00
|
|
|
|
|
2023-11-30 18:03:14 +00:00
|
|
|
|
notoPackage = mkPackageOption pkgs "Noto fonts" {
|
2023-03-15 21:53:18 +00:00
|
|
|
|
default = [ "noto-fonts" ];
|
|
|
|
|
example = "noto-fonts-lgc-plus";
|
|
|
|
|
};
|
2022-11-21 12:29:39 +00:00
|
|
|
|
|
2023-03-15 21:53:18 +00:00
|
|
|
|
# Internally allows configuring kdeglobals globally
|
|
|
|
|
kdeglobals = mkOption {
|
|
|
|
|
internal = true;
|
|
|
|
|
default = {};
|
|
|
|
|
type = kdeConfigurationType;
|
|
|
|
|
};
|
2021-07-14 22:16:42 +00:00
|
|
|
|
|
2023-03-15 21:53:18 +00:00
|
|
|
|
# Internally allows configuring kwin globally
|
|
|
|
|
kwinrc = mkOption {
|
|
|
|
|
internal = true;
|
|
|
|
|
default = {};
|
|
|
|
|
type = kdeConfigurationType;
|
|
|
|
|
};
|
2019-03-26 16:49:26 +00:00
|
|
|
|
|
2023-03-15 21:53:18 +00:00
|
|
|
|
mobile.enable = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
|
Enable support for running the Plasma Mobile shell.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2021-03-16 19:25:41 +00:00
|
|
|
|
|
2023-03-15 21:53:18 +00:00
|
|
|
|
mobile.installRecommendedSoftware = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = true;
|
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
|
Installs software recommended for use with Plasma Mobile, but which
|
|
|
|
|
is not strictly required for Plasma Mobile to run.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2022-09-17 13:02:37 +00:00
|
|
|
|
|
2023-03-15 21:53:18 +00:00
|
|
|
|
bigscreen.enable = mkOption {
|
|
|
|
|
type = types.bool;
|
|
|
|
|
default = false;
|
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
|
Enable support for running the Plasma Bigscreen session.
|
|
|
|
|
'';
|
|
|
|
|
};
|
2022-09-17 13:02:37 +00:00
|
|
|
|
};
|
2023-03-15 21:53:18 +00:00
|
|
|
|
environment.plasma5.excludePackages = mkOption {
|
|
|
|
|
description = lib.mdDoc "List of default packages to exclude from the configuration";
|
|
|
|
|
type = types.listOf types.package;
|
|
|
|
|
default = [];
|
|
|
|
|
example = literalExpression "[ pkgs.plasma5Packages.oxygen ]";
|
|
|
|
|
};
|
2015-01-19 17:39:23 +00:00
|
|
|
|
};
|
|
|
|
|
|
2019-11-21 20:54:49 +00:00
|
|
|
|
imports = [
|
|
|
|
|
(mkRemovedOptionModule [ "services" "xserver" "desktopManager" "plasma5" "enableQt4Support" ] "Phonon no longer supports Qt 4.")
|
2023-03-17 20:39:08 +00:00
|
|
|
|
(mkRemovedOptionModule [ "services" "xserver" "desktopManager" "plasma5" "supportDDC" ] "DDC/CI is no longer supported upstream.")
|
2019-12-10 01:51:19 +00:00
|
|
|
|
(mkRenamedOptionModule [ "services" "xserver" "desktopManager" "kde5" ] [ "services" "xserver" "desktopManager" "plasma5" ])
|
2023-03-15 21:53:18 +00:00
|
|
|
|
(mkRenamedOptionModule [ "services" "xserver" "desktopManager" "plasma5" "excludePackages" ] [ "environment" "plasma5" "excludePackages" ])
|
2019-11-21 20:54:49 +00:00
|
|
|
|
];
|
2015-01-19 17:39:23 +00:00
|
|
|
|
|
2016-12-28 13:53:19 +00:00
|
|
|
|
config = mkMerge [
|
2021-11-02 01:11:50 +00:00
|
|
|
|
# Common Plasma dependencies
|
2022-09-17 13:02:37 +00:00
|
|
|
|
(mkIf (cfg.enable || cfg.mobile.enable || cfg.bigscreen.enable) {
|
2015-01-19 17:39:23 +00:00
|
|
|
|
|
2017-01-29 07:58:12 +00:00
|
|
|
|
security.wrappers = {
|
nixos/plasma5: remove pointless setuid wrappers
The module for Plasma 5 contained two pointless setuid wrappers:
* kscreenlocker_greet was introduced when the kscreenlocker package
dropped kcheckpass. However, this was actually replaced by making
proper use of PAM (which finally calls its unix_chkpwd setuid binary).
kscreenlocker_greet itself was never intended to be setuid.
Fortunately, this is not exploitable, because QCoreApplication
immediately aborts if it detects setuid. The wrapper is still
incorrect and pointless, so remove it.
* start_kdeinit can optionally use setuid root or setcap
CAP_SYS_RESOURCE to reduce its OOM killer score. However, with systemd
startup, start_kdeinit does not get used at all. So in this case, the
setuid wrapper is pointless, and so is removed as well. Ideally, the
case where systemd startup is not enabled would use a capability
wrapper instead, but since systemd startup is the default in NixOS and
kinit is deprecated upstream for KF6, I don't bother any more.
2023-09-08 17:21:22 +00:00
|
|
|
|
kwin_wayland = {
|
2021-10-31 15:54:21 +00:00
|
|
|
|
owner = "root";
|
|
|
|
|
group = "root";
|
nixos/plasma5: remove pointless setuid wrappers
The module for Plasma 5 contained two pointless setuid wrappers:
* kscreenlocker_greet was introduced when the kscreenlocker package
dropped kcheckpass. However, this was actually replaced by making
proper use of PAM (which finally calls its unix_chkpwd setuid binary).
kscreenlocker_greet itself was never intended to be setuid.
Fortunately, this is not exploitable, because QCoreApplication
immediately aborts if it detects setuid. The wrapper is still
incorrect and pointless, so remove it.
* start_kdeinit can optionally use setuid root or setcap
CAP_SYS_RESOURCE to reduce its OOM killer score. However, with systemd
startup, start_kdeinit does not get used at all. So in this case, the
setuid wrapper is pointless, and so is removed as well. Ideally, the
case where systemd startup is not enabled would use a capability
wrapper instead, but since systemd startup is the default in NixOS and
kinit is deprecated upstream for KF6, I don't bother any more.
2023-09-08 17:21:22 +00:00
|
|
|
|
capabilities = "cap_sys_nice+ep";
|
2022-12-25 20:02:41 +00:00
|
|
|
|
source = "${getBin pkgs.plasma5Packages.kwin}/bin/kwin_wayland";
|
2021-10-31 15:54:21 +00:00
|
|
|
|
};
|
2023-11-04 15:33:38 +00:00
|
|
|
|
} // optionalAttrs (!cfg.runUsingSystemd) {
|
2021-10-31 15:54:21 +00:00
|
|
|
|
start_kdeinit = {
|
|
|
|
|
setuid = true;
|
|
|
|
|
owner = "root";
|
|
|
|
|
group = "root";
|
2022-12-25 20:02:41 +00:00
|
|
|
|
source = "${getBin pkgs.plasma5Packages.kinit}/libexec/kf5/start_kdeinit";
|
2021-10-31 15:54:21 +00:00
|
|
|
|
};
|
2017-01-29 07:58:12 +00:00
|
|
|
|
};
|
2015-12-11 12:58:28 +00:00
|
|
|
|
|
2024-01-30 14:36:06 +00:00
|
|
|
|
qt.enable = true;
|
|
|
|
|
|
2020-09-08 13:47:34 +00:00
|
|
|
|
environment.systemPackages =
|
2022-12-25 20:02:41 +00:00
|
|
|
|
with pkgs.plasma5Packages;
|
2022-06-12 11:33:30 +00:00
|
|
|
|
let
|
|
|
|
|
requiredPackages = [
|
|
|
|
|
frameworkintegration
|
|
|
|
|
kactivities
|
|
|
|
|
kauth
|
|
|
|
|
kcmutils
|
|
|
|
|
kconfig
|
|
|
|
|
kconfigwidgets
|
|
|
|
|
kcoreaddons
|
|
|
|
|
kdoctools
|
|
|
|
|
kdbusaddons
|
|
|
|
|
kdeclarative
|
|
|
|
|
kded
|
|
|
|
|
kdesu
|
|
|
|
|
kdnssd
|
|
|
|
|
kemoticons
|
|
|
|
|
kfilemetadata
|
|
|
|
|
kglobalaccel
|
|
|
|
|
kguiaddons
|
|
|
|
|
kiconthemes
|
|
|
|
|
kidletime
|
|
|
|
|
kimageformats
|
|
|
|
|
kinit
|
|
|
|
|
kirigami2 # In system profile for SDDM theme. TODO: wrapper.
|
|
|
|
|
kio
|
|
|
|
|
kjobwidgets
|
|
|
|
|
knewstuff
|
|
|
|
|
knotifications
|
|
|
|
|
knotifyconfig
|
|
|
|
|
kpackage
|
|
|
|
|
kparts
|
|
|
|
|
kpeople
|
|
|
|
|
krunner
|
|
|
|
|
kservice
|
|
|
|
|
ktextwidgets
|
|
|
|
|
kwallet
|
|
|
|
|
kwallet-pam
|
|
|
|
|
kwalletmanager
|
|
|
|
|
kwayland
|
|
|
|
|
kwayland-integration
|
|
|
|
|
kwidgetsaddons
|
|
|
|
|
kxmlgui
|
|
|
|
|
kxmlrpcclient
|
|
|
|
|
plasma-framework
|
|
|
|
|
solid
|
|
|
|
|
sonnet
|
|
|
|
|
threadweaver
|
|
|
|
|
|
|
|
|
|
breeze-qt5
|
|
|
|
|
kactivitymanagerd
|
|
|
|
|
kde-cli-tools
|
|
|
|
|
kdecoration
|
|
|
|
|
kdeplasma-addons
|
|
|
|
|
kgamma5
|
|
|
|
|
khotkeys
|
|
|
|
|
kscreen
|
|
|
|
|
kscreenlocker
|
|
|
|
|
kwayland
|
|
|
|
|
kwin
|
|
|
|
|
kwrited
|
|
|
|
|
libkscreen
|
|
|
|
|
libksysguard
|
|
|
|
|
milou
|
|
|
|
|
plasma-integration
|
|
|
|
|
polkit-kde-agent
|
|
|
|
|
|
2024-01-30 08:38:10 +00:00
|
|
|
|
qqc2-breeze-style
|
|
|
|
|
qqc2-desktop-style
|
|
|
|
|
|
2022-06-12 11:33:30 +00:00
|
|
|
|
plasma-desktop
|
|
|
|
|
plasma-workspace
|
|
|
|
|
plasma-workspace-wallpapers
|
|
|
|
|
|
2022-07-28 16:09:49 +00:00
|
|
|
|
oxygen-sounds
|
|
|
|
|
|
2022-06-12 11:33:30 +00:00
|
|
|
|
breeze-icons
|
|
|
|
|
pkgs.hicolor-icon-theme
|
|
|
|
|
|
|
|
|
|
kde-gtk-config
|
|
|
|
|
breeze-gtk
|
|
|
|
|
|
|
|
|
|
qtvirtualkeyboard
|
|
|
|
|
|
|
|
|
|
pkgs.xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/
|
|
|
|
|
];
|
|
|
|
|
optionalPackages = [
|
2023-01-27 08:30:07 +00:00
|
|
|
|
pkgs.aha # needed by kinfocenter for fwupd support
|
2022-06-12 11:33:30 +00:00
|
|
|
|
plasma-browser-integration
|
|
|
|
|
konsole
|
|
|
|
|
oxygen
|
2022-07-08 21:33:19 +00:00
|
|
|
|
(lib.getBin qttools) # Expose qdbus in PATH
|
2022-06-12 11:33:30 +00:00
|
|
|
|
];
|
|
|
|
|
in
|
|
|
|
|
requiredPackages
|
2023-03-15 21:53:18 +00:00
|
|
|
|
++ utils.removePackagesByName optionalPackages config.environment.plasma5.excludePackages
|
2019-07-27 02:36:32 +00:00
|
|
|
|
|
2019-07-20 19:26:01 +00:00
|
|
|
|
# Phonon audio backend
|
2022-12-25 20:02:41 +00:00
|
|
|
|
++ lib.optional (cfg.phononBackend == "gstreamer") pkgs.plasma5Packages.phonon-backend-gstreamer
|
|
|
|
|
++ lib.optional (cfg.phononBackend == "vlc") pkgs.plasma5Packages.phonon-backend-vlc
|
2016-12-28 13:53:19 +00:00
|
|
|
|
|
|
|
|
|
# Optional hardware support features
|
2020-09-11 05:29:57 +00:00
|
|
|
|
++ lib.optionals config.hardware.bluetooth.enable [ bluedevil bluez-qt pkgs.openobex pkgs.obexftp ]
|
2017-02-25 18:25:44 +00:00
|
|
|
|
++ lib.optional config.networking.networkmanager.enable plasma-nm
|
|
|
|
|
++ lib.optional config.hardware.pulseaudio.enable plasma-pa
|
2021-05-16 08:51:11 +00:00
|
|
|
|
++ lib.optional config.services.pipewire.pulse.enable plasma-pa
|
2017-02-25 18:25:44 +00:00
|
|
|
|
++ lib.optional config.powerManagement.enable powerdevil
|
2020-09-14 23:08:00 +00:00
|
|
|
|
++ lib.optional config.services.colord.enable pkgs.colord-kde
|
2021-10-24 21:10:52 +00:00
|
|
|
|
++ lib.optional config.services.hardware.bolt.enable pkgs.plasma5Packages.plasma-thunderbolt
|
2023-11-29 14:33:09 +00:00
|
|
|
|
++ lib.optional config.services.samba.enable kdenetwork-filesharing
|
2023-01-20 12:42:37 +00:00
|
|
|
|
++ lib.optional config.services.xserver.wacom.enable pkgs.wacomtablet
|
|
|
|
|
++ lib.optional config.services.flatpak.enable flatpak-kcm;
|
2016-12-28 13:53:19 +00:00
|
|
|
|
|
2022-11-23 16:27:00 +00:00
|
|
|
|
# Extra services for D-Bus activation
|
|
|
|
|
services.dbus.packages = [
|
2022-12-25 20:02:41 +00:00
|
|
|
|
pkgs.plasma5Packages.kactivitymanagerd
|
2022-11-23 16:27:00 +00:00
|
|
|
|
];
|
|
|
|
|
|
2019-03-01 00:12:28 +00:00
|
|
|
|
environment.pathsToLink = [
|
2018-08-15 08:55:35 +00:00
|
|
|
|
# FIXME: modules should link subdirs of `/share` rather than relying on this
|
2019-03-01 00:12:28 +00:00
|
|
|
|
"/share"
|
2018-08-15 08:55:35 +00:00
|
|
|
|
];
|
2016-12-28 13:53:19 +00:00
|
|
|
|
|
2023-10-09 01:31:13 +00:00
|
|
|
|
environment.etc."X11/xkb".source = xcfg.xkb.dir;
|
2015-01-19 17:39:23 +00:00
|
|
|
|
|
2022-10-28 14:26:05 +00:00
|
|
|
|
environment.sessionVariables = {
|
|
|
|
|
PLASMA_USE_QT_SCALING = mkIf cfg.useQtScaling "1";
|
|
|
|
|
|
|
|
|
|
# Needed for things that depend on other store.kde.org packages to install correctly,
|
|
|
|
|
# notably Plasma look-and-feel packages (a.k.a. Global Themes)
|
|
|
|
|
#
|
|
|
|
|
# FIXME: this is annoyingly impure and should really be fixed at source level somehow,
|
|
|
|
|
# but kpackage is a library so we can't just wrap the one thing invoking it and be done.
|
|
|
|
|
# This also means things won't work for people not on Plasma, but at least this way it
|
|
|
|
|
# works for SOME people.
|
|
|
|
|
KPACKAGE_DEP_RESOLVERS_PATH = "${pkgs.plasma5Packages.frameworkintegration.out}/libexec/kf5/kpackagehandlers";
|
|
|
|
|
};
|
2021-10-09 00:07:03 +00:00
|
|
|
|
|
2018-06-25 12:11:59 +00:00
|
|
|
|
# Enable GTK applications to load SVG icons
|
|
|
|
|
services.xserver.gdk-pixbuf.modulePackages = [ pkgs.librsvg ];
|
2017-02-25 18:25:44 +00:00
|
|
|
|
|
2023-07-19 11:43:36 +00:00
|
|
|
|
fonts.packages = with pkgs; [ cfg.notoPackage hack-font ];
|
2017-03-04 20:50:15 +00:00
|
|
|
|
fonts.fontconfig.defaultFonts = {
|
2020-07-07 14:52:52 +00:00
|
|
|
|
monospace = [ "Hack" "Noto Sans Mono" ];
|
2017-03-04 20:50:15 +00:00
|
|
|
|
sansSerif = [ "Noto Sans" ];
|
|
|
|
|
serif = [ "Noto Serif" ];
|
|
|
|
|
};
|
2016-12-28 13:53:19 +00:00
|
|
|
|
|
2024-03-14 13:53:33 +00:00
|
|
|
|
programs.gnupg.agent.pinentryPackage = mkDefault pkgs.pinentry-qt;
|
2022-12-25 20:02:41 +00:00
|
|
|
|
programs.ssh.askPassword = mkDefault "${pkgs.plasma5Packages.ksshaskpass.out}/bin/ksshaskpass";
|
2016-12-28 13:53:19 +00:00
|
|
|
|
|
|
|
|
|
# Enable helpful DBus services.
|
2021-10-31 15:54:50 +00:00
|
|
|
|
services.accounts-daemon.enable = true;
|
2023-11-08 09:41:53 +00:00
|
|
|
|
programs.dconf.enable = true;
|
2021-10-31 18:50:07 +00:00
|
|
|
|
# when changing an account picture the accounts-daemon reads a temporary file containing the image which systemsettings5 may place under /tmp
|
|
|
|
|
systemd.services.accounts-daemon.serviceConfig.PrivateTmp = false;
|
2022-05-31 10:30:46 +00:00
|
|
|
|
services.power-profiles-daemon.enable = mkDefault true;
|
|
|
|
|
services.system-config-printer.enable = mkIf config.services.printing.enable (mkDefault true);
|
2016-12-28 13:53:19 +00:00
|
|
|
|
services.udisks2.enable = true;
|
|
|
|
|
services.upower.enable = config.powerManagement.enable;
|
2019-09-06 23:18:52 +00:00
|
|
|
|
services.xserver.libinput.enable = mkDefault true;
|
2016-12-28 13:53:19 +00:00
|
|
|
|
|
|
|
|
|
# Extra UDEV rules used by Solid
|
|
|
|
|
services.udev.packages = [
|
2022-01-27 03:29:32 +00:00
|
|
|
|
# libmtp has "bin", "dev", "out" outputs. UDEV rules file is in "out".
|
|
|
|
|
pkgs.libmtp.out
|
2016-12-28 13:53:19 +00:00
|
|
|
|
pkgs.media-player-info
|
2015-12-11 12:58:28 +00:00
|
|
|
|
];
|
|
|
|
|
|
2016-12-28 13:53:19 +00:00
|
|
|
|
services.xserver.displayManager.sddm = {
|
2017-10-21 22:03:34 +00:00
|
|
|
|
theme = mkDefault "breeze";
|
2016-12-28 13:53:19 +00:00
|
|
|
|
};
|
2015-01-19 17:39:23 +00:00
|
|
|
|
|
2016-12-28 13:53:19 +00:00
|
|
|
|
security.pam.services.kde = { allowNullPassword = true; };
|
|
|
|
|
|
2024-02-06 18:09:19 +00:00
|
|
|
|
security.pam.services.login.kwallet.enable = true;
|
2017-02-15 00:38:52 +00:00
|
|
|
|
|
2021-03-29 06:38:19 +00:00
|
|
|
|
systemd.user.services = {
|
|
|
|
|
plasma-early-setup = mkIf cfg.runUsingSystemd {
|
|
|
|
|
description = "Early Plasma setup";
|
|
|
|
|
wantedBy = [ "graphical-session-pre.target" ];
|
|
|
|
|
serviceConfig.Type = "oneshot";
|
|
|
|
|
script = activationScript;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2019-07-27 02:36:32 +00:00
|
|
|
|
xdg.portal.enable = true;
|
2022-12-25 20:02:41 +00:00
|
|
|
|
xdg.portal.extraPortals = [ pkgs.plasma5Packages.xdg-desktop-portal-kde ];
|
|
|
|
|
xdg.portal.configPackages = mkDefault [ pkgs.plasma5Packages.xdg-desktop-portal-kde ];
|
2022-11-23 16:23:24 +00:00
|
|
|
|
# xdg-desktop-portal-kde expects PipeWire to be running.
|
|
|
|
|
# This does not, by default, replace PulseAudio.
|
|
|
|
|
services.pipewire.enable = mkDefault true;
|
2019-07-10 14:01:25 +00:00
|
|
|
|
|
2018-10-04 03:57:55 +00:00
|
|
|
|
# Update the start menu for each user that is currently logged in
|
2020-02-08 15:25:14 +00:00
|
|
|
|
system.userActivationScripts.plasmaSetup = activationScript;
|
2020-10-01 17:32:48 +00:00
|
|
|
|
|
2023-10-21 22:30:48 +00:00
|
|
|
|
programs.firefox.nativeMessagingHosts.packages = [ pkgs.plasma5Packages.plasma-browser-integration ];
|
2023-05-17 20:08:18 +00:00
|
|
|
|
programs.chromium.enablePlasmaBrowserIntegration = true;
|
2022-09-15 18:48:21 +00:00
|
|
|
|
})
|
2021-07-14 22:16:42 +00:00
|
|
|
|
|
2022-09-15 18:48:21 +00:00
|
|
|
|
(mkIf (cfg.kwinrc != {}) {
|
|
|
|
|
environment.etc."xdg/kwinrc".text = lib.generators.toINI {} cfg.kwinrc;
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
(mkIf (cfg.kdeglobals != {}) {
|
|
|
|
|
environment.etc."xdg/kdeglobals".text = lib.generators.toINI {} cfg.kdeglobals;
|
2016-12-28 13:53:19 +00:00
|
|
|
|
})
|
2021-11-02 01:11:50 +00:00
|
|
|
|
|
|
|
|
|
# Plasma Desktop
|
|
|
|
|
(mkIf cfg.enable {
|
|
|
|
|
|
|
|
|
|
# Seed our configuration into nixos-generate-config
|
|
|
|
|
system.nixos-generate-config.desktopConfiguration = [
|
|
|
|
|
''
|
|
|
|
|
# Enable the Plasma 5 Desktop Environment.
|
|
|
|
|
services.xserver.displayManager.sddm.enable = true;
|
|
|
|
|
services.xserver.desktopManager.plasma5.enable = true;
|
|
|
|
|
''
|
|
|
|
|
];
|
|
|
|
|
|
2022-12-25 20:02:41 +00:00
|
|
|
|
services.xserver.displayManager.sessionPackages = [ pkgs.plasma5Packages.plasma-workspace ];
|
2021-11-02 01:11:50 +00:00
|
|
|
|
# Default to be `plasma` (X11) instead of `plasmawayland`, since plasma wayland currently has
|
|
|
|
|
# many tiny bugs.
|
|
|
|
|
# See: https://github.com/NixOS/nixpkgs/issues/143272
|
|
|
|
|
services.xserver.displayManager.defaultSession = mkDefault "plasma";
|
|
|
|
|
|
|
|
|
|
environment.systemPackages =
|
2022-12-25 20:02:41 +00:00
|
|
|
|
with pkgs.plasma5Packages;
|
2022-06-12 11:33:30 +00:00
|
|
|
|
let
|
|
|
|
|
requiredPackages = [
|
|
|
|
|
ksystemstats
|
|
|
|
|
kinfocenter
|
|
|
|
|
kmenuedit
|
|
|
|
|
plasma-systemmonitor
|
|
|
|
|
spectacle
|
|
|
|
|
systemsettings
|
|
|
|
|
|
|
|
|
|
dolphin
|
|
|
|
|
dolphin-plugins
|
|
|
|
|
ffmpegthumbs
|
|
|
|
|
kdegraphics-thumbnailers
|
2023-03-28 13:30:32 +00:00
|
|
|
|
kde-inotify-survey
|
|
|
|
|
kio-admin
|
2022-06-12 11:33:30 +00:00
|
|
|
|
kio-extras
|
|
|
|
|
];
|
|
|
|
|
optionalPackages = [
|
2023-03-11 12:37:53 +00:00
|
|
|
|
ark
|
2022-06-12 11:33:30 +00:00
|
|
|
|
elisa
|
|
|
|
|
gwenview
|
|
|
|
|
okular
|
|
|
|
|
khelpcenter
|
|
|
|
|
print-manager
|
|
|
|
|
];
|
2023-03-15 21:53:18 +00:00
|
|
|
|
in requiredPackages ++ utils.removePackagesByName optionalPackages config.environment.plasma5.excludePackages;
|
2021-11-02 01:11:50 +00:00
|
|
|
|
|
|
|
|
|
systemd.user.services = {
|
|
|
|
|
plasma-run-with-systemd = {
|
|
|
|
|
description = "Run KDE Plasma via systemd";
|
|
|
|
|
wantedBy = [ "basic.target" ];
|
|
|
|
|
serviceConfig.Type = "oneshot";
|
|
|
|
|
script = ''
|
|
|
|
|
${set_XDG_CONFIG_HOME}
|
|
|
|
|
|
2022-12-25 20:02:41 +00:00
|
|
|
|
${pkgs.plasma5Packages.kconfig}/bin/kwriteconfig5 \
|
2021-11-02 01:11:50 +00:00
|
|
|
|
--file startkderc --group General --key systemdBoot ${lib.boolToString cfg.runUsingSystemd}
|
|
|
|
|
'';
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
# Plasma Mobile
|
2021-03-10 20:26:11 +00:00
|
|
|
|
(mkIf cfg.mobile.enable {
|
|
|
|
|
assertions = [
|
|
|
|
|
{
|
|
|
|
|
# The user interface breaks without NetworkManager
|
|
|
|
|
assertion = config.networking.networkmanager.enable;
|
|
|
|
|
message = "Plasma Mobile requires NetworkManager.";
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
# The user interface breaks without bluetooth
|
|
|
|
|
assertion = config.hardware.bluetooth.enable;
|
|
|
|
|
message = "Plasma Mobile requires Bluetooth.";
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
# The user interface breaks without pulse
|
2022-12-26 16:54:12 +00:00
|
|
|
|
assertion = config.hardware.pulseaudio.enable || (config.services.pipewire.enable && config.services.pipewire.pulse.enable);
|
2021-03-10 20:26:11 +00:00
|
|
|
|
message = "Plasma Mobile requires pulseaudio.";
|
|
|
|
|
}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
environment.systemPackages =
|
2022-12-25 20:02:41 +00:00
|
|
|
|
with pkgs.plasma5Packages;
|
2021-03-10 20:26:11 +00:00
|
|
|
|
[
|
2021-03-16 19:25:41 +00:00
|
|
|
|
# Basic packages without which Plasma Mobile fails to work properly.
|
2022-03-16 04:24:32 +00:00
|
|
|
|
plasma-mobile
|
2021-03-10 20:26:11 +00:00
|
|
|
|
plasma-nano
|
2021-07-14 19:52:06 +00:00
|
|
|
|
pkgs.maliit-framework
|
|
|
|
|
pkgs.maliit-keyboard
|
2021-03-16 19:25:41 +00:00
|
|
|
|
]
|
2024-01-26 22:52:49 +00:00
|
|
|
|
++ lib.optionals (cfg.mobile.installRecommendedSoftware) (with pkgs.plasma5Packages.plasmaMobileGear; [
|
2021-03-16 19:25:41 +00:00
|
|
|
|
# Additional software made for Plasma Mobile.
|
2021-03-24 20:37:21 +00:00
|
|
|
|
alligator
|
|
|
|
|
angelfish
|
|
|
|
|
audiotube
|
|
|
|
|
calindori
|
|
|
|
|
kalk
|
|
|
|
|
kasts
|
|
|
|
|
kclock
|
|
|
|
|
keysmith
|
|
|
|
|
koko
|
|
|
|
|
krecorder
|
|
|
|
|
ktrip
|
|
|
|
|
kweather
|
|
|
|
|
plasma-dialer
|
|
|
|
|
plasma-phonebook
|
|
|
|
|
plasma-settings
|
|
|
|
|
spacebar
|
|
|
|
|
])
|
2021-03-16 19:25:41 +00:00
|
|
|
|
;
|
2021-03-10 20:26:11 +00:00
|
|
|
|
|
|
|
|
|
# The following services are needed or the UI is broken.
|
|
|
|
|
hardware.bluetooth.enable = true;
|
|
|
|
|
hardware.pulseaudio.enable = true;
|
|
|
|
|
networking.networkmanager.enable = true;
|
2022-11-24 02:06:31 +00:00
|
|
|
|
# Required for autorotate
|
|
|
|
|
hardware.sensor.iio.enable = lib.mkDefault true;
|
2021-03-10 20:26:11 +00:00
|
|
|
|
|
|
|
|
|
# Recommendations can be found here:
|
|
|
|
|
# - https://invent.kde.org/plasma-mobile/plasma-phone-settings/-/tree/master/etc/xdg
|
|
|
|
|
# This configuration is the minimum required for Plasma Mobile to *work*.
|
|
|
|
|
services.xserver.desktopManager.plasma5 = {
|
|
|
|
|
kdeglobals = {
|
|
|
|
|
KDE = {
|
|
|
|
|
# This forces a numeric PIN for the lockscreen, which is the
|
|
|
|
|
# recommendation from upstream.
|
|
|
|
|
LookAndFeelPackage = lib.mkDefault "org.kde.plasma.phone";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
kwinrc = {
|
2022-11-18 09:34:14 +00:00
|
|
|
|
"Wayland" = {
|
|
|
|
|
"InputMethod[$e]" = "/run/current-system/sw/share/applications/com.github.maliit.keyboard.desktop";
|
|
|
|
|
"VirtualKeyboardEnabled" = "true";
|
2021-03-10 20:26:11 +00:00
|
|
|
|
};
|
|
|
|
|
"org.kde.kdecoration2" = {
|
|
|
|
|
# No decorations (title bar)
|
|
|
|
|
NoPlugin = lib.mkDefault "true";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
};
|
2021-03-16 19:25:41 +00:00
|
|
|
|
|
2022-12-25 20:02:41 +00:00
|
|
|
|
services.xserver.displayManager.sessionPackages = [ pkgs.plasma5Packages.plasma-mobile ];
|
2021-03-10 20:26:11 +00:00
|
|
|
|
})
|
2022-09-17 13:02:37 +00:00
|
|
|
|
|
|
|
|
|
# Plasma Bigscreen
|
|
|
|
|
(mkIf cfg.bigscreen.enable {
|
|
|
|
|
environment.systemPackages =
|
|
|
|
|
with pkgs.plasma5Packages;
|
|
|
|
|
[
|
|
|
|
|
plasma-nano
|
|
|
|
|
plasma-settings
|
|
|
|
|
plasma-bigscreen
|
|
|
|
|
plasma-remotecontrollers
|
|
|
|
|
|
|
|
|
|
aura-browser
|
|
|
|
|
plank-player
|
|
|
|
|
|
|
|
|
|
plasma-pa
|
|
|
|
|
plasma-nm
|
|
|
|
|
kdeconnect-kde
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
services.xserver.displayManager.sessionPackages = [ pkgs.plasma5Packages.plasma-bigscreen ];
|
2022-10-12 17:28:53 +00:00
|
|
|
|
|
|
|
|
|
# required for plasma-remotecontrollers to work correctly
|
|
|
|
|
hardware.uinput.enable = true;
|
2022-09-17 13:02:37 +00:00
|
|
|
|
})
|
2016-12-28 13:53:19 +00:00
|
|
|
|
];
|
2015-01-19 17:39:23 +00:00
|
|
|
|
}
|