summaryrefslogtreecommitdiff
path: root/gnu/services
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2023-08-06 21:50:01 +0200
committerLudovic Courtès <ludo@gnu.org>2023-08-20 22:48:47 +0200
commit1ce3424e22bc89e01f9cc3a2eb01232715495bd3 (patch)
tree0db2f5f91e4e872a88f25853fc1f4b8a0b6318c3 /gnu/services
parent1c30d5a6bfc5d48137f4bdcc271189a06fdc6ed3 (diff)
home: services: Add dicod.
* gnu/home/services/dict.scm: New file. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. * gnu/services/dict.scm (<dicod-configuration>)[home-service?]: New field. (dicod-shepherd-service): Do not map /dev/log when 'home-service?' is true. Remove 'user-processes' requirement when 'home-service?' is true. (dicod-shepherd-service): Set #:user and #:group to #f when 'home-service?' is true. * doc/guix.texi (Miscellaneous Home Services): New node. (Miscellaneous Services): Add cross-reference.
Diffstat (limited to 'gnu/services')
-rw-r--r--gnu/services/dict.scm27
1 files changed, 18 insertions, 9 deletions
diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm
index f542921302..a4e25f5302 100644
--- a/gnu/services/dict.scm
+++ b/gnu/services/dict.scm
@@ -56,7 +56,9 @@
(handlers dicod-configuration-handlers ;list of <dicod-handler>
(default '()))
(databases dicod-configuration-databases ;list of <dicod-database>
- (default (list %dicod-database:gcide))))
+ (default (list %dicod-database:gcide)))
+ (home-service? dicod-configuration-home-service? ;boolean
+ (default for-home?) (innate)))
(define-record-type* <dicod-handler>
dicod-handler make-dicod-handler
@@ -152,20 +154,26 @@ database {
(define (dicod-shepherd-service config)
(let* ((dicod.conf (dicod-configuration-file config))
(interfaces (dicod-configuration-interfaces config))
+ (home-service? (dicod-configuration-home-service? config))
+ (mappings `(,@(if home-service?
+ '()
+ (list (file-system-mapping
+ (source "/dev/log")
+ (target source))))
+ ,(file-system-mapping
+ (source dicod.conf)
+ (target source))))
(dicod (least-authority-wrapper
(file-append (dicod-configuration-dico config)
"/bin/dicod")
#:name "dicod"
- #:mappings (list (file-system-mapping
- (source "/dev/log")
- (target source))
- (file-system-mapping
- (source dicod.conf)
- (target source)))
+ #:mappings mappings
#:namespaces (delq 'net %namespaces))))
(list (shepherd-service
(provision '(dicod))
- (requirement '(user-processes))
+ (requirement (if home-service?
+ '()
+ '(user-processes)))
(documentation "Run the dicod daemon.")
(start #~(make-inetd-constructor
(list #$dicod "--inetd" "--foreground"
@@ -176,7 +184,8 @@ database {
(car (getaddrinfo interface "dict")))))
'#$interfaces)
#:requirements '#$requirement
- #:user "dicod" #:group "dicod"
+ #:user #$(and (not home-service?) "dicod")
+ #:group #$(and (not home-service?) "dicod")
#:service-name-stem "dicod"))
(stop #~(make-inetd-destructor))
(actions (list (shepherd-configuration-action dicod.conf)))))))