treewide: automatically md-convert option descriptions

the conversion procedure is simple:

 - find all things that look like options, ie calls to either `mkOption`
   or `lib.mkOption` that take an attrset. remember the attrset as the
   option
 - for all options, find a `description` attribute who's value is not a
   call to `mdDoc` or `lib.mdDoc`
 - textually convert the entire value of the attribute to MD with a few
   simple regexes (the set from mdize-module.sh)
 - if the change produced a change in the manual output, discard
 - if the change kept the manual unchanged, add some text to the
   description to make sure we've actually found an option. if the
   manual changes this time, keep the converted description

this procedure converts 80% of nixos options to markdown. around 2000
options remain to be inspected, but most of those fail the "does not
change the manual output check": currently the MD conversion process
does not faithfully convert docbook tags like <code> and <package>, so
any option using such tags will not be converted at all.
This commit is contained in:
pennae 2022-07-28 23:19:15 +02:00
parent 52b0ad17e3
commit 2e751c0772
1050 changed files with 9605 additions and 9605 deletions

View file

@ -36,8 +36,8 @@ in
type = types.bool;
default = true;
description =
''
Whether to enable the <command>sudo</command> command, which
lib.mdDoc ''
Whether to enable the {command}`sudo` command, which
allows non-root users to execute commands as root.
'';
};
@ -77,15 +77,15 @@ in
# Note: if syntax errors are detected in this file, the NixOS
# configuration will fail to build.
description =
''
lib.mdDoc ''
This string contains the contents of the
<filename>sudoers</filename> file.
{file}`sudoers` file.
'';
};
security.sudo.extraRules = mkOption {
description = ''
Define specific rules to be in the <filename>sudoers</filename> file.
description = lib.mdDoc ''
Define specific rules to be in the {file}`sudoers` file.
More specific rules should come after more general ones in order to
yield the expected behavior. You can use mkBefore/mkAfter to ensure
this is the case when configuration options are merged.
@ -114,7 +114,7 @@ in
options = {
users = mkOption {
type = with types; listOf (either str int);
description = ''
description = lib.mdDoc ''
The usernames / UIDs this rule should apply for.
'';
default = [];
@ -122,7 +122,7 @@ in
groups = mkOption {
type = with types; listOf (either str int);
description = ''
description = lib.mdDoc ''
The groups / GIDs this rule should apply for.
'';
default = [];
@ -131,7 +131,7 @@ in
host = mkOption {
type = types.str;
default = "ALL";
description = ''
description = lib.mdDoc ''
For what host this rule should apply.
'';
};
@ -149,7 +149,7 @@ in
};
commands = mkOption {
description = ''
description = lib.mdDoc ''
The commands for which the rule should apply.
'';
type = with types; listOf (either str (submodule {
@ -182,8 +182,8 @@ in
security.sudo.extraConfig = mkOption {
type = types.lines;
default = "";
description = ''
Extra configuration text appended to <filename>sudoers</filename>.
description = lib.mdDoc ''
Extra configuration text appended to {file}`sudoers`.
'';
};
};