{
  lib,
  config,
  # name,
  # meta,
  ...
}:
with lib; let
  cfg = config.nodeExporter;
in {
  options.nodeExporter = {
    enable = mkOption {
      type = types.bool;
      default = false;
    };

    port = mkOption {
      type = types.number;
      default = 9100;
    };

    extraConfig = mkOption {
      type = types.attrs;
      default = {};
    };
  };

  config = mkIf cfg.enable {
    networking.firewall.allowedTCPPorts = [cfg.port];

    services.prometheus.exporters.node =
      {
        enable = true;
        enabledCollectors = ["systemd"];
        port = cfg.port;
        extraFlags = ["--collector.ethtool" "--collector.softirqs" "--collector.tcpstat" "--collector.wifi"];
      }
      // cfg.extraConfig;
  };
}
