nixos/znc: Fix config generator for certain null values

The type of ZNC's config option specifies that a configuration like

  config.User.paul = null;

should be valid, which is useful for clearing/disabling property sets
like Users and Networks. However until now the config generator
implementation didn't actually cover null values, meaning you'd get an
error like

  error: value is null while a set was expected, at /foo.nix:29:10

This fixes the implementation to correcly allow clearing of property
sets.
This commit is contained in:
Silvan Mosberger 2019-05-01 00:06:11 +02:00
parent 9db70b6a2a
commit a27dc9d3ab
No known key found for this signature in database
GPG key ID: 9424360B4B85C9E7

View file

@ -47,11 +47,11 @@ let
# Baz=baz
# Qux=qux
# </Foo>
set = concatMap (subname: [
set = concatMap (subname: optionals (value.${subname} != null) ([
"<${name} ${subname}>"
] ++ map (line: "\t${line}") (toLines value.${subname}) ++ [
"</${name}>"
]) (filter (v: v != null) (attrNames value));
])) (filter (v: v != null) (attrNames value));
}.${builtins.typeOf value};