chore: move docgen comment to markdown file
This commit is contained in:
parent
51be18d517
commit
dd51a7ab58
3 changed files with 29 additions and 26 deletions
|
|
@ -1,26 +1,3 @@
|
||||||
# Documentation
|
|
||||||
/**
|
|
||||||
Docs are generated from comments in `.nix` files.
|
|
||||||
This results in kind of weird config format, but
|
|
||||||
makes it easier to track configuration changes
|
|
||||||
and add/remove docs as required.
|
|
||||||
|
|
||||||
## How docs are generated
|
|
||||||
|
|
||||||
`nixdoc` utility enables us to generate documentation
|
|
||||||
from comments in `.nix` file, like `doxygen` and `rustdoc` do.
|
|
||||||
|
|
||||||
`nixdoc` requires this flags:
|
|
||||||
- category (derived from file's path)
|
|
||||||
- description (derived from file's first line if it's commented)
|
|
||||||
|
|
||||||
most hard part is to generate SUMMARY.md.
|
|
||||||
generator uses orderKey of type "{num}|{mdPath}" and derives indentation from path's depth,
|
|
||||||
so chapters have proper order.
|
|
||||||
|
|
||||||
run `nix build .#docBuild` to build documentation.
|
|
||||||
run `nix run .#docServe` to serve documentation site
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
perSystem =
|
perSystem =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@ stdenvNoCC.mkDerivation {
|
||||||
excluded = [
|
excluded = [
|
||||||
".*flake\\.nix$"
|
".*flake\\.nix$"
|
||||||
|
|
||||||
"docs/docgen.nix"
|
"^docs/.*"
|
||||||
"docs/server.nix"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
shouldExclude = relPath: lib.any (pattern: builtins.match pattern relPath != null) excluded;
|
shouldExclude = relPath: lib.any (pattern: builtins.match pattern relPath != null) excluded;
|
||||||
|
|
@ -93,7 +92,13 @@ stdenvNoCC.mkDerivation {
|
||||||
|
|
||||||
summaryContent =
|
summaryContent =
|
||||||
"# Summary\n\n"
|
"# Summary\n\n"
|
||||||
+ "[Introduction](README.md)\n"
|
+ ''
|
||||||
|
[Introduction](README.md)
|
||||||
|
|
||||||
|
- [Features]()
|
||||||
|
- [Documentation generation](docGen.md)
|
||||||
|
|
||||||
|
''
|
||||||
+ builtins.concatStringsSep "\n" (map (c: c.summaryLine) chapters)
|
+ builtins.concatStringsSep "\n" (map (c: c.summaryLine) chapters)
|
||||||
+ "\n";
|
+ "\n";
|
||||||
|
|
||||||
|
|
|
||||||
21
docs/src/docGen.md
Normal file
21
docs/src/docGen.md
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Documentation
|
||||||
|
Docs are generated from comments in `.nix` files.
|
||||||
|
This results in kind of weird config format, but
|
||||||
|
makes it easier to track configuration changes
|
||||||
|
and add/remove docs as required.
|
||||||
|
|
||||||
|
## How docs are generated
|
||||||
|
|
||||||
|
`nixdoc` utility enables us to generate documentation
|
||||||
|
from comments in `.nix` file, like `doxygen` and `rustdoc` do.
|
||||||
|
|
||||||
|
`nixdoc` requires this flags:
|
||||||
|
- category (derived from file's path)
|
||||||
|
- description (derived from file's first line if it's commented)
|
||||||
|
|
||||||
|
most hard part is to generate SUMMARY.md.
|
||||||
|
generator uses orderKey of type `{num}|{mdPath}` and derives indentation from path's depth,
|
||||||
|
so chapters have proper order.
|
||||||
|
|
||||||
|
run `nix build .#docBuild` to build documentation.
|
||||||
|
run `nix run .#docServe` to serve documentation site
|
||||||
Loading…
Add table
Add a link
Reference in a new issue