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