common: profiles: migrate wm

This commit is contained in:
Bruno BELANYI 2024-01-03 17:05:37 +00:00
parent 53594d2fb4
commit 334a3346b8
4 changed files with 37 additions and 30 deletions

View file

@ -6,5 +6,6 @@
./devices
./gtk
./laptop
./wm
];
}

View file

@ -0,0 +1,36 @@
{ config, lib, type, ... }:
let
cfg = config.my.profiles.wm;
applyWm = wm: configs: lib.mkIf (cfg.windowManager == wm) (lib.my.merge configs);
in
{
options.my.profiles.wm = with lib; {
windowManager = mkOption {
type = with types; nullOr (enum [ "i3" ]);
default = null;
example = "i3";
description = "Which window manager to use";
};
};
config = lib.mkMerge [
(applyWm "i3" [
(lib.optionalAttrs (type == "home") {
# i3 settings
my.home.wm.windowManager = "i3";
# Screenshot tool
my.home.flameshot.enable = true;
# Auto disk mounter
my.home.udiskie.enable = true;
})
(lib.optionalAttrs (type == "nixos") {
# Enable i3
services.xserver.windowManager.i3.enable = true;
# udiskie fails if it can't find this dbus service
services.udisks2.enable = true;
})
])
];
}

View file

@ -2,7 +2,6 @@
{ ... }:
{
imports = [
./wm
./x
];
}

View file

@ -1,29 +0,0 @@
{ config, lib, ... }:
let
cfg = config.my.profiles.wm;
in
{
options.my.profiles.wm = with lib; {
windowManager = mkOption {
type = with types; nullOr (enum [ "i3" ]);
default = null;
example = "i3";
description = "Which window manager to use";
};
};
config = lib.mkMerge [
(lib.mkIf (cfg.windowManager == "i3") {
# Enable i3
services.xserver.windowManager.i3.enable = true;
# i3 settings
my.home.wm.windowManager = "i3";
# Screenshot tool
my.home.flameshot.enable = true;
# Auto disk mounter
my.home.udiskie.enable = true;
# udiskie fails if it can't find this dbus service
services.udisks2.enable = true;
})
];
}