Extract "surface-control" management into new option-enabled module

This commit is contained in:
mexisme committed 2023-01-10 17:29:15 +13:00
1 parent b8f4e97171
commit 5b27563b02
3 files changed
+27 -8

No files matched your search

@@ -0,0 +1,25 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) mkDefault mkEnableOption mkIf mkMerge;
cfg = config.microsoft-surface.surface-control;
in {
options.microsoft-surface.surface-control = {
enable = mkEnableOption "Enable 'surface-control' for Microsoft Surface";
};
config = mkMerge [
{
microsoft-surface.surface-control.enable = mkDefault false;
}
(mkIf cfg.enable {
environment.systemPackages = with pkgs; [ surface-control ];
services.udev.packages = with pkgs; [ surface-control];
users.groups.surface-control = { };
})
];
}