1{
2 lib,
3 stdenv,
4 ailment,
5 archinfo,
6 buildPythonPackage,
7 cachetools,
8 capstone,
9 cffi,
10 claripy,
11 cle,
12 cppheaderparser,
13 dpkt,
14 fetchFromGitHub,
15 gitpython,
16 itanium-demangler,
17 mulpyplexer,
18 nampa,
19 networkx,
20 progressbar2,
21 protobuf,
22 psutil,
23 pycparser,
24 pyformlang,
25 pythonOlder,
26 pyvex,
27 rich,
28 rpyc,
29 setuptools,
30 sortedcontainers,
31 sqlalchemy,
32 sympy,
33 unicorn,
34 unique-log-filter,
35}:
36
37buildPythonPackage rec {
38 pname = "angr";
39 version = "9.2.133";
40 pyproject = true;
41
42 disabled = pythonOlder "3.11";
43
44 src = fetchFromGitHub {
45 owner = "angr";
46 repo = "angr";
47 rev = "refs/tags/v${version}";
48 hash = "sha256-dHksVhuQUC0f55WNPSkVHTXTGVuul742LeWSz0CTwrw=";
49 };
50
51 postPatch = ''
52 # unicorn is also part of build-system
53 substituteInPlace pyproject.toml \
54 --replace-fail "unicorn==2.0.1.post1" "unicorn"
55 '';
56
57 pythonRelaxDeps = [
58 "capstone"
59 "unicorn"
60 ];
61
62 build-system = [ setuptools ];
63
64 dependencies = [
65 ailment
66 archinfo
67 cachetools
68 capstone
69 cffi
70 claripy
71 cle
72 cppheaderparser
73 dpkt
74 gitpython
75 itanium-demangler
76 mulpyplexer
77 nampa
78 networkx
79 progressbar2
80 protobuf
81 psutil
82 pycparser
83 pyformlang
84 pyvex
85 rich
86 rpyc
87 sortedcontainers
88 sqlalchemy
89 sympy
90 unicorn
91 unique-log-filter
92 ];
93
94 optional-dependencies = {
95 AngrDB = [ sqlalchemy ];
96 };
97
98 setupPyBuildFlags = lib.optionals stdenv.hostPlatform.isLinux [
99 "--plat-name"
100 "linux"
101 ];
102
103 # Tests have additional requirements, e.g., pypcode and angr binaries
104 # cle is executing the tests with the angr binaries
105 doCheck = false;
106
107 pythonImportsCheck = [
108 "angr"
109 "claripy"
110 "cle"
111 "pyvex"
112 "archinfo"
113 ];
114
115 meta = with lib; {
116 description = "Powerful and user-friendly binary analysis platform";
117 homepage = "https://angr.io/";
118 license = with licenses; [ bsd2 ];
119 maintainers = with maintainers; [ fab ];
120 # angr is pining unicorn
121 broken = versionAtLeast unicorn.version "2.0.1.post1";
122 };
123}