add programs.idapro

This commit is contained in:
xenia 2025-09-12 02:14:30 -04:00
parent b7dc1853a5
commit 0aa0881377
4 changed files with 71 additions and 3 deletions

View File

@ -336,6 +336,26 @@ example:
enable binsync integration
### [`programs.idapro`](./modules/idapro/default.nix)
Enables IDA Pro in the system environment, with optional plugin config.
This also directs IDA Pro to use `~/.config/idapro` as its main user config directory, instead of
`~/.idapro`. Unfortunately, as of IDA Pro 9.2, `~/.idapro` still gets created, though it will be
empty.
#### `programs.idapro.enable`
Whether to enable IDA Pro
#### `programs.idapro.package`
The IDA Pro package to use
#### `programs.idapro.binsync.enable`
Enables binsync integration with IDA Pro
### [`environment.machineInfo`](./modules/machine-info/default.nix)
provides options to customize the `/etc/machine-info` file on a NixOS system. See the module itself

View File

@ -2,6 +2,7 @@
imports = [
./modules/ghidra-client
./modules/ghidra-server
./modules/idapro
./modules/machine-info
./modules/regdom
./modules/satisfactory-dedicated-server

View File

@ -0,0 +1,44 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.idapro;
binsyncPkg = pkgs.python311.pkgs.binsync;
binsyncPath = "${pkgs.python311.pkgs.binsync}/${pkgs.python311.sitePackages}";
idaproConfigured = cfg.package.override {
pythonDeps = lib.optionals cfg.binsync.enable [binsyncPkg];
plugins = lib.optionals cfg.binsync.enable [
(pkgs.runCommand "binsync-ida" {} ''
mkdir -p $out/plugins
cp ${binsyncPath}/binsync/binsync_plugin.py $out/plugins
'')
];
};
in
{
options.programs.idapro = {
enable = lib.mkEnableOption "IDA Pro";
package = lib.mkPackageOption pkgs "idapro" {
example = lib.literalExpression "idapro.override { ... }";
};
binsync = {
enable = lib.mkEnableOption "IDA binsync integration";
};
};
config = lib.mkIf cfg.enable {
environment = {
systemPackages = [
idaproConfigured
];
sessionVariables.IDAUSR = "$HOME/.config/idapro";
};
};
}

View File

@ -26,7 +26,7 @@
curl,
gnutar,
makeDesktopItem,
makeWrapper,
makeBinaryWrapper,
runCommand,
_errorMessage ? builtins.throw ''
@ -62,6 +62,8 @@
pythonPackage ? python311,
# additional python packages to make available to idapython
pythonDeps ? [],
# dirs to prepend to IDAUSR
plugins ? [],
}: let
defaultPythonDeps = ps: with ps; [
rpyc
@ -77,7 +79,7 @@ in stdenv.mkDerivation (self: {
nativeBuildInputs = [
autoPatchelfHook
copyDesktopItems
makeWrapper
makeBinaryWrapper
];
# Add everything to the RPATH, in case IDA decides to dlopen things.
@ -149,7 +151,8 @@ in stdenv.mkDerivation (self: {
wrapProgram "$out/opt/ida" \
--prefix PYTHONPATH : $out/opt/idalib/python \
--prefix PATH : ${pythonEnv}/bin
--prefix PATH : ${pythonEnv}/bin \
--suffix IDAUSR : "${lib.makeSearchPath "" plugins}"
'';
dontWrapQtApps = true;