mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 20:25:32 +03:00
Strictly check the arguments to mkOption
And fix various instances of bad arguments.
This commit is contained in:
parent
db2a9afb75
commit
70a2c54527
9 changed files with 45 additions and 39 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue