From: "Ludovic Courtès" <ludo@gnu.org>
To: Tanguy Le Carrour <tanguy@bioneland.org>
Cc: 62969-done@debbugs.gnu.org, mirai@makinata.eu
Subject: bug#62969: [PATCH] home: Add msmtp service.
Date: Mon, 29 May 2023 23:43:14 +0200 [thread overview]
Message-ID: <87ttvuerv1.fsf_-_@gnu.org> (raw)
In-Reply-To: <b2cd3fe9db8d8c4ddb0678dbd36937e83a09511d.1684313128.git.tanguy@bioneland.org> (Tanguy Le Carrour's message of "Wed, 17 May 2023 10:51:44 +0200")
[-- Attachment #1: Type: text/plain, Size: 623 bytes --]
Hi,
Tanguy Le Carrour <tanguy@bioneland.org> skribis:
> * gnu/home/services/mail.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.
> * doc/guix.texi (Mailing): New node.
Sorry for the delay!
I applied it with the changes below. The ‘define-maybe’ change fixes
the unbound-variable warnings that we were seeing, and it lets us remove
a bit of boilerplate.
In a subsequent patch, we should make the msmtp package configurable, as
is done for other services (see redshift, unclutter, dbus, etc.).
I was going to do it but ran out of time; could you take a look?
Thanks!
Ludo’.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 4107 bytes --]
diff --git a/gnu/home/services/mail.scm b/gnu/home/services/mail.scm
index c3d34240f1..5445c82c67 100644
--- a/gnu/home/services/mail.scm
+++ b/gnu/home/services/mail.scm
@@ -18,11 +18,11 @@
(define-module (gnu home services mail)
#:use-module (guix gexp)
- #:use-module (gnu packages)
#:use-module (gnu services)
#:use-module (gnu services configuration)
#:use-module (gnu home services)
#:use-module (gnu home services shepherd)
+ #:use-module (gnu packages mail)
#:use-module (ice-9 string-fun)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
@@ -49,9 +49,9 @@ (define-module (gnu home services mail)
msmtp-account-name
msmtp-account-configuration))
-(define-maybe string)
-(define-maybe boolean)
-(define-maybe integer)
+(define-maybe string (prefix msmtp-configuration-))
+(define-maybe boolean (prefix msmtp-configuration-))
+(define-maybe integer (prefix msmtp-configuration-))
;; Serialization of 'msmtp'.
(define (uglify-symbol field-name)
@@ -61,15 +61,12 @@ (define (uglify-symbol field-name)
(string-drop-right ugly-name 1)
ugly-name)))
-(define (msmtp-configuration-serialize-maybe-boolean field-name value)
- #~(if #$(maybe-value-set? value)
- (string-append #$(uglify-symbol field-name) " " (if #$value "on" "off") "\n")
- ""))
+(define (msmtp-configuration-serialize-boolean field-name value)
+ #~(string-append #$(uglify-symbol field-name) " "
+ (if #$value "on" "off") "\n"))
-(define (msmtp-configuration-serialize-maybe-string field-name value)
- #~(if #$(maybe-value-set? value)
- (string-append #$(uglify-symbol field-name) " " #$value "\n")
- ""))
+(define (msmtp-configuration-serialize-string field-name value)
+ #~(string-append #$(uglify-symbol field-name) " " #$value "\n"))
(define (msmtp-configuration-serialize-maybe-string-no-underscore field-name value)
#~(if #$(maybe-value-set? value)
@@ -77,10 +74,9 @@ (define (msmtp-configuration-serialize-maybe-string-no-underscore field-name val
#$(string-replace-substring (uglify-symbol field-name) "_" "") " " #$value "\n")
""))
-(define (msmtp-configuration-serialize-maybe-integer field-name value)
- #~(if #$(maybe-value-set? value)
- (string-append #$(uglify-symbol field-name) " " (number->string #$value) "\n")
- ""))
+(define (msmtp-configuration-serialize-integer field-name value)
+ #~(string-append #$(uglify-symbol field-name) " "
+ (number->string #$value) "\n"))
(define (msmtp-configuration-serialize-extra-content field-name value)
#~(if (string=? #$value "") "" (string-append #$value "\n")))
@@ -204,25 +200,22 @@ (define-configuration home-msmtp-configuration
(prefix home-msmtp-configuration-))
-(define (home-msmtp-files-service config)
+(define (home-msmtp-files config)
(list
`(".config/msmtp/config"
- ,(mixed-text-file "config"
+ ,(mixed-text-file "msmtp-config"
(serialize-configuration config home-msmtp-configuration-fields)))))
-(define (home-msmtp-profile-service config)
- (specifications->packages (list "msmtp")))
+(define (home-msmtp-profile-entries config)
+ (list msmtp))
(define home-msmtp-service-type
(service-type (name 'home-msmtp)
(extensions
- (list
- (service-extension
- home-profile-service-type
- home-msmtp-profile-service)
- (service-extension
- home-files-service-type
- home-msmtp-files-service)))
+ (list (service-extension home-profile-service-type
+ home-msmtp-profile-entries)
+ (service-extension home-files-service-type
+ home-msmtp-files)))
(default-value (home-msmtp-configuration))
(description "Configure msmtp, a simple
@acronym{SMTP, Simple Mail Transfer Protocol} client that can relay email
next prev parent reply other threads:[~2023-05-29 22:09 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-20 14:42 [bug#62969] [PATCH] home: Add msmtp service Tanguy Le Carrour
2023-04-20 16:36 ` Bruno Victal
2023-04-23 17:10 ` Tanguy LE CARROUR
2023-04-23 17:12 ` [bug#62969] [PATCH v2] " Tanguy Le Carrour
2023-04-30 21:30 ` [bug#62969] [PATCH] " Ludovic Courtès
2023-05-03 10:01 ` [bug#62969] [PATCH v3] " Tanguy LE CARROUR
2023-05-03 20:27 ` Ludovic Courtès
2023-05-17 8:52 ` Tanguy LE CARROUR
2023-05-17 8:51 ` [bug#62969] [PATCH v4] " Tanguy Le Carrour
2023-05-29 21:43 ` Ludovic Courtès [this message]
2023-05-30 6:54 ` [bug#62969] [PATCH] " Tanguy LE CARROUR
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ttvuerv1.fsf_-_@gnu.org \
--to=ludo@gnu.org \
--cc=62969-done@debbugs.gnu.org \
--cc=mirai@makinata.eu \
--cc=tanguy@bioneland.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.