nixos-configs/apps/gen-docs/script.sh

30 lines
1,018 B
Bash
Raw Normal View History

substitute() {
echo '' | pandoc --metadata-file <(
nix eval \
--impure \
--json \
2025-01-20 12:34:07 -05:00
"$FLAKE"#"$1" \
--apply "import \"$FLAKE/apps/gen-docs/$3.nix\"" |
jq -r
) -t markdown --template "$FLAKE/apps/gen-docs/templates/$2.md" -o "$FLAKE/$2/README.md"
}
2025-01-21 13:49:09 -05:00
substituteModule() {
echo '' | pandoc --metadata-file <(
nix eval \
--impure \
--json \
--expr "\"$FLAKE\"" \
--apply "(import \"$FLAKE/apps/gen-docs/getModuleMeta.nix\") \"$1\"" |
jq -r
) -t markdown --template "$FLAKE/apps/gen-docs/templates/$1.md" -o "$FLAKE/$1/README.md"
}
# TODO: add lib, nixFastChecks, overlays, scopedPackages
substitute "appsPackages" "apps" "getPackageMeta"
substitute "nixosConfigurations" "configurations" "getConfigMeta"
substitute "devShells" "devShells" "getPackageMeta"
substitute "packages" "packages" "getPackageMeta"
2025-01-21 13:49:09 -05:00
substituteModule "modules"
substituteModule "homeManagerModules"