nix/docs: extract CSS into sibling file (#625)
Per mara on #622 comment 7442: > follow up moving scripts and css and stuff out of the nix file. > can live in the same dir. Layout: nix/docs/ default.nix ← what was nix/docs.nix style.css ← extracted from inline `styleCSS = '' ... ''` `builtins.readFile ./style.css` loads the stylesheet at evaluation time, so the rendered HTML stays byte-identical (CSS inlined into each page's `<style>` block — verified). Future client-side scripts can land at `nix/docs/script.js` with the same `builtins.readFile` pattern. Bonus: the docs.nix stub NixOS eval was still force-disabling `hyperhive.{forge,matrix}.enable` on the pre-#615 namespace; updated to `services.hyperhive.{forge,matrix}.enable` so `nix flake check` passes against current main. (Same fix lives on PRs #619 + #620; whichever lands first wins, the others rebase to a no-op.) `flake.nix` references updated: `./nix/docs.nix` → `./nix/docs`. Verified: - `nix flake check --no-build` passes clean - `nix build .#docs` produces 5-file bundle identical to pre-PR shape - inline CSS still appears 3× per HTML page (one per index/host/agent)
This commit is contained in:
parent
7ab3b125ec
commit
32661cf806
3 changed files with 84 additions and 84 deletions
|
|
@ -116,7 +116,7 @@
|
||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
docsAttrs = import ./nix/docs.nix {
|
docsAttrs = import ./nix/docs {
|
||||||
inherit pkgs self;
|
inherit pkgs self;
|
||||||
inherit (nixpkgs) lib;
|
inherit (nixpkgs) lib;
|
||||||
inherit (nixpkgs.lib) nixosSystem;
|
inherit (nixpkgs.lib) nixosSystem;
|
||||||
|
|
@ -349,7 +349,7 @@
|
||||||
# frontend deps. CI fails fast if a module change breaks
|
# frontend deps. CI fails fast if a module change breaks
|
||||||
# option declarations or the doc rendering. Reuses the
|
# option declarations or the doc rendering. Reuses the
|
||||||
# `packages.<system>.docs` derivation so the per-system eval
|
# `packages.<system>.docs` derivation so the per-system eval
|
||||||
# of `nix/docs.nix` happens once.
|
# of `nix/docs/default.nix` happens once.
|
||||||
inherit (self.packages.${system}) docs;
|
inherit (self.packages.${system}) docs;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -137,95 +137,19 @@ let
|
||||||
echo "# ${title}"
|
echo "# ${title}"
|
||||||
echo
|
echo
|
||||||
echo "<!-- Auto-generated from the hyperhive flake."
|
echo "<!-- Auto-generated from the hyperhive flake."
|
||||||
echo " Source: nix/docs.nix · regenerate with"
|
echo " Source: nix/docs/default.nix · regenerate with"
|
||||||
echo " \`nix build .#${name}\` -->"
|
echo " \`nix build .#${name}\` -->"
|
||||||
echo
|
echo
|
||||||
cat ${doc.optionsCommonMark}
|
cat ${doc.optionsCommonMark}
|
||||||
} > $out
|
} > $out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Single self-contained stylesheet. Inlined into every page so the
|
# Inline-stylesheet, loaded as plain text from `./style.css` so it's
|
||||||
# bundle doesn't depend on a second HTTP fetch — keeps the
|
# editable with normal CSS tooling (#625). Inlined into every page
|
||||||
|
# so the bundle doesn't depend on a second HTTP fetch — keeps the
|
||||||
# `/options/` mount trivial for nginx (no MIME guessing for separate
|
# `/options/` mount trivial for nginx (no MIME guessing for separate
|
||||||
# .css files, no cache-busting needed when this updates).
|
# .css files, no cache-busting needed when this updates).
|
||||||
styleCSS = ''
|
styleCSS = builtins.readFile ./style.css;
|
||||||
:root {
|
|
||||||
color-scheme: light dark;
|
|
||||||
--fg: #1a1a1a;
|
|
||||||
--bg: #fafafa;
|
|
||||||
--muted: #6b6b6b;
|
|
||||||
--accent: #5e548e;
|
|
||||||
--code-bg: rgba(94, 84, 142, 0.08);
|
|
||||||
--rule: rgba(94, 84, 142, 0.2);
|
|
||||||
}
|
|
||||||
@media (prefers-color-scheme: dark) {
|
|
||||||
:root {
|
|
||||||
--fg: #e6e6e6;
|
|
||||||
--bg: #0d0d0d;
|
|
||||||
--muted: #9b9b9b;
|
|
||||||
--accent: #c4a7e7;
|
|
||||||
--code-bg: rgba(196, 167, 231, 0.08);
|
|
||||||
--rule: rgba(196, 167, 231, 0.2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
* { box-sizing: border-box; }
|
|
||||||
body {
|
|
||||||
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
||||||
max-width: 56rem;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding: 2rem 1.25rem 4rem;
|
|
||||||
color: var(--fg);
|
|
||||||
background: var(--bg);
|
|
||||||
line-height: 1.55;
|
|
||||||
}
|
|
||||||
nav {
|
|
||||||
margin-bottom: 2rem;
|
|
||||||
padding-bottom: 1rem;
|
|
||||||
border-bottom: 1px solid var(--rule);
|
|
||||||
font-size: 0.9rem;
|
|
||||||
color: var(--muted);
|
|
||||||
}
|
|
||||||
nav a { color: var(--accent); text-decoration: none; }
|
|
||||||
nav a:hover { text-decoration: underline; }
|
|
||||||
nav a + a { margin-left: 0.5rem; }
|
|
||||||
nav a + a::before { content: "· "; color: var(--muted); margin-right: 0.25rem; }
|
|
||||||
h1, h2, h3 { color: var(--accent); line-height: 1.25; }
|
|
||||||
h1 { font-size: 1.75rem; margin-top: 0; }
|
|
||||||
h2 {
|
|
||||||
font-size: 1.15rem;
|
|
||||||
margin-top: 2.5rem;
|
|
||||||
padding-top: 0.5rem;
|
|
||||||
border-top: 1px solid var(--rule);
|
|
||||||
font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
|
|
||||||
}
|
|
||||||
h3 { font-size: 1rem; }
|
|
||||||
p { margin: 0.75rem 0; }
|
|
||||||
code {
|
|
||||||
background: var(--code-bg);
|
|
||||||
padding: 0.1em 0.35em;
|
|
||||||
border-radius: 0.25em;
|
|
||||||
font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
|
|
||||||
font-size: 0.9em;
|
|
||||||
}
|
|
||||||
pre {
|
|
||||||
background: var(--code-bg);
|
|
||||||
padding: 0.85rem 1rem;
|
|
||||||
border-left: 2px solid var(--accent);
|
|
||||||
border-radius: 0 0.25rem 0.25rem 0;
|
|
||||||
overflow-x: auto;
|
|
||||||
line-height: 1.4;
|
|
||||||
}
|
|
||||||
pre code { background: transparent; padding: 0; }
|
|
||||||
a { color: var(--accent); }
|
|
||||||
em { color: var(--muted); font-style: normal; font-size: 0.9em; }
|
|
||||||
footer {
|
|
||||||
margin-top: 4rem;
|
|
||||||
padding-top: 1rem;
|
|
||||||
border-top: 1px solid var(--rule);
|
|
||||||
font-size: 0.85rem;
|
|
||||||
color: var(--muted);
|
|
||||||
}
|
|
||||||
'';
|
|
||||||
|
|
||||||
# HTML page: CommonMark → cmark-gfm → minimal template with inline
|
# HTML page: CommonMark → cmark-gfm → minimal template with inline
|
||||||
# CSS + relative-only links. cmark-gfm rather than plain cmark so
|
# CSS + relative-only links. cmark-gfm rather than plain cmark so
|
||||||
|
|
@ -252,7 +176,7 @@ let
|
||||||
echo '</nav>'
|
echo '</nav>'
|
||||||
echo '<main>'
|
echo '<main>'
|
||||||
echo '<h1>${title}</h1>'
|
echo '<h1>${title}</h1>'
|
||||||
echo '<p><em>Auto-generated from the hyperhive flake. Source: <a href="${forgeRoot}/nix/docs.nix">nix/docs.nix</a>.</em></p>'
|
echo '<p><em>Auto-generated from the hyperhive flake. Source: <a href="${forgeRoot}/nix/docs/default.nix">nix/docs/default.nix</a>.</em></p>'
|
||||||
cmark-gfm ${doc.optionsCommonMark}
|
cmark-gfm ${doc.optionsCommonMark}
|
||||||
echo '</main>'
|
echo '</main>'
|
||||||
echo '<footer>'
|
echo '<footer>'
|
||||||
76
nix/docs/style.css
Normal file
76
nix/docs/style.css
Normal file
|
|
@ -0,0 +1,76 @@
|
||||||
|
:root {
|
||||||
|
color-scheme: light dark;
|
||||||
|
--fg: #1a1a1a;
|
||||||
|
--bg: #fafafa;
|
||||||
|
--muted: #6b6b6b;
|
||||||
|
--accent: #5e548e;
|
||||||
|
--code-bg: rgba(94, 84, 142, 0.08);
|
||||||
|
--rule: rgba(94, 84, 142, 0.2);
|
||||||
|
}
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
:root {
|
||||||
|
--fg: #e6e6e6;
|
||||||
|
--bg: #0d0d0d;
|
||||||
|
--muted: #9b9b9b;
|
||||||
|
--accent: #c4a7e7;
|
||||||
|
--code-bg: rgba(196, 167, 231, 0.08);
|
||||||
|
--rule: rgba(196, 167, 231, 0.2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
* { box-sizing: border-box; }
|
||||||
|
body {
|
||||||
|
font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
||||||
|
max-width: 56rem;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 2rem 1.25rem 4rem;
|
||||||
|
color: var(--fg);
|
||||||
|
background: var(--bg);
|
||||||
|
line-height: 1.55;
|
||||||
|
}
|
||||||
|
nav {
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
border-bottom: 1px solid var(--rule);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
color: var(--muted);
|
||||||
|
}
|
||||||
|
nav a { color: var(--accent); text-decoration: none; }
|
||||||
|
nav a:hover { text-decoration: underline; }
|
||||||
|
nav a + a { margin-left: 0.5rem; }
|
||||||
|
nav a + a::before { content: "· "; color: var(--muted); margin-right: 0.25rem; }
|
||||||
|
h1, h2, h3 { color: var(--accent); line-height: 1.25; }
|
||||||
|
h1 { font-size: 1.75rem; margin-top: 0; }
|
||||||
|
h2 {
|
||||||
|
font-size: 1.15rem;
|
||||||
|
margin-top: 2.5rem;
|
||||||
|
padding-top: 0.5rem;
|
||||||
|
border-top: 1px solid var(--rule);
|
||||||
|
font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
|
||||||
|
}
|
||||||
|
h3 { font-size: 1rem; }
|
||||||
|
p { margin: 0.75rem 0; }
|
||||||
|
code {
|
||||||
|
background: var(--code-bg);
|
||||||
|
padding: 0.1em 0.35em;
|
||||||
|
border-radius: 0.25em;
|
||||||
|
font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
pre {
|
||||||
|
background: var(--code-bg);
|
||||||
|
padding: 0.85rem 1rem;
|
||||||
|
border-left: 2px solid var(--accent);
|
||||||
|
border-radius: 0 0.25rem 0.25rem 0;
|
||||||
|
overflow-x: auto;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
pre code { background: transparent; padding: 0; }
|
||||||
|
a { color: var(--accent); }
|
||||||
|
em { color: var(--muted); font-style: normal; font-size: 0.9em; }
|
||||||
|
footer {
|
||||||
|
margin-top: 4rem;
|
||||||
|
padding-top: 1rem;
|
||||||
|
border-top: 1px solid var(--rule);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
color: var(--muted);
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue