nix: hyperhive-the-movie app (gource history movie), replaces gource.sh
This commit is contained in:
parent
29569e90ed
commit
f08a0a5d09
3 changed files with 97 additions and 0 deletions
10
flake.nix
10
flake.nix
|
|
@ -69,6 +69,16 @@
|
|||
}
|
||||
);
|
||||
|
||||
apps = forAllSystems (
|
||||
{ system, ... }:
|
||||
{
|
||||
hyperhive-the-movie = {
|
||||
type = "app";
|
||||
program = "${self.packages.${system}.hyperhive-the-movie}/bin/hyperhive-the-movie";
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
nixosModules =
|
||||
let
|
||||
# Package wiring for agent containers — the harness modules
|
||||
|
|
|
|||
|
|
@ -149,6 +149,11 @@ in
|
|||
}
|
||||
// binPkgs
|
||||
// {
|
||||
# `nix run .#hyperhive-the-movie`: gource over the cwd repo's history.
|
||||
hyperhive-the-movie = pkgs.callPackage ./hyperhive-the-movie.nix {
|
||||
logo = ../../branding/hyperhive.png;
|
||||
};
|
||||
|
||||
# Swarm-level controller daemon. Deliberately NOT in `daemonBins`:
|
||||
# that list is the core stack — the binaries hive-c0re and the agent
|
||||
# harness are made of — and it drives the `default` bundle that
|
||||
|
|
|
|||
82
nix/packages/hyperhive-the-movie.nix
Normal file
82
nix/packages/hyperhive-the-movie.nix
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
# `nix run .#hyperhive-the-movie` — gource visualisation of the git
|
||||
# history of the repo it is run from. `-- --record` renders
|
||||
# gource-hyperhive.mp4 in the cwd instead of opening a window.
|
||||
{
|
||||
lib,
|
||||
writeShellApplication,
|
||||
gource,
|
||||
ffmpeg,
|
||||
xvfb-run,
|
||||
librsvg,
|
||||
curl,
|
||||
git,
|
||||
coreutils,
|
||||
gnugrep,
|
||||
logo,
|
||||
}:
|
||||
writeShellApplication {
|
||||
name = "hyperhive-the-movie";
|
||||
runtimeInputs = [
|
||||
gource
|
||||
ffmpeg
|
||||
xvfb-run
|
||||
librsvg
|
||||
curl
|
||||
git
|
||||
coreutils
|
||||
gnugrep
|
||||
];
|
||||
text = ''
|
||||
record=false
|
||||
[[ "''${1:-}" == "--record" ]] && record=true
|
||||
|
||||
cd "$(git rev-parse --show-toplevel)"
|
||||
|
||||
# Per-agent avatars from the local forge (same icons the dashboard
|
||||
# uses), rasterised because --user-image-dir needs png. Cached.
|
||||
# müde is the human operator: no forge icon.
|
||||
avatar_dir="''${XDG_CACHE_HOME:-$HOME/.cache}/hyperhive-the-movie/avatars"
|
||||
mkdir -p "$avatar_dir"
|
||||
while IFS= read -r author; do
|
||||
[[ "$author" == "müde" || -f "$avatar_dir/$author.png" ]] && continue
|
||||
svg="$avatar_dir/$author.svg"
|
||||
curl -sSf "http://localhost/agent/$author/icon" -o "$svg" 2>/dev/null || rm -f "$svg"
|
||||
# unknown agents get a 200 html fallback page, not a 404
|
||||
if [[ -f "$svg" ]]; then
|
||||
if head -c 200 "$svg" | grep -qi '<svg'; then
|
||||
rsvg-convert -w 256 -h 256 "$svg" -o "$avatar_dir/$author.png"
|
||||
fi
|
||||
rm -f "$svg"
|
||||
fi
|
||||
done < <(git log --format='%an' | sort -u)
|
||||
|
||||
# Catppuccin Mocha, as in frontend/packages/shared/src/colors.css.
|
||||
args=(
|
||||
-s 1 -1280x720 --auto-skip-seconds 1 --multi-sampling --stop-at-end
|
||||
--background-colour 1e1e2e --font-colour cdd6f4
|
||||
--highlight-colour f9e2af --highlight-users --highlight-dirs
|
||||
--filename-colour 585b70 --dir-colour 89b4fa
|
||||
--bloom-multiplier 1.5 --bloom-intensity 0.75 --elasticity 0.3
|
||||
--title hyperhive
|
||||
--logo ${logo} --logo-offset 20x20
|
||||
--user-image-dir "$avatar_dir"
|
||||
--key
|
||||
)
|
||||
|
||||
if $record; then
|
||||
xvfb-run -a --server-args="-screen 0 1280x720x24" \
|
||||
gource "''${args[@]}" --output-ppm-stream - --output-framerate 30 \
|
||||
| ffmpeg -y -r 30 -f image2pipe -vcodec ppm -i - \
|
||||
-vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" \
|
||||
-vcodec libx264 -preset ultrafast -pix_fmt yuv420p -crf 1 -threads 0 -bf 0 \
|
||||
gource-hyperhive.mp4
|
||||
else
|
||||
gource "''${args[@]}"
|
||||
fi
|
||||
'';
|
||||
meta = {
|
||||
description = "gource movie of the hyperhive git history";
|
||||
mainProgram = "hyperhive-the-movie";
|
||||
platforms = lib.platforms.linux;
|
||||
};
|
||||
}
|
||||
Loading…
Reference in a new issue