rizin-nix-plugins/rizin-with-plugin-support.nix

24 lines
853 B
Nix
Raw Permalink Normal View History

{ rizin-unwrapped, rizinPlugins, symlinkJoin }:
2022-07-28 18:42:08 +02:00
let
makeRizinPackageWithPlugins = plugins:
2022-08-02 19:15:07 +02:00
symlinkJoin
{
name = "rizin";
paths = [ rizin-unwrapped ] ++ plugins;
postBuild = ''
cd $out/bin/
for file in ./*; do
# Rizin loads plugins from a path relative to /proc/self/exe.
# /proc/self/exe resolves symlinks so we need to copy the resulting binary.
# This is obviously not ideal, but the binaries weight only a few kibibytes
# and nix can replace the copy with a hardlink automatically, via nix store optimize
2022-08-02 19:15:07 +02:00
cp --remove-destination "$(readlink "$file")" "$file"
done
'';
} // {
2022-07-28 18:42:08 +02:00
withPlugins = p: makeRizinPackageWithPlugins (plugins ++ (p rizinPlugins));
};
2022-08-02 19:15:07 +02:00
in
makeRizinPackageWithPlugins [ ]