push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.wireshark;
wireshark = cfg.package;
in
{
options = {
programs.wireshark = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to add Wireshark to the global environment and create a 'wireshark'
group. To configure what users can capture, set the `dumpcap.enable` and
`usbmon.enable` options. By default, users in the 'wireshark' group are
allowed to capture network traffic but not USB traffic.
'';
};
package = lib.mkPackageOption pkgs "wireshark-cli" {
example = "wireshark";
};
dumpcap.enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Whether to allow users in the 'wireshark' group to capture network traffic. This
configures a setcap wrapper for 'dumpcap' for users in the 'wireshark' group.
'';
};
usbmon.enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Whether to allow users in the 'wireshark' group to capture USB traffic. This adds
udev rules to give users in the 'wireshark' group read permissions to all devices
in the usbmon subsystem.
'';
};
};
};
config = lib.mkIf cfg.enable {
environment.systemPackages = [ wireshark ];
users.groups.wireshark = { };
security.wrappers.dumpcap = lib.mkIf cfg.dumpcap.enable {
source = "${wireshark}/bin/dumpcap";
capabilities = "cap_net_raw,cap_net_admin+eip";
owner = "root";
group = "wireshark";
permissions = "u+rx,g+x";
};
services.udev.packages = lib.mkIf cfg.usbmon.enable [
(pkgs.writeTextDir "etc/udev/rules.d/85-wireshark-usbmon.rules" ''
SUBSYSTEM=="usbmon", MODE="0640", GROUP="wireshark"
'')
];
};
}