config/modules/base/users/default.nix

46 lines
1.0 KiB
Nix
Raw Normal View History

2023-07-20 15:02:38 +03:00
{
config,
lib,
myData,
...
}: {
options.mj.base.users = with lib.types; {
passwd = lib.mkOption {
type = attrsOf (submodule (
{...}: {
options = {
passwordFile = lib.mkOption {
type = nullOr path;
default = null;
};
initialPassword = lib.mkOption {
type = nullOr str;
default = null;
};
};
}
));
};
};
config = {
users = {
mutableUsers = false;
users = with config.mj.base.users; {
motiejus =
{
isNormalUser = true;
extraGroups = ["wheel"];
2023-07-24 16:31:38 +03:00
uid = myData.uidgid.motiejus;
2023-07-23 15:23:09 +03:00
openssh.authorizedKeys.keys = [myData.people_pubkeys.motiejus];
2023-07-20 15:02:38 +03:00
}
// lib.filterAttrs (n: v: v != null) passwd.motiejus or {};
root = assert lib.assertMsg (passwd ? root) "root password needs to be defined";
lib.filterAttrs (n: v: v != null) passwd.root;
};
};
};
}