571c71e6f7
We are migrating packages that meet below requirements: 1. using `callPackage` 2. called path is a directory 3. overriding set is empty (`{ }`) 4. not containing path expressions other than relative path (to makenixpkgs-vet happy) 5. not referenced by nix files outside of the directory, other than`pkgs/top-level/all-packages.nix` 6. not referencing nix files outside of the directory 7. not referencing `default.nix` (since it's changed to `package.nix`) 8. `outPath` doesn't change after migration The tool is here: https://github.com/Aleksanaa/by-name-migrate.
85 lines
1.9 KiB
Nix
85 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 = "2024.06";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "hugsy";
|
|
repo = "gef";
|
|
rev = version;
|
|
sha256 = "sha256-fo8hC2T2WDcG0MQffPm2QBPR89EPiqctkUJC40PeyWg=";
|
|
};
|
|
|
|
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 ];
|
|
};
|
|
}
|