about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorRobert Scott <code@humanleg.org.uk>2022-10-22 11:38:19 +0100
committerGitHub <noreply@github.com>2022-10-22 11:38:19 +0100
commit325449194b856b82a1b6d85d4a483696ffc201a1 (patch)
tree0d14202ff67c100fc14cfb027f18109078a516f9 /pkgs
parente907b9b313ecad648858e9b6993c4e1d2c2011c3 (diff)
parente69d148812feb8ea6188d84d343ac02bdabb0424 (diff)
Merge pull request #196930 from greedy/ghidra-aarch64-darwin
ghidra: add support for aarch64-darwin
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/tools/security/ghidra/build.nix26
1 files changed, 9 insertions, 17 deletions
diff --git a/pkgs/tools/security/ghidra/build.nix b/pkgs/tools/security/ghidra/build.nix
index 3e7197f543d24..23bc1d216f35c 100644
--- a/pkgs/tools/security/ghidra/build.nix
+++ b/pkgs/tools/security/ghidra/build.nix
@@ -84,7 +84,10 @@ HERE
 
     nativeBuildInputs = [ gradle perl ] ++ lib.optional stdenv.isDarwin xcbuild;
     buildPhase = ''
-      export GRADLE_USER_HOME=$(mktemp -d)
+      export HOME="$NIX_BUILD_TOP/home"
+      mkdir -p "$HOME"
+      export JAVA_TOOL_OPTIONS="-Duser.home='$HOME'"
+      export GRADLE_USER_HOME="$HOME/.gradle"
 
       # First, fetch the static dependencies.
       gradle --no-daemon --info -Dorg.gradle.java.home=${openjdk11} -I gradle/support/fetchDependencies.gradle init
@@ -116,21 +119,10 @@ in stdenv.mkDerivation rec {
   patches = [ ./0001-Use-protobuf-gradle-plugin.patch ];
   postPatch = fixProtoc;
 
-  buildPhase = (lib.optionalString stdenv.isDarwin ''
-    export HOME=$(mktemp -d)
-
-    # construct a dummy /etc/passwd file - something attempts to determine
-    # the user's "real" home using this
-    DUMMY_PASSWD=$(realpath ../dummy-passwd)
-    cat > $DUMMY_PASSWD <<EOF
-    $(whoami)::$(id -u):$(id -g)::$HOME:$SHELL
-    EOF
-
-    export NIX_REDIRECTS=/etc/passwd=$DUMMY_PASSWD
-    export DYLD_INSERT_LIBRARIES=${libredirect}/lib/libredirect.dylib
-  '') + ''
-
-    export GRADLE_USER_HOME=$(mktemp -d)
+  buildPhase = ''
+    export HOME="$NIX_BUILD_TOP/home"
+    mkdir -p "$HOME"
+    export JAVA_TOOL_OPTIONS="-Duser.home='$HOME'"
 
     ln -s ${deps}/dependencies dependencies
 
@@ -170,7 +162,7 @@ in stdenv.mkDerivation rec {
   meta = with lib; {
     description = "A software reverse engineering (SRE) suite of tools developed by NSA's Research Directorate in support of the Cybersecurity mission";
     homepage = "https://ghidra-sre.org/";
-    platforms = [ "x86_64-linux" "x86_64-darwin" ];
+    platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-darwin" ];
     sourceProvenance = with sourceTypes; [
       fromSource
       binaryBytecode  # deps