refactor: rename snowfallorg.user to snowfallorg.users in system configs

This commit is contained in:
Jake Hamilton 2024-03-04 09:42:48 -08:00
parent 1fd6a70a82
commit 8d6612527a
No known key found for this signature in database
GPG key ID: 9762169A1B35EA68
3 changed files with 38 additions and 13 deletions

View file

@ -5,16 +5,25 @@ args @ {
config,
...
}: let
inherit (lib) types mkOption mkDefault foldl optionalAttrs optional;
inherit
(lib)
types
mkOption
mkDefault
mkRenamedOptionModule
foldl
optionalAttrs
optional
;
cfg = config.snowfallorg;
inputs = args.inputs or {};
user-names = builtins.attrNames cfg.user;
user-names = builtins.attrNames cfg.users;
create-system-users = system-users: name: let
user = cfg.user.${name};
user = cfg.users.${name};
in
system-users
// (optionalAttrs user.create {
@ -30,8 +39,12 @@ args @ {
};
});
in {
imports = [
(mkRenamedOptionModule ["snowfallorg" "user"] ["snowfallorg" "users"])
];
options.snowfallorg = {
user = mkOption {
users = mkOption {
description = "User configuration.";
default = {};
type = types.attrsOf (types.submodule ({name, ...}: {