summary refs log tree commit diff
path: root/pkgs/applications/networking/sniffers/wireshark/default.nix
diff options
context:
space:
mode:
authorBjørn Forsman <bjorn.forsman@gmail.com>2014-09-19 18:49:08 +0200
committerBjørn Forsman <bjorn.forsman@gmail.com>2014-09-20 13:28:46 +0200
commit8983b60f87d64745867c5051f655e9708ed2a3ce (patch)
tree0d3363b77bd2870bfd1456cb718f9647b8f30876 /pkgs/applications/networking/sniffers/wireshark/default.nix
parent1daa2e5a7e853b1e4855dd937a44707a85ea9c7a (diff)
downloadnixpkgs-8983b60f87d64745867c5051f655e9708ed2a3ce.tar
nixpkgs-8983b60f87d64745867c5051f655e9708ed2a3ce.tar.gz
nixpkgs-8983b60f87d64745867c5051f655e9708ed2a3ce.tar.bz2
nixpkgs-8983b60f87d64745867c5051f655e9708ed2a3ce.tar.lz
nixpkgs-8983b60f87d64745867c5051f655e9708ed2a3ce.tar.xz
nixpkgs-8983b60f87d64745867c5051f655e9708ed2a3ce.tar.zst
nixpkgs-8983b60f87d64745867c5051f655e9708ed2a3ce.zip
wireshark: add CLI and Qt versions
In addition to our existing GTK version.

* Only install desktop file if building a GUI version.
* The Qt build appends "-qt" to the
  wireshark binary name. Undo it so the desktop file works.
* The 'wireshark' attribute still refers to the GTK version, for
  backwards compatibility.
Diffstat (limited to 'pkgs/applications/networking/sniffers/wireshark/default.nix')
-rw-r--r--pkgs/applications/networking/sniffers/wireshark/default.nix33
1 files changed, 25 insertions, 8 deletions
diff --git a/pkgs/applications/networking/sniffers/wireshark/default.nix b/pkgs/applications/networking/sniffers/wireshark/default.nix
index af1b39170f8..69f0ff5301a 100644
--- a/pkgs/applications/networking/sniffers/wireshark/default.nix
+++ b/pkgs/applications/networking/sniffers/wireshark/default.nix
@@ -1,12 +1,21 @@
 { stdenv, fetchurl, pkgconfig, perl, flex, bison, libpcap, libnl, c-ares
-, gnutls, libgcrypt, geoip, heimdal, lua5, gtk, makeDesktopItem, python
-, libcap
+, gnutls, libgcrypt, geoip, heimdal, lua5, makeDesktopItem, python, libcap, glib
+, withGtk ? false, gtk ? null
+, withQt ? false, qt4 ? null
 }:
 
-let version = "1.12.1"; in
+assert withGtk -> !withQt && gtk != null;
+assert withQt -> !withGtk && qt4 != null;
+
+with stdenv.lib;
+
+let
+  version = "1.12.1";
+  variant = if withGtk then "gtk" else if withQt then "qt" else "cli";
+in
 
 stdenv.mkDerivation {
-  name = "wireshark-${version}";
+  name = "wireshark-${variant}-${version}";
 
   src = fetchurl {
     url = "http://www.wireshark.org/download/src/wireshark-${version}.tar.bz2";
@@ -15,12 +24,18 @@ stdenv.mkDerivation {
 
   buildInputs = [
     bison flex perl pkgconfig libpcap lua5 heimdal libgcrypt gnutls
-    geoip libnl c-ares gtk python libcap
-  ];
+    geoip libnl c-ares python libcap glib
+  ] ++ optional withQt qt4
+    ++ optional withGtk gtk;
 
   patches = [ ./wireshark-lookup-dumpcap-in-path.patch ];
 
-  configureFlags = "--disable-usr-local --disable-silent-rules --with-gtk2 --without-gtk3 --without-qt --with-ssl";
+  configureFlags = "--disable-usr-local --disable-silent-rules --with-ssl"
+    + (if withGtk then
+         " --with-gtk2 --without-gtk3 --without-qt"
+       else if withQt then
+         " --without-gtk2 --without-gtk3 --with-qt"
+       else " --disable-wireshark");
 
   desktopItem = makeDesktopItem {
     name = "Wireshark";
@@ -32,11 +47,13 @@ stdenv.mkDerivation {
     categories = "Network;System";
   };
 
-  postInstall = ''
+  postInstall = optionalString (withQt || withGtk) ''
     mkdir -p "$out"/share/applications/
     mkdir -p "$out"/share/icons/
     cp "$desktopItem/share/applications/"* "$out/share/applications/"
     cp image/wsicon.svg "$out"/share/icons/wireshark.svg
+  '' + optionalString withQt ''
+    mv "$out/bin/wireshark-qt" "$out/bin/wireshark"
   '';
 
   enableParallelBuilding = true;