Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 111 lines 2.8 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 gradle_8, 6 jdk, 7 quark-engine, 8 makeBinaryWrapper, 9 imagemagick, 10 makeDesktopItem, 11 copyDesktopItems, 12 desktopToDarwinBundle, 13}: 14let 15 # "Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0." 16 gradle = gradle_8; 17in 18stdenv.mkDerivation (finalAttrs: { 19 pname = "jadx"; 20 version = "1.5.0"; 21 22 src = fetchFromGitHub { 23 owner = "skylot"; 24 repo = "jadx"; 25 rev = "v${finalAttrs.version}"; 26 hash = "sha256-+F+PHAd1+FmdAlQkjYDBsUYCUzKXG19ZUEorfvBUEg0="; 27 }; 28 29 patches = [ 30 # Remove use of launch4j - contains platform binaries not able to be cached by mitmCache 31 ./no-native-deps.diff 32 ]; 33 34 nativeBuildInputs = [ 35 gradle 36 jdk 37 imagemagick 38 makeBinaryWrapper 39 copyDesktopItems 40 ] 41 ++ lib.optionals stdenv.hostPlatform.isDarwin [ desktopToDarwinBundle ]; 42 43 # Otherwise, Gradle fails with `java.net.SocketException: Operation not permitted` 44 __darwinAllowLocalNetworking = true; 45 46 mitmCache = gradle.fetchDeps { 47 pname = "jadx"; 48 data = ./deps.json; 49 }; 50 51 preBuild = "export JADX_VERSION=${finalAttrs.version}"; 52 53 gradleBuildTask = "pack"; 54 55 installPhase = '' 56 runHook preInstall 57 58 mkdir $out $out/bin 59 cp -R build/jadx/lib $out 60 for prog in jadx jadx-gui; do 61 cp build/jadx/bin/$prog $out/bin 62 wrapProgram $out/bin/$prog \ 63 --set JAVA_HOME ${jdk.home} \ 64 --prefix PATH : "${lib.makeBinPath [ quark-engine ]}" 65 done 66 67 for size in 16 32 48; do 68 install -Dm444 \ 69 jadx-gui/src/main/resources/logos/jadx-logo-"$size"px.png \ 70 $out/share/icons/hicolor/"$size"x"$size"/apps/jadx.png 71 done 72 for size in 64 128 256; do 73 mkdir -p $out/share/icons/hicolor/"$size"x"$size"/apps 74 convert -resize "$size"x"$size" jadx-gui/src/main/resources/logos/jadx-logo.png $out/share/icons/hicolor/"$size"x"$size"/apps/jadx.png 75 done 76 77 runHook postInstall 78 ''; 79 80 desktopItems = [ 81 (makeDesktopItem { 82 name = "jadx"; 83 desktopName = "JADX"; 84 exec = "jadx-gui"; 85 icon = "jadx"; 86 comment = finalAttrs.meta.description; 87 categories = [ 88 "Development" 89 "Utility" 90 ]; 91 }) 92 ]; 93 94 meta = with lib; { 95 changelog = "https://github.com/skylot/jadx/releases/tag/v${finalAttrs.version}"; 96 description = "Dex to Java decompiler"; 97 homepage = "https://github.com/skylot/jadx"; 98 longDescription = '' 99 Command line and GUI tools for produce Java source code from Android Dex 100 and Apk files. 101 ''; 102 sourceProvenance = with sourceTypes; [ 103 fromSource 104 binaryBytecode # deps 105 ]; 106 license = licenses.asl20; 107 platforms = platforms.unix; 108 mainProgram = "jadx-gui"; 109 maintainers = with maintainers; [ emilytrau ]; 110 }; 111})