47 lines
1.1 KiB
Nix
47 lines
1.1 KiB
Nix
{
|
|
lib,
|
|
fetchFromGitHub,
|
|
buildGhidraScripts,
|
|
runCommand,
|
|
rsync,
|
|
|
|
python311,
|
|
}: let
|
|
python = python311;
|
|
libbs_path = "${python.pkgs.libbs}/${python.sitePackages}";
|
|
binsync_path = "${python.pkgs.binsync}/${python.sitePackages}";
|
|
|
|
binsync_env = python.withPackages (ps: with ps; ([
|
|
binsync
|
|
] ++ binsync.optional-dependencies.ghidra));
|
|
in buildGhidraScripts {
|
|
pname = "BinSync";
|
|
inherit (python.pkgs.binsync) version;
|
|
|
|
src = runCommand "binsync-ghidra-scripts" {
|
|
nativeBuildInputs = [ rsync ];
|
|
strictDeps = true;
|
|
} ''
|
|
mkdir -p $out
|
|
|
|
rsync -r \
|
|
--exclude='__pycache__' \
|
|
--exclude='/__init__.py' \
|
|
${libbs_path}/libbs/decompiler_stubs/ghidra_libbs/. $out/.
|
|
|
|
cp ${binsync_path}/binsync/binsync_plugin.py $out
|
|
'';
|
|
|
|
postPatch = ''
|
|
substituteInPlace binsync_plugin.py \
|
|
--replace-fail 'plugin_command = "binsync -s ghidra"' \
|
|
'plugin_command = "${lib.getExe' binsync_env "binsync"} -s ghidra"'
|
|
'';
|
|
|
|
meta = {
|
|
description = "Reversing plugin for cross-decompiler collaboration, built on git";
|
|
homepage = "https://github.com/binsync/binsync";
|
|
license = lib.licenses.bsd2;
|
|
};
|
|
}
|