private: No


{ lib, pkgs, config, ... }:
with lib;
let cfg = config.pinpox.metrics;
in {

  options.pinpox.metrics.node = {
    enable = mkEnableOption "prometheus node-exporter metrics collection";
  };

  options.pinpox.metrics.backbox = {
    enable = mkEnableOption "prometheus blackbox-exporter metrics collection";
  };

  config.services.prometheus.exporters = {
    node = mkIf cfg.node.enable {
        enable = true;
        listenAddress = config.pinpox.wg-client.clientIp;
        enabledCollectors = [ "systemd" ];
      };

    };
{ lib, pkgs, config, ... }:
with lib;
let cfg = config.pinpox.metrics;
in {

  options.pinpox.metrics.node = {
    enable = mkEnableOption "prometheus node-exporter metrics collection";
  };

  options.pinpox.metrics.backbox = {
    enable = mkEnableOption "prometheus blackbox-exporter metrics collection";
  };

  config = {
    services.prometheus.exporters = {
      node = mkIf cfg.node.enable {
        enable = true;
        listenAddress = config.pinpox.wg-client.clientIp;
        enabledCollectors = [ "systemd" ];
      };
      backbox = mkIf cfg.backbox.enable { };
    };

    # Open wirewall port for the wireguard interface
    networking.firewall.interfaces.wg0.allowedTCPPorts = mkIf cfg.node.enable [ 9100 ];
  };
}