From 60b0489ee327cbbbc6432c771b5d38756b3b809b Mon Sep 17 00:00:00 2001 From: vringar Date: Fri, 2 Aug 2024 13:10:43 +0200 Subject: [PATCH 1/2] gradle: fix update-deps.sh to use Nix bash This fixes an issue on non NixOS Linux distributions where their system bash might be outside of /tmp, /nix, and /run. Thanks to @puckipedia for the suggestion --- pkgs/development/tools/build-managers/gradle/update-deps.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/tools/build-managers/gradle/update-deps.nix b/pkgs/development/tools/build-managers/gradle/update-deps.nix index 0b19a17429bd..96e46a0d98fd 100644 --- a/pkgs/development/tools/build-managers/gradle/update-deps.nix +++ b/pkgs/development/tools/build-managers/gradle/update-deps.nix @@ -104,10 +104,10 @@ writeTextFile { --tmpfs /home --bind /tmp /tmp --ro-bind /nix /nix --ro-bind /run /run --proc /proc --dev /dev \ --ro-bind ${toString path} ${toString path} --bind "$MITM_CACHE_CERT_DIR" "$MITM_CACHE_CERT_DIR" \ ${builtins.concatStringsSep " " (map (x: "--setenv ${x} \"\$${x}\"") keep)} \ - --setenv NIX_BUILD_SHELL bash ${bwrapFlags} ''${BWRAP_FLAGS:-} \ + --setenv NIX_BUILD_SHELL ${runtimeShell} ${bwrapFlags} ''${BWRAP_FLAGS:-} \ -- ${nix}/bin/nix-shell --pure --run ${gradleScript} ${nixShellKeep} ${sourceDrvPath} else - NIX_BUILD_SHELL=bash nix-shell --pure --run ${gradleScript} ${nixShellKeep} ${sourceDrvPath} + NIX_BUILD_SHELL=${runtimeShell} nix-shell --pure --run ${gradleScript} ${nixShellKeep} ${sourceDrvPath} fi${lib.optionalString silent " >&2"} kill -s SIGINT "$MITM_CACHE_PID" for i in {0..20}; do From 5c354f19ea79a4bb52e29465d672a01e82c7c6d5 Mon Sep 17 00:00:00 2001 From: vringar Date: Fri, 2 Aug 2024 13:11:01 +0200 Subject: [PATCH 2/2] ghidra: restore configurability to buildGhidraExtension This is required as Ghidra plugins don't have a consistent layout and have to be widely configurable --- pkgs/tools/security/ghidra/build-extension.nix | 4 +++- .../security/ghidra/extensions/gnudisassembler/default.nix | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/pkgs/tools/security/ghidra/build-extension.nix b/pkgs/tools/security/ghidra/build-extension.nix index ce84287a8bd6..49d68b2f81ee 100644 --- a/pkgs/tools/security/ghidra/build-extension.nix +++ b/pkgs/tools/security/ghidra/build-extension.nix @@ -26,9 +26,11 @@ let preBuild = '' # Set project name, otherwise defaults to directory name echo -e '\nrootProject.name = "${pname}"' >> settings.gradle + ${args.preBuild or ""} ''; - gradleFlags = [ "-PGHIDRA_INSTALL_DIR=${ghidra}/lib/ghidra" ]; + gradleBuildTask = args.gradleBuildTask or "buildExtension"; + gradleFlags = args.gradleFlags or [] ++ [ "-PGHIDRA_INSTALL_DIR=${ghidra}/lib/ghidra" ]; installPhase = args.installPhase or '' runHook preInstall diff --git a/pkgs/tools/security/ghidra/extensions/gnudisassembler/default.nix b/pkgs/tools/security/ghidra/extensions/gnudisassembler/default.nix index 7ca4b056842e..14b0f1df2733 100644 --- a/pkgs/tools/security/ghidra/extensions/gnudisassembler/default.nix +++ b/pkgs/tools/security/ghidra/extensions/gnudisassembler/default.nix @@ -48,6 +48,7 @@ buildGhidraExtension { buildInputs = [ zlib ]; + gradleBuildTask = "assemble"; installPhase = '' runHook preInstall