1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 filelock,
6 ghidra-bridge,
7 jfx-bridge,
8 networkx,
9 platformdirs,
10 ply,
11 prompt-toolkit,
12 psutil,
13 pycparser,
14 pyhidra,
15 pytestCheckHook,
16 setuptools,
17 toml,
18 tqdm,
19 writableTmpDirAsHomeHook,
20}:
21
22let
23 # Binary files from https://github.com/binsync/bs-artifacts (only used for testing and only here)
24 binaries = fetchFromGitHub {
25 owner = "binsync";
26 repo = "bs-artifacts";
27 rev = "514c2d6ef1875435c9d137bb5d99b6fc74063817";
28 hash = "sha256-P7+BTJgdC9W8cC/7xQduFYllF+0ds1dSlm59/BFvZ2g=";
29 };
30in
31buildPythonPackage rec {
32 pname = "libbs";
33 version = "2.16.4";
34 pyproject = true;
35
36 src = fetchFromGitHub {
37 owner = "binsync";
38 repo = "libbs";
39 tag = "v${version}";
40 hash = "sha256-if27Tg5S0Esrw9xHi6nr+kDIw4OTz7yZ2256/4Kbkeo=";
41 };
42
43 build-system = [ setuptools ];
44
45 dependencies = [
46 filelock
47 ghidra-bridge
48 jfx-bridge
49 networkx
50 platformdirs
51 ply
52 prompt-toolkit
53 psutil
54 pycparser
55 pyhidra
56 toml
57 tqdm
58 ];
59
60 nativeCheckInputs = [
61 pytestCheckHook
62 writableTmpDirAsHomeHook
63 ];
64
65 # Place test binaries in place
66 preCheck = ''
67 export HOME=$TMPDIR
68 mkdir -p $HOME/bs-artifacts/binaries
69 cp -r ${binaries} $HOME/bs-artifacts/binaries
70 export TEST_BINARIES_DIR=$HOME/bs-artifacts/binaries
71 '';
72
73 pythonImportsCheck = [ "libbs" ];
74
75 disabledTests = [
76 "test_change_watcher_plugin_cli"
77 "test_ghidra_artifact_watchers"
78 "TestHeadlessInterfaces"
79 ];
80
81 meta = {
82 description = "Library for writing plugins in any decompiler: includes API lifting, common data formatting, and GUI abstraction";
83 homepage = "https://github.com/binsync/libbs";
84 changelog = "https://github.com/binsync/libbs/releases/tag/${src.tag}";
85 license = lib.licenses.bsd2;
86 maintainers = with lib.maintainers; [ scoder12 ];
87 };
88}