1
0
Fork 0
puter/modules/user-types.nix

39 lines
731 B
Nix
Raw Normal View History

2024-12-30 22:52:20 +01:00
{
config,
lib,
...
2025-05-11 22:49:04 +02:00
}:
let
inherit (lib) types;
filterUsers =
predicate:
(lib.pipe config.users.users [
(lib.filterAttrs (_: predicate))
builtins.attrNames
]);
in
{
options.users = {
2024-12-30 22:52:20 +01:00
normalUsers = lib.mkOption {
type = types.listOf (types.passwdEntry types.str);
description = ''
List of normal users.
'';
2025-05-11 22:49:04 +02:00
readOnly = true;
2024-12-30 22:52:20 +01:00
};
systemUsers = lib.mkOption {
type = types.listOf (types.passwdEntry types.str);
description = ''
List of system users.
'';
2025-05-11 22:49:04 +02:00
readOnly = true;
2024-12-30 22:52:20 +01:00
};
};
2025-05-11 22:49:04 +02:00
config.users = {
2024-12-30 22:52:20 +01:00
normalUsers = filterUsers (user: user.isNormalUser);
systemUsers = filterUsers (user: user.isSystemUser);
};
}