Skip to content

Commit

Permalink
lib/modules: make mkAliasOptionModule emit DocBook
Browse files Browse the repository at this point in the history
Follow-up to NixOS#208407

Removing `mdDoc` isn't enough, we need to emit actual DocBook.
Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

ncfavier committed Jan 8, 2023
1 parent 6c73595 commit fb1bc8d
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/modules.nix
Original file line number Diff line number Diff line change
@@ -1113,7 +1113,6 @@ rec {
visible = true;
warn = false;
use = id;
wrapDescription = lib.id;
};

/* Transitional version of mkAliasOptionModule that uses MD docs. */
@@ -1122,6 +1121,7 @@ rec {
visible = true;
warn = false;
use = id;
markdown = true;
};

/* mkDerivedConfig : Option a -> (a -> Definition b) -> Definition b
@@ -1144,7 +1144,7 @@ rec {
(opt.highestPrio or defaultOverridePriority)
(f opt.value);

doRename = { from, to, visible, warn, use, withPriority ? true, wrapDescription ? lib.mdDoc }:
doRename = { from, to, visible, warn, use, withPriority ? true, markdown ? false }:
{ config, options, ... }:
let
fromOpt = getAttrFromPath from options;
@@ -1155,7 +1155,9 @@ rec {
{
options = setAttrByPath from (mkOption {
inherit visible;
description = wrapDescription "Alias of {option}`${showOption to}`.";
description = if markdown
then lib.mdDoc "Alias of {option}`${showOption to}`."
else "Alias of <option>${showOption to}</option>.";
apply = x: use (toOf config);
} // optionalAttrs (toType != null) {
type = toType;
1 change: 1 addition & 0 deletions nixos/lib/make-options-doc/default.nix
Original file line number Diff line number Diff line change
@@ -41,6 +41,7 @@
# characteristics but (hopefully) indistinguishable output.
, allowDocBook ? true
# whether lib.mdDoc is required for descriptions to be read as markdown.
# !!! when this is eventually flipped to true, `lib.doRename` should also default to emitting Markdown
, markdownByDefault ? false
}:

0 comments on commit fb1bc8d

Please sign in to comment.