docs: add generated configurations readme

This commit is contained in:
matt1432 2025-01-20 19:04:05 -05:00
parent 6aca512b8a
commit 5194199d25
14 changed files with 105 additions and 21 deletions

View file

@ -1,9 +1,11 @@
packageMetaFunc=$(cat << EOF
getMetaFunc=$(cat << EOF
(x: {
attrs = builtins.mapAttrs (_: v: {
desc = builtins.replaceStrings ["\n"] [" "] (v.meta.description or "");
homepage = v.meta.homepage or "";
}) (builtins.removeAttrs x.\${builtins.currentSystem} ["default"]);
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"]);
})
EOF
)
@ -15,12 +17,13 @@ substitute() {
--impure \
--json \
"$FLAKE"#"$1" \
--apply "$packageMetaFunc" |
--apply "$getMetaFunc" |
jq -r
) -t markdown --template "$2" -o "$3"
) -t markdown --template "$FLAKE/apps/gen-docs/templates/$2.md" -o "$FLAKE/$2/README.md"
}
# TODO: add configurations, homeManagerModules, lib, modules, nixFastChecks, overlays, scopedPackages
substitute "appsPackages" "$FLAKE/apps/gen-docs/templates/apps.md" "$FLAKE/apps/README.md"
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"
# TODO: add homeManagerModules, lib, modules, nixFastChecks, overlays, scopedPackages
substitute "appsPackages" "apps"
substitute "nixosConfigurations" "configurations"
substitute "devShells" "devShells"
substitute "packages" "packages"

View file

@ -0,0 +1,13 @@
# nixosConfigurations
This directory contains every device's main configuration file, their `hardware-configuration.nix` and some custom modules
unique to them.
## List of my Devices
| Name | Model / Specs | Description |
| --------- | ------------- | ------------------------------------------------------------------------------------------------ |
| `android` | OnePlus 9 Pro | [Nix-On-Droid](https://github.com/nix-community/nix-on-droid) configuration for my OnePlus 9 Pro |
$for(attrs/pairs)$
| `$it.key$` | $it.value.hwDesc/nowrap$ | $it.value.roleDesc/nowrap$ |
$endfor$

View file

@ -4,8 +4,8 @@ This directory contains every derivations for packages exposed by this flake.
## List of my packages found in `self.packages`
| Name | Description |
| ---- | ----------- |
| Name | Description | Homepage |
| ---- | ----------- | -------- |
$for(attrs/pairs)$
| `$it.key$` | $it.value.desc/nowrap$ | $it.value.homepage/nowrap$ |
$endfor$