1{
2 config,
3 lib,
4 pkgs,
5 ...
6}:
7
8let
9 cfg = config.programs.bandwhich;
10in
11{
12 meta.maintainers = with lib.maintainers; [ Br1ght0ne ];
13
14 options = {
15 programs.bandwhich = {
16 enable = lib.mkOption {
17 type = lib.types.bool;
18 default = false;
19 description = ''
20 Whether to add bandwhich to the global environment and configure a
21 setcap wrapper for it.
22 '';
23 };
24 };
25 };
26
27 config = lib.mkIf cfg.enable {
28 environment.systemPackages = with pkgs; [ bandwhich ];
29 security.wrappers.bandwhich = {
30 owner = "root";
31 group = "root";
32 capabilities = "cap_sys_ptrace,cap_dac_read_search,cap_net_raw,cap_net_admin+ep";
33 source = "${pkgs.bandwhich}/bin/bandwhich";
34 };
35 };
36}