Hi guixers,

I created a package definition for nethogs.

It's a kind of top for network usage.

Comments are appreciated.

Cheers,

Rai
>From 87bd3bdfccdd686fd06e30c1a100d1aca3911b9f Mon Sep 17 00:00:00 2001
From: Raimon Grau <rai...@3scale.net>
Date: Thu, 10 Mar 2016 12:27:45 +0000
Subject: [PATCH] gnu: Add nethogs 0.8.1.

* gnu/packages/networking.scm (nethogs): New variable.
---
 gnu/packages/networking.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 49403c1..3731da7 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -25,6 +25,7 @@
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages admin)
   #:use-module (gnu packages ncurses))
 
 (define-public miredo
@@ -210,3 +211,37 @@ two graphs and provides additional info like total amount of transfered data
 and min/max network usage.")
     (license license:gpl2)))
 
+(define-public nethogs
+  (package
+    (name "nethogs")
+    (version "0.8.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/raboof/nethogs/archive/v";
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "0hnz4h2zwfyfn62i0hjsiii0izvjxfa1myq1bd59fja5h51yyc2c"))))
+    (build-system gnu-build-system)
+    (inputs `(("ncurses" ,ncurses)
+              ("libpcap" ,libpcap)))
+    (arguments
+     '(#:tests? #f                                ; no "check" target
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)             ; no configure script
+         (add-before
+          'build 'fix-prefix-path
+          (lambda _
+            (substitute* "Makefile"
+              (("^prefix := /usr/local")
+               (string-append "prefix := " (assoc-ref %outputs "out"))))))
+       #:make-flags `("CC=gcc" ,(string-append "PREFIX="
+                                               (assoc-ref %outputs "out")))))
+    (home-page "http://raboof.github.io/nethogs/";)
+    (synopsis "Net top tool grouping bandwidth per process")
+    (description
+     "NetHogs is a small 'net top' tool.  Instead of breaking the traffic down
+per protocol or per subnet, like most tools do, it groups bandwidth by
+process. NetHogs does not rely on a special kernel module to be loaded.")
+    (license license:gpl2))))
-- 
2.6.3

Reply via email to