re-init
This commit is contained in:
58
modules/nixos/user.nix
Normal file
58
modules/nixos/user.nix
Normal file
@@ -0,0 +1,58 @@
|
||||
{ pkgs, username, ... }:
|
||||
|
||||
{
|
||||
nix.settings.trusted-users = [ username ];
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
users = {
|
||||
users."${username}" = {
|
||||
# the hashed password with salt is generated by run `mkpasswd`.
|
||||
hashedPassword = "$y$j9T$inkrp6FuM46uoPFVrOlbz1$igJed6pECf4AENVaLT4mk.Q4z02MmxjWnGo.OVvCyC.";
|
||||
home = "/home/${username}";
|
||||
isNormalUser = true;
|
||||
description = username;
|
||||
extraGroups = [
|
||||
"users"
|
||||
"wheel"
|
||||
"networkmanager"
|
||||
"audio"
|
||||
];
|
||||
openssh.authorizedKeys.keys = [
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# DO NOT promote the specified user to input password for `nix-store` and `nix-copy-closure`
|
||||
security.sudo = {
|
||||
# wheelNeedsPassword = false;
|
||||
extraRules = [
|
||||
{
|
||||
users = [ username ];
|
||||
commands =
|
||||
[
|
||||
{
|
||||
command = "/run/current-system/sw/bin/nix-store";
|
||||
options = [ "NOPASSWD" ];
|
||||
}
|
||||
{
|
||||
command = "/run/current-system/sw/bin/nixos-rebuild";
|
||||
options = [ "NOPASSWD" "SETENV" ];
|
||||
}
|
||||
{
|
||||
command = "${pkgs.systemd}/bin/systemctl suspend";
|
||||
options = [ "NOPASSWD" ];
|
||||
}
|
||||
{
|
||||
command = "${pkgs.systemd}/bin/reboot";
|
||||
options = [ "NOPASSWD" ];
|
||||
}
|
||||
{
|
||||
command = "${pkgs.systemd}/bin/poweroff";
|
||||
options = [ "NOPASSWD" ];
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user