Option Declarations
An option declaration specifies the name, type and description
of a NixOS configuration option. It is invalid to define an option
that hasn’t been declared in any module. An option declaration
generally looks like this:
options = {
name = mkOption {
type = type specification;
default = default value;
example = example value;
description = "Description for use in the NixOS manual.";
};
};
The function mkOption accepts the following arguments.
type
The type of the option (see ).
It may be omitted, but that’s not advisable since it may lead to errors
that are hard to diagnose.
default
The default value used if no value is defined by any
module. A default is not required; in that case, if the option
value is never used, an error will be thrown.
example
An example value that will be shown in the NixOS manual.
description
A textual description of the option, in DocBook format,
that will be included in the NixOS manual.