docs: add script to generate some docs from nix attrs
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
5621df5749
commit
a4c953df3b
7 changed files with 45 additions and 5 deletions
|
@ -7,14 +7,20 @@
|
||||||
|
|
||||||
buildApp = attrs: (pkgs.callPackage ./buildApp.nix ({} // inputs // attrs));
|
buildApp = attrs: (pkgs.callPackage ./buildApp.nix ({} // inputs // attrs));
|
||||||
|
|
||||||
mkApp = file: {
|
mkNodeApp = file: {
|
||||||
program = getExe (pkgs.callPackage file ({inherit buildApp;} // inputs));
|
program = getExe (pkgs.callPackage file ({inherit buildApp;} // inputs));
|
||||||
type = "app";
|
type = "app";
|
||||||
};
|
};
|
||||||
|
|
||||||
mkApps = apps: listToAttrs (map (x: nameValuePair x (mkApp ./${x})) apps);
|
mkNodeApps = apps: listToAttrs (map (x: nameValuePair x (mkNodeApp ./${x})) apps);
|
||||||
in
|
in
|
||||||
mkApps [
|
mkNodeApps [
|
||||||
"extract-subs"
|
"extract-subs"
|
||||||
"update-sources"
|
"update-sources"
|
||||||
]
|
]
|
||||||
|
// {
|
||||||
|
gen-docs = {
|
||||||
|
program = getExe (pkgs.callPackage ./gen-docs {});
|
||||||
|
type = "app";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
10
apps/gen-docs/default.nix
Normal file
10
apps/gen-docs/default.nix
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
writeShellApplication,
|
||||||
|
pandoc,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
writeShellApplication {
|
||||||
|
name = "gen-docs";
|
||||||
|
runtimeInputs = [pandoc];
|
||||||
|
text = builtins.readFile ./script.sh;
|
||||||
|
}
|
12
apps/gen-docs/script.sh
Executable file
12
apps/gen-docs/script.sh
Executable file
|
@ -0,0 +1,12 @@
|
||||||
|
substitute() {
|
||||||
|
echo '' | pandoc --metadata-file <(
|
||||||
|
nix eval \
|
||||||
|
--impure \
|
||||||
|
--json \
|
||||||
|
.#"$1" \
|
||||||
|
--apply "(x: {attrs = builtins.mapAttrs (_: v: v.meta.description or \"\") x.\${builtins.currentSystem};})" |
|
||||||
|
jq -r
|
||||||
|
) -t markdown --template "$2" -o "$3"
|
||||||
|
}
|
||||||
|
|
||||||
|
substitute "devShells" "./templates/devShells.md" "$FLAKE/devShells/README.md"
|
11
apps/gen-docs/templates/devShells.md
Normal file
11
apps/gen-docs/templates/devShells.md
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
# devShells
|
||||||
|
|
||||||
|
This directory contains every derivations for devShells exposed by this flake.
|
||||||
|
|
||||||
|
## List of my devShells found in `self.devShells`
|
||||||
|
|
||||||
|
| Name | Description |
|
||||||
|
| ---- | ----------- |
|
||||||
|
$for(attrs/pairs)$
|
||||||
|
| $it.key$ | $it.value$ |
|
||||||
|
$endfor$
|
|
@ -1,6 +1,6 @@
|
||||||
# nixosConfigurations
|
# nixosConfigurations
|
||||||
|
|
||||||
This directory keeps every device's main configuration file, their `hardware-configuration.nix` and some custom modules
|
This directory contains every device's main configuration file, their `hardware-configuration.nix` and some custom modules
|
||||||
unique to them.
|
unique to them.
|
||||||
|
|
||||||
## List of my Devices
|
## List of my Devices
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
text = ''
|
text = ''
|
||||||
# this command might fail but still updates the main lockfile
|
# this command might fail but still updates the main lockfile
|
||||||
npm update --package-lock-only || true
|
npm update --package-lock-only || true
|
||||||
|
|
||||||
hash="$(prefetch-npm-deps ./package-lock.json)"
|
hash="$(prefetch-npm-deps ./package-lock.json)"
|
||||||
echo "$hash"
|
echo "$hash"
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# Packages
|
# Packages
|
||||||
|
|
||||||
This directory encompasses every derivations for packages exposed by my flake.
|
This directory contains every derivations for packages exposed by this flake.
|
||||||
|
|
||||||
## List of my packages found in `self.packages`
|
## List of my packages found in `self.packages`
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue