nixos-config/pkgs/gef/default.nix

35 lines
916 B
Nix
Raw Normal View History

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-11-12 20:49:15 +00:00
rev = "2021.10";
sha256 = "7kIR9lzKBb1rArb9l1Tu10RJ9uacifvy2EbkmrMFK2Y=";
2021-02-17 03:18:37 +00:00
};
2021-11-12 20:49:15 +00:00
reqs = lib.splitString "\n" (lib.fileContents (./. + "/requirements.txt"));
2021-08-16 06:11:10 +00:00
# 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
'';
2021-11-12 20:49:15 +00:00
meta.platforms = [ "x86_64-linux" ];
2021-02-17 03:18:37 +00:00
}