@@ -0,0 +1,48 @@
1+{ stdenv, fetchurl, unzip, lib, makeWrapper, autoPatchelfHook
2+, openjdk11, pam
3+}: let
4+
5+ pkg_path = "$out/lib/ghidra";
6+
7+in stdenv.mkDerivation {
8+
9+ name = "ghidra-9.0";
10+
11+ src = fetchurl {
12+ url = https://ghidra-sre.org/ghidra_9.0_PUBLIC_20190228.zip;
13+ sha256 = "3b65d29024b9decdbb1148b12fe87bcb7f3a6a56ff38475f5dc9dd1cfc7fd6b2";
14+ };
15+
16+ nativeBuildInputs = [
17+ makeWrapper
18+ autoPatchelfHook
19+ unzip
20+ ];
21+
22+ buildInputs = [
23+ stdenv.cc.cc.lib
24+ pam
25+ ];
26+
27+ dontStrip = true;
28+
29+ installPhase = ''
30+ mkdir -p "${pkg_path}"
31+ cp -a * "${pkg_path}"
32+ '';
33+
34+ postFixup = ''
35+ mkdir -p "$out/bin"
36+ makeWrapper "${pkg_path}/ghidraRun" "$out/bin/ghidra" \
37+ --prefix PATH : ${lib.makeBinPath [ openjdk11 ]}
38+ '';
39+
40+ meta = with lib; {
41+ description = "A software reverse engineering (SRE) suite of tools developed by NSA's Research Directorate in support of the Cybersecurity mission";
42+ homepage = "https://ghidra-sre.org/";
43+ platforms = [ "x86_64-linux" ];
44+ license = licenses.asl20;
45+ maintainers = [ maintainers.ck3d ];
46+ };
47+
48+}