···2727 content = '<refentrytitle>' .. title .. '</refentrytitle>' .. (volnum ~= nil and ('<manvolnum>' .. volnum .. '</manvolnum>') or '')
2828 elseif elem.attributes['role'] == 'file' then
2929 tag = 'filename'
3030+ elseif elem.attributes['role'] == 'command' then
3131+ tag = 'command'
3232+ elseif elem.attributes['role'] == 'option' then
3333+ tag = 'option'
3034 end
31353236 if tag ~= nil then
···27272828As per [RFC 0072](https://github.com/NixOS/rfcs/pull/72), all new documentation content should be written in [CommonMark](https://commonmark.org/) Markdown dialect.
29293030-Additionally, the following syntax extensions are currently used:
3030+Additional syntax extensions are available, though not all extensions can be used in NixOS option documentation. The following extensions are currently used:
31313232- []{#ssec-contributing-markup-anchors}
3333 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).
···5353 This syntax is taken from [MyST](https://myst-parser.readthedocs.io/en/latest/using/syntax.html#targets-and-cross-referencing).
54545555- []{#ssec-contributing-markup-inline-roles}
5656- If you want to link to a man page, you can use `` {manpage}`nix.conf(5)` ``, which will turn into {manpage}`nix.conf(5)`.
5656+ 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`.
57575858- The references will turn into links when a mapping exists in {file}`doc/build-aux/pandoc-filters/link-unix-man-references.lua`.
5858+ A few markups for other kinds of literals are also available:
5959+6060+ - `` {command}`rm -rfi` `` turns into {command}`rm -rfi`
6161+ - `` {option}`networking.useDHCP` `` turns into {option}`networking.useDHCP`
6262+ - `` {file}`/etc/passwd` `` turns into {file}`/etc/passwd`
6363+6464+ These literal kinds are used mostly in NixOS option documentation.
59656066 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.
6767+6868+ ::: {.note}
6969+ Inline roles are available for option documentation.
7070+ :::
61716272- []{#ssec-contributing-markup-admonitions}
6373 **Admonitions**, set off from the text to bring attention to something.
···8393 - [`note`](https://tdg.docbook.org/tdg/5.0/note.html)
8494 - [`tip`](https://tdg.docbook.org/tdg/5.0/tip.html)
8595 - [`warning`](https://tdg.docbook.org/tdg/5.0/warning.html)
9696+9797+ ::: {.note}
9898+ Admonitions are available for option documentation.
9999+ :::
8610087101- []{#ssec-contributing-markup-definition-lists}
88102 [**Definition lists**](https://github.com/jgm/commonmark-hs/blob/master/commonmark-extensions/test/definition_lists.md), for defining a group of terms:
···280280 if ! isString text then throw "literalDocBook expects a string."
281281 else { _type = "literalDocBook"; inherit text; };
282282283283+ /* Transition marker for documentation that's already migrated to markdown
284284+ syntax.
285285+ */
286286+ mdDoc = text:
287287+ if ! isString text then throw "mdDoc expects a string."
288288+ else { _type = "mdDoc"; inherit text; };
289289+290290+ /* For use in the `defaultText` and `example` option attributes. Causes the
291291+ given MD text to be inserted verbatim in the documentation, for when
292292+ a `literalExpression` would be too hard to read.
293293+ */
294294+ literalMD = text:
295295+ if ! isString text then throw "literalMD expects a string."
296296+ else { _type = "literalMD"; inherit text; };
297297+283298 # Helper functions.
284299285300 /* Convert an option, described as a list of the option parts in to a
···5656`description`
57575858: A textual description of the option, in DocBook format, that will be
5959- included in the NixOS manual.
5959+ included in the NixOS manual. During the migration process from DocBook
6060+ to CommonMark the description may also be written in CommonMark, but has
6161+ to be wrapped in `lib.mdDoc` to differentiate it from DocBook. See
6262+ the nixpkgs manual for [the list of CommonMark extensions](
6363+ https://nixos.org/nixpkgs/manual/#sec-contributing-markup)
6464+ supported by NixOS documentation.
6565+6666+ New documentation should preferably be written as CommonMark.
60676168## Utility functions for common option patterns {#sec-option-declarations-util}
6269
···9494 <listitem>
9595 <para>
9696 A textual description of the option, in DocBook format, that
9797- will be included in the NixOS manual.
9797+ will be included in the NixOS manual. During the migration
9898+ process from DocBook to CommonMark the description may also be
9999+ written in CommonMark, but has to be wrapped in
100100+ <literal>lib.mdDoc</literal> to differentiate it from DocBook.
101101+ See the nixpkgs manual for
102102+ <link xlink:href="https://nixos.org/nixpkgs/manual/#sec-contributing-markup">the
103103+ list of CommonMark extensions</link> supported by NixOS
104104+ documentation.
105105+ </para>
106106+ <para>
107107+ New documentation should preferably be written as CommonMark.
98108 </para>
99109 </listitem>
100110 </varlistentry>
···4141 result[opt.name] = opt.value
4242 return result
43434444+# converts in-place!
4545+def convertMD(options: Dict[str, Any]) -> str:
4646+ import mistune
4747+ import re
4848+ from xml.sax.saxutils import escape, quoteattr
4949+5050+ admonitions = {
5151+ '.warning': 'warning',
5252+ '.important': 'important',
5353+ '.note': 'note'
5454+ }
5555+ class Renderer(mistune.renderers.BaseRenderer):
5656+ def _get_method(self, name):
5757+ try:
5858+ return super(Renderer, self)._get_method(name)
5959+ except AttributeError:
6060+ def not_supported(children, **kwargs):
6161+ raise NotImplementedError("md node not supported yet", name, children, **kwargs)
6262+ return not_supported
6363+6464+ def text(self, text):
6565+ return escape(text)
6666+ def paragraph(self, text):
6767+ return text + "\n\n"
6868+ def codespan(self, text):
6969+ return f"<literal>{text}</literal>"
7070+ def block_code(self, text, info=None):
7171+ info = f" language={quoteattr(info)}" if info is not None else ""
7272+ return f"<programlisting{info}>\n{text}</programlisting>"
7373+ def link(self, link, text=None, title=None):
7474+ if link[0:1] == '#':
7575+ attr = "linkend"
7676+ link = quoteattr(link[1:])
7777+ else:
7878+ # try to faithfully reproduce links that were of the form <link href="..."/>
7979+ # in docbook format
8080+ if text == link:
8181+ text = ""
8282+ attr = "xlink:href"
8383+ link = quoteattr(link)
8484+ return f"<link {attr}={link}>{text}</link>"
8585+ def list(self, text, ordered, level, start=None):
8686+ if ordered:
8787+ raise NotImplementedError("ordered lists not supported yet")
8888+ return f"<itemizedlist>\n{text}\n</itemizedlist>"
8989+ def list_item(self, text, level):
9090+ return f"<listitem><para>{text}</para></listitem>\n"
9191+ def block_text(self, text):
9292+ return text
9393+ def emphasis(self, text):
9494+ return f"<emphasis>{text}</emphasis>"
9595+ def strong(self, text):
9696+ return f"<emphasis role=\"strong\">{text}</emphasis>"
9797+ def admonition(self, text, kind):
9898+ if kind not in admonitions:
9999+ raise NotImplementedError(f"admonition {kind} not supported yet")
100100+ tag = admonitions[kind]
101101+ # we don't keep whitespace here because usually we'll contain only
102102+ # a single paragraph and the original docbook string is no longer
103103+ # available to restore the trailer.
104104+ return f"<{tag}><para>{text.rstrip()}</para></{tag}>"
105105+ def command(self, text):
106106+ return f"<command>{escape(text)}</command>"
107107+ def option(self, text):
108108+ return f"<option>{escape(text)}</option>"
109109+ def file(self, text):
110110+ return f"<filename>{escape(text)}</filename>"
111111+ def manpage(self, page, section):
112112+ title = f"<refentrytitle>{escape(page)}</refentrytitle>"
113113+ vol = f"<manvolnum>{escape(section)}</manvolnum>"
114114+ return f"<citerefentry>{title}{vol}</citerefentry>"
115115+116116+ def finalize(self, data):
117117+ return "".join(data)
118118+119119+ plugins = []
120120+121121+ COMMAND_PATTERN = r'\{command\}`(.*?)`'
122122+ def command(md):
123123+ def parse(self, m, state):
124124+ return ('command', m.group(1))
125125+ md.inline.register_rule('command', COMMAND_PATTERN, parse)
126126+ md.inline.rules.append('command')
127127+ plugins.append(command)
128128+129129+ FILE_PATTERN = r'\{file\}`(.*?)`'
130130+ def file(md):
131131+ def parse(self, m, state):
132132+ return ('file', m.group(1))
133133+ md.inline.register_rule('file', FILE_PATTERN, parse)
134134+ md.inline.rules.append('file')
135135+ plugins.append(file)
136136+137137+ OPTION_PATTERN = r'\{option\}`(.*?)`'
138138+ def option(md):
139139+ def parse(self, m, state):
140140+ return ('option', m.group(1))
141141+ md.inline.register_rule('option', OPTION_PATTERN, parse)
142142+ md.inline.rules.append('option')
143143+ plugins.append(option)
144144+145145+ MANPAGE_PATTERN = r'\{manpage\}`(.*?)\((.+?)\)`'
146146+ def manpage(md):
147147+ def parse(self, m, state):
148148+ return ('manpage', m.group(1), m.group(2))
149149+ md.inline.register_rule('manpage', MANPAGE_PATTERN, parse)
150150+ md.inline.rules.append('manpage')
151151+ plugins.append(manpage)
152152+153153+ ADMONITION_PATTERN = re.compile(r'^::: \{([^\n]*?)\}\n(.*?)^:::\n', flags=re.MULTILINE|re.DOTALL)
154154+ def admonition(md):
155155+ def parse(self, m, state):
156156+ return {
157157+ 'type': 'admonition',
158158+ 'children': self.parse(m.group(2), state),
159159+ 'params': [ m.group(1) ],
160160+ }
161161+ md.block.register_rule('admonition', ADMONITION_PATTERN, parse)
162162+ md.block.rules.append('admonition')
163163+ plugins.append(admonition)
164164+165165+ def convertString(text: str) -> str:
166166+ rendered = mistune.markdown(text, renderer=Renderer(), plugins=plugins)
167167+ # keep trailing spaces so we can diff the generated XML to check for conversion bugs.
168168+ return rendered.rstrip() + text[len(text.rstrip()):]
169169+170170+ def optionIs(option: Dict[str, Any], key: str, typ: str) -> bool:
171171+ if key not in option: return False
172172+ if type(option[key]) != dict: return False
173173+ if '_type' not in option[key]: return False
174174+ return option[key]['_type'] == typ
175175+176176+ for (name, option) in options.items():
177177+ if optionIs(option, 'description', 'mdDoc'):
178178+ option['description'] = convertString(option['description']['text'])
179179+ if optionIs(option, 'example', 'literalMD'):
180180+ docbook = convertString(option['example']['text'])
181181+ option['example'] = { '_type': 'literalDocBook', 'text': docbook }
182182+ if optionIs(option, 'default', 'literalMD'):
183183+ docbook = convertString(option['default']['text'])
184184+ option['default'] = { '_type': 'literalDocBook', 'text': docbook }
185185+186186+ return options
187187+44188warningsAreErrors = sys.argv[1] == "--warnings-are-errors"
45189optOffset = 1 if warningsAreErrors else 0
46190options = pivot(json.load(open(sys.argv[1 + optOffset], 'r')))
···92236 file=sys.stderr)
93237 sys.exit(1)
942389595-json.dump(unpivot(options), fp=sys.stdout)
239239+json.dump(convertMD(unpivot(options)), fp=sys.stdout)
+2-2
nixos/modules/config/console.nix
···4646 type = with types; either str path;
4747 default = "Lat2-Terminus16";
4848 example = "LatArCyrHeb-16";
4949- description = ''
4949+ description = mdDoc ''
5050 The font used for the virtual consoles. Leave empty to use
5151- whatever the <command>setfont</command> program considers the
5151+ whatever the {command}`setfont` program considers the
5252 default font.
5353 Can be either a font name or a path to a PSF font file.
5454 '';
+9-10
nixos/modules/config/debug-info.nix
···99 environment.enableDebugInfo = mkOption {
1010 type = types.bool;
1111 default = false;
1212- description = ''
1212+ description = mdDoc ''
1313 Some NixOS packages provide debug symbols. However, these are
1414 not included in the system closure by default to save disk
1515 space. Enabling this option causes the debug symbols to appear
1616- in <filename>/run/current-system/sw/lib/debug/.build-id</filename>,
1717- where tools such as <command>gdb</command> can find them.
1616+ in {file}`/run/current-system/sw/lib/debug/.build-id`,
1717+ where tools such as {command}`gdb` can find them.
1818 If you need debug symbols for a package that doesn't
1919 provide them by default, you can enable them as follows:
2020- <programlisting>
2121- nixpkgs.config.packageOverrides = pkgs: {
2222- hello = pkgs.hello.overrideAttrs (oldAttrs: {
2323- separateDebugInfo = true;
2424- });
2525- };
2626- </programlisting>
2020+2121+ nixpkgs.config.packageOverrides = pkgs: {
2222+ hello = pkgs.hello.overrideAttrs (oldAttrs: {
2323+ separateDebugInfo = true;
2424+ });
2525+ };
2726 '';
2827 };
2928
+11-20
nixos/modules/misc/documentation.nix
···178178 man.generateCaches = mkOption {
179179 type = types.bool;
180180 default = false;
181181- description = ''
181181+ description = mdDoc ''
182182 Whether to generate the manual page index caches.
183183 This allows searching for a page or
184184- keyword using utilities like
185185- <citerefentry>
186186- <refentrytitle>apropos</refentrytitle>
187187- <manvolnum>1</manvolnum>
188188- </citerefentry>
189189- and the <literal>-k</literal> option of
190190- <citerefentry>
191191- <refentrytitle>man</refentrytitle>
192192- <manvolnum>1</manvolnum>
193193- </citerefentry>.
184184+ keyword using utilities like {manpage}`apropos(1)`
185185+ and the `-k` option of
186186+ {manpage}`man(1)`.
194187 '';
195188 };
196189···216209 dev.enable = mkOption {
217210 type = types.bool;
218211 default = false;
219219- description = ''
212212+ description = mdDoc ''
220213 Whether to install documentation targeted at developers.
221221- <itemizedlist>
222222- <listitem><para>This includes man pages targeted at developers if <option>documentation.man.enable</option> is
223223- set (this also includes "devman" outputs).</para></listitem>
224224- <listitem><para>This includes info pages targeted at developers if <option>documentation.info.enable</option>
225225- is set (this also includes "devinfo" outputs).</para></listitem>
226226- <listitem><para>This includes other pages targeted at developers if <option>documentation.doc.enable</option>
227227- is set (this also includes "devdoc" outputs).</para></listitem>
228228- </itemizedlist>
214214+ * This includes man pages targeted at developers if {option}`documentation.man.enable` is
215215+ set (this also includes "devman" outputs).
216216+ * This includes info pages targeted at developers if {option}`documentation.info.enable`
217217+ is set (this also includes "devinfo" outputs).
218218+ * This includes other pages targeted at developers if {option}`documentation.doc.enable`
219219+ is set (this also includes "devdoc" outputs).
229220 '';
230221 };
231222
+4-4
nixos/modules/misc/man-db.nix
···2323 ++ lib.optionals config.documentation.dev.enable [ "devman" ];
2424 ignoreCollisions = true;
2525 };
2626- defaultText = lib.literalDocBook "all man pages in <option>config.environment.systemPackages</option>";
2727- description = ''
2828- The manual pages to generate caches for if <option>documentation.man.generateCaches</option>
2626+ defaultText = lib.literalMD "all man pages in {option}`config.environment.systemPackages`";
2727+ description = lib.mdDoc ''
2828+ The manual pages to generate caches for if {option}`documentation.man.generateCaches`
2929 is enabled. Must be a path to a directory with man pages under
3030- <literal>/share/man</literal>; see the source for an example.
3030+ `/share/man`; see the source for an example.
3131 Advanced users can make this a content-addressed derivation to save a few rebuilds.
3232 '';
3333 };
+6-5
nixos/modules/security/systemd-confinement.nix
···2222 options.confinement.fullUnit = lib.mkOption {
2323 type = types.bool;
2424 default = false;
2525- description = ''
2525+ description = lib.mdDoc ''
2626 Whether to include the full closure of the systemd unit file into the
2727 chroot, instead of just the dependencies for the executables.
28282929- <warning><para>While it may be tempting to just enable this option to
2929+ ::: {.warning}
3030+ While it may be tempting to just enable this option to
3031 make things work quickly, please be aware that this might add paths
3132 to the closure of the chroot that you didn't anticipate. It's better
3232- to use <option>confinement.packages</option> to <emphasis
3333- role="strong">explicitly</emphasis> add additional store paths to the
3434- chroot.</para></warning>
3333+ to use {option}`confinement.packages` to **explicitly** add additional store paths to the
3434+ chroot.
3535+ :::
3536 '';
3637 };
3738
+9-9
nixos/modules/services/matrix/synapse.nix
···191191192192 settings = mkOption {
193193 default = {};
194194- description = ''
194194+ description = mdDoc ''
195195 The primary synapse configuration. See the
196196- <link xlink:href="https://github.com/matrix-org/synapse/blob/v${cfg.package.version}/docs/sample_config.yaml">sample configuration</link>
196196+ [sample configuration](https://github.com/matrix-org/synapse/blob/v${cfg.package.version}/docs/sample_config.yaml)
197197 for possible values.
198198199199- Secrets should be passed in by using the <literal>extraConfigFiles</literal> option.
199199+ Secrets should be passed in by using the `extraConfigFiles` option.
200200 '';
201201 type = with types; submodule {
202202 freeformType = format.type;
···230230 registration_shared_secret = mkOption {
231231 type = types.nullOr types.str;
232232 default = null;
233233- description = ''
233233+ description = mdDoc ''
234234 If set, allows registration by anyone who also has the shared
235235 secret, even if registration is otherwise disabled.
236236237237- Secrets should be passed in via <literal>extraConfigFiles</literal>!
237237+ Secrets should be passed in via `extraConfigFiles`!
238238 '';
239239 };
240240241241 macaroon_secret_key = mkOption {
242242 type = types.nullOr types.str;
243243 default = null;
244244- description = ''
244244+ description = mdDoc ''
245245 Secret key for authentication tokens. If none is specified,
246246 the registration_shared_secret is used, if one is given; otherwise,
247247 a secret key is derived from the signing key.
248248249249- Secrets should be passed in via <literal>extraConfigFiles</literal>!
249249+ Secrets should be passed in via `extraConfigFiles`!
250250 '';
251251 };
252252···620620 example = literalExpression ''
621621 config.services.coturn.static-auth-secret
622622 '';
623623- description = ''
623623+ description = mdDoc ''
624624 The shared secret used to compute passwords for the TURN server.
625625626626- Secrets should be passed in via <literal>extraConfigFiles</literal>!
626626+ Secrets should be passed in via `extraConfigFiles`!
627627 '';
628628 };
629629
+20-20
nixos/modules/services/networking/mosquitto.nix
···5454 hashedPassword = mkOption {
5555 type = uniq (nullOr str);
5656 default = null;
5757- description = ''
5757+ description = mdDoc ''
5858 Specifies the hashed password for the MQTT User.
5959- To generate hashed password install <literal>mosquitto</literal>
6060- package and use <literal>mosquitto_passwd</literal>.
5959+ To generate hashed password install `mosquitto`
6060+ package and use `mosquitto_passwd`.
6161 '';
6262 };
6363···6565 type = uniq (nullOr types.path);
6666 example = "/path/to/file";
6767 default = null;
6868- description = ''
6868+ description = mdDoc ''
6969 Specifies the path to a file containing the
7070 hashed password for the MQTT user.
7171- To generate hashed password install <literal>mosquitto</literal>
7272- package and use <literal>mosquitto_passwd</literal>.
7171+ To generate hashed password install `mosquitto`
7272+ package and use `mosquitto_passwd`.
7373 '';
7474 };
7575···155155 options = {
156156 plugin = mkOption {
157157 type = path;
158158- description = ''
159159- Plugin path to load, should be a <literal>.so</literal> file.
158158+ description = mdDoc ''
159159+ Plugin path to load, should be a `.so` file.
160160 '';
161161 };
162162163163 denySpecialChars = mkOption {
164164 type = bool;
165165- description = ''
166166- Automatically disallow all clients using <literal>#</literal>
167167- or <literal>+</literal> in their name/id.
165165+ description = mdDoc ''
166166+ Automatically disallow all clients using `#`
167167+ or `+` in their name/id.
168168 '';
169169 default = true;
170170 };
171171172172 options = mkOption {
173173 type = attrsOf optionType;
174174- description = ''
175175- Options for the auth plugin. Each key turns into a <literal>auth_opt_*</literal>
174174+ description = mdDoc ''
175175+ Options for the auth plugin. Each key turns into a `auth_opt_*`
176176 line in the config.
177177 '';
178178 default = {};
···239239240240 address = mkOption {
241241 type = nullOr str;
242242- description = ''
243243- Address to listen on. Listen on <literal>0.0.0.0</literal>/<literal>::</literal>
242242+ description = mdDoc ''
243243+ Address to listen on. Listen on `0.0.0.0`/`::`
244244 when unset.
245245 '';
246246 default = null;
···248248249249 authPlugins = mkOption {
250250 type = listOf authPluginOptions;
251251- description = ''
251251+ description = mdDoc ''
252252 Authentication plugin to attach to this listener.
253253- Refer to the <link xlink:href="https://mosquitto.org/man/mosquitto-conf-5.html">
254254- mosquitto.conf documentation</link> for details on authentication plugins.
253253+ Refer to the [mosquitto.conf documentation](https://mosquitto.org/man/mosquitto-conf-5.html)
254254+ for details on authentication plugins.
255255 '';
256256 default = [];
257257 };
···472472473473 includeDirs = mkOption {
474474 type = listOf path;
475475- description = ''
475475+ description = mdDoc ''
476476 Directories to be scanned for further config files to include.
477477 Directories will processed in the order given,
478478- <literal>*.conf</literal> files in the directory will be
478478+ `*.conf` files in the directory will be
479479 read in case-sensistive alphabetical order.
480480 '';
481481 default = [];
+48-60
nixos/modules/services/networking/syncthing.nix
···7272 cert = mkOption {
7373 type = types.nullOr types.str;
7474 default = null;
7575- description = ''
7676- Path to the <literal>cert.pem</literal> file, which will be copied into Syncthing's
7777- <link linkend="opt-services.syncthing.configDir">configDir</link>.
7575+ description = mdDoc ''
7676+ Path to the `cert.pem` file, which will be copied into Syncthing's
7777+ [configDir](#opt-services.syncthing.configDir).
7878 '';
7979 };
80808181 key = mkOption {
8282 type = types.nullOr types.str;
8383 default = null;
8484- description = ''
8585- Path to the <literal>key.pem</literal> file, which will be copied into Syncthing's
8686- <link linkend="opt-services.syncthing.configDir">configDir</link>.
8484+ description = mdDoc ''
8585+ Path to the `key.pem` file, which will be copied into Syncthing's
8686+ [configDir](#opt-services.syncthing.configDir).
8787 '';
8888 };
89899090 overrideDevices = mkOption {
9191 type = types.bool;
9292 default = true;
9393- description = ''
9393+ description = mdDoc ''
9494 Whether to delete the devices which are not configured via the
9595- <link linkend="opt-services.syncthing.devices">devices</link> option.
9696- If set to <literal>false</literal>, devices added via the web
9595+ [devices](#opt-services.syncthing.devices) option.
9696+ If set to `false`, devices added via the web
9797 interface will persist and will have to be deleted manually.
9898 '';
9999 };
100100101101 devices = mkOption {
102102 default = {};
103103- description = ''
103103+ description = mdDoc ''
104104 Peers/devices which Syncthing should communicate with.
105105106106 Note that you can still add devices manually, but those changes
107107- will be reverted on restart if <link linkend="opt-services.syncthing.overrideDevices">overrideDevices</link>
107107+ will be reverted on restart if [overrideDevices](#opt-services.syncthing.overrideDevices)
108108 is enabled.
109109 '';
110110 example = {
···135135136136 id = mkOption {
137137 type = types.str;
138138- description = ''
139139- The device ID. See <link xlink:href="https://docs.syncthing.net/dev/device-ids.html"/>.
138138+ description = mdDoc ''
139139+ The device ID. See <https://docs.syncthing.net/dev/device-ids.html>.
140140 '';
141141 };
142142143143 introducer = mkOption {
144144 type = types.bool;
145145 default = false;
146146- description = ''
146146+ description = mdDoc ''
147147 Whether the device should act as an introducer and be allowed
148148 to add folders on this computer.
149149- See <link xlink:href="https://docs.syncthing.net/users/introducer.html"/>.
149149+ See <https://docs.syncthing.net/users/introducer.html>.
150150 '';
151151 };
152152153153 autoAcceptFolders = mkOption {
154154 type = types.bool;
155155 default = false;
156156- description = ''
156156+ description = mdDoc ''
157157 Automatically create or share folders that this device advertises at the default path.
158158- See <link xlink:href="https://docs.syncthing.net/users/config.html?highlight=autoaccept#config-file-format"/>.
158158+ See <https://docs.syncthing.net/users/config.html?highlight=autoaccept#config-file-format>.
159159 '';
160160 };
161161···166166 overrideFolders = mkOption {
167167 type = types.bool;
168168 default = true;
169169- description = ''
169169+ description = mdDoc ''
170170 Whether to delete the folders which are not configured via the
171171- <link linkend="opt-services.syncthing.folders">folders</link> option.
172172- If set to <literal>false</literal>, folders added via the web
171171+ [folders](#opt-services.syncthing.folders) option.
172172+ If set to `false`, folders added via the web
173173 interface will persist and will have to be deleted manually.
174174 '';
175175 };
176176177177 folders = mkOption {
178178 default = {};
179179- description = ''
179179+ description = mdDoc ''
180180 Folders which should be shared by Syncthing.
181181182182 Note that you can still add devices manually, but those changes
183183- will be reverted on restart if <link linkend="opt-services.syncthing.overrideDevices">overrideDevices</link>
183183+ will be reverted on restart if [overrideDevices](#opt-services.syncthing.overrideDevices)
184184 is enabled.
185185 '';
186186 example = literalExpression ''
···231231 devices = mkOption {
232232 type = types.listOf types.str;
233233 default = [];
234234- description = ''
234234+ description = mdDoc ''
235235 The devices this folder should be shared with. Each device must
236236- be defined in the <link linkend="opt-services.syncthing.devices">devices</link> option.
236236+ be defined in the [devices](#opt-services.syncthing.devices) option.
237237 '';
238238 };
239239240240 versioning = mkOption {
241241 default = null;
242242- description = ''
242242+ description = mdDoc ''
243243 How to keep changed/deleted files with Syncthing.
244244 There are 4 different types of versioning with different parameters.
245245- See <link xlink:href="https://docs.syncthing.net/users/versioning.html"/>.
245245+ See <https://docs.syncthing.net/users/versioning.html>.
246246 '';
247247 example = literalExpression ''
248248 [
···284284 options = {
285285 type = mkOption {
286286 type = enum [ "external" "simple" "staggered" "trashcan" ];
287287- description = ''
287287+ description = mdDoc ''
288288 The type of versioning.
289289- See <link xlink:href="https://docs.syncthing.net/users/versioning.html"/>.
289289+ See <https://docs.syncthing.net/users/versioning.html>.
290290 '';
291291 };
292292 params = mkOption {
293293 type = attrsOf (either str path);
294294- description = ''
294294+ description = mdDoc ''
295295 The parameters for versioning. Structure depends on
296296- <link linkend="opt-services.syncthing.folders._name_.versioning.type">versioning.type</link>.
297297- See <link xlink:href="https://docs.syncthing.net/users/versioning.html"/>.
296296+ [versioning.type](#opt-services.syncthing.folders._name_.versioning.type).
297297+ See <https://docs.syncthing.net/users/versioning.html>.
298298 '';
299299 };
300300 };
···345345 ignoreDelete = mkOption {
346346 type = types.bool;
347347 default = false;
348348- description = ''
348348+ description = mdDoc ''
349349 Whether to skip deleting files that are deleted by peers.
350350- See <link xlink:href="https://docs.syncthing.net/advanced/folder-ignoredelete.html"/>.
350350+ See <https://docs.syncthing.net/advanced/folder-ignoredelete.html>.
351351 '';
352352 };
353353 };
···357357 extraOptions = mkOption {
358358 type = types.addCheck (pkgs.formats.json {}).type isAttrs;
359359 default = {};
360360- description = ''
360360+ description = mdDoc ''
361361 Extra configuration options for Syncthing.
362362- See <link xlink:href="https://docs.syncthing.net/users/config.html"/>.
362362+ See <https://docs.syncthing.net/users/config.html>.
363363 '';
364364 example = {
365365 options.localAnnounceEnabled = false;
···387387 type = types.str;
388388 default = defaultUser;
389389 example = "yourUser";
390390- description = ''
390390+ description = mdDoc ''
391391 The user to run Syncthing as.
392392- By default, a user named <literal>${defaultUser}</literal> will be created.
392392+ By default, a user named `${defaultUser}` will be created.
393393 '';
394394 };
395395···397397 type = types.str;
398398 default = defaultGroup;
399399 example = "yourGroup";
400400- description = ''
400400+ description = mdDoc ''
401401 The group to run Syncthing under.
402402- By default, a group named <literal>${defaultGroup}</literal> will be created.
402402+ By default, a group named `${defaultGroup}` will be created.
403403 '';
404404 };
405405···407407 type = with types; nullOr str;
408408 default = null;
409409 example = "socks5://address.com:1234";
410410- description = ''
410410+ description = mdDoc ''
411411 Overwrites the all_proxy environment variable for the Syncthing process to
412412 the given value. This is normally used to let Syncthing connect
413413 through a SOCKS5 proxy server.
414414- See <link xlink:href="https://docs.syncthing.net/users/proxying.html"/>.
414414+ See <https://docs.syncthing.net/users/proxying.html>.
415415 '';
416416 };
417417···432432 The path where the settings and keys will exist.
433433 '';
434434 default = cfg.dataDir + optionalString cond "/.config/syncthing";
435435- defaultText = literalDocBook ''
436436- <variablelist>
437437- <varlistentry>
438438- <term><literal>stateVersion >= 19.03</literal></term>
439439- <listitem>
440440- <programlisting>
441441- config.${opt.dataDir} + "/.config/syncthing"
442442- </programlisting>
443443- </listitem>
444444- </varlistentry>
445445- <varlistentry>
446446- <term>otherwise</term>
447447- <listitem>
448448- <programlisting>
449449- config.${opt.dataDir}
450450- </programlisting>
451451- </listitem>
452452- </varlistentry>
453453- </variablelist>
435435+ defaultText = literalMD ''
436436+ * if `stateVersion >= 19.03`:
437437+438438+ config.${opt.dataDir} + "/.config/syncthing"
439439+ * otherwise:
440440+441441+ config.${opt.dataDir}
454442 '';
455443 };
456444
+3-3
nixos/modules/virtualisation/xen-dom0.nix
···2323 default = false;
2424 type = types.bool;
2525 description =
2626- ''
2626+ mdDoc ''
2727 Setting this option enables the Xen hypervisor, a
2828 virtualisation technology that allows multiple virtual
2929- machines, known as <emphasis>domains</emphasis>, to run
2929+ machines, known as *domains*, to run
3030 concurrently on the physical machine. NixOS runs as the
3131- privileged <emphasis>Domain 0</emphasis>. This option
3131+ privileged *Domain 0*. This option
3232 requires a reboot to take effect.
3333 '';
3434 };