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!
main
Silvan Mosberger 3 years ago
parent 97d3b5e1dd
commit 382289027f
  1. 4
      lib/types.nix

@ -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 {

Loading…
Cancel
Save