summary refs log tree commit diff
path: root/gnu/services/spice.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2021-05-15 22:55:24 +0200
committerLudovic Courtès <ludo@gnu.org>2021-05-15 22:55:24 +0200
commit25487c3fe6a41dd62f6e53f256392224a3be2a08 (patch)
tree1051a1716d962ba0a7bbbf9dc8f7b67aa2674400 /gnu/services/spice.scm
parent4a9597e4516ec5ca58df3e007fcd5ef1d3fd2e54 (diff)
parent46eac03e720e9b21d225e2ec1c41299c09202d18 (diff)
downloadguix-25487c3fe6a41dd62f6e53f256392224a3be2a08.tar.gz
Merge branch 'master' into core-updates
Diffstat (limited to 'gnu/services/spice.scm')
-rw-r--r--gnu/services/spice.scm45
1 files changed, 23 insertions, 22 deletions
diff --git a/gnu/services/spice.scm b/gnu/services/spice.scm
index fd85dc234f..3b88e29043 100644
--- a/gnu/services/spice.scm
+++ b/gnu/services/spice.scm
@@ -34,41 +34,42 @@
   (spice-vdagent spice-vdagent-configuration-spice-vdagent
                  (default spice-vdagent)))
 
-(define (spice-vdagent-activation config)
-  "Return the activation gexp for CONFIG."
-  #~(begin
-      (use-modules (guix build utils))
-      (mkdir-p "/var/run/spice-vdagentd")))
-
 (define (spice-vdagent-shepherd-service config)
   "Return a <shepherd-service> for spice-vdagentd with CONFIG."
   (define spice-vdagent (spice-vdagent-configuration-spice-vdagent config))
 
   (define spice-vdagentd-command
     (list
-      (file-append spice-vdagent "/sbin/spice-vdagentd")
-      "-x"))
+     (file-append spice-vdagent "/sbin/spice-vdagentd")
+     "-x"))
 
   (list
-    (shepherd-service
-      (documentation "Spice vdagentd service")
-      (requirement '(udev))
-      (provision '(spice-vdagentd))
-      (start #~(make-forkexec-constructor '#$spice-vdagentd-command))
-      (stop #~(make-kill-destructor)))))
+   (shepherd-service
+    (documentation "Spice vdagentd service")
+    (requirement '(dbus-system))
+    (provision '(spice-vdagentd))
+    (start #~(lambda args
+               ;; spice-vdagentd supports being activated upon the client
+               ;; connecting to its socket; when not using such feature, the
+               ;; socket should not exist before vdagentd creates it itself.
+               (mkdir-p "/run/spice-vdagentd")
+               (false-if-exception
+                (delete-file "/run/spice-vdagentd/spice-vdagent-sock"))
+               (fork+exec-command '#$spice-vdagentd-command)))
+    (stop #~(make-kill-destructor)))))
 
 (define spice-vdagent-profile
   (compose list spice-vdagent-configuration-spice-vdagent))
 
 (define spice-vdagent-service-type
-  (service-type (name 'spice-vdagent)
-    (extensions
-      (list (service-extension shepherd-root-service-type
-                               spice-vdagent-shepherd-service)
-            (service-extension activation-service-type
-                               spice-vdagent-activation)
-            (service-extension profile-service-type
-                               spice-vdagent-profile)))))
+  (service-type
+   (name 'spice-vdagent)
+   (default-value (spice-vdagent-configuration))
+   (extensions
+    (list (service-extension shepherd-root-service-type
+                             spice-vdagent-shepherd-service)
+          (service-extension profile-service-type
+                             spice-vdagent-profile)))))
 
 (define* (spice-vdagent-service
           #:optional (config (spice-vdagent-configuration)))