nixos-config/modules/desktop/plasma.nix

177 lines
4.7 KiB
Nix

{ config, lib, pkgs, ... }:
let
cfg = config.ptw.programs.plasma;
in {
options.ptw.programs.plasma = {
enable = lib.mkEnableOption "Enable KDE Plasma";
mobile = {
enable = lib.mkEnableOption "Enable Plasma Mobile";
};
wayland = {
enable = lib.mkOption {
default = true;
description = "Ignore NixOS 'recommendations' and use the Wayland session by default";
};
};
sddm = {
backgroundImage = lib.mkOption {
default = "${pkgs.sddm-sugar-dark}/usr/share/sddm/themes/sugar-dark/Background.jpg";
description = "The background image to use with sddm-sugar-dark";
};
screenWidth = lib.mkOption {
default = 1920;
description = "Width of the screen";
};
screenHeight = lib.mkOption {
default = 1080;
description = "Width of the screen";
};
};
};
config = lib.mkIf cfg.enable {
security.pam.services = {
login.enableKwallet = true;
greetd.enableKwallet = true;
};
services.xserver = {
displayManager.sddm = let
sddm-sugar-dark-configured = pkgs.sddm-sugar-dark.override {
config = {
General = {
Background = "${cfg.sddm.backgroundImage}";
ScaleImageCropped = true;
ScreenWidth = builtins.toString cfg.sddm.screenWidth;
ScreenHeight = builtins.toString cfg.sddm.screenHeight;
MainColor = "navajowhite";
AccentColor = "white";
RoundCorners = 20;
ScreenPadding = 0;
Font = "Noto Sans";
FontSize = "";
Locale = "";
HourFormat = "HH:mm";
DataFormat = "dddd, d of MMMM";
ForceLastUser = true;
ForcePasswordFocus = true;
ForceHideCompletePassword = true;
ForceHideVirtualKeyboardButton = false;
HeaderText = "Welcome!";
};
};
};
in {
enable = true;
autoNumlock = true;
theme = "${sddm-sugar-dark-configured}/usr/share/sddm/themes/sugar-dark";
};
desktopManager.plasma5 = {
enable = true;
runUsingSystemd = true;
supportDDC = true;
mobile.enable = cfg.mobile.enable;
kdeglobals = lib.mkIf cfg.mobile.enable {
KDE = {
StartDragDist = "10";
LookAndFeelPackage = "org.kde.plasma.phone";
};
Icons = {
Theme = "breeze";
};
General = {
ColorScheme = "breeze";
Name = "breeze";
XftHintStyle = "none";
XftSubPixel = "none";
shadeSortColumn = "true";
};
};
kwinrc = lib.mkIf cfg.mobile.enable {
Plugins = {
"org.kde.phone.multitaskingEnabled" = "false";
"kwin4_effect_eyeonscreenEnabled" = "false";
"kwin4_effect_windowapertureEnabled" = "false";
blurEnabled = "false";
contrastEnabled = "false";
};
Windows = {
Placement = "Maximizing";
};
TabBox = {
TouchBorderActive = "9";
TouchBorderAlternativeActive = "9";
BorderActivate = "9";
};
"Effect-PresentWindows" = {
BorderActivateAll = "9";
};
"org.kde.kdecoration2" = {
NoPlugin = "true";
};
TouchEdges = {
Left = "None";
Right = "None";
};
Wayland = {
InputMethod = "${pkgs.maliit-keyboard}/usr/share/applications/com.github.maliit.keyboard.desktop";
};
};
};
# See https://github.com/NixOS/nixpkgs/commit/a506f9c79700255c215dddb53455d5e2bed6c1af
displayManager = {
defaultSession = lib.mkIf cfg.wayland.enable "plasmawayland";
#sessionPackages = lib.mkIf cfg.mobile.enable [ pkgs.libsForQt5.plasma5.plasma-mobile ];
};
};
xdg.portal = {
enable = true;
extraPortals = [ pkgs.xdg-desktop-portal-kde ];
};
environment.systemPackages = let
plasmaMobilePackages = with pkgs.libsForQt5; with plasma5; with kdeApplications; with kdeFrameworks; [
plasma-mobile
plasma-nano
pkgs.maliit-framework
pkgs.maliit-keyboard
];
kdePackages = with pkgs.libsForQt5; [
okular
kdeconnect-kde
breeze-gtk
bismuth
gwenview
yakuake
] ++ lib.optionals cfg.mobile.enable plasmaMobilePackages;
packages = with pkgs; [
index-fm
rsibreak
kalendar
kate
okular
# Some Gnome software
gnome.totem
];
in kdePackages ++ packages;
};
}