docs/website: add nixdoc-generated docs

This commit is contained in:
Gabriel Arazas 2025-01-13 10:01:26 +08:00
parent fc4866826c
commit 79a929461a
No known key found for this signature in database
GPG Key ID: 62104B43D00AA360
5 changed files with 53 additions and 8 deletions

View File

@ -72,6 +72,29 @@ let
};
wmNixosDoc = evalDoc { modules = [ ../modules/env/nixos ]; };
wmHmDoc = evalDoc { modules = [ ../modules/env/home-manager ]; };
wmLibNixdocs =
pkgs.runCommand "wrapper-manager-lib-nixdoc"
{
buildInputs = with pkgs; [ nixdoc ];
}
''
mkdir -p $out
for nixfile in ${../lib}/*.nix; do
name=$(basename --suffix=".nix" "$nixfile")
[ "$name" = "default" ] && continue
filename="''${out}/''${name}.md"
title="wrapperManagerLib.''${name}"
cat > "$filename" << EOF
---
title: "$title"
---
EOF
nixdoc --file "$nixfile" --description "$title" --category "$name" --prefix "wrapperManagerLib" >> "$filename"
done
'';
gems = pkgs.bundlerEnv {
name = "wrapper-manager-fds-gem-env";
@ -80,13 +103,6 @@ let
};
in
{
# I forgot about the fact Hugo also uses Go modules for its Hugo modules
# feature. For now, this is considered broken up until that is working and I
# know squat about Go build system. Also, Hugo has several features such as
# embedding metadata from VCS which doesn't play well with Nix that is
# requiring a clean source.
#
# For now, we're just relying on nix-shell to build it for us.
website =
let
buildHugoSite = pkgs.callPackage ./hugo-build-module.nix { };
@ -147,6 +163,23 @@ in
install -Dm0644 ${wmOptionsDoc.optionsAsciiDoc} ./content/en/wrapper-manager-env-options.adoc
install -Dm0644 ${wmNixosDoc.optionsAsciiDoc} ./content/en/wrapper-manager-nixos-module.adoc
install -Dm0644 ${wmHmDoc.optionsAsciiDoc} ./content/en/wrapper-manager-home-manager-module.adoc
wmLibDir="./content/en/wrapper-manager-lib"
mkdir -p "$wmLibDir" && install -Dm0644 ${wmLibNixdocs}/*.md -t "$wmLibDir"
cat > "$wmLibDir/_index.md" <<EOF
---
title: "wrapper-manager library"
---
# wrapper-manager library set
EOF
for i in ${wmLibNixdocs}/*.md; do
filename="$(basename "$i")"
echo "- [''${filename}](./''${i})" >> "$wmLibDir/_index.md"
done
'';
meta = with lib; {
@ -160,7 +193,7 @@ in
};
};
inherit wmOptionsDoc wmHmDoc wmNixosDoc;
inherit wmOptionsDoc wmHmDoc wmNixosDoc wmLibNixdocs;
inherit releaseConfig;
outputs = {

View File

@ -1,5 +1,6 @@
# All of the generated assets.
/content/**/wrapper-manager-*.adoc
/content/**/wrapper-manager-lib/*.md
### Hugo ###
# Generated files by hugo

View File

@ -10,6 +10,12 @@ name = "Module options"
url = "wrapper-manager-env-options/"
weight = 2
[[main]]
identifier = "wrapper-amanager-lib"
name = "Library set"
url = "wrapper-manager-lib/"
weight = 3
[[main]]
identifier = "source-code"
name = "Source code"

View File

@ -134,6 +134,8 @@ let
in
wrapperManagerLib.env.build { }
----
+
To know more about the library set, you can see its function at link:wrapper-manager-lib/[the respective documentation page].
* `overlays` is a set of nixpkgs overlays to be applied by the user.
So far, there's only one overlay called `default` containing the wrapper-manager library set.

View File

@ -22,5 +22,8 @@ pkgs.mkShell {
install -Dm0644 ${docs.wmOptionsDoc.optionsAsciiDoc} ./content/en/wrapper-manager-env-options.adoc
install -Dm0644 ${docs.wmNixosDoc.optionsAsciiDoc} ./content/en/wrapper-manager-nixos-module.adoc
install -Dm0644 ${docs.wmHmDoc.optionsAsciiDoc} ./content/en/wrapper-manager-home-manager-module.adoc
wmLibDir="./content/en/wrapper-manager-lib"
mkdir -p "$wmLibDir" && install -Dm0644 ${docs.wmLibNixdocs}/*.md -t "$wmLibDir"
'';
}