mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 13:10:33 +00:00
lib/types: add types.nonEmptyListOf
This commit is contained in:
parent
e860b651d6
commit
c65e36c9ca
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue