Radare2 plugins in `nixpkgs`

Context

Because I hoped to use the Ghidra decompiler with Cutter, I stumbled upon the related radare2 plugin: r2ghidra-dec.

As stated in their README:

To use r2ghidra from cutter, either use a provided pre-built release starting with Cutter 1.9, which bundles r2ghidra, or follow the build instructions below.

It does not seem that the nixpkgs version of Cutter has the plugin available, so I started an expression to have it.

Situation

Sadly, not being very experienced with nix expressions, and unfamiliar with Qt applications, I am not quite sure of what I am doing… :confused:
Here is what I have so far: https://github.com/Pamplemousse/nixpkgs/blob/422e40d75756bc26846503e2315c7bd86b58cbd2/pkgs/development/tools/analysis/radare2/packages/r2ghidra-dec.nix .

As of now, it has several major limitations:

  • It does not seem to work for “vanilla” r2:
After building successfully, and copying the relevant content from the nix store to `~/.local/share/radare2/plugins` (toggle for error log).
R_DEBUG=1 r2 binaries/simple/program
Cannot open /home/pamplemousse/.local/share/radare2/plugins/r2ghidra_sleigh
Loading /home/pamplemousse/.local/share/radare2/plugins/core_ghidra.so
r_lib_dl_open: error: /home/pamplemousse/.local/share/radare2/plugins/core_ghidra.so (/home/pamplemousse/.local/share/radare2/plugins/core_ghidra.so: undefined symbol: r_annotated_code_free)
Cannot open library: '/home/pamplemousse/.local/share/radare2/plugins/core_ghidra.so'
Cannot open directory '/nix/store/3cq7x6wivjzbz5p0w14y98yw0w6jsvjr-radare2-4.4.0/lib/radare2-extras/4.4.0'
Cannot open directory '/nix/store/3cq7x6wivjzbz5p0w14y98yw0w6jsvjr-radare2-4.4.0/lib/radare2-bindings/4.4.0'
Unknown DW_FORM 0x06
r_lib_dl_open: error: /usr/lib/swift/libswiftCore.dylib (/usr/lib/swift/libswiftCore.dylib: cannot open shared object file: No such file or directory)
 -- Ask not what r2 can do for you - ask what you can do for r2
^C
[0x00401060]>
  • It does not build for Cutter;
  • Even if the package built, there would still need a bit of manual hooking required for it to be usable from r2 and/or Cutter;

(Plus, and that rejoins the previous point: It would be nice to have an idiomatic way to package radare2 and Cutter plugins.)

And so what?

Well, I found that some people expressed their interest in such an enterprise:

And I don’t feel I can get any farther without help of some more experienced nixpkgs contributors.

How you can help

  • Express your interest in seeing this moving forward;
  • Give some feedback on what has been done;
  • Present some tips, pointers, documentation, ideas, or whatever could help;
  • Write some nix code.

Thanks :slight_smile:

eveything you really need to know about qt is located Nixpkgs 23.11 manual | Nix & NixOS