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