refactor(nixos): move usb config to its own module

This commit is contained in:
Mohammad Rafiq 2025-06-16 17:37:06 +08:00
parent a5d8bfcdd5
commit 59031cd01b
No known key found for this signature in database
4 changed files with 51 additions and 24 deletions

View file

@ -0,0 +1,46 @@
{
config,
pkgs,
lib,
...
}:
let
inherit (lib)
mkEnableOption
mkIf
mkMerge
singleton
;
cfg = config.hardware.usb;
in
{
options.hardware.usb = {
automount = mkEnableOption "";
enableQmk = mkEnableOption "";
};
config = mkMerge [
(mkIf cfg.automount {
services.udisks2.enable = true;
home-manager.sharedModules = singleton {
services.udiskie = {
enable = true;
automount = true;
notify = true;
};
};
})
(mkIf cfg.enableQmk {
hardware.keyboard.qmk.enable = true;
services.udev = {
packages = with pkgs; [
vial
via
qmk
qmk-udev-rules
qmk_hid
];
};
})
];
}