install gef optional dependencies

This commit is contained in:
Sean Buckley 2021-08-16 02:11:10 -04:00
parent 32fd85a4d3
commit aa2de56953

View file

@ -1,5 +1,6 @@
{ stdenv, fetchFromGitHub, makeWrapper, gdb }:
{ stdenv, lib, fetchFromGitHub, makeWrapper, gdb, python3 }:
let
src = fetchFromGitHub {
owner = "hugsy";
repo = "gef";
@ -7,6 +8,20 @@ let
sha256 = "zKn3yS9h8bzjsb/iPgNU8g5IgXFBaKvM7osTqzzv16s=";
};
reqs =
(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);
in
stdenv.mkDerivation {
name = "gef";
@ -15,6 +30,7 @@ stdenv.mkDerivation {
installPhase = ''
mkdir -p "$out/bin"
makeWrapper "${gdb}/bin/gdb" "$out/bin/gef" \
--suffix PYTHONPATH : "${optionals}" \
--add-flags "-x ${src}/gef.py" \
--add-flags "-ex 'gef config context.clear_screen 0'"
'';