nixpkgs/pkgs/tools/security/ghidra/default.nix

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

80 lines
2.0 KiB
Nix
Raw Normal View History

{ stdenv
, fetchzip
, lib
, makeWrapper
, autoPatchelfHook
, openjdk11
, pam
, makeDesktopItem
, icoutils
}:
let
pkg_path = "$out/lib/ghidra";
desktopItem = makeDesktopItem {
name = "ghidra";
exec = "ghidra";
icon = "ghidra";
desktopName = "Ghidra";
genericName = "Ghidra Software Reverse Engineering Suite";
categories = [ "Development" ];
};
2020-11-13 23:26:24 +00:00
in stdenv.mkDerivation rec {
pname = "ghidra";
version = "10.1.1";
versiondate = "20211221";
src = fetchzip {
2021-06-26 01:13:40 +00:00
url = "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_${version}_build/ghidra_${version}_PUBLIC_${versiondate}.zip";
sha256 = "1aib24hjfavy31vq0pasbzix9lpqrb90m3hp4n0iakg6ck8jcl5r";
};
nativeBuildInputs = [
makeWrapper
icoutils
]
++ lib.optionals stdenv.isLinux [ autoPatchelfHook ];
2019-03-13 21:03:40 +00:00
buildInputs = [
stdenv.cc.cc.lib
pam
];
2019-03-13 21:03:40 +00:00
dontStrip = true;
installPhase = ''
mkdir -p "${pkg_path}"
mkdir -p "${pkg_path}" "$out/share/applications"
cp -a * "${pkg_path}"
ln -s ${desktopItem}/share/applications/* $out/share/applications
icotool -x "${pkg_path}/support/ghidra.ico"
rm ghidra_4_40x40x32.png
for f in ghidra_*.png; do
res=$(basename "$f" ".png" | cut -d"_" -f3 | cut -d"x" -f1-2)
mkdir -pv "$out/share/icons/hicolor/$res/apps"
mv "$f" "$out/share/icons/hicolor/$res/apps/ghidra.png"
done;
'';
postFixup = ''
mkdir -p "$out/bin"
ln -s "${pkg_path}/ghidraRun" "$out/bin/ghidra"
wrapProgram "${pkg_path}/support/launch.sh" \
--prefix PATH : ${lib.makeBinPath [ openjdk11 ]}
'';
meta = with lib; {
description = "A software reverse engineering (SRE) suite of tools developed by NSA's Research Directorate in support of the Cybersecurity mission";
2021-12-28 17:07:43 +00:00
homepage = "https://github.com/NationalSecurityAgency/ghidra";
platforms = [ "x86_64-linux" "x86_64-darwin" ];
license = licenses.asl20;
2021-04-23 15:42:33 +00:00
maintainers = with maintainers; [ ck3d govanify mic92 ];
};
}