From 9abcb29cd4c4dab94d100ffc877797bf97cc8dde Mon Sep 17 00:00:00 2001 From: Ilan Joselevich Date: Thu, 16 Apr 2026 20:54:26 +0100 Subject: [PATCH] nixos/prometheus-postfix-exporter: use socket activation Run postfix_exporter with `--web.systemd-socket` and move the listen-address/port configuration into a companion `.socket` unit. --- .../services/monitoring/prometheus/exporters/postfix.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/monitoring/prometheus/exporters/postfix.nix b/nixos/modules/services/monitoring/prometheus/exporters/postfix.nix index 53a4056b86dd..e0abda068b2f 100644 --- a/nixos/modules/services/monitoring/prometheus/exporters/postfix.nix +++ b/nixos/modules/services/monitoring/prometheus/exporters/postfix.nix @@ -85,6 +85,7 @@ in }; }; }; + serviceOpts = { after = mkIf cfg.systemd.enable [ cfg.systemd.unit ]; serviceConfig = { @@ -95,7 +96,7 @@ in SupplementaryGroups = mkIf cfg.systemd.enable [ "systemd-journal" ]; ExecStart = '' ${lib.getExe cfg.package} \ - --web.listen-address ${cfg.listenAddress}:${toString cfg.port} \ + --web.systemd-socket \ --web.telemetry-path ${cfg.telemetryPath} \ --postfix.showq_path ${escapeShellArg cfg.showqPath} \ ${concatStringsSep " \\\n " ( @@ -115,4 +116,8 @@ in ''; }; }; + + socketOpts = { + socketConfig.ListenStream = "${cfg.listenAddress}:${toString cfg.port}"; + }; }