Skip to content

Commit

Permalink
Merge pull request #68507 from peterhoeg/f/mtr
Browse files Browse the repository at this point in the history
nixos/mtr: support for selecting the package
  • Loading branch information
Ma27 committed Sep 12, 2019
2 parents 4bb6905 + 968d464 commit 99b291c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
14 changes: 12 additions & 2 deletions nixos/modules/programs/mtr.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ with lib;

let
cfg = config.programs.mtr;

in {
options = {
programs.mtr = {
Expand All @@ -15,13 +16,22 @@ in {
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; [ mtr ];
environment.systemPackages = with pkgs; [ cfg.package ];

security.wrappers.mtr-packet = {
source = "${pkgs.mtr}/bin/mtr-packet";
source = "${cfg.package}/bin/mtr-packet";
capabilities = "cap_net_raw+p";
};
};
Expand Down
4 changes: 2 additions & 2 deletions pkgs/tools/networking/mtr/default.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{ stdenv, fetchFromGitHub, autoreconfHook, pkgconfig
{ stdenv, lib, fetchFromGitHub, autoreconfHook, pkgconfig
, libcap, ncurses
, withGtk ? false, gtk2 ? null }:

assert withGtk -> gtk2 != null;

stdenv.mkDerivation rec {
pname = "mtr";
pname = "mtr${lib.optionalString withGtk "-gui"}";
version = "0.93";

src = fetchFromGitHub {
Expand Down
2 changes: 2 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4860,6 +4860,8 @@ in

mtr = callPackage ../tools/networking/mtr {};

mtr-gui = callPackage ../tools/networking/mtr { withGtk = true; };

mtx = callPackage ../tools/backup/mtx {};

mt-st = callPackage ../tools/backup/mt-st {};
Expand Down

0 comments on commit 99b291c

Please sign in to comment.