puter/modules/user-types.nix
2025-01-04 23:51:35 +01:00

34 lines
682 B
Nix

{
config,
lib,
...
}: {
options.users = let
inherit (lib) types;
in {
normalUsers = lib.mkOption {
type = types.listOf (types.passwdEntry types.str);
description = ''
List of normal users.
'';
};
systemUsers = lib.mkOption {
type = types.listOf (types.passwdEntry types.str);
description = ''
List of system users.
'';
};
};
config.users = let
filterUsers = pred: (lib.pipe config.users.users [
(lib.filterAttrs (_: pred))
builtins.attrNames
]);
in {
normalUsers = filterUsers (user: user.isNormalUser);
systemUsers = filterUsers (user: user.isSystemUser);
};
}