# Named, explicitly-filtered source views of this repo. Each real # consumer gets its own filtered derivation used as `src`, rather than # an inline filter at the use site. Companion to the rust `cleanSrc` # (crane's cargo-source filter — see ./rust.nix). { lib }: { # Filtered view of this repo handed to hive-c0re as the `hyperhive` # meta-flake input. Drops files no nix or cargo derivation reads — # shell helper scripts and root-level markdown — so editing them # does NOT change the store path and therefore does NOT force a # rebuild of every agent container. # # 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 `reference-docs` 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 = ../.; filter = path: type: let # Repo-relative path (strip the absolute source-dir prefix). 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 the `hyperhive` input); 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; }; }