DEVELOPMENT ENVIRONMENT

~liljamo/nix-arta

ref: 916791d2430d97269a8db2fcffb784e330ca405c nix-arta/roles/cadvisor.nix -rw-r--r-- 632 bytes
916791d2Jonni Liljamo chroe: remove sqbuilds a month 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;
    };
  };
}