about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/security/nmap/qt.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/security/nmap/qt.nix')
-rw-r--r--nixpkgs/pkgs/tools/security/nmap/qt.nix60
1 files changed, 60 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/security/nmap/qt.nix b/nixpkgs/pkgs/tools/security/nmap/qt.nix
new file mode 100644
index 000000000000..b4e406a0035b
--- /dev/null
+++ b/nixpkgs/pkgs/tools/security/nmap/qt.nix
@@ -0,0 +1,60 @@
+{ lib, stdenv
+, fetchFromGitHub
+, cmake
+, pkg-config
+, wrapQtAppsHook
+, dnsutils
+, nmap
+, qtbase
+, qtscript
+, qtwebengine
+}:
+
+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 wrapQtAppsHook ];
+
+  buildInputs = [ 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 = with lib; {
+    description = "Qt frontend for nmap";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ peterhoeg ];
+    inherit (src.meta) homepage;
+  };
+}