{ stdenv, lib, librsvg, }: # Static assets the rust workspace reads at runtime: the project's # branding SVG/PNG family + the claude system-prompt template + # claude-settings JSON. Lives as its own derivation so a tweak to # branding/agent-configs.svg or hive-ag3nt/prompts/system.md doesn't # invalidate the rust derivation's cargo cache (closes #555 follow-up # to #538 — naersk previously paired with `src = ./.;` invalidating # every rust build on any branding/prompt edit; crane inherited that # coupling and this split breaks it cleanly). # # Output layout: # # $out/share/hyperhive/branding/{hyperhive.svg, hyperhive.png, # agent-configs.svg, agent-configs.png} # $out/share/hyperhive/prompts/{system.md, claude-settings.json} # # The agent-configs PNG is rendered at build time from the SVG via # rsvg-convert — same shape as the old `hive-c0re/build.rs` rasteriser, # just hoisted into nix so the librsvg dependency stays *here* instead # of in the rust derivation's nativeBuildInputs. stdenv.mkDerivation { pname = "hyperhive-assets"; version = "0.1.0"; # `src` is intentionally narrow — only branding/ + the hive-ag3nt/prompts/ # subdir, NOT the whole tree. Keeps the input hash decoupled from # rust source / docs / nix module edits. srcs = [ ../branding ../hive-ag3nt/prompts ]; # `unpackPhase` would normally extract each src to its own dir; we # just want them side-by-side, so hand-roll a flat copy. unpackPhase = '' runHook preUnpack cp -r ${../branding} branding cp -r ${../hive-ag3nt/prompts} prompts chmod -R u+w branding prompts runHook postUnpack ''; nativeBuildInputs = [ librsvg ]; # No real build step — just render the agent-configs PNG alongside # its SVG. 300×300 matches branding/hyperhive.png, which is the size # Forgejo's avatar endpoint accepts without resampling on upload (the # same constraint hive-c0re/build.rs encoded). buildPhase = '' runHook preBuild rsvg-convert --width 300 --height 300 \ -o branding/agent-configs.png \ branding/agent-configs.svg runHook postBuild ''; installPhase = '' runHook preInstall mkdir -p $out/share/hyperhive cp -r branding $out/share/hyperhive/branding cp -r prompts $out/share/hyperhive/prompts runHook postInstall ''; # Pure data — no executables to fixup, no shared libs to patchelf. dontFixup = true; meta = { description = "hyperhive static assets (branding + claude prompts)"; homepage = "https://forge.darkest.space/hyperhive/hyperhive"; license = lib.licenses.mit; }; }