summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'gnu')
-rw-r--r--gnu/services/base.scm19
-rw-r--r--gnu/services/dmd.scm56
2 files changed, 42 insertions, 33 deletions
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 5157349aec..e0f2888ee0 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -22,8 +22,7 @@
   #:use-module (gnu system linux)                 ; 'pam-service', etc.
   #:use-module (gnu packages admin)
   #:use-module ((gnu packages base)
-                #:select (glibc-final %final-inputs))
-  #:use-module (gnu packages linux)
+                #:select (glibc-final))
   #:use-module (gnu packages package-management)
   #:use-module (guix gexp)
   #:use-module (guix monads)
@@ -52,9 +51,6 @@ system upon shutdown (aka. cleanly \"umounting\" root.)
 
 This service must be the root of the service dependency graph so that its
 'stop' action is invoked when dmd is the only process left."
-  (define coreutils
-    (car (assoc-ref %final-inputs "coreutils")))
-
   (with-monad %store-monad
     (return
      (service
@@ -63,7 +59,7 @@ This service must be the root of the service dependency graph so that its
       (start #~(const #t))
       (stop #~(lambda _
                 ;; Return #f if successfully stopped.
-                (system* (string-append #$coreutils "/bin/sync"))
+                (sync)
 
                 (call-with-blocked-asyncs
                  (lambda ()
@@ -82,12 +78,13 @@ This service must be the root of the service dependency graph so that its
                      ;; Close /dev/console.
                      (for-each close-fdes '(0 1 2))
 
-                     ;; At this points, there are no open files left, so the
+                     ;; At this point, there are no open files left, so the
                      ;; root file system can be re-mounted read-only.
-                     (not (zero?
-                           (system* (string-append #$util-linux "/bin/mount")
-                                    "-n" "-o" "remount,ro"
-                                    "-t" "dummy" "dummy" "/"))))))))
+                     (mount #f "/" #f
+                            (logior MS_REMOUNT MS_RDONLY)
+                            #:update-mtab? #f)
+
+                     #f)))))
       (respawn? #f)))))
 
 (define* (user-processes-service #:key (grace-delay 2))
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