nixpkgs icon indicating copy to clipboard operation
nixpkgs copied to clipboard

Package request: nicstat

Open juliusrickert opened this issue 1 year ago • 1 comments

Project description

nicstat is a tool similar to iostat, but for network interfaces. Originally written by Brendan Gregg for Solaris. Ported to Linux by Tim Cook.

Metadata

  • homepage URL: https://nicstat.sourceforge.io/
  • source URL: https://github.com/scotte/nicstat (There may be better-suited sources. This one's been updated after the SourceForge version.)
  • license: Artistic License 2.0
  • platforms: Linux

Add a :+1: reaction to issues you find important.

juliusrickert avatar Jul 02 '24 14:07 juliusrickert

Hey. I remember this tool from Solaris so gave it a shot. It's trivial to build if you ignore their build system and just compile it manually.

I don't want to PR and maintain this myself so here's the code. Feel free to go through the process of submitting it yourself if you so desire.

pkgs/by-name/ni/nicstat/package.nix

{ lib
, stdenv
, fetchFromGitHub
}:

stdenv.mkDerivation rec {
  pname = "nicstat";
  version = "unstable-2018-05-09";

  src = fetchFromGitHub {
    owner = "scotte";
    repo = "nicstat";
    rev = "1fbe28198b49a2062b0c928554f93db33cb288c3";
    hash = "sha256-7+11K9636dGeW0HaaH6OJF5Wy4CXYXfoaZOVfhHK6kg=";
  };

  buildPhase = ''
    runHook preBuild

    $CC -O2 nicstat.c -o nicstat

    runHook postBuild
  '';

  installPhase = ''
    runHook preInstall

    install -d "$out/bin"
    install -m 755 nicstat "$out/bin"

    install -d "$out/share/man/man1"
    install -m 644 nicstat.1 "$out/share/man/man1"

    runHook postInstall
  '';

  meta = with lib; {
    description = "Network traffic statistics utility for Solaris and Linux";
    homepage = "https://github.com/scotte/nicstat";
    changelog = "https://github.com/scotte/nicstat/blob/${src.rev}/ChangeLog.txt";
    license = licenses.artistic2;
    maintainers = with maintainers; [ ];
    mainProgram = "nicstat";
    platforms = platforms.linux;
  };
}

okvik avatar Jul 03 '24 21:07 okvik

Thank you very much, @okvik.

I don't want to PR and maintain this myself so here's the code.

You can probably open a PR without a maintainer, but you can add me as the maintainer if you want.

juliusrickert avatar Jul 03 '24 21:07 juliusrickert

Ok. I added you as the maintainer.

okvik avatar Jul 03 '24 21:07 okvik