feat(gen-docs): also get source of package
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2025-01-20 11:20:02 -05:00
parent a4c953df3b
commit d2c7ee7e25
2 changed files with 14 additions and 3 deletions

View file

@ -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() { substitute() {
echo '' | pandoc --metadata-file <( echo '' | pandoc --metadata-file <(
nix eval \ nix eval \
--impure \ --impure \
--json \ --json \
.#"$1" \ .#"$1" \
--apply "(x: {attrs = builtins.mapAttrs (_: v: v.meta.description or \"\") x.\${builtins.currentSystem};})" | --apply "$packageMetaFunc" |
jq -r jq -r
) -t markdown --template "$2" -o "$3" ) -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"

View file

@ -7,5 +7,5 @@ This directory contains every derivations for devShells exposed by this flake.
| Name | Description | | Name | Description |
| ---- | ----------- | | ---- | ----------- |
$for(attrs/pairs)$ $for(attrs/pairs)$
| $it.key$ | $it.value$ | | $it.key$ | $it.value.desc$ |
$endfor$ $endfor$