feat(nixos): add machine module with virtualisation and usb options

This commit is contained in:
Mohammad Rafiq 2025-07-07 19:04:17 +08:00
parent e097d3e688
commit 3bffa8760e
No known key found for this signature in database
5 changed files with 81 additions and 54 deletions

View file

@ -0,0 +1,37 @@
{ lib, ... }:
let
inherit (lib.options) mkEnableOption;
inherit (lib.modules) mkIf mkMerge;
in
{
flake.modules.nixos.default =
{ config, ... }:
let
cfg = config.machine;
in
{
options.machine.bluetooth.enable = mkEnableOption "";
options.machine.usb.automount = mkEnableOption "";
config = mkMerge [
(mkIf cfg.usb.automount {
services.udisks2.enable = true;
home-manager.sharedModules = [
{
services.udiskie = {
enable = true;
automount = true;
notify = true;
};
}
];
})
(mkIf cfg.bluetooth.enable {
persistDirs = [ "/var/lib/bluetooth" ];
hardware.bluetooth = {
enable = true;
settings.General.Experimental = true;
};
})
];
};
}