diff options
Diffstat (limited to 'nixos/doc/manual/development/option-declarations.section.md')
-rw-r--r-- | nixos/doc/manual/development/option-declarations.section.md | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/nixos/doc/manual/development/option-declarations.section.md b/nixos/doc/manual/development/option-declarations.section.md index f6fed3e1683..3448b07722b 100644 --- a/nixos/doc/manual/development/option-declarations.section.md +++ b/nixos/doc/manual/development/option-declarations.section.md @@ -77,6 +77,7 @@ The option's description is "Whether to enable \<name\>.". For example: ::: {#ex-options-declarations-util-mkEnableOption-magic .example} +### `mkEnableOption` usage ```nix lib.mkEnableOption (lib.mdDoc "magic") # is like @@ -126,6 +127,7 @@ During the transition to CommonMark documentation `mkPackageOption` creates an o Examples: ::: {#ex-options-declarations-util-mkPackageOption-hello .example} +### Simple `mkPackageOption` usage ```nix lib.mkPackageOptionMD pkgs "hello" { } # is like @@ -139,6 +141,7 @@ lib.mkOption { ::: ::: {#ex-options-declarations-util-mkPackageOption-ghc .example} +### `mkPackageOption` with explicit default and example ```nix lib.mkPackageOptionMD pkgs "GHC" { default = [ "ghc" ]; @@ -156,6 +159,7 @@ lib.mkOption { ::: ::: {#ex-options-declarations-util-mkPackageOption-extraDescription .example} +### `mkPackageOption` with additional description text ```nix mkPackageOption pkgs [ "python39Packages" "pytorch" ] { extraDescription = "This is an example and doesn't actually do anything."; @@ -217,7 +221,7 @@ changing the main service module file and the type system automatically enforces that there can only be a single display manager enabled. ::: {#ex-option-declaration-eot-service .example} -**Example: Extensible type placeholder in the service module** +### Extensible type placeholder in the service module ```nix services.xserver.displayManager.enable = mkOption { description = "Display manager to use"; @@ -227,7 +231,7 @@ services.xserver.displayManager.enable = mkOption { ::: ::: {#ex-option-declaration-eot-backend-gdm .example} -**Example: Extending `services.xserver.displayManager.enable` in the `gdm` module** +### Extending `services.xserver.displayManager.enable` in the `gdm` module ```nix services.xserver.displayManager.enable = mkOption { type = with types; nullOr (enum [ "gdm" ]); @@ -236,7 +240,7 @@ services.xserver.displayManager.enable = mkOption { ::: ::: {#ex-option-declaration-eot-backend-sddm .example} -**Example: Extending `services.xserver.displayManager.enable` in the `sddm` module** +### Extending `services.xserver.displayManager.enable` in the `sddm` module ```nix services.xserver.displayManager.enable = mkOption { type = with types; nullOr (enum [ "sddm" ]); |