about summary refs log tree commit diff
path: root/pkgs/by-name/nm/nmapsi4/package.nix
blob: a9574b4baa0124cf66fcd630ff64fafae3bebbc8 (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
{
  lib,
  stdenv,
  fetchFromGitHub,
  cmake,
  pkg-config,
  dnsutils,
  nmap,
  libsForQt5,
}:

stdenv.mkDerivation rec {
  pname = "nmapsi4";
  version = "0.5-alpha2";

  src = fetchFromGitHub {
    owner = "nmapsi4";
    repo = "nmapsi4";
    rev = "v${version}";
    sha256 = "sha256-q3XfwJ4TGK4E58haN0Q0xRH4GDpKD8VZzyxHe/VwBqY=";
  };

  nativeBuildInputs = [
    cmake
    pkg-config
    libsForQt5.wrapQtAppsHook
  ];

  buildInputs = with libsForQt5; [
    qtbase
    qtscript
    qtwebengine
  ];

  postPatch = ''
    substituteInPlace src/platform/digmanager.cpp \
      --replace '"dig"' '"${dnsutils}/bin/dig"'
    substituteInPlace src/platform/discover.cpp \
        --replace '"nping"' '"${nmap}/bin/nping"'
    for f in \
      src/platform/monitor/monitor.cpp \
      src/platform/nsemanager.cpp ; do

      substituteInPlace $f \
        --replace '"nmap"'  '"${nmap}/bin/nmap"'
    done
  '';

  postInstall = ''
    mv $out/share/applications/kde4/*.desktop $out/share/applications
    rmdir $out/share/applications/kde4

    for f in $out/share/applications/* ; do
      substituteInPlace $f \
        --replace Qt4                   Qt5 \
        --replace Exec=nmapsi4          Exec=$out/bin/nmapsi4 \
        --replace "Exec=kdesu nmapsi4" "Exec=kdesu $out/bin/nmapsi4"
    done
  '';

  meta = {
    description = "Qt frontend for nmap";
    mainProgram = "nmapsi4";
    license = lib.licenses.gpl2Plus;
    maintainers = with lib.maintainers; [ peterhoeg ];
    inherit (src.meta) homepage;
  };
}