Files
nixpkgs/pkgs/by-name/id/ida-free/package.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

132 lines
3.3 KiB
Nix

{
autoPatchelfHook,
cairo,
dbus,
requireFile,
fontconfig,
freetype,
glib,
gtk3,
lib,
libdrm,
libGL,
libkrb5,
libsecret,
libunwind,
libxkbcommon,
makeWrapper,
openssl,
stdenv,
xorg,
zlib,
}:
stdenv.mkDerivation (finalAttrs: rec {
pname = "ida-free";
version = "9.2";
src = requireFile {
name = "ida-free-pc_${lib.replaceStrings [ "." ] [ "" ] version}_x64linux.run";
url = "https://my.hex-rays.com/dashboard/download-center/installers/release/${version}/ida-free";
hash = "sha256-CQm9phkqLXhht4UQxooKmhmiGuW3lV8RIJuDrm52aNw=";
};
nativeBuildInputs = [
makeWrapper
autoPatchelfHook
];
# 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
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
xorg.xcbutilcursor
zlib
];
buildInputs = runtimeDependencies;
# IDA comes with its own Qt6, some dependencies are missing in the installer.
autoPatchelfIgnoreMissingDeps = [
"libQt6Network.so.6"
"libQt6EglFSDeviceIntegration.so.6"
"libQt6WaylandEglClientHwIntegration.so.6"
"libQt6WlShellIntegration.so.6"
];
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/lib $out/opt
mkdir -p $out/.local/share/applications
# 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/${finalAttrs.pname}-${finalAttrs.version}
# The installer doesn't honor `--prefix` in all places,
# thus needing to set `HOME` here.
HOME=$out
# 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
# Copy the exported libraries to the output.
cp $IDADIR/libida.so $out/lib
# Some libraries come with the installer.
addAutoPatchelfSearchPath $IDADIR
# Wrap the ida executable to set QT_PLUGIN_PATH
wrapProgram $IDADIR/ida --prefix QT_PLUGIN_PATH : $IDADIR/plugins/platforms
ln -s $IDADIR/ida $out/bin/ida
# runtimeDependencies don't get added to non-executables, and openssl is needed
# for cloud decompilation
patchelf --add-needed libcrypto.so $IDADIR/libida.so
mv $out/.local/share $out
rm -r $out/.local
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/";
changelog = "https://hex-rays.com/products/ida/news/";
license = licenses.unfree;
mainProgram = "ida";
maintainers = with maintainers; [ msanft ];
platforms = [ "x86_64-linux" ]; # Right now, the installation script only supports Linux.
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
};
})