summary refs log tree commit diff
path: root/gnu/services/dmd.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/services/dmd.scm')
-rw-r--r--gnu/services/dmd.scm56
1 files changed, 34 insertions, 22 deletions
diff --git a/gnu/services/dmd.scm b/gnu/services/dmd.scm
index 161a971edd..8d4c483cc4 100644
--- a/gnu/services/dmd.scm
+++ b/gnu/services/dmd.scm
@@ -32,27 +32,39 @@
 
 (define (dmd-configuration-file services)
   "Return the dmd configuration file for SERVICES."
-  (define config
-    #~(begin
-        (use-modules (ice-9 ftw))
-
-        (register-services
-         #$@(map (lambda (service)
-                   #~(make <service>
-                       #:docstring '#$(service-documentation service)
-                       #:provides '#$(service-provision service)
-                       #:requires '#$(service-requirement service)
-                       #:respawn? '#$(service-respawn? service)
-                       #:start #$(service-start service)
-                       #:stop #$(service-stop service)))
-                 services))
-
-        ;; guix-daemon 0.6 aborts if 'PATH' is undefined, so work around it.
-        (setenv "PATH" "/run/current-system/bin")
-
-        (format #t "starting services...~%")
-        (for-each start '#$(append-map service-provision services))))
-
-  (gexp->file "dmd.conf" config))
+  (define modules
+    ;; Extra modules visible to dmd.conf.
+    '((guix build syscalls)))
+
+  (mlet %store-monad ((modules  (imported-modules modules))
+                      (compiled (compiled-modules modules)))
+    (define config
+      #~(begin
+          (eval-when (expand load eval)
+            (set! %load-path (cons #$modules %load-path))
+            (set! %load-compiled-path
+                  (cons #$compiled %load-compiled-path)))
+
+          (use-modules (ice-9 ftw)
+                       (guix build syscalls))
+
+          (register-services
+           #$@(map (lambda (service)
+                     #~(make <service>
+                         #:docstring '#$(service-documentation service)
+                         #:provides '#$(service-provision service)
+                         #:requires '#$(service-requirement service)
+                         #:respawn? '#$(service-respawn? service)
+                         #:start #$(service-start service)
+                         #:stop #$(service-stop service)))
+                   services))
+
+          ;; guix-daemon 0.6 aborts if 'PATH' is undefined, so work around it.
+          (setenv "PATH" "/run/current-system/bin")
+
+          (format #t "starting services...~%")
+          (for-each start '#$(append-map service-provision services))))
+
+    (gexp->file "dmd.conf" config)))
 
 ;;; dmd.scm ends here