Option: added active desktop option which allows kde to be primary desktop environment.

This commit is contained in:
Jurn Wubben 2025-07-09 19:48:10 +02:00
parent d233e18593
commit f622009e87
17 changed files with 82 additions and 60 deletions

View file

@ -21,8 +21,20 @@ in {
enable = mkEO "enable desktop related programs (+home manager).";
apps = mkEO "extra bloat.";
games = mkEO "gaming related programs";
hyprland = mkEO "enable hyprland related programs.";
kde = mkEO "enable kde specialisation.";
activeDesktop = lib.mkOption {
type = lib.types.enum ["hyprland" "kde"];
description = "What desktop should be the default, other enabled desktops will be specialized.";
default =
if cfg.hyprland
then "hyprland"
else if cfg.kde
then "kde"
else "hyprland";
example = "hyprland";
};
};
config.assertions = mkIf (cfg.hyprland

View file

@ -5,21 +5,9 @@
}: {
config = lib.mkIf config.niksos.desktop.enable {
# greetd display manager
services.greetd = let
session = {
command = lib.mkDefault "${lib.getExe config.programs.uwsm.package} start hyprland-uwsm.desktop";
user = "jsw";
};
in {
services.greetd = {
enable = true;
settings = {
terminal.vt = 1;
default_session = session;
initial_session = session;
};
settings.terminal.vt = 1;
};
programs.uwsm.enable = config.niksos.desktop.hyprland;
};
}

View file

@ -1,16 +1,37 @@
{
config,
pkgs,
lib,
pkgs,
config,
...
}: let
cfg = config.niksos.desktop.enable && config.niksos.desktop.hyprland;
inherit (config.niksos) desktop;
cfg = desktop.enable && desktop.hyprland;
active = cfg && desktop.activeDesktop == "hyprland";
ifActive = x: lib.mkIf active x;
in {
config = lib.mkIf cfg {
programs.hyprland = {
specialisation.hyprland.configuration =
lib.mkIf cfg
&& !active {
niksos.desktop.activeDesktop = lib.mkForce "hyprland";
};
programs = ifActive {
hyprland = {
enable = true;
withUWSM = true;
};
environment.sessionVariables.NIXOS_OZONE_WL = "1"; # Makes electron apps use wayland.
uwsm.enable = true;
};
services.greetd.settings = let
session = {
command = "${lib.getExe config.programs.uwsm.package} start hyprland-uwsm.desktop";
user = "jsw";
};
in
ifActive {
default_session = session;
initial_session = session;
};
environment.sessionVariables.NIXOS_OZONE_WL = ifActive "1"; # Makes electron apps use wayland.
}

View file

@ -4,25 +4,28 @@
config,
...
}: let
cfg = config.niksos.desktop.enable && config.niksos.desktop.kde;
inherit (config.niksos) desktop;
cfg = desktop.enable && desktop.kde;
active = cfg && desktop.activeDesktop == "kde";
ifActive = x: lib.mkIf active x;
in {
specialisation.de.configuration = lib.mkIf cfg {
niksos.desktop.hyprland = lib.mkForce false;
services = {
greetd = let
session.command = "${pkgs.kdePackages.plasma-workspace}/bin/startplasma-wayland";
in {
enable = true;
settings = {
terminal.vt = 1;
default_session = session;
initial_session = session;
};
};
desktopManager.plasma6.enable = true;
specialisation.kde.configuration =
lib.mkIf cfg
&& !active {
niksos.desktop.activeDesktop = lib.mkForce "kde";
};
home-manager.users.jsw.stylix.autoEnable = false;
services = ifActive {
greetd.settings = let
session.command = "${pkgs.kdePackages.plasma-workspace}/bin/startplasma-wayland";
in {
default_session = session;
initial_session = session;
};
desktopManager.plasma6.enable = true;
};
home-manager.users = ifActive {
jsw.stylix.autoEnable = false;
};
}

View file

@ -3,10 +3,8 @@
lib,
pkgs,
...
}: let
cfg = config.niksos.desktop.enable && config.niksos.desktop.hyprland;
in {
systemd.user.services.polkit-gnome-authentication-agent-1 = lib.mkIf cfg {
}: {
systemd.user.services.polkit-gnome-authentication-agent-1 = lib.mkIf config.programs.hyprland.enable {
description = "polkit-gnome-authentication-agent-1";
wantedBy = ["graphical-session.target"];
wants = ["graphical-session.target"];

View file

@ -3,10 +3,8 @@
config,
lib,
...
}: let
cfg = config.niksos.desktop.enable && config.niksos.desktop.hyprland;
in {
xdg.portal = lib.mkIf cfg {
}: {
xdg.portal = lib.mkIf config.programs.hyprland.enable {
enable = true;
xdgOpenUsePortal = true;
config = {