-
-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22882 from bjornfor/wireshark
nixos: add programs.wireshark option
- Loading branch information
Showing
3 changed files
with
45 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
with lib; | ||
|
||
let | ||
cfg = config.programs.wireshark; | ||
wireshark = cfg.package; | ||
in { | ||
options = { | ||
programs.wireshark = { | ||
enable = mkOption { | ||
type = types.bool; | ||
default = false; | ||
description = '' | ||
Whether to add Wireshark to the global environment and configure a | ||
setcap wrapper for 'dumpcap' for users in the 'wireshark' group. | ||
''; | ||
}; | ||
package = mkOption { | ||
type = types.package; | ||
default = pkgs.wireshark-cli; | ||
defaultText = "pkgs.wireshark-cli"; | ||
description = '' | ||
Which Wireshark package to install in the global environment. | ||
''; | ||
}; | ||
}; | ||
}; | ||
|
||
config = mkIf cfg.enable { | ||
environment.systemPackages = [ wireshark ]; | ||
users.extraGroups.wireshark = {}; | ||
|
||
security.wrappers.dumpcap = { | ||
source = "${wireshark}/bin/dumpcap"; | ||
capabilities = "cap_net_raw+p"; | ||
owner = "root"; | ||
group = "wireshark"; | ||
permissions = "u+rx,g+x"; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters