diff options
author | roblabla <unfiltered@roblab.la> | 2021-12-27 20:43:56 +0100 |
---|---|---|
committer | roblabla <unfiltered@roblab.la> | 2021-12-29 17:40:34 +0100 |
commit | cc4ee8d27d0fa9171cd4f3be2be429d6945384ec (patch) | |
tree | c5bdb560d3a31ad9b79d249f1909b9c3dd68cd74 /pkgs/tools/security/ghidra | |
parent | 20109f2c7eb720008464b7e47484e204dad41074 (diff) |
ghidra: Fix build on darwin
Diffstat (limited to 'pkgs/tools/security/ghidra')
-rw-r--r-- | pkgs/tools/security/ghidra/build.nix | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/pkgs/tools/security/ghidra/build.nix b/pkgs/tools/security/ghidra/build.nix index f92ccce2f7ef7..77a8542ec4a74 100644 --- a/pkgs/tools/security/ghidra/build.nix +++ b/pkgs/tools/security/ghidra/build.nix @@ -11,6 +11,8 @@ , makeDesktopItem , autoPatchelfHook , icoutils +, xcbuild +, libredirect }: let @@ -40,7 +42,7 @@ let pname = "${pname}-deps"; inherit version src; - nativeBuildInputs = [ gradle perl ]; + nativeBuildInputs = [ gradle perl ] ++ lib.optional stdenv.isDarwin xcbuild; buildPhase = '' cat >>build.gradle <<HERE task resolveDependencies { @@ -101,11 +103,26 @@ in stdenv.mkDerivation rec { nativeBuildInputs = [ gradle unzip makeWrapper icoutils - ]; + ] ++ lib.optional stdenv.isDarwin xcbuild; dontStrip = true; - buildPhase = '' + 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) + ln -s ${fixedDeps}/dependencies dependencies sed -ie "s#mavenLocal()#mavenLocal(); maven { url '${fixedDeps}/maven' }#g" build.gradle |