add idapro packaging
This commit is contained in:
parent
fd2baa1c23
commit
7d914c78d2
|
@ -16,6 +16,7 @@ final: prev: {
|
||||||
ghidra-extensions = final.lib.recurseIntoAttrs (final.callPackage ./pkgs/reverse-engineering/ghidra/extensions.nix { });
|
ghidra-extensions = final.lib.recurseIntoAttrs (final.callPackage ./pkgs/reverse-engineering/ghidra/extensions.nix { });
|
||||||
# end stuff that tracks upstream
|
# end stuff that tracks upstream
|
||||||
|
|
||||||
|
idapro = final.callPackage ./pkgs/reverse-engineering/idapro9 {};
|
||||||
|
|
||||||
ocamlPackages = prev.ocamlPackages.overrideScope (ofinal: oprev: {
|
ocamlPackages = prev.ocamlPackages.overrideScope (ofinal: oprev: {
|
||||||
ppx_unicode = ofinal.callPackage ./pkgs/ocaml/ppx_unicode {};
|
ppx_unicode = ofinal.callPackage ./pkgs/ocaml/ppx_unicode {};
|
||||||
|
|
|
@ -0,0 +1,181 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
stdenv,
|
||||||
|
fetchurl,
|
||||||
|
autoPatchelfHook,
|
||||||
|
copyDesktopItems,
|
||||||
|
python311,
|
||||||
|
qt6,
|
||||||
|
cairo,
|
||||||
|
dbus,
|
||||||
|
fontconfig,
|
||||||
|
freetype,
|
||||||
|
glib,
|
||||||
|
gtk3,
|
||||||
|
libdrm,
|
||||||
|
libGL,
|
||||||
|
libkrb5,
|
||||||
|
libsecret,
|
||||||
|
libunwind,
|
||||||
|
libxkbcommon,
|
||||||
|
openssl,
|
||||||
|
gcc,
|
||||||
|
clang,
|
||||||
|
xorg,
|
||||||
|
zlib,
|
||||||
|
curl,
|
||||||
|
gnutar,
|
||||||
|
makeDesktopItem,
|
||||||
|
makeWrapper,
|
||||||
|
runCommand,
|
||||||
|
|
||||||
|
_errorMessage ? builtins.throw ''
|
||||||
|
No source and/or version for package `idapro` was provided.
|
||||||
|
Please provide a source file and version number using, for example:
|
||||||
|
|
||||||
|
pkgs.idapro.override {
|
||||||
|
idaSource = pkgs.requireFile rec {
|
||||||
|
name = "my-idapro-source.tar.xz";
|
||||||
|
hash = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=";
|
||||||
|
message = '''
|
||||||
|
Please run `nix store add-file ''${name}`
|
||||||
|
The value of `nix hash file ''${name}` should be ''${hash}
|
||||||
|
''';
|
||||||
|
};
|
||||||
|
|
||||||
|
idaVersion = "9.x.y";
|
||||||
|
}
|
||||||
|
|
||||||
|
The source file must be a tarball with a single directory inside containing the IDA Pro
|
||||||
|
installation. This will be extracted and patched to be able to run on NixOS.
|
||||||
|
|
||||||
|
Version 9.2 is currently supported by this derivation.
|
||||||
|
'',
|
||||||
|
# the IDA Pro tarball to extract, patch and repackage
|
||||||
|
# the reason i'm not providing an exact requireFile spec is that people's IDA Pro tarballs
|
||||||
|
# may vary, and this derivation nominally allows packaging many different versions of IDA Pro
|
||||||
|
# (though it's actually just 9.2 for now)
|
||||||
|
idaSource ? _errorMessage,
|
||||||
|
# the version of IDA pro being built
|
||||||
|
idaVersion ? _errorMessage,
|
||||||
|
# the python version to use for idapython
|
||||||
|
pythonPackage ? python311,
|
||||||
|
# additional python packages to make available to idapython
|
||||||
|
pythonDeps ? [],
|
||||||
|
}: let
|
||||||
|
defaultPythonDeps = ps: with ps; [
|
||||||
|
rpyc
|
||||||
|
];
|
||||||
|
pythonEnv =
|
||||||
|
pythonPackage.withPackages
|
||||||
|
(ps: (defaultPythonDeps ps) ++ pythonDeps);
|
||||||
|
in stdenv.mkDerivation (self: {
|
||||||
|
pname = "idapro";
|
||||||
|
version = idaVersion;
|
||||||
|
src = idaSource;
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
autoPatchelfHook
|
||||||
|
copyDesktopItems
|
||||||
|
makeWrapper
|
||||||
|
];
|
||||||
|
|
||||||
|
# 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.out
|
||||||
|
(if stdenv.cc.isGNU then gcc else clang).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
|
||||||
|
curl.out
|
||||||
|
qt6.qtwayland
|
||||||
|
pythonEnv
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs = self.runtimeDependencies;
|
||||||
|
|
||||||
|
qtWrapperArgs = [];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
mkdir -p $out/opt $out/lib $out/bin
|
||||||
|
cp -a * $out/opt
|
||||||
|
|
||||||
|
# Link the exported libraries to the output.
|
||||||
|
for lib in $out/opt/libida*; do
|
||||||
|
ln -s $lib $out/lib/$(basename $lib)
|
||||||
|
done
|
||||||
|
|
||||||
|
ln -s $out/opt/ida $out/bin/ida
|
||||||
|
|
||||||
|
mkdir -p $out/share/icons/hicolor/128x128/apps
|
||||||
|
cp $out/opt/appico.png $out/share/icons/hicolor/128x128/apps/idapro.png
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
preFixup = ''
|
||||||
|
# Some libraries come with the installer.
|
||||||
|
addAutoPatchelfSearchPath $out/opt
|
||||||
|
|
||||||
|
# Manually patch libraries that dlopen stuff.
|
||||||
|
patchelf --add-needed libpython${pythonEnv.pythonVersion}.so $out/lib/libida.so
|
||||||
|
patchelf --add-needed libpython${pythonEnv.pythonVersion}.so $out/opt/plugins/idapython3.so
|
||||||
|
patchelf --add-needed libcrypto.so $out/lib/libida.so
|
||||||
|
patchelf --add-needed libcrypto.so $out/opt/plugins/idapython3.so
|
||||||
|
|
||||||
|
wrapProgram "$out/opt/ida" \
|
||||||
|
--prefix PYTHONPATH : $out/opt/idalib/python \
|
||||||
|
--prefix PATH : ${pythonEnv}/bin
|
||||||
|
'';
|
||||||
|
|
||||||
|
dontWrapQtApps = true;
|
||||||
|
|
||||||
|
desktopItem = makeDesktopItem {
|
||||||
|
name = "ida-pro";
|
||||||
|
exec = "ida";
|
||||||
|
icon = "idapro";
|
||||||
|
comment = self.meta.description;
|
||||||
|
desktopName = "IDA Pro";
|
||||||
|
genericName = "Interactive Disassembler";
|
||||||
|
categories = [ "Development" ];
|
||||||
|
startupWMClass = "IDA";
|
||||||
|
};
|
||||||
|
desktopItems = [ self.desktopItem ];
|
||||||
|
|
||||||
|
passthru = {
|
||||||
|
inherit pythonEnv;
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = with lib; {
|
||||||
|
description = "A powerful disassembler, decompiler and a versatile debugger.";
|
||||||
|
homepage = "https://hex-rays.com/ida-pro";
|
||||||
|
mainProgram = "ida";
|
||||||
|
platforms = [ "x86_64-linux" ];
|
||||||
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
||||||
|
license = lib.licenses.unfree;
|
||||||
|
};
|
||||||
|
})
|
Loading…
Reference in New Issue