diff options
Diffstat (limited to 'lib/options.nix')
-rw-r--r-- | lib/options.nix | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/options.nix b/lib/options.nix index 8d82a809083b7..afae1769afdd4 100644 --- a/lib/options.nix +++ b/lib/options.nix @@ -7,6 +7,7 @@ let collect concatLists concatMap + concatMapStringsSep elemAt filter foldl' @@ -280,6 +281,21 @@ rec { if ! isString text then throw "literalDocBook expects a string." else { _type = "literalDocBook"; inherit text; }; + /* Transition marker for documentation that's already migrated to markdown + syntax. + */ + mdDoc = text: + if ! isString text then throw "mdDoc expects a string." + else { _type = "mdDoc"; inherit text; }; + + /* For use in the `defaultText` and `example` option attributes. Causes the + given MD text to be inserted verbatim in the documentation, for when + a `literalExpression` would be too hard to read. + */ + literalMD = text: + if ! isString text then throw "literalMD expects a string." + else { _type = "literalMD"; inherit text; }; + # Helper functions. /* Convert an option, described as a list of the option parts in to a @@ -325,6 +341,11 @@ rec { in "\n- In `${def.file}'${result}" ) defs; + showOptionWithDefLocs = opt: '' + ${showOption opt.loc}, with values defined in: + ${concatMapStringsSep "\n" (defFile: " - ${defFile}") opt.files} + ''; + unknownModule = "<unknown-file>"; } |