{config, lib, ...}: let cfg = config.selfprivacy.modules.monitoring; in { options.selfprivacy.modules.monitoring = { enable = lib.mkOption { default = false; type = lib.types.bool; }; }; config = lib.mkIf cfg.enable { services.prometheus = { enable = true; port = 9001; listenAddress = "127.0.0.1"; exporters = { node = { enable = true; enabledCollectors = [ "systemd" ]; port = 9002; }; }; scrapeConfigs = [ { job_name = "node-exporter"; static_configs = [{ targets = [ "127.0.0.1:9002" ]; }]; } ]; }; }; }