From 745dc29a70fa0bd2fc6d648101b66dc6446a3b81 Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 25 May 2026 13:24:26 -0500 Subject: Extract ghidra derivation into its own file --- modules/home/ghidra.nix | 21 +++++++++++++++++++++ modules/home/re.nix | 32 ++++---------------------------- 2 files changed, 25 insertions(+), 28 deletions(-) create mode 100644 modules/home/ghidra.nix (limited to 'modules') diff --git a/modules/home/ghidra.nix b/modules/home/ghidra.nix new file mode 100644 index 0000000..be73c36 --- /dev/null +++ b/modules/home/ghidra.nix @@ -0,0 +1,21 @@ +{ pkgs }: +let + pyghidra = pkgs.python3Packages.buildPythonPackage { + pname = "pyghidra"; + version = "2.2.1"; + format = "wheel"; + src = "${pkgs.ghidra}/lib/ghidra/Ghidra/Features/PyGhidra/pypkg/dist/pyghidra-2.2.1-py3-none-any.whl"; + propagatedBuildInputs = with pkgs.python3Packages; [ + jpype1 + packaging + ]; + }; + ghidraPython = pkgs.python3.withPackages (_: [ pyghidra ]); +in +pkgs.runCommand "ghidra" { buildInputs = [ pkgs.makeWrapper ]; } '' + mkdir -p $out/bin + makeWrapper ${ghidraPython}/bin/python3 $out/bin/ghidra \ + --add-flags "-m pyghidra.ghidra_launch --install-dir ${pkgs.ghidra}/lib/ghidra -g ghidra.GhidraRun" \ + --set JAVA_HOME ${pkgs.jdk21} \ + --prefix PATH : ${pkgs.jdk21}/bin +'' diff --git a/modules/home/re.nix b/modules/home/re.nix index 451d1fe..2185024 100644 --- a/modules/home/re.nix +++ b/modules/home/re.nix @@ -4,34 +4,10 @@ inputs, ... }: -let - pyghidra = pkgs.python3Packages.buildPythonPackage { - pname = "pyghidra"; - version = "2.2.1"; - format = "wheel"; - src = "${pkgs.ghidra}/lib/ghidra/Ghidra/Features/PyGhidra/pypkg/dist/pyghidra-2.2.1-py3-none-any.whl"; - propagatedBuildInputs = with pkgs.python3Packages; [ - jpype1 - packaging - ]; - }; - ghidraPython = pkgs.python3.withPackages (_: [ pyghidra ]); -in { - home.packages = with pkgs; [ - binaryninja-free - avalonia-ilspy - (symlinkJoin { - name = "ghidra"; - paths = [ ghidra ]; - buildInputs = [ makeWrapper ]; - postBuild = '' - rm $out/bin/ghidra - makeWrapper ${ghidraPython}/bin/python3 $out/bin/ghidra \ - --add-flags "-m pyghidra.ghidra_launch --install-dir ${ghidra}/lib/ghidra -g ghidra.GhidraRun" \ - --set JAVA_HOME ${pkgs.jdk21} \ - --prefix PATH : ${pkgs.jdk21}/bin - ''; - }) + home.packages = [ + pkgs.binaryninja-free + pkgs.avalonia-ilspy + (import ./ghidra.nix { inherit pkgs; }) ]; } -- cgit v1.2.3