Merge pull request #22882 from bjornfor/wireshark
nixos: add programs.wireshark option
This commit is contained in:
commit
12b4556642
@ -93,6 +93,7 @@
|
|||||||
./programs/tmux.nix
|
./programs/tmux.nix
|
||||||
./programs/venus.nix
|
./programs/venus.nix
|
||||||
./programs/vim.nix
|
./programs/vim.nix
|
||||||
|
./programs/wireshark.nix
|
||||||
./programs/wvdial.nix
|
./programs/wvdial.nix
|
||||||
./programs/xfs_quota.nix
|
./programs/xfs_quota.nix
|
||||||
./programs/xonsh.nix
|
./programs/xonsh.nix
|
||||||
|
42
nixos/modules/programs/wireshark.nix
Normal file
42
nixos/modules/programs/wireshark.nix
Normal file
@ -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";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
@ -28,6 +28,7 @@ let
|
|||||||
, source
|
, source
|
||||||
, owner ? "nobody"
|
, owner ? "nobody"
|
||||||
, group ? "nogroup"
|
, group ? "nogroup"
|
||||||
|
, permissions ? "u+rx,g+x,o+x"
|
||||||
, ...
|
, ...
|
||||||
}:
|
}:
|
||||||
assert (lib.versionAtLeast (lib.getVersion config.boot.kernelPackages.kernel) "4.3");
|
assert (lib.versionAtLeast (lib.getVersion config.boot.kernelPackages.kernel) "4.3");
|
||||||
@ -45,7 +46,7 @@ let
|
|||||||
${pkgs.libcap.out}/bin/setcap "cap_setpcap,${capabilities}" $wrapperDir/${program}
|
${pkgs.libcap.out}/bin/setcap "cap_setpcap,${capabilities}" $wrapperDir/${program}
|
||||||
|
|
||||||
# Set the executable bit
|
# Set the executable bit
|
||||||
chmod u+rx,g+x,o+x $wrapperDir/${program}
|
chmod ${permissions} $wrapperDir/${program}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
###### Activation script for the setuid wrappers
|
###### Activation script for the setuid wrappers
|
||||||
|
Loading…
x
Reference in New Issue
Block a user