From d2c7ee7e25223b1d01126c4064413a15dd90b465 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Mon, 20 Jan 2025 11:20:02 -0500 Subject: [PATCH] feat(gen-docs): also get source of package --- apps/gen-docs/script.sh | 15 +++++++++++++-- apps/gen-docs/templates/devShells.md | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/apps/gen-docs/script.sh b/apps/gen-docs/script.sh index da35361d..0d2af308 100755 --- a/apps/gen-docs/script.sh +++ b/apps/gen-docs/script.sh @@ -1,12 +1,23 @@ +packageMetaFunc=$(cat << EOF +(x: { + attrs = builtins.mapAttrs (_: v: { + desc = v.meta.description or ""; + homepage = v.meta.homepage or ""; + }) x.\${builtins.currentSystem}; +}) +EOF +) + + substitute() { echo '' | pandoc --metadata-file <( nix eval \ --impure \ --json \ .#"$1" \ - --apply "(x: {attrs = builtins.mapAttrs (_: v: v.meta.description or \"\") x.\${builtins.currentSystem};})" | + --apply "$packageMetaFunc" | jq -r ) -t markdown --template "$2" -o "$3" } -substitute "devShells" "./templates/devShells.md" "$FLAKE/devShells/README.md" +substitute "devShells" "$FLAKE/apps/gen-docs/templates/devShells.md" "$FLAKE/devShells/README.md" diff --git a/apps/gen-docs/templates/devShells.md b/apps/gen-docs/templates/devShells.md index 4c4798a9..3fd71fa7 100644 --- a/apps/gen-docs/templates/devShells.md +++ b/apps/gen-docs/templates/devShells.md @@ -7,5 +7,5 @@ This directory contains every derivations for devShells exposed by this flake. | Name | Description | | ---- | ----------- | $for(attrs/pairs)$ -| $it.key$ | $it.value$ | +| $it.key$ | $it.value.desc$ | $endfor$