diff options
author | Silvan Mosberger <contact@infinisil.com> | 2021-08-02 21:18:40 +0200 |
---|---|---|
committer | Silvan Mosberger <contact@infinisil.com> | 2022-02-17 18:48:27 +0100 |
commit | 382289027f92ff3973f14d983a55b183c9b1c0bd (patch) | |
tree | d91f8c1ff13aa6cb9b67409ce6a0da04cb4dcd59 /lib | |
parent | 97d3b5e1dd4afbcc43ea3c1f6e19a55701483dc0 (diff) |
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!
Diffstat (limited to 'lib')
-rw-r--r-- | lib/types.nix | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/types.nix b/lib/types.nix index f2f9b2bca9853..3fa9d881a6502 100644 --- a/lib/types.nix +++ b/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 { |