Skip to content

Commit

Permalink
nixos/plasma5: Split common Plasma config for Mobile from Desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
samueldr committed Dec 4, 2021
1 parent 7f4324c commit 2f12f30
Showing 1 changed file with 62 additions and 45 deletions.
107 changes: 62 additions & 45 deletions nixos/modules/services/x11/desktop-managers/plasma5.nix
Original file line number Diff line number Diff line change
Expand Up @@ -230,22 +230,8 @@ in
];

config = mkMerge [
(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;
''
];

services.xserver.displayManager.sessionPackages = [ pkgs.libsForQt5.plasma5.plasma-workspace ];
# 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";
# Common Plasma dependencies
(mkIf (cfg.enable || cfg.mobile.enable) {

security.wrappers = {
kcheckpass = {
Expand Down Expand Up @@ -331,37 +317,24 @@ in
kdeplasma-addons
kgamma5
khotkeys
kinfocenter
kmenuedit
kscreen
kscreenlocker
ksystemstats
kwayland
kwin
kwrited
libkscreen
libksysguard
milou
plasma-systemmonitor
plasma-browser-integration
plasma-integration
polkit-kde-agent
spectacle
systemsettings

plasma-desktop
plasma-workspace
plasma-workspace-wallpapers

dolphin
dolphin-plugins
ffmpegthumbs
kdegraphics-thumbnailers
khelpcenter
kio-extras
konsole
oxygen
print-manager

breeze-icons
pkgs.hicolor-icon-theme
Expand All @@ -372,10 +345,6 @@ in
qtvirtualkeyboard

pkgs.xdg-user-dirs # Update user dirs as described in https://freedesktop.org/wiki/Software/xdg-user-dirs/

elisa
gwenview
okular
]

# Phonon audio backend
Expand Down Expand Up @@ -449,18 +418,6 @@ in
serviceConfig.Type = "oneshot";
script = activationScript;
};

plasma-run-with-systemd = {
description = "Run KDE Plasma via systemd";
wantedBy = [ "basic.target" ];
serviceConfig.Type = "oneshot";
script = ''
${set_XDG_CONFIG_HOME}
${kdeFrameworks.kconfig}/bin/kwriteconfig5 \
--file startkderc --group General --key systemdBoot ${lib.boolToString cfg.runUsingSystemd}
'';
};
};

xdg.portal.enable = true;
Expand All @@ -477,6 +434,66 @@ in
"xdg/kdeglobals".text = lib.generators.toINI {} cfg.kdeglobals;
};
})

# 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;
''
];

services.xserver.displayManager.sessionPackages = [ pkgs.libsForQt5.plasma5.plasma-workspace ];
# 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 =
with libsForQt5;
with plasma5; with kdeGear; with kdeFrameworks;
[
ksystemstats
kinfocenter
kmenuedit
plasma-systemmonitor
spectacle
systemsettings

dolphin
dolphin-plugins
ffmpegthumbs
kdegraphics-thumbnailers
khelpcenter
kio-extras
print-manager

elisa
gwenview
okular
]
;

systemd.user.services = {
plasma-run-with-systemd = {
description = "Run KDE Plasma via systemd";
wantedBy = [ "basic.target" ];
serviceConfig.Type = "oneshot";
script = ''
${set_XDG_CONFIG_HOME}
${kdeFrameworks.kconfig}/bin/kwriteconfig5 \
--file startkderc --group General --key systemdBoot ${lib.boolToString cfg.runUsingSystemd}
'';
};
};
})

# Plasma Mobile
(mkIf cfg.mobile.enable {
assertions = [
{
Expand Down

0 comments on commit 2f12f30

Please sign in to comment.