From 047a80444950005004b423b09c1c0a5531e7cab3 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Mon, 12 May 2025 09:51:17 +0200 Subject: [PATCH] nixos/postsrsd: expose socketPath via module option Services utilising postsrsd need to connect to it via a Unix socket. While the path to that socket is static as of now, the discoverability of that path suffers from the lack of module documentation and a scattered definition of the individual path components over at least three lines, even when reading the module source. By exposing the socket path as a readOnly NixOS option, that value shows up in the options overview and can be re-used in other parts of NixOS config. --- nixos/modules/services/mail/postsrsd.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nixos/modules/services/mail/postsrsd.nix b/nixos/modules/services/mail/postsrsd.nix index e7c133bceac1..bc91edbbe000 100644 --- a/nixos/modules/services/mail/postsrsd.nix +++ b/nixos/modules/services/mail/postsrsd.nix @@ -22,7 +22,7 @@ let secrets-file = "''${CREDENTIALS_DIRECTORY}/secrets-file" domains = ${libconfuseDomains} separator = "${cfg.separator}" - socketmap = "unix:${runtimeDirectory}/socket" + socketmap = "unix:${cfg.socketPath}" # Disable postsrsd's jailing in favor of confinement with systemd. unprivileged-user = "" @@ -93,6 +93,15 @@ in default = "postsrsd"; description = "Group for the daemon"; }; + + socketPath = lib.mkOption { + type = lib.types.path; + default = "${runtimeDirectory}/socket"; + readOnly = true; + description = '' + Path to the Unix socket for connecting to postsrsd. + Read-only, intended for usage when integrating postsrsd into other NixOS config.''; + }; }; };