From c65e36c9caec87873175095f07b052760b42e3ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=BCtz?= Date: Thu, 8 Feb 2018 09:49:06 +0100 Subject: [PATCH] lib/types: add types.nonEmptyListOf --- lib/types.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/types.nix b/lib/types.nix index 88fc90d0597..a334db5c724 100644 --- a/lib/types.nix +++ b/lib/types.nix @@ -256,6 +256,10 @@ rec { functor = (defaultFunctor name) // { wrapped = elemType; }; }; + nonEmptyListOf = elemType: + let list = addCheck (types.listOf elemType) (l: l != []); + in list // { description = "non-empty " + list.description; }; + attrsOf = elemType: mkOptionType rec { name = "attrsOf"; description = "attribute set of ${elemType.description}s";