hyperhive/nix/packages/hive-forge-tools.nix

36 lines
1.3 KiB
Nix

{ pkgs, lib }:
# hive-forge — Forgejo CLI wrapper for hyperhive (closes #280).
#
# Previously a ~600-line bash script. Rewritten as a proper Rust
# binary in `/hive-forge` so we get:
# - typed clap subcommands (`hive-forge <verb> --help` instead of
# reading the case statement),
# - one reqwest client with consistent error surfaces (no more
# `curl --fail-with-body` repeated per verb),
# - sane shell quoting (no more HEREDOC-eaten-by-positional traps
# like #379),
# - and a single test surface.
#
# This Nix file is now a thin extractor: it pulls just the
# `hive-forge` binary out of the hyperhive workspace package so
# agents that already imported this file via
# `pkgs.callPackage ../packages/hive-forge-tools.nix { }` keep
# working, getting only the verb they need on PATH (not the full
# `hive-c0re` / `hive-ag3nt` / `hive-m1nd` surface).
#
# Requires the hyperhive overlay (see `flake.nix`'s `overlays.default`)
# so `pkgs.hyperhive` resolves.
let
_ = lib; # placeholder; kept so callers don't break when reading the args.
in
pkgs.runCommand "hive-forge"
{
meta = {
description = "Forgejo CLI wrapper for hyperhive (Rust)";
mainProgram = "hive-forge";
};
}
''
mkdir -p $out/bin
ln -s ${pkgs.hyperhive}/bin/hive-forge $out/bin/hive-forge
''