about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/analysis/rizin/cutter.nix
blob: 44954c62a3c2c9b67999a929d8fcb61080151780 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
{ lib
, fetchFromGitHub
, stdenv
# for passthru.plugins
, pkgs
# nativeBuildInputs
, cmake
, pkg-config
, wrapQtAppsHook
# Qt
, qt5compat
, qtbase
, qtwayland
, qtsvg
, qttools
, qtwebengine
# buildInputs
, graphviz
, python3
, rizin
}:

let cutter = stdenv.mkDerivation rec {
  pname = "cutter";
  version = "2.3.4";

  src = fetchFromGitHub {
    owner = "rizinorg";
    repo = "cutter";
    rev = "v${version}";
    hash = "sha256-TSEi1mXVvvaGo4koo3EnN/veXPUHF747g+gifnl4IDQ=";
    fetchSubmodules = true;
  };

  nativeBuildInputs = [
    cmake
    pkg-config
    python3
    wrapQtAppsHook
  ];

  propagatedBuildInputs = [
    python3.pkgs.pyside6
  ];

  buildInputs = [
    graphviz
    python3
    qt5compat
    qtbase
    qtsvg
    qttools
    qtwebengine
    rizin
  ] ++ lib.optionals stdenv.isLinux [
    qtwayland
  ];

  cmakeFlags = [
    "-DCUTTER_USE_BUNDLED_RIZIN=OFF"
    "-DCUTTER_ENABLE_PYTHON=ON"
    "-DCUTTER_ENABLE_PYTHON_BINDINGS=ON"
    "-DCUTTER_ENABLE_GRAPHVIZ=ON"
    "-DCUTTER_QT6=ON"
  ];

  preBuild = ''
    qtWrapperArgs+=(--prefix PYTHONPATH : "$PYTHONPATH")
  '';

  passthru = rec {
    plugins = rizin.plugins // {
      rz-ghidra = rizin.plugins.rz-ghidra.override {
        inherit cutter qtbase qtsvg;
        enableCutterPlugin = true;
      };
    };
    withPlugins = filter: pkgs.callPackage ./wrapper.nix {
      inherit rizin cutter;
      isCutter = true;
      plugins = filter plugins;
    };
  };

  meta = with lib; {
    description = "Free and Open Source Reverse Engineering Platform powered by rizin";
    homepage = src.meta.homepage;
    license = licenses.gpl3;
    mainProgram = "cutter";
    maintainers = with maintainers; [ mic92 dtzWill ];
    inherit (rizin.meta) platforms;
  };
}; in cutter