feat(gen-docs): add metadata of all scoped packages
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
a42f4091d0
commit
fffcce6d29
3 changed files with 59 additions and 10 deletions
31
apps/gen-docs/getScopesMeta.nix
Normal file
31
apps/gen-docs/getScopesMeta.nix
Normal file
|
@ -0,0 +1,31 @@
|
|||
attr: selfPath: let
|
||||
inherit (builtins) currentSystem getFlake mapAttrs removeAttrs replaceStrings;
|
||||
|
||||
self = getFlake selfPath;
|
||||
scopes = import "${selfPath}/${attr}" {description = true;};
|
||||
|
||||
trimNewlines = s: replaceStrings ["\n"] [" "] s;
|
||||
in {
|
||||
attrs =
|
||||
mapAttrs (n: v: {
|
||||
desc = trimNewlines v;
|
||||
packages = let
|
||||
scopePkgs = removeAttrs self.${attr}.${currentSystem}.${n} [
|
||||
"buildFirefoxXpiAddon"
|
||||
"callPackage"
|
||||
"newScope"
|
||||
"override"
|
||||
"overrideDerivation"
|
||||
"overrideScope"
|
||||
"packages"
|
||||
"recurseForDerivations"
|
||||
];
|
||||
in
|
||||
mapAttrs (_: pkg: {
|
||||
desc = trimNewlines (pkg.meta.description or "");
|
||||
homepage = pkg.meta.homepage or "";
|
||||
})
|
||||
scopePkgs;
|
||||
})
|
||||
scopes;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
substitute() {
|
||||
substituteDerivs() {
|
||||
echo '' | pandoc --metadata-file <(
|
||||
nix eval \
|
||||
--impure \
|
||||
|
@ -20,13 +20,24 @@ substituteAttrs() {
|
|||
) -t markdown --template "$FLAKE/apps/gen-docs/templates/$1.md" -o "$FLAKE/$1/README.md"
|
||||
}
|
||||
|
||||
substitute "appsPackages" "apps" "getPackageMeta"
|
||||
substitute "nixosConfigurations" "configurations" "getConfigMeta"
|
||||
substitute "devShells" "devShells" "getPackageMeta"
|
||||
substitute "packages" "packages" "getPackageMeta"
|
||||
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"
|
||||
|
||||
substituteAttrs "modules"
|
||||
substituteAttrs "homeManagerModules"
|
||||
substituteAttrs "overlays"
|
||||
|
||||
# TODO: add metadata of all packages
|
||||
substituteAttrs "scopedPackages"
|
||||
substituteScopes "scopedPackages"
|
||||
|
|
|
@ -4,8 +4,15 @@ This directory contains every package scopes exposed by this flake.
|
|||
|
||||
## List of my package scopes found in `self.scopedPackages`
|
||||
|
||||
| Name | Description |
|
||||
| ---- | ----------- |
|
||||
$for(attrs/pairs)$
|
||||
| `$it.key$` | $it.value.desc/nowrap$ |
|
||||
### $it.key$
|
||||
|
||||
$it.value.desc/nowrap$
|
||||
|
||||
| Name | Description | Homepage |
|
||||
| ---- | ----------- | -------- |
|
||||
$for(it.value.packages/pairs)$
|
||||
| `$it.key$` | $it.value.desc/nowrap$ | $it.value.homepage/nowrap$ |
|
||||
$endfor$
|
||||
|
||||
$endfor$
|
||||
|
|
Loading…
Add table
Reference in a new issue