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

44 lines
1.4 KiB
Bash
Raw Normal View History

substituteDerivs() {
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 17:05:47 -05:00
substituteAttrs() {
2025-01-21 13:49:09 -05:00
echo '' | pandoc --metadata-file <(
nix eval \
--impure \
--json \
--expr "\"$FLAKE\"" \
2025-01-21 17:05:47 -05:00
--apply "(import \"$FLAKE/apps/gen-docs/getAttrsMeta.nix\") \"$1\"" |
2025-01-21 13:49:09 -05:00
jq -r
) -t markdown --template "$FLAKE/apps/gen-docs/templates/$1.md" -o "$FLAKE/$1/README.md"
}
substituteScopes() {
echo '' | pandoc --metadata-file <(
nix eval \
--impure \
--json \
--expr "\"$FLAKE\"" \
--apply "(import \"$FLAKE/apps/gen-docs/getScopesMeta.nix\") \"$1\"" |
jq -r
) -t markdown --template "$FLAKE/apps/gen-docs/templates/$1.md" -o "$FLAKE/$1/README.md"
}
substituteDerivs "appsPackages" "apps" "getPackageMeta"
substituteDerivs "nixosConfigurations" "configurations" "getConfigMeta"
substituteDerivs "devShells" "devShells" "getPackageMeta"
substituteDerivs "packages" "packages" "getPackageMeta"
2025-01-21 17:05:47 -05:00
substituteAttrs "modules"
substituteAttrs "homeManagerModules"
substituteAttrs "overlays"
substituteScopes "scopedPackages"