dream2nix/docs
2024-06-26 19:05:13 +02:00
..
hooks docs: Experimental -> Experimental Modules 2024-06-18 15:39:32 +02:00
src docs: improve options reference layout 2024-06-18 13:17:48 +02:00
theme docs: improve options reference layout 2024-06-18 13:17:48 +02:00
mkdocs.yml docs: enable copy button for code blocks 2024-06-26 19:05:13 +02:00
README.md docs: children -> option 2024-06-14 15:48:38 +02:00

About this Documentation

Dream2nix documentation is generated from markdown via mkdocs and mkdocs-material.

Build

You can build and server it locally with, i.e.:

nix build .#website
python3 -m http.server -d ./result

Development shell

Or alternatively run a development environment with:

nix develop .#website

Upon entering the devshell, it will change into ./docs and symlink a build of the options reference into ./docs/src/reference.

Normal builds will always use an up-to-date options reference, but during development you need to update this symlink yourself and remove it after use.

i.e. from inside the shell in ./docs:

# update
ln -sfT $(nix build --print-out-paths --no-link ..#optionsReference) ./src/reference
# remove
rm ./src/reference

Options Reference

The reference documentation for modules is auto-generated via a custom hook in docs/hooks/render_options.py and a derivation in .#optionsReference.

The derivation includes, for each module, an options.json file as generated by nix via pkgs.nixosOptionsDoc as well as a README.md file, copied from the modules source directory. The existence of such a README.md is used as an indicator on whether to include a module in the reference documentation.

The hook runs whenever mkdocs renders one of the README.mds. Each of them gets concatenated with header and options reference, after the latter are run through jinja templates in ./docs/theme.

Notes on Markdown

Mkdocs uses a markdown dialect from Python-Markdown with various, optional extensions listed in ./docs/mkdocs.yml.

This is different from the CommonMark dialect, as implemented by markdown-it-py and used in NixOS official documentation.

The differences between both don't seem to be too relevant for the markdown features used in our options reference, but it's good to be aware of them when writing longer prose.

mkdocs-materials reference provides a good overview on useful extensions.

CI

The documentation is published on GitHub pages via a GitHub action, defined in .github/workflows/pages.yml