dragnpkgs/pkgs/ghidra-xenia-v2/default.nix

84 lines
2.1 KiB
Nix
Raw Normal View History

2024-10-21 20:30:26 +00:00
{ stdenv
, fetchzip
, lib
, makeWrapper
, autoPatchelfHook
, openjdk17
, pam
, makeDesktopItem
, icoutils
2024-10-11 02:44:57 +00:00
}:
let
pkg_path = "$out/lib/ghidra";
desktopItem = makeDesktopItem {
name = "ghidra";
exec = "ghidra";
icon = "ghidra";
desktopName = "Ghidra";
genericName = "Ghidra Software Reverse Engineering Suite";
categories = [ "Development" ];
terminal = false;
startupWMClass = "ghidra-Ghidra";
};
2024-10-21 20:30:26 +00:00
in stdenv.mkDerivation rec {
2024-10-11 02:44:57 +00:00
pname = "ghidra";
version = "10.4";
versiondate = "20230928";
src = fetchzip {
url = "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_${version}_build/ghidra_${version}_PUBLIC_${versiondate}.zip";
hash = "sha256-IiAQ9OKmr8ZgqmGftuW0ITdG06fb9Lr30n2H9GArctk=";
};
nativeBuildInputs = [
makeWrapper
icoutils
2024-10-21 20:30:26 +00:00
]
++ lib.optionals stdenv.isLinux [ autoPatchelfHook ];
2024-10-11 02:44:57 +00:00
buildInputs = [
stdenv.cc.cc.lib
pam
];
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 [ openjdk17 ]}
'';
meta = with lib; {
description = "Software reverse engineering (SRE) suite of tools developed by NSA's Research Directorate in support of the Cybersecurity mission";
mainProgram = "ghidra";
homepage = "https://github.com/NationalSecurityAgency/ghidra";
2024-10-21 20:30:26 +00:00
platforms = [ "x86_64-linux" "x86_64-darwin" ];
2024-10-11 02:44:57 +00:00
sourceProvenance = with sourceTypes; [ binaryBytecode ];
license = licenses.asl20;
2024-10-21 20:30:26 +00:00
maintainers = with maintainers; [ ck3d govanify mic92 ];
2024-10-11 02:44:57 +00:00
};
}