fix extension build

This commit is contained in:
xenia 2025-09-13 23:45:17 -04:00
parent 26d03f13e2
commit 9d42d525a8
2 changed files with 34 additions and 25 deletions

View File

@ -21,16 +21,17 @@ let
platforms = oldMeta.platforms or ghidra.meta.platforms;
};
buildGhidraExtension =
{
pname,
nativeBuildInputs ? [ ],
meta ? { },
...
}@args:
stdenv.mkDerivation (
args
// {
buildGhidraExtension = lib.extendMkDerivation {
constructDrv = stdenv.mkDerivation;
extendDrvArgs =
finalAttrs:
{
pname,
nativeBuildInputs ? [ ],
meta ? { },
...
}@args:
{
nativeBuildInputs = nativeBuildInputs ++ [
unzip
jdk
@ -58,22 +59,28 @@ let
mkdir -p $out/lib/ghidra/Ghidra/Extensions
unzip -d $out/lib/ghidra/Ghidra/Extensions dist/*.zip
# Prevent attempted creation of plugin lock files in the Nix store.
for i in $out/lib/ghidra/Ghidra/Extensions/*; do
touch "$i/.dbDirLock"
done
runHook postInstall
'';
meta = metaCommon meta;
}
);
};
};
buildGhidraScripts =
{
pname,
meta ? { },
...
}@args:
stdenv.mkDerivation (
args
// {
buildGhidraScripts = lib.extendMkDerivation {
constructDrv = stdenv.mkDerivation;
extendDrvArgs =
finalAttrs:
{
pname,
meta ? { },
...
}@args:
{
installPhase = ''
runHook preInstall
@ -95,8 +102,8 @@ let
'';
meta = metaCommon meta;
}
);
};
};
in
{
inherit buildGhidraExtension buildGhidraScripts;

View File

@ -29,8 +29,10 @@ let
nativeBuildInputs = [
makeBinaryWrapper
] ++ lib.optional stdenv.hostPlatform.isDarwin desktopToDarwinBundle;
postBuild =
''
postBuild = ''
# Prevent attempted creation of plugin lock files in the Nix store.
touch $out/lib/ghidra/Ghidra/.dbDirLock
makeWrapper '${ghidra}/bin/ghidra' "$out/bin/ghidra" \
--set NIX_GHIDRAHOME "$out/lib/ghidra/Ghidra"
makeWrapper '${ghidra}/bin/ghidra-analyzeHeadless' "$out/bin/ghidra-analyzeHeadless" \