From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id +GZnAogidWQ2HQEASxT56A (envelope-from ) for ; Tue, 30 May 2023 00:09:12 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id wAKVAogidWQOKQEA9RJhRA (envelope-from ) for ; Tue, 30 May 2023 00:09:12 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 630B219C1C for ; Tue, 30 May 2023 00:09:11 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q3ker-0002m3-TK; Mon, 29 May 2023 17:44:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3kep-0002lg-Kg for guix-patches@gnu.org; Mon, 29 May 2023 17:44:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q3keo-0001ID-FC for guix-patches@gnu.org; Mon, 29 May 2023 17:44:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q3keo-0001EO-1l for guix-patches@gnu.org; Mon, 29 May 2023 17:44:02 -0400 Subject: bug#62969: [PATCH] home: Add msmtp service. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-To: guix-patches@gnu.org Resent-Date: Mon, 29 May 2023 21:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 62969 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Tanguy Le Carrour Cc: 62969-done@debbugs.gnu.org, mirai@makinata.eu Mail-Followup-To: 62969@debbugs.gnu.org, ludo@gnu.org, tanguy@bioneland.org Received: via spool by 62969-done@debbugs.gnu.org id=D62969.16853966284699 (code D ref 62969); Mon, 29 May 2023 21:44:01 +0000 Received: (at 62969-done) by debbugs.gnu.org; 29 May 2023 21:43:48 +0000 Received: from localhost ([127.0.0.1]:59352 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3kea-0001Dj-Ex for submit@debbugs.gnu.org; Mon, 29 May 2023 17:43:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45452) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q3keY-0001DQ-4r for 62969-done@debbugs.gnu.org; Mon, 29 May 2023 17:43:47 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3keS-0001FP-1m; Mon, 29 May 2023 17:43:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=qS/lDLLhyJxNiTbtIYay+RvQgs8IX6Zk6BDpdqWOWwU=; b=NJkMjjiuHv0aqZTcDwG2 zj1r8qwHxSp53gp8d9KJedR0FMwLO/VF6Ky/PQuhd99wIjLRvyBSMK1z6nG086pQly036yDBx3smn E4Vqxk2BAtfZkpGiyChGWNl4lhVQYgGhug9etTsx3orDpKmjnzZZP7husKTHK58lBMLTHnCdANN7L Z7hYTz24fGSGOf2y/OLBDHO1rQwhWEFwmD5w+xCpdftdlUp8h94KsQpHJtkCkRnZVjhbd2vK5C1YQ lOR2AJitPbWYnRgayjUsxNSYmp2CIOQqgk7TMJzkMTFbItVk0SSLpe1YYX1rWzajqflbF3EgUtBVm Lt0qw884cr/wmg==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201] helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q3ke5-0004Tf-N7; Mon, 29 May 2023 17:43:22 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20230420144230.9392-1-tanguy@bioneland.org> Date: Mon, 29 May 2023 23:43:14 +0200 In-Reply-To: (Tanguy Le Carrour's message of "Wed, 17 May 2023 10:51:44 +0200") Message-ID: <87ttvuerv1.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1685398151; a=rsa-sha256; cv=none; b=afOWWjrzEYhET/Owepo2J/hs8Ty5xywEXPAWEZlAWcGXj8WKB9GXRLUamyRYR9uu7Pi2bZ jWn118FAo67u3XRFml4skeUtR1U8Jtm7/ZquabIPOwYolP4jcwQ0DbtAzjokI87svcVNS6 HaZcUU5bPlYqgHdfBeI1i2zShY2OMpmb9EObUaLiEN1a6XZRi6kKxer3Uf7LyaZ+Emsyc/ lqMvTH87NhmEDTNUBZnWN0PdwvlhQrWAaTYs3Vnr3z5UNX6KHb6+mP4CaARnaDjfF6vhFZ xSecWAJAj9nphTx4jYW9sf/W43EsUkoH4RJruPjcJnrX7LV3luHVE7Q3USdjEQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=NJkMjjiu; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1685398151; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-to:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=qS/lDLLhyJxNiTbtIYay+RvQgs8IX6Zk6BDpdqWOWwU=; b=ZQh928eBZRrhEOrPJswePlYMwEFT4LvhdjftGgV9lsvGI+sVJ4AXDIz1vCWDLpYVkp03iZ evNrhuemoJlojBOwlr9I5xN0dzbp0R3R9g40LLKBV7Nc9wGczX0S1l9zYkB5TiPgUzrET/ GruYlGFk7k+rxpUjotvjhfZg3L8+h6UMub+L1msz2mr/4xx+cXGiV0dKzvez/P1f/F7DLG 7grtlAgYrer+7DU4gn9rg7L2C7ptjLUKSpUuR5s2O+9t2hexoCtV6rSXnx3yTGTCeAWUVa 9XLHiBKpep02X5K7j/+ba9/+zeZJPTmyaLLSnDaUw/voOi7HkDBdSSoUn+z6ag== X-Migadu-Spam-Score: -2.31 X-Spam-Score: -2.31 X-Migadu-Queue-Id: 630B219C1C X-Migadu-Scanner: scn0.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=NJkMjjiu; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-TUID: 42Yw5WuYGOlo --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Tanguy Le Carrour 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 =E2=80=98define-maybe=E2=80=99 ch= ange 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=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline 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 --=-=-=--