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