doc/packages/treefmt: add function reference docs

Add a `treefmt.functionsDoc` passthru, which is included on the treefmt
section of the nixpkgs manual.

This generates reference docs for functions defined in
`pkgs/by-name/tr/treefmt/lib.nix`, using `nixdoc`.
This commit is contained in:
Matt Sturgeon 2025-05-14 07:20:21 +01:00 committed by Valentin Gagarin
parent fe586a5d59
commit 301824d216
5 changed files with 41 additions and 1 deletions

View file

@ -14,6 +14,7 @@
nixpkgs ? { },
markdown-code-runner,
roboto,
treefmt,
}:
stdenvNoCC.mkDerivation (
@ -47,6 +48,7 @@ stdenvNoCC.mkDerivation (
postPatch = ''
ln -s ${optionsJSON}/share/doc/nixos/options.json ./config-options.json
ln -s ${treefmt.functionsDoc.markdown} ./packages/treefmt-functions.section.md
'';
buildPhase = ''

View file

@ -3,6 +3,10 @@
[treefmt](https://github.com/numtide/treefmt) streamlines the process of applying formatters to your project, making it a breeze with just one command line.
The [`treefmt` package](https://search.nixos.org/packages?channel=unstable&show=treefmt)
provides functions for configuring treefmt using the module system.
provides functions for configuring treefmt using the module system, which are [documented below](#sec-functions-library-treefmt).
Alternatively, treefmt can be configured using [treefmt-nix](https://github.com/numtide/treefmt-nix).
```{=include=} sections auto-id-prefix=auto-generated-treefmt-functions
treefmt-functions.section.md
```

View file

@ -72,6 +72,15 @@
"part-toolchains": [
"index.html#part-toolchains"
],
"pkgs.treefmt.buildConfig": [
"index.html#pkgs.treefmt.buildConfig"
],
"pkgs.treefmt.evalConfig": [
"index.html#pkgs.treefmt.evalConfig"
],
"pkgs.treefmt.withConfig": [
"index.html#pkgs.treefmt.withConfig"
],
"preface": [
"index.html#preface"
],
@ -111,6 +120,9 @@
"sec-building-packages-with-llvm-using-clang-stdenv": [
"index.html#sec-building-packages-with-llvm-using-clang-stdenv"
],
"sec-functions-library-treefmt": [
"index.html#sec-functions-library-treefmt"
],
"sec-inkscape": [
"index.html#sec-inkscape"
],