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