From 185451d742f850d4573aceed76a8504c223bfe79 Mon Sep 17 00:00:00 2001 From: Tim Schumacher Date: Mon, 9 Jun 2025 22:11:20 +0200 Subject: [PATCH] ghidra: Prevent lock file creation in with-extensions directory This file already exists in `lib/ghidra/Ghidra` in the default Ghidra derivation, but due to various path resolving steps the file also needs to be created in the with-extensions symlink join as well as the individual extension directories. --- pkgs/tools/security/ghidra/build-extension.nix | 5 +++++ pkgs/tools/security/ghidra/with-extensions.nix | 3 +++ 2 files changed, 8 insertions(+) diff --git a/pkgs/tools/security/ghidra/build-extension.nix b/pkgs/tools/security/ghidra/build-extension.nix index a677879f8a39..b6bec2073ca1 100644 --- a/pkgs/tools/security/ghidra/build-extension.nix +++ b/pkgs/tools/security/ghidra/build-extension.nix @@ -58,6 +58,11 @@ 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 ''; diff --git a/pkgs/tools/security/ghidra/with-extensions.nix b/pkgs/tools/security/ghidra/with-extensions.nix index e1ddfed4a06a..80276704ac78 100644 --- a/pkgs/tools/security/ghidra/with-extensions.nix +++ b/pkgs/tools/security/ghidra/with-extensions.nix @@ -30,6 +30,9 @@ let ] ++ lib.optional stdenv.hostPlatform.isDarwin desktopToDarwinBundle; 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" \