* gnu/services/spice.scm: New file. * gnu/packages/spice.scm (spice-vdagent): Set Exec path in spice-vdagent.desktop. * gnu/local.mk (GNU_SYSTEM_MODULES): Add it. --- gnu/local.mk | 1 + gnu/packages/spice.scm | 5 +++++ gnu/services/spice.scm | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 gnu/services/spice.scm
diff --git a/gnu/local.mk b/gnu/local.mk index c789b19..0fce83a 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -384,6 +384,7 @@ GNU_SYSTEM_MODULES = \ %D%/services/networking.scm \ %D%/services/shepherd.scm \ %D%/services/herd.scm \ + %D%/services/spice.scm \ %D%/services/ssh.scm \ %D%/services/web.scm \ %D%/services/xorg.scm \ diff --git a/gnu/packages/spice.scm b/gnu/packages/spice.scm index 1a356b0..1b538fc 100644 --- a/gnu/packages/spice.scm +++ b/gnu/packages/spice.scm @@ -235,6 +235,11 @@ Internet and from a wide variety of machine architectures.") (((string-append "\\$\\(mkdir_p\\) \\$\\(DESTDIR\\)" "\\$\\(localstatedir\\)/run/spice-vdagentd")) "-$(mkdir_p) $(DESTDIR)$(localstatedir)/run/spice-vdagentd")) + #t)) + (add-after 'unpack 'patch-spice-vdagent.desktop + (lambda _ + (substitute* "data/spice-vdagent.desktop" + (("Exec=/usr/bin/spice-vdagent\n") "Exec=spice-vdagent\n")) #t))))) (inputs `(("alsa-lib" ,alsa-lib) diff --git a/gnu/services/spice.scm b/gnu/services/spice.scm new file mode 100644 index 0000000..ff8f2a2 --- /dev/null +++ b/gnu/services/spice.scm @@ -0,0 +1,55 @@ +(define-module (gnu services spice) + #:use-module (gnu packages spice) + #:use-module (gnu services) + #:use-module (gnu services shepherd) + #:use-module (guix gexp) + #:use-module (guix records) + #:export (spice-vdagent-configuration + spice-vdagent-configuration? + spice-vdagent-service-type + spice-vdagent-service)) + +(define-record-type* <spice-vdagent-configuration> + spice-vdagent-configuration make-spice-vdagent-configuration + spice-vdagent-configuration? + (spice-vdagent spice-vdagent-configuration-spice-vdagent + (default spice-vdagent))) + +(define (spice-vdagent-activation config) + "Return the activation gexp for CONFIG." + #~(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 + #~(string-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))))) + +(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 + (compose list + spice-vdagent-configuration-spice-vdagent)))))) + +(define* (spice-vdagent-service + #:optional (config (spice-vdagent-configuration))) + "Start the @command{vdagentd} and @command{vdagent} deamons +from @var{spice-vdagent} to enable guest window resizing and +clipboard sharing." + (service spice-vdagent-service-type config)) -- 2.9.0