summary refs log tree commit diff
path: root/pkgs/tools/networking/nethoscope/default.nix
blob: 478220210b3d887ec1de7704d59b3d47e61b7c1c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
{ lib
, rustPlatform
, fetchFromGitHub
, pkg-config
, alsa-lib
, libpcap
, expect
}:

rustPlatform.buildRustPackage rec {
  pname = "nethoscope";
  version = "0.1.1";

  src = fetchFromGitHub {
    owner = "vvilhonen";
    repo = "nethoscope";
    rev = "v${version}";
    hash = "sha256-v7GO+d4b0N3heN10+WSUJEpcShKmx4BPR1FyZoELWzc=";
  };

  cargoHash = "sha256-0yLMscmjHeU8dRDzx3kgniCRsekg9ZJWdN13hyqJgDI=";

  nativeBuildInputs = [
    pkg-config
  ];
  buildInputs = [
    alsa-lib
    libpcap
  ];

  LD_LIBRARY_PATH = lib.makeLibraryPath [
    libpcap
    alsa-lib
  ];

  doInstallCheck = true;
  installCheckPhase = ''
    if [[ "$(${expect}/bin/unbuffer "$out/bin/${pname}" --help 2> /dev/null | strings | grep ${version} | tr -d '\n')" == " ${version}" ]]; then
      echo '${pname} smoke check passed'
    else
      echo '${pname} smoke check failed'
      return 1
    fi
  '';

  meta = with lib; {
    description = "Listen to your network traffic";
    longDescription = ''
      Employ your built-in wetware pattern recognition and
      signal processing facilities to understand your network traffic.
    '';
    homepage = "https://github.com/vvilhonen/nethoscope";
    license = licenses.isc;
    maintainers = with maintainers; [ _0x4A6F ];
    platforms = platforms.linux;
  };

}