summary refs log tree commit diff
path: root/pkgs/tools/security/ghidra
diff options
context:
space:
mode:
authorLatebricole <32686187+Latebricole@users.noreply.github.com>2019-12-07 18:46:14 +0000
committerLassulus <github@lassul.us>2019-12-07 19:46:14 +0100
commitfdca231242fea0c71f8fcdeeebbd88d856cca071 (patch)
treeb72d22fcae4c34c6984791723ca9a7e22ce8e651 /pkgs/tools/security/ghidra
parentd52cfb76613100d529276e3882749156ead892b0 (diff)
downloadnixpkgs-fdca231242fea0c71f8fcdeeebbd88d856cca071.tar
nixpkgs-fdca231242fea0c71f8fcdeeebbd88d856cca071.tar.gz
nixpkgs-fdca231242fea0c71f8fcdeeebbd88d856cca071.tar.bz2
nixpkgs-fdca231242fea0c71f8fcdeeebbd88d856cca071.tar.lz
nixpkgs-fdca231242fea0c71f8fcdeeebbd88d856cca071.tar.xz
nixpkgs-fdca231242fea0c71f8fcdeeebbd88d856cca071.tar.zst
nixpkgs-fdca231242fea0c71f8fcdeeebbd88d856cca071.zip
ghidra: 9.04 -> 9.1
* ghidra: 9.04 -> 9.1

Update Ghidra from 9.04 to 9.1

* ghidra: Added desktop file

Add a desktop file for Ghidra

Ghidra ships its icons as a .ico file, which isn't support by freedesktop. This means that to have icons, we need to extract the pngs from ghidra.ico, then copy them to the relevant folders.
This adds a requirement on a library to extract them, and also requires them to be copied over, which isn't ideal.
Diffstat (limited to 'pkgs/tools/security/ghidra')
-rw-r--r--pkgs/tools/security/ghidra/default.nix29
1 files changed, 25 insertions, 4 deletions
diff --git a/pkgs/tools/security/ghidra/default.nix b/pkgs/tools/security/ghidra/default.nix
index d68fd5e7e92..b3773725e6e 100644
--- a/pkgs/tools/security/ghidra/default.nix
+++ b/pkgs/tools/security/ghidra/default.nix
@@ -1,16 +1,26 @@
 { stdenv, fetchurl, unzip, lib, makeWrapper, autoPatchelfHook
-, openjdk11, pam
+, 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;";
+  };
+
+
 in stdenv.mkDerivation {
 
-  name = "ghidra-9.0.4";
+  name = "ghidra-9.1";
 
   src = fetchurl {
-    url = https://ghidra-sre.org/ghidra_9.0.4_PUBLIC_20190516.zip;
-    sha256 = "1gqqxk57hswwgr97qisqivcfgjdxjipfdshyh4r76dyrfpa0q3d5";
+    url = https://ghidra-sre.org/ghidra_9.1_PUBLIC_20191023.zip;
+    sha256 = "0pl7s59008gvgwz4mxp7rz3xr3vaa12a6s5zvx2yr9jxx3gk1l99";
   };
 
   nativeBuildInputs = [
@@ -22,13 +32,24 @@ in stdenv.mkDerivation {
   buildInputs = [
     stdenv.cc.cc.lib
     pam
+    icoutils
   ];
 
   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 = ''