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