docs: move options search to separate page

This commit is contained in:
DavHau
2025-08-08 13:15:33 +07:00
parent 5841432b6f
commit 798d445f3e
7 changed files with 55 additions and 17 deletions

2
docs/.gitignore vendored
View File

@@ -1,5 +1,5 @@
/site/reference /site/reference
/site/static /site/static
/site/options-page /site/options
/site/openapi.json /site/openapi.json
!/site/static/extra.css !/site/static/extra.css

View File

@@ -6,7 +6,7 @@ edit_uri: _edit/main/docs/docs/
validation: validation:
omitted_files: warn omitted_files: warn
absolute_links: warn absolute_links: ignore
unrecognized_links: warn unrecognized_links: warn
markdown_extensions: markdown_extensions:
@@ -88,7 +88,7 @@ nav:
- Templates: concepts/templates.md - Templates: concepts/templates.md
- Reference: - Reference:
- Overview: reference/index.md - Overview: reference/index.md
- Clan Options: options.md - Browse Options: "/options"
- Services: - Services:
- Overview: - Overview:
- reference/clanServices/index.md - reference/clanServices/index.md
@@ -155,6 +155,7 @@ nav:
- 05-deployment-parameters: decisions/05-deployment-parameters.md - 05-deployment-parameters: decisions/05-deployment-parameters.md
- Template: decisions/_template.md - Template: decisions/_template.md
- Glossary: reference/glossary.md - Glossary: reference/glossary.md
- Browse Options: "/options"
docs_dir: site docs_dir: site
site_dir: out site_dir: out

View File

@@ -54,9 +54,9 @@ pkgs.stdenv.mkDerivation {
chmod -R +w ./site/reference chmod -R +w ./site/reference
echo "Generated API documentation in './site/reference/' " echo "Generated API documentation in './site/reference/' "
rm -r ./site/options-page || true rm -rf ./site/options
cp -r ${docs-options} ./site/options-page cp -r ${docs-options} ./site/options
chmod -R +w ./site/options-page chmod -R +w ./site/options
mkdir -p ./site/static/asciinema-player mkdir -p ./site/static/asciinema-player
ln -snf ${asciinema-player-js} ./site/static/asciinema-player/asciinema-player.min.js ln -snf ${asciinema-player-js} ./site/static/asciinema-player/asciinema-player.min.js

View File

@@ -25,7 +25,7 @@
serviceModules = self.clan.modules; serviceModules = self.clan.modules;
baseHref = "/options-page/"; baseHref = "/options/";
getRoles = getRoles =
module: module:
@@ -126,7 +126,7 @@
nestedSettingsOption = mkOption { nestedSettingsOption = mkOption {
type = types.raw; type = types.raw;
description = '' description = ''
See [instances.${name}.roles.${roleName}.settings](${baseHref}?option_scope=0&option=instances.${name}.roles.${roleName}.settings) See [instances.${name}.roles.${roleName}.settings](${baseHref}?option_scope=0&option=inventory.instances.${name}.roles.${roleName}.settings)
''; '';
}; };
settingsOption = mkOption { settingsOption = mkOption {
@@ -161,6 +161,42 @@
} }
]; ];
baseModule =
# Module
{ config, ... }:
{
imports = (import (pkgs.path + "/nixos/modules/module-list.nix"));
nixpkgs.pkgs = pkgs;
clan.core.name = "dummy";
system.stateVersion = config.system.nixos.release;
# Set this to work around a bug where `clan.core.settings.machine.name`
# is forced due to `networking.interfaces` being forced
# somewhere in the nixpkgs options
facter.detected.dhcp.enable = lib.mkForce false;
};
evalClanModules =
let
evaled = lib.evalModules {
class = "nixos";
modules = [
baseModule
{
clan.core.settings.directory = self;
}
self.nixosModules.clanCore
];
};
in
evaled;
coreOptions =
(pkgs.nixosOptionsDoc {
options = (evalClanModules.options).clan.core or { };
warningsAreErrors = true;
transformOptions = self.clanLib.docs.stripStorePathsFromDeclarations;
}).optionsJSON;
in in
{ {
# Uncomment for debugging # Uncomment for debugging
@@ -175,10 +211,17 @@
# scopes = mapAttrsToList mkScope serviceModules; # scopes = mapAttrsToList mkScope serviceModules;
scopes = [ scopes = [
{ {
name = "Clan"; inherit baseHref;
name = "Flake Options (clan.nix file)";
modules = docModules; modules = docModules;
urlPrefix = "https://git.clan.lol/clan/clan-core/src/branch/main/"; urlPrefix = "https://git.clan.lol/clan/clan-core/src/branch/main/";
} }
{
name = "Machine Options (clan.core NixOS options)";
optionsJSON = "${coreOptions}/share/doc/nixos/options.json";
urlPrefix = "https://git.clan.lol/clan/clan-core/src/branch/main/";
}
]; ];
}; };
}; };

View File

@@ -27,7 +27,7 @@ inputs = {
## Import the Clan flake-parts Module ## Import the Clan flake-parts Module
After updating your flake inputs, the next step is to import the Clan flake-parts module. This will make the [Clan options](../options.md) available within `mkFlake`. After updating your flake inputs, the next step is to import the Clan flake-parts module. This will make the [Clan options](/options) available within `mkFlake`.
```nix ```nix
{ {

View File

@@ -1,6 +0,0 @@
---
template: options.html
---
<iframe src="/options-page/" height="1000" width="100%"></iframe>

View File

@@ -4,7 +4,7 @@ This section of the site provides an overview of available options and commands
--- ---
- [Clan Configuration Option](../options.md) - for defining a Clan - [Clan Configuration Option](/options) - for defining a Clan
- Learn how to use the [Clan CLI](./cli/index.md) - Learn how to use the [Clan CLI](./cli/index.md)
- Explore available [services](./clanServices/index.md) - Explore available [services](./clanServices/index.md)
- [NixOS Configuration Options](./clan.core/index.md) - Additional options avilable on a NixOS machine. - [NixOS Configuration Options](./clan.core/index.md) - Additional options avilable on a NixOS machine.