diff --git a/nix/bundle/bundle.py b/nix/bundle/bundle.py index 5a3746333..7b871a95b 100755 --- a/nix/bundle/bundle.py +++ b/nix/bundle/bundle.py @@ -377,18 +377,6 @@ def bundle_python_venv(src_lib_dir: Path, out_lib_dir: Path, root_dst: Path): '.dylib', )) - is_good_ext = src_file_path.suffix in ( - '.py', # python script file - '.pyi', '.typed', # python types - '.asm', # pwntools asm templates - ) - is_good_name = src_file_path.name in ( - '__doc__', # pwntools asm templates - ) - - if not (is_so or is_good_ext or is_good_name): - continue - real_file = copy_with_symlink_normal(src_file_path, src_lib_dir, out_lib_dir, is_so=is_so) if is_so and real_file: bundle_binaries.add(real_file) diff --git a/nix/portable.nix b/nix/portable.nix index cb97cd2ee..21821cf25 100644 --- a/nix/portable.nix +++ b/nix/portable.nix @@ -187,20 +187,25 @@ let # writable out chmod -R +w $out + # remove unneeded dirs + rm -rf $out/pwndbg/lib/pkgconfig + find $out/pwndbg/lib/${python3.libPrefix}/ -type d -name "__pycache__" -exec rm -rf {} + + find $out/pwndbg/lib/${python3.libPrefix}/ -type d -name "*.dist-info" -exec rm -rf {} + + find $out/pwndbg/lib/${python3.libPrefix}/ -maxdepth 1 -type d -name "config-*" -exec rm -rf {} + + + # EXTERNALLY-MANAGED info + echo -e "[externally-managed]\nError=This is a pwndbg-portable installation.\n Installing additional dependencies is not supported." > $out/pwndbg/lib/${python3.libPrefix}/EXTERNALLY-MANAGED + # copy extra files mkdir -p $out/pwndbg/share/ cp -rf ${lib.getLib pkgs.ncurses}/share/terminfo/ $out/pwndbg/share/ - # fix ipython autocomplete - cp -rf ${pwndbgVenv}/lib/${python3.libPrefix}/site-packages/parso/python/*.txt $out/pwndbg/lib/${python3.libPrefix}/site-packages/parso/python/ - - # fix ziglang - cp -rf ${pwndbgVenv}/lib/${python3.libPrefix}/site-packages/ziglang/zig $out/pwndbg/lib/${python3.libPrefix}/site-packages/ziglang/ - cp -rf ${pwndbgVenv}/lib/${python3.libPrefix}/site-packages/ziglang/lib $out/pwndbg/lib/${python3.libPrefix}/site-packages/ziglang/ - # fix python "subprocess.py" to use "/bin/sh" and not the nix'ed version, otherwise "gdb-pt-dump" is broken sed -i 's@/nix/store/.*/bin/sh@/bin/sh@' $out/pwndbg/lib/${python3.libPrefix}/subprocess.py + # remove /nix/store references in all files + find $out/pwndbg/ -type f -exec ${pkgsNative.nukeReferences}/bin/nuke-refs {} + + # build pycache SOURCE_DATE_EPOCH=0 ${pkgsNative.python3}/bin/python3 -c "import compileall; compileall.compile_dir('$out', stripdir='$out', force=True);" '';