mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
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:
parent
fe586a5d59
commit
301824d216
5 changed files with 41 additions and 1 deletions
|
@ -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 = ''
|
||||
|
|
|
@ -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
|
||||
```
|
||||
|
|
|
@ -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"
|
||||
],
|
||||
|
|
19
pkgs/by-name/tr/treefmt/functions-doc.nix
Normal file
19
pkgs/by-name/tr/treefmt/functions-doc.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
nixdoc,
|
||||
runCommand,
|
||||
}:
|
||||
{
|
||||
markdown =
|
||||
runCommand "treefmt-functions-doc"
|
||||
{
|
||||
nativeBuildInputs = [ nixdoc ];
|
||||
}
|
||||
''
|
||||
nixdoc --file ${./lib.nix} \
|
||||
--description "Functions Reference" \
|
||||
--prefix "pkgs" \
|
||||
--category "treefmt" \
|
||||
--anchor-prefix "" \
|
||||
> $out
|
||||
'';
|
||||
}
|
|
@ -36,6 +36,9 @@ buildGoModule rec {
|
|||
;
|
||||
|
||||
tests = callPackages ./tests.nix { };
|
||||
|
||||
# Documentation for functions defined in `./lib.nix`
|
||||
functionsDoc = callPackages ./functions-doc.nix { };
|
||||
};
|
||||
|
||||
meta = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue