mirror of
https://github.com/foo-dogsquared/nix-module-wrapper-manager-fds.git
synced 2025-01-30 22:57:58 +00:00
wrapper-manager-fds/docs: reorganize to make way for other docs output
This commit is contained in:
parent
92f8103743
commit
46aa501193
4
Makefile
4
Makefile
@ -1,10 +1,10 @@
|
||||
.PHONY: docs-serve
|
||||
docs-serve:
|
||||
hugo -s docs serve
|
||||
hugo -s docs/website serve
|
||||
|
||||
.PHONY: docs-build
|
||||
docs-build:
|
||||
hugo -s docs
|
||||
hugo -s docs/website
|
||||
|
||||
# Ideally, this should be done only in the remote CI environment with a certain
|
||||
# update cadence/rhythm.
|
||||
|
@ -1 +1 @@
|
||||
docs/content/en/project-overview.adoc
|
||||
docs/website/content/en/project-overview.adoc
|
19
docs/.gitignore
vendored
19
docs/.gitignore
vendored
@ -1,22 +1,3 @@
|
||||
# All of the generated assets.
|
||||
/content/*/nix-module-options/*/content.json
|
||||
|
||||
### Hugo ###
|
||||
# Generated files by hugo
|
||||
/public/
|
||||
/resources/_gen/
|
||||
/assets/jsconfig.json
|
||||
hugo_stats.json
|
||||
|
||||
# Executable may be added to repository
|
||||
hugo.exe
|
||||
hugo.darwin
|
||||
hugo.linux
|
||||
|
||||
# Temporary lock file while building
|
||||
/.hugo_build.lock
|
||||
|
||||
|
||||
### Ruby ###
|
||||
*.gem
|
||||
*.rbc
|
||||
|
11
docs/README.adoc
Normal file
11
docs/README.adoc
Normal file
@ -0,0 +1,11 @@
|
||||
= Documentation
|
||||
:toc:
|
||||
|
||||
This is where the documentation is created, namely both the website and the manual page.
|
||||
|
||||
* The website is powered by Hugo and it is pretty much what makes most of the files here.
|
||||
It requires Hugo and whatever Hugo module feature requires so it isn't possible to build it offline.
|
||||
For now, we rely on the remote CI having network access for it (which is pretty much the standard for the most part so no worries there).
|
||||
|
||||
* The manual page is powered by some under-documented tool in the Nix ecosystem (as is tradition) called https://github.com/NixOS/nixpkgs/tree/de19b7eaffd1ec24c50a6a257f3674a841ab1221/pkgs/tools/nix/nixos-render-docs/src/nixos_render_docs[nixos-render-docs].
|
||||
The adjacent tools in the Nix-module-options-doc-generation ecosystem are also what makes the (autogenerated) Nix module options pages found in the website.
|
@ -1,9 +0,0 @@
|
||||
[[main]]
|
||||
identifier = "nix-module-options"
|
||||
name = "Module options"
|
||||
url = "nix-module-options/"
|
||||
|
||||
[[main]]
|
||||
identifier = "source-code"
|
||||
name = "Source code"
|
||||
url = "https://github.com/foo-dogsquared/wrapper-manager-fds"
|
151
docs/default.nix
151
docs/default.nix
@ -11,74 +11,103 @@ in
|
||||
|
||||
let
|
||||
inherit (pkgs) nixosOptionsDoc stdenv lib;
|
||||
|
||||
# Pretty much inspired from home-manager's documentation build process.
|
||||
evalDoc = args@{ modules, includeModuleSystemOptions ? false, ... }:
|
||||
let
|
||||
options = (pkgs.lib.evalModules {
|
||||
modules = modules ++ [ { _module.check = false; } ];
|
||||
class = "wrapperManager";
|
||||
}).options;
|
||||
in
|
||||
nixosOptionsDoc ({
|
||||
options =
|
||||
if includeModuleSystemOptions
|
||||
then options
|
||||
else builtins.removeAttrs options [ "_module" ];
|
||||
}
|
||||
// builtins.removeAttrs args [ "modules" "includeModuleSystemOptions" ]);
|
||||
buildHugoSite = pkgs.callPackage ./hugo-build-module.nix { };
|
||||
wrapperManagerLib = import ../lib/env.nix;
|
||||
|
||||
wrapperManagerEval = wrapperManagerLib.eval { inherit pkgs; };
|
||||
|
||||
optionsDoc = nixosOptionsDoc { inherit (wrapperManagerEval) options; };
|
||||
|
||||
gems = pkgs.bundlerEnv {
|
||||
name = "wrapper-manager-fds-gem-env";
|
||||
ruby = pkgs.ruby_3_1;
|
||||
gemdir = ./.;
|
||||
wmOptionsDoc = evalDoc {
|
||||
modules = [ ../modules/wrapper-manager ];
|
||||
includeModuleSystemOptions = true;
|
||||
};
|
||||
|
||||
# Now this is some dogfooding.
|
||||
asciidoctorWrapped =
|
||||
wrapperManagerLib.build {
|
||||
inherit pkgs;
|
||||
modules = [
|
||||
({ config, lib, pkgs, ... }: {
|
||||
wrappers.asciidoctor = {
|
||||
arg0 = lib.getExe' gems "asciidoctor";
|
||||
appendArgs = [
|
||||
"-T" "${sources.website}/templates"
|
||||
];
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
in
|
||||
buildHugoSite {
|
||||
pname = "wrapper-manager-docs";
|
||||
version = "2024-07-13";
|
||||
{
|
||||
website =
|
||||
let
|
||||
gems = pkgs.bundlerEnv {
|
||||
name = "wrapper-manager-fds-gem-env";
|
||||
ruby = pkgs.ruby_3_1;
|
||||
gemdir = ./.;
|
||||
};
|
||||
|
||||
src = lib.fileset.toSource {
|
||||
root = ./.;
|
||||
fileset = lib.fileset.unions [
|
||||
./assets
|
||||
./config
|
||||
./content
|
||||
./layouts
|
||||
./go.mod
|
||||
./go.sum
|
||||
];
|
||||
};
|
||||
wrapperManagerLib = (import ../. { }).lib;
|
||||
|
||||
vendorHash = "sha256-vMLi8of2eF/s60B/lM3FDfSntEyieGkvJbTSMuI7Wws=";
|
||||
# Now this is some dogfooding.
|
||||
asciidoctorWrapped =
|
||||
wrapperManagerLib.build {
|
||||
inherit pkgs;
|
||||
modules = [
|
||||
({ config, lib, pkgs, ... }: {
|
||||
wrappers.asciidoctor = {
|
||||
arg0 = lib.getExe' gems "asciidoctor";
|
||||
appendArgs = [
|
||||
"-T" "${sources.website}/templates"
|
||||
];
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
in
|
||||
buildHugoSite {
|
||||
pname = "wrapper-manager-docs";
|
||||
version = "2024-07-13";
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
asciidoctorWrapped
|
||||
hugo
|
||||
git
|
||||
gems
|
||||
gems.wrappedRuby
|
||||
];
|
||||
src = lib.fileset.toSource {
|
||||
root = ./.;
|
||||
fileset = lib.fileset.unions [
|
||||
./website/assets
|
||||
./website/config
|
||||
./website/content
|
||||
./website/layouts
|
||||
./website/go.mod
|
||||
./website/go.sum
|
||||
];
|
||||
};
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
cp --reflink=auto "$src/public" "$out"
|
||||
runHook postInstall
|
||||
vendorHash = "sha256-vMLi8of2eF/s60B/lM3FDfSntEyieGkvJbTSMuI7Wws=";
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
asciidoctorWrapped
|
||||
hugo
|
||||
git
|
||||
gems
|
||||
gems.wrappedRuby
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
description = "wrapper-manager-fds documentation";
|
||||
homepage = "https://github.com/foo-dogsquared/wrapper-manager-fds";
|
||||
license = with licenses; [
|
||||
mit
|
||||
fdl13Only
|
||||
];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
};
|
||||
|
||||
inherit wmOptionsDoc;
|
||||
wmNixosDoc = evalDoc { modules = [ ../modules/env/nixos ]; };
|
||||
wmHmDoc = evalDoc { modules = [ ../modules/env/home-manager ]; };
|
||||
|
||||
manualPage = pkgs.runCommand "wrapper-manager-reference-manpage" {
|
||||
nativeBuildInputs = with pkgs; [ nixos-render-docs ];
|
||||
} ''
|
||||
mkdir -p $out/share/man/man5
|
||||
nixos-render-docs options manpage \
|
||||
${wmOptionsDoc.optionsJSON}/share/doc/nixos/options.json \
|
||||
$out/share/man/man5/wrapper-manager.nix.5
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
description = "wrapper-manager-fds documentation";
|
||||
homepage = "https://github.com/foo-dogsquared/wrapper-manager-fds";
|
||||
license = with licenses; [
|
||||
mit
|
||||
fdl13Only
|
||||
];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
|
@ -1,25 +0,0 @@
|
||||
let
|
||||
sources = import ../npins;
|
||||
in
|
||||
{ pkgs ? import sources.nixos-unstable { } }:
|
||||
|
||||
let
|
||||
inherit (pkgs) nixosOptionsDoc;
|
||||
websitePkg = import ./. { inherit pkgs; };
|
||||
wrapperManagerLib = import ../lib/env.nix;
|
||||
|
||||
wrapperManagerEval = wrapperManagerLib.eval { inherit pkgs; };
|
||||
optionsDoc = nixosOptionsDoc { inherit (wrapperManagerEval) options; };
|
||||
in
|
||||
with pkgs; mkShell {
|
||||
inputsFrom = [ websitePkg ];
|
||||
|
||||
packages = [
|
||||
nodePackages.prettier
|
||||
vscode-langservers-extracted
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
install -Dm0644 ${optionsDoc.optionsJSON}/share/doc/nixos/options.json ./content/en-US/nix-module-options/module-environment/content.json
|
||||
'';
|
||||
}
|
17
docs/website/.gitignore
vendored
Normal file
17
docs/website/.gitignore
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
# All of the generated assets.
|
||||
/content/**/wrapper-manager-*.adoc
|
||||
|
||||
### Hugo ###
|
||||
# Generated files by hugo
|
||||
/public/
|
||||
/resources/_gen/
|
||||
/assets/jsconfig.json
|
||||
hugo_stats.json
|
||||
|
||||
# Executable may be added to repository
|
||||
hugo.exe
|
||||
hugo.darwin
|
||||
hugo.linux
|
||||
|
||||
# Temporary lock file while building
|
||||
/.hugo_build.lock
|
20
docs/website/config/_default/menu.toml
Normal file
20
docs/website/config/_default/menu.toml
Normal file
@ -0,0 +1,20 @@
|
||||
[[main]]
|
||||
identifier = "nix-module-options"
|
||||
name = "Module options"
|
||||
url = "wrapper-manager-env-options/"
|
||||
weight = 1
|
||||
|
||||
[[main]]
|
||||
identifier = "source-code"
|
||||
name = "Source code"
|
||||
url = "https://github.com/foo-dogsquared/wrapper-manager-fds"
|
||||
|
||||
[[main]]
|
||||
identifier = "wrapper-manager-nixos"
|
||||
name = "NixOS module"
|
||||
url = "wrapper-manager-nixos-module/"
|
||||
|
||||
[[main]]
|
||||
identifier = "wrapper-manager-home-manager"
|
||||
name = "home-manager module"
|
||||
url = "wrapper-manager-home-manager-module/"
|
22
docs/website/shell.nix
Normal file
22
docs/website/shell.nix
Normal file
@ -0,0 +1,22 @@
|
||||
let
|
||||
sources = import ../../npins;
|
||||
in
|
||||
{ pkgs ? import sources.nixos-unstable { } }:
|
||||
|
||||
let
|
||||
docs = import ../. { inherit pkgs; };
|
||||
in
|
||||
with pkgs; mkShell {
|
||||
inputsFrom = [ docs.website ];
|
||||
|
||||
packages = [
|
||||
nodePackages.prettier
|
||||
vscode-langservers-extracted
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
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
|
||||
'';
|
||||
}
|
Loading…
Reference in New Issue
Block a user