| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 |
|
| 20 | (define-module (gnu services spice)
|
| 21 | #:use-module (gnu packages spice)
|
| 22 | #:use-module (gnu services)
|
| 23 | #:use-module (gnu services shepherd)
|
| 24 | #:use-module (guix deprecation)
|
| 25 | #:use-module (guix gexp)
|
| 26 | #:use-module (guix records)
|
| 27 | #:export (spice-vdagent-configuration
|
| 28 | spice-vdagent-configuration?
|
| 29 | spice-vdagent-service-type))
|
| 30 |
|
| 31 | (define-record-type* <spice-vdagent-configuration>
|
| 32 | spice-vdagent-configuration make-spice-vdagent-configuration
|
| 33 | spice-vdagent-configuration?
|
| 34 | (spice-vdagent spice-vdagent-configuration-spice-vdagent
|
| 35 | (default spice-vdagent)))
|
| 36 |
|
| 37 | (define (spice-vdagent-shepherd-service config)
|
| 38 | "Return a <shepherd-service> for spice-vdagentd with CONFIG."
|
| 39 | (define spice-vdagent (spice-vdagent-configuration-spice-vdagent config))
|
| 40 |
|
| 41 | (define spice-vdagentd-command
|
| 42 | (list
|
| 43 | (file-append spice-vdagent "/sbin/spice-vdagentd")
|
| 44 | "-x"))
|
| 45 |
|
| 46 | (list
|
| 47 | (shepherd-service
|
| 48 | (documentation "Spice vdagentd service")
|
| 49 | (requirement '(user-processes dbus-system))
|
| 50 | (provision '(spice-vdagentd))
|
| 51 | (start #~(lambda args
|
| 52 | |
| 53 | |
| 54 | |
| 55 | (mkdir-p "/run/spice-vdagentd")
|
| 56 | (false-if-exception
|
| 57 | (delete-file "/run/spice-vdagentd/spice-vdagent-sock"))
|
| 58 | (fork+exec-command '#$spice-vdagentd-command)))
|
| 59 | (stop #~(make-kill-destructor)))))
|
| 60 |
|
| 61 | (define spice-vdagent-profile
|
| 62 | (compose list spice-vdagent-configuration-spice-vdagent))
|
| 63 |
|
| 64 | (define spice-vdagent-service-type
|
| 65 | (service-type
|
| 66 | (name 'spice-vdagent)
|
| 67 | (default-value (spice-vdagent-configuration))
|
| 68 | (extensions
|
| 69 | (list (service-extension shepherd-root-service-type
|
| 70 | spice-vdagent-shepherd-service)
|
| 71 | (service-extension profile-service-type
|
| 72 | spice-vdagent-profile)))
|
| 73 | (description "Start the @command{vdagentd} and @command{vdagent} daemons
|
| 74 | from the @code{spice-vdagent} package to enable window resizing and clipboard
|
| 75 | sharing for @acronym{VM, virtual machine} guests.")))
|