about summary refs log tree commit diff
path: root/pkgs/by-name/pw/pwru/package.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/by-name/pw/pwru/package.nix')
-rw-r--r--pkgs/by-name/pw/pwru/package.nix42
1 files changed, 42 insertions, 0 deletions
diff --git a/pkgs/by-name/pw/pwru/package.nix b/pkgs/by-name/pw/pwru/package.nix
new file mode 100644
index 0000000000000..d8dca376fc3ba
--- /dev/null
+++ b/pkgs/by-name/pw/pwru/package.nix
@@ -0,0 +1,42 @@
+{ lib
+, buildGoModule
+, fetchFromGitHub
+, clang
+, libpcap
+}:
+
+buildGoModule rec {
+  pname = "pwru";
+  version = "1.0.5";
+
+  src = fetchFromGitHub {
+    owner = "cilium";
+    repo = "pwru";
+    rev = "v${version}";
+    hash = "sha256-2CpjTVBuiGU5cYkdSIxIpk1EoZAUhlXxVU+KJXHosiA=";
+  };
+
+  vendorHash = null;
+
+  nativeBuildInputs = [ clang ];
+
+  buildInputs = [ libpcap ];
+
+  postPatch = ''
+    substituteInPlace internal/libpcap/compile.go \
+      --replace "-static" ""
+  '';
+
+  preBuild = ''
+    TARGET_GOARCH="$GOARCH" GOOS= GOARCH= go generate
+  '';
+
+  meta = with lib; {
+    description = "eBPF-based Linux kernel networking debugger";
+    homepage = "https://github.com/cilium/pwru";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ nickcao ];
+    platforms = platforms.linux;
+    mainProgram = "pwru";
+  };
+}