nixos/manual: clarify mk{Enable,Package}Option MD usage

the examples were incorrect, but not catastrophically. running a docs
build would've issued a warning with the correct instructions.
This commit is contained in:
pennae 2023-01-15 15:05:30 +01:00 committed by pennae
parent df09c21fb2
commit ad8d5cf731
2 changed files with 6 additions and 6 deletions

View file

@ -78,7 +78,7 @@ For example:
::: {#ex-options-declarations-util-mkEnableOption-magic .example}
```nix
lib.mkEnableOption "magic"
lib.mkEnableOption (lib.mdDoc "magic")
# is like
lib.mkOption {
type = lib.types.bool;
@ -113,7 +113,7 @@ Examples:
::: {#ex-options-declarations-util-mkPackageOption-hello .example}
```nix
lib.mkPackageOption pkgs "hello" { }
lib.mkPackageOptionMD pkgs "hello" { }
# is like
lib.mkOption {
type = lib.types.package;
@ -125,7 +125,7 @@ lib.mkOption {
::: {#ex-options-declarations-util-mkPackageOption-ghc .example}
```nix
lib.mkPackageOption pkgs "GHC" {
lib.mkPackageOptionMD pkgs "GHC" {
default = [ "ghc" ];
example = "pkgs.haskell.packages.ghc92.ghc.withPackages (hkgs: [ hkgs.primes ])";
}

View file

@ -128,7 +128,7 @@ options = {
</para>
<anchor xml:id="ex-options-declarations-util-mkEnableOption-magic" />
<programlisting language="nix">
lib.mkEnableOption &quot;magic&quot;
lib.mkEnableOption (lib.mdDoc &quot;magic&quot;)
# is like
lib.mkOption {
type = lib.types.bool;
@ -188,7 +188,7 @@ mkPackageOption pkgs &quot;name&quot; { default = [ &quot;path&quot; &quot;in&qu
</para>
<anchor xml:id="ex-options-declarations-util-mkPackageOption-hello" />
<programlisting language="nix">
lib.mkPackageOption pkgs &quot;hello&quot; { }
lib.mkPackageOptionMD pkgs &quot;hello&quot; { }
# is like
lib.mkOption {
type = lib.types.package;
@ -199,7 +199,7 @@ lib.mkOption {
</programlisting>
<anchor xml:id="ex-options-declarations-util-mkPackageOption-ghc" />
<programlisting language="nix">
lib.mkPackageOption pkgs &quot;GHC&quot; {
lib.mkPackageOptionMD pkgs &quot;GHC&quot; {
default = [ &quot;ghc&quot; ];
example = &quot;pkgs.haskell.packages.ghc92.ghc.withPackages (hkgs: [ hkgs.primes ])&quot;;
}