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