{ rizin-unwrapped, rizinPlugins, symlinkJoin }: let makeRizinPackageWithPlugins = plugins: 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 cp --remove-destination "$(readlink "$file")" "$file" done ''; } // { withPlugins = p: makeRizinPackageWithPlugins (plugins ++ (p rizinPlugins)); }; in makeRizinPackageWithPlugins [ ]