From a4314b2079971be847764f4103dc237bce9d5151 Mon Sep 17 00:00:00 2001 From: Ingo Reitz <9l@9lo.re> Date: Fri, 14 Nov 2025 16:01:14 +0100 Subject: [PATCH] ghidra-extensions.ghidraninja-ghidra-scripts: add useSwift overridable boolean --- .../ghidraninja-ghidra-scripts/default.nix | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/pkgs/tools/security/ghidra/extensions/ghidraninja-ghidra-scripts/default.nix b/pkgs/tools/security/ghidra/extensions/ghidraninja-ghidra-scripts/default.nix index 1e4fcefabdc3..2b80a2201d68 100644 --- a/pkgs/tools/security/ghidra/extensions/ghidraninja-ghidra-scripts/default.nix +++ b/pkgs/tools/security/ghidra/extensions/ghidraninja-ghidra-scripts/default.nix @@ -5,6 +5,7 @@ binwalk, swift, yara, + useSwift ? false, }: buildGhidraScripts { @@ -20,11 +21,20 @@ buildGhidraScripts { postPatch = '' # Replace subprocesses with store versions - substituteInPlace binwalk.py --replace-fail 'subprocess.call(["binwalk"' 'subprocess.call(["${binwalk}/bin/binwalk"' - substituteInPlace swift_demangler.py --replace-fail '"swift"' '"${swift}/bin/swift"' - substituteInPlace yara.py --replace-fail 'subprocess.check_output(["yara"' 'subprocess.check_output(["${yara}/bin/yara"' - substituteInPlace YaraSearch.py --replace-fail '"yara "' '"${yara}/bin/yara "' - ''; + substituteInPlace binwalk.py --replace-fail 'subprocess.call(["binwalk"' 'subprocess.call(["${lib.getExe binwalk}"' + substituteInPlace yara.py --replace-fail 'subprocess.check_output(["yara"' 'subprocess.check_output(["${lib.getExe yara}"' + substituteInPlace YaraSearch.py --replace-fail '"yara "' '"${lib.getExe yara} "' + '' + + ( + if useSwift then + '' + substituteInPlace swift_demangler.py --replace-fail '"swift"' '"${lib.getExe' swift "swift"}"' + '' + else + '' + rm swift_demangler.py + '' + ); meta = with lib; { description = "Scripts for the Ghidra software reverse engineering suite";