refactor(nixos): move usb config to its own module
This commit is contained in:
parent
a5d8bfcdd5
commit
59031cd01b
4 changed files with 51 additions and 24 deletions
|
@ -24,33 +24,10 @@ in
|
|||
};
|
||||
gpu = lib.pantheon.mkStrOption;
|
||||
platform = lib.pantheon.mkStrOption;
|
||||
usb = {
|
||||
automount = mkEnableOption "";
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkMerge [
|
||||
(mkIf cfg.usb.automount {
|
||||
services.udisks2.enable = true;
|
||||
home-manager.sharedModules = singleton {
|
||||
services.udiskie = {
|
||||
enable = true;
|
||||
automount = true;
|
||||
notify = true;
|
||||
};
|
||||
};
|
||||
})
|
||||
{
|
||||
hardware.keyboard.qmk.enable = true;
|
||||
services.udev = {
|
||||
packages = with pkgs; [
|
||||
vial
|
||||
via
|
||||
qmk
|
||||
qmk-udev-rules
|
||||
qmk_hid
|
||||
];
|
||||
};
|
||||
services.fwupd.enable = true;
|
||||
persistDirs = singleton "/var/lib/bluetooth";
|
||||
hardware.bluetooth = {
|
||||
|
|
46
modules/nixos/hardware/usb/default.nix
Normal file
46
modules/nixos/hardware/usb/default.nix
Normal 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
|
||||
];
|
||||
};
|
||||
})
|
||||
];
|
||||
}
|
|
@ -10,4 +10,9 @@
|
|||
terminal.ghostty.enable = true;
|
||||
window-manager.hyprland.enable = true;
|
||||
};
|
||||
|
||||
hardware.usb = {
|
||||
automount = true;
|
||||
enableQmk = true;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
};
|
||||
platform = "amd";
|
||||
gpu = "nvidia";
|
||||
usb.automount = true;
|
||||
};
|
||||
|
||||
desktop = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue