···
## Building the Manual {#sec-writing-docs-building-the-manual}
10
-
The DocBook sources of the [](#book-nixos-manual) are in the
10
+
The sources of the [](#book-nixos-manual) are in the
[`nixos/doc/manual`](https://github.com/NixOS/nixpkgs/tree/master/nixos/doc/manual)
subdirectory of the Nixpkgs repository.
···
When this command successfully finishes, it will tell you where the
manual got generated. The HTML will be accessible through the `result`
symlink at `./result/share/doc/nixos/index.html`.
33
-
## Editing DocBook XML {#sec-writing-docs-editing-docbook-xml}
35
-
For general information on how to write in DocBook, see [DocBook 5: The
36
-
Definitive Guide](https://tdg.docbook.org/tdg/5.1/).
38
-
Emacs nXML Mode is very helpful for editing DocBook XML because it
39
-
validates the document as you write, and precisely locates errors. To
40
-
use it, see [](#sec-emacs-docbook-xml).
42
-
[Pandoc](https://pandoc.org/) can generate DocBook XML from a multitude of
43
-
formats, which makes a good starting point. Here is an example of Pandoc
44
-
invocation to convert GitHub-Flavoured MarkDown to DocBook 5 XML:
47
-
pandoc -f markdown_github -t docbook5 docs.md -o my-section.md
50
-
Pandoc can also quickly convert a single `section.xml` to HTML, which is
51
-
helpful when drafting.
53
-
Sometimes writing valid DocBook is too difficult. In this case,
54
-
submit your documentation updates in a [GitHub
55
-
Issue](https://github.com/NixOS/nixpkgs/issues/new) and someone will
56
-
handle the conversion to XML for you.
58
-
## Creating a Topic {#sec-writing-docs-creating-a-topic}
60
-
You can use an existing topic as a basis for the new topic or create a
63
-
Keep the following guidelines in mind when you create and add a topic:
65
-
- The NixOS [`book`](https://tdg.docbook.org/tdg/5.0/book.html)
66
-
element is in `nixos/doc/manual/manual.xml`. It includes several
67
-
[`parts`](https://tdg.docbook.org/tdg/5.0/book.html) which are in
70
-
- Store the topic file in the same directory as the `part` to which it
71
-
belongs. If your topic is about configuring a NixOS module, then the
72
-
XML file can be stored alongside the module definition `nix` file.
74
-
- If you include multiple words in the file name, separate the words
75
-
with a dash. For example: `ipv6-config.xml`.
77
-
- Make sure that the `xml:id` value is unique. You can use abbreviations
78
-
if the ID is too long. For example: `nixos-config`.
80
-
- Determine whether your topic is a chapter or a section. If you are
81
-
unsure, open an existing topic file and check whether the main
82
-
element is chapter or section.
84
-
## Adding a Topic to the Book {#sec-writing-docs-adding-a-topic}
86
-
Open the parent CommonMark file and add a line to the list of
87
-
chapters with the file name of the topic that you created. If you
88
-
created a `section`, you add the file to the `chapter` file. If you created
89
-
a `chapter`, you add the file to the `part` file.
91
-
If the topic is about configuring a NixOS module, it can be
92
-
automatically included in the manual by using the `meta.doc` attribute.
93
-
See [](#sec-meta-attributes) for an explanation.