diff options
author | Robert Schütz <robert.schuetz@stud.uni-heidelberg.de> | 2018-02-08 09:49:06 +0100 |
---|---|---|
committer | Robert Schütz <robert.schuetz@stud.uni-heidelberg.de> | 2018-02-08 10:01:49 +0100 |
commit | c65e36c9caec87873175095f07b052760b42e3ef (patch) | |
tree | 8a8379e544283d7635797ca832f983d92f7d67f3 /lib/types.nix | |
parent | e860b651d6e297658e960c165fd231dbc0de1f9b (diff) | |
download | nixpkgs-c65e36c9caec87873175095f07b052760b42e3ef.tar nixpkgs-c65e36c9caec87873175095f07b052760b42e3ef.tar.gz nixpkgs-c65e36c9caec87873175095f07b052760b42e3ef.tar.bz2 nixpkgs-c65e36c9caec87873175095f07b052760b42e3ef.tar.lz nixpkgs-c65e36c9caec87873175095f07b052760b42e3ef.tar.xz nixpkgs-c65e36c9caec87873175095f07b052760b42e3ef.tar.zst nixpkgs-c65e36c9caec87873175095f07b052760b42e3ef.zip |
lib/types: add types.nonEmptyListOf
Diffstat (limited to 'lib/types.nix')
-rw-r--r-- | lib/types.nix | 4 |
1 files changed, 4 insertions, 0 deletions
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"; |