2019-12-30 11:58:58 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2019-12-31 08:17:28 +00:00
|
|
|
let cfg = config.programs.bandwhich;
|
2019-12-30 11:58:58 +00:00
|
|
|
in {
|
2020-11-17 11:02:06 +00:00
|
|
|
meta.maintainers = with maintainers; [ Br1ght0ne ];
|
2019-12-30 11:58:58 +00:00
|
|
|
|
|
|
|
options = {
|
2019-12-31 08:17:28 +00:00
|
|
|
programs.bandwhich = {
|
2019-12-30 11:58:58 +00:00
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
|
|
|
description = lib.mdDoc ''
|
2019-12-31 08:17:28 +00:00
|
|
|
Whether to add bandwhich to the global environment and configure a
|
2019-12-30 11:58:58 +00:00
|
|
|
setcap wrapper for it.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2019-12-31 08:17:28 +00:00
|
|
|
environment.systemPackages = with pkgs; [ bandwhich ];
|
|
|
|
security.wrappers.bandwhich = {
|
2021-09-12 16:53:48 +00:00
|
|
|
owner = "root";
|
|
|
|
group = "root";
|
2019-12-30 11:58:58 +00:00
|
|
|
capabilities = "cap_net_raw,cap_net_admin+ep";
|
2021-09-12 16:53:48 +00:00
|
|
|
source = "${pkgs.bandwhich}/bin/bandwhich";
|
2019-12-30 11:58:58 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|