lib/types: Fix emptyValue of listOf and nonEmptyListOf

An empty list is [], not {}!

Also, non-empty lists shouldn't have a default of an empty list!
This commit is contained in:
Silvan Mosberger 2021-08-02 21:18:40 +02:00
parent 97d3b5e1dd
commit 382289027f

View File

@ -390,7 +390,7 @@ rec {
).optionalValue
) def.value
) defs)));
emptyValue = { value = {}; };
emptyValue = { value = []; };
getSubOptions = prefix: elemType.getSubOptions (prefix ++ ["*"]);
getSubModules = elemType.getSubModules;
substSubModules = m: listOf (elemType.substSubModules m);
@ -402,7 +402,7 @@ rec {
let list = addCheck (types.listOf elemType) (l: l != []);
in list // {
description = "non-empty " + list.description;
# Note: emptyValue is left as is, because another module may define an element.
emptyValue = { }; # no .value attr, meaning unset
};
attrsOf = elemType: mkOptionType rec {