diff options
author | Romain GARBAGE <romain.garbage@inria.fr> | 2025-04-08 16:07:00 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2025-04-08 17:23:27 +0200 |
commit | c88f98bb3ca2616baea6b1e452cc900cc9c87503 (patch) | |
tree | a6003d4b2f602d7c078d0387a807ca3cddee61a0 | |
parent | ac83a22375e4ba0b5c5d2c2f23ae301d64dc7170 (diff) | |
download | guix-c88f98bb3ca2616baea6b1e452cc900cc9c87503.tar.gz guix-c88f98bb3ca2616baea6b1e452cc900cc9c87503.zip |
home: services: msmtp: Accept g-expressions for ‘password-eval’.
This allows users to specify:
(password-eval #~(string-append
#$(file-append libsecret "/bin/secret-tool")
"…"))
* gnu/home/services/mail.scm (string-or-gexp?): New variable.
(maybe-string-or-gexp): New record type
(msmtp-configuration-serialize-string-or-gexp): New variable.
(msmtp-configuration) [password-eval]: Change type.
Change-Id: Id3016956250c447b301b40f29a6509d57058be49
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r-- | gnu/home/services/mail.scm | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/gnu/home/services/mail.scm b/gnu/home/services/mail.scm index 5445c82c67..78d614dc84 100644 --- a/gnu/home/services/mail.scm +++ b/gnu/home/services/mail.scm @@ -49,9 +49,14 @@ msmtp-account-name msmtp-account-configuration)) +(define (string-or-gexp? obj) + (or (string? obj) + (gexp? obj))) + (define-maybe string (prefix msmtp-configuration-)) (define-maybe boolean (prefix msmtp-configuration-)) (define-maybe integer (prefix msmtp-configuration-)) +(define-maybe string-or-gexp (prefix msmtp-configuration-)) ;; Serialization of 'msmtp'. (define (uglify-symbol field-name) @@ -68,6 +73,9 @@ (define (msmtp-configuration-serialize-string field-name value) #~(string-append #$(uglify-symbol field-name) " " #$value "\n")) +(define msmtp-configuration-serialize-string-or-gexp + msmtp-configuration-serialize-string) + (define (msmtp-configuration-serialize-maybe-string-no-underscore field-name value) #~(if #$(maybe-value-set? value) (string-append @@ -148,7 +156,7 @@ unless TLS without STARTTLS is used, in which case it is 465 (\"smtps\").") "Set the envelope-from address.") (password-eval - maybe-string + maybe-string-or-gexp "Set the password for authentication to the output (stdout) of the command cmd." (serializer msmtp-configuration-serialize-maybe-string-no-underscore)) |