{
lib,
config,
...
}: let
cfg = config.roles.cadvisor;
in {
options.roles.cadvisor = {
enable = lib.mkEnableOption "cadvisor";
port = lib.mkOption {
type = lib.types.port;
default = 9080;
};
openFirewall = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Wheter to open firewall port for cadvisor";
};
};
config = lib.mkIf cfg.enable {
networking.firewall.allowedTCPPorts = lib.mkIf cfg.openFirewall [
cfg.port
];
services.cadvisor = {
enable = true;
listenAddress = "0.0.0.0";
port = cfg.port;
};
};
}