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

@ -1,6 +1,6 @@
{
{osConfig, ...}: {
services.udiskie = {
enable = true;
inherit (osConfig.services.udisks2) enable;
tray = "never"; #NOTE: Don't have a bar (yet?)
};
}

View file

@ -6,7 +6,6 @@
./other.nix
./repl
./starship.nix
./transfer.nix
./yazi.nix
./zoxide.nix
];

View file

@ -5,7 +5,7 @@
...
}: let
inherit (lib) mkIf;
cfg = osConfig.niksos.desktop.hyprland;
cfg = osConfig.programs.hyprland.enable;
in {
imports = [
./fuzzel.nix

View file

@ -5,7 +5,7 @@
...
}: {
programs.fuzzel = {
enable = osConfig.niksos.desktop.hyprland;
inherit (osConfig.programs.hyprland) enable;
settings.main = {
launch-prefix = "${lib.getExe pkgs.uwsm} app --";
};

View file

@ -15,7 +15,7 @@ in {
];
wayland.windowManager.hyprland = {
enable = osConfig.niksos.desktop.hyprland;
inherit (osConfig.programs.hyprland) enable;
settings = {
env = [
"QT_WAYLAND_DISABLE_WINDOWDECORATION,1"

View file

@ -6,7 +6,7 @@
inherit (config.lib.stylix.colors) base05;
in {
programs.hyprlock = {
enable = osConfig.niksos.desktop.hyprland;
inherit (osConfig.programs.hyprland) enable;
settings = {
general = {

View file

@ -1,6 +1,8 @@
{osConfig, ...}: {
{osConfig, ...}: let
inherit (osConfig.niksos) desktop;
in {
services.mako = {
enable = osConfig.niksos.desktop.hyprland;
inherit (osConfig.programs.hyprland) enable;
settings.defaultTimeout = 5000;
};
}

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 = {

View file

@ -5,20 +5,21 @@
...
}: let
inherit (config.niksos) hardware desktop;
inherit (lib) mkIf mkEnableOption;
inherit (lib) mkIf;
uwsm = lib.getExe pkgs.uwsm;
foot = lib.getExe pkgs.foot;
hypr = config.programs.hyprland.enable;
in {
config = mkIf hardware.fingerprint {
services = {
fprintd.enable = true;
logind.extraConfig = mkIf desktop.hyprland ''
logind.extraConfig = mkIf hypr ''
# dont shutdown when power button is short-pressed
HandlePowerKey=ignore
'';
};
home-manager.users.jsw.wayland.windowManager.hyprland.settings = mkIf desktop.hyprland {
home-manager.users.jsw.wayland.windowManager.hyprland.settings = mkIf hypr {
bind = [
", XF86PowerOff, exec, ${uwsm} app -- pgrep fprintd-verify && exit 0 || ${foot} -a 'foot-fprintd' sh -c 'fprintd-verify && systemctl sleep'"
];

View file

@ -4,7 +4,7 @@
lib,
...
}: let
inherit (lib) optionals mkEnableOption mkDefault;
inherit (lib) optionals mkDefault;
inherit (config.niksos.hardware) graphics;
inherit (graphics) enable nvidia intel;

View file

@ -3,7 +3,7 @@
lib,
...
}: {
config.services = lib.mkIf config.niksos.hardware.joycond {
services = lib.mkIf config.niksos.hardware.joycond {
usbmuxd.enable = true;
joycond.enable = true;
};

View file

@ -17,7 +17,7 @@ in {
power-profiles-daemon.enable = true;
};
environment.systemPackages = lib.mkIf niksos.desktop.hyprland [
environment.systemPackages = lib.mkIf config.programs.hyprland.enable [
(pkgs.writeScriptBin "powermode" ''
#!/usr/bin/env bash