diff --git a/flake.nix b/flake.nix index 4b39a3fd..db3ac654 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,33 @@ "aarch64-linux" "x86_64-linux" ]; + # Explicit per-consumer source filter for the hyperhive flake path + # handed to hive-c0re (`hyperhiveFlake`, below). A filtered view of + # this repo that drops files no nix or cargo derivation reads — + # documentation, 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. + # + # Companion to the rust `cleanSrc` (crane's cargo-source filter): + # each real source is a named, explicitly-filtered derivation used + # as `src`, rather than an inline filter at the use site. + # + # Dropped: docs/, scripts/, root-level *.md (README/CLAUDE/TODO/…). + # Kept (build needs them): .nix, .rs, Cargo.*, branding/, frontend/, + # prompts/, flake.lock. + 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 "docs/" rel || rel == "docs") + && !(lib.hasPrefix "scripts/" rel || rel == "scripts") + && !(type == "regular" && !lib.hasInfix "/" rel && lib.hasSuffix ".md" rel); + }; treefmt-config = { projectRootFile = "flake.nix"; programs = { @@ -234,7 +261,7 @@ hyperhivePackage = system: self.packages.${system}.default; hyperhiveFrontend = system: self.packages.${system}.frontend; hyperhiveAssets = system: self.packages.${system}.assets; - hyperhiveFlake = "${self}"; + hyperhiveFlake = "${hyperhiveFlakeSource}"; # Store path of the nixpkgs-unstable input this flake was evaluated # with — the channel that carries claude-code. Passed as the default # for `services.hyperhive.c0re.nixpkgsUnstableFlake` so operators can