refactor: simplify 'user' options

This commit is contained in:
2026-04-21 13:59:03 +02:00
parent 38818e7508
commit 6a30a431f8
24 changed files with 94 additions and 139 deletions

View File

@@ -2,15 +2,13 @@
let
cfg = config.nfc;
inherit (config.host) username;
in
{
options.nfc = {
user = lib.mkOption {
type = lib.types.nullOr lib.types.str;
default = null;
};
enable = lib.mkEnableOption "NFC device access";
};
config = lib.mkIf (cfg.user != null) {
users.users.${cfg.user}.extraGroups = [ "dialout" ];
config = lib.mkIf cfg.enable {
users.users.${username}.extraGroups = [ "dialout" ];
};
}