nixos-configs/apps/gen-docs/script.sh
matt1432 d2c7ee7e25
All checks were successful
Discord / discord commits (push) Has been skipped
feat(gen-docs): also get source of package
2025-01-20 11:20:02 -05:00

23 lines
546 B
Bash
Executable file

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 "$packageMetaFunc" |
jq -r
) -t markdown --template "$2" -o "$3"
}
substitute "devShells" "$FLAKE/apps/gen-docs/templates/devShells.md" "$FLAKE/devShells/README.md"