wip ghidra python packaging

This commit is contained in:
xenia 2025-09-14 18:35:07 -04:00
parent 7914014c1d
commit 4cbea3dc01
5 changed files with 186 additions and 4 deletions

View File

@ -251,6 +251,23 @@ stdenv.mkDerivation (finalAttrs: {
;
withExtensions = callPackage ./with-extensions.nix { ghidra = finalAttrs.finalPackage; };
pythonPackages = rec {
ghidratrace = python3Packages.callPackage ./python/ghidratrace.nix {
ghidra = finalAttrs.finalPackage;
};
ghidragdb = python3Packages.callPackage ./python/ghidragdb.nix {
ghidra = finalAttrs.finalPackage;
inherit ghidratrace;
};
ghidralldb = python3Packages.callPackage ./python/ghidralldb.nix {
ghidra = finalAttrs.finalPackage;
inherit ghidratrace;
};
pyghidra = python3Packages.callPackage ./python/pyghidra.nix {
ghidra = finalAttrs.finalPackage;
};
};
};
meta = with lib; {
@ -269,10 +286,6 @@ stdenv.mkDerivation (finalAttrs: {
binaryBytecode # deps
];
license = licenses.asl20;
maintainers = with maintainers; [
roblabla
vringar
];
broken = stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64;
};
})

View File

@ -0,0 +1,40 @@
{
lib,
python,
buildPythonPackage,
ghidra,
setuptools,
psutil,
ghidratrace,
}: buildPythonPackage {
pname = "ghidragdb";
version = "11.3";
pyproject = true;
src = "${ghidra.lib}/lib/ghidra/Ghidra/Debug/Debugger-agent-gdb/pypkg";
postPatch = ''
rm -rf dist
'';
build-system = [
setuptools
];
dependencies = [
ghidratrace
psutil
];
# can't import because gdb is missing
# pythonImportsCheck = [
# "ghidragdb"
# ];
meta = (lib.removeAttrs ghidra.meta ["description" "mainProgram"]) // {
description = "Ghidra's Plugin for gdb";
};
}

View File

@ -0,0 +1,40 @@
{
lib,
python,
buildPythonPackage,
ghidra,
setuptools,
psutil,
ghidratrace,
}: buildPythonPackage {
pname = "ghidralldb";
version = "11.3";
pyproject = true;
src = "${ghidra.lib}/lib/ghidra/Ghidra/Debug/Debugger-agent-lldb/pypkg";
postPatch = ''
rm -rf dist
'';
build-system = [
setuptools
];
dependencies = [
ghidratrace
psutil
];
# can't import because lldb is missing
# pythonImportsCheck = [
# "ghidralldb"
# ];
meta = (lib.removeAttrs ghidra.meta ["description" "mainProgram"]) // {
description = "Ghidra's Plugin for lldb";
};
}

View File

@ -0,0 +1,46 @@
{
lib,
python,
buildPythonPackage,
pythonRelaxDepsHook,
ghidra,
setuptools,
protobuf,
}: buildPythonPackage {
pname = "ghidratrace";
version = "11.3";
pyproject = true;
src = "${ghidra.lib}/lib/ghidra/Ghidra/Debug/Debugger-rmi-trace/pypkg";
postPatch = ''
rm -rf dist
'';
build-system = [
setuptools
];
dependencies = [
protobuf
];
nativeBuildInputs = [
pythonRelaxDepsHook
];
pythonRelaxDeps = [
"protobuf"
];
pythonImportsCheck = [
"ghidratrace"
];
meta = (lib.removeAttrs ghidra.meta ["description" "mainProgram"]) // {
description = "Ghidra's TraceRmi for Python3";
};
}

View File

@ -0,0 +1,43 @@
{
lib,
python,
buildPythonPackage,
ghidra,
setuptools,
jpype1,
}: buildPythonPackage {
pname = "pyghidra";
version = "2.1.0";
pyproject = true;
src = "${ghidra.lib}/lib/ghidra/Ghidra/Features/PyGhidra/pypkg";
# TODO: make a more involved wrapper or patch this package to change the launch system
# TODO: support launching a ghidra-with-extensions package
makeWrapperArgs = [
"--set" "GHIDRA_INSTALL_DIR" "${ghidra.lib}/lib/ghidra"
];
postPatch = ''
rm -rf dist
'';
build-system = [
setuptools
];
dependencies = [
jpype1
];
pythonImportsCheck = [
"pyghidra"
];
meta = (lib.removeAttrs ghidra.meta ["description" "mainProgram"]) // {
description = "Native CPython for Ghidra";
};
}