From dd51a7ab5842806e553fa77dbf80ed90631855ba Mon Sep 17 00:00:00 2001 From: Sk7Str1p3 Date: Sat, 2 May 2026 23:27:00 +0300 Subject: [PATCH] chore: move `docgen` comment to markdown file --- docs/default.nix | 23 ----------------------- docs/docgen.nix | 11 ++++++++--- docs/src/docGen.md | 21 +++++++++++++++++++++ 3 files changed, 29 insertions(+), 26 deletions(-) create mode 100644 docs/src/docGen.md diff --git a/docs/default.nix b/docs/default.nix index 68d3713..64d0570 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -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 = { pkgs, ... }: diff --git a/docs/docgen.nix b/docs/docgen.nix index 38fc43b..b640add 100644 --- a/docs/docgen.nix +++ b/docs/docgen.nix @@ -16,8 +16,7 @@ stdenvNoCC.mkDerivation { excluded = [ ".*flake\\.nix$" - "docs/docgen.nix" - "docs/server.nix" + "^docs/.*" ]; shouldExclude = relPath: lib.any (pattern: builtins.match pattern relPath != null) excluded; @@ -93,7 +92,13 @@ stdenvNoCC.mkDerivation { summaryContent = "# Summary\n\n" - + "[Introduction](README.md)\n" + + '' + [Introduction](README.md) + + - [Features]() + - [Documentation generation](docGen.md) + + '' + builtins.concatStringsSep "\n" (map (c: c.summaryLine) chapters) + "\n"; diff --git a/docs/src/docGen.md b/docs/src/docGen.md new file mode 100644 index 0000000..3b989af --- /dev/null +++ b/docs/src/docGen.md @@ -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