mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-02 03:43:06 +00:00
be6aa219ed
This new binary is an alias to the support/analyzeHeadless script, which is used to run ghidra scripts in a headless manner. This ghidra-analyzeHeadless name is also the one used by the ArchLinux package.
46 lines
1.3 KiB
Nix
46 lines
1.3 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
callPackage,
|
|
symlinkJoin,
|
|
makeBinaryWrapper,
|
|
desktopToDarwinBundle,
|
|
ghidra,
|
|
}:
|
|
|
|
let
|
|
ghidra-extensions = callPackage ./extensions.nix { inherit ghidra; };
|
|
allExtensions = lib.filterAttrs (n: pkg: lib.isDerivation pkg) ghidra-extensions;
|
|
|
|
/*
|
|
Make Ghidra with additional extensions
|
|
Example:
|
|
pkgs.ghidra.withExtensions (p: with p; [
|
|
ghostrings
|
|
]);
|
|
=> /nix/store/3yn0rbnz5mbrxf0x70jbjq73wgkszr5c-ghidra-with-extensions-10.2.2
|
|
*/
|
|
withExtensions =
|
|
f:
|
|
(symlinkJoin {
|
|
name = "${ghidra.pname}-with-extensions-${lib.getVersion ghidra}";
|
|
paths = (f allExtensions);
|
|
nativeBuildInputs = [
|
|
makeBinaryWrapper
|
|
] ++ lib.optional stdenv.hostPlatform.isDarwin desktopToDarwinBundle;
|
|
postBuild =
|
|
''
|
|
makeWrapper '${ghidra}/bin/ghidra' "$out/bin/ghidra" \
|
|
--set NIX_GHIDRAHOME "$out/lib/ghidra/Ghidra"
|
|
makeWrapper '${ghidra}/bin/ghidra-analyzeHeadless' "$out/bin/ghidra-analyzeHeadless" \
|
|
--set NIX_GHIDRAHOME "$out/lib/ghidra/Ghidra"
|
|
ln -s ${ghidra}/share $out/share
|
|
''
|
|
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
|
|
convertDesktopFiles $prefix
|
|
'';
|
|
inherit (ghidra) meta;
|
|
});
|
|
in
|
|
withExtensions
|