Files
nix-config/modules/nixos/base/user-group.nix

46 lines
1015 B
Nix

{
myvars,
config,
...
}:
{
# Don't allow mutation of users outside the config.
users.mutableUsers = false;
users.groups = {
"${myvars.username}" = { };
podman = { };
wireshark = { };
# for android platform tools's udev rules
adbusers = { };
dialout = { };
# for openocd (embedded system development)
plugdev = { };
# misc
uinput = { };
};
users.users."${myvars.username}" = {
# we have to use initialHashedPassword here when using tmpfs for /
inherit (myvars) initialHashedPassword;
home = "/home/${myvars.username}";
isNormalUser = true;
extraGroups = [
myvars.username
"users"
"networkmanager"
"wheel"
"podman"
"wireshark"
"adbusers"
"libvirtd"
];
};
# root's ssh key are mainly used for remote deployment
users.users.root = {
inherit (myvars) initialHashedPassword;
openssh.authorizedKeys.keys = myvars.mainSshAuthorizedKeys ++ myvars.secondaryAuthorizedKeys;
};
}