summary refs log tree commit diff
path: root/pkgs/lib/types.nix
diff options
context:
space:
mode:
authorMarc Weber <marco-oweber@gmx.de>2013-08-22 10:01:27 +0300
committerEvgeny Egorochkin <phreedom@yandex.ru>2013-08-22 10:01:27 +0300
commita3f148ce96493fa320a947e7a134b417880ee987 (patch)
treef9131b668bec0051f1a094acef01c5f9c0c1aa1f /pkgs/lib/types.nix
parent983c87a1dd371044c3e7ff0e8e662353094ddcc1 (diff)
downloadnixpkgs-a3f148ce96493fa320a947e7a134b417880ee987.tar
nixpkgs-a3f148ce96493fa320a947e7a134b417880ee987.tar.gz
nixpkgs-a3f148ce96493fa320a947e7a134b417880ee987.tar.bz2
nixpkgs-a3f148ce96493fa320a947e7a134b417880ee987.tar.lz
nixpkgs-a3f148ce96493fa320a947e7a134b417880ee987.tar.xz
nixpkgs-a3f148ce96493fa320a947e7a134b417880ee987.tar.zst
nixpkgs-a3f148ce96493fa320a947e7a134b417880ee987.zip
Improve option types documentation.
Diffstat (limited to 'pkgs/lib/types.nix')
-rw-r--r--pkgs/lib/types.nix19
1 files changed, 16 insertions, 3 deletions
diff --git a/pkgs/lib/types.nix b/pkgs/lib/types.nix
index f9a195a80ba..b634cccc8c6 100644
--- a/pkgs/lib/types.nix
+++ b/pkgs/lib/types.nix
@@ -19,7 +19,7 @@ rec {
 
 
   # name (name of the type)
-  # check (boolean function)
+  # check (check the config value. Before returning false it should trace the bad value eg using traceValIfNot)
   # merge (default merge function)
   # iter (iterate on all elements contained in this type)
   # fold (fold all elements contained in this type)
@@ -196,8 +196,21 @@ rec {
       hasOptions = false;
     };
 
-    # !!! this should be a type constructor that takes the options as
-    # an argument.
+    # usually used with listOf, attrsOf, loaOf like this:
+    # users = mkOption {
+    #   type = loaOf optionSet;
+    #
+    #   # you can omit the list if there is one element only
+    #   options = [ {
+    #     name = mkOption {
+    #       description = "name of the user"
+    #       ...
+    #     };
+    #     # more options here
+    #   } { more options } ];
+    # }
+    # TODO: !!! document passing options as an argument to optionSet,
+    # deprecate the current approach.
     optionSet = mkOptionType {
       name = "option set";
       # merge is done in "options.nix > addOptionMakeUp > handleOptionSets"