Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 fetchFromGitHub,
4 fetchpatch,
5 stdenv,
6 # for passthru.plugins
7 pkgs,
8 # nativeBuildInputs
9 cmake,
10 pkg-config,
11 wrapQtAppsHook,
12 # Qt
13 qt5compat,
14 qtbase,
15 qtwayland,
16 qtsvg,
17 qttools,
18 qtwebengine,
19 # buildInputs
20 graphviz,
21 python3,
22 rizin,
23}:
24
25let
26 cutter = stdenv.mkDerivation rec {
27 pname = "cutter";
28 version = "2.4.1";
29
30 src = fetchFromGitHub {
31 owner = "rizinorg";
32 repo = "cutter";
33 rev = "v${version}";
34 hash = "sha256-fNOznaFzWJ4Dve9U1+E4xPaznnyxae2jHNaBCdJzDyQ=";
35 fetchSubmodules = true;
36 };
37
38 nativeBuildInputs = [
39 cmake
40 pkg-config
41 python3
42 wrapQtAppsHook
43 ];
44
45 propagatedBuildInputs = [
46 python3.pkgs.pyside6
47 ];
48
49 buildInputs = [
50 graphviz
51 python3
52 qt5compat
53 qtbase
54 qtsvg
55 qttools
56 qtwebengine
57 rizin
58 ]
59 ++ lib.optionals stdenv.hostPlatform.isLinux [
60 qtwayland
61 ];
62
63 cmakeFlags = [
64 "-DCUTTER_USE_BUNDLED_RIZIN=OFF"
65 "-DCUTTER_ENABLE_PYTHON=ON"
66 "-DCUTTER_ENABLE_PYTHON_BINDINGS=ON"
67 "-DCUTTER_ENABLE_GRAPHVIZ=ON"
68 "-DCUTTER_QT6=ON"
69 ];
70
71 preBuild = ''
72 qtWrapperArgs+=(--prefix PYTHONPATH : "$PYTHONPATH")
73 '';
74
75 passthru = rec {
76 plugins = rizin.plugins // {
77 rz-ghidra = rizin.plugins.rz-ghidra.override {
78 inherit cutter qtbase qtsvg;
79 enableCutterPlugin = true;
80 };
81 };
82 withPlugins =
83 filter:
84 pkgs.callPackage ./wrapper.nix {
85 inherit rizin cutter;
86 isCutter = true;
87 plugins = filter plugins;
88 };
89 };
90
91 meta = with lib; {
92 description = "Free and Open Source Reverse Engineering Platform powered by rizin";
93 homepage = src.meta.homepage;
94 license = licenses.gpl3;
95 mainProgram = "cutter";
96 maintainers = with maintainers; [
97 mic92
98 dtzWill
99 ];
100 inherit (rizin.meta) platforms;
101 };
102 };
103in
104cutter