Change:
Describe the bug fails to run because setuptools is no longer propagated implictly. If were purely a python application built with then we would just need to add to propagatedBuildInputs and be done. However, is not simply a Python application, but a wrapper around , and isn't built using. The derivation patches the script as follows: This does result in the site-packages directories from all python packages ending up in , including setuptools (e.g. ). I'm not that familiar with Python packaging but from experimenting I found that the full path to the Python egg needs to be included (e.g. ) in order for this method to work. I made an attempt at resolving the issue but being new to Python packaging in Nix, neither are likely to be ideal: We could use buildPythonPackage in place of mkDerivation, using and use Or continue to use mkDerivation and manually set for patchPythonScript: I'm happy to submit a PR but I'm not sure what the recommended solution is here. To Reproduce Steps to reproduce the behavior: Expected behavior should launch with the extension loaded: Metadata system: host os: multi-user?: sandbox: version: nixpkgs: Maintainer information:
It seems is normally used by adding a to , or calling with (what the wrapper registered in does). This script then just does some addition calculations to register itself (we probably don't that at all) and some python 2 specific fixups, and then calls , which starts executing some code on import. I'd suggest to package it as a regular python application first (via ), so you can successfully import it inside a . The python tooling should automatically take care of patching the python shebang properly if you make script executable.
proposed fix

Discussion:
, buildPythonPackage , fetchPypi , fetchpatch <ins> , setuptools </ins> }: buildPythonPackage rec {

sha256 = "3c0f73db9f8392f7048c8a244809f154d7c39f354e2167f6c477630aa517ed04"; }; <ins> propagatedBuildInputs = [ setuptools ]; </ins> patches = [ (fetchpatch { stripLen = 2;

{ stdenv <ins> , python3 </ins> , fetchFromGitHub , makeWrapper , gdb <del> , future , isort , psutil , pycparser , pyelftools , python-ptrace , ROPGadget , six , unicorn , pygments , }: </del> <ins> }: </ins> <del> stdenv.mkDerivation rec { pname = "pwndbg"; version = "2019.01.25"; src = fetchFromGitHub { owner = "pwndbg"; repo = "pwndbg"; rev = version; sha256 = "0k7n6pcrj62ccag801yzf04a9mj9znghpkbnqwrzz0qn3rs42vgs"; }; nativeBuildInputs = [ makeWrapper ]; propagatedBuildInputs = [ </del> <ins> let pythonPath = with python3.pkgs; makePythonPath [ </ins> future isort psutil

pygments ]; <ins> in stdenv.mkDerivation rec { pname = "pwndbg"; version = "2019.01.25"; format = "other"; src = fetchFromGitHub { owner = "pwndbg"; repo = "pwndbg"; rev = version; sha256 = "0k7n6pcrj62ccag801yzf04a9mj9znghpkbnqwrzz0qn3rs42vgs"; }; nativeBuildInputs = [ makeWrapper ]; </ins> installPhase = '' mkdir -p $out/share/pwndbg cp -r *.py pwndbg $out/share/pwndbg <ins> chmod +x $out/share/pwndbg/gdbinit.py </ins> makeWrapper ${gdb}/bin/gdb $out/bin/pwndbg  <del> --add-flags "-q -x $out/share/pwndbg/gdbinit.py" ''; preFixup = '' sed -i "/import sys/a import sys; sys.path[0:0] = '$PYTHONPATH'.split(':')"  $out/share/pwndbg/gdbinit.py </del> <ins> --add-flags "-q -x $out/share/pwndbg/gdbinit.py"  --set NIX_PYTHONPATH ${pythonPath} </ins> ''; meta = with stdenv.lib; {

pwnat = callPackage ../tools/networking/pwnat { }; <del> pwndbg = python3Packages.callPackage ../development/tools/misc/pwndbg { }; </del> <ins> pwndbg = callPackage ../development/tools/misc/pwndbg { }; </ins> pycangjie = pythonPackages.pycangjie;