Refactor user option types across modules for consistency

Updated multiple configuration files to replace the user option type with a unified `usersOptionType`, enhancing consistency in user management across applications and services. This change simplifies the user configuration process and improves maintainability.
This commit is contained in:
Danilo Reyes
2026-01-16 13:40:44 -06:00
parent f1e6015d39
commit 6573392c3b
29 changed files with 43 additions and 65 deletions

View File

@@ -237,13 +237,20 @@ in
}) (inputs.self.lib.normalizeUsers users)
);
getFirstUser = users: if builtins.isString users then users else (builtins.head users);
mergeUsersOption =
lib: _loc: defs:
let
normalize = users: if builtins.isString users then [ users ] else users;
allUsers = lib.foldl' (acc: def: acc ++ (normalize def.value)) [ ] defs;
in
lib.unique allUsers;
usersOptionType =
lib:
lib.mkOptionType {
name = "usersOption";
description = "Either a single user (string) or multiple users (list of strings)";
check = x: builtins.isString x || (builtins.isList x && lib.all builtins.isString x);
merge =
_loc: defs:
let
normalize = users: if builtins.isString users then [ users ] else users;
allUsers = lib.foldl' (acc: def: acc ++ (normalize def.value)) [ ] defs;
in
lib.unique allUsers;
};
};
};
}