41 lines
1.2 KiB
Nix
41 lines
1.2 KiB
Nix
# Lifted from:
|
|
# https://github.com/Doc-Steve/dendritic-design-with-flake-parts/blob/69edacdb5a4a6ca71d649bb8eb62cf8c630c8627/modules/users/bob%20%5BNDn%5D/bob.nix#L8
|
|
{ self, ... }:
|
|
{
|
|
config.flake.factory.user = username: isAdmin: {
|
|
nixos."${username}" = { lib, pkgs, ... }: {
|
|
users.users."${username}" = {
|
|
isNormalUser = true;
|
|
home = "/home/${username}";
|
|
extraGroups = [
|
|
"input"
|
|
"networkmanager"
|
|
] ++ lib.optionals isAdmin [
|
|
"docker"
|
|
"wheel"
|
|
];
|
|
};
|
|
|
|
# Removes password for sudo
|
|
security.sudo-rs = lib.mkIf isAdmin {
|
|
enable = true;
|
|
extraRules = [{
|
|
users = [ "${username}" ];
|
|
commands = [{
|
|
command = "ALL";
|
|
options = [ "NOPASSWD" ];
|
|
}];
|
|
}];
|
|
};
|
|
|
|
# https://github.com/Doc-Steve/dendritic-design-with-flake-parts/wiki/Dendritic_Aspects#multi-context-aspect
|
|
home-manager.users."${username}" = {
|
|
home.username = "${username}";
|
|
home.homeDirectory = "/home/${username}";
|
|
imports = [
|
|
self.modules.homeManager."${username}"
|
|
];
|
|
};
|
|
};
|
|
};
|
|
} |