summary refs log tree commit diff
path: root/pkgs/applications/networking/ostinato/default.nix
blob: b3ff51ab7c190d61aeb5489c55253f2bd87b1fd9 (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{ lib, mkDerivation, fetchFromGitHub, fetchurl, qmake, makeDesktopItem
, qtbase, qtscript, protobuf, libpcap, wireshark, gzip, diffutils, gawk
, libnl
, copyDesktopItems
}:

mkDerivation rec {
  pname = "ostinato";
  version = "1.1";

  src = fetchFromGitHub  {
    owner  = "pstavirs";
    repo   = "ostinato";
    rev    = "v${version}";
    sha256 = "0B3jOj5rA3/rD2gXS2praZImeP34zN06fOPy/IswXOg=";
  };

  ostinatoIcon = fetchurl {
    url = "https://ostinato.org/images/site-logo.png";
    sha256 = "f5c067823f2934e4d358d76f65a343efd69ad783a7aeabd7ab4ce3cd03490d70";
  };

  buildInputs = [ qtbase protobuf libpcap qtscript libnl ];

  nativeBuildInputs = [
    copyDesktopItems
    qmake
  ];

  patches = [ ./drone_ini.patch ];
  prePatch = ''
    sed -i 's|/usr/include/libnl3|${libnl.dev}/include/libnl3|' server/drone.pro
  '';

  desktopItems = lib.singleton (makeDesktopItem {
    name          = "ostinato";
    desktopName   = "Ostinato";
    genericName   = "Packet/Traffic Generator and Analyzer";
    comment       = "Network packet and traffic generator and analyzer with a friendly GUI";
    categories    = [ "Network" ];
    startupNotify = true;
    exec          = "@out@/bin/ostinato";
    icon          =  ostinatoIcon;
    extraConfig   = {
      "GenericName[it]" = "Generatore ed Analizzatore di pacchetti di rete";
      "Comment[it]"     = "Generatore ed Analizzatore di pacchetti di rete con interfaccia amichevole";
    };
  });

  preFixup = ''
    substituteInPlace $out/share/applications/ostinato.desktop \
      --subst-var out

    cat > $out/bin/ostinato.ini <<EOF
    WiresharkPath=${wireshark}/bin/wireshark
    TsharkPath=${wireshark}/bin/tshark
    GzipPath=${gzip}/bin/gzip
    DiffPath=${diffutils}/bin/diff
    AwkPath=${gawk}/bin/awk
    EOF
  '';

  # `cd common; qmake ostproto.pro; make pdmlreader.o`:
  # pdmlprotocol.h:23:25: fatal error: protocol.pb.h: No such file or directory
  enableParallelBuilding = false;

  meta = with lib; {
    description = "A packet traffic generator and analyzer";
    homepage    = "https://ostinato.org/";
    license     = licenses.gpl3Plus;
    maintainers = with maintainers; [ rick68 ];
    platforms   = with platforms; linux ++ darwin ++ cygwin;
  };
}