lol

Merge pull request #176146 from pennae/module-docs-markdown

treewide: markdown option docs

authored by

Robert Hensing and committed by
GitHub
e2c261f2 a72d7811

+329 -143
+4
doc/build-aux/pandoc-filters/docbook-writer/rst-roles.lua
··· 27 27 content = '<refentrytitle>' .. title .. '</refentrytitle>' .. (volnum ~= nil and ('<manvolnum>' .. volnum .. '</manvolnum>') or '') 28 28 elseif elem.attributes['role'] == 'file' then 29 29 tag = 'filename' 30 + elseif elem.attributes['role'] == 'command' then 31 + tag = 'command' 32 + elseif elem.attributes['role'] == 'option' then 33 + tag = 'option' 30 34 end 31 35 32 36 if tag ~= nil then
+17 -3
doc/contributing/contributing-to-documentation.chapter.md
··· 27 27 28 28 As per [RFC 0072](https://github.com/NixOS/rfcs/pull/72), all new documentation content should be written in [CommonMark](https://commonmark.org/) Markdown dialect. 29 29 30 - Additionally, the following syntax extensions are currently used: 30 + Additional syntax extensions are available, though not all extensions can be used in NixOS option documentation. The following extensions are currently used: 31 31 32 32 - []{#ssec-contributing-markup-anchors} 33 33 Explicitly defined **anchors** on headings, to allow linking to sections. These should be always used, to ensure the anchors can be linked even when the heading text changes, and to prevent conflicts between [automatically assigned identifiers](https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/auto_identifiers.md). ··· 53 53 This syntax is taken from [MyST](https://myst-parser.readthedocs.io/en/latest/using/syntax.html#targets-and-cross-referencing). 54 54 55 55 - []{#ssec-contributing-markup-inline-roles} 56 - If you want to link to a man page, you can use `` {manpage}`nix.conf(5)` ``, which will turn into {manpage}`nix.conf(5)`. 56 + If you want to link to a man page, you can use `` {manpage}`nix.conf(5)` ``, which will turn into {manpage}`nix.conf(5)`. The references will turn into links when a mapping exists in {file}`doc/build-aux/pandoc-filters/link-unix-man-references.lua`. 57 57 58 - The references will turn into links when a mapping exists in {file}`doc/build-aux/pandoc-filters/link-unix-man-references.lua`. 58 + A few markups for other kinds of literals are also available: 59 + 60 + - `` {command}`rm -rfi` `` turns into {command}`rm -rfi` 61 + - `` {option}`networking.useDHCP` `` turns into {option}`networking.useDHCP` 62 + - `` {file}`/etc/passwd` `` turns into {file}`/etc/passwd` 63 + 64 + These literal kinds are used mostly in NixOS option documentation. 59 65 60 66 This syntax is taken from [MyST](https://myst-parser.readthedocs.io/en/latest/syntax/syntax.html#roles-an-in-line-extension-point). Though, the feature originates from [reStructuredText](https://www.sphinx-doc.org/en/master/usage/restructuredtext/roles.html#role-manpage) with slightly different syntax. 67 + 68 + ::: {.note} 69 + Inline roles are available for option documentation. 70 + ::: 61 71 62 72 - []{#ssec-contributing-markup-admonitions} 63 73 **Admonitions**, set off from the text to bring attention to something. ··· 83 93 - [`note`](https://tdg.docbook.org/tdg/5.0/note.html) 84 94 - [`tip`](https://tdg.docbook.org/tdg/5.0/tip.html) 85 95 - [`warning`](https://tdg.docbook.org/tdg/5.0/warning.html) 96 + 97 + ::: {.note} 98 + Admonitions are available for option documentation. 99 + ::: 86 100 87 101 - []{#ssec-contributing-markup-definition-lists} 88 102 [**Definition lists**](https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/definition_lists.md), for defining a group of terms:
+2 -1
lib/default.nix
··· 131 131 getValues getFiles 132 132 optionAttrSetToDocList optionAttrSetToDocList' 133 133 scrubOptionValue literalExpression literalExample literalDocBook 134 - showOption showFiles unknownModule mkOption mkPackageOption; 134 + showOption showFiles unknownModule mkOption mkPackageOption 135 + mdDoc literalMD; 135 136 inherit (self.types) isType setType defaultTypeMerge defaultFunctor 136 137 isOptionType mkOptionType; 137 138 inherit (self.asserts)
+15
lib/options.nix
··· 280 280 if ! isString text then throw "literalDocBook expects a string." 281 281 else { _type = "literalDocBook"; inherit text; }; 282 282 283 + /* Transition marker for documentation that's already migrated to markdown 284 + syntax. 285 + */ 286 + mdDoc = text: 287 + if ! isString text then throw "mdDoc expects a string." 288 + else { _type = "mdDoc"; inherit text; }; 289 + 290 + /* For use in the `defaultText` and `example` option attributes. Causes the 291 + given MD text to be inserted verbatim in the documentation, for when 292 + a `literalExpression` would be too hard to read. 293 + */ 294 + literalMD = text: 295 + if ! isString text then throw "literalMD expects a string." 296 + else { _type = "literalMD"; inherit text; }; 297 + 283 298 # Helper functions. 284 299 285 300 /* Convert an option, described as a list of the option parts in to a
+8 -1
nixos/doc/manual/development/option-declarations.section.md
··· 56 56 `description` 57 57 58 58 : A textual description of the option, in DocBook format, that will be 59 - included in the NixOS manual. 59 + included in the NixOS manual. During the migration process from DocBook 60 + to CommonMark the description may also be written in CommonMark, but has 61 + to be wrapped in `lib.mdDoc` to differentiate it from DocBook. See 62 + the nixpkgs manual for [the list of CommonMark extensions]( 63 + https://nixos.org/nixpkgs/manual/#sec-contributing-markup) 64 + supported by NixOS documentation. 65 + 66 + New documentation should preferably be written as CommonMark. 60 67 61 68 ## Utility functions for common option patterns {#sec-option-declarations-util} 62 69
+11 -1
nixos/doc/manual/from_md/development/option-declarations.section.xml
··· 94 94 <listitem> 95 95 <para> 96 96 A textual description of the option, in DocBook format, that 97 - will be included in the NixOS manual. 97 + will be included in the NixOS manual. During the migration 98 + process from DocBook to CommonMark the description may also be 99 + written in CommonMark, but has to be wrapped in 100 + <literal>lib.mdDoc</literal> to differentiate it from DocBook. 101 + See the nixpkgs manual for 102 + <link xlink:href="https://nixos.org/nixpkgs/manual/#sec-contributing-markup">the 103 + list of CommonMark extensions</link> supported by NixOS 104 + documentation. 105 + </para> 106 + <para> 107 + New documentation should preferably be written as CommonMark. 98 108 </para> 99 109 </listitem> 100 110 </varlistentry>
+15 -3
nixos/lib/make-options-doc/default.nix
··· 112 112 113 113 optionsJSON = pkgs.runCommand "options.json" 114 114 { meta.description = "List of NixOS options in JSON format"; 115 - buildInputs = [ pkgs.brotli ]; 115 + buildInputs = [ 116 + pkgs.brotli 117 + (let 118 + self = (pkgs.python3Minimal.override { 119 + inherit self; 120 + includeSiteCustomize = true; 121 + }); 122 + in self.withPackages (p: [ p.mistune_2_0 ])) 123 + ]; 116 124 options = builtins.toFile "options.json" 117 125 (builtins.unsafeDiscardStringContext (builtins.toJSON optionsNix)); 118 126 } ··· 123 131 124 132 ${ 125 133 if baseOptionsJSON == null 126 - then "cp $options $dst/options.json" 134 + then '' 135 + # `cp $options $dst/options.json`, but with temporary 136 + # markdown processing 137 + python ${./mergeJSON.py} $options <(echo '{}') > $dst/options.json 138 + '' 127 139 else '' 128 - ${pkgs.python3Minimal}/bin/python ${./mergeJSON.py} \ 140 + python ${./mergeJSON.py} \ 129 141 ${lib.optionalString warningsAreErrors "--warnings-are-errors"} \ 130 142 ${baseOptionsJSON} $options \ 131 143 > $dst/options.json
+145 -1
nixos/lib/make-options-doc/mergeJSON.py
··· 41 41 result[opt.name] = opt.value 42 42 return result 43 43 44 + # converts in-place! 45 + def convertMD(options: Dict[str, Any]) -> str: 46 + import mistune 47 + import re 48 + from xml.sax.saxutils import escape, quoteattr 49 + 50 + admonitions = { 51 + '.warning': 'warning', 52 + '.important': 'important', 53 + '.note': 'note' 54 + } 55 + class Renderer(mistune.renderers.BaseRenderer): 56 + def _get_method(self, name): 57 + try: 58 + return super(Renderer, self)._get_method(name) 59 + except AttributeError: 60 + def not_supported(children, **kwargs): 61 + raise NotImplementedError("md node not supported yet", name, children, **kwargs) 62 + return not_supported 63 + 64 + def text(self, text): 65 + return escape(text) 66 + def paragraph(self, text): 67 + return text + "\n\n" 68 + def codespan(self, text): 69 + return f"<literal>{text}</literal>" 70 + def block_code(self, text, info=None): 71 + info = f" language={quoteattr(info)}" if info is not None else "" 72 + return f"<programlisting{info}>\n{text}</programlisting>" 73 + def link(self, link, text=None, title=None): 74 + if link[0:1] == '#': 75 + attr = "linkend" 76 + link = quoteattr(link[1:]) 77 + else: 78 + # try to faithfully reproduce links that were of the form <link href="..."/> 79 + # in docbook format 80 + if text == link: 81 + text = "" 82 + attr = "xlink:href" 83 + link = quoteattr(link) 84 + return f"<link {attr}={link}>{text}</link>" 85 + def list(self, text, ordered, level, start=None): 86 + if ordered: 87 + raise NotImplementedError("ordered lists not supported yet") 88 + return f"<itemizedlist>\n{text}\n</itemizedlist>" 89 + def list_item(self, text, level): 90 + return f"<listitem><para>{text}</para></listitem>\n" 91 + def block_text(self, text): 92 + return text 93 + def emphasis(self, text): 94 + return f"<emphasis>{text}</emphasis>" 95 + def strong(self, text): 96 + return f"<emphasis role=\"strong\">{text}</emphasis>" 97 + def admonition(self, text, kind): 98 + if kind not in admonitions: 99 + raise NotImplementedError(f"admonition {kind} not supported yet") 100 + tag = admonitions[kind] 101 + # we don't keep whitespace here because usually we'll contain only 102 + # a single paragraph and the original docbook string is no longer 103 + # available to restore the trailer. 104 + return f"<{tag}><para>{text.rstrip()}</para></{tag}>" 105 + def command(self, text): 106 + return f"<command>{escape(text)}</command>" 107 + def option(self, text): 108 + return f"<option>{escape(text)}</option>" 109 + def file(self, text): 110 + return f"<filename>{escape(text)}</filename>" 111 + def manpage(self, page, section): 112 + title = f"<refentrytitle>{escape(page)}</refentrytitle>" 113 + vol = f"<manvolnum>{escape(section)}</manvolnum>" 114 + return f"<citerefentry>{title}{vol}</citerefentry>" 115 + 116 + def finalize(self, data): 117 + return "".join(data) 118 + 119 + plugins = [] 120 + 121 + COMMAND_PATTERN = r'\{command\}`(.*?)`' 122 + def command(md): 123 + def parse(self, m, state): 124 + return ('command', m.group(1)) 125 + md.inline.register_rule('command', COMMAND_PATTERN, parse) 126 + md.inline.rules.append('command') 127 + plugins.append(command) 128 + 129 + FILE_PATTERN = r'\{file\}`(.*?)`' 130 + def file(md): 131 + def parse(self, m, state): 132 + return ('file', m.group(1)) 133 + md.inline.register_rule('file', FILE_PATTERN, parse) 134 + md.inline.rules.append('file') 135 + plugins.append(file) 136 + 137 + OPTION_PATTERN = r'\{option\}`(.*?)`' 138 + def option(md): 139 + def parse(self, m, state): 140 + return ('option', m.group(1)) 141 + md.inline.register_rule('option', OPTION_PATTERN, parse) 142 + md.inline.rules.append('option') 143 + plugins.append(option) 144 + 145 + MANPAGE_PATTERN = r'\{manpage\}`(.*?)\((.+?)\)`' 146 + def manpage(md): 147 + def parse(self, m, state): 148 + return ('manpage', m.group(1), m.group(2)) 149 + md.inline.register_rule('manpage', MANPAGE_PATTERN, parse) 150 + md.inline.rules.append('manpage') 151 + plugins.append(manpage) 152 + 153 + ADMONITION_PATTERN = re.compile(r'^::: \{([^\n]*?)\}\n(.*?)^:::\n', flags=re.MULTILINE|re.DOTALL) 154 + def admonition(md): 155 + def parse(self, m, state): 156 + return { 157 + 'type': 'admonition', 158 + 'children': self.parse(m.group(2), state), 159 + 'params': [ m.group(1) ], 160 + } 161 + md.block.register_rule('admonition', ADMONITION_PATTERN, parse) 162 + md.block.rules.append('admonition') 163 + plugins.append(admonition) 164 + 165 + def convertString(text: str) -> str: 166 + rendered = mistune.markdown(text, renderer=Renderer(), plugins=plugins) 167 + # keep trailing spaces so we can diff the generated XML to check for conversion bugs. 168 + return rendered.rstrip() + text[len(text.rstrip()):] 169 + 170 + def optionIs(option: Dict[str, Any], key: str, typ: str) -> bool: 171 + if key not in option: return False 172 + if type(option[key]) != dict: return False 173 + if '_type' not in option[key]: return False 174 + return option[key]['_type'] == typ 175 + 176 + for (name, option) in options.items(): 177 + if optionIs(option, 'description', 'mdDoc'): 178 + option['description'] = convertString(option['description']['text']) 179 + if optionIs(option, 'example', 'literalMD'): 180 + docbook = convertString(option['example']['text']) 181 + option['example'] = { '_type': 'literalDocBook', 'text': docbook } 182 + if optionIs(option, 'default', 'literalMD'): 183 + docbook = convertString(option['default']['text']) 184 + option['default'] = { '_type': 'literalDocBook', 'text': docbook } 185 + 186 + return options 187 + 44 188 warningsAreErrors = sys.argv[1] == "--warnings-are-errors" 45 189 optOffset = 1 if warningsAreErrors else 0 46 190 options = pivot(json.load(open(sys.argv[1 + optOffset], 'r'))) ··· 92 236 file=sys.stderr) 93 237 sys.exit(1) 94 238 95 - json.dump(unpivot(options), fp=sys.stdout) 239 + json.dump(convertMD(unpivot(options)), fp=sys.stdout)
+2 -2
nixos/modules/config/console.nix
··· 46 46 type = with types; either str path; 47 47 default = "Lat2-Terminus16"; 48 48 example = "LatArCyrHeb-16"; 49 - description = '' 49 + description = mdDoc '' 50 50 The font used for the virtual consoles. Leave empty to use 51 - whatever the <command>setfont</command> program considers the 51 + whatever the {command}`setfont` program considers the 52 52 default font. 53 53 Can be either a font name or a path to a PSF font file. 54 54 '';
+9 -10
nixos/modules/config/debug-info.nix
··· 9 9 environment.enableDebugInfo = mkOption { 10 10 type = types.bool; 11 11 default = false; 12 - description = '' 12 + description = mdDoc '' 13 13 Some NixOS packages provide debug symbols. However, these are 14 14 not included in the system closure by default to save disk 15 15 space. Enabling this option causes the debug symbols to appear 16 - in <filename>/run/current-system/sw/lib/debug/.build-id</filename>, 17 - where tools such as <command>gdb</command> can find them. 16 + in {file}`/run/current-system/sw/lib/debug/.build-id`, 17 + where tools such as {command}`gdb` can find them. 18 18 If you need debug symbols for a package that doesn't 19 19 provide them by default, you can enable them as follows: 20 - <programlisting> 21 - nixpkgs.config.packageOverrides = pkgs: { 22 - hello = pkgs.hello.overrideAttrs (oldAttrs: { 23 - separateDebugInfo = true; 24 - }); 25 - }; 26 - </programlisting> 20 + 21 + nixpkgs.config.packageOverrides = pkgs: { 22 + hello = pkgs.hello.overrideAttrs (oldAttrs: { 23 + separateDebugInfo = true; 24 + }); 25 + }; 27 26 ''; 28 27 }; 29 28
+11 -20
nixos/modules/misc/documentation.nix
··· 178 178 man.generateCaches = mkOption { 179 179 type = types.bool; 180 180 default = false; 181 - description = '' 181 + description = mdDoc '' 182 182 Whether to generate the manual page index caches. 183 183 This allows searching for a page or 184 - keyword using utilities like 185 - <citerefentry> 186 - <refentrytitle>apropos</refentrytitle> 187 - <manvolnum>1</manvolnum> 188 - </citerefentry> 189 - and the <literal>-k</literal> option of 190 - <citerefentry> 191 - <refentrytitle>man</refentrytitle> 192 - <manvolnum>1</manvolnum> 193 - </citerefentry>. 184 + keyword using utilities like {manpage}`apropos(1)` 185 + and the `-k` option of 186 + {manpage}`man(1)`. 194 187 ''; 195 188 }; 196 189 ··· 216 209 dev.enable = mkOption { 217 210 type = types.bool; 218 211 default = false; 219 - description = '' 212 + description = mdDoc '' 220 213 Whether to install documentation targeted at developers. 221 - <itemizedlist> 222 - <listitem><para>This includes man pages targeted at developers if <option>documentation.man.enable</option> is 223 - set (this also includes "devman" outputs).</para></listitem> 224 - <listitem><para>This includes info pages targeted at developers if <option>documentation.info.enable</option> 225 - is set (this also includes "devinfo" outputs).</para></listitem> 226 - <listitem><para>This includes other pages targeted at developers if <option>documentation.doc.enable</option> 227 - is set (this also includes "devdoc" outputs).</para></listitem> 228 - </itemizedlist> 214 + * This includes man pages targeted at developers if {option}`documentation.man.enable` is 215 + set (this also includes "devman" outputs). 216 + * This includes info pages targeted at developers if {option}`documentation.info.enable` 217 + is set (this also includes "devinfo" outputs). 218 + * This includes other pages targeted at developers if {option}`documentation.doc.enable` 219 + is set (this also includes "devdoc" outputs). 229 220 ''; 230 221 }; 231 222
+4 -4
nixos/modules/misc/man-db.nix
··· 23 23 ++ lib.optionals config.documentation.dev.enable [ "devman" ]; 24 24 ignoreCollisions = true; 25 25 }; 26 - defaultText = lib.literalDocBook "all man pages in <option>config.environment.systemPackages</option>"; 27 - description = '' 28 - The manual pages to generate caches for if <option>documentation.man.generateCaches</option> 26 + defaultText = lib.literalMD "all man pages in {option}`config.environment.systemPackages`"; 27 + description = lib.mdDoc '' 28 + The manual pages to generate caches for if {option}`documentation.man.generateCaches` 29 29 is enabled. Must be a path to a directory with man pages under 30 - <literal>/share/man</literal>; see the source for an example. 30 + `/share/man`; see the source for an example. 31 31 Advanced users can make this a content-addressed derivation to save a few rebuilds. 32 32 ''; 33 33 };
+6 -5
nixos/modules/security/systemd-confinement.nix
··· 22 22 options.confinement.fullUnit = lib.mkOption { 23 23 type = types.bool; 24 24 default = false; 25 - description = '' 25 + description = lib.mdDoc '' 26 26 Whether to include the full closure of the systemd unit file into the 27 27 chroot, instead of just the dependencies for the executables. 28 28 29 - <warning><para>While it may be tempting to just enable this option to 29 + ::: {.warning} 30 + While it may be tempting to just enable this option to 30 31 make things work quickly, please be aware that this might add paths 31 32 to the closure of the chroot that you didn't anticipate. It's better 32 - to use <option>confinement.packages</option> to <emphasis 33 - role="strong">explicitly</emphasis> add additional store paths to the 34 - chroot.</para></warning> 33 + to use {option}`confinement.packages` to **explicitly** add additional store paths to the 34 + chroot. 35 + ::: 35 36 ''; 36 37 }; 37 38
+9 -9
nixos/modules/services/matrix/synapse.nix
··· 191 191 192 192 settings = mkOption { 193 193 default = {}; 194 - description = '' 194 + description = mdDoc '' 195 195 The primary synapse configuration. See the 196 - <link xlink:href="https://github.com/matrix-org/synapse/blob/v${cfg.package.version}/docs/sample_config.yaml">sample configuration</link> 196 + [sample configuration](https://github.com/matrix-org/synapse/blob/v${cfg.package.version}/docs/sample_config.yaml) 197 197 for possible values. 198 198 199 - Secrets should be passed in by using the <literal>extraConfigFiles</literal> option. 199 + Secrets should be passed in by using the `extraConfigFiles` option. 200 200 ''; 201 201 type = with types; submodule { 202 202 freeformType = format.type; ··· 230 230 registration_shared_secret = mkOption { 231 231 type = types.nullOr types.str; 232 232 default = null; 233 - description = '' 233 + description = mdDoc '' 234 234 If set, allows registration by anyone who also has the shared 235 235 secret, even if registration is otherwise disabled. 236 236 237 - Secrets should be passed in via <literal>extraConfigFiles</literal>! 237 + Secrets should be passed in via `extraConfigFiles`! 238 238 ''; 239 239 }; 240 240 241 241 macaroon_secret_key = mkOption { 242 242 type = types.nullOr types.str; 243 243 default = null; 244 - description = '' 244 + description = mdDoc '' 245 245 Secret key for authentication tokens. If none is specified, 246 246 the registration_shared_secret is used, if one is given; otherwise, 247 247 a secret key is derived from the signing key. 248 248 249 - Secrets should be passed in via <literal>extraConfigFiles</literal>! 249 + Secrets should be passed in via `extraConfigFiles`! 250 250 ''; 251 251 }; 252 252 ··· 620 620 example = literalExpression '' 621 621 config.services.coturn.static-auth-secret 622 622 ''; 623 - description = '' 623 + description = mdDoc '' 624 624 The shared secret used to compute passwords for the TURN server. 625 625 626 - Secrets should be passed in via <literal>extraConfigFiles</literal>! 626 + Secrets should be passed in via `extraConfigFiles`! 627 627 ''; 628 628 }; 629 629
+20 -20
nixos/modules/services/networking/mosquitto.nix
··· 54 54 hashedPassword = mkOption { 55 55 type = uniq (nullOr str); 56 56 default = null; 57 - description = '' 57 + description = mdDoc '' 58 58 Specifies the hashed password for the MQTT User. 59 - To generate hashed password install <literal>mosquitto</literal> 60 - package and use <literal>mosquitto_passwd</literal>. 59 + To generate hashed password install `mosquitto` 60 + package and use `mosquitto_passwd`. 61 61 ''; 62 62 }; 63 63 ··· 65 65 type = uniq (nullOr types.path); 66 66 example = "/path/to/file"; 67 67 default = null; 68 - description = '' 68 + description = mdDoc '' 69 69 Specifies the path to a file containing the 70 70 hashed password for the MQTT user. 71 - To generate hashed password install <literal>mosquitto</literal> 72 - package and use <literal>mosquitto_passwd</literal>. 71 + To generate hashed password install `mosquitto` 72 + package and use `mosquitto_passwd`. 73 73 ''; 74 74 }; 75 75 ··· 155 155 options = { 156 156 plugin = mkOption { 157 157 type = path; 158 - description = '' 159 - Plugin path to load, should be a <literal>.so</literal> file. 158 + description = mdDoc '' 159 + Plugin path to load, should be a `.so` file. 160 160 ''; 161 161 }; 162 162 163 163 denySpecialChars = mkOption { 164 164 type = bool; 165 - description = '' 166 - Automatically disallow all clients using <literal>#</literal> 167 - or <literal>+</literal> in their name/id. 165 + description = mdDoc '' 166 + Automatically disallow all clients using `#` 167 + or `+` in their name/id. 168 168 ''; 169 169 default = true; 170 170 }; 171 171 172 172 options = mkOption { 173 173 type = attrsOf optionType; 174 - description = '' 175 - Options for the auth plugin. Each key turns into a <literal>auth_opt_*</literal> 174 + description = mdDoc '' 175 + Options for the auth plugin. Each key turns into a `auth_opt_*` 176 176 line in the config. 177 177 ''; 178 178 default = {}; ··· 239 239 240 240 address = mkOption { 241 241 type = nullOr str; 242 - description = '' 243 - Address to listen on. Listen on <literal>0.0.0.0</literal>/<literal>::</literal> 242 + description = mdDoc '' 243 + Address to listen on. Listen on `0.0.0.0`/`::` 244 244 when unset. 245 245 ''; 246 246 default = null; ··· 248 248 249 249 authPlugins = mkOption { 250 250 type = listOf authPluginOptions; 251 - description = '' 251 + description = mdDoc '' 252 252 Authentication plugin to attach to this listener. 253 - Refer to the <link xlink:href="https://mosquitto.org/man/mosquitto-conf-5.html"> 254 - mosquitto.conf documentation</link> for details on authentication plugins. 253 + Refer to the [mosquitto.conf documentation](https://mosquitto.org/man/mosquitto-conf-5.html) 254 + for details on authentication plugins. 255 255 ''; 256 256 default = []; 257 257 }; ··· 472 472 473 473 includeDirs = mkOption { 474 474 type = listOf path; 475 - description = '' 475 + description = mdDoc '' 476 476 Directories to be scanned for further config files to include. 477 477 Directories will processed in the order given, 478 - <literal>*.conf</literal> files in the directory will be 478 + `*.conf` files in the directory will be 479 479 read in case-sensistive alphabetical order. 480 480 ''; 481 481 default = [];
+48 -60
nixos/modules/services/networking/syncthing.nix
··· 72 72 cert = mkOption { 73 73 type = types.nullOr types.str; 74 74 default = null; 75 - description = '' 76 - Path to the <literal>cert.pem</literal> file, which will be copied into Syncthing's 77 - <link linkend="opt-services.syncthing.configDir">configDir</link>. 75 + description = mdDoc '' 76 + Path to the `cert.pem` file, which will be copied into Syncthing's 77 + [configDir](#opt-services.syncthing.configDir). 78 78 ''; 79 79 }; 80 80 81 81 key = mkOption { 82 82 type = types.nullOr types.str; 83 83 default = null; 84 - description = '' 85 - Path to the <literal>key.pem</literal> file, which will be copied into Syncthing's 86 - <link linkend="opt-services.syncthing.configDir">configDir</link>. 84 + description = mdDoc '' 85 + Path to the `key.pem` file, which will be copied into Syncthing's 86 + [configDir](#opt-services.syncthing.configDir). 87 87 ''; 88 88 }; 89 89 90 90 overrideDevices = mkOption { 91 91 type = types.bool; 92 92 default = true; 93 - description = '' 93 + description = mdDoc '' 94 94 Whether to delete the devices which are not configured via the 95 - <link linkend="opt-services.syncthing.devices">devices</link> option. 96 - If set to <literal>false</literal>, devices added via the web 95 + [devices](#opt-services.syncthing.devices) option. 96 + If set to `false`, devices added via the web 97 97 interface will persist and will have to be deleted manually. 98 98 ''; 99 99 }; 100 100 101 101 devices = mkOption { 102 102 default = {}; 103 - description = '' 103 + description = mdDoc '' 104 104 Peers/devices which Syncthing should communicate with. 105 105 106 106 Note that you can still add devices manually, but those changes 107 - will be reverted on restart if <link linkend="opt-services.syncthing.overrideDevices">overrideDevices</link> 107 + will be reverted on restart if [overrideDevices](#opt-services.syncthing.overrideDevices) 108 108 is enabled. 109 109 ''; 110 110 example = { ··· 135 135 136 136 id = mkOption { 137 137 type = types.str; 138 - description = '' 139 - The device ID. See <link xlink:href="https://docs.syncthing.net/dev/device-ids.html"/>. 138 + description = mdDoc '' 139 + The device ID. See <https://docs.syncthing.net/dev/device-ids.html>. 140 140 ''; 141 141 }; 142 142 143 143 introducer = mkOption { 144 144 type = types.bool; 145 145 default = false; 146 - description = '' 146 + description = mdDoc '' 147 147 Whether the device should act as an introducer and be allowed 148 148 to add folders on this computer. 149 - See <link xlink:href="https://docs.syncthing.net/users/introducer.html"/>. 149 + See <https://docs.syncthing.net/users/introducer.html>. 150 150 ''; 151 151 }; 152 152 153 153 autoAcceptFolders = mkOption { 154 154 type = types.bool; 155 155 default = false; 156 - description = '' 156 + description = mdDoc '' 157 157 Automatically create or share folders that this device advertises at the default path. 158 - See <link xlink:href="https://docs.syncthing.net/users/config.html?highlight=autoaccept#config-file-format"/>. 158 + See <https://docs.syncthing.net/users/config.html?highlight=autoaccept#config-file-format>. 159 159 ''; 160 160 }; 161 161 ··· 166 166 overrideFolders = mkOption { 167 167 type = types.bool; 168 168 default = true; 169 - description = '' 169 + description = mdDoc '' 170 170 Whether to delete the folders which are not configured via the 171 - <link linkend="opt-services.syncthing.folders">folders</link> option. 172 - If set to <literal>false</literal>, folders added via the web 171 + [folders](#opt-services.syncthing.folders) option. 172 + If set to `false`, folders added via the web 173 173 interface will persist and will have to be deleted manually. 174 174 ''; 175 175 }; 176 176 177 177 folders = mkOption { 178 178 default = {}; 179 - description = '' 179 + description = mdDoc '' 180 180 Folders which should be shared by Syncthing. 181 181 182 182 Note that you can still add devices manually, but those changes 183 - will be reverted on restart if <link linkend="opt-services.syncthing.overrideDevices">overrideDevices</link> 183 + will be reverted on restart if [overrideDevices](#opt-services.syncthing.overrideDevices) 184 184 is enabled. 185 185 ''; 186 186 example = literalExpression '' ··· 231 231 devices = mkOption { 232 232 type = types.listOf types.str; 233 233 default = []; 234 - description = '' 234 + description = mdDoc '' 235 235 The devices this folder should be shared with. Each device must 236 - be defined in the <link linkend="opt-services.syncthing.devices">devices</link> option. 236 + be defined in the [devices](#opt-services.syncthing.devices) option. 237 237 ''; 238 238 }; 239 239 240 240 versioning = mkOption { 241 241 default = null; 242 - description = '' 242 + description = mdDoc '' 243 243 How to keep changed/deleted files with Syncthing. 244 244 There are 4 different types of versioning with different parameters. 245 - See <link xlink:href="https://docs.syncthing.net/users/versioning.html"/>. 245 + See <https://docs.syncthing.net/users/versioning.html>. 246 246 ''; 247 247 example = literalExpression '' 248 248 [ ··· 284 284 options = { 285 285 type = mkOption { 286 286 type = enum [ "external" "simple" "staggered" "trashcan" ]; 287 - description = '' 287 + description = mdDoc '' 288 288 The type of versioning. 289 - See <link xlink:href="https://docs.syncthing.net/users/versioning.html"/>. 289 + See <https://docs.syncthing.net/users/versioning.html>. 290 290 ''; 291 291 }; 292 292 params = mkOption { 293 293 type = attrsOf (either str path); 294 - description = '' 294 + description = mdDoc '' 295 295 The parameters for versioning. Structure depends on 296 - <link linkend="opt-services.syncthing.folders._name_.versioning.type">versioning.type</link>. 297 - See <link xlink:href="https://docs.syncthing.net/users/versioning.html"/>. 296 + [versioning.type](#opt-services.syncthing.folders._name_.versioning.type). 297 + See <https://docs.syncthing.net/users/versioning.html>. 298 298 ''; 299 299 }; 300 300 }; ··· 345 345 ignoreDelete = mkOption { 346 346 type = types.bool; 347 347 default = false; 348 - description = '' 348 + description = mdDoc '' 349 349 Whether to skip deleting files that are deleted by peers. 350 - See <link xlink:href="https://docs.syncthing.net/advanced/folder-ignoredelete.html"/>. 350 + See <https://docs.syncthing.net/advanced/folder-ignoredelete.html>. 351 351 ''; 352 352 }; 353 353 }; ··· 357 357 extraOptions = mkOption { 358 358 type = types.addCheck (pkgs.formats.json {}).type isAttrs; 359 359 default = {}; 360 - description = '' 360 + description = mdDoc '' 361 361 Extra configuration options for Syncthing. 362 - See <link xlink:href="https://docs.syncthing.net/users/config.html"/>. 362 + See <https://docs.syncthing.net/users/config.html>. 363 363 ''; 364 364 example = { 365 365 options.localAnnounceEnabled = false; ··· 387 387 type = types.str; 388 388 default = defaultUser; 389 389 example = "yourUser"; 390 - description = '' 390 + description = mdDoc '' 391 391 The user to run Syncthing as. 392 - By default, a user named <literal>${defaultUser}</literal> will be created. 392 + By default, a user named `${defaultUser}` will be created. 393 393 ''; 394 394 }; 395 395 ··· 397 397 type = types.str; 398 398 default = defaultGroup; 399 399 example = "yourGroup"; 400 - description = '' 400 + description = mdDoc '' 401 401 The group to run Syncthing under. 402 - By default, a group named <literal>${defaultGroup}</literal> will be created. 402 + By default, a group named `${defaultGroup}` will be created. 403 403 ''; 404 404 }; 405 405 ··· 407 407 type = with types; nullOr str; 408 408 default = null; 409 409 example = "socks5://address.com:1234"; 410 - description = '' 410 + description = mdDoc '' 411 411 Overwrites the all_proxy environment variable for the Syncthing process to 412 412 the given value. This is normally used to let Syncthing connect 413 413 through a SOCKS5 proxy server. 414 - See <link xlink:href="https://docs.syncthing.net/users/proxying.html"/>. 414 + See <https://docs.syncthing.net/users/proxying.html>. 415 415 ''; 416 416 }; 417 417 ··· 432 432 The path where the settings and keys will exist. 433 433 ''; 434 434 default = cfg.dataDir + optionalString cond "/.config/syncthing"; 435 - defaultText = literalDocBook '' 436 - <variablelist> 437 - <varlistentry> 438 - <term><literal>stateVersion >= 19.03</literal></term> 439 - <listitem> 440 - <programlisting> 441 - config.${opt.dataDir} + "/.config/syncthing" 442 - </programlisting> 443 - </listitem> 444 - </varlistentry> 445 - <varlistentry> 446 - <term>otherwise</term> 447 - <listitem> 448 - <programlisting> 449 - config.${opt.dataDir} 450 - </programlisting> 451 - </listitem> 452 - </varlistentry> 453 - </variablelist> 435 + defaultText = literalMD '' 436 + * if `stateVersion >= 19.03`: 437 + 438 + config.${opt.dataDir} + "/.config/syncthing" 439 + * otherwise: 440 + 441 + config.${opt.dataDir} 454 442 ''; 455 443 }; 456 444
+3 -3
nixos/modules/virtualisation/xen-dom0.nix
··· 23 23 default = false; 24 24 type = types.bool; 25 25 description = 26 - '' 26 + mdDoc '' 27 27 Setting this option enables the Xen hypervisor, a 28 28 virtualisation technology that allows multiple virtual 29 - machines, known as <emphasis>domains</emphasis>, to run 29 + machines, known as *domains*, to run 30 30 concurrently on the physical machine. NixOS runs as the 31 - privileged <emphasis>Domain 0</emphasis>. This option 31 + privileged *Domain 0*. This option 32 32 requires a reboot to take effect. 33 33 ''; 34 34 };