{ povSelf, config, lib, ... }: let inherit (lib) types; cfg = lib.getAttrFromPath povSelf config; in { options = { enable = { type = types.bool; default = false; }; }; config = lib.mkIf cfg.enable { services = { prometheus.exporters = { node = { enable = true; listenAddress = "[::1]"; port = 9100; enabledCollectors = [ "systemd" "processes" ]; }; systemd = { enable = true; listenAddress = "[::1]"; port = 9558; }; }; nginx.virtualHosts."${config.networking.fqdn}".locations = { "/node-exporter".proxyPass = "http://${toString config.services.prometheus.exporters.node.listenAddress}:${toString config.services.prometheus.exporters.node.port}/metrics"; "/systemd-exporter".proxyPass = "http://${toString config.services.prometheus.exporters.systemd.listenAddress}:${toString config.services.prometheus.exporters.systemd.port}/metrics"; }; }; }; }