From a27dc9d3ab31634d40905926203484e5d0f3336c Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Wed, 1 May 2019 00:06:11 +0200 Subject: [PATCH] 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. --- nixos/modules/services/networking/znc/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nixos/modules/services/networking/znc/default.nix b/nixos/modules/services/networking/znc/default.nix index 1ad8855b86db..46bff6954cdd 100644 --- a/nixos/modules/services/networking/znc/default.nix +++ b/nixos/modules/services/networking/znc/default.nix @@ -47,11 +47,11 @@ let # Baz=baz # Qux=qux # - set = concatMap (subname: [ + set = concatMap (subname: optionals (value.${subname} != null) ([ "<${name} ${subname}>" ] ++ map (line: "\t${line}") (toLines value.${subname}) ++ [ "" - ]) (filter (v: v != null) (attrNames value)); + ])) (filter (v: v != null) (attrNames value)); }.${builtins.typeOf value};