hyperhive/nix/packages/hive-xdg-icons.nix

85 lines
2.5 KiB
Nix

{
stdenv,
librsvg,
# Absolute path to the hyperhive.svg source so this derivation's input
# hash is narrow: a change to any other source file does NOT bust it.
hyperhiveSvg,
}:
# XDG icon set + .desktop entries for hyperhive processes so desktop
# environments can match running processes to icons (task managers, CPU
# monitors, etc.).
#
# Output layout:
# $out/share/icons/hicolor/<N>x<N>/apps/hyperhive.png (N = 16,32,48,64,128,256)
# $out/share/pixmaps/hyperhive.png (48px fallback)
# $out/share/applications/hive-c0re.desktop
# $out/share/applications/hive-agent.desktop
stdenv.mkDerivation {
pname = "hive-xdg-icons";
version = "0.1.0";
# No source tree — everything is built from the single SVG path.
dontUnpack = true;
nativeBuildInputs = [ librsvg ];
buildPhase = ''
runHook preBuild
mkdir -p icons
for size in 16 32 48 64 128 256; do
rsvg-convert --width "$size" --height "$size" \
-o "icons/hyperhive-''${size}.png" \
${hyperhiveSvg}
done
runHook postBuild
'';
installPhase = ''
runHook preInstall
# Per-size hicolor tree
for size in 16 32 48 64 128 256; do
mkdir -p "$out/share/icons/hicolor/''${size}x''${size}/apps"
cp "icons/hyperhive-''${size}.png" \
"$out/share/icons/hicolor/''${size}x''${size}/apps/hyperhive.png"
done
# Flat pixmaps fallback (48px)
mkdir -p "$out/share/pixmaps"
cp icons/hyperhive-48.png "$out/share/pixmaps/hyperhive.png"
# .desktop entries NoDisplay so they don't show up in app launchers
# but are still discovered by process-to-icon matchers (GNOME, etc.).
mkdir -p "$out/share/applications"
cat > "$out/share/applications/hive-c0re.desktop" <<EOF
[Desktop Entry]
Type=Application
Name=hyperhive core
GenericName=hive-c0re
Comment=hyperhive host daemon container lifecycle, broker, operator dashboard
Exec=hive-c0re serve
Icon=hyperhive
Categories=System;
NoDisplay=true
StartupNotify=false
EOF
cat > "$out/share/applications/hive-agent.desktop" <<EOF
[Desktop Entry]
Type=Application
Name=hyperhive agent
GenericName=hive-agent
Comment=hyperhive per-agent harness (claude turn loop + MCP server)
Exec=hive serve
Icon=hyperhive
Categories=System;
NoDisplay=true
StartupNotify=false
EOF
runHook postInstall
'';
dontFixup = true;
meta = {
description = "XDG icon set and .desktop entries for hyperhive processes";
};
}