aboutsummaryrefslogtreecommitdiff
path: root/gnu/system
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-07-25 23:57:52 +0200
committerLudovic Courtès <ludo@gnu.org>2015-07-26 00:57:44 +0200
commit72b891e50e1d0106a4b7a0fd88a44e34baae93e9 (patch)
tree8be1c181ffd8633be67995e2830506829a05ba9d /gnu/system
parent5b9da1f955a9c765191259eb9d24520e4b174e38 (diff)
downloadgnu-guix-72b891e50e1d0106a4b7a0fd88a44e34baae93e9.tar
gnu-guix-72b891e50e1d0106a4b7a0fd88a44e34baae93e9.tar.gz
vm: Make the list of partitions to build a parameter.
* gnu/build/vm.scm (<partition>): New record type. (fold2): New procedure. (initialize-partition-table): Remove #:bootable? and 'partition-size' parameters. Add 'partitions' parameter. Invoke 'parted' with '--script'. (initialize-root-partition): Remove. (initialize-partition, root-partition-initializer): New procedures. (initialize-hard-disk): Remove #:system-directory, #:disk-image-size, #:file-system-type, #:file-system-label, #:closures, #:copy-closures?, #:bootable?, and #:register-closures? parameters. Add #:partitions. Rewrite to use 'initialize-partition' for each item of PARTITIONS. * gnu/system/vm.scm (expression->derivation-in-linux-vm): Add (guix records) to #:modules default value. (qemu-image): Adjust accordingly.
Diffstat (limited to 'gnu/system')
-rw-r--r--gnu/system/vm.scm29
1 files changed, 18 insertions, 11 deletions
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index eb27ebce3b..dfb6996067 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -101,6 +101,7 @@
(gnu build linux-modules)
(gnu build file-systems)
(guix elf)
+ (guix records)
(guix build utils)
(guix build syscalls)
(guix build store-copy)))
@@ -227,18 +228,24 @@ the image."
(set-path-environment-variable "PATH" '("bin" "sbin") inputs)
- (let ((graphs '#$(match inputs
- (((names . _) ...)
- names))))
+ (let* ((graphs '#$(match inputs
+ (((names . _) ...)
+ names)))
+ (initialize (root-partition-initializer
+ #:closures graphs
+ #:copy-closures? #$copy-inputs?
+ #:register-closures? #$register-closures?
+ #:system-directory #$os-derivation))
+ (partitions (list (partition
+ (size #$(- disk-image-size
+ (* 10 (expt 2 20))))
+ (label #$file-system-label)
+ (file-system #$file-system-type)
+ (bootable? #t)
+ (initializer initialize)))))
(initialize-hard-disk "/dev/vda"
- #:system-directory #$os-derivation
- #:grub.cfg #$grub-configuration
- #:closures graphs
- #:copy-closures? #$copy-inputs?
- #:register-closures? #$register-closures?
- #:disk-image-size #$disk-image-size
- #:file-system-type #$file-system-type
- #:file-system-label #$file-system-label)
+ #:partitions partitions
+ #:grub.cfg #$grub-configuration)
(reboot))))
#:system system
#:make-disk-image? #t