Generate documentation for NixOS and Home Manager options 📝

This commit is contained in:
Daniel Thwaites 2023-02-04 12:07:06 +00:00
parent 3567250ba0
commit 6fa03db360
No known key found for this signature in database
GPG key ID: D8AFC4BF05670F9D
2 changed files with 62 additions and 5 deletions

View file

@ -9,7 +9,8 @@
<h1>Stylix</h1>
<nav>
<a href="">Home</a>
<a href="options.html">Options list</a>
<a href="options.html">NixOS options</a>
<a href="options-hm.html">Home Manager options</a>
<a href="haddock/doc-index.html">Haskell internals</a>
<a href="https://github.com/danth/stylix">GitHub repository</a>
</nav>
@ -25,22 +26,52 @@
tail -n+2 ${../README.md} >$out
'';
}
{
path = "options.html";
title = "NixOS Options";
title = "NixOS options";
body.docbook =
let
nixosSystem = pkgsLib.nixosSystem {
configuration = pkgsLib.nixosSystem {
inherit (pkgs) system;
modules = [
inputs.home-manager.nixosModules.home-manager
inputs.self.nixosModules.stylix
./settings.nix
{ _module.check = false; }
];
};
in
coricamuLib.makeOptionsDocBook {
inherit (nixosSystem) options;
inherit (configuration) options;
customFilter = option: builtins.elemAt option.loc 0 == "stylix";
};
}
{
path = "options-hm.html";
title = "Home Manager options";
body.docbook =
let
configuration = inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
inputs.self.homeManagerModules.stylix
./settings.nix
{
home = {
homeDirectory = "/home/docs";
stateVersion = "22.11";
username = "docs";
};
}
];
check = false;
};
in
coricamuLib.makeOptionsDocBook {
inherit (configuration) options;
customFilter = option: builtins.elemAt option.loc 0 == "stylix";
};
}

26
docs/settings.nix Normal file
View file

@ -0,0 +1,26 @@
# Dummy values to avoid errors when generating the documentation.
{
stylix = {
image = "/a/b/c";
base16Scheme = {
base00 = "ffffff";
base01 = "ffffff";
base02 = "ffffff";
base03 = "ffffff";
base04 = "ffffff";
base05 = "ffffff";
base06 = "ffffff";
base07 = "ffffff";
base08 = "ffffff";
base09 = "ffffff";
base0A = "ffffff";
base0B = "ffffff";
base0C = "ffffff";
base0D = "ffffff";
base0E = "ffffff";
base0F = "ffffff";
};
};
}