nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 clang,
6 libpcap,
7}:
8
9buildGoModule rec {
10 pname = "pwru";
11 version = "1.0.9";
12
13 src = fetchFromGitHub {
14 owner = "cilium";
15 repo = "pwru";
16 rev = "v${version}";
17 hash = "sha256-3lIKbzwPX6okJT9CeErX5/innUK3VqnnbWPpvlSN+6U=";
18 };
19
20 vendorHash = null;
21
22 nativeBuildInputs = [ clang ];
23
24 buildInputs = [ libpcap ];
25
26 postPatch = ''
27 substituteInPlace internal/libpcap/compile.go \
28 --replace "-static" ""
29 '';
30
31 # this breaks go generate as bpf does not support -fzero-call-used-regs=used-gpr
32 hardeningDisable = [ "zerocallusedregs" ];
33
34 preBuild = ''
35 TARGET_GOARCH="$GOARCH" GOOS= GOARCH= go generate
36 '';
37
38 meta = with lib; {
39 description = "eBPF-based Linux kernel networking debugger";
40 homepage = "https://github.com/cilium/pwru";
41 license = licenses.asl20;
42 maintainers = with maintainers; [ nickcao ];
43 platforms = platforms.linux;
44 mainProgram = "pwru";
45 };
46}