Initial commit

This commit is contained in:
bad 2022-07-28 18:42:08 +02:00
commit c9bb7d4a85
5 changed files with 129 additions and 0 deletions

39
flake.lock Normal file
View file

@ -0,0 +1,39 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1656928814,
"narHash": "sha256-RIFfgBuKz6Hp89yRr7+NR5tzIAbn52h8vT6vXkYjZoM=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "7e2a3b3dfd9af950a856d66b0a7d01e3c18aa249",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 0,
"narHash": "sha256-94ZTF0uIX/iZdiD4RJ5f933ak/OM4XLl7hF+gCa4Iuk=",
"path": "/nix/store/9qqx4gk4qnqaqb102iwvhhwn2basmbdq-source",
"type": "path"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

36
flake.nix Normal file
View file

@ -0,0 +1,36 @@
{
description = "A very basic flake";
inputs = {
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, flake-utils }:
{
overlays.default = final: prev: {
rizin-unwrapped = prev.rizin;
rizin = self.packages.${prev.system}.rizin;
rizinPlugins = self.packages.${prev.system}.rizinPlugins;
};
}
// flake-utils.lib.eachSystem [
"aarch64-linux"
"i686-linux"
"x86_64-linux"
]
(system:
let
pkgs = import nixpkgs { inherit system; overlays = [ self.overlays.default ]; };
in
rec {
packages = flake-utils.lib.flattenTree {
rizin = pkgs.callPackage ./rizin-with-plugin-support.nix { };
rizinPlugins = {
rz-ghidra = pkgs.callPackage ./rz-ghidra.nix { };
jsdec = pkgs.callPackage ./jsdec.nix { };
};
};
defaultPackage = packages.rizin;
}
);
}

15
jsdec.nix Normal file
View file

@ -0,0 +1,15 @@
{ lib, stdenv, fetchFromGitHub, meson, pkg-config, cmake, ninja, openssl, rizin }: stdenv.mkDerivation {
name = "jsdec";
src = fetchFromGitHub {
owner = "rizinorg";
repo = "jsdec";
rev = "5ef437d181ad73fc74e406d922f02d09904ae047";
sha256 = "sha256-Z5QU7IdMGk5IcWbmOVeblfWlo1hfulaYVt3qWRmmYjc=";
};
preConfigure = ''
cd p
'';
mesonFlags = [ "-Djsc_folder=/build/source/" ];
buildInputs = [ rizin openssl ];
nativeBuildInputs = [ meson pkg-config ninja ];
}

View file

@ -0,0 +1,27 @@
{ rizin-unwrapped, rizinPlugins, makeWrapper, symlinkJoin }:
let
makeRizinPackageWithPlugins = plugins:
let
plugins_path = symlinkJoin {
name = "rizin-plugins";
paths = plugins;
};
in
symlinkJoin {
name = "rizin";
paths = [ rizin-unwrapped ];
buildInputs = [makeWrapper];
postBuild = ''
wrapProgramArgs=()
for plugin in ${plugins_path}/lib/rizin/plugins/*; do
wrapProgramArgs+=("--add-flags")
wrapProgramArgs+=("-l")
wrapProgramArgs+=("--add-flags")
wrapProgramArgs+=("$plugin")
done
wrapProgram $out/bin/rizin ''${wrapProgramArgs[*]}
'';
} // {
withPlugins = p: makeRizinPackageWithPlugins (plugins ++ (p rizinPlugins));
};
in makeRizinPackageWithPlugins []

12
rz-ghidra.nix Normal file
View file

@ -0,0 +1,12 @@
{ lib, stdenv, fetchgit, pkg-config, cmake, openssl, rizin, breakpointHook }: stdenv.mkDerivation {
name = "rz-ghidra";
src = fetchgit {
url = "https://github.com/rizinorg/rz-ghidra.git";
rev = "e70aa0f68310f18620153eed57b27fdfb9ba3018";
sha256 = "sha256-7GZdrxHGSAf1MlMdEpKDOa4Dxu5ckG+IlgAN+mp/U5E=";
fetchSubmodules = true;
};
mesonFlags = [ "-Djsc_folder=/build/source/" ];
buildInputs = [ rizin cmake openssl ];
nativeBuildInputs = [ pkg-config breakpointHook ];
}