summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2020-05-15 22:23:21 +0200
committerTobias Geerinckx-Rice <me@tobias.gr>2020-05-17 15:16:49 +0200
commitba3138ab0f1d9f332a42f2a69a60e3879405c9b8 (patch)
tree456bcc1d0ad22bfd7e29bd02c6971becb42c9af3 /gnu
parent3d028f03c8cc258fa74b87f15a80b7b2b7da28ec (diff)
downloadguix-ba3138ab0f1d9f332a42f2a69a60e3879405c9b8.tar.gz
vm: Use 'let-system'.
* gnu/system/vm.scm (expression->derivation-in-linux-vm)[check]: New macro.
[builder]: Use 'let-system' and 'check' instead of referencing
'%current-system' and '%current-target-system'.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/system/vm.scm15
1 files changed, 8 insertions, 7 deletions
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 163e8b4e9c..3e483fd86c 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -199,6 +199,10 @@ substitutable."
                       (sync)
                       (reboot))))
 
+  (define-syntax-rule (check predicate)
+    (let-system (system target)
+      (predicate (or target system))))
+
   (let ((initrd (or initrd
                     (base-initrd file-systems
                                  #:on-error 'backtrace
@@ -229,7 +233,8 @@ substitutable."
                      (graphs  '#$(match references-graphs
                                    (((graph-files . _) ...) graph-files)
                                    (_ #f)))
-                     (target  #$(or (%current-target-system) (%current-system)))
+                     (target  #$(let-system (system target)
+                                  (or target system)))
                      (size    #$(if (eq? 'guess disk-image-size)
                                     #~(+ (* 70 (expt 2 20)) ;ESP
                                          (estimated-partition-size graphs))
@@ -244,12 +249,8 @@ substitutable."
                                   #:memory-size #$memory-size
                                   #:make-disk-image? #$make-disk-image?
                                   #:single-file-output? #$single-file-output?
-                                  ;; FIXME: ‘target-arm32?’ and
-                                  ;; ‘target-aarch64?’ may not operate on the
-                                  ;; right system/target values.  Rewrite
-                                  ;; using ‘let-system’ when available.
-                                  #:target-arm32? #$(target-arm32?)
-                                  #:target-aarch64? #$(target-aarch64?)
+                                  #:target-arm32? #$(check target-arm32?)
+                                  #:target-aarch64? #$(check target-aarch64?)
                                   #:disk-image-format #$disk-image-format
                                   #:disk-image-size size
                                   #:references-graphs graphs))))))