nixpkgs-suyu/nixos/modules/programs/wireshark.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

43 lines
1 KiB
Nix
Raw Normal View History

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.programs.wireshark;
wireshark = cfg.package;
2017-02-17 13:15:59 +01:00
in {
options = {
programs.wireshark = {
enable = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
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.
'';
};
package = mkOption {
type = types.package;
default = pkgs.wireshark-cli;
defaultText = literalExpression "pkgs.wireshark-cli";
description = lib.mdDoc ''
Which Wireshark package to install in the global environment.
'';
};
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ wireshark ];
users.groups.wireshark = {};
2017-02-17 13:15:59 +01:00
security.wrappers.dumpcap = {
source = "${wireshark}/bin/dumpcap";
2017-02-17 13:15:59 +01:00
capabilities = "cap_net_raw+p";
owner = "root";
group = "wireshark";
permissions = "u+rx,g+x";
};
};
}