feat(#2170): split docs/ into its own meta-flake input
This commit is contained in:
parent
9b607e2857
commit
b5acd60cf5
5 changed files with 148 additions and 18 deletions
35
flake.nix
35
flake.nix
|
|
@ -37,15 +37,17 @@
|
|||
# each real source is a named, explicitly-filtered derivation used
|
||||
# as `src`, rather than an inline filter at the use site.
|
||||
#
|
||||
# Dropped: scripts/, root-level *.md (README/CLAUDE/TODO/…).
|
||||
# Kept (build needs them): .nix, .rs, Cargo.*, branding/, docs/,
|
||||
# frontend/, prompts/, flake.lock. docs/ MUST stay in: the
|
||||
# reference-docs derivation (nix/reference-docs.nix, shipped into
|
||||
# every agent container via claude --add-dir) builds from ../docs,
|
||||
# so a flake source without it can't evaluate — container rebuilds
|
||||
# from the meta flake die with "path …/docs does not exist". The
|
||||
# rebuild-avoidance for doc edits is gone by design: containers now
|
||||
# genuinely depend on the docs tree.
|
||||
# Dropped: scripts/, docs/, root-level *.md (README/CLAUDE/TODO/…).
|
||||
# Kept (build needs them): .nix, .rs, Cargo.*, branding/,
|
||||
# frontend/, prompts/, flake.lock. docs/ is deliberately dropped:
|
||||
# it is shipped to agent containers as its OWN narrow
|
||||
# meta-flake input (`hyperhiveDocsSource`, below), threaded through
|
||||
# hive-c0re → the meta flake → `hyperhive.docs.source`. Keeping docs/
|
||||
# out of THIS source means a doc edit only re-hashes the docs input
|
||||
# (a cheap re-link), not the whole flake source (which would rebuild
|
||||
# every agent container). The old `nix/reference-docs.nix` build from
|
||||
# `../docs` stays only for standalone `nix build .#reference-docs`
|
||||
# from a full checkout — the meta path never evaluates it.
|
||||
hyperhiveFlakeSource = lib.cleanSourceWith {
|
||||
name = "hyperhive-flake-source";
|
||||
src = ./.;
|
||||
|
|
@ -56,8 +58,20 @@
|
|||
rel = lib.removePrefix (toString ./. + "/") (toString path);
|
||||
in
|
||||
!(lib.hasPrefix "scripts/" rel || rel == "scripts")
|
||||
&& !(lib.hasPrefix "docs/" rel || rel == "docs")
|
||||
&& !(type == "regular" && !lib.hasInfix "/" rel && lib.hasSuffix ".md" rel);
|
||||
};
|
||||
# The repo `docs/` tree as a standalone narrow source. Its
|
||||
# store path moves ONLY on doc edits, decoupled from
|
||||
# `hyperhiveFlakeSource`. hive-c0re threads this to the meta flake as
|
||||
# the `hyperhive-docs` input (same pattern as `hyperhiveFlake`); the
|
||||
# harness resolves `$HIVE_DOCS_DIR` from it via `hyperhive.docs.source`.
|
||||
# Evaluated here on the host where docs/ exists — it cannot be derived
|
||||
# from inside the docs-stripped `hyperhiveFlakeSource`.
|
||||
hyperhiveDocsSource = lib.cleanSourceWith {
|
||||
name = "hyperhive-docs-source";
|
||||
src = ./docs;
|
||||
};
|
||||
treefmt-config = {
|
||||
projectRootFile = "flake.nix";
|
||||
programs = {
|
||||
|
|
@ -285,6 +299,9 @@
|
|||
hyperhiveFrontend = system: self.packages.${system}.frontend;
|
||||
hyperhiveAssets = system: self.packages.${system}.assets;
|
||||
hyperhiveFlake = "${hyperhiveFlakeSource}";
|
||||
# Narrow docs/ source, threaded as its own meta-flake input so
|
||||
# doc edits don't re-hash the whole flake source.
|
||||
hyperhiveDocs = "${hyperhiveDocsSource}";
|
||||
# Per-container toplevels — wired into `system.extraDependencies`
|
||||
# when `services.hyperhive.c0re.preBuildAgentTemplates` is on so the
|
||||
# host system closure pre-fetches the heavy build inputs.
|
||||
|
|
|
|||
Loading…
Reference in a new issue