~abcdw/rde-devel

rde: feature-msmtp: Migrate to XDG_STATE_HOME. v1 PROPOSED

Nicolas Graves: 1
 rde: feature-msmtp: Migrate to XDG_STATE_HOME.

 1 files changed, 10 insertions(+), 4 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~abcdw/rde-devel/patches/44179/mbox | git am -3
Learn more about email & git

[PATCH] rde: feature-msmtp: Migrate to XDG_STATE_HOME. Export this patch

---
 src/rde/features/mail.scm | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/rde/features/mail.scm b/src/rde/features/mail.scm
index 17426200..ed63ec16 100644
--- a/src/rde/features/mail.scm
+++ b/src/rde/features/mail.scm
@@ -2,7 +2,7 @@
;;;
;;; Copyright © 2021, 2022, 2023 Andrew Tropin <andrew@trop.in>
;;; Copyright © 2021 Demis Balbach <db@minikn.xyz>
;;; Copyright © 2022 Nicolas Graves <ngraves@ngraves.fr>
;;; Copyright © 2022, 2023 Nicolas Graves <ngraves@ngraves.fr>
;;; Copyright © 2023 Miguel Ángel Moreno <me@mianmoreno.com>
;;;
;;; This file is part of rde.
@@ -37,6 +37,7 @@
  #:use-module (gnu home-services mail)
  #:use-module (gnu home services mcron)
  #:use-module (gnu home-services version-control)
  #:use-module (gnu home services xdg)

  #:use-module (ice-9 match)
  #:use-module (srfi srfi-1)
@@ -345,8 +346,7 @@ Citation line format, message signature, gpg and msmtp configurations. "
(define %default-msmtp-settings
  "defaults
tls on
auth on
logfile \"~/.local/var/log/msmtp.log\"\n")
auth on\n")

(define (default-msmtp-serializer provider-settings mail-account)
  (let* ((account-type (mail-account-type mail-account))
@@ -365,6 +365,7 @@ logfile \"~/.local/var/log/msmtp.log\"\n")
          (msmtp-serializer default-msmtp-serializer))
  "Configure msmtp MTA."
  (define (get-home-services config)
    (require-value 'xdg-base-directories-configuration config)
    (require-value 'mail-accounts config
                   "feature-msmtp can't operate without mail-accounts.")

@@ -376,11 +377,16 @@ logfile \"~/.local/var/log/msmtp.log\"\n")
      (list
       (list
        "msmtp/config"
        ;; TODO: Try $HOME/.local/var/log expansion
        (apply
         mixed-text-file
         "msmtp-config"
         msmtp-settings
         (format #f "logfile ~a~a/log/msmtp.log\n"
                 (get-value 'home-directory config)
                 (string-drop
                  (home-xdg-base-directories-configuration-state-home
                   (get-value 'xdg-base-directories-configuration config))
                  5)) ; 5 <-> "$HOME"
          (map
           (lambda (acc)
             (string-append
-- 
2.41.0
I've tried the $XDG_STATE_HOME expansion and it doesn't work.
This is the last solution I could come up with, I did the same thing as
for libreoffice.