2025-01-20 11:20:02 -05:00
|
|
|
packageMetaFunc=$(cat << EOF
|
|
|
|
(x: {
|
|
|
|
attrs = builtins.mapAttrs (_: v: {
|
2025-01-20 12:34:07 -05:00
|
|
|
desc = builtins.replaceStrings ["\n"] [" "] (v.meta.description or "");
|
2025-01-20 11:20:02 -05:00
|
|
|
homepage = v.meta.homepage or "";
|
2025-01-20 11:40:10 -05:00
|
|
|
}) (builtins.removeAttrs x.\${builtins.currentSystem} ["default"]);
|
2025-01-20 11:20:02 -05:00
|
|
|
})
|
|
|
|
EOF
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2025-01-20 11:06:01 -05:00
|
|
|
substitute() {
|
|
|
|
echo '' | pandoc --metadata-file <(
|
|
|
|
nix eval \
|
|
|
|
--impure \
|
|
|
|
--json \
|
2025-01-20 12:34:07 -05:00
|
|
|
"$FLAKE"#"$1" \
|
2025-01-20 11:20:02 -05:00
|
|
|
--apply "$packageMetaFunc" |
|
2025-01-20 11:06:01 -05:00
|
|
|
jq -r
|
|
|
|
) -t markdown --template "$2" -o "$3"
|
|
|
|
}
|
|
|
|
|
2025-01-20 15:06:16 -05:00
|
|
|
# TODO: add configurations, homeManagerModules, lib, modules, nixFastChecks, overlays, scopedPackages
|
2025-01-20 12:34:07 -05:00
|
|
|
substitute "appsPackages" "$FLAKE/apps/gen-docs/templates/apps.md" "$FLAKE/apps/README.md"
|
2025-01-20 15:06:16 -05:00
|
|
|
substitute "devShells" "$FLAKE/apps/gen-docs/templates/devShells.md" "$FLAKE/devShells/README.md"
|
|
|
|
substitute "packages" "$FLAKE/apps/gen-docs/templates/packages.md" "$FLAKE/packages/README.md"
|