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.
This commit is contained in:
Ilan Joselevich
2026-04-16 20:54:26 +01:00
parent 6a7bcd4fbb
commit 9abcb29cd4
@@ -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}";
};
}