nixos/users: add defaultGroups option for users

This commit is contained in:
Aly Raffauf 2024-07-02 16:23:27 -04:00
parent 080eb89a78
commit 1a99f1ecc2
4 changed files with 29 additions and 15 deletions

View file

@ -248,6 +248,21 @@
}; };
users = { users = {
defaultGroups = lib.mkOption {
description = "Default groups for desktop users.";
default = [
"dialout"
"docker"
"libvirtd"
"lp"
"networkmanager"
"scanner"
"transmission"
"video"
"wheel"
];
};
aly = { aly = {
enable = lib.mkEnableOption "Aly's user."; enable = lib.mkEnableOption "Aly's user.";

View file

@ -17,17 +17,16 @@
}; };
home-manager.users.aly = home-manager.users.aly =
if config.ar.users.aly.manageHome lib.attrsets.optionalAttrs
then import ../../../homes/aly config.ar.users.aly.manageHome
else {}; (import ../../../homes/aly);
users.users.aly = { users.users.aly = {
description = "Aly Raffauf"; description = "Aly Raffauf";
extraGroups = ["networkmanager" "wheel" "docker" "libvirtd" "video"]; extraGroups = config.ar.users.defaultGroups;
hashedPassword = config.ar.users.aly.password; hashedPassword = config.ar.users.aly.password;
isNormalUser = true; isNormalUser = true;
linger = true; linger = true;
uid = 1000;
openssh.authorizedKeys = { openssh.authorizedKeys = {
keys = [ keys = [
@ -42,6 +41,8 @@
../../../secrets/publicKeys/aly_rustboro.pub ../../../secrets/publicKeys/aly_rustboro.pub
]; ];
}; };
uid = 1000;
}; };
}; };
} }

View file

@ -6,15 +6,14 @@
}: { }: {
config = lib.mkIf config.ar.users.dustin.enable { config = lib.mkIf config.ar.users.dustin.enable {
home-manager.users.dustin = home-manager.users.dustin =
if config.ar.users.dustin.manageHome lib.attrsets.optionalAttrs
then import ../../../homes/dustin config.ar.users.dustin.manageHome
else {}; (import ../../../homes/dustin);
users.users.dustin = { users.users.dustin = {
description = "Dustin Raffauf"; description = "Dustin Raffauf";
extraGroups = ["networkmanager" "wheel" "docker" "libvirtd" "video"]; extraGroups = config.ar.users.defaultGroups;
hashedPassword = config.ar.users.dustin.password; hashedPassword = config.ar.users.dustin.password;
isNormalUser = true; isNormalUser = true;
uid = 1001; uid = 1001;
}; };

View file

@ -6,15 +6,14 @@
}: { }: {
config = lib.mkIf config.ar.users.morgan.enable { config = lib.mkIf config.ar.users.morgan.enable {
home-manager.users.morgan = home-manager.users.morgan =
if config.ar.users.morgan.manageHome lib.attrsets.optionalAttrs
then import ../../../homes/morgan config.ar.users.morgan.manageHome
else {}; (import ../../../homes/morgan);
users.users.morgan = { users.users.morgan = {
description = "Morgan Tamayo"; description = "Morgan Tamayo";
extraGroups = ["networkmanager" "wheel" "docker" "libvirtd" "video"]; extraGroups = config.ar.users.defaultGroups;
hashedPassword = config.ar.users.morgan.password; hashedPassword = config.ar.users.morgan.password;
isNormalUser = true; isNormalUser = true;
uid = 1002; uid = 1002;
}; };