aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/nixos/modules/programs/mtr.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/nixos/modules/programs/mtr.nix')
-rw-r--r--nixpkgs/nixos/modules/programs/mtr.nix38
1 files changed, 38 insertions, 0 deletions
diff --git a/nixpkgs/nixos/modules/programs/mtr.nix b/nixpkgs/nixos/modules/programs/mtr.nix
new file mode 100644
index 00000000000..75b710c1584
--- /dev/null
+++ b/nixpkgs/nixos/modules/programs/mtr.nix
@@ -0,0 +1,38 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+ cfg = config.programs.mtr;
+
+in {
+ options = {
+ programs.mtr = {
+ enable = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Whether to add mtr to the global environment and configure a
+ setcap wrapper for it.
+ '';
+ };
+
+ package = mkOption {
+ type = types.package;
+ default = pkgs.mtr;
+ description = ''
+ The package to use.
+ '';
+ };
+ };
+ };
+
+ config = mkIf cfg.enable {
+ environment.systemPackages = with pkgs; [ cfg.package ];
+
+ security.wrappers.mtr-packet = {
+ source = "${cfg.package}/bin/mtr-packet";
+ capabilities = "cap_net_raw+p";
+ };
+ };
+}