2025-01-20 19:04:05 -05:00
|
|
|
getMetaFunc=$(cat << EOF
|
2025-01-20 11:20:02 -05:00
|
|
|
(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 19:04:05 -05:00
|
|
|
roleDesc = builtins.replaceStrings ["\n"] [" "] (v.config.meta.roleDescription or "");
|
|
|
|
hwDesc = builtins.replaceStrings ["\n"] [" "] (v.config.meta.hardwareDescription or "");
|
|
|
|
}) (builtins.removeAttrs (x.\${builtins.currentSystem} or x) ["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 19:04:05 -05:00
|
|
|
--apply "$getMetaFunc" |
|
2025-01-20 11:06:01 -05:00
|
|
|
jq -r
|
2025-01-20 19:04:05 -05:00
|
|
|
) -t markdown --template "$FLAKE/apps/gen-docs/templates/$2.md" -o "$FLAKE/$2/README.md"
|
2025-01-20 11:06:01 -05:00
|
|
|
}
|
|
|
|
|
2025-01-20 19:04:05 -05:00
|
|
|
# TODO: add homeManagerModules, lib, modules, nixFastChecks, overlays, scopedPackages
|
|
|
|
substitute "appsPackages" "apps"
|
|
|
|
substitute "nixosConfigurations" "configurations"
|
|
|
|
substitute "devShells" "devShells"
|
|
|
|
substitute "packages" "packages"
|