DEVELOPMENT ENVIRONMENT

~liljamo/nix-arta

ref: a2307139c283dc5eb3b5855a073203f78e30462d nix-arta/roles/cadvisor.nix -rw-r--r-- 632 bytes
a2307139Jonni Liljamo chore: update flake inputs, don't touch nvim-flake nixpkgs 20 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{
  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;
    };
  };
}