chore: refactor system modules

This commit is contained in:
2025-07-05 00:02:39 +02:00
parent d054442c28
commit af1a606c1a
56 changed files with 549 additions and 475 deletions

View File

@@ -0,0 +1,3 @@
{
imports = [./hyprland.nix ./niri.nix ./xserver.nix];
}

View File

@@ -0,0 +1,14 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.system.desktop.hyprland;
in {
options.system.desktop.hyprland.enable = mkEnableOption "Enables Hyprland";
config.programs.hyprland = mkIf cfg.enable {
inherit (cfg) enable;
withUWSM = true;
};
}

13
system/desktop/niri.nix Normal file
View File

@@ -0,0 +1,13 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.system.desktop.niri;
in {
options.system.desktop.niri.enable = mkEnableOption "Enables Niri";
config.programs.niri = mkIf cfg.enable {
inherit (cfg) enable;
};
}

View File

@@ -0,0 +1,45 @@
{
config,
lib,
...
}:
with lib; let
cfg = config.system.desktop.xserver;
in {
options.system.desktop.xserver = {
enable = mkEnableOption "Enables xserver";
de = mkOption {
type = types.enum ["gnome" "kde"];
default = "gnome";
example = "kde";
description = "Which DE to enable";
};
};
config.services = mkIf cfg.enable {
displayManager = {
sddm.enable = mkIf (cfg.de == "kde") true;
gdm.enable = mkIf (cfg.de == "gnome") true;
};
desktopManager = {
plasma6.enable = mkIf (cfg.de == "kde") true;
gnome.enable = mkIf (cfg.de == "gnome") true;
};
gnome = mkIf (cfg.de == "gnome") {
gnome-browser-connector.enable = true;
games.enable = false;
gnome-remote-desktop.enable = true;
gnome-online-accounts.enable = true;
sushi.enable = true;
};
xserver = {
inherit (cfg) enable;
videoDrivers = lists.optional config.system.hardware.amdgpu.enable "amdgpu";
xkb = {
layout = "fr";
variant = "bepo_afnor";
};
};
};
}