2017-02-16 21:53:09 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.programs.wireshark;
|
|
|
|
wireshark = cfg.package;
|
2017-02-17 13:15:59 +01:00
|
|
|
in {
|
2017-02-16 21:53:09 +01:00
|
|
|
options = {
|
|
|
|
programs.wireshark = {
|
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2022-07-28 23:19:15 +02:00
|
|
|
description = lib.mdDoc ''
|
2017-02-16 21:53:09 +01:00
|
|
|
Whether to add Wireshark to the global environment and configure a
|
2017-02-17 13:15:59 +01:00
|
|
|
setcap wrapper for 'dumpcap' for users in the 'wireshark' group.
|
2017-02-16 21:53:09 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.wireshark-cli;
|
2021-10-03 18:06:03 +02:00
|
|
|
defaultText = literalExpression "pkgs.wireshark-cli";
|
2022-07-28 23:19:15 +02:00
|
|
|
description = lib.mdDoc ''
|
2017-02-16 21:53:09 +01:00
|
|
|
Which Wireshark package to install in the global environment.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
environment.systemPackages = [ wireshark ];
|
2018-06-30 01:58:35 +02:00
|
|
|
users.groups.wireshark = {};
|
2017-02-17 13:15:59 +01:00
|
|
|
|
2017-02-16 21:53:09 +01:00
|
|
|
security.wrappers.dumpcap = {
|
|
|
|
source = "${wireshark}/bin/dumpcap";
|
2017-02-17 13:15:59 +01:00
|
|
|
capabilities = "cap_net_raw+p";
|
2017-02-16 21:53:09 +01:00
|
|
|
owner = "root";
|
|
|
|
group = "wireshark";
|
|
|
|
permissions = "u+rx,g+x";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|