diff options
| author | Johannes Kirschbauer <hsjobeki+github@gmail.com> | 2026-01-15 01:30:18 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-01-15 01:30:18 +0000 |
| commit | f98c9687bc8f8d1bcfef42b061eed751faf9017d (patch) | |
| tree | f50e385c016fdbe52b2fcf671ae75a04688b616e /lib | |
| parent | Fix swap creation failure (#457346) (diff) | |
| parent | docs/mkOption: improve mkOption documentation (diff) | |
| download | nixpkgs-f98c9687bc8f8d1bcfef42b061eed751faf9017d.tar.gz | |
docs/mkOption: improve mkOption documentation (#478096)
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/options.nix | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/options.nix b/lib/options.nix index 1cf93d5bdf92..164bd6248534 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -77,12 +77,12 @@ rec { isOption = lib.isType "option"; /** - Creates an Option attribute set. `mkOption` accepts an attribute set with the following keys: + Creates an Option declaration for use with the module system. # Inputs - Structured attribute set - : Attribute set containing none or some of the following attributes. + Attribute set + : containing none or some of the following attributes. `default` : Optional default value used when no definition is given in the configuration. @@ -122,16 +122,16 @@ rec { `readOnly` : Optional boolean indicating whether the option can be set only once. - `...` (any other attribute) - : Any other attribute is passed through to the resulting option attribute set. - # Examples :::{.example} ## `lib.options.mkOption` usage example ```nix - mkOption { } // => { _type = "option"; } - mkOption { default = "foo"; } // => { _type = "option"; default = "foo"; } + mkOption { } + # => Empty option; type = types.anything + + mkOption { default = "foo"; } + # => Same as above, with a default value ``` ::: |
