mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
lib.types.anything: remove custom logic for lists (default to 'mergeEqualOption')
Previously, for values of type list, the merge function would only retain the value if the number of option definitions was less than or equal to 1, and would throw an error for conflicting definitions to avoid potentially unwanted list merges. This change removes that logic, defaulting to the 'mergeEqualOption' function for values of type list. This approach maintains the same safeguard against merging different lists while allowing lists with identical values to be merged.
This commit is contained in:
parent
187de2e360
commit
e5e69b748f
4 changed files with 7 additions and 10 deletions
|
@ -253,12 +253,6 @@ rec {
|
|||
mergeFunction = {
|
||||
# Recursively merge attribute sets
|
||||
set = (attrsOf anything).merge;
|
||||
# Safe and deterministic behavior for lists is to only accept one definition
|
||||
# listOf only used to apply mkIf and co.
|
||||
list =
|
||||
if length defs > 1
|
||||
then throw "The option `${showOption loc}' has conflicting definitions, in ${showFiles (getFiles defs)}."
|
||||
else (listOf anything).merge;
|
||||
# This is the type of packages, only accept a single definition
|
||||
stringCoercibleSet = mergeOneOption;
|
||||
lambda = loc: defs: arg: anything.merge
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue