refactor(modules): clean up folder structure
This commit is contained in:
parent
d8aa7f62b4
commit
03fca8b28b
12 changed files with 32 additions and 38 deletions
40
nix/modules/system/users.nix
Normal file
40
nix/modules/system/users.nix
Normal file
|
@ -0,0 +1,40 @@
|
|||
{ config, lib, ... }:
|
||||
let
|
||||
cfg = config.flake;
|
||||
inherit (cfg.lib.modules) userListToAttrs forAllUsers';
|
||||
inherit (lib.lists) optional;
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.default =
|
||||
{ config, ... }:
|
||||
{
|
||||
#TODO: move sudo/security options elsewhere
|
||||
# security.sudo.wheelNeedsPassword = false;
|
||||
# nix.settings.trusted-users = [ "@wheel" ];
|
||||
# persist uids and gids
|
||||
persistDirs = [ "/var/lib/nixos" ];
|
||||
users = {
|
||||
mutableUsers = false;
|
||||
groups.users.gid = 100;
|
||||
users = forAllUsers' (
|
||||
name: value: {
|
||||
isNormalUser = true;
|
||||
hashedPasswordFile = config.sops.secrets."${name}/hashedPassword".path;
|
||||
extraGroups = optional (value.primary or false) "wheel";
|
||||
}
|
||||
);
|
||||
};
|
||||
sops.secrets = userListToAttrs (name: {
|
||||
"${name}/hashedPassword" = {
|
||||
neededForUsers = true;
|
||||
sopsFile = cfg.paths.secrets + "/users.yaml";
|
||||
};
|
||||
});
|
||||
home-manager.users = forAllUsers' (
|
||||
name: _: {
|
||||
home.username = name;
|
||||
home.homeDirectory = config.users.users.${name}.home;
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue