Declaration: Difference between revisions

imported>Mth
m Mth moved page NixOS:Declaration to Declaration
imported>Evertras
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 42: Line 42:
with lib;
with lib;
services.fooBar.option = mkOption {
services.fooBar.option = mkOption {
   type = with types; uniq string;
   type = with types; uniq str;
   description = "
   description = "
     ...
     ...
Line 53: Line 53:
== Simple Types ==
== Simple Types ==


* <code>inferred</code>: Useful when it is used under a meta-type.
* <code>anything</code>: Useful when it is used under a meta-type.
* <code>bool</code>: A Boolean useful for enable flags.  The merge function is a logical OR between all definitions.
* <code>bool</code>: A Boolean useful for enable flags.  The merge function is a logical OR between all definitions.
* <code>int</code>: An Integer.
* <code>int</code>: An Integer.
* <code>string</code>: A string where all definitions are concatenated.
* <code>str</code>: A string where all definitions are concatenated.
* <code>envVar</code>: A string where all definitions are concatenated with a colon between all definitions.
* <code>envVar</code>: A string where all definitions are concatenated with a colon between all definitions.
* <code>attrs</code>: An attribute set. (you should prefer <code>attrsOf inferred</code>)
* <code>attrs</code>: An attribute set. (you should prefer <code>attrsOf inferred</code>)
Line 75: Line 75:


* <code>optionSet</code>: '''DEPRECATED, probably use submodule instead''' This type is used to benefit from the modular system used by NixOS inside an option.  When this type is enabled, it merge the <code>options</code> attribute of option declarations with each definition.  The result is the fixed configuration of each module.  This option is often see in conjunction with <code>attrsOf</code> or <code>listOf</code>.  Modules declared in option declaration appear in the generated manual with a prefix representing the container type, respectively "<code>.<name></code>" and "<code>.*</code>".  Reference to definition files do not appears in the generated manual because the system cannot track them.
* <code>optionSet</code>: '''DEPRECATED, probably use submodule instead''' This type is used to benefit from the modular system used by NixOS inside an option.  When this type is enabled, it merge the <code>options</code> attribute of option declarations with each definition.  The result is the fixed configuration of each module.  This option is often see in conjunction with <code>attrsOf</code> or <code>listOf</code>.  Modules declared in option declaration appear in the generated manual with a prefix representing the container type, respectively "<code>.<name></code>" and "<code>.*</code>".  Reference to definition files do not appears in the generated manual because the system cannot track them.
[[Category:NixOS]]