You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pwndbg/nix/bundle/default.nix

38 lines
818 B
Nix

{
pkgs,
}:
paths:
# Original file copied from https://github.com/3noch/nix-bundle-exe
# But it was modified/patched for pwndbg usecase!
# May be:
# 1) a derivation,
# 2) a path to a directory containing bin/, or
# 3) a path to an executable.
let
deps =
if pkgs.stdenv.isDarwin then
[
pkgs.darwin.cctools
pkgs.darwin.binutils
pkgs.darwin.sigtool
]
else if pkgs.stdenv.isLinux then
[
pkgs.patchelf
]
else
throw "Unsupported platform: only darwin and linux are supported";
in
pkgs.runCommand "pwndbg-bundler"
{
nativeBuildInputs = deps ++ [
pkgs.nukeReferences
pkgs.python3
];
}
''
set -euo pipefail
python3 ${./bundle.py} "$out" ${pkgs.lib.escapeShellArgs paths}
find $out -empty -type d -delete
''