{ 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-ghidra"; 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"' ''; }