summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorNikolay Amiantov <ab@fmap.me>2017-05-25 19:18:34 +0300
committerNikolay Amiantov <ab@fmap.me>2017-05-25 19:24:05 +0300
commit63e0d50f16157bd85fc1b3bef87a90792c66dc7c (patch)
tree418bd1840a23f68f68e133ba7304bddea53da887 /lib
parent634b0403739377fd5d0a162444ce92acf51e9d97 (diff)
downloadnixpkgs-63e0d50f16157bd85fc1b3bef87a90792c66dc7c.tar
nixpkgs-63e0d50f16157bd85fc1b3bef87a90792c66dc7c.tar.gz
nixpkgs-63e0d50f16157bd85fc1b3bef87a90792c66dc7c.tar.bz2
nixpkgs-63e0d50f16157bd85fc1b3bef87a90792c66dc7c.tar.lz
nixpkgs-63e0d50f16157bd85fc1b3bef87a90792c66dc7c.tar.xz
nixpkgs-63e0d50f16157bd85fc1b3bef87a90792c66dc7c.tar.zst
nixpkgs-63e0d50f16157bd85fc1b3bef87a90792c66dc7c.zip
types: add short docstrings
Fixes #26055
Diffstat (limited to 'lib')
-rw-r--r--lib/types.nix7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/types.nix b/lib/types.nix
index b06cc9eedaa..50aa6d77085 100644
--- a/lib/types.nix
+++ b/lib/types.nix
@@ -259,6 +259,7 @@ rec {
       functor = (defaultFunctor name) // { wrapped = elemType; };
     };
 
+    # Value of given type but with no merging (i.e. `uniq list`s are not concatenated).
     uniq = elemType: mkOptionType rec {
       name = "uniq";
       inherit (elemType) description check;
@@ -269,6 +270,7 @@ rec {
       functor = (defaultFunctor name) // { wrapped = elemType; };
     };
 
+    # Null or value of ...
     nullOr = elemType: mkOptionType rec {
       name = "nullOr";
       description = "null or ${elemType.description}";
@@ -285,6 +287,7 @@ rec {
       functor = (defaultFunctor name) // { wrapped = elemType; };
     };
 
+    # A submodule (like typed attribute set). See NixOS manual.
     submodule = opts:
       let
         opts' = toList opts;
@@ -316,6 +319,7 @@ rec {
         };
       };
 
+    # A value from a set of allowed ones.
     enum = values:
       let
         show = v:
@@ -331,6 +335,7 @@ rec {
         functor = (defaultFunctor name) // { payload = values; binOp = a: b: unique (a ++ b); };
       };
 
+    # Either value of type `t1` or `t2`.
     either = t1: t2: mkOptionType rec {
       name = "either";
       description = "${t1.description} or ${t2.description}";
@@ -354,6 +359,8 @@ rec {
       functor = (defaultFunctor name) // { wrapped = [ t1 t2 ]; };
     };
 
+    # Either value of type `finalType` or `coercedType`, the latter is
+    # converted to `finalType` using `coerceFunc`.
     coercedTo = coercedType: coerceFunc: finalType:
       assert coercedType.getSubModules == null;
       mkOptionType rec {