nixpkgs/pkgs/by-name/ge/gef/package.nix
Winter a19cd4ffb1 Revert "treewide: replace rev with tag"
This reverts commit 65a333600d5c88a98d674f637d092807cfc12253.

This wasn't tested for correctness with something like fodwatch [0],
and should not have been (self-)merged so quickly, especially without
further review.

It also resulted in the breakage of at least one package [1] (and that's
the one we know of and was caught).

A few packages that were updated in between this commit and this revert
were not reverted back to using `rev`, but other than that, this is a
1:1 revert.

[0]: https://codeberg.org/raphaelr/fodwatch
[1]: https://github.com/NixOS/nixpkgs/pull/396904 / 758551e4587d75882aebc21a04bee960418f8ce9
2025-04-08 02:57:25 -04:00

91 lines
1.9 KiB
Nix

{
lib,
stdenv,
fetchFromGitHub,
makeWrapper,
gdb,
python3,
bintools-unwrapped,
file,
ps,
git,
coreutils,
}:
let
pythonPath =
with python3.pkgs;
makePythonPath [
keystone-engine
unicorn
capstone
ropper
];
in
stdenv.mkDerivation rec {
pname = "gef";
version = "2025.01";
src = fetchFromGitHub {
owner = "hugsy";
repo = "gef";
rev = version;
sha256 = "sha256-JM9zH1wWEdjpBafnxMIFtePjXWf3UOXhBSWZCXEOzKw=";
};
dontBuild = true;
nativeBuildInputs = [ makeWrapper ];
installPhase = ''
mkdir -p $out/share/gef
cp gef.py $out/share/gef
makeWrapper ${gdb}/bin/gdb $out/bin/gef \
--add-flags "-q -x $out/share/gef/gef.py" \
--set NIX_PYTHONPATH ${pythonPath} \
--prefix PATH : ${
lib.makeBinPath [
python3
bintools-unwrapped # for readelf
file
ps
]
}
'';
nativeCheckInputs = [
gdb
file
ps
git
python3
python3.pkgs.pytest
python3.pkgs.pytest-xdist
python3.pkgs.keystone-engine
python3.pkgs.unicorn
python3.pkgs.capstone
python3.pkgs.ropper
];
checkPhase = ''
# Skip some tests that require network access.
sed -i '/def test_cmd_shellcode_get(self):/i \ \ \ \ @unittest.skip(reason="not available in sandbox")' tests/runtests.py
sed -i '/def test_cmd_shellcode_search(self):/i \ \ \ \ @unittest.skip(reason="not available in sandbox")' tests/runtests.py
# Patch the path to /bin/ls.
sed -i 's+/bin/ls+${coreutils}/bin/ls+g' tests/runtests.py
# Run the tests.
make test
'';
meta = with lib; {
description = "Modern experience for GDB with advanced debugging features for exploit developers & reverse engineers";
mainProgram = "gef";
homepage = "https://github.com/hugsy/gef";
license = licenses.mit;
platforms = platforms.all;
maintainers = with maintainers; [ freax13 ];
};
}