Files
nix-config/modules/nixos/base/user-group.nix
2025-07-17 23:07:33 +08:00

45 lines
1008 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;
};
}