various
This commit is contained in:
parent
0f6a49366e
commit
024ea1168a
23 changed files with 485 additions and 101 deletions
33
modules/user-types.nix
Normal file
33
modules/user-types.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
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);
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue