Compare commits

..

No commits in common. "f690335d83b8f846cb6c866da86876219457cb29" and "bbc1e9899e4a15fca808ad0e726d5079b24edc29" have entirely different histories.

4 changed files with 28 additions and 27 deletions

View file

@ -7,9 +7,7 @@
outputs = { self, nixpkgs, flake-utils }: outputs = { self, nixpkgs, flake-utils }:
{ {
overlays.default = final: prev: { overlays.default = final: prev: {
rizin-unwrapped = prev.rizin.overrideAttrs (o: { rizin-unwrapped = prev.rizin;
mesonFlags = o.mesonFlags ++ [ "-Dportable=true" ];
});
rizin = self.packages.${prev.system}.rizin; rizin = self.packages.${prev.system}.rizin;
rizinPlugins = { rizinPlugins = {
rz-ghidra = self.packages.${prev.system}.rz-ghidra; rz-ghidra = self.packages.${prev.system}.rz-ghidra;
@ -28,7 +26,6 @@
in in
rec { rec {
packages = flake-utils.lib.flattenTree { packages = flake-utils.lib.flattenTree {
rizin-unwrapped = pkgs.rizin-unwrapped;
rizin = pkgs.callPackage ./rizin-with-plugin-support.nix { }; rizin = pkgs.callPackage ./rizin-with-plugin-support.nix { };
rz-ghidra = pkgs.callPackage ./rz-ghidra.nix { }; rz-ghidra = pkgs.callPackage ./rz-ghidra.nix { };
jsdec = pkgs.callPackage ./jsdec.nix { }; jsdec = pkgs.callPackage ./jsdec.nix { };

View file

@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, meson, pkg-config, cmake, ninja, openssl, rizin-unwrapped }: stdenv.mkDerivation { { lib, stdenv, fetchFromGitHub, meson, pkg-config, cmake, ninja, openssl, rizin }: stdenv.mkDerivation {
name = "jsdec"; name = "jsdec";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "rizinorg"; owner = "rizinorg";
@ -10,6 +10,6 @@
cd p cd p
''; '';
mesonFlags = [ "-Djsc_folder=/build/source/" ]; mesonFlags = [ "-Djsc_folder=/build/source/" ];
buildInputs = [ rizin-unwrapped openssl ]; buildInputs = [ rizin openssl ];
nativeBuildInputs = [ meson pkg-config ninja ]; nativeBuildInputs = [ meson pkg-config ninja ];
} }

View file

@ -1,23 +1,27 @@
{ rizin-unwrapped, rizinPlugins, symlinkJoin }: { rizin-unwrapped, rizinPlugins, makeWrapper, symlinkJoin }:
let let
makeRizinPackageWithPlugins = plugins: makeRizinPackageWithPlugins = plugins:
symlinkJoin let
{ plugins_path = symlinkJoin {
name = "rizin-plugins";
paths = plugins;
};
in
symlinkJoin {
name = "rizin"; name = "rizin";
paths = [ rizin-unwrapped ] ++ plugins; paths = [ rizin-unwrapped ];
buildInputs = [makeWrapper];
postBuild = '' postBuild = ''
cd $out/bin/ wrapProgramArgs=()
for file in ./*; do for plugin in ${plugins_path}/lib/rizin/plugins/*; do
# Rizin loads plugins from a path relative to /proc/self/exe. wrapProgramArgs+=("--add-flags")
# /proc/self/exe resolves symlinks so we need to copy the resulting binary. wrapProgramArgs+=("-l")
# This is obviously not ideal, but the binaries weight only a few kibibytes wrapProgramArgs+=("--add-flags")
# and nix can replace the copy with a hardlink automatically, via nix store optimize wrapProgramArgs+=("$plugin")
cp --remove-destination "$(readlink "$file")" "$file"
done done
wrapProgram $out/bin/rizin ''${wrapProgramArgs[*]}
''; '';
} // { } // {
withPlugins = p: makeRizinPackageWithPlugins (plugins ++ (p rizinPlugins)); withPlugins = p: makeRizinPackageWithPlugins (plugins ++ (p rizinPlugins));
}; };
in in makeRizinPackageWithPlugins []
makeRizinPackageWithPlugins [ ]

View file

@ -1,4 +1,4 @@
{ lib, stdenv, fetchgit, pkg-config, cmake, openssl, rizin-unwrapped }: stdenv.mkDerivation { { lib, stdenv, fetchgit, pkg-config, cmake, openssl, rizin }: stdenv.mkDerivation {
name = "rz-ghidra"; name = "rz-ghidra";
src = fetchgit { src = fetchgit {
url = "https://github.com/rizinorg/rz-ghidra.git"; url = "https://github.com/rizinorg/rz-ghidra.git";
@ -7,6 +7,6 @@
fetchSubmodules = true; fetchSubmodules = true;
}; };
mesonFlags = [ "-Djsc_folder=.." ]; mesonFlags = [ "-Djsc_folder=.." ];
buildInputs = [ rizin-unwrapped cmake openssl ]; buildInputs = [ rizin cmake openssl ];
nativeBuildInputs = [ pkg-config ]; nativeBuildInputs = [ pkg-config ];
} }