modules: system: users: make it configurable
Notably, make use of my global 'username' option.
This commit is contained in:
parent
558f9b3919
commit
22a01eeadf
|
@ -1,17 +1,27 @@
|
||||||
# User setup
|
# User setup
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
let
|
let
|
||||||
my = config.my;
|
secrets = config.my.secrets;
|
||||||
|
cfg = config.my.system.users;
|
||||||
groupExists = grp: builtins.hasAttr grp config.users.groups;
|
groupExists = grp: builtins.hasAttr grp config.users.groups;
|
||||||
groupsIfExist = builtins.filter groupExists;
|
groupsIfExist = builtins.filter groupExists;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
users.mutableUsers = false; # I want it to be declarative.
|
options.my.system.users = with lib; {
|
||||||
|
enable = my.mkDisableOption "user configuration";
|
||||||
|
};
|
||||||
|
|
||||||
# Define user accounts and passwords.
|
config = lib.mkIf cfg.enable {
|
||||||
users.users.root.hashedPassword = my.secrets.users.root.hashedPassword;
|
users = {
|
||||||
users.users.ambroisie = {
|
mutableUsers = false; # I want it to be declarative.
|
||||||
hashedPassword = my.secrets.users.ambroisie.hashedPassword;
|
|
||||||
|
users = {
|
||||||
|
root = {
|
||||||
|
inherit (secrets.users.root) hashedPassword;
|
||||||
|
};
|
||||||
|
|
||||||
|
${config.my.username} = {
|
||||||
|
inherit (secrets.users.${config.my.username}) hashedPassword;
|
||||||
description = "Bruno BELANYI";
|
description = "Bruno BELANYI";
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
shell = pkgs.zsh;
|
shell = pkgs.zsh;
|
||||||
|
@ -33,4 +43,7 @@ in
|
||||||
in
|
in
|
||||||
keys;
|
keys;
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue