From 908919efc43551d6786561dc4050861350532938 Mon Sep 17 00:00:00 2001 From: magic_rb Date: Tue, 17 Dec 2024 14:41:40 +0100 Subject: [PATCH] `services/apache`: use a `listOf` which accepts non-list things Signed-off-by: magic_rb --- modules/services/nginx.nix | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/services/nginx.nix b/modules/services/nginx.nix index 5af8539..31b5231 100644 --- a/modules/services/nginx.nix +++ b/modules/services/nginx.nix @@ -44,8 +44,23 @@ in type = with lib.types; let + optionalListOf = elemType: + let list = (types.listOf elemType); + in list // { + merge = loc: defs: + list.merge loc + (map + (def: + if lib.isList def.value then + def + else + def // { value = lib.singleton def.value; } + ) + defs); + check = lib.const true; + }; self = - (listOf (oneOf [ + (optionalListOf (oneOf [ str (attrsOf (oneOf [ str