mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-31 01:02:20 +00:00
Keep the upstream runtime requirement and relax its exact version pin to use Z3 5.3.1. Remove Z3 from build-system.requires, since Nix supplies it and pythonRelaxDeps only changes runtime metadata. Assisted-by: OpenAI Codex (GPT-6)
179 lines
3.3 KiB
Nix
179 lines
3.3 KiB
Nix
{
|
|
lib,
|
|
angr-data,
|
|
archinfo,
|
|
buildPythonPackage,
|
|
cachetools,
|
|
capstone,
|
|
cargo,
|
|
cffi,
|
|
cle,
|
|
cxxheaderparser,
|
|
fastmcp,
|
|
fetchFromGitHub,
|
|
gitpython,
|
|
grpcio-tools,
|
|
keystone-engine,
|
|
lmdb,
|
|
mcp,
|
|
msgspec,
|
|
mulpyplexer,
|
|
networkx,
|
|
opentelemetry-api,
|
|
platformdirs,
|
|
protobuf,
|
|
psutil,
|
|
pycparser,
|
|
pydantic-ai-slim,
|
|
pydemumble,
|
|
pypcode,
|
|
pyvex,
|
|
python,
|
|
pythonOlder,
|
|
rich,
|
|
runCommandCC,
|
|
rustc,
|
|
rustPlatform,
|
|
setuptools,
|
|
setuptools-rust,
|
|
sortedcontainers,
|
|
sqlalchemy,
|
|
sympy,
|
|
typing-extensions,
|
|
unicorn,
|
|
z3-solver,
|
|
}:
|
|
|
|
buildPythonPackage (finalAttrs: {
|
|
pname = "angr";
|
|
# Keep angr-management, angr, archinfo, cle, and pyvex in sync.
|
|
# nixpkgs-update: no auto update
|
|
version = "10.0.4";
|
|
pyproject = true;
|
|
|
|
disabled = pythonOlder "3.12";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "angr";
|
|
repo = "angr";
|
|
tag = "v${finalAttrs.version}";
|
|
hash = "sha256-7XPOH5kGpSychDk17jBz7jK7nv9zRsy+dPWaCYCNx50=";
|
|
};
|
|
|
|
cargoDeps = rustPlatform.fetchCargoVendor {
|
|
inherit (finalAttrs) src pname version;
|
|
hash = "sha256-kVDd3sXTyGZPPXg5rFZZqfC3UNqq6AxxHoZdhzMBKyo=";
|
|
};
|
|
|
|
pythonRelaxDeps = [
|
|
"cxxheaderparser"
|
|
"lmdb"
|
|
"z3-solver"
|
|
];
|
|
|
|
postPatch = ''
|
|
# Nix supplies the build dependency; keep the runtime requirement.
|
|
sed -i '/^\[build-system\]/,/^\[/{ /"z3-solver/d; }' pyproject.toml
|
|
|
|
# cxxheaderparser 1.x represents member-function pointers using Pointer.
|
|
substituteInPlace angr/sim_type.py \
|
|
--replace-fail 'cxxheaderparser.types.MemberPointer' \
|
|
'getattr(cxxheaderparser.types, "MemberPointer", cxxheaderparser.types.Pointer)'
|
|
'';
|
|
|
|
build-system = [
|
|
grpcio-tools
|
|
protobuf
|
|
pyvex
|
|
setuptools
|
|
setuptools-rust
|
|
z3-solver
|
|
];
|
|
|
|
nativeBuildInputs = [
|
|
rustPlatform.cargoSetupHook
|
|
cargo
|
|
rustc
|
|
];
|
|
|
|
env.Z3_SYS_Z3_VERSION = z3-solver.version;
|
|
|
|
dependencies = [
|
|
angr-data
|
|
archinfo
|
|
cachetools
|
|
capstone
|
|
cffi
|
|
cle
|
|
cxxheaderparser
|
|
gitpython
|
|
lmdb
|
|
msgspec
|
|
mulpyplexer
|
|
networkx
|
|
platformdirs
|
|
protobuf
|
|
psutil
|
|
pycparser
|
|
pydemumble
|
|
pypcode
|
|
pyvex
|
|
rich
|
|
sortedcontainers
|
|
sympy
|
|
typing-extensions
|
|
z3-solver
|
|
];
|
|
|
|
optional-dependencies = {
|
|
angrdb = [ sqlalchemy ];
|
|
keystone = [ keystone-engine ];
|
|
llm = [
|
|
fastmcp
|
|
mcp
|
|
pydantic-ai-slim
|
|
];
|
|
telemetry = [ opentelemetry-api ];
|
|
unicorn = [ unicorn ];
|
|
};
|
|
|
|
# The full upstream suite requires large external fixtures and optional dependencies.
|
|
doCheck = false;
|
|
|
|
pythonImportsCheck = [
|
|
"angr"
|
|
"archinfo"
|
|
"cle"
|
|
"pypcode"
|
|
"pyvex"
|
|
];
|
|
|
|
passthru.tests.smoke =
|
|
runCommandCC "angr-smoke-test"
|
|
{
|
|
__structuredAttrs = true;
|
|
nativeBuildInputs = [
|
|
(python.withPackages (_: [
|
|
finalAttrs.finalPackage
|
|
sqlalchemy
|
|
unicorn
|
|
]))
|
|
];
|
|
}
|
|
''
|
|
cc -O1 ${./tests/fixture.c} -o fixture
|
|
python ${./tests/smoke.py} "$PWD/fixture" ${finalAttrs.version}
|
|
touch "$out"
|
|
'';
|
|
|
|
meta = {
|
|
description = "Powerful and user-friendly binary analysis platform";
|
|
homepage = "https://angr.io/";
|
|
license = lib.licenses.bsd2;
|
|
maintainers = with lib.maintainers; [
|
|
connornelson
|
|
fab
|
|
];
|
|
};
|
|
})
|