nixos/mtr: make the package configurable

This commit is contained in:
Peter Hoeg 2019-08-05 17:42:17 +08:00
parent 49e61479d4
commit 968d4643b0

View File

@ -4,6 +4,7 @@ with lib;
let let
cfg = config.programs.mtr; cfg = config.programs.mtr;
in { in {
options = { options = {
programs.mtr = { programs.mtr = {
@ -15,13 +16,22 @@ in {
setcap wrapper for it. setcap wrapper for it.
''; '';
}; };
package = mkOption {
type = types.package;
default = pkgs.mtr;
description = ''
The package to use.
'';
};
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ mtr ]; environment.systemPackages = with pkgs; [ cfg.package ];
security.wrappers.mtr-packet = { security.wrappers.mtr-packet = {
source = "${pkgs.mtr}/bin/mtr-packet"; source = "${cfg.package}/bin/mtr-packet";
capabilities = "cap_net_raw+p"; capabilities = "cap_net_raw+p";
}; };
}; };