From 559ba6bb59b46ba211a4b759016925698431e165 Mon Sep 17 00:00:00 2001 From: Moritz Sanft <58110325+msanft@users.noreply.github.com> Date: Thu, 28 Mar 2024 15:59:54 +0100 Subject: ida-free: init at `8.4.240320` --- pkgs/by-name/id/ida-free/package.nix | 133 +++++++++++++++++++++++++++++++++++ pkgs/by-name/id/ida-free/srcs.json | 20 ++++++ 2 files changed, 153 insertions(+) create mode 100644 pkgs/by-name/id/ida-free/package.nix create mode 100644 pkgs/by-name/id/ida-free/srcs.json diff --git a/pkgs/by-name/id/ida-free/package.nix b/pkgs/by-name/id/ida-free/package.nix new file mode 100644 index 0000000000000..aac31480a08f1 --- /dev/null +++ b/pkgs/by-name/id/ida-free/package.nix @@ -0,0 +1,133 @@ +{ autoPatchelfHook +, cairo +, copyDesktopItems +, dbus +, fetchurl +, fontconfig +, freetype +, glib +, gtk3 +, lib +, libdrm +, libGL +, libkrb5 +, libsecret +, libsForQt5 +, libunwind +, libxkbcommon +, makeDesktopItem +, makeWrapper +, openssl +, stdenv +, xorg +, zlib +}: + +let + srcs = builtins.fromJSON (builtins.readFile ./srcs.json); +in +stdenv.mkDerivation rec { + pname = "ida-free"; + version = "8.4.240320"; + + src = fetchurl { + inherit (srcs.${stdenv.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}")) urls sha256; + }; + + icon = fetchurl { + urls = [ + "https://www.hex-rays.com/products/ida/news/8_1/images/icon_free.png" + "https://web.archive.org/web/20221105181231if_/https://hex-rays.com/products/ida/news/8_1/images/icon_free.png" + ]; + sha256 = "sha256-widkv2VGh+eOauUK/6Sz/e2auCNFAsc8n9z0fdrSnW0="; + }; + + desktopItem = makeDesktopItem { + name = "ida-free"; + exec = "ida64"; + icon = icon; + comment = meta.description; + desktopName = "IDA Free"; + genericName = "Interactive Disassembler"; + categories = [ "Development" ]; + }; + + nativeBuildInputs = [ makeWrapper copyDesktopItems autoPatchelfHook libsForQt5.wrapQtAppsHook ]; + + # We just get a runfile in $src, so no need to unpack it. + dontUnpack = true; + + # Add everything to the RPATH, in case IDA decides to dlopen things. + runtimeDependencies = [ + cairo + dbus + fontconfig + freetype + glib + gtk3 + libdrm + libGL + libkrb5 + libsecret + libsForQt5.qtbase + libunwind + libxkbcommon + openssl + stdenv.cc.cc + xorg.libICE + xorg.libSM + xorg.libX11 + xorg.libXau + xorg.libxcb + xorg.libXext + xorg.libXi + xorg.libXrender + xorg.xcbutilimage + xorg.xcbutilkeysyms + xorg.xcbutilrenderutil + xorg.xcbutilwm + zlib + ]; + buildInputs = runtimeDependencies; + + dontWrapQtApps = true; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin $out/lib $out/opt + + # IDA depends on quite some things extracted by the runfile, so first extract everything + # into $out/opt, then remove the unnecessary files and directories. + IDADIR=$out/opt + + # Invoke the installer with the dynamic loader directly, avoiding the need + # to copy it to fix permissions and patch the executable. + $(cat $NIX_CC/nix-support/dynamic-linker) $src \ + --mode unattended --prefix $IDADIR --installpassword "" + + # Copy the exported libraries to the output. + cp $IDADIR/libida64.so $out/lib + + # Some libraries come with the installer. + addAutoPatchelfSearchPath $IDADIR + + for bb in ida64 assistant; do + wrapProgram $IDADIR/$bb \ + --prefix QT_PLUGIN_PATH : $IDADIR/plugins/platforms + ln -s $IDADIR/$bb $out/bin/$bb + done + + runHook postInstall + ''; + + meta = with lib; { + description = "Freeware version of the world's smartest and most feature-full disassembler"; + homepage = "https://hex-rays.com/ida-free/"; + license = licenses.unfree; + mainProgram = "ida64"; + maintainers = with maintainers; [ msanft ]; + platforms = [ "x86_64-linux" ]; # Right now, the installation script only supports Linux. + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + }; +} diff --git a/pkgs/by-name/id/ida-free/srcs.json b/pkgs/by-name/id/ida-free/srcs.json new file mode 100644 index 0000000000000..2087ed4381d9b --- /dev/null +++ b/pkgs/by-name/id/ida-free/srcs.json @@ -0,0 +1,20 @@ +{ + "x86_64-linux": { + "urls": [ + "https://web.archive.org/web/20240330140328/https://out7.hex-rays.com/files/idafree84_linux.run" + ], + "sha256": "1wg60afkhjj7my2la4x4qf6gdxzl2aqdbvd6zfnwf8n3bl7ckn2a" + }, + "x86_64-darwin": { + "urls": [ + "https://web.archive.org/web/20240330140623/https://out7.hex-rays.com/files/idafree84_mac.app.zip" + ], + "sha256": "0a97xb0ah6rcq69whs5xvkar43ci8r5nan9wa29ad19w8k25ryym" + }, + "aarch64-darwin": { + "urls": [ + "https://web.archive.org/web/20240330140634/https://out7.hex-rays.com/files/arm_idafree84_mac.app.zip" + ], + "sha256": "10wwq7ia1z1kxfigj4i7xr037bzv1cg3pyvrl27jdq9v7bghdf3m" + } +} -- cgit 1.4.1