From 382289027f92ff3973f14d983a55b183c9b1c0bd Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Mon, 2 Aug 2021 21:18:40 +0200 Subject: [PATCH] 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! --- lib/types.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/types.nix b/lib/types.nix index f2f9b2bca985..3fa9d881a650 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 {