Watch
0
0
Fork
You've already forked hyperhive
0

add rea agent module and reverse-engineer archetype

This commit is contained in:
atlas 2026-10-27 11:32:17 +01:00
commit 50c1f2a3d1
4 changed files with 2083 additions and 8 deletions

View file

@ -276,6 +276,10 @@ in
# is exposed too since it's independently useful/inspectable.
inherit swagger-ui-dist swagger-ui-theme;
# REA and the Ghidra it needs; consumed by nix/agent-modules/rea.nix.
rea = pkgs.callPackage ./rea.nix { };
ghidra-12-1 = pkgs.callPackage ./ghidra-12-1.nix { };
# Pre-built system closure every agent container builds from. Exposed as a package
# so operators can `nix build .#agent-base-toplevel` (or wire
# them into their host system closure via the

View file

@ -0,0 +1,14 @@
{ ghidra-bin, fetchzip }:
# Ghidra 12.1.4 on the pinned nixpkgs' `ghidra-bin` build recipe. REA accepts
# Ghidra >= 12.1 and the pinned nixpkgs ships 12.0.4. Only agents that enable
# `services.hyperhive.agent.rea` reference this, so the shared agent closure
# keeps the pinned Ghidra.
ghidra-bin.overrideAttrs (_: rec {
version = "12.1.4";
versiondate = "20260921";
src = fetchzip {
url = "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_${version}_build/ghidra_${version}_PUBLIC_${versiondate}.zip";
hash = "sha256-ZD4Vs1i7BMvrneAbAiOc7F9iBj64Rbom+PaVO//TzK8=";
};
})

1833
nix/packages/rea-package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

57
nix/packages/rea.nix Normal file
View file

@ -0,0 +1,57 @@
{
lib,
buildNpmPackage,
fetchurl,
jq,
nodejs_22,
}:
# REA ("Reverse Engineer Anything", npm `rea-agents`) from the published
# npm tarball, whose `dist/` is prebuilt: building from the git source runs a
# `compile` step that needs `tsrs`, a native compiler with no nix package.
#
# The tarball carries no lockfile, so ./rea-package-lock.json is vendored: a
# `npm install --package-lock-only` over the tarball's `dependencies` alone.
# Regenerate it on a version bump. `postPatch` strips the tarball's
# `package.json` to the same keys, so the install is production dependencies
# only; `frida`, an optional dependency whose install script downloads a
# toolchain, is left out with them, and `--ignore-scripts` keeps every other
# install script from running.
#
# Node must satisfy `^22.23.4 || ^24.22.1 || >=26.12.1`; nixpkgs' `nodejs_22`
# is the one that does.
buildNpmPackage (finalAttrs: {
pname = "rea-agents";
version = "6.8.0";
nodejs = nodejs_22;
src = fetchurl {
url = "https://registry.npmjs.org/rea-agents/-/rea-agents-${finalAttrs.version}.tgz";
hash = "sha256-jVQux2qcs1BYS2CmycCIcG/4EtW7WwlMIMlbbcJWmLs=";
};
sourceRoot = "package";
postPatch = ''
cp ${./rea-package-lock.json} package-lock.json
${lib.getExe jq} '{ name, version, license, bin, dependencies }' package.json > package.json.new
mv package.json.new package.json
'';
npmDepsHash = "sha256-/YMAZNQHaerVCVUlxTkL2WJyb9FXiu8ZpuBah3fW0+w=";
npmFlags = [ "--ignore-scripts" ];
dontNpmBuild = true;
doInstallCheck = true;
installCheckPhase = ''
runHook preInstallCheck
HOME=$(mktemp -d) $out/bin/rea mcp --help
runHook postInstallCheck
'';
meta = {
description = "Reverse Engineer Anything: an MCP server driving Ghidra and other reverse-engineering tools";
homepage = "https://github.com/morluto/rea";
license = lib.licenses.mit;
mainProgram = "rea";
};
})