modules: users: add to groups in single place
This commit is contained in:
parent
960f65f62c
commit
5b63b70958
|
@ -2,11 +2,6 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
my = config.my;
|
||||
groupIfExists = grp:
|
||||
lib.lists.optional
|
||||
(builtins.hasAttr grp config.users.groups)
|
||||
grp;
|
||||
groupsIfExist = grps: builtins.concatMap groupIfExists grps;
|
||||
in
|
||||
{
|
||||
users.users.blog = {
|
||||
|
@ -17,8 +12,4 @@ in
|
|||
home = "/var/www/";
|
||||
openssh.authorizedKeys.keys = [ my.secrets.drone.ssh.publicKey ];
|
||||
};
|
||||
|
||||
users.users.ambroisie.extraGroups = groupsIfExist [
|
||||
"media"
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
# User setup
|
||||
{ config, pkgs, ... }:
|
||||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
my = config.my;
|
||||
groupIfExists = grp:
|
||||
lib.lists.optional
|
||||
(builtins.hasAttr grp config.users.groups)
|
||||
grp;
|
||||
groupsIfExist = grps: builtins.concatMap groupIfExists grps;
|
||||
in
|
||||
{
|
||||
users.mutableUsers = false; # I want it to be declarative.
|
||||
|
@ -13,7 +18,10 @@ in
|
|||
description = "Bruno BELANYI";
|
||||
isNormalUser = true;
|
||||
shell = pkgs.zsh;
|
||||
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
|
||||
extraGroups = groupsIfExist [
|
||||
"media" # access to media files
|
||||
"wheel" # `sudo` for the user.
|
||||
];
|
||||
openssh.authorizedKeys.keys = with builtins; let
|
||||
keyDir = ./ssh;
|
||||
contents = readDir keyDir;
|
||||
|
|
Loading…
Reference in a new issue