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:
@@ -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;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user