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 = {
defaultGroups = lib.mkOption {
description = "Default groups for desktop users.";
default = [
"dialout"
"docker"
"libvirtd"
"lp"
"networkmanager"
"scanner"
"transmission"
"video"
"wheel"
];
};
aly = {
enable = lib.mkEnableOption "Aly's user.";

View file

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

View file

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

View file

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