aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-11-22 23:16:01 +0100
committerLudovic Courtès <ludo@gnu.org>2017-11-22 23:16:01 +0100
commit9e549ad1c3a576eed1fb095a2d14613bce83b9ee (patch)
tree72d086f831f1457ba820052110937b77971f46b3
parent0cb9c9d1702b65613a81a3e56255dcc38939841a (diff)
downloadpatches-9e549ad1c3a576eed1fb095a2d14613bce83b9ee.tar
patches-9e549ad1c3a576eed1fb095a2d14613bce83b9ee.tar.gz
services: dicod: Run in a container.
* gnu/services/dict.scm (dicod-shepherd-service): Add 'with-imported-modules' form and 'modules' field. Use 'make-forkexec-constructor/container' instead of 'make-forkexec-constructor'.
-rw-r--r--gnu/services/dict.scm26
1 files changed, 18 insertions, 8 deletions
diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm
index 69eadafd2e..c8403c0135 100644
--- a/gnu/services/dict.scm
+++ b/gnu/services/dict.scm
@@ -21,6 +21,7 @@
(define-module (gnu services dict)
#:use-module (guix gexp)
#:use-module (guix records)
+ #:use-module (guix modules)
#:use-module (gnu services)
#:use-module (gnu services shepherd)
#:use-module (gnu system shadow)
@@ -144,14 +145,23 @@ database {
(let ((dicod (file-append (dicod-configuration-dico config)
"/bin/dicod"))
(dicod.conf (dicod-configuration-file config)))
- (list (shepherd-service
- (provision '(dicod))
- (documentation "Run the dicod daemon.")
- (start #~(make-forkexec-constructor
- (list #$dicod "--foreground"
- (string-append "--config=" #$dicod.conf))
- #:user "dicod" #:group "dicod"))
- (stop #~(make-kill-destructor))))))
+ (with-imported-modules (source-module-closure
+ '((gnu build shepherd)
+ (gnu system file-systems)))
+ (list (shepherd-service
+ (provision '(dicod))
+ (documentation "Run the dicod daemon.")
+ (modules '((gnu build shepherd)
+ (gnu system file-systems)))
+ (start #~(make-forkexec-constructor/container
+ (list #$dicod "--foreground"
+ (string-append "--config=" #$dicod.conf))
+ #:user "dicod" #:group "dicod"
+ #:mappings (list (file-system-mapping
+ (source "/var/run/dicod")
+ (target source)
+ (writable? #t)))))
+ (stop #~(make-kill-destructor)))))))
(define dicod-service-type
(service-type