better split also for desktop envs

This commit is contained in:
Vinzenz Schroeter 2023-09-24 13:20:34 +02:00
parent 44bbfc2fa0
commit adb51fd36e
6 changed files with 117 additions and 100 deletions

View file

@ -5,11 +5,11 @@ modulesCfg: {lib, ...}: {
./nixpkgs.nix
./globalinstalls.nix
./server.nix
./desktop
]
++ (map (path: (import path modulesCfg)) [
./hardware
./users
./desktop
]);
config = {

View file

@ -1,15 +1,21 @@
{
modulesCfg: {
config,
pkgs,
lib,
...
}: let
isEnabled = config.my.desktop.enable;
isHomeManager = modulesCfg.enableHomeManager;
in {
imports = [
imports =
[
./gnome.nix
./kde.nix
./gaming.nix
]
++ lib.optionals isHomeManager [
./gnome-home.nix
./kde-home.nix
];
options.my.desktop.enable = lib.mkEnableOption "desktop";

View file

@ -0,0 +1,23 @@
{
lib,
config,
pkgs,
...
}: let
isEnabled = config.my.desktop.enableGnome;
in {
config = lib.mkIf isEnabled {
home-manager.sharedModules = [
{
home.packages = with pkgs; [
amberol
];
dconf.settings = {
"org/gnome/desktop/peripherals/keyboard" = {
numlock-state = true;
};
};
}
];
};
}

View file

@ -5,12 +5,10 @@
...
}: let
isEnabled = config.my.desktop.enableGnome;
enableHomeManager = config.my.modulesCfg.enableHomeManager;
in {
options.my.desktop.enableGnome = lib.mkEnableOption "gnome desktop";
config = lib.mkMerge [
(lib.mkIf isEnabled {
config = lib.mkIf isEnabled {
my.desktop.enable = true;
services = {
@ -47,20 +45,5 @@ in {
pkgs.gnome-connections
];
};
})
(lib.mkIf (isEnabled && enableHomeManager) {
home-manager.sharedModules = [
{
home.packages = with pkgs; [
amberol
];
dconf.settings = {
"org/gnome/desktop/peripherals/keyboard" = {
numlock-state = true;
};
};
}
];
})
];
}

View file

@ -0,0 +1,18 @@
{
lib,
config,
...
}: let
isEnabled = config.my.desktop.enableKde;
in {
config = lib.mkIf isEnabled {
home-manager.sharedModules = [
{
services.kdeconnect = {
enable = true;
indicator = true;
};
}
];
};
}

View file

@ -5,12 +5,10 @@
...
}: let
isEnabled = config.my.desktop.enableKde;
enableHomeManager = config.my.modulesCfg.enableHomeManager;
in {
options.my.desktop.enableKde = lib.mkEnableOption "KDE desktop";
config = lib.mkMerge [
(lib.mkIf isEnabled {
config = lib.mkIf isEnabled {
my.desktop.enable = true;
# flatpak xdg-portal-kde crashes, otherwise this would be global
@ -46,16 +44,5 @@ in {
dconf.enable = true;
partition-manager.enable = true;
};
})
(lib.mkIf (isEnabled && enableHomeManager) {
home-manager.sharedModules = [
{
services.kdeconnect = {
enable = true;
indicator = true;
};
}
];
})
];
}