Compare commits
2 commits
bbc1e9899e
...
f690335d83
Author | SHA1 | Date | |
---|---|---|---|
|
f690335d83 | ||
|
3f91ac23a0 |
4 changed files with 27 additions and 28 deletions
|
@ -7,7 +7,9 @@
|
|||
outputs = { self, nixpkgs, flake-utils }:
|
||||
{
|
||||
overlays.default = final: prev: {
|
||||
rizin-unwrapped = prev.rizin;
|
||||
rizin-unwrapped = prev.rizin.overrideAttrs (o: {
|
||||
mesonFlags = o.mesonFlags ++ [ "-Dportable=true" ];
|
||||
});
|
||||
rizin = self.packages.${prev.system}.rizin;
|
||||
rizinPlugins = {
|
||||
rz-ghidra = self.packages.${prev.system}.rz-ghidra;
|
||||
|
@ -26,6 +28,7 @@
|
|||
in
|
||||
rec {
|
||||
packages = flake-utils.lib.flattenTree {
|
||||
rizin-unwrapped = pkgs.rizin-unwrapped;
|
||||
rizin = pkgs.callPackage ./rizin-with-plugin-support.nix { };
|
||||
rz-ghidra = pkgs.callPackage ./rz-ghidra.nix { };
|
||||
jsdec = pkgs.callPackage ./jsdec.nix { };
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, stdenv, fetchFromGitHub, meson, pkg-config, cmake, ninja, openssl, rizin }: stdenv.mkDerivation {
|
||||
{ lib, stdenv, fetchFromGitHub, meson, pkg-config, cmake, ninja, openssl, rizin-unwrapped }: stdenv.mkDerivation {
|
||||
name = "jsdec";
|
||||
src = fetchFromGitHub {
|
||||
owner = "rizinorg";
|
||||
|
@ -10,6 +10,6 @@
|
|||
cd p
|
||||
'';
|
||||
mesonFlags = [ "-Djsc_folder=/build/source/" ];
|
||||
buildInputs = [ rizin openssl ];
|
||||
buildInputs = [ rizin-unwrapped openssl ];
|
||||
nativeBuildInputs = [ meson pkg-config ninja ];
|
||||
}
|
||||
|
|
|
@ -1,27 +1,23 @@
|
|||
{ rizin-unwrapped, rizinPlugins, makeWrapper, symlinkJoin }:
|
||||
{ rizin-unwrapped, rizinPlugins, symlinkJoin }:
|
||||
let
|
||||
makeRizinPackageWithPlugins = plugins:
|
||||
let
|
||||
plugins_path = symlinkJoin {
|
||||
name = "rizin-plugins";
|
||||
paths = plugins;
|
||||
};
|
||||
in
|
||||
symlinkJoin {
|
||||
symlinkJoin
|
||||
{
|
||||
name = "rizin";
|
||||
paths = [ rizin-unwrapped ];
|
||||
buildInputs = [makeWrapper];
|
||||
paths = [ rizin-unwrapped ] ++ plugins;
|
||||
postBuild = ''
|
||||
wrapProgramArgs=()
|
||||
for plugin in ${plugins_path}/lib/rizin/plugins/*; do
|
||||
wrapProgramArgs+=("--add-flags")
|
||||
wrapProgramArgs+=("-l")
|
||||
wrapProgramArgs+=("--add-flags")
|
||||
wrapProgramArgs+=("$plugin")
|
||||
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
|
||||
wrapProgram $out/bin/rizin ''${wrapProgramArgs[*]}
|
||||
'';
|
||||
} // {
|
||||
withPlugins = p: makeRizinPackageWithPlugins (plugins ++ (p rizinPlugins));
|
||||
};
|
||||
in makeRizinPackageWithPlugins []
|
||||
in
|
||||
makeRizinPackageWithPlugins [ ]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ lib, stdenv, fetchgit, pkg-config, cmake, openssl, rizin }: stdenv.mkDerivation {
|
||||
{ lib, stdenv, fetchgit, pkg-config, cmake, openssl, rizin-unwrapped }: stdenv.mkDerivation {
|
||||
name = "rz-ghidra";
|
||||
src = fetchgit {
|
||||
url = "https://github.com/rizinorg/rz-ghidra.git";
|
||||
|
@ -7,6 +7,6 @@
|
|||
fetchSubmodules = true;
|
||||
};
|
||||
mesonFlags = [ "-Djsc_folder=.." ];
|
||||
buildInputs = [ rizin cmake openssl ];
|
||||
buildInputs = [ rizin-unwrapped cmake openssl ];
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue