guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#33836] [PATCH 1/2] services: configuration: Add location.


From: Oleg Pykhalov
Subject: [bug#33836] [PATCH 1/2] services: configuration: Add location.
Date: Sun, 23 Dec 2018 18:40:20 +0300

* gnu/services/configuration.scm (define-configuration): Add location.
* gnu/services/mail.scm (namespace-configuration)[location]: Rename to
'mailbox-location'.
(uglify-field-name): Handle this.
* doc/guix.texi (Mail Services): Document this.
---
 doc/guix.texi                  |  2 +-
 gnu/services/configuration.scm |  5 +++++
 gnu/services/mail.scm          | 11 +++++++----
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index e254b3859..a6db2461d 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -14665,7 +14665,7 @@ different for all namespaces. For example 
@samp{Public/}.
 Defaults to @samp{""}.
 @end deftypevr
 
address@hidden address@hidden parameter} string location
address@hidden address@hidden parameter} string mailbox-location
 Physical location of the mailbox. This is in the same format as
 mail_location, which is also the default for it.
 Defaults to @samp{""}.
diff --git a/gnu/services/configuration.scm b/gnu/services/configuration.scm
index 707944cbe..9775f91ff 100644
--- a/gnu/services/configuration.scm
+++ b/gnu/services/configuration.scm
@@ -22,6 +22,7 @@
   #:use-module (guix packages)
   #:use-module (guix records)
   #:use-module (guix gexp)
+  #:use-module ((guix utils) #:select (source-properties->location))
   #:autoload   (texinfo) (texi-fragment->stexi)
   #:autoload   (texinfo serialize) (stexi->texi)
   #:use-module (ice-9 match)
@@ -129,6 +130,10 @@
                  #,(id #'stem #'% #'stem)
                  #,(id #'stem #'make- #'stem)
                  #,(id #'stem #'stem #'?)
+                 (location configuration-location
+                           (default (and=> (current-source-location)
+                                           source-properties->location))
+                           (innate))
                  (field field-getter (default def))
                  ...)
                (define #,(id #'stem #'stem #'-fields)
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index fcaedd038..a8121e5d1 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -75,9 +75,12 @@
 
 (define (uglify-field-name field-name)
   (let ((str (symbol->string field-name)))
-    (string-join (string-split (if (string-suffix? "?" str)
-                                   (substring str 0 (1- (string-length str)))
-                                   str)
+    (string-join (string-split (cond
+                                ((string-suffix? "?" str)
+                                 (substring str 0 (1- (string-length str))))
+                                ((string=? str "mailbox-location")
+                                 "location")
+                                (else str))
                                #\-)
                  "_")))
 
@@ -413,7 +416,7 @@ format.")
    "Prefix required to access this namespace.  This needs to be
 different for all namespaces. For example @samp{Public/}.")
 
-  (location
+  (mailbox-location
    (string "")
    "Physical location of the mailbox. This is in same format as
 mail_location, which is also the default for it.")
-- 
2.20.1






reply via email to

[Prev in Thread] Current Thread [Next in Thread]