virtualization.scm 91 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2015, 2016, 2017, 2018 Mark H Weaver <mhw@netris.org>
  4. ;;; Copyright © 2016, 2017, 2018. 2019, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
  5. ;;; Copyright © 2016, 2017 Ricardo Wurmus <rekado@elephly.net>
  6. ;;; Copyright © 2017 Alex Vong <alexvong1995@gmail.com>
  7. ;;; Copyright © 2017 Andy Patterson <ajpatter@uwaterloo.ca>
  8. ;;; Copyright © 2017, 2018, 2019 Rutger Helling <rhelling@mykolab.com>
  9. ;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <me@tobias.gr>
  10. ;;; Copyright © 2018 Danny Milosavljevic <dannym@scratchpost.org>
  11. ;;; Copyright © 2018 Sou Bunnbu <iyzsong@member.fsf.org>
  12. ;;; Copyright © 2018 Julien Lepiller <julien@lepiller.eu>
  13. ;;; Copyright © 2019 Guy Fleury Iteriteka <hoonandon@gmail.com>
  14. ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
  15. ;;; Copyright © 2020, 2021 Brice Waegeneire <brice@waegenei.re>
  16. ;;; Copyright © 2020 Mathieu Othacehe <m.othacehe@gmail.com>
  17. ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
  18. ;;; Copyright © 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
  19. ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
  20. ;;; Copyright © 2021 Leo Famulari <leo@famulari.name>
  21. ;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
  22. ;;; Copyright © 2021 Dion Mendel <guix@dm9.info>
  23. ;;;
  24. ;;; This file is part of GNU Guix.
  25. ;;;
  26. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  27. ;;; under the terms of the GNU General Public License as published by
  28. ;;; the Free Software Foundation; either version 3 of the License, or (at
  29. ;;; your option) any later version.
  30. ;;;
  31. ;;; GNU Guix is distributed in the hope that it will be useful, but
  32. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  33. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  34. ;;; GNU General Public License for more details.
  35. ;;;
  36. ;;; You should have received a copy of the GNU General Public License
  37. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  38. (define-module (gnu packages virtualization)
  39. #:use-module (gnu packages)
  40. #:use-module (gnu packages acl)
  41. #:use-module (gnu packages admin)
  42. #:use-module (gnu packages assembly)
  43. #:use-module (gnu packages attr)
  44. #:use-module (gnu packages autotools)
  45. #:use-module (gnu packages backup)
  46. #:use-module (gnu packages base)
  47. #:use-module (gnu packages bash)
  48. #:use-module (gnu packages bison)
  49. #:use-module (gnu packages build-tools)
  50. #:use-module (gnu packages check)
  51. #:use-module (gnu packages cmake)
  52. #:use-module (gnu packages compression)
  53. #:use-module (gnu packages cross-base)
  54. #:use-module (gnu packages curl)
  55. #:use-module (gnu packages cyrus-sasl)
  56. #:use-module (gnu packages debian)
  57. #:use-module (gnu packages disk)
  58. #:use-module (gnu packages dns)
  59. #:use-module (gnu packages docbook)
  60. #:use-module (gnu packages documentation)
  61. #:use-module (gnu packages figlet)
  62. #:use-module (gnu packages firmware)
  63. #:use-module (gnu packages flex)
  64. #:use-module (gnu packages fontutils)
  65. #:use-module (gnu packages freedesktop)
  66. #:use-module (gnu packages gettext)
  67. #:use-module (gnu packages gl)
  68. #:use-module (gnu packages glib)
  69. #:use-module (gnu packages gnome)
  70. #:use-module (gnu packages gnupg)
  71. #:use-module (gnu packages golang)
  72. #:use-module (gnu packages graphviz)
  73. #:use-module (gnu packages gtk)
  74. #:use-module (gnu packages haskell)
  75. #:use-module (gnu packages haskell-apps)
  76. #:use-module (gnu packages haskell-check)
  77. #:use-module (gnu packages haskell-crypto)
  78. #:use-module (gnu packages haskell-web)
  79. #:use-module (gnu packages haskell-xyz)
  80. #:use-module (gnu packages image)
  81. #:use-module (gnu packages libbsd)
  82. #:use-module (gnu packages libusb)
  83. #:use-module (gnu packages linux)
  84. #:use-module (gnu packages m4)
  85. #:use-module (gnu packages ncurses)
  86. #:use-module (gnu packages nettle)
  87. #:use-module (gnu packages networking)
  88. #:use-module (gnu packages ninja)
  89. #:use-module (gnu packages onc-rpc)
  90. #:use-module (gnu packages package-management)
  91. #:use-module (gnu packages perl)
  92. #:use-module (gnu packages pcre)
  93. #:use-module (gnu packages pkg-config)
  94. #:use-module (gnu packages polkit)
  95. #:use-module (gnu packages protobuf)
  96. #:use-module (gnu packages python)
  97. #:use-module (gnu packages python-build)
  98. #:use-module (gnu packages python-check)
  99. #:use-module (gnu packages python-crypto)
  100. #:use-module (gnu packages python-web)
  101. #:use-module (gnu packages python-xyz)
  102. #:use-module (gnu packages pulseaudio)
  103. #:use-module (gnu packages readline)
  104. #:use-module (gnu packages selinux)
  105. #:use-module (gnu packages sdl)
  106. #:use-module (gnu packages sphinx)
  107. #:use-module (gnu packages spice)
  108. #:use-module (gnu packages ssh)
  109. #:use-module (gnu packages texinfo)
  110. #:use-module (gnu packages textutils)
  111. #:use-module (gnu packages tls)
  112. #:use-module (gnu packages web)
  113. #:use-module (gnu packages wget)
  114. #:use-module (gnu packages xdisorg)
  115. #:use-module (gnu packages xml)
  116. #:use-module (gnu packages xorg)
  117. #:use-module (guix build-system cmake)
  118. #:use-module (guix build-system gnu)
  119. #:use-module (guix build-system go)
  120. #:use-module (guix build-system meson)
  121. #:use-module (guix build-system python)
  122. #:use-module (guix build-system trivial)
  123. #:use-module (guix download)
  124. #:use-module (guix git-download)
  125. #:use-module ((guix licenses) #:prefix license:)
  126. #:use-module (guix packages)
  127. #:use-module (guix utils)
  128. #:use-module (srfi srfi-1)
  129. #:use-module (srfi srfi-26)
  130. #:use-module (ice-9 match))
  131. (define (qemu-patch commit file-name sha256-bv)
  132. "Return an origin for COMMIT."
  133. (origin
  134. (method url-fetch)
  135. (uri (string-append
  136. "http://git.qemu.org/?p=qemu.git;a=commitdiff_plain;h="
  137. commit))
  138. (hash (content-hash sha256-bv sha256))
  139. (file-name file-name)))
  140. (define-public qemu
  141. (package
  142. (name "qemu")
  143. (version "6.0.0")
  144. (source
  145. (origin
  146. (method url-fetch)
  147. (uri (string-append "https://download.qemu.org/qemu-"
  148. version ".tar.xz"))
  149. (sha256
  150. (base32
  151. "1f9hz8rf12jm8baa7kda34yl4hyl0xh0c4ap03krfjx23i3img47"))
  152. (patches (search-patches "qemu-CVE-2021-20203.patch"
  153. "qemu-meson-compat.patch"
  154. "qemu-sphinx-compat.patch"
  155. "qemu-build-info-manual.patch"))
  156. (modules '((guix build utils)))
  157. (snippet
  158. '(begin
  159. ;; Delete the bundled meson copy.
  160. (delete-file-recursively "meson")))))
  161. (outputs '("out" "static" "doc")) ;5.3 MiB of HTML docs
  162. (build-system gnu-build-system)
  163. (arguments
  164. ;; FIXME: Disable tests on i686 to work around
  165. ;; <https://bugs.gnu.org/40527>.
  166. `(#:tests? ,(or (%current-target-system)
  167. (not (string=? "i686-linux" (%current-system))))
  168. #:configure-flags
  169. (let ((gcc (string-append (assoc-ref %build-inputs "gcc") "/bin/gcc"))
  170. (out (assoc-ref %outputs "out")))
  171. (list (string-append "--cc=" gcc)
  172. ;; Some architectures insist on using HOST_CC.
  173. (string-append "--host-cc=" gcc)
  174. (string-append "--prefix=" out)
  175. "--sysconfdir=/etc"
  176. (string-append "--smbd=" out "/libexec/samba-wrapper")
  177. "--disable-debug-info" ;for space considerations
  178. ;; The binaries need to be linked against -lrt.
  179. (string-append "--extra-ldflags=-lrt")))
  180. ;; Make build and test output verbose to facilitate investigation upon failure.
  181. #:make-flags '("V=1")
  182. #:modules ((srfi srfi-1)
  183. (srfi srfi-26)
  184. (ice-9 ftw)
  185. (ice-9 match)
  186. ,@%gnu-build-system-modules)
  187. #:phases
  188. (modify-phases %standard-phases
  189. (add-after 'unpack 'extend-test-time-outs
  190. (lambda _
  191. ;; These tests can time out on heavily-loaded and/or slow storage.
  192. (substitute* (cons* "tests/qemu-iotests/common.qemu"
  193. (find-files "tests/qemu-iotests" "^[0-9]+$"))
  194. (("QEMU_COMM_TIMEOUT=[0-9]+" match)
  195. (string-append match "9")))))
  196. (add-after 'unpack 'disable-unusable-tests
  197. (lambda _
  198. (substitute* "tests/unit/meson.build"
  199. ;; Comment out the test-qga test, which needs /sys and
  200. ;; fails within the build environment.
  201. (("tests.*test-qga.*$" all)
  202. (string-append "# " all))
  203. ;; Comment out the test-char test, which needs networking and
  204. ;; fails within the build environment.
  205. ((".*'test-char':.*" all)
  206. (string-append "# " all)))))
  207. (add-after 'patch-source-shebangs 'patch-embedded-shebangs
  208. (lambda _
  209. ;; Ensure the executables created by these source files reference
  210. ;; /bin/sh from the store so they work inside the build container.
  211. (substitute* '("block/cloop.c" "migration/exec.c"
  212. "net/tap.c" "tests/qtest/libqtest.c")
  213. (("/bin/sh") (which "sh")))
  214. (substitute* "Makefile"
  215. (("SHELL = /usr/bin/env bash -o pipefail")
  216. "SHELL = bash -o pipefail"))
  217. (substitute* "tests/qemu-iotests/check"
  218. (("#!/usr/bin/env python3")
  219. (string-append "#!" (which "python3"))))))
  220. (add-before 'configure 'fix-optionrom-makefile
  221. (lambda _
  222. ;; Work around the inability of the rules defined in this
  223. ;; Makefile to locate the firmware files (e.g.: No rule to make
  224. ;; target 'multiboot.bin') by extending the VPATH.
  225. (substitute* "pc-bios/optionrom/Makefile"
  226. (("^VPATH = \\$\\(SRC_DIR\\)")
  227. "VPATH = $(SRC_DIR):$(TOPSRC_DIR)/pc-bios"))))
  228. ;; XXX ./configure is being re-run at beginning of build phase...
  229. (replace 'configure
  230. (lambda* (#:key inputs outputs configure-flags #:allow-other-keys)
  231. ;; The `configure' script doesn't understand some of the
  232. ;; GNU options. Thus, add a new phase that's compatible.
  233. (let ((out (assoc-ref outputs "out")))
  234. (setenv "SHELL" (which "bash"))
  235. ;; Ensure config.status gets the correct shebang off the bat.
  236. ;; The build system gets confused if we change it later and
  237. ;; attempts to re-run the whole configuration, and fails.
  238. (substitute* "configure"
  239. (("#!/bin/sh")
  240. (string-append "#!" (which "sh"))))
  241. (mkdir-p "b/qemu")
  242. (chdir "b/qemu")
  243. (apply invoke "../../configure" configure-flags))))
  244. ;; Configure, build and install QEMU user-emulation static binaries.
  245. (add-after 'configure 'configure-user-static
  246. (lambda* (#:key inputs outputs #:allow-other-keys)
  247. (let* ((gcc (search-input-file inputs "/bin/gcc"))
  248. (static (assoc-ref outputs "static"))
  249. ;; This is the common set of configure flags; it is
  250. ;; duplicated here to isolate this phase from manipulations
  251. ;; to the #:configure-flags build argument, as done in
  252. ;; derived packages such as qemu-minimal.
  253. (configure-flags (list (string-append "--cc=" gcc)
  254. (string-append "--host-cc=" gcc)
  255. "--sysconfdir=/etc"
  256. "--disable-debug-info")))
  257. (mkdir-p "../user-static")
  258. (with-directory-excursion "../user-static"
  259. (apply invoke "../../configure"
  260. "--static"
  261. "--disable-docs" ;already built
  262. "--disable-system"
  263. "--enable-linux-user"
  264. (string-append "--prefix=" static)
  265. configure-flags)))))
  266. (add-after 'build 'build-user-static
  267. (lambda args
  268. (with-directory-excursion "../user-static"
  269. (apply (assoc-ref %standard-phases 'build) args))))
  270. (add-after 'install 'install-user-static
  271. (lambda* (#:key outputs #:allow-other-keys)
  272. (let* ((static (assoc-ref outputs "static"))
  273. (bin (string-append static "/bin")))
  274. (with-directory-excursion "../user-static"
  275. (for-each (cut install-file <> bin)
  276. (append-map (cut find-files <> "^qemu-" #:stat stat)
  277. (scandir "."
  278. (cut string-suffix?
  279. "-linux-user" <>))))))))
  280. ;; Create a wrapper for Samba. This allows QEMU to use Samba without
  281. ;; pulling it in as an input. Note that you need to explicitly install
  282. ;; Samba in your Guix profile for Samba support.
  283. (add-after 'install 'create-samba-wrapper
  284. (lambda* (#:key inputs outputs #:allow-other-keys)
  285. (let* ((out (assoc-ref outputs "out"))
  286. (libexec (string-append out "/libexec")))
  287. (call-with-output-file "samba-wrapper"
  288. (lambda (port)
  289. (format port "#!/bin/sh
  290. exec smbd $@")))
  291. (chmod "samba-wrapper" #o755)
  292. (install-file "samba-wrapper" libexec))))
  293. (add-after 'install 'move-html-doc
  294. (lambda* (#:key inputs outputs #:allow-other-keys)
  295. (let* ((out (assoc-ref outputs "out"))
  296. (doc (assoc-ref outputs "doc"))
  297. (qemu-doc (string-append doc "/share/doc/qemu-" ,version)))
  298. (mkdir-p qemu-doc)
  299. (rename-file (string-append out "/share/doc/qemu")
  300. (string-append qemu-doc "/html"))))))))
  301. (inputs ; TODO: Add optional inputs.
  302. `(("alsa-lib" ,alsa-lib)
  303. ("attr" ,attr)
  304. ("glib" ,glib)
  305. ("gtk+" ,gtk+)
  306. ("libaio" ,libaio)
  307. ("libattr" ,attr)
  308. ("libcacard" ,libcacard) ; smartcard support
  309. ("libcap-ng" ,libcap-ng) ; virtfs support requires libcap-ng & libattr
  310. ("libdrm" ,libdrm)
  311. ("libepoxy" ,libepoxy)
  312. ("libjpeg" ,libjpeg-turbo)
  313. ("libpng" ,libpng)
  314. ("libseccomp" ,libseccomp)
  315. ("libusb" ,libusb) ;USB pass-through support
  316. ("mesa" ,mesa)
  317. ("ncurses" ,ncurses)
  318. ;; ("pciutils" ,pciutils)
  319. ("pixman" ,pixman)
  320. ("pulseaudio" ,pulseaudio)
  321. ("sdl2" ,sdl2)
  322. ("spice" ,spice)
  323. ("usbredir" ,usbredir)
  324. ("util-linux" ,util-linux)
  325. ("vde2" ,vde2)
  326. ("virglrenderer" ,virglrenderer)
  327. ("zlib" ,zlib)))
  328. (native-inputs `(("gettext" ,gettext-minimal)
  329. ("glib:bin" ,glib "bin") ; gtester, etc.
  330. ("perl" ,perl)
  331. ("flex" ,flex)
  332. ("bison" ,bison)
  333. ("meson" ,meson)
  334. ("ninja" ,ninja)
  335. ("pkg-config" ,pkg-config)
  336. ("python-wrapper" ,python-wrapper)
  337. ("python-sphinx" ,python-sphinx)
  338. ("texinfo" ,texinfo)
  339. ;; The following static libraries are required to build
  340. ;; the static output of QEMU.
  341. ("glib:static" ,glib "static")
  342. ("pcre:static" ,pcre "static")
  343. ("zlib:static" ,zlib "static")))
  344. (home-page "https://www.qemu.org")
  345. (synopsis "Machine emulator and virtualizer")
  346. (description
  347. "QEMU is a generic machine emulator and virtualizer.
  348. When used as a machine emulator, QEMU can run OSes and programs made for one
  349. machine (e.g. an ARM board) on a different machine---e.g., your own PC. By
  350. using dynamic translation, it achieves very good performance.
  351. When used as a virtualizer, QEMU achieves near native performances by
  352. executing the guest code directly on the host CPU. QEMU supports
  353. virtualization when executing under the Xen hypervisor or using
  354. the KVM kernel module in Linux. When using KVM, QEMU can virtualize x86,
  355. server and embedded PowerPC, and S390 guests.")
  356. ;; Many files are GPLv2+, but some are GPLv2-only---e.g., `memory.c'.
  357. (license license:gpl2)
  358. ;; Several tests fail on MIPS; see <http://hydra.gnu.org/build/117914>.
  359. (supported-systems (fold delete %supported-systems
  360. '("mips64el-linux" "i586-gnu")))))
  361. (define-public qemu-minimal
  362. ;; QEMU without GUI support, only supporting the host's architecture
  363. (package
  364. (inherit qemu)
  365. (name "qemu-minimal")
  366. (outputs '("out" "doc"))
  367. (synopsis
  368. "Machine emulator and virtualizer (without GUI) for the host architecture")
  369. (arguments
  370. (substitute-keyword-arguments (package-arguments qemu)
  371. ((#:configure-flags configure-flags '(list))
  372. ;; Restrict to the host's architecture.
  373. (let* ((system (or (%current-target-system)
  374. (%current-system)))
  375. (target-list-arg
  376. (match system
  377. ((? (cut string-prefix? "i686" <>))
  378. "--target-list=i386-softmmu")
  379. ((? (cut string-prefix? "x86_64" <>))
  380. "--target-list=i386-softmmu,x86_64-softmmu")
  381. ((? (cut string-prefix? "mips64" <>))
  382. (string-append "--target-list=mips-softmmu,mipsel-softmmu,"
  383. "mips64-softmmu,mips64el-softmmu"))
  384. ((? (cut string-prefix? "mips" <>))
  385. "--target-list=mips-softmmu,mipsel-softmmu")
  386. ((? (cut string-prefix? "aarch64" <>))
  387. "--target-list=arm-softmmu,aarch64-softmmu")
  388. ((? (cut string-prefix? "arm" <>))
  389. "--target-list=arm-softmmu")
  390. ((? (cut string-prefix? "alpha" <>))
  391. "--target-list=alpha-softmmu")
  392. ((? (cut string-prefix? "powerpc64" <>))
  393. "--target-list=ppc-softmmu,ppc64-softmmu")
  394. ((? (cut string-prefix? "powerpc" <>))
  395. "--target-list=ppc-softmmu")
  396. ((? (cut string-prefix? "s390" <>))
  397. "--target-list=s390x-softmmu")
  398. ((? (cut string-prefix? "riscv" <>))
  399. "--target-list=riscv32-softmmu,riscv64-softmmu")
  400. (else ; An empty list actually builds all the targets.
  401. '()))))
  402. `(cons ,target-list-arg ,configure-flags)))
  403. ((#:phases phases)
  404. `(modify-phases ,phases
  405. (delete 'configure-user-static)
  406. (delete 'build-user-static)
  407. (delete 'install-user-static)))))
  408. ;; Remove dependencies on optional libraries, notably GUI libraries.
  409. (native-inputs (fold alist-delete (package-native-inputs qemu)
  410. '("gettext" "glib:static" "pcre:static" "zlib:static")))
  411. (inputs (fold alist-delete (package-inputs qemu)
  412. '("libusb" "mesa" "sdl2" "spice" "virglrenderer" "gtk+"
  413. "usbredir" "libdrm" "libepoxy" "pulseaudio" "vde2"
  414. "libcacard")))))
  415. (define (system->qemu-target system)
  416. (cond
  417. ((string-prefix? "i686" system)
  418. "qemu-system-i386")
  419. ((string-prefix? "arm" system)
  420. "qemu-system-arm")
  421. (else
  422. (string-append "qemu-system-" (match (string-split system #\-)
  423. ((arch kernel) arch)
  424. (_ system))))))
  425. (define-public ganeti
  426. (package
  427. (name "ganeti")
  428. ;; Note: we use a pre-release for Python 3 compatibility as well as many
  429. ;; other fixes.
  430. (version "3.0.0beta1-24-g024cc9fa2")
  431. (source (origin
  432. (method git-fetch)
  433. (uri (git-reference
  434. (url "https://github.com/ganeti/ganeti")
  435. (commit (string-append "v" version))))
  436. (sha256
  437. (base32 "1ll34qd2mifni3bhg7cnir3xfnkafig8ch33qndqwrsby0y5ssia"))
  438. (file-name (git-file-name name version))
  439. (patches (search-patches "ganeti-shepherd-support.patch"
  440. "ganeti-shepherd-master-failover.patch"
  441. "ganeti-deterministic-manual.patch"
  442. "ganeti-drbd-compat.patch"
  443. "ganeti-os-disk-size.patch"
  444. "ganeti-haskell-pythondir.patch"
  445. "ganeti-disable-version-symlinks.patch"))))
  446. (build-system gnu-build-system)
  447. (arguments
  448. `(#:imported-modules (,@%gnu-build-system-modules
  449. (guix build haskell-build-system)
  450. (guix build python-build-system))
  451. #:modules (,@%gnu-build-system-modules
  452. ((guix build haskell-build-system) #:prefix haskell:)
  453. (ice-9 rdelim))
  454. ;; The default test target includes a lot of checks that are only really
  455. ;; relevant for developers such as NEWS file checking, line lengths, etc.
  456. ;; We are only interested in the "py-tests" and "hs-tests" targets: this
  457. ;; is the closest we've got even though it includes a little more.
  458. #:test-target "check-TESTS"
  459. #:configure-flags
  460. (list "--localstatedir=/var"
  461. "--sharedstatedir=/var"
  462. "--sysconfdir=/etc"
  463. "--enable-haskell-tests"
  464. ;; By default, the build system installs everything to versioned
  465. ;; directories such as $libdir/3.0 and relies on a $libdir/default
  466. ;; symlink pointed from /etc/ganeti/{lib,share} to actually function.
  467. ;; This is done to accommodate installing multiple versions in
  468. ;; parallel, but is of little use to us as Guix users can just
  469. ;; roll back and forth. Thus, disable it for simplicity.
  470. "--disable-version-links"
  471. ;; Ganeti can optionally take control over SSH host keys and
  472. ;; distribute them to nodes as they are added, and also rotate keys
  473. ;; with 'gnt-cluster renew-crypto --new-ssh-keys'. Thus it needs to
  474. ;; know how to restart the SSH daemon.
  475. "--with-sshd-restart-command='herd restart ssh-daemon'"
  476. ;; Look for OS definitions in this directory by default. It can
  477. ;; be changed in the cluster configuration.
  478. "--with-os-search-path=/run/current-system/profile/share/ganeti/os"
  479. ;; The default QEMU executable to use. We don't use the package
  480. ;; here because this entry is stored in the cluster configuration.
  481. (string-append "--with-kvm-path=/run/current-system/profile/bin/"
  482. ,(system->qemu-target (%current-system))))
  483. #:phases
  484. (modify-phases %standard-phases
  485. (add-after 'unpack 'create-vcs-version
  486. (lambda _
  487. ;; If we are building from a git checkout, we need to create a
  488. ;; 'vcs-version' file manually because the build system does
  489. ;; not have access to the git repository information.
  490. (unless (file-exists? "vcs-version")
  491. (call-with-output-file "vcs-version"
  492. (lambda (port)
  493. (format port "v~a~%" ,version))))))
  494. (add-after 'unpack 'patch-absolute-file-names
  495. (lambda _
  496. (substitute* '("lib/utils/process.py"
  497. "lib/utils/text.py"
  498. "src/Ganeti/Constants.hs"
  499. "src/Ganeti/HTools/CLI.hs"
  500. "test/py/ganeti.config_unittest.py"
  501. "test/py/ganeti.hooks_unittest.py"
  502. "test/py/ganeti.utils.process_unittest.py"
  503. "test/py/ganeti.utils.text_unittest.py"
  504. "test/py/ganeti.utils.wrapper_unittest.py")
  505. (("/bin/sh") (which "sh"))
  506. (("/bin/bash") (which "bash"))
  507. (("/usr/bin/env") (which "env"))
  508. (("/bin/true") (which "true")))
  509. ;; This script is called by the node daemon at startup to perform
  510. ;; sanity checks on the cluster IP addresses, and it is also used
  511. ;; in a master-failover scenario. Add absolute references to
  512. ;; avoid propagating these executables.
  513. (substitute* "tools/master-ip-setup"
  514. (("arping") (which "arping"))
  515. (("ndisc6") (which "ndisc6"))
  516. (("fping") (which "fping"))
  517. (("grep") (which "grep"))
  518. (("ip addr") (string-append (which "ip") " addr")))))
  519. (add-after 'unpack 'override-builtin-PATH
  520. (lambda _
  521. ;; Ganeti runs OS install scripts and similar with a built-in
  522. ;; hard coded PATH. Patch so it works on Guix System.
  523. (substitute* "src/Ganeti/Constants.hs"
  524. (("/sbin:/bin:/usr/sbin:/usr/bin")
  525. "/run/setuid-programs:/run/current-system/profile/sbin:\
  526. /run/current-system/profile/bin"))))
  527. (add-after 'bootstrap 'patch-sphinx-version-detection
  528. (lambda _
  529. ;; The build system runs 'sphinx-build --version' to verify that
  530. ;; the Sphinx is recent enough, but does not expect the
  531. ;; .sphinx-build-real executable name created by the Sphinx wrapper.
  532. (substitute* "configure"
  533. (("\\$SPHINX --version 2>&1")
  534. "$SPHINX --version 2>&1 \
  535. | sed 's/.sphinx-build-real/sphinx-build/g'"))))
  536. ;; The build system invokes Cabal and GHC, which do not work with
  537. ;; GHC_PACKAGE_PATH: <https://github.com/haskell/cabal/issues/3728>.
  538. ;; Tweak the build system to do roughly what haskell-build-system does.
  539. (add-before 'configure 'configure-haskell
  540. (assoc-ref haskell:%standard-phases 'setup-compiler))
  541. (add-after 'configure 'do-not-use-GHC_PACKAGE_PATH
  542. (lambda _
  543. (unsetenv "GHC_PACKAGE_PATH")
  544. (substitute* "Makefile"
  545. (("\\$\\(CABAL\\)")
  546. "$(CABAL) --package-db=../package.conf.d")
  547. (("\\$\\(GHC\\)")
  548. "$(GHC) -package-db=../package.conf.d"))))
  549. (add-after 'configure 'make-ghc-use-shared-libraries
  550. (lambda _
  551. (substitute* "Makefile"
  552. (("HFLAGS =") "HFLAGS = -dynamic -fPIC"))))
  553. (add-after 'configure 'fix-installation-directories
  554. (lambda _
  555. (substitute* "Makefile"
  556. ;; Do not attempt to create /var during install.
  557. (("\\$\\(DESTDIR\\)\\$\\{localstatedir\\}")
  558. "$(DESTDIR)${prefix}${localstatedir}")
  559. ;; Similarly, do not attempt to install the sample ifup scripts
  560. ;; to /etc/ganeti.
  561. (("\\$\\(DESTDIR\\)\\$\\(ifupdir\\)")
  562. "$(DESTDIR)${prefix}$(ifupdir)"))))
  563. (add-before 'build 'adjust-tests
  564. (lambda _
  565. ;; Disable tests that can not run. Do it early to prevent
  566. ;; touching the Makefile later and triggering a needless rebuild.
  567. (substitute* "Makefile"
  568. ;; These tests expect the presence of a 'root' user (via
  569. ;; ganeti/runtime.py), which fails in the build environment.
  570. (("test/py/ganeti\\.asyncnotifier_unittest\\.py") "")
  571. (("test/py/ganeti\\.backend_unittest\\.py") "")
  572. (("test/py/ganeti\\.daemon_unittest\\.py") "")
  573. (("test/py/ganeti\\.tools\\.ensure_dirs_unittest\\.py") "")
  574. (("test/py/ganeti\\.utils\\.io_unittest-runasroot\\.py") "")
  575. ;; Disable the bash_completion test, as it requires the full
  576. ;; bash instead of bash-minimal.
  577. (("test/py/bash_completion\\.bash")
  578. "")
  579. ;; This test requires networking.
  580. (("test/py/import-export_unittest\\.bash")
  581. ""))))
  582. (add-after 'build 'build-bash-completions
  583. (lambda _
  584. (invoke "python" "-m" "./autotools/build-bash-completion")))
  585. (add-before 'check 'pre-check
  586. (lambda* (#:key inputs #:allow-other-keys)
  587. ;; Set TZDIR so that time zones are found.
  588. (setenv "TZDIR" (search-input-directory inputs "share/zoneinfo"))
  589. (substitute* "test/py/ganeti.utils.process_unittest.py"
  590. ;; This test attempts to run an executable with
  591. ;; RunCmd(..., reset_env=True), which fails because the default
  592. ;; PATH from Constants.hs does not exist in the build container.
  593. ((".*def testResetEnv.*" all)
  594. (string-append " @unittest.skipIf(True, "
  595. "\"cannot reset env in the build container\")\n"
  596. all))
  597. ;; XXX: Somehow this test fails in the build container, but
  598. ;; works in 'guix environment -C', even without /bin/sh?
  599. ((".*def testPidFile.*" all)
  600. (string-append " @unittest.skipIf(True, "
  601. "\"testPidFile fails in the build container\")\n"
  602. all)))
  603. ;; XXX: Why are these links not added automatically.
  604. (with-directory-excursion "test/hs"
  605. (for-each (lambda (file)
  606. (symlink "../../src/htools" file))
  607. '("hspace" "hscan" "hinfo" "hbal" "hroller"
  608. "hcheck" "hail" "hsqueeze")))))
  609. (add-after 'install 'install-bash-completions
  610. (lambda* (#:key outputs #:allow-other-keys)
  611. (let* ((out (assoc-ref outputs "out"))
  612. (compdir (string-append out "/etc/bash_completion.d")))
  613. (mkdir-p compdir)
  614. (copy-file "doc/examples/bash_completion"
  615. (string-append compdir "/ganeti"))
  616. ;; The one file contains completions for many different
  617. ;; executables. Create symlinks for found completions.
  618. (with-directory-excursion compdir
  619. (for-each
  620. (lambda (prog) (symlink "ganeti" prog))
  621. (call-with-input-file "ganeti"
  622. (lambda (port)
  623. (let loop ((line (read-line port))
  624. (progs '()))
  625. (if (eof-object? line)
  626. progs
  627. (if (string-prefix? "complete" line)
  628. (loop (read-line port)
  629. ;; Extract "prog" from lines of the form:
  630. ;; "complete -F _prog -o filenames prog".
  631. ;; Note that 'burnin' is listed with the
  632. ;; absolute file name, which is why we
  633. ;; run everything through 'basename'.
  634. (cons (basename (car (reverse (string-split
  635. line #\ ))))
  636. progs))
  637. (loop (read-line port) progs)))))))))))
  638. ;; Wrap all executables with GUIX_PYTHONPATH. We can't borrow
  639. ;; the phase from python-build-system because we also need to wrap
  640. ;; the scripts in $out/lib/ganeti such as "node-daemon-setup".
  641. (add-after 'install 'wrap
  642. (lambda* (#:key outputs #:allow-other-keys)
  643. (let* ((out (assoc-ref outputs "out"))
  644. (sbin (string-append out "/sbin"))
  645. (lib (string-append out "/lib")))
  646. (define (shell-script? file)
  647. (call-with-ascii-input-file file
  648. (lambda (port)
  649. (let ((shebang (false-if-exception (read-line port))))
  650. (and shebang
  651. (string-prefix? "#!" shebang)
  652. (or (string-contains shebang "/bin/bash")
  653. (string-contains shebang "/bin/sh")))))))
  654. (define (wrap? file)
  655. ;; Do not wrap shell scripts because some are meant to be
  656. ;; sourced, which breaks if they are wrapped. We do wrap
  657. ;; the Haskell executables because some call out to Python
  658. ;; directly.
  659. (and (executable-file? file)
  660. (not (symbolic-link? file))
  661. (not (shell-script? file))))
  662. (for-each (lambda (file)
  663. (wrap-program file
  664. `("GUIX_PYTHONPATH" ":" prefix
  665. (,(getenv "GUIX_PYTHONPATH")))))
  666. (filter wrap?
  667. (append (find-files (string-append lib "/ganeti"))
  668. (find-files sbin))))))))))
  669. (native-inputs
  670. `(("haskell" ,ghc)
  671. ("cabal" ,cabal-install)
  672. ("m4" ,m4)
  673. ;; These inputs are necessary to bootstrap the package, because we
  674. ;; have patched the build system.
  675. ("autoconf" ,autoconf)
  676. ("automake" ,automake)
  677. ;; For the documentation.
  678. ("python-docutils" ,python-docutils)
  679. ("sphinx" ,python-sphinx)
  680. ("pandoc" ,pandoc)
  681. ("dot" ,graphviz)
  682. ;; Test dependencies.
  683. ("fakeroot" ,fakeroot)
  684. ("ghc-temporary" ,ghc-temporary)
  685. ("ghc-test-framework" ,ghc-test-framework)
  686. ("ghc-test-framework-hunit" ,ghc-test-framework-hunit)
  687. ("ghc-test-framework-quickcheck2" ,ghc-test-framework-quickcheck2)
  688. ("python-mock" ,python-mock)
  689. ("python-pyyaml" ,python-pyyaml)
  690. ("openssh" ,openssh)
  691. ("procps" ,procps)
  692. ("shelltestrunner" ,shelltestrunner)
  693. ("tzdata" ,tzdata-for-tests)))
  694. (inputs
  695. `(("arping" ,iputils) ;must be the iputils version
  696. ("curl" ,curl)
  697. ("fping" ,fping)
  698. ("iproute2" ,iproute)
  699. ("ndisc6" ,ndisc6)
  700. ("socat" ,socat)
  701. ("qemu" ,qemu-minimal) ;for qemu-img
  702. ("ghc-attoparsec" ,ghc-attoparsec)
  703. ("ghc-base64-bytestring" ,ghc-base64-bytestring)
  704. ("ghc-cryptonite" ,ghc-cryptonite)
  705. ("ghc-curl" ,ghc-curl)
  706. ("ghc-hinotify" ,ghc-hinotify)
  707. ("ghc-hslogger" ,ghc-hslogger)
  708. ("ghc-json" ,ghc-json)
  709. ("ghc-lens" ,ghc-lens)
  710. ("ghc-lifted-base" ,ghc-lifted-base)
  711. ("ghc-network" ,ghc-network)
  712. ("ghc-old-time" ,ghc-old-time)
  713. ("ghc-psqueue" ,ghc-psqueue)
  714. ("ghc-regex-pcre" ,ghc-regex-pcre)
  715. ("ghc-utf8-string" ,ghc-utf8-string)
  716. ("ghc-zlib" ,ghc-zlib)
  717. ;; For the optional metadata daemon.
  718. ("ghc-snap-core" ,ghc-snap-core)
  719. ("ghc-snap-server" ,ghc-snap-server)
  720. ("python" ,python)
  721. ("python-pyopenssl" ,python-pyopenssl)
  722. ("python-simplejson" ,python-simplejson)
  723. ("python-pyparsing" ,python-pyparsing)
  724. ("python-pyinotify" ,python-pyinotify)
  725. ("python-pycurl" ,python-pycurl)
  726. ("python-bitarray" ,python-bitarray)
  727. ("python-paramiko" ,python-paramiko)
  728. ("python-psutil" ,python-psutil)))
  729. (home-page "https://www.ganeti.org/")
  730. (synopsis "Cluster-based virtual machine management system")
  731. (description
  732. "Ganeti is a virtual machine management tool built on top of existing
  733. virtualization technologies such as Xen or KVM. Ganeti controls:
  734. @itemize @bullet
  735. @item Disk creation management;
  736. @item Operating system installation for instances (in co-operation with
  737. OS-specific install scripts); and
  738. @item Startup, shutdown, and failover between physical systems.
  739. @end itemize
  740. Ganeti is designed to facilitate cluster management of virtual servers and
  741. to provide fast and simple recovery after physical failures, using
  742. commodity hardware.")
  743. (license license:bsd-2)))
  744. (define-public ganeti-instance-guix
  745. (package
  746. (name "ganeti-instance-guix")
  747. (version "0.6")
  748. (home-page "https://github.com/mbakke/ganeti-instance-guix")
  749. (source (origin
  750. (method git-fetch)
  751. (uri (git-reference (url home-page) (commit version)))
  752. (file-name (git-file-name name version))
  753. (sha256
  754. (base32
  755. "0aa08irpcpns6mhjgsplc5f0p8ab1qcr9ah1gj5z66kxgqyflzrp"))))
  756. (build-system gnu-build-system)
  757. (arguments
  758. '(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var")))
  759. (native-inputs
  760. `(("autoconf" ,autoconf)
  761. ("automake" ,automake)))
  762. (inputs
  763. `(("util-linux" ,util-linux)
  764. ("qemu-img" ,qemu-minimal)))
  765. (synopsis "Guix OS integration for Ganeti")
  766. (description
  767. "This package provides a guest OS definition for Ganeti that uses
  768. Guix to build virtual machines.")
  769. (license license:gpl3+)))
  770. (define-public ganeti-instance-debootstrap
  771. (package
  772. (name "ganeti-instance-debootstrap")
  773. ;; We need two commits on top of the latest release for compatibility
  774. ;; with newer sfdisk, as well as gnt-network integration.
  775. (version "0.16-2-ge145396")
  776. (home-page "https://github.com/ganeti/instance-debootstrap")
  777. (source (origin
  778. (method git-fetch)
  779. (uri (git-reference (url home-page) (commit version)))
  780. (file-name (git-file-name name version))
  781. (sha256
  782. (base32
  783. "0f2isw9d8lawzj21rrq1q9xhq8xfa65rqbhqmrn59z201x9q1336"))))
  784. (build-system gnu-build-system)
  785. (arguments
  786. '(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var")
  787. #:phases (modify-phases %standard-phases
  788. (add-after 'unpack 'add-absolute-references
  789. (lambda _
  790. (substitute* "common.sh.in"
  791. (("/sbin/blkid") (which "blkid"))
  792. (("kpartx -")
  793. (string-append (which "kpartx") " -")))
  794. (substitute* "import"
  795. (("restore -r")
  796. (string-append (which "restore") " -r")))
  797. (substitute* "export"
  798. (("dump -0")
  799. (string-append (which "dump") " -0")))
  800. (substitute* "create"
  801. (("debootstrap") (which "debootstrap"))
  802. (("`which run-parts`") (which "run-parts"))
  803. ;; Here we actually need to hard code /bin/passwd
  804. ;; because it's called via chroot, which fails if
  805. ;; "/bin" is not in PATH.
  806. (("passwd") "/bin/passwd"))
  807. #t))
  808. (add-after 'unpack 'set-dpkg-arch
  809. (lambda* (#:key system #:allow-other-keys)
  810. ;; The create script passes --arch to debootstrap,
  811. ;; and defaults to `dpkg --print-architecture` when
  812. ;; ARCH is not set in variant.conf. Hard code the
  813. ;; build-time architecture to avoid the dpkg dependency.
  814. (let ((dpkg-arch
  815. (cond ((string-prefix? "x86_64" system)
  816. "amd64")
  817. ((string-prefix? "i686" system)
  818. "i386")
  819. ((string-prefix? "aarch64" system)
  820. "arm64")
  821. (else (car (string-split system #\-))))))
  822. (substitute* "create"
  823. (("`dpkg --print-architecture`")
  824. dpkg-arch))
  825. #t)))
  826. (add-after 'configure 'adjust-Makefile
  827. (lambda _
  828. ;; Do not attempt to create /etc/ganeti/instance-debootstrap
  829. ;; and /etc/default/ganeti-instance-debootstrap during install.
  830. ;; They are created by the Ganeti service.
  831. (substitute* "Makefile"
  832. (("\\$\\(variantsdir\\)")
  833. "$(prefix)/etc/ganeti/instance-debootstrap/variants")
  834. (("\\$\\(defaultsdir\\)")
  835. "$(prefix)/etc/default/ganeti-instance-debootstrap"))
  836. #t))
  837. (add-after 'install 'make-variants.list-symlink
  838. (lambda* (#:key outputs #:allow-other-keys)
  839. ;; The Ganeti OS API mandates a variants.list file that
  840. ;; describes all supported "variants" of this OS.
  841. ;; Guix generates this file, so make the original file
  842. ;; a symlink to it.
  843. (with-directory-excursion (string-append
  844. (assoc-ref outputs "out")
  845. "/share/ganeti/os/debootstrap")
  846. (delete-file "variants.list")
  847. (symlink "/etc/ganeti/instance-debootstrap/variants/variants.list"
  848. "variants.list"))
  849. #t)))))
  850. (native-inputs
  851. `(("autoconf" ,autoconf)
  852. ("automake" ,automake)))
  853. (inputs
  854. `(("debianutils" ,debianutils)
  855. ("debootstrap" ,debootstrap)
  856. ("dump" ,dump)
  857. ("kpartx" ,multipath-tools)
  858. ("util-linux" ,util-linux)))
  859. (synopsis "Debian OS integration for Ganeti")
  860. (description
  861. "This package provides a guest OS definition for Ganeti. It installs
  862. Debian or a derivative using @command{debootstrap}.")
  863. (license license:gpl2+)))
  864. (define-public libosinfo
  865. (package
  866. (name "libosinfo")
  867. (version "1.7.1")
  868. (source
  869. (origin
  870. (method url-fetch)
  871. (uri (string-append "https://releases.pagure.org/libosinfo/libosinfo-"
  872. version ".tar.xz"))
  873. (sha256
  874. (base32
  875. "1s97sv24bybggjx6hgqba2qdqz3ivfpd4cmkh4zm5y59sim109mv"))))
  876. (build-system meson-build-system)
  877. (arguments
  878. `(#:configure-flags
  879. (list (string-append "-Dwith-usb-ids-path="
  880. (assoc-ref %build-inputs "usb.ids"))
  881. (string-append "-Dwith-pci-ids-path="
  882. (assoc-ref %build-inputs "pci.ids")))
  883. #:phases
  884. (modify-phases %standard-phases
  885. (add-after 'unpack 'patch-osinfo-path
  886. (lambda* (#:key inputs #:allow-other-keys)
  887. (substitute* "osinfo/osinfo_loader.c"
  888. (("path = DATA_DIR.*")
  889. (string-append "path = \"" (assoc-ref inputs "osinfo-db")
  890. "/share/osinfo\";")))
  891. #t)))))
  892. (inputs
  893. `(("libsoup" ,libsoup)
  894. ("libxml2" ,libxml2)
  895. ("libxslt" ,libxslt)
  896. ("osinfo-db" ,osinfo-db)))
  897. (native-inputs
  898. `(("glib" ,glib "bin") ; glib-mkenums, etc.
  899. ("gobject-introspection" ,gobject-introspection)
  900. ("gtk-doc" ,gtk-doc/stable)
  901. ("vala" ,vala)
  902. ("intltool" ,intltool)
  903. ("pkg-config" ,pkg-config)
  904. ("pci.ids"
  905. ,(origin
  906. (method url-fetch)
  907. (uri "https://github.com/pciutils/pciids/raw/ad02084f0bc143e3c15e31a6152a3dfb1d7a3156/pci.ids")
  908. (sha256
  909. (base32
  910. "0kfhpj5rnh24hz2714qhfmxk281vwc2w50sm73ggw5d15af7zfsw"))))
  911. ("usb.ids"
  912. ,(origin
  913. (method url-fetch)
  914. (uri "https://svn.code.sf.net/p/linux-usb/repo/trunk/htdocs/usb.ids?r=2681")
  915. (file-name "usb.ids")
  916. (sha256
  917. (base32
  918. "1m6yhvz5k8aqzxgk7xj3jkk8frl1hbv0h3vgj4wbnvnx79qnvz3r"))))))
  919. (home-page "https://libosinfo.org/")
  920. (synopsis "Operating system information database")
  921. (description "libosinfo is a GObject based library API for managing
  922. information about operating systems, hypervisors and the (virtual) hardware
  923. devices they can support. It includes a database containing device metadata
  924. and provides APIs to match/identify optimal devices for deploying an operating
  925. system on a hypervisor. Via GObject Introspection, the API is available in
  926. all common programming languages. Vala bindings are also provided.")
  927. ;; The library files are released under LGPLv2.1 or later; the source
  928. ;; files in the "tools" directory are released under GPLv2+.
  929. (license (list license:lgpl2.1+ license:gpl2+))))
  930. (define-public lxc
  931. (package
  932. (name "lxc")
  933. (version "4.0.6")
  934. (source (origin
  935. (method url-fetch)
  936. (uri (string-append
  937. "https://linuxcontainers.org/downloads/lxc/lxc-"
  938. version ".tar.gz"))
  939. (sha256
  940. (base32
  941. "0qz4l7mlhq7hx53q606qgvkyzyr01glsw290v8ppzvxn1fydlrci"))))
  942. (build-system gnu-build-system)
  943. (native-inputs
  944. `(("pkg-config" ,pkg-config)
  945. ("docbook2x" ,docbook2x)))
  946. (inputs
  947. `(("gnutls" ,gnutls)
  948. ("libcap" ,libcap)
  949. ("libseccomp" ,libseccomp)
  950. ("libselinux" ,libselinux)))
  951. (arguments
  952. `(#:configure-flags
  953. (list (string-append "--docdir=" (assoc-ref %outputs "out")
  954. "/share/doc/" ,name "-" ,version)
  955. "--sysconfdir=/etc"
  956. "--localstatedir=/var")
  957. #:phases
  958. (modify-phases %standard-phases
  959. (replace 'install
  960. (lambda* (#:key outputs #:allow-other-keys)
  961. (let* ((out (assoc-ref outputs "out"))
  962. (bashcompdir (string-append out "/etc/bash_completion.d")))
  963. (invoke "make" "install"
  964. (string-append "bashcompdir=" bashcompdir)
  965. ;; Don't install files into /var and /etc.
  966. "LXCPATH=/tmp/var/lib/lxc"
  967. "localstatedir=/tmp/var"
  968. "sysconfdir=/tmp/etc"
  969. "sysconfigdir=/tmp/etc/default")))))))
  970. (synopsis "Linux container tools")
  971. (home-page "https://linuxcontainers.org/")
  972. (description
  973. "LXC is a userspace interface for the Linux kernel containment features.
  974. Through a powerful API and simple tools, it lets Linux users easily create and
  975. manage system or application containers.")
  976. (license license:lgpl2.1+)))
  977. (define-public lxcfs
  978. (package
  979. (name "lxcfs")
  980. (version "4.0.8")
  981. (home-page "https://github.com/lxc/lxcfs")
  982. (source (origin
  983. (method git-fetch)
  984. (uri (git-reference (url home-page)
  985. (commit (string-append "lxcfs-" version))))
  986. (file-name (git-file-name name version))
  987. (sha256
  988. (base32
  989. "1f74wy88si2ia035pcvciq5821kc8jcb75w1f8vhbp0cd29rqdpi"))))
  990. (arguments
  991. '(#:configure-flags '("--localstatedir=/var")))
  992. (native-inputs
  993. `(("autoconf" ,autoconf)
  994. ("automake" ,automake)
  995. ("libtool" ,libtool)
  996. ("pkg-config" ,pkg-config)))
  997. (inputs
  998. `(("fuse" ,fuse)))
  999. (build-system gnu-build-system)
  1000. (synopsis "FUSE-based file system for LXC")
  1001. (description "LXCFS is a small FUSE file system written with the intention
  1002. of making Linux containers feel more like a virtual machine.
  1003. It started as a side project of LXC but can be used by any run-time.")
  1004. (license license:lgpl2.1+)))
  1005. (define-public libvirt
  1006. (package
  1007. (name "libvirt")
  1008. (version "7.5.0")
  1009. (source
  1010. (origin
  1011. (method url-fetch)
  1012. (uri (string-append "https://libvirt.org/sources/libvirt-"
  1013. version ".tar.xz"))
  1014. (sha256
  1015. (base32 "15987ihnsjvcgi11dzcf1k3zp1si2d4wcxj0r0i30brc0d4pn44h"))
  1016. (patches (search-patches "libvirt-add-install-prefix.patch"))))
  1017. (build-system meson-build-system)
  1018. (arguments
  1019. `(#:configure-flags
  1020. (list "-Ddriver_qemu=enabled"
  1021. "-Dqemu_user=nobody"
  1022. "-Dqemu_group=kvm"
  1023. "-Dstorage_disk=enabled"
  1024. "-Dstorage_dir=enabled"
  1025. "-Dpolkit=enabled"
  1026. ;; XXX The default, but required to make -Dsasl ‘stick’.
  1027. ;; See <https://gitlab.com/libvirt/libvirt/-/issues/185>
  1028. "-Ddriver_remote=enabled"
  1029. "-Dnls=enabled" ;translations
  1030. (string-append "-Ddocdir=" (assoc-ref %outputs "out") "/share/doc/"
  1031. ,name "-" ,version)
  1032. "-Dbash_completion=enabled"
  1033. (string-append "-Dinstall_prefix=" (assoc-ref %outputs "out"))
  1034. "--sysconfdir=/etc"
  1035. "--localstatedir=/var")
  1036. #:phases
  1037. (modify-phases %standard-phases
  1038. (add-after 'unpack 'skip-directory-confusion
  1039. (lambda _
  1040. ;; Don't try to install an (unused) /var outside of the store.
  1041. (substitute* "scripts/meson-install-dirs.py"
  1042. (("destdir = .*")
  1043. "destdir = '/tmp'"))))
  1044. (add-before 'configure 'disable-broken-tests
  1045. (lambda _
  1046. (let ((tests (list "commandtest" ; hangs idly
  1047. "qemuxml2argvtest" ; fails
  1048. "virnetsockettest"))) ; tries to network
  1049. (substitute* "tests/meson.build"
  1050. (((format #f ".*'name': '(~a)'.*" (string-join tests "|")))
  1051. ""))))))))
  1052. (inputs
  1053. `(("acl" ,acl)
  1054. ("attr" ,attr)
  1055. ("fuse" ,fuse)
  1056. ("libxml2" ,libxml2)
  1057. ("eudev" ,eudev)
  1058. ("libpciaccess" ,libpciaccess)
  1059. ("gnutls" ,gnutls)
  1060. ("dbus" ,dbus)
  1061. ("libpcap" ,libpcap)
  1062. ("libnl" ,libnl)
  1063. ("libssh2" ,libssh2) ;optional
  1064. ("libtirpc" ,libtirpc) ;for <rpc/rpc.h>
  1065. ("libuuid" ,util-linux "lib")
  1066. ("lvm2" ,lvm2) ;for libdevmapper
  1067. ("curl" ,curl)
  1068. ("openssl" ,openssl)
  1069. ("readline" ,readline)
  1070. ("cyrus-sasl" ,cyrus-sasl)
  1071. ("libyajl" ,libyajl)
  1072. ("audit" ,audit)
  1073. ("dmidecode" ,dmidecode)
  1074. ("dnsmasq" ,dnsmasq)
  1075. ("ebtables" ,ebtables)
  1076. ("parted" ,parted)
  1077. ("iproute" ,iproute)
  1078. ("iptables" ,iptables)))
  1079. (native-inputs
  1080. `(("bash-completion" ,bash-completion)
  1081. ("gettext" ,gettext-minimal)
  1082. ("xsltproc" ,libxslt)
  1083. ("perl" ,perl)
  1084. ("pkg-config" ,pkg-config)
  1085. ("polkit" ,polkit)
  1086. ("python" ,python-wrapper)
  1087. ("python-docutils" ,python-docutils) ;for rst2html
  1088. ("rpcsvc-proto" ,rpcsvc-proto))) ;for rpcgen
  1089. (home-page "https://libvirt.org")
  1090. (synopsis "Simple API for virtualization")
  1091. (description "Libvirt is a C toolkit to interact with the virtualization
  1092. capabilities of recent versions of Linux. The library aims at providing long
  1093. term stable C API initially for the Xen paravirtualization but should be able
  1094. to integrate other virtualization mechanisms if needed.")
  1095. (license license:lgpl2.1+)))
  1096. (define-public libvirt-glib
  1097. (package
  1098. (name "libvirt-glib")
  1099. (version "4.0.0")
  1100. (source (origin
  1101. (method url-fetch)
  1102. (uri (string-append "ftp://libvirt.org/libvirt/glib/"
  1103. "libvirt-glib-" version ".tar.xz"))
  1104. (sha256
  1105. (base32
  1106. "1gdcvqz88qkp402zra9csc6391f2xki1270x683n6ixakl3gf8w4"))))
  1107. (build-system meson-build-system)
  1108. (inputs
  1109. `(("openssl" ,openssl)
  1110. ("cyrus-sasl" ,cyrus-sasl)
  1111. ("lvm2" ,lvm2) ; for libdevmapper
  1112. ("libyajl" ,libyajl)))
  1113. (native-inputs
  1114. `(("pkg-config" ,pkg-config)
  1115. ("intltool" ,intltool)
  1116. ("glib" ,glib "bin")
  1117. ("vala" ,vala)))
  1118. (propagated-inputs
  1119. ;; ‘Required:’ by the installed .pc files.
  1120. `(("glib" ,glib)
  1121. ("libvirt" ,libvirt)
  1122. ("libxml2" ,libxml2)
  1123. ("gobject-introspection" ,gobject-introspection)))
  1124. (home-page "https://libvirt.org")
  1125. (synopsis "GLib wrapper around libvirt")
  1126. (description "libvirt-glib wraps the libvirt library to provide a
  1127. high-level object-oriented API better suited for glib-based applications, via
  1128. three libraries:
  1129. @enumerate
  1130. @item libvirt-glib - GLib main loop integration & misc helper APIs
  1131. @item libvirt-gconfig - GObjects for manipulating libvirt XML documents
  1132. @item libvirt-gobject - GObjects for managing libvirt objects
  1133. @end enumerate
  1134. ")
  1135. (license license:lgpl2.1+)))
  1136. (define-public python-libvirt
  1137. (package
  1138. (name "python-libvirt")
  1139. (version "7.3.0")
  1140. (source
  1141. (origin
  1142. (method url-fetch)
  1143. (uri (string-append "https://libvirt.org/sources/python/libvirt-python-"
  1144. version ".tar.gz"))
  1145. (sha256
  1146. (base32 "15pn8610ybf03xff3vbz3apz2ph42k2kh6k19r020l9nvc6jcv37"))))
  1147. (build-system python-build-system)
  1148. (arguments
  1149. `(#:phases
  1150. (modify-phases %standard-phases
  1151. (replace 'check
  1152. (lambda* (#:key inputs outputs tests? #:allow-other-keys)
  1153. (when tests?
  1154. ;; No reason to explicity invoke Python on a wrapped pytest.
  1155. (substitute* "setup.py"
  1156. (("sys\\.executable, pytest") "pytest"))
  1157. (add-installed-pythonpath inputs outputs)
  1158. (setenv "LIBVIRT_API_COVERAGE" "whynot")
  1159. (invoke "python" "setup.py" "test")))))))
  1160. (inputs
  1161. `(("libvirt" ,libvirt)))
  1162. (propagated-inputs
  1163. `(("python-lxml" ,python-lxml)))
  1164. (native-inputs
  1165. `(("pkg-config" ,pkg-config)
  1166. ("python-pytest" ,python-pytest)))
  1167. (home-page "https://libvirt.org")
  1168. (synopsis "Python bindings to libvirt")
  1169. (description "This package provides Python bindings to the libvirt
  1170. virtualization library.")
  1171. (license license:lgpl2.1+)))
  1172. (define-public virt-manager
  1173. (package
  1174. (name "virt-manager")
  1175. (version "3.2.0")
  1176. (source (origin
  1177. (method url-fetch)
  1178. (uri (string-append "https://virt-manager.org/download/sources"
  1179. "/virt-manager/virt-manager-"
  1180. version ".tar.gz"))
  1181. (sha256
  1182. (base32
  1183. "11kvpzcmyir91qz0dsnk7748jbb4wr8mrc744w117qc91pcy6vrb"))))
  1184. (build-system python-build-system)
  1185. (arguments
  1186. `(#:use-setuptools? #f ; uses custom distutils 'install' command
  1187. #:tests? #f ; TODO The tests currently fail
  1188. ; RuntimeError: Loop condition wasn't
  1189. ; met
  1190. #:imported-modules ((guix build glib-or-gtk-build-system)
  1191. ,@%python-build-system-modules)
  1192. #:modules ((ice-9 match)
  1193. (srfi srfi-26)
  1194. (guix build python-build-system)
  1195. ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
  1196. (guix build utils))
  1197. #:phases
  1198. (modify-phases %standard-phases
  1199. (add-after 'unpack 'fix-setup
  1200. (lambda* (#:key outputs #:allow-other-keys)
  1201. (substitute* "virtinst/buildconfig.py"
  1202. (("/usr") (assoc-ref outputs "out")))
  1203. #t))
  1204. (add-after 'unpack 'fix-default-uri
  1205. (lambda* (#:key inputs #:allow-other-keys)
  1206. ;; Xen is not available for now - so only patch qemu.
  1207. (substitute* "virtManager/createconn.py"
  1208. (("/usr(/bin/qemu-system-[a-zA-Z0-9_-]+)" _ suffix)
  1209. (search-input-file inputs suffix)))
  1210. #t))
  1211. (add-before 'wrap 'wrap-with-GI_TYPELIB_PATH
  1212. (lambda* (#:key inputs outputs #:allow-other-keys)
  1213. (let* ((bin (string-append (assoc-ref outputs "out") "/bin"))
  1214. (bin-files (find-files bin ".*"))
  1215. (paths (map (match-lambda
  1216. ((output . directory)
  1217. (let* ((girepodir (string-append
  1218. directory
  1219. "/lib/girepository-1.0")))
  1220. (if (file-exists? girepodir)
  1221. girepodir #f))))
  1222. inputs)))
  1223. (for-each (lambda (file)
  1224. (format #t "wrapping ~a\n" file)
  1225. (wrap-program file
  1226. `("GI_TYPELIB_PATH" ":" prefix
  1227. ,(filter identity paths))))
  1228. bin-files))
  1229. #t))
  1230. (replace 'check
  1231. (lambda* (#:key tests? #:allow-other-keys)
  1232. (when tests?
  1233. (setenv "HOME" "/tmp")
  1234. (setenv "XDG_CACHE_HOME" "/tmp")
  1235. (system "Xvfb :1 &")
  1236. (setenv "DISPLAY" ":1")
  1237. ;; Dogtail requires that Assistive Technology support be enabled
  1238. (setenv "GTK_MODULES" "gail:atk-bridge")
  1239. (invoke "dbus-run-session" "--" "pytest" "--uitests"))
  1240. #t))
  1241. (add-after 'install 'glib-or-gtk-compile-schemas
  1242. (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
  1243. (add-after 'wrap 'glib-or-gtk-wrap
  1244. (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
  1245. (inputs
  1246. `(("dconf" ,dconf)
  1247. ("gtk+" ,gtk+)
  1248. ("gtk-vnc" ,gtk-vnc)
  1249. ("gtksourceview" ,gtksourceview)
  1250. ("libvirt" ,libvirt)
  1251. ("libvirt-glib" ,libvirt-glib)
  1252. ("libosinfo" ,libosinfo)
  1253. ("vte" ,vte)
  1254. ("python-libvirt" ,python-libvirt)
  1255. ("python-requests" ,python-requests)
  1256. ("python-pycairo" ,python-pycairo)
  1257. ("python-pygobject" ,python-pygobject)
  1258. ("python-libxml2" ,python-libxml2)
  1259. ("spice-gtk" ,spice-gtk)))
  1260. ;; virt-manager searches for qemu-img or kvm-img in the PATH.
  1261. (propagated-inputs
  1262. `(("qemu" ,qemu)))
  1263. (native-inputs
  1264. `(("glib" ,glib "bin") ; glib-compile-schemas
  1265. ("gobject-introspection" ,gobject-introspection)
  1266. ("gtk+" ,gtk+ "bin") ; gtk-update-icon-cache
  1267. ("perl" ,perl) ; pod2man
  1268. ("intltool" ,intltool)
  1269. ("rst2man" ,python-docutils)
  1270. ;; The following are required for running the tests
  1271. ;; ("python-pytest" ,python-pytest)
  1272. ;; ("python-dogtail" ,python-dogtail)
  1273. ;; ("xvfb" ,xorg-server-for-tests)
  1274. ;; ("dbus" ,dbus)
  1275. ;; ("at-spi2-core" ,at-spi2-core)
  1276. ;; ("gsettings-desktop-schemas" ,gsettings-desktop-schemas)
  1277. ))
  1278. (home-page "https://virt-manager.org/")
  1279. (synopsis "Manage virtual machines")
  1280. (description
  1281. "The virt-manager application is a desktop user interface for managing
  1282. virtual machines through libvirt. It primarily targets KVM VMs, but also
  1283. manages Xen and LXC (Linux containers). It presents a summary view of running
  1284. domains, their live performance and resource utilization statistics.")
  1285. (license license:gpl2+)))
  1286. (define-public criu
  1287. (package
  1288. (name "criu")
  1289. (version "3.15")
  1290. (source (origin
  1291. (method url-fetch)
  1292. (uri (string-append "https://download.openvz.org/criu/criu-"
  1293. version ".tar.bz2"))
  1294. (sha256
  1295. (base32
  1296. "09d0j24x0cyc7wkgi7cnxqgfjk7kbdlm79zxpj8d356sa3rw2z24"))))
  1297. (build-system gnu-build-system)
  1298. (arguments
  1299. `(#:test-target "test"
  1300. #:tests? #f ; tests require mounting as root
  1301. #:make-flags
  1302. (list (string-append "PREFIX=" (assoc-ref %outputs "out"))
  1303. (string-append "LIBDIR=" (assoc-ref %outputs "out")
  1304. "/lib")
  1305. (string-append "ASCIIDOC=" (assoc-ref %build-inputs "asciidoc")
  1306. "/bin/asciidoc")
  1307. (string-append "XMLTO=" (assoc-ref %build-inputs "xmlto")
  1308. "/bin/xmlto"))
  1309. #:phases
  1310. (modify-phases %standard-phases
  1311. (replace 'configure
  1312. (lambda* (#:key inputs #:allow-other-keys)
  1313. ;; The includes for libnl are located in a sub-directory.
  1314. (setenv "C_INCLUDE_PATH"
  1315. (string-append
  1316. (search-input-directory inputs "/include/libnl3")
  1317. ":" (or (getenv "C_INCLUDE_PATH") "")))))
  1318. (add-after 'configure 'fix-documentation
  1319. (lambda* (#:key inputs outputs #:allow-other-keys)
  1320. (substitute* "Documentation/Makefile"
  1321. (("-m custom.xsl")
  1322. (string-append
  1323. "-m custom.xsl --skip-validation -x "
  1324. (assoc-ref inputs "docbook-xsl") "/xml/xsl/"
  1325. ,(package-name docbook-xsl) "-"
  1326. ,(package-version docbook-xsl)
  1327. "/manpages/docbook.xsl")))
  1328. #t))
  1329. (add-after 'unpack 'hardcode-variables
  1330. (lambda* (#:key inputs #:allow-other-keys)
  1331. ;; Hardcode arm version detection
  1332. (substitute* "Makefile"
  1333. (("ARMV.*:=.*") "ARMV := 7\n"))
  1334. ;; We are currently using python-2
  1335. (substitute* "crit/Makefile"
  1336. (("\\$\\(PYTHON\\)") "python2"))
  1337. (substitute* "lib/Makefile"
  1338. (("\\$\\(PYTHON\\)")
  1339. (search-input-file inputs "/bin/python")))))
  1340. (add-before 'build 'fix-symlink
  1341. (lambda* (#:key inputs #:allow-other-keys)
  1342. ;; The file 'images/google/protobuf/descriptor.proto' points to
  1343. ;; /usr/include/..., which obviously does not exist.
  1344. (let* ((file "google/protobuf/descriptor.proto")
  1345. (target (string-append "images/" file))
  1346. (source (search-input-file
  1347. inputs
  1348. (string-append "include/" file))))
  1349. (delete-file target)
  1350. (symlink source target)
  1351. #t)))
  1352. (add-after 'install 'wrap
  1353. (lambda* (#:key inputs outputs #:allow-other-keys)
  1354. ;; Make sure 'crit' runs with the correct PYTHONPATH.
  1355. (let* ((out (assoc-ref outputs "out"))
  1356. (path (string-append out
  1357. "/lib/python"
  1358. (string-take (string-take-right
  1359. (assoc-ref inputs "python") 5) 3)
  1360. "/site-packages:"
  1361. (or (getenv "GUIX_PYTHONPATH") ""))))
  1362. (wrap-program (string-append out "/bin/crit")
  1363. `("GUIX_PYTHONPATH" ":" prefix (,path))))
  1364. #t)))))
  1365. (inputs
  1366. `(("protobuf" ,protobuf)
  1367. ("python" ,python-2)
  1368. ("python2-protobuf" ,python2-protobuf)
  1369. ("python2-ipaddr" ,python2-ipaddr)
  1370. ("iproute" ,iproute)
  1371. ("libaio" ,libaio)
  1372. ("libcap" ,libcap)
  1373. ("libnet" ,libnet)
  1374. ("libnl" ,libnl)
  1375. ("libbsd" ,libbsd)
  1376. ("nftables" ,nftables)))
  1377. (native-inputs
  1378. `(("pkg-config" ,pkg-config)
  1379. ("perl" ,perl)
  1380. ("protobuf-c" ,protobuf-c)
  1381. ("asciidoc" ,asciidoc)
  1382. ("xmlto" ,xmlto)
  1383. ("docbook-xml" ,docbook-xml)
  1384. ("docbook-xsl" ,docbook-xsl)))
  1385. (home-page "https://criu.org")
  1386. (synopsis "Checkpoint and restore in user space")
  1387. (description "Using this tool, you can freeze a running application (or
  1388. part of it) and checkpoint it to a hard drive as a collection of files. You
  1389. can then use the files to restore and run the application from the point it
  1390. was frozen at. The distinctive feature of the CRIU project is that it is
  1391. mainly implemented in user space.")
  1392. ;; The project is licensed under GPLv2; files in the lib/ directory are
  1393. ;; LGPLv2.1.
  1394. (license (list license:gpl2 license:lgpl2.1))))
  1395. (define-public qmpbackup
  1396. (package
  1397. (name "qmpbackup")
  1398. (version "0.2")
  1399. (source (origin
  1400. (method git-fetch)
  1401. (uri (git-reference
  1402. (url "https://github.com/abbbi/qmpbackup")
  1403. (commit version)))
  1404. (file-name (git-file-name name version))
  1405. (sha256
  1406. (base32
  1407. "0swhp5byz44brhyis1a39p11fyn9q84xz5q6v2fah29r7d71kmmx"))))
  1408. (build-system python-build-system)
  1409. (arguments
  1410. `(#:python ,python-2))
  1411. (home-page "https://github.com/abbbi/qmpbackup")
  1412. (synopsis "Backup and restore QEMU machines")
  1413. (description "qmpbackup is designed to create and restore full and
  1414. incremental backups of running QEMU virtual machines via QMP, the QEMU
  1415. Machine Protocol.")
  1416. (license license:gpl3+)))
  1417. (define-public looking-glass-client
  1418. (let ((commit "182c4752d57690da7f99d5e788de9b8baea33895"))
  1419. (package
  1420. (name "looking-glass-client")
  1421. (version (string-append "a12-" (string-take commit 7)))
  1422. (source
  1423. (origin
  1424. (method git-fetch)
  1425. (uri (git-reference (url "https://github.com/gnif/LookingGlass")
  1426. (commit commit)))
  1427. (file-name (git-file-name name version))
  1428. (sha256
  1429. (base32
  1430. "02bq46ndmzq9cihazzn7xq1x7q5nzm7iw4l9lqzihxcxp9famkhw"))
  1431. (modules '((guix build utils)))
  1432. (snippet
  1433. '(begin
  1434. ;; Do not create binaries optimized for the CPU of the build machine,
  1435. ;; for reproducibility and compatibility. TODO: in the next version
  1436. ;; of looking glass, this is exposed as a CMake configure option.
  1437. (substitute* "client/CMakeLists.txt"
  1438. (("-march=native")
  1439. ""))
  1440. #t))))
  1441. (build-system cmake-build-system)
  1442. (inputs `(("fontconfig" ,fontconfig)
  1443. ("glu" ,glu)
  1444. ("mesa" ,mesa)
  1445. ("openssl" ,openssl)
  1446. ("sdl2" ,sdl2)
  1447. ("sdl2-ttf" ,sdl2-ttf)
  1448. ("spice-protocol" ,spice-protocol)
  1449. ("wayland" ,wayland)))
  1450. (native-inputs `(("libconfig" ,libconfig)
  1451. ("nettle" ,nettle)
  1452. ("pkg-config" ,pkg-config)))
  1453. (arguments
  1454. `(#:tests? #f ;; No tests are available.
  1455. #:make-flags '("CC=gcc")
  1456. #:phases (modify-phases %standard-phases
  1457. (add-before 'configure 'chdir-to-client
  1458. (lambda* (#:key outputs #:allow-other-keys)
  1459. (chdir "client")
  1460. #t))
  1461. (add-after 'chdir-to-client 'add-missing-include
  1462. (lambda _
  1463. ;; Mimic upstream commit b9797529893, required since the
  1464. ;; update to Mesa 19.2.
  1465. (substitute* "renderers/egl/shader.h"
  1466. (("#include <stdbool\\.h>")
  1467. "#include <stdbool.h>\n#include <stddef.h>"))
  1468. #t))
  1469. (replace 'install
  1470. (lambda* (#:key outputs #:allow-other-keys)
  1471. (install-file "looking-glass-client"
  1472. (string-append (assoc-ref outputs "out")
  1473. "/bin"))
  1474. #t)))))
  1475. (home-page "https://looking-glass.hostfission.com")
  1476. (synopsis "KVM Frame Relay (KVMFR) implementation")
  1477. (description "Looking Glass allows the use of a KVM (Kernel-based Virtual
  1478. Machine) configured for VGA PCI Pass-through without an attached physical
  1479. monitor, keyboard or mouse. It displays the VM's rendered contents on your main
  1480. monitor/GPU.")
  1481. ;; This package requires SSE instructions.
  1482. (supported-systems '("i686-linux" "x86_64-linux"))
  1483. (license license:gpl2+))))
  1484. (define-public runc
  1485. (package
  1486. (name "runc")
  1487. (version "1.0.0-rc93")
  1488. (source (origin
  1489. (method url-fetch)
  1490. (uri (string-append
  1491. "https://github.com/opencontainers/runc/releases/"
  1492. "download/v" version "/runc.tar.xz"))
  1493. (file-name (string-append name "-" version ".tar.xz"))
  1494. (sha256
  1495. (base32
  1496. "0b90r1bkvlqli53ca1yc1l488dba0isd3i6l7nlhszxi8p7hzvkh"))))
  1497. (build-system go-build-system)
  1498. (arguments
  1499. '(#:import-path "github.com/opencontainers/runc"
  1500. #:install-source? #f
  1501. ;; XXX: 20/139 tests fail due to missing /var, cgroups and apparmor in
  1502. ;; the build environment.
  1503. #:tests? #f
  1504. #:phases
  1505. (modify-phases %standard-phases
  1506. (replace 'build
  1507. (lambda* (#:key import-path #:allow-other-keys)
  1508. (with-directory-excursion (string-append "src/" import-path)
  1509. (invoke "make" "all" "man"))))
  1510. (replace 'check
  1511. (lambda* (#:key tests? #:allow-other-keys)
  1512. (when tests?
  1513. (invoke "make" "localunittest"))))
  1514. (replace 'install
  1515. (lambda* (#:key import-path outputs #:allow-other-keys)
  1516. (with-directory-excursion (string-append "src/" import-path)
  1517. (let ((out (assoc-ref outputs "out")))
  1518. (invoke "make" "install" "install-bash" "install-man"
  1519. (string-append "PREFIX=" out)))))))))
  1520. (native-inputs
  1521. `(("go-md2man" ,go-github-com-go-md2man)
  1522. ("pkg-config" ,pkg-config)))
  1523. (inputs
  1524. `(("libseccomp" ,libseccomp)))
  1525. (synopsis "Open container initiative runtime")
  1526. (home-page "https://opencontainers.org/")
  1527. (description
  1528. "@command{runc} is a command line client for running applications
  1529. packaged according to the
  1530. @uref{https://github.com/opencontainers/runtime-spec/blob/master/spec.md, Open
  1531. Container Initiative (OCI) format} and is a compliant implementation of the
  1532. Open Container Initiative specification.")
  1533. (license license:asl2.0)))
  1534. (define-public umoci
  1535. (package
  1536. (name "umoci")
  1537. (version "0.4.7")
  1538. (source
  1539. (origin
  1540. (method url-fetch)
  1541. (uri (string-append
  1542. "https://github.com/opencontainers/umoci/releases/download/v"
  1543. version "/umoci.tar.xz"))
  1544. (file-name (string-append "umoci-" version ".tar.xz"))
  1545. (sha256
  1546. (base32 "0fvljj9k4f83wbqzd8nbijz0p1zaq633f8yxyvl5sy3wjf03ffk9"))))
  1547. (build-system go-build-system)
  1548. (arguments
  1549. '(#:import-path "github.com/opencontainers/umoci"
  1550. #:install-source? #f
  1551. #:phases
  1552. (modify-phases %standard-phases
  1553. (replace 'unpack
  1554. (lambda* (#:key source import-path #:allow-other-keys)
  1555. ;; Unpack the tarball into 'umoci' instead of "runc-${version}".
  1556. (let ((dest (string-append "src/" import-path)))
  1557. (mkdir-p dest)
  1558. (invoke "tar" "-C" (string-append "src/" import-path)
  1559. "--strip-components=1"
  1560. "-xvf" source))))
  1561. (replace 'build
  1562. (lambda* (#:key import-path #:allow-other-keys)
  1563. (with-directory-excursion (string-append "src/" import-path)
  1564. ;; TODO: build manpages with 'go-md2man'.
  1565. (invoke "make" "SHELL=bash"))))
  1566. (replace 'install
  1567. (lambda* (#:key import-path outputs #:allow-other-keys)
  1568. (let* ((out (assoc-ref outputs "out"))
  1569. (bindir (string-append out "/bin")))
  1570. (install-file (string-append "src/" import-path "/umoci")
  1571. bindir)
  1572. #t))))))
  1573. (home-page "https://umo.ci/")
  1574. (synopsis "Tool for modifying Open Container images")
  1575. (description
  1576. "@command{umoci} is a tool that allows for high-level modification of an
  1577. Open Container Initiative (OCI) image layout and its tagged images.")
  1578. (license license:asl2.0)))
  1579. (define-public skopeo
  1580. (package
  1581. (name "skopeo")
  1582. (version "1.2.3")
  1583. (source (origin
  1584. (method git-fetch)
  1585. (uri (git-reference
  1586. (url "https://github.com/containers/skopeo")
  1587. (commit (string-append "v" version))))
  1588. (file-name (git-file-name name version))
  1589. (sha256
  1590. (base32
  1591. "0n22sdif437ddg5ch0ipwim3fg0n6ihc9bfi52qkhy3r1grz04hs"))))
  1592. (build-system go-build-system)
  1593. (native-inputs
  1594. `(("pkg-config" ,pkg-config)
  1595. ("go-github-com-go-md2man" ,go-github-com-go-md2man)))
  1596. (inputs
  1597. `(("btrfs-progs" ,btrfs-progs)
  1598. ("eudev" ,eudev)
  1599. ("libassuan" ,libassuan)
  1600. ("libselinux" ,libselinux)
  1601. ("libostree" ,libostree)
  1602. ("lvm2" ,lvm2)
  1603. ("glib" ,glib)
  1604. ("gpgme" ,gpgme)))
  1605. (arguments
  1606. '(#:import-path "github.com/containers/skopeo"
  1607. #:install-source? #f
  1608. #:tests? #f ; The tests require Docker
  1609. #:phases
  1610. (modify-phases %standard-phases
  1611. (replace 'build
  1612. (lambda* (#:key import-path #:allow-other-keys)
  1613. (with-directory-excursion (string-append "src/" import-path)
  1614. (invoke "make" "bin/skopeo"))))
  1615. (add-after 'build 'build-docs
  1616. (lambda* (#:key import-path #:allow-other-keys)
  1617. (with-directory-excursion (string-append "src/" import-path)
  1618. (invoke "make" "docs"))))
  1619. (replace 'install
  1620. (lambda* (#:key import-path outputs #:allow-other-keys)
  1621. (with-directory-excursion (string-append "src/" import-path)
  1622. (let ((out (assoc-ref outputs "out")))
  1623. (install-file "default-policy.json"
  1624. (string-append out "/etc/containers"))
  1625. (invoke "make" "install-binary" "install-completions" "install-docs"
  1626. (string-append "PREFIX=" out)))))))))
  1627. (home-page "https://github.com/containers/skopeo")
  1628. (synopsis "Interact with container images and container image registries")
  1629. (description
  1630. "@command{skopeo} is a command line utility providing various operations
  1631. with container images and container image registries. It can:
  1632. @enumerate
  1633. @item Copy container images between various containers image stores,
  1634. converting them as necessary.
  1635. @item Convert a Docker schema 2 or schema 1 container image to an OCI image.
  1636. @item Inspect a repository on a container registry without needlessly pulling
  1637. the image.
  1638. @item Sign and verify container images.
  1639. @item Delete container images from a remote container registry.
  1640. @end enumerate")
  1641. (license license:asl2.0)))
  1642. (define-public python-vagrant
  1643. (package
  1644. (name "python-vagrant")
  1645. (version "0.5.15")
  1646. (source
  1647. (origin
  1648. (method url-fetch)
  1649. (uri (pypi-uri "python-vagrant" version))
  1650. (sha256
  1651. (base32
  1652. "1ikrh6canhcxg5y7pzmkcnnydikppv7s6sm9prfx90nk0ac8m6mg"))))
  1653. (build-system python-build-system)
  1654. (arguments
  1655. '(#:tests? #f)) ; tests involve running vagrant.
  1656. (home-page "https://github.com/todddeluca/python-vagrant")
  1657. (synopsis "Python bindings for Vagrant")
  1658. (description
  1659. "Python-vagrant is a Python module that provides a thin wrapper around the
  1660. @code{vagrant} command line executable, allowing programmatic control of Vagrant
  1661. virtual machines.")
  1662. (license license:expat)))
  1663. (define-public bubblewrap
  1664. (package
  1665. (name "bubblewrap")
  1666. (version "0.4.1")
  1667. (source (origin
  1668. (method url-fetch)
  1669. (uri (string-append "https://github.com/containers/bubblewrap/"
  1670. "releases/download/v" version "/bubblewrap-"
  1671. version ".tar.xz"))
  1672. (sha256
  1673. (base32
  1674. "00ycgi6q2yngh06bnz50wkvar6r2jnjf3j158grhi9k13jdrpimr"))))
  1675. (build-system gnu-build-system)
  1676. (arguments
  1677. `(#:phases
  1678. (modify-phases %standard-phases
  1679. (add-after 'unpack 'fix-test
  1680. (lambda* (#:key outputs #:allow-other-keys)
  1681. ;; Tests try to access /var/tmp, which is not possible in our build
  1682. ;; environment. Let's give them another directory.
  1683. ;; /tmp gets overriden in some tests, so we need another directory.
  1684. ;; the only possibility is the output directory.
  1685. (let ((tmp-dir (string-append (assoc-ref outputs "out") "/tmp")))
  1686. (mkdir-p tmp-dir)
  1687. (substitute* "tests/test-run.sh"
  1688. (("/var/tmp") tmp-dir)
  1689. ;; Tests create a temporary python script, so fix its shebang.
  1690. (("/usr/bin/env python") (which "python"))
  1691. ;; Some tests try to access /usr, but that doesn't exist.
  1692. ;; Give them /gnu instead.
  1693. (("/usr") "/gnu")
  1694. (("--ro-bind /bin /bin") "--ro-bind /gnu /bin")
  1695. (("--ro-bind /sbin /sbin") "--ro-bind /gnu /sbin")
  1696. (("--ro-bind /lib /lib") "--ro-bind /gnu /lib")
  1697. ((" */bin/bash") (which "bash"))
  1698. (("/bin/sh") (which "sh"))
  1699. (("findmnt") (which "findmnt"))))
  1700. #t))
  1701. ;; Remove the directory we gave to tests to have a clean package.
  1702. (add-after 'check 'remove-tmp-dir
  1703. (lambda* (#:key outputs #:allow-other-keys)
  1704. (delete-file-recursively (string-append (assoc-ref outputs "out") "/tmp"))
  1705. #t)))))
  1706. (inputs
  1707. `(("libcap" ,libcap)))
  1708. (native-inputs
  1709. `(("python" ,python-wrapper)
  1710. ("util-linux" ,util-linux)))
  1711. (home-page "https://github.com/containers/bubblewrap")
  1712. (synopsis "Unprivileged sandboxing tool")
  1713. (description "Bubblewrap is aimed at running applications in a sandbox,
  1714. restricting their access to parts of the operating system or user data such as
  1715. the home directory. Bubblewrap always creates a new mount namespace, and the
  1716. user can specify exactly what parts of the file system should be made visible
  1717. in the sandbox. These directories are mounted with the @code{nodev} option
  1718. by default and can be made read-only.")
  1719. (license license:lgpl2.0+)))
  1720. (define-public bochs
  1721. (package
  1722. (name "bochs")
  1723. (version "2.7")
  1724. (source
  1725. (origin
  1726. (method url-fetch)
  1727. (uri (string-append "https://sourceforge.net/projects/bochs/files/bochs/"
  1728. version "/bochs-" version ".tar.gz"))
  1729. (sha256
  1730. (base32 "0ymiwnfqg5npq2dk9ngidbbfn3qw8z6i491finhcaan7zldsn450"))))
  1731. (build-system gnu-build-system)
  1732. (arguments
  1733. `(#:tests? #f)) ; no tests exist
  1734. (inputs
  1735. `(("libxrandr" ,libxrandr)))
  1736. (home-page "http://bochs.sourceforge.net/")
  1737. (synopsis "Emulator for x86 PC")
  1738. (description
  1739. "Bochs is an emulator which can emulate Intel x86 CPU, common I/O
  1740. devices, and a custom BIOS. It can also be compiled to emulate many different
  1741. x86 CPUs, from early 386 to the most recent x86-64 Intel and AMD processors.
  1742. Bochs can run most Operating Systems inside the emulation including Linux,
  1743. DOS or Microsoft Windows.")
  1744. (license license:lgpl2.0+)))
  1745. (define-public xen
  1746. (package
  1747. (name "xen")
  1748. (version "4.14.1")
  1749. (source (origin
  1750. (method git-fetch)
  1751. (uri (git-reference
  1752. (url "git://xenbits.xenproject.org/xen.git")
  1753. (commit (string-append "RELEASE-" version))))
  1754. (file-name (git-file-name name version))
  1755. (sha256
  1756. (base32
  1757. "1r90rvypw76ya9clqw5p02gm1k8hxz73f7gr95ca778nnzvb7xjw"))))
  1758. (build-system gnu-build-system)
  1759. (arguments
  1760. `(#:configure-flags
  1761. (list "--enable-rpath"
  1762. "--disable-qemu-traditional" ; It tries to do "git clone"
  1763. "--disable-rombios" ; would try to "git clone" via etherboot.
  1764. ;; TODO: Re-enable stubdom (it's "more secure" to use it).
  1765. "--disable-stubdom" ; tries to "git clone" old patched newlib.
  1766. (string-append "--with-initddir="
  1767. (assoc-ref %outputs "out")
  1768. "/etc/init.d")
  1769. (string-append "--with-system-qemu="
  1770. (assoc-ref %build-inputs "qemu")
  1771. "/bin/qemu-system-i386")
  1772. (string-append "--with-system-seabios="
  1773. (assoc-ref %build-inputs "seabios")
  1774. "/share/firmware/bios.bin")
  1775. (string-append "--with-system-ovmf="
  1776. (assoc-ref %build-inputs "ovmf")
  1777. "/share/firmware/ovmf_ia32.bin"))
  1778. #:make-flags (list "-j" "1"
  1779. "XEN_BUILD_DATE=Thu Jan 1 01:00:01 CET 1970"
  1780. "XEN_BUILD_TIME=01:00:01"
  1781. "XEN_BUILD_HOST="
  1782. "ETHERBOOT_NICS="
  1783. "SMBIOS_REL_DATE=01/01/1970"
  1784. "VGABIOS_REL_DATE=01 Jan 1970"
  1785. ; QEMU_TRADITIONAL_LOC
  1786. ; QEMU_UPSTREAM_LOC
  1787. "SYSCONFIG_DIR=/tmp/etc/default"
  1788. (string-append "BASH_COMPLETION_DIR="
  1789. (assoc-ref %outputs "out")
  1790. "/etc/bash_completion.d")
  1791. (string-append "BOOT_DIR="
  1792. (assoc-ref %outputs "out")
  1793. "/boot")
  1794. (string-append "DEBUG_DIR="
  1795. (assoc-ref %outputs "out")
  1796. "/lib/debug")
  1797. (string-append "EFI_DIR="
  1798. (assoc-ref %outputs "out")
  1799. "/lib/efi") ; TODO lib64 ?
  1800. "MINIOS_UPSTREAM_URL="
  1801. ;(string-append "DISTDIR="
  1802. ; (assoc-ref %outputs "out"))
  1803. )
  1804. #:test-target "test"
  1805. #:phases
  1806. (modify-phases %standard-phases
  1807. (add-after 'unpack 'unpack-mini-os
  1808. (lambda* (#:key inputs #:allow-other-keys)
  1809. (copy-recursively (assoc-ref inputs "mini-os") "extras/mini-os")
  1810. #t))
  1811. (add-after 'unpack-mini-os 'patch
  1812. (lambda* (#:key inputs outputs #:allow-other-keys)
  1813. (substitute* "tools/firmware/Rules.mk"
  1814. (("override XEN_TARGET_ARCH = x86_32")
  1815. (string-append "override XEN_TARGET_ARCH = x86_32
  1816. override CC = " (assoc-ref inputs "cross-gcc") "/bin/i686-linux-gnu-gcc"))
  1817. (("^CFLAGS =$")
  1818. (string-append "CFLAGS=-I" (assoc-ref inputs "cross-libc")
  1819. "/include\n")))
  1820. (substitute* "config/x86_32.mk"
  1821. (("CFLAGS += -m32 -march=i686")
  1822. (string-append "CFLAGS += -march=i686 -I"
  1823. (assoc-ref inputs "cross-libc")
  1824. "/include")))
  1825. ;; /var is not in /gnu/store , so don't try to create it.
  1826. (substitute* '("tools/Makefile"
  1827. "tools/xenstore/Makefile"
  1828. "tools/xenpaging/Makefile")
  1829. (("\\$\\(INSTALL_DIR\\) .*XEN_(DUMP|LOG|RUN|LIB|PAGING)_DIR.*")
  1830. "\n")
  1831. (("\\$\\(INSTALL_DIR\\) .*XEN_(RUN|LIB)_STORED.*")
  1832. "\n"))
  1833. ;; Prevent xen from creating /etc .
  1834. (substitute* "tools/examples/Makefile"
  1835. ((" install-readmes") "")
  1836. ((" install-configs") ""))
  1837. ;; Set rpath.
  1838. (substitute* "tools/pygrub/setup.py"
  1839. (("library_dirs =")
  1840. ; TODO: extra_link_args = ['-Wl,-rpath=/opt/foo'],
  1841. (string-append "runtime_library_dirs = ['"
  1842. (assoc-ref outputs "out")
  1843. "/lib'],\nlibrary_dirs =")))
  1844. #t))
  1845. (add-before 'configure 'patch-xen-script-directory
  1846. (lambda* (#:key outputs #:allow-other-keys)
  1847. (substitute* '("configure"
  1848. "tools/configure"
  1849. "docs/configure")
  1850. (("XEN_SCRIPT_DIR=.*")
  1851. (string-append "XEN_SCRIPT_DIR="
  1852. (assoc-ref outputs "out")
  1853. "/etc/xen/scripts")))
  1854. #t))
  1855. (add-before 'configure 'set-environment-up
  1856. (lambda* (#:key make-flags #:allow-other-keys)
  1857. (define (cross? x)
  1858. (string-contains x "cross-i686-linux"))
  1859. (define (filter-environment! filter-predicate
  1860. environment-variable-names)
  1861. (for-each
  1862. (lambda (env-name)
  1863. (let* ((env-value (getenv env-name))
  1864. (search-path (search-path-as-string->list env-value))
  1865. (new-search-path (filter filter-predicate
  1866. search-path))
  1867. (new-env-value (list->search-path-as-string
  1868. new-search-path ":")))
  1869. (setenv env-name new-env-value)))
  1870. environment-variable-names))
  1871. (setenv "CROSS_C_INCLUDE_PATH" (getenv "C_INCLUDE_PATH"))
  1872. (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
  1873. (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
  1874. (filter-environment! cross?
  1875. '("CROSS_C_INCLUDE_PATH" "CROSS_CPLUS_INCLUDE_PATH"
  1876. "CROSS_LIBRARY_PATH"))
  1877. (filter-environment! (lambda (e) (not (cross? e)))
  1878. '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
  1879. "LIBRARY_PATH"))
  1880. ;; Guix tries to be helpful and automatically adds
  1881. ;; mini-os-git-checkout/include to the include path,
  1882. ;; but actually we don't want it to be there (yet).
  1883. (filter-environment! (lambda (e)
  1884. (not
  1885. (string-contains e
  1886. "mini-os-git-checkout")))
  1887. '("C_INCLUDE_PATH" "CPLUS_INCLUDE_PATH"
  1888. "LIBRARY_PATH"))
  1889. (setenv "EFI_VENDOR" "guix")
  1890. #t))
  1891. (replace 'build
  1892. (lambda* (#:key make-flags #:allow-other-keys)
  1893. (apply invoke "make" "world" make-flags))))))
  1894. (inputs
  1895. `(("acpica" ,acpica) ; TODO: patch iasl invocation.
  1896. ("bridge-utils" ,bridge-utils) ; TODO: patch invocations.
  1897. ("glib" ,glib)
  1898. ("iproute" ,iproute) ; TODO: patch invocations.
  1899. ("libaio" ,libaio)
  1900. ("libx11" ,libx11)
  1901. ("libyajl" ,libyajl)
  1902. ("ncurses" ,ncurses)
  1903. ("openssl" ,openssl)
  1904. ("ovmf" ,ovmf)
  1905. ("pixman" ,pixman)
  1906. ("qemu" ,qemu-minimal)
  1907. ("seabios" ,seabios)
  1908. ("util-linux" ,util-linux "lib") ; uuid
  1909. ; TODO: ocaml-findlib, ocaml-nox.
  1910. ("xz" ,xz) ; for liblzma
  1911. ("zlib" ,zlib)))
  1912. (native-inputs
  1913. `(("dev86" ,dev86)
  1914. ("bison" ,bison)
  1915. ("cmake" ,cmake-minimal)
  1916. ("figlet" ,figlet)
  1917. ("flex" ,flex)
  1918. ("gettext" ,gettext-minimal)
  1919. ("libnl" ,libnl)
  1920. ("mini-os"
  1921. ,(origin
  1922. (method git-fetch)
  1923. (uri (git-reference
  1924. (url "http://xenbits.xen.org/git-http/mini-os.git")
  1925. (commit (string-append "xen-RELEASE-" version))))
  1926. (sha256
  1927. (base32
  1928. "1i8pcl19n60i2m9vlg79q3nknpj209c9ic5x10wxaicx45kc107f"))
  1929. (file-name "mini-os-git-checkout")))
  1930. ("perl" ,perl)
  1931. ; TODO: markdown
  1932. ("pkg-config" ,pkg-config)
  1933. ("python" ,python-2)
  1934. ("wget" ,wget)
  1935. ("cross-gcc" ,(cross-gcc "i686-linux-gnu"
  1936. #:xbinutils (cross-binutils "i686-linux-gnu")
  1937. #:libc (cross-libc "i686-linux-gnu")))
  1938. ("cross-libc" ,(cross-libc "i686-linux-gnu")) ; header files
  1939. ("cross-libc-static" ,(cross-libc "i686-linux-gnu") "static")))
  1940. (home-page "https://xenproject.org/")
  1941. (synopsis "Xen Virtual Machine Monitor")
  1942. (description "This package provides the Xen Virtual Machine Monitor
  1943. which is a hypervisor.")
  1944. ;; TODO: Some files are licensed differently. List those.
  1945. (license license:gpl2)
  1946. (supported-systems '("i686-linux" "x86_64-linux" "armhf-linux"))))
  1947. (define-public osinfo-db-tools
  1948. (package
  1949. (name "osinfo-db-tools")
  1950. (version "1.8.0")
  1951. (source (origin
  1952. (method url-fetch)
  1953. (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-tools-"
  1954. version ".tar.xz"))
  1955. (sha256
  1956. (base32
  1957. "038q3gzdbkfkhpicj0755mw1q4gbvn57pslpw8n2dp3lds9im0g9"))))
  1958. (build-system meson-build-system)
  1959. (inputs
  1960. `(("libsoup" ,libsoup)
  1961. ("libxml2" ,libxml2)
  1962. ("libxslt" ,libxslt)
  1963. ("json-glib" ,json-glib)
  1964. ("libarchive" ,libarchive)))
  1965. (native-inputs
  1966. `(("perl" ,perl)
  1967. ("gobject-introspection" ,gobject-introspection)
  1968. ("gettext" ,gettext-minimal)
  1969. ("pkg-config" ,pkg-config)
  1970. ;; Tests
  1971. ("python" ,python)
  1972. ("pytest" ,python-pytest)
  1973. ("requests" ,python-requests)))
  1974. (home-page "https://gitlab.com/libosinfo/osinfo-db-tools")
  1975. (synopsis "Tools for managing the osinfo database")
  1976. (description "This package contains a set of tools to assist
  1977. administrators and developers in managing the database.")
  1978. (license license:lgpl2.0+)))
  1979. (define-public osinfo-db
  1980. (package
  1981. (name "osinfo-db")
  1982. (version "20210809")
  1983. (source (origin
  1984. (method url-fetch)
  1985. (uri (string-append "https://releases.pagure.org/libosinfo/osinfo-db-"
  1986. version ".tar.xz"))
  1987. (sha256
  1988. (base32
  1989. "16gas6ahxwim1vdjlc4p1gm6q5gfy25h82ngykcm94x69sl6qsan"))))
  1990. (build-system trivial-build-system)
  1991. (arguments
  1992. `(#:modules ((guix build utils))
  1993. #:builder
  1994. (begin
  1995. (use-modules (guix build utils))
  1996. (let* ((out (assoc-ref %outputs "out"))
  1997. (osinfo-dir (string-append out "/share/osinfo"))
  1998. (source (assoc-ref %build-inputs "source"))
  1999. (osinfo-db-import
  2000. (string-append (assoc-ref %build-inputs "osinfo-db-tools")
  2001. "/bin/osinfo-db-import")))
  2002. (mkdir-p osinfo-dir)
  2003. (invoke osinfo-db-import "--dir" osinfo-dir source)
  2004. #t))))
  2005. (native-inputs
  2006. `(("intltool" ,intltool)
  2007. ("osinfo-db-tools" ,osinfo-db-tools)))
  2008. (home-page "https://gitlab.com/libosinfo/osinfo-db")
  2009. (synopsis "Database of information about operating systems")
  2010. (description "Osinfo-db provides the database files for use with the
  2011. libosinfo library. It provides information about guest operating systems for
  2012. use with virtualization provisioning tools")
  2013. (license license:lgpl2.0+)))
  2014. (define-public python-transient
  2015. (package
  2016. (name "python-transient")
  2017. (version "0.12")
  2018. (source
  2019. (origin
  2020. (method url-fetch)
  2021. (uri (pypi-uri "transient" version))
  2022. (sha256
  2023. (base32
  2024. "148yiqrmcscsi6787y0f27i1y9cf0gcw3mqfv5frhpmsmv62mv5z"))))
  2025. (build-system python-build-system)
  2026. (arguments
  2027. `(#:tests? #f ; Requires behave
  2028. #:phases (modify-phases %standard-phases
  2029. (add-after 'unpack 'fix-dependencies
  2030. (lambda _
  2031. (substitute* "setup.py"
  2032. (("==")
  2033. ">="))
  2034. #t)))))
  2035. (propagated-inputs
  2036. `(("python-beautifultable" ,python-beautifultable)
  2037. ("python-click" ,python-click)
  2038. ("python-importlib-resources"
  2039. ,python-importlib-resources)
  2040. ("python-lark-parser" ,python-lark-parser)
  2041. ("python-marshmallow" ,python-marshmallow)
  2042. ("python-progressbar2" ,python-progressbar2)
  2043. ("python-requests" ,python-requests)
  2044. ("python-toml" ,python-toml)))
  2045. (native-inputs
  2046. `(("python-black" ,python-black)
  2047. ("python-mypy" ,python-mypy)
  2048. ("python-pyhamcrest" ,python-pyhamcrest)
  2049. ("python-twine" ,python-twine)))
  2050. (home-page
  2051. "https://github.com/ALSchwalm/transient")
  2052. (synopsis
  2053. "QEMU Wrapper written in Python")
  2054. (description
  2055. "@code{transient} is a wrapper for QEMU allowing the creation of virtual
  2056. machines with shared folder, ssh, and disk creation support.")
  2057. (license license:expat)))