users and passwords
This commit is contained in:
45
modules/base/users/default.nix
Normal file
45
modules/base/users/default.nix
Normal file
@@ -0,0 +1,45 @@
|
||||
{
|
||||
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"];
|
||||
uid = 1000;
|
||||
openssh.authorizedKeys.keys = [myData.ssh_pubkeys.motiejus];
|
||||
}
|
||||
// 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;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user