Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 84 lines 1.9 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, makeWrapper 5, gdb 6, python3 7, bintools-unwrapped 8, file 9, ps 10, git 11, coreutils 12}: 13 14let 15 pythonPath = with python3.pkgs; makePythonPath [ 16 keystone-engine 17 unicorn 18 capstone 19 ropper 20 ]; 21 22in stdenv.mkDerivation rec { 23 pname = "gef"; 24 version = "2024.06"; 25 26 src = fetchFromGitHub { 27 owner = "hugsy"; 28 repo = "gef"; 29 rev = version; 30 sha256 = "sha256-fo8hC2T2WDcG0MQffPm2QBPR89EPiqctkUJC40PeyWg="; 31 }; 32 33 dontBuild = true; 34 35 nativeBuildInputs = [ makeWrapper ]; 36 37 installPhase = '' 38 mkdir -p $out/share/gef 39 cp gef.py $out/share/gef 40 makeWrapper ${gdb}/bin/gdb $out/bin/gef \ 41 --add-flags "-q -x $out/share/gef/gef.py" \ 42 --set NIX_PYTHONPATH ${pythonPath} \ 43 --prefix PATH : ${lib.makeBinPath [ 44 python3 45 bintools-unwrapped # for readelf 46 file 47 ps 48 ]} 49 ''; 50 51 nativeCheckInputs = [ 52 gdb 53 file 54 ps 55 git 56 python3 57 python3.pkgs.pytest 58 python3.pkgs.pytest-xdist 59 python3.pkgs.keystone-engine 60 python3.pkgs.unicorn 61 python3.pkgs.capstone 62 python3.pkgs.ropper 63 ]; 64 checkPhase = '' 65 # Skip some tests that require network access. 66 sed -i '/def test_cmd_shellcode_get(self):/i \ \ \ \ @unittest.skip(reason="not available in sandbox")' tests/runtests.py 67 sed -i '/def test_cmd_shellcode_search(self):/i \ \ \ \ @unittest.skip(reason="not available in sandbox")' tests/runtests.py 68 69 # Patch the path to /bin/ls. 70 sed -i 's+/bin/ls+${coreutils}/bin/ls+g' tests/runtests.py 71 72 # Run the tests. 73 make test 74 ''; 75 76 meta = with lib; { 77 description = "Modern experience for GDB with advanced debugging features for exploit developers & reverse engineers"; 78 mainProgram = "gef"; 79 homepage = "https://github.com/hugsy/gef"; 80 license = licenses.mit; 81 platforms = platforms.all; 82 maintainers = with maintainers; [ freax13 ]; 83 }; 84}