Skip to content

docs: publish plugin-env.md on the options-doc Pages site (#614) - #629

Merged
vibechoom merged 2 commits into
mainfrom
docs/publish-plugin-env-614
Jul 30, 2026
Merged

docs: publish plugin-env.md on the options-doc Pages site (#614)#629
vibechoom merged 2 commits into
mainfrom
docs/publish-plugin-env-614

Conversation

@vibechoom

@vibechoom vibechoom commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Closes #614

Design points settled (per the issue)

  1. Who renders the Markdown? Took the preferred option: the options-doc derivation now renders docs/plugin-env.md too, reusing the exact same rendering mechanism options.html uses (factored into a shared render_page shell function so both pages share one source of styling truth). The workflow (.github/workflows/options-doc.yml) stays a dumb copier — it just copies files out of result/.

    One tool swap was required to do this properly: cmarkcmark-gfm. plugin-env.md's env-var reference tables are GFM pipe tables (| Variable | Default | Effect |), which plain CommonMark has no syntax for — verified with plain cmark --unsafe first, which printed the | characters literally instead of a table. cmark-gfm --extension table is still the same tiny C library (no pandoc/Haskell closure), just the GFM-flavored build, applied uniformly to both docs (harmless on options.md, which has no tables).

  2. The root page. index.html is no longer a byte-copy of options.html. The derivation now generates a small landing page linking both documents, styled consistently with the rest of the site (same inline CSS approach, no new dependency, no JS framework). Both options.html and plugin-env.html also gained a small "← trollshell docs" nav link back to the new root.

Review follow-up (this PR was adversarially reviewed before merge)

Four gaps were found and fixed in a second commit, three cosmetic-shaped but one structural:

  1. options-doc is now in checks, not just packages. nix flake check — the only gate CI runs on PRs — never built the options-doc derivation this PR just made meaningfully bigger. That's the exact chore(ci): flake checks never build packages.trollshell — CI can be green while nix build is red #449-class gap flake.nix already documents for trollshell/trollshell-control-center: a broken derivation could stay green here and only surface as a red Pages deploy after merge.

    Wiring it in wasn't a plain inherit, though — options-doc was originally defined inline inside packages's own let block, and checks has its own, separately-scoped let block (each forAllSystems callback is an independent scope), so the binding simply wasn't reachable from there. Fixed by extracting the whole derivation into nix/options-doc.nix, pkgs.callPackage'd from both packages and checks — the same shape already used for trollshell, bundledPlugins, and hytte-infobroker, which are likewise built via a shared file from both outputs rather than defined inline in one and inherited by the other. options-doc is pure module evaluation plus one tiny C binary (cmark-gfm), so this is effectively free on every nix flake check run.

  2. nix/module-common.nix's plugins.<name>.env option description — the only in-repo cross-reference to the env-knob doc — pointed at raw Markdown on GitHub instead of the newly-published plugin-env.html. Repointed to the absolute Pages URL: https://vibec0re.github.io/trollshell/plugin-env.html. Deliberately absolute, not relative — this same description is rendered by nixos-option and man home-configuration.nix, where a relative plugin-env.html link resolves to nothing.

  3. Shared page styling. The landing page's inline <style> was a second, independently-drifting copy of render_page's (already visibly different: the landing page's <h1> inherited line-height:1.5 from body while both doc pages used 1.2). Folded into the nix/options-doc.nix extraction: page_style/page_head/page_foot are now one shared shell function/variable set used by all three generated pages — verified byte-identical <style> blocks across index.html, options.html, and plugin-env.html after the fix.

  4. Workflow copy step now matches its own comment. options-doc.yml claimed "this workflow only copies files out of result/ into _site/" while actually hand-enumerating five cps — a sixth derivation output would have silently not published, with no gate catching it. Changed to cp -R result/share/doc/trollshell/. _site/, so the comment is now literally true and a future output file ships automatically.

Gate evidence

nix build .#options-doc, inspecting result/share/doc/trollshell/ (current, post-review-fixes):

$ ls -la result/share/doc/trollshell/
index.html        911 bytes   — landing page, links options.html + plugin-env.html, shares render_page's style
options.html    27011 bytes   — options reference, nav link back to index, shared style
options.md      21554 bytes   — unchanged raw nixosOptionsDoc CommonMark (description text grew slightly, see point 2)
plugin-env.html 14940 bytes   — rendered plugin-env.md; confirmed 5 real <table> elements (GFM pipe tables)
plugin-env.md   15778 bytes   — raw copy of docs/plugin-env.md

plugin-env.html has its own <h1>Plugin environment-variable reference</h1> (from the file's own top heading — no duplicate H1 injected, unlike options.md, which has none of its own and gets one injected via render_page's optional third argument).

nix fmt — first run: 0 changed. Second run: 0 changed.

nix flake check -L was kicked off locally to double-check the new checks entry doesn't turn CI red, but the workspace-wide clippy/test/VM suite runs well past any reasonable local wait (~37 min is this repo's own CI number for the equivalent job) — pushing was correctly prioritized over waiting on a local run that duplicates what CI's flake-check job will verify authoritatively. If options-doc-in-checks turns this PR's CI red, that is exactly the signal adding it was for, and it'll get fixed then.

What CI does and doesn't cover

options-doc.yml (the actual Pages-publishing workflow) is deliberately not part of nix flake check and still isn't after this PR — so CI never exercises the cp -R/deploy steps themselves, only the options-doc derivation's build (now via checks, see review point 1 above).

Manual check for a human after merge: watch the "options doc → GitHub Pages" Action run once this lands on main, then check the deployed site:

  • Root (https://vibec0re.github.io/trollshell/) shows the small landing page (not the options doc directly) — confirm both links work.
  • .../plugin-env.html renders with real tables, code spans, and the "← trollshell docs" nav back to root.
  • .../options.html still renders correctly, including its plugins.<name>.env description now linking out to plugin-env.html with a real, working absolute URL.

🤖 Generated with Claude Code

vibechoom and others added 2 commits July 30, 2026 14:05
Step 4 of #573, deferred by PR #574 until #570's flake.nix/workflow
changes landed (they did, 2026-07-28). docs/plugin-env.md was readable
only in the repo while the options reference next to it was published.

Teaches the options-doc derivation (flake.nix) to render plugin-env.md
too, rather than doing it in the workflow: it reuses the exact same
cmark rendering path as options.html, factored into a small render_page
shell function, so both pages share one source of styling truth. The
cmark tool swaps to cmark-gfm (still tiny, no pandoc/Haskell closure)
because plugin-env.md's env-var tables are GFM pipe tables, which plain
CommonMark has no syntax for and would otherwise print literally.

Since there are now two documents, index.html stops being a byte-copy
of options.html and becomes a small generated landing page linking
both. options-doc.yml stays a dumb copier: it now copies plugin-env's
.md/.html and the derivation's own index.html instead of re-deriving
one from options.html.

Closes #614

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Adversarial review of PR #629 found four gaps, all one-liners on paper but
one required a real structural fix:

1. options-doc was never wired into `checks`, so `nix flake check` (the
   only gate CI runs on PRs) never built the derivation this PR just made
   meaningfully bigger — the exact #449-class gap flake.nix already warns
   about for `trollshell`/`trollshell-control-center`. Wiring it in isn't a
   plain `inherit`, though: `options-doc` was defined inline inside
   `packages`'s own `let` block, which is a different scope from `checks`'s
   `let` block (each `forAllSystems` callback is independently scoped), so
   the name simply wasn't in reach. Extracted the whole derivation into
   nix/options-doc.nix — its own file, `pkgs.callPackage`'d from both
   `packages` and `checks` — matching how `trollshell`, `bundledPlugins`,
   and `hytte-infobroker` are already built in both outputs from a shared
   file rather than duplicated inline. `options-doc` is pure eval plus one
   tiny C binary, so this is effectively free on every `nix flake check`.

2. nix/module-common.nix's `plugins.<name>.env` option description — the
   only in-repo pointer to the env-knob reference — linked to raw Markdown
   on GitHub instead of the now-published plugin-env.html. Repointed to the
   absolute Pages URL (https://vibec0re.github.io/trollshell/plugin-env.html).
   Deliberately absolute, not relative: this same description is rendered
   by `nixos-option` and `man home-configuration.nix`, where a relative
   `plugin-env.html` resolves to nothing.

3. The landing page's inline <style> was a second, independently-drifting
   copy of render_page's — already visibly different (h1 line-height 1.5 vs
   1.2). Folded into the nix/options-doc.nix extraction: page_style/
   page_head/page_foot are now shared shell functions/variables used by all
   three generated pages, verified byte-identical across index.html,
   options.html, and plugin-env.html.

4. options-doc.yml's "this workflow only copies files" comment didn't match
   five hand-enumerated `cp`s, so a future new output file wouldn't publish
   and no gate would notice. Changed to `cp -R result/share/doc/trollshell/.
   _site/`, making the comment actually true.

Rebuilt `nix build .#options-doc` after each fix; output file list
unchanged (index.html, options.html, options.md, plugin-env.html,
plugin-env.md). `nix fmt` clean (0 changed) both before and after.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@vibechoom
vibechoom merged commit 0e50e96 into main Jul 30, 2026
1 check passed
vibechoom added a commit that referenced this pull request Jul 30, 2026
…630/#634 (#636)

PR #634 (closes #613) makes two existing entries actively wrong rather than
merely stale, which is worse than a gap: a verifier following the old text
would read a successful self-heal as a regression. Corrects both, per #635:

- The #610 "restart NetworkManager" caveat no longer says the backend probe
  runs once at startup; it retries while inconclusive. The deferred re-probe
  gap now points at #633 (the genuinely-unsolved half — switching backends
  after one is already committed) instead of the closed #613.
- The #609 entry no longer expects an `error!` pointing at
  `systemctl --user restart trollshell` on a transient probe failure. The
  shipped retry policy is unbounded and self-heals into a `RECOVERED` line
  instead of giving up.

Also folds in the three PRs that merged alongside #634 since the doc's last
refresh (#628):

- #629 (closes #614): docs/plugin-env.md publishing to the Pages options-doc
  site, new "Documentation site (GitHub Pages)" section (deploy itself is
  outside `nix flake check` by design — flagged as a manual check).
- #630 (closes #627): modal::close_all's borrow-timing fix, added to Shell
  chrome as a regression-only check — explicitly states that no observable
  change is the pass condition.
- #634 itself: new Wi-Fi entry covering the INCONCLUSIVE/RECOVERED journal
  pair and the incidental startup-freeze fix.
- #628: docs-only refresh of this file, noted in the closing section.

Coverage line bumped to #458 through #634. Documentation-only change.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docs: publish plugin-env.md on the Pages options-doc site — #573 step 4 (prerequisite #570 has merged)

1 participant