2021-08-16 06:11:10 +00:00
|
|
|
{ stdenv, lib, fetchFromGitHub, makeWrapper, gdb, python3 }:
|
2021-02-17 03:18:37 +00:00
|
|
|
let
|
2021-08-16 06:11:10 +00:00
|
|
|
|
2021-02-17 03:18:37 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "hugsy";
|
|
|
|
repo = "gef";
|
2021-07-09 01:04:04 +00:00
|
|
|
rev = "2021.07";
|
|
|
|
sha256 = "zKn3yS9h8bzjsb/iPgNU8g5IgXFBaKvM7osTqzzv16s=";
|
2021-02-17 03:18:37 +00:00
|
|
|
};
|
|
|
|
|
2021-09-13 18:51:06 +00:00
|
|
|
# exclude broken libraries
|
|
|
|
reqs = builtins.filter (x: false == (builtins.elem x [ "capstone" "ropper" ]))
|
2021-08-16 06:11:10 +00:00
|
|
|
(builtins.filter (x: x != "")
|
|
|
|
(lib.splitString "\n"
|
|
|
|
(builtins.readFile "${src}/requirements.txt")));
|
|
|
|
|
|
|
|
# python3.pkgs.ropper does not work with makePythonPath. Swap it out.
|
|
|
|
pyp = python3.pkgs // {
|
|
|
|
ropper = python3.pkgs.buildPythonPackage {
|
|
|
|
inherit (python3.pkgs.ropper) name src propagatedBuildInputs;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
optionals = pyp.makePythonPath (map (x: pyp.${x}) reqs);
|
|
|
|
|
2021-02-17 03:18:37 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
name = "gef";
|
|
|
|
phases = [ "installPhase" ];
|
|
|
|
buildInputs = [ makeWrapper ];
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "$out/bin"
|
|
|
|
makeWrapper "${gdb}/bin/gdb" "$out/bin/gef" \
|
2021-08-16 06:11:10 +00:00
|
|
|
--suffix PYTHONPATH : "${optionals}" \
|
2021-08-16 14:08:26 +00:00
|
|
|
--add-flags "-x ${src}/gef.py"
|
2021-02-17 03:18:37 +00:00
|
|
|
'';
|
|
|
|
}
|