{ stdenv, fetchFromGitHub, lib, callPackage, gradle, makeBinaryWrapper, openjdk21, unzip, makeDesktopItem, copyDesktopItems, desktopToDarwinBundle, xcbuild, protobuf, ghidra-extensions, python3, python3Packages, }: let pname = "ghidra"; version = "11.2"; releaseName = "NIX"; distroPrefix = "ghidra_${version}_${releaseName}"; src = fetchFromGitHub { owner = "NationalSecurityAgency"; repo = "Ghidra"; rev = "Ghidra_${version}_build"; hash = "sha256-iO6g3t8JNdc/wAC+JG+6Y7aZCq7T9zYQC3KKZcr+wzc="; # populate values that require us to use git. By doing this in postFetch we # can delete .git afterwards and maintain better reproducibility of the src. leaveDotGit = true; postFetch = '' cd "$out" git rev-parse HEAD > $out/COMMIT # 1970-Jan-01 date -u -d "@$(git log -1 --pretty=%ct)" "+%Y-%b-%d" > $out/SOURCE_DATE_EPOCH # 19700101 date -u -d "@$(git log -1 --pretty=%ct)" "+%Y%m%d" > $out/SOURCE_DATE_EPOCH_SHORT find "$out" -name .git -print0 | xargs -0 rm -rf ''; }; patches = [ # Use our own protoc binary instead of the prebuilt one ./0001-Use-protobuf-gradle-plugin.patch # Override installation directory to allow loading extensions ./0002-Load-nix-extensions.patch # Remove build dates from output filenames for easier reference ./0003-Remove-build-datestamp.patch ]; postPatch = '' # Set name of release (eg. PUBLIC, DEV, etc.) sed -i -e 's/application\.release\.name=.*/application.release.name=${releaseName}/' Ghidra/application.properties # Set build date and git revision echo "application.build.date=$(cat SOURCE_DATE_EPOCH)" >> Ghidra/application.properties echo "application.build.date.short=$(cat SOURCE_DATE_EPOCH_SHORT)" >> Ghidra/application.properties echo "application.revision.ghidra=$(cat COMMIT)" >> Ghidra/application.properties # Tells ghidra to use our own protoc binary instead of the prebuilt one. cat >>Ghidra/Debug/Debugger-gadp/build.gradle <