1{ config, lib, pkgs, ... }:
2
3let cfg = config.programs.nethoscope;
4in
5{
6 meta.maintainers = with lib.maintainers; [ _0x4A6F ];
7
8 options = {
9 programs.nethoscope = {
10 enable = lib.mkOption {
11 type = lib.types.bool;
12 default = false;
13 description = ''
14 Whether to add nethoscope to the global environment and configure a
15 setcap wrapper for it.
16 '';
17 };
18 };
19 };
20
21 config = lib.mkIf cfg.enable {
22 environment.systemPackages = with pkgs; [ nethoscope ];
23 security.wrappers.nethoscope = {
24 source = "${pkgs.nethoscope}/bin/nethoscope";
25 capabilities = "cap_net_raw,cap_net_admin=eip";
26 };
27 };
28}