···
# TODO: Change the type of this option to a submodule with a
# freeformType, so that individual arguments can be documented
166
+
description = lib.mdDoc ''
Additional arguments passed to each module in addition to ones
168
-
like <literal>lib</literal>, <literal>config</literal>,
169
-
and <literal>pkgs</literal>, <literal>modulesPath</literal>.
168
+
like `lib`, `config`,
169
+
and `pkgs`, `modulesPath`.
This option is also available to all submodules. Submodules do not
inherit args from their parent module, nor do they provide args to
their parent module or sibling submodules. The sole exception to
175
-
this is the argument <literal>name</literal> which is provided by
174
+
this is the argument `name` which is provided by
parent modules to a submodule and contains the attribute name
the submodule is bound to, or a unique generated name if it is
not bound to an attribute.
Some arguments are already passed by default, of which the
182
-
following <emphasis>cannot</emphasis> be changed with this option:
186
-
<varname>lib</varname>: The nixpkgs library.
191
-
<varname>config</varname>: The results of all options after merging the values from all modules together.
196
-
<varname>options</varname>: The options declared in all modules.
201
-
<varname>specialArgs</varname>: The <literal>specialArgs</literal> argument passed to <literal>evalModules</literal>.
206
-
All attributes of <varname>specialArgs</varname>
209
-
Whereas option values can generally depend on other option values
210
-
thanks to laziness, this does not apply to <literal>imports</literal>, which
211
-
must be computed statically before anything else.
214
-
For this reason, callers of the module system can provide <literal>specialArgs</literal>
215
-
which are available during import resolution.
218
-
For NixOS, <literal>specialArgs</literal> includes
219
-
<varname>modulesPath</varname>, which allows you to import
220
-
extra modules from the nixpkgs package tree without having to
221
-
somehow make the module aware of the location of the
222
-
<literal>nixpkgs</literal> or NixOS directories.
224
-
{ modulesPath, ... }: {
226
-
(modulesPath + "/profiles/minimal.nix")
180
+
following *cannot* be changed with this option:
181
+
- {var}`lib`: The nixpkgs library.
182
+
- {var}`config`: The results of all options after merging the values from all modules together.
183
+
- {var}`options`: The options declared in all modules.
184
+
- {var}`specialArgs`: The `specialArgs` argument passed to `evalModules`.
185
+
- All attributes of {var}`specialArgs`
187
+
Whereas option values can generally depend on other option values
188
+
thanks to laziness, this does not apply to `imports`, which
189
+
must be computed statically before anything else.
191
+
For this reason, callers of the module system can provide `specialArgs`
192
+
which are available during import resolution.
194
+
For NixOS, `specialArgs` includes
195
+
{var}`modulesPath`, which allows you to import
196
+
extra modules from the nixpkgs package tree without having to
197
+
somehow make the module aware of the location of the
198
+
`nixpkgs` or NixOS directories.
200
+
{ modulesPath, ... }: {
202
+
(modulesPath + "/profiles/minimal.nix")
For NixOS, the default value for this option includes at least this argument:
239
-
<varname>pkgs</varname>: The nixpkgs package set according to
240
-
the <option>nixpkgs.pkgs</option> option.
208
+
- {var}`pkgs`: The nixpkgs package set according to
209
+
the {option}`nixpkgs.pkgs` option.
···
251
-
description = "Whether to check whether all option definitions have matching declarations.";
217
+
description = lib.mdDoc "Whether to check whether all option definitions have matching declarations.";
_module.freeformType = mkOption {
type = types.nullOr types.optionType;
224
+
description = lib.mdDoc ''
If set, merge all definitions that don't have an associated option
together using this type. The result then gets combined with the
261
-
values of all declared options to produce the final <literal>
262
-
config</literal> value.
227
+
values of all declared options to produce the final `
264
-
If this is <literal>null</literal>, definitions without an option
265
-
will throw an error unless <option>_module.check</option> is
230
+
If this is `null`, definitions without an option
231
+
will throw an error unless {option}`_module.check` is
···
_module.specialArgs = mkOption {
239
+
description = lib.mdDoc ''
Externally provided module arguments that can't be modified from
within a configuration, but can be used in module imports.
···
options = setAttrByPath from (mkOption {
1170
-
description = "Alias of <option>${showOption to}</option>.";
1136
+
description = lib.mdDoc "Alias of {option}`${showOption to}`.";
apply = x: use (toOf config);
} // optionalAttrs (toType != null) {