summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohannes Kirschbauer <hsjobeki@gmail.com>2026-01-08 15:55:40 +0100
committerJohannes Kirschbauer <hsjobeki@gmail.com>2026-01-09 09:47:50 +0100
commitc80a1dea363f143d29d75a488aee49bb27f74d6e (patch)
treeee4f86415744a6160b00cf6e9f9784338a152419 /lib
parentclifm: 1.26.3 -> 1.27 (#477955) (diff)
downloadnixpkgs-c80a1dea363f143d29d75a488aee49bb27f74d6e.tar.gz
docs/mkOption: improve mkOption documentation
Diffstat (limited to 'lib')
-rw-r--r--lib/options.nix16
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
```
:::