summary refs log tree commit diff
path: root/lib/options.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-30 15:33:20 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-30 15:35:09 +0100
commit70a2c545274cda238c5eda28b60cfa9dbc6f7ed6 (patch)
treed3629d90b938f5be866f2977c26976198f4ab014 /lib/options.nix
parentdb2a9afb75abc50497fcde61470c2b83795e4669 (diff)
downloadnixpkgs-70a2c545274cda238c5eda28b60cfa9dbc6f7ed6.tar
nixpkgs-70a2c545274cda238c5eda28b60cfa9dbc6f7ed6.tar.gz
nixpkgs-70a2c545274cda238c5eda28b60cfa9dbc6f7ed6.tar.bz2
nixpkgs-70a2c545274cda238c5eda28b60cfa9dbc6f7ed6.tar.lz
nixpkgs-70a2c545274cda238c5eda28b60cfa9dbc6f7ed6.tar.xz
nixpkgs-70a2c545274cda238c5eda28b60cfa9dbc6f7ed6.tar.zst
nixpkgs-70a2c545274cda238c5eda28b60cfa9dbc6f7ed6.zip
Strictly check the arguments to mkOption
And fix various instances of bad arguments.
Diffstat (limited to 'lib/options.nix')
-rw-r--r--lib/options.nix23
1 files changed, 12 insertions, 11 deletions
diff --git a/lib/options.nix b/lib/options.nix
index 5a05775e8c2..d1a161cf763 100644
--- a/lib/options.nix
+++ b/lib/options.nix
@@ -11,17 +11,18 @@ with import ./strings.nix;
 rec {
 
   isOption = lib.isType "option";
-  mkOption = attrs: attrs // {
-    _type = "option";
-    # name (this is the name of the attributem it is automatically generated by the traversal)
-    # default (value used when no definition exists)
-    # example (documentation)
-    # description (documentation)
-    # type (option type, provide a default merge function and ensure type correctness)
-    # merge (function used to merge definitions into one definition: [ /type/ ] -> /type/)
-    # apply (convert the option value to ease the manipulation of the option result)
-    # options (set of sub-options declarations & definitions)
-  };
+  mkOption =
+    { default ? null # Default value used when no definition is given in the configuration.
+    , defaultText ? null # Textual representation of the default, for in the manual.
+    , example ? null # Example value used in the manual.
+    , description ? null # String describing the option.
+    , type ? null # Option type, providing type-checking and value merging.
+    , apply ? null # Function that converts the option value to something else.
+    , internal ? null # Whether the option is for NixOS developers only.
+    , visible ? null # Whether the option shows up in the manual.
+    , options ? null # Obsolete, used by types.optionSet.
+    } @ attrs:
+    attrs // { _type = "option"; };
 
   mkEnableOption = name: mkOption {
     default = false;