From af81311b8c7712db207927c8e7b8ed66602be5c7 Mon Sep 17 00:00:00 2001 From: Chris Marusich Date: Thu, 15 Mar 2018 05:09:11 +0100 Subject: vm: Allow control of deduplication in root-partition-initializer. * gnu/build/vm.scm (root-partition-initializer): Add #:deduplicate? keyword argument. --- gnu/build/vm.scm | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'gnu/build/vm.scm') diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm index 7f6801b9dd..4268ad1111 100644 --- a/gnu/build/vm.scm +++ b/gnu/build/vm.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2016, 2017 Leo Famulari ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2017 Marius Bakke +;;; Copyright © 2018 Chris Marusich ;;; ;;; This file is part of GNU Guix. ;;; @@ -307,11 +308,14 @@ it, run its initializer, and unmount it." (define* (root-partition-initializer #:key (closures '()) copy-closures? (register-closures? #t) - system-directory) + system-directory + (deduplicate? #t)) "Return a procedure to initialize a root partition. -If REGISTER-CLOSURES? is true, register all of CLOSURES is the partition's -store. If COPY-CLOSURES? is true, copy all of CLOSURES to the partition. +If REGISTER-CLOSURES? is true, register all of CLOSURES in the partition's +store. If DEDUPLICATE? is true, then also deduplicate files common to +CLOSURES and the rest of the store when registering the closures. If +COPY-CLOSURES? is true, copy all of CLOSURES to the partition. SYSTEM-DIRECTORY is the name of the directory of the 'system' derivation." (lambda (target) (define target-store @@ -336,7 +340,8 @@ SYSTEM-DIRECTORY is the name of the directory of the 'system' derivation." (display "registering closures...\n") (for-each (lambda (closure) (register-closure target - (string-append "/xchg/" closure))) + (string-append "/xchg/" closure) + #:deduplicate? deduplicate?)) closures) (unless copy-closures? (umount target-store))) -- cgit v1.2.3 From 8c9bf2946a1cb58c5b7b941db3a37830ece80708 Mon Sep 17 00:00:00 2001 From: Chris Marusich Date: Thu, 15 Mar 2018 05:09:12 +0100 Subject: 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. --- gnu/build/vm.scm | 7 +++++++ gnu/system/vm.scm | 12 ++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) (limited to 'gnu/build/vm.scm') diff --git a/gnu/build/vm.scm b/gnu/build/vm.scm index 4268ad1111..527b4c495d 100644 --- a/gnu/build/vm.scm +++ b/gnu/build/vm.scm @@ -126,6 +126,7 @@ the #:references-graphs parameter of 'derivation'." (number->string disk-image-size))) (mkdir "xchg") + (mkdir "tmp") (match references-graphs ((graph-files ...) @@ -146,6 +147,12 @@ the #:references-graphs parameter of 'derivation'." "-virtfs" (string-append "local,id=xchg_dev,path=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 "-initrd" initrd (append diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 594ba66ff4..9d9eafc094 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2016, 2017 Leo Famulari ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2017 Marius Bakke +;;; Copyright © 2018 Chris Marusich ;;; ;;; This file is part of GNU Guix. ;;; @@ -87,8 +88,8 @@ ;;; Code: (define %linux-vm-file-systems - ;; File systems mounted for 'derivation-in-linux-vm'. The store and /xchg - ;; directory are shared with the host over 9p. + ;; File systems mounted for 'derivation-in-linux-vm'. These are shared with + ;; the host over 9p. (list (file-system (mount-point (%store-prefix)) (device "store") @@ -102,6 +103,13 @@ (type "9p") (needed-for-boot? #t) (options "trans=virtio") + (check? #f)) + (file-system + (mount-point "/tmp") + (device "tmp") + (type "9p") + (needed-for-boot? #t) + (options "trans=virtio") (check? #f)))) (define* (expression->derivation-in-linux-vm name exp -- cgit v1.2.3