2015-01-19 17:39:23 +00:00
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2018-07-20 19:36:12 +00:00
|
|
|
|
inherit (pkgs) kdeApplications plasma5 libsForQt5 qt5;
|
2020-02-08 15:25:14 +00:00
|
|
|
|
inherit (pkgs) writeText;
|
|
|
|
|
|
|
|
|
|
pulseaudio = config.hardware.pulseaudio;
|
|
|
|
|
pactl = "${getBin pulseaudio.package}/bin/pactl";
|
|
|
|
|
startplasma-x11 = "${getBin plasma5.plasma-workspace}/bin/startplasma-x11";
|
|
|
|
|
sed = "${getBin pkgs.gnused}/bin/sed";
|
|
|
|
|
|
|
|
|
|
gtkrc2 = writeText "gtkrc-2.0" ''
|
|
|
|
|
# Default GTK+ 2 config for NixOS Plasma 5
|
|
|
|
|
include "/run/current-system/sw/share/themes/Breeze/gtk-2.0/gtkrc"
|
|
|
|
|
style "user-font"
|
|
|
|
|
{
|
|
|
|
|
font_name="Sans Serif Regular"
|
|
|
|
|
}
|
|
|
|
|
widget_class "*" style "user-font"
|
|
|
|
|
gtk-font-name="Sans Serif Regular 10"
|
|
|
|
|
gtk-theme-name="Breeze"
|
|
|
|
|
gtk-icon-theme-name="breeze"
|
|
|
|
|
gtk-fallback-icon-theme="hicolor"
|
|
|
|
|
gtk-cursor-theme-name="breeze_cursors"
|
|
|
|
|
gtk-toolbar-style=GTK_TOOLBAR_ICONS
|
|
|
|
|
gtk-menu-images=1
|
|
|
|
|
gtk-button-images=1
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
gtk3_settings = writeText "settings.ini" ''
|
|
|
|
|
[Settings]
|
|
|
|
|
gtk-font-name=Sans Serif Regular 10
|
|
|
|
|
gtk-theme-name=Breeze
|
|
|
|
|
gtk-icon-theme-name=breeze
|
|
|
|
|
gtk-fallback-icon-theme=hicolor
|
|
|
|
|
gtk-cursor-theme-name=breeze_cursors
|
|
|
|
|
gtk-toolbar-style=GTK_TOOLBAR_ICONS
|
|
|
|
|
gtk-menu-images=1
|
|
|
|
|
gtk-button-images=1
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
kcminputrc = writeText "kcminputrc" ''
|
|
|
|
|
[Mouse]
|
|
|
|
|
cursorTheme=breeze_cursors
|
|
|
|
|
cursorSize=0
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
${sed} -i "$trolltech_conf" -e '/nix\\store\|nix\/store/ d'
|
|
|
|
|
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*
|
|
|
|
|
|
|
|
|
|
${pkgs.libsForQt5.kservice}/bin/kbuildsycoca5
|
|
|
|
|
'';
|
|
|
|
|
|
2020-02-27 15:48:36 +00:00
|
|
|
|
set_XDG_CONFIG_HOME = ''
|
|
|
|
|
# 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-08 15:25:14 +00:00
|
|
|
|
startplasma =
|
|
|
|
|
''
|
2020-02-27 15:48:36 +00:00
|
|
|
|
${set_XDG_CONFIG_HOME}
|
|
|
|
|
mkdir -p "''${XDG_CONFIG_HOME}"
|
2020-02-08 15:25:14 +00:00
|
|
|
|
|
|
|
|
|
''
|
|
|
|
|
+ optionalString pulseaudio.enable ''
|
|
|
|
|
# Load PulseAudio module for routing support.
|
|
|
|
|
# See also: http://colin.guthr.ie/2009/10/so-how-does-the-kde-pulseaudio-support-work-anyway/
|
|
|
|
|
${pactl} load-module module-device-manager "do_routing=1"
|
|
|
|
|
|
|
|
|
|
''
|
|
|
|
|
+ ''
|
|
|
|
|
${activationScript}
|
|
|
|
|
|
|
|
|
|
# Create default configurations if Plasma has never been started.
|
2020-02-27 15:48:36 +00:00
|
|
|
|
kdeglobals="''${XDG_CONFIG_HOME}/kdeglobals"
|
2020-02-08 15:25:14 +00:00
|
|
|
|
if ! [ -f "$kdeglobals" ]
|
|
|
|
|
then
|
2020-02-27 15:48:36 +00:00
|
|
|
|
kcminputrc="''${XDG_CONFIG_HOME}/kcminputrc"
|
2020-02-08 15:25:14 +00:00
|
|
|
|
if ! [ -f "$kcminputrc" ]
|
|
|
|
|
then
|
|
|
|
|
cat ${kcminputrc} >"$kcminputrc"
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
gtkrc2="$HOME/.gtkrc-2.0"
|
|
|
|
|
if ! [ -f "$gtkrc2" ]
|
|
|
|
|
then
|
|
|
|
|
cat ${gtkrc2} >"$gtkrc2"
|
|
|
|
|
fi
|
|
|
|
|
|
2020-02-27 15:48:36 +00:00
|
|
|
|
gtk3_settings="''${XDG_CONFIG_HOME}/gtk-3.0/settings.ini"
|
2020-02-08 15:25:14 +00:00
|
|
|
|
if ! [ -f "$gtk3_settings" ]
|
|
|
|
|
then
|
|
|
|
|
mkdir -p "$(dirname "$gtk3_settings")"
|
|
|
|
|
cat ${gtk3_settings} >"$gtk3_settings"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
''
|
|
|
|
|
+ ''
|
|
|
|
|
exec "${startplasma-x11}"
|
|
|
|
|
'';
|
2015-01-19 17:39:23 +00:00
|
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
options = {
|
|
|
|
|
|
2017-02-25 20:43:13 +00:00
|
|
|
|
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.";
|
|
|
|
|
};
|
|
|
|
|
|
2019-07-20 19:26:01 +00:00
|
|
|
|
phononBackend = mkOption {
|
|
|
|
|
type = types.enum [ "gstreamer" "vlc" ];
|
|
|
|
|
default = "gstreamer";
|
|
|
|
|
example = "vlc";
|
|
|
|
|
description = "Phonon audio backend to install.";
|
|
|
|
|
};
|
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.")
|
2019-12-10 01:51:19 +00:00
|
|
|
|
(mkRenamedOptionModule [ "services" "xserver" "desktopManager" "kde5" ] [ "services" "xserver" "desktopManager" "plasma5" ])
|
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 [
|
2019-05-13 04:12:00 +00:00
|
|
|
|
(mkIf cfg.enable {
|
2016-12-28 13:53:19 +00:00
|
|
|
|
services.xserver.desktopManager.session = singleton {
|
2017-02-25 20:43:13 +00:00
|
|
|
|
name = "plasma5";
|
2016-12-28 13:53:19 +00:00
|
|
|
|
bgSupport = true;
|
2020-02-08 15:25:14 +00:00
|
|
|
|
start = startplasma;
|
2016-12-28 13:53:19 +00:00
|
|
|
|
};
|
2015-01-19 17:39:23 +00:00
|
|
|
|
|
2017-01-29 07:58:12 +00:00
|
|
|
|
security.wrappers = {
|
2019-07-05 15:41:41 +00:00
|
|
|
|
kcheckpass.source = "${lib.getBin plasma5.kscreenlocker}/libexec/kcheckpass";
|
2019-08-13 21:52:01 +00:00
|
|
|
|
start_kdeinit.source = "${lib.getBin pkgs.kinit}/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
|
|
|
|
|
2017-02-26 12:49:15 +00:00
|
|
|
|
environment.systemPackages = with pkgs; with qt5; with libsForQt5; with plasma5; with kdeApplications;
|
2016-12-28 13:53:19 +00:00
|
|
|
|
[
|
2017-02-25 18:25:44 +00:00
|
|
|
|
frameworkintegration
|
|
|
|
|
kactivities
|
|
|
|
|
kauth
|
|
|
|
|
kcmutils
|
|
|
|
|
kconfig
|
|
|
|
|
kconfigwidgets
|
|
|
|
|
kcoreaddons
|
2018-09-23 05:06:34 +00:00
|
|
|
|
kdoctools
|
2017-02-25 18:25:44 +00: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
|
2020-02-01 12:59:13 +00:00
|
|
|
|
plasma-browser-integration
|
2017-02-25 18:25:44 +00:00
|
|
|
|
plasma-integration
|
|
|
|
|
polkit-kde-agent
|
|
|
|
|
systemsettings
|
|
|
|
|
|
|
|
|
|
plasma-desktop
|
|
|
|
|
plasma-workspace
|
|
|
|
|
plasma-workspace-wallpapers
|
|
|
|
|
|
2017-05-16 15:56:41 +00:00
|
|
|
|
dolphin
|
2017-02-25 18:25:44 +00:00
|
|
|
|
dolphin-plugins
|
|
|
|
|
ffmpegthumbs
|
|
|
|
|
kdegraphics-thumbnailers
|
2017-05-16 15:56:41 +00:00
|
|
|
|
khelpcenter
|
2017-02-25 18:25:44 +00:00
|
|
|
|
kio-extras
|
2017-05-16 15:56:41 +00:00
|
|
|
|
konsole
|
|
|
|
|
oxygen
|
2017-02-25 18:25:44 +00:00
|
|
|
|
print-manager
|
|
|
|
|
|
|
|
|
|
breeze-icons
|
2018-02-25 02:23:58 +00:00
|
|
|
|
pkgs.hicolor-icon-theme
|
2016-12-28 13:53:19 +00:00
|
|
|
|
|
2017-02-25 18:25:44 +00:00
|
|
|
|
kde-gtk-config breeze-gtk
|
2016-12-28 13:53:19 +00:00
|
|
|
|
|
2017-12-27 21:47:45 +00:00
|
|
|
|
qtvirtualkeyboard
|
|
|
|
|
|
2019-03-01 00:12:28 +00:00
|
|
|
|
xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/
|
2016-12-28 13:53:19 +00:00
|
|
|
|
]
|
2019-07-27 02:36:32 +00:00
|
|
|
|
|
2019-07-20 19:26:01 +00:00
|
|
|
|
# Phonon audio backend
|
|
|
|
|
++ lib.optional (cfg.phononBackend == "gstreamer") libsForQt5.phonon-backend-gstreamer
|
|
|
|
|
++ lib.optional (cfg.phononBackend == "vlc") libsForQt5.phonon-backend-vlc
|
2016-12-28 13:53:19 +00:00
|
|
|
|
|
|
|
|
|
# Optional hardware support features
|
2019-12-01 21:52:58 +00:00
|
|
|
|
++ lib.optionals config.hardware.bluetooth.enable [ bluedevil bluez-qt openobex 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
|
|
|
|
|
++ lib.optional config.powerManagement.enable powerdevil
|
|
|
|
|
++ lib.optional config.services.colord.enable colord-kde
|
2019-09-15 10:47:14 +00:00
|
|
|
|
++ lib.optionals config.services.samba.enable [ kdenetwork-filesharing pkgs.samba ]
|
|
|
|
|
++ lib.optional config.services.xserver.wacom.enable wacomtablet;
|
2016-12-28 13:53:19 +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
|
|
|
|
|
2019-09-14 17:51:29 +00:00
|
|
|
|
environment.etc."X11/xkb".source = xcfg.xkbDir;
|
2015-01-19 17:39:23 +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
|
|
|
|
|
|
|
|
|
fonts.fonts = with pkgs; [ noto-fonts hack-font ];
|
2017-03-04 20:50:15 +00:00
|
|
|
|
fonts.fontconfig.defaultFonts = {
|
|
|
|
|
monospace = [ "Hack" "Noto Mono" ];
|
|
|
|
|
sansSerif = [ "Noto Sans" ];
|
|
|
|
|
serif = [ "Noto Serif" ];
|
|
|
|
|
};
|
2016-12-28 13:53:19 +00:00
|
|
|
|
|
2017-10-21 22:03:34 +00:00
|
|
|
|
programs.ssh.askPassword = mkDefault "${plasma5.ksshaskpass.out}/bin/ksshaskpass";
|
2016-12-28 13:53:19 +00:00
|
|
|
|
|
|
|
|
|
# Enable helpful DBus services.
|
|
|
|
|
services.udisks2.enable = true;
|
|
|
|
|
services.upower.enable = config.powerManagement.enable;
|
2019-09-06 13:47:24 +00:00
|
|
|
|
services.system-config-printer.enable = (mkIf config.services.printing.enable (mkDefault true));
|
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 = [
|
|
|
|
|
pkgs.libmtp
|
|
|
|
|
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; };
|
|
|
|
|
|
2017-02-15 00:38:52 +00: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;
|
|
|
|
|
|
2019-07-27 02:36:32 +00:00
|
|
|
|
xdg.portal.enable = true;
|
2019-07-10 14:01:25 +00:00
|
|
|
|
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-kde ];
|
|
|
|
|
|
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;
|
2016-12-28 13:53:19 +00:00
|
|
|
|
})
|
|
|
|
|
];
|
2015-01-19 17:39:23 +00:00
|
|
|
|
|
|
|
|
|
}
|