2022-05-06 03:01:56 +00:00
|
|
|
|
{ config, lib, ... }: {
|
2022-04-29 01:56:21 +00:00
|
|
|
|
|
2022-05-06 03:01:56 +00:00
|
|
|
|
options = {
|
2022-04-29 01:56:21 +00:00
|
|
|
|
|
2022-05-06 03:01:56 +00:00
|
|
|
|
user = lib.mkOption {
|
|
|
|
|
type = lib.types.str;
|
|
|
|
|
description = "Primary user of the system";
|
|
|
|
|
default = "nixos";
|
|
|
|
|
};
|
2022-04-29 01:56:21 +00:00
|
|
|
|
|
2022-05-06 03:01:56 +00:00
|
|
|
|
passwordHash = lib.mkOption {
|
|
|
|
|
type = lib.types.str;
|
|
|
|
|
description = "Password created with mkpasswd -m sha-512";
|
|
|
|
|
};
|
2022-04-29 01:56:21 +00:00
|
|
|
|
|
2022-05-06 03:01:56 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
config = {
|
|
|
|
|
|
|
|
|
|
# Define a user account. Don't forget to set a password with ‘passwd’.
|
|
|
|
|
users.users.${config.user} = {
|
|
|
|
|
|
|
|
|
|
# Create a home directory for human user
|
|
|
|
|
isNormalUser = true;
|
|
|
|
|
|
|
|
|
|
# Automatically create a password to start
|
|
|
|
|
hashedPassword = config.passwordHash;
|
|
|
|
|
|
|
|
|
|
extraGroups = [
|
|
|
|
|
"wheel" # Sudo privileges
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
};
|
2022-04-29 01:56:21 +00:00
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|