Commit ad8d5cf7 authored by pennae's avatar pennae Committed by pennae
Browse files

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.
parent df09c21f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -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 ])";
}
+3 −3
Original line number Diff line number Diff line
@@ -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;;
}