gnu: When building in a VM, share a temporary directory.

* gnu/build/vm.scm (load-in-linux-vm): Make a shared temporary directory
  available in the VM.
* gnu/system/vm.scm (%linux-vm-file-systems): Add a corresponding entry.
This commit is contained in:
Chris Marusich 2018-03-15 05:09:12 +01:00
parent af81311b8c
commit 8c9bf2946a
No known key found for this signature in database
GPG Key ID: DD409A15D822469D
2 changed files with 17 additions and 2 deletions

View File

@ -126,6 +126,7 @@ the #:references-graphs parameter of 'derivation'."
(number->string disk-image-size))) (number->string disk-image-size)))
(mkdir "xchg") (mkdir "xchg")
(mkdir "tmp")
(match references-graphs (match references-graphs
((graph-files ...) ((graph-files ...)
@ -146,6 +147,12 @@ the #:references-graphs parameter of 'derivation'."
"-virtfs" "-virtfs"
(string-append "local,id=xchg_dev,path=xchg" (string-append "local,id=xchg_dev,path=xchg"
",security_model=none,mount_tag=xchg") ",security_model=none,mount_tag=xchg")
"-virtfs"
;; Some programs require more space in /tmp than is normally
;; available in the guest. Accommodate such programs by sharing a
;; temporary directory.
(string-append "local,id=tmp_dev,path=tmp"
",security_model=none,mount_tag=tmp")
"-kernel" linux "-kernel" linux
"-initrd" initrd "-initrd" initrd
(append (append

View File

@ -4,6 +4,7 @@
;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name> ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com> ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
;;; Copyright © 2018 Chris Marusich <cmmarusich@gmail.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -87,8 +88,8 @@
;;; Code: ;;; Code:
(define %linux-vm-file-systems (define %linux-vm-file-systems
;; File systems mounted for 'derivation-in-linux-vm'. The store and /xchg ;; File systems mounted for 'derivation-in-linux-vm'. These are shared with
;; directory are shared with the host over 9p. ;; the host over 9p.
(list (file-system (list (file-system
(mount-point (%store-prefix)) (mount-point (%store-prefix))
(device "store") (device "store")
@ -102,6 +103,13 @@
(type "9p") (type "9p")
(needed-for-boot? #t) (needed-for-boot? #t)
(options "trans=virtio") (options "trans=virtio")
(check? #f))
(file-system
(mount-point "/tmp")
(device "tmp")
(type "9p")
(needed-for-boot? #t)
(options "trans=virtio")
(check? #f)))) (check? #f))))
(define* (expression->derivation-in-linux-vm name exp (define* (expression->derivation-in-linux-vm name exp