{ config, pkgs, ... }: let configure_prom = builtins.toFile "prometheus.yml" '' scrape_configs: - job_name: '${config.networking.hostName}' stream_parse: true static_configs: - targets: - 127.0.0.1:9100 ''; in { sops.secrets.victoria-agent-env = { sopsFile = ./secrets.yaml; }; services.prometheus.exporters.node.enable = true; systemd.services.export-to-prometheus = { path = with pkgs; [victoriametrics]; enable = true; after = ["network-online.target"]; wantedBy = ["multi-user.target"]; script = "vmagent -promscrape.config=${configure_prom} -remoteWrite.url=http://victoria-server.cloonar.com:8428/api/v1/write"; serviceConfig = { EnvironmentFile=config.sops.secrets.victoria-agent-env.path; }; }; }