nixpkgs/pkgs/tools/security/ghidra/with-extensions.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
1.0 KiB
Nix
Raw Normal View History

2022-12-26 08:51:17 +00:00
{ lib
2024-05-26 05:59:02 +00:00
, stdenv
2022-12-26 08:51:17 +00:00
, callPackage
, symlinkJoin
, makeBinaryWrapper
2024-05-26 05:59:02 +00:00
, desktopToDarwinBundle
2022-12-26 08:51:17 +00:00
, 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);
2024-05-26 05:59:02 +00:00
nativeBuildInputs = [ makeBinaryWrapper ]
++ lib.optional stdenv.hostPlatform.isDarwin desktopToDarwinBundle;
2022-12-26 08:51:17 +00:00
postBuild = ''
makeWrapper '${ghidra}/bin/ghidra' "$out/bin/ghidra" \
--set NIX_GHIDRAHOME "$out/lib/ghidra/Ghidra"
2024-05-26 05:59:02 +00:00
ln -s ${ghidra}/share $out/share
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
convertDesktopFiles $prefix
2022-12-26 08:51:17 +00:00
'';
inherit (ghidra) meta;
});
in
withExtensions