spice.scm 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2016 David Craven <david@craven.ch>
  3. ;;; Copyright © 2018–2021 Tobias Geerinckx-Rice <me@tobias.gr>
  4. ;;; Copyright © 2019 Rutger Helling <rhelling@mykolab.com>
  5. ;;; Copyright © 2019, 2020 Marius Bakke <mbakke@fastmail.com>
  6. ;;;
  7. ;;; This file is part of GNU Guix.
  8. ;;;
  9. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  10. ;;; under the terms of the GNU General Public License as published by
  11. ;;; the Free Software Foundation; either version 3 of the License, or (at
  12. ;;; your option) any later version.
  13. ;;;
  14. ;;; GNU Guix is distributed in the hope that it will be useful, but
  15. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ;;; GNU General Public License for more details.
  18. ;;;
  19. ;;; You should have received a copy of the GNU General Public License
  20. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  21. (define-module (gnu packages spice)
  22. #:use-module (gnu packages)
  23. #:use-module (gnu packages autotools)
  24. #:use-module (gnu packages base)
  25. #:use-module (gnu packages compression)
  26. #:use-module (gnu packages cyrus-sasl)
  27. #:use-module (gnu packages gl)
  28. #:use-module (gnu packages glib)
  29. #:use-module (gnu packages gnome)
  30. #:use-module (gnu packages gstreamer)
  31. #:use-module (gnu packages gtk)
  32. #:use-module (gnu packages image)
  33. #:use-module (gnu packages libusb)
  34. #:use-module (gnu packages linux)
  35. #:use-module (gnu packages nss)
  36. #:use-module (gnu packages pkg-config)
  37. #:use-module (gnu packages pulseaudio)
  38. #:use-module (gnu packages python)
  39. #:use-module (gnu packages security-token)
  40. #:use-module (gnu packages tls)
  41. #:use-module (gnu packages xorg)
  42. #:use-module (gnu packages xdisorg)
  43. #:use-module (gnu packages xiph)
  44. #:use-module (gnu packages xml)
  45. #:use-module (guix build-system gnu)
  46. #:use-module (guix build-system meson)
  47. #:use-module (guix download)
  48. #:use-module (guix packages)
  49. #:use-module ((guix licenses) #:prefix license:)
  50. #:use-module (guix utils))
  51. (define-public usbredir
  52. (package
  53. (name "usbredir")
  54. (home-page "https://spice-space.org")
  55. (version "0.9.0")
  56. (source (origin
  57. (method url-fetch)
  58. (uri (string-append home-page "/download/" name "/" name "-"
  59. version ".tar.xz"))
  60. (sha256
  61. (base32
  62. "19jnpzlanq0a1m5lmlcsp50wxf7icxvpvclx7hnf0zxw8azngqd3"))))
  63. (build-system gnu-build-system)
  64. (propagated-inputs
  65. `(("libusb" ,libusb)))
  66. (native-inputs
  67. `(("autoconf" ,autoconf)
  68. ("automake" ,automake)
  69. ("libtool" ,libtool)
  70. ("pkg-config" ,pkg-config)))
  71. (synopsis "Tools for sending USB device traffic over a network")
  72. (description
  73. "Usbredir is a network protocol for sending USB device traffic over a
  74. network connection. It can be used to redirect traffic from a USB device to a
  75. different (virtual) machine than the one to which the USB device is attached.")
  76. (license (list license:gpl2+ license:lgpl2.0+ license:lgpl2.1+))))
  77. (define-public virglrenderer
  78. (package
  79. (name "virglrenderer")
  80. (version "0.6.0")
  81. (source (origin
  82. (method url-fetch)
  83. (uri (string-append
  84. "https://www.freedesktop.org/software/virgl/"
  85. "virglrenderer-" version ".tar.bz2"))
  86. (patches (search-patches "virglrenderer-CVE-2017-6386.patch"))
  87. (sha256
  88. (base32
  89. "06kf0q4l52gzx5p63l8850hff8pmhp7xv1hk8zgx2apbw18y6jd5"))))
  90. (build-system gnu-build-system)
  91. (inputs
  92. `(("libepoxy" ,libepoxy)
  93. ("mesa" ,mesa)
  94. ("udev" ,eudev)))
  95. (native-inputs
  96. `(("pkg-config" ,pkg-config)))
  97. (synopsis "Virtual 3D GPU library")
  98. (description "A virtual 3D GPU library that enables a virtualized operating
  99. system to use the host GPU to accelerate 3D rendering.")
  100. (home-page "https://virgil3d.github.io")
  101. (license (list license:expat license:bsd-3))))
  102. (define-public spice-protocol
  103. (package
  104. (name "spice-protocol")
  105. (version "0.14.3")
  106. (source (origin
  107. (method url-fetch)
  108. (uri (string-append
  109. "https://www.spice-space.org/download/releases/"
  110. "spice-protocol-" version ".tar.xz"))
  111. (sha256
  112. (base32
  113. "0yj8k7gcirrsf21w0q6146n5g4nzn2pqky4p90n5760m5ayfb1pr"))))
  114. (build-system meson-build-system)
  115. (arguments
  116. `(#:phases
  117. (modify-phases %standard-phases
  118. (add-after 'unpack 'install-documentation
  119. (lambda* (#:key outputs #:allow-other-keys)
  120. (let* ((out (assoc-ref outputs "out"))
  121. (doc (string-append out "/share/doc/"
  122. ,name "-" ,version)))
  123. (install-file "COPYING" doc)
  124. #t))))))
  125. (synopsis "Protocol headers for the SPICE protocol")
  126. (description "SPICE (the Simple Protocol for Independent Computing
  127. Environments) is a remote-display system built for virtual environments
  128. which allows users to view a desktop computing environment.")
  129. (home-page "https://www.spice-space.org")
  130. (license (list license:bsd-3 license:lgpl2.1+))))
  131. (define-public spice-gtk
  132. (package
  133. (name "spice-gtk")
  134. (version "0.37")
  135. (source (origin
  136. (method url-fetch)
  137. (uri (string-append
  138. "https://spice-space.org/download/gtk/"
  139. "spice-gtk-" version ".tar.bz2"))
  140. (sha256
  141. (base32
  142. "1drvj8y35gnxbnrxsipwi15yh0vs9ixzv4wslz6r3lra8w3bfa0z"))))
  143. (build-system gnu-build-system)
  144. (propagated-inputs
  145. `(("gstreamer" ,gstreamer)
  146. ("gst-plugins-base" ,gst-plugins-base)
  147. ("gst-plugins-good" ,gst-plugins-good)
  148. ("spice-protocol" ,spice-protocol)
  149. ;; These are required by the pkg-config files.
  150. ("gtk+" ,gtk+)
  151. ("pixman" ,pixman)
  152. ("openssl" ,openssl)))
  153. (inputs
  154. `(("glib-networking" ,glib-networking)
  155. ("gobject-introspection" ,gobject-introspection)
  156. ("json-glib" ,json-glib)
  157. ("libepoxy" ,libepoxy)
  158. ("libjpeg" ,libjpeg-turbo)
  159. ("libxcb" ,libxcb)
  160. ("lz4" ,lz4)
  161. ("mesa" ,mesa)
  162. ("pulseaudio" ,pulseaudio)
  163. ("python" ,python)
  164. ("opus" ,opus)
  165. ("usbredir" ,usbredir)))
  166. (native-inputs
  167. `(("glib:bin" ,glib "bin")
  168. ("intltool" ,intltool)
  169. ("pkg-config" ,pkg-config)
  170. ("vala" ,vala)))
  171. (arguments
  172. `(#:configure-flags
  173. '("--enable-gstaudio"
  174. "--enable-gstvideo"
  175. "--enable-pulse"
  176. "--enable-vala"
  177. "--enable-introspection")
  178. #:phases
  179. (modify-phases %standard-phases
  180. (add-before 'check 'disable-session-test
  181. (lambda _
  182. ;; XXX: Disable session tests, because they require USB support,
  183. ;; which is not available in the build container.
  184. (substitute* "tests/Makefile"
  185. (("test-session\\$\\(EXEEXT\\) ") ""))
  186. #t))
  187. (add-after 'install 'patch-la-files
  188. (lambda* (#:key inputs outputs #:allow-other-keys)
  189. (let ((out (assoc-ref outputs "out"))
  190. (libjpeg (assoc-ref inputs "libjpeg")))
  191. ;; Add an absolute reference for libjpeg in the .la files
  192. ;; so it does not have to be propagated.
  193. (substitute* (find-files (string-append out "/lib") "\\.la$")
  194. (("-ljpeg")
  195. (string-append "-L" libjpeg "/lib -ljpeg")))
  196. #t)))
  197. (add-after
  198. 'install 'wrap-spicy
  199. (lambda* (#:key inputs outputs #:allow-other-keys)
  200. (let ((out (assoc-ref outputs "out"))
  201. (gst-plugin-path (getenv "GST_PLUGIN_SYSTEM_PATH")))
  202. (wrap-program (string-append out "/bin/spicy")
  203. `("GST_PLUGIN_SYSTEM_PATH" ":" prefix (,gst-plugin-path))))
  204. #t)))))
  205. (synopsis "Gtk client and libraries for SPICE remote desktop servers")
  206. (description "Gtk client and libraries for SPICE remote desktop servers.")
  207. (home-page "https://www.spice-space.org")
  208. (license (list license:lgpl2.1+ license:lgpl2.0+))))
  209. (define-public spice
  210. (package
  211. (name "spice")
  212. (version "0.15.0")
  213. (source (origin
  214. (method url-fetch)
  215. (uri (string-append
  216. "https://www.spice-space.org/download/releases/"
  217. "spice-server/spice-" version ".tar.bz2"))
  218. (sha256
  219. (base32
  220. "1xd0xffw0g5vvwbq4ksmm3jjfq45f9dw20xpmi82g1fj9f7wy85k"))))
  221. (build-system gnu-build-system)
  222. (propagated-inputs
  223. `(("openssl" ,openssl)
  224. ("pixman" ,pixman)
  225. ("spice-protocol" ,spice-protocol)))
  226. (inputs
  227. `(("cyrus-sasl" ,cyrus-sasl)
  228. ("glib" ,glib)
  229. ("libjpeg-turbo" ,libjpeg-turbo)
  230. ("libcacard" ,libcacard) ; smartcard support
  231. ("lz4" ,lz4)
  232. ("opus" ,opus)
  233. ("orc" ,orc)
  234. ("zlib" ,zlib)))
  235. (native-inputs
  236. `(("pkg-config" ,pkg-config)
  237. ("python" ,python)
  238. ("spice-gtk" ,spice-gtk)
  239. ;; These are needed for the server listen tests.
  240. ("glib-networking" ,glib-networking)
  241. ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)))
  242. (arguments
  243. `(#:configure-flags
  244. '("--enable-lz4"
  245. "--enable-automated-tests")
  246. #:phases
  247. (modify-phases %standard-phases
  248. ;; XXX: Otherwise the server listen tests fails with
  249. ;; Failed to create /homeless-shelter/.config/glib-2.0/settings
  250. (add-before 'check 'set-XDG_CONFIG_HOME
  251. (lambda _
  252. (setenv "XDG_CONFIG_HOME" "/tmp"))))
  253. ;; Several tests appear to be opening the same sockets concurrently.
  254. #:parallel-tests? #f))
  255. (synopsis "Server implementation of the SPICE protocol")
  256. (description "SPICE is a remote display system built for virtual
  257. environments which allows you to view a computing @code{desktop} environment
  258. not only on the machine where it is running, but from anywhere on the
  259. Internet and from a wide variety of machine architectures.")
  260. (home-page "https://www.spice-space.org")
  261. (license (list license:lgpl2.1+ license:lgpl2.0+))))
  262. (define-public spice-vdagent
  263. (package
  264. (name "spice-vdagent")
  265. (version "0.21.0")
  266. (source (origin
  267. (method url-fetch)
  268. (uri (string-append
  269. "http://www.spice-space.org/download/releases/"
  270. "spice-vdagent-" version ".tar.bz2"))
  271. (sha256
  272. (base32
  273. "0n8jlc1pv6mkry161y656b1nk9hhhminjq6nymzmmyjl7k95ymzx"))))
  274. (build-system gnu-build-system)
  275. (arguments
  276. `(#:configure-flags
  277. '("--localstatedir=/var")
  278. ;; The test-session-info test fails for unknown reasons (see:
  279. ;; https://gitlab.freedesktop.org/spice/linux/vd_agent/-/issues/24).
  280. #:make-flags '("XFAIL_TESTS=tests/test-session-info")
  281. #:phases
  282. (modify-phases %standard-phases
  283. (add-after 'unpack 'patch-makefile.in
  284. (lambda _
  285. (substitute* "Makefile.in"
  286. (((string-append "\\$\\(mkdir_p\\) \\$\\(DESTDIR\\)"
  287. "\\$\\(localstatedir\\)/run/spice-vdagentd"))
  288. "-$(mkdir_p) $(DESTDIR)$(localstatedir)/run/spice-vdagentd"))))
  289. (add-after 'unpack 'patch-spice-vdagent.desktop
  290. (lambda* (#:key outputs #:allow-other-keys)
  291. (substitute* "data/spice-vdagent.desktop"
  292. (("Exec=/usr/bin/spice-vdagent")
  293. (string-append "Exec=" (assoc-ref outputs "out")
  294. "/bin/spice-vdagent")))))
  295. (add-after 'unpack 'fix-test-termination
  296. (lambda _
  297. ;; The termination tests depend on finding the socket file name
  298. ;; in the spice-vdagent command line it launched, but by default
  299. ;; ps truncates its output, which causes the test to fail (see:
  300. ;; https://gitlab.freedesktop.org/spice/linux/vd_agent/-/merge_requests/36).
  301. (substitute* "tests/test-termination.c"
  302. (("ps -ef")
  303. "ps -efww")))))))
  304. (inputs
  305. `(("alsa-lib" ,alsa-lib)
  306. ("dbus" ,dbus)
  307. ("glib" ,glib)
  308. ("gtk+" ,gtk+)
  309. ("libdrm" ,libdrm)
  310. ("libpciaccess" ,libpciaccess)
  311. ("libx11" ,libx11)
  312. ("libxext" ,libxext)
  313. ("libxfixes" ,libxfixes)
  314. ("libxinerama" ,libxinerama)
  315. ("libxrandr" ,libxrandr)
  316. ("spice-protocol" ,spice-protocol)))
  317. (native-inputs
  318. `(("pkg-config" ,pkg-config)
  319. ("procps" ,procps))) ;tests use 'ps'
  320. (synopsis "Spice agent for Linux")
  321. (description "Spice-vdagent enables sharing the clipboard and guest display
  322. resolution scaling on graphical console window resize.")
  323. (home-page "https://www.spice-space.org")
  324. (license license:gpl3+)))
  325. (define-public libcacard
  326. (package
  327. (name "libcacard")
  328. (version "2.8.0")
  329. (source (origin
  330. (method url-fetch)
  331. (uri (string-append
  332. "https://gitlab.freedesktop.org/spice/libcacard/uploads/"
  333. "9d8f24b131bcbbd7846727ea92952cb5"
  334. "/libcacard-" version ".tar.xz"))
  335. (patches (search-patches "libcacard-unknown-variable.patch"))
  336. (sha256
  337. (base32
  338. "0azj3rqr2smg0lai24xrn3zr628xmjfrzcggay877zrr64ybj1c0"))))
  339. (build-system meson-build-system)
  340. (propagated-inputs
  341. `(("glib" ,glib) ; Requires: in the pkg-config file
  342. ("nss" ,nss) ; Requires.private: in the pkg-config
  343. ("pcsc-lite" ,pcsc-lite))) ; file
  344. (native-inputs
  345. `(("openssl" ,openssl)
  346. ("nss" ,nss "bin")
  347. ("opensc" ,opensc)
  348. ("gnutls" ,gnutls)
  349. ("pkg-config" ,pkg-config)
  350. ("which" ,which)))
  351. (synopsis "Emulate and share smart cards with virtual machines")
  352. (description
  353. "The @acronym{CAC,Common Access Card} library can be used to emulate and
  354. share smart cards from client system to local or remote virtual machines.")
  355. (home-page "https://gitlab.freedesktop.org/spice/libcacard")
  356. (license license:lgpl2.1+)))
  357. (define-public virt-viewer
  358. (package
  359. (name "virt-viewer")
  360. (version "7.0")
  361. (source (origin
  362. (method url-fetch)
  363. (uri (string-append
  364. "https://virt-manager.org/download/sources/virt-viewer/"
  365. "virt-viewer-" version ".tar.gz"))
  366. (sha256
  367. (base32
  368. "00y9vi69sja4pkrfnvrkwsscm41bqrjzvp8aijb20pvg6ymczhj7"))))
  369. (build-system gnu-build-system)
  370. (inputs
  371. `(("gtk+" ,gtk+)
  372. ("gtk-vnc" ,gtk-vnc)
  373. ("libcap" ,libcap)
  374. ("libxml2" ,libxml2)
  375. ("spice-gtk" ,spice-gtk)))
  376. (native-inputs
  377. `(("glib:bin" ,glib "bin")
  378. ("intltool" ,intltool)
  379. ("pkg-config" ,pkg-config)))
  380. (arguments
  381. `(#:configure-flags
  382. '("--with-spice-gtk")
  383. #:phases
  384. (modify-phases %standard-phases
  385. (add-after
  386. 'install 'wrap-remote-viewer
  387. (lambda* (#:key inputs outputs #:allow-other-keys)
  388. (let ((out (assoc-ref outputs "out"))
  389. (gst-plugin-path (getenv "GST_PLUGIN_SYSTEM_PATH")))
  390. (wrap-program (string-append out "/bin/remote-viewer")
  391. `("GST_PLUGIN_SYSTEM_PATH" ":" prefix (,gst-plugin-path))))
  392. #t)))))
  393. (synopsis "Graphical console client for virtual machines")
  394. (description "Graphical console client for virtual machines using SPICE or
  395. VNC.")
  396. (home-page "https://virt-manager.org")
  397. (license license:gpl2+)))