summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2022-01-13 11:35:40 +0100
committerMathieu Othacehe <othacehe@gnu.org>2022-01-14 12:26:07 +0100
commit2d12ec724ea2ab4e96c9040094194ddfa4b2692b (patch)
tree839dab11cbf48ec48c5a2776d10f66726c7c76d2
parent3dbb7112d443ab0220febb467effc5f4c46141b8 (diff)
scripts: system: Rationalize persistency.
Make sure that the images are created with a non volatile root by default and the vm are created with a volatile root by default. Break the --volatile option into --volatile-image and --persistent-vm options. * guix/scripts/system.scm (perform-action): Turn volatile? argument into volatile-vm-root?. (show-help): Introduce --volatile-image and --persistent-vm options instead of --volatile. (%default-options): Adapt it. (%options): Handle those options. (process-action): Honor them. * doc/guix.texi (Invoking guix system): Adapt it accordingly.
-rw-r--r--doc/guix.texi9
-rw-r--r--guix/scripts/system.scm21
2 files changed, 22 insertions, 8 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 92971a531c1..42691570ff6 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -35162,6 +35162,11 @@ $ $(guix system vm my-config.scm) -m 1024 -smp 2 -nic user,model=virtio-net-pci
35162 35162
35163The VM shares its store with the host system. 35163The VM shares its store with the host system.
35164 35164
35165By default, the root file system of the VM is mounted volatile; the
35166@option{--persistent} option can be provided to make it persistent
35167instead. In that case, the VM disk-image file will be copied from the
35168store to the @env{TMPDIR} directory to make it writable.
35169
35165Additional file systems can be shared between the host and the VM using 35170Additional file systems can be shared between the host and the VM using
35166the @option{--share} and @option{--expose} command-line options: the former 35171the @option{--share} and @option{--expose} command-line options: the former
35167specifies a directory to be shared with write access, while the latter 35172specifies a directory to be shared with write access, while the latter
@@ -35199,8 +35204,8 @@ QEMU monitor and the VM.
35199@cindex Creating system images in various formats 35204@cindex Creating system images in various formats
35200@item image 35205@item image
35201@cindex image, creating disk images 35206@cindex image, creating disk images
35202The @code{image} command can produce various image types. The 35207The @code{image} command can produce various image types. The image
35203image type can be selected using the @option{--image-type} option. It 35208type can be selected using the @option{--image-type} option. It
35204defaults to @code{efi-raw}. When its value is @code{iso9660}, the 35209defaults to @code{efi-raw}. When its value is @code{iso9660}, the
35205@option{--label} option can be used to specify a volume ID with 35210@option{--label} option can be used to specify a volume ID with
35206@code{image}. By default, the root file system of a disk image is 35211@code{image}. By default, the root file system of a disk image is
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 98e788c657e..414e931c8a9 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -772,7 +772,7 @@ and TARGET arguments."
772 dry-run? derivations-only? 772 dry-run? derivations-only?
773 use-substitutes? target 773 use-substitutes? target
774 full-boot? 774 full-boot?
775 volatile? 775 volatile-vm-root?
776 (graphic? #t) 776 (graphic? #t)
777 container-shared-network? 777 container-shared-network?
778 (mappings '()) 778 (mappings '())
@@ -827,7 +827,8 @@ static checks."
827 (mlet* %store-monad 827 (mlet* %store-monad
828 ((sys (system-derivation-for-action image action 828 ((sys (system-derivation-for-action image action
829 #:full-boot? full-boot? 829 #:full-boot? full-boot?
830 #:volatile? volatile? 830 #:volatile?
831 volatile-vm-root?
831 #:graphic? graphic? 832 #:graphic? graphic?
832 #:container-shared-network? container-shared-network? 833 #:container-shared-network? container-shared-network?
833 #:mappings mappings)) 834 #:mappings mappings))
@@ -999,6 +1000,8 @@ Some ACTIONS support additional ARGS.\n"))
999 (display (G_ " 1000 (display (G_ "
1000 --volatile for 'image', make the root file system volatile")) 1001 --volatile for 'image', make the root file system volatile"))
1001 (display (G_ " 1002 (display (G_ "
1003 --persistent for 'vm', make the root file system persistent"))
1004 (display (G_ "
1002 --label=LABEL for 'image', label disk image with LABEL")) 1005 --label=LABEL for 'image', label disk image with LABEL"))
1003 (display (G_ " 1006 (display (G_ "
1004 --save-provenance save provenance information")) 1007 --save-provenance save provenance information"))
@@ -1080,7 +1083,10 @@ Some ACTIONS support additional ARGS.\n"))
1080 (alist-cons 'install-bootloader? #f result))) 1083 (alist-cons 'install-bootloader? #f result)))
1081 (option '("volatile") #f #f 1084 (option '("volatile") #f #f
1082 (lambda (opt name arg result) 1085 (lambda (opt name arg result)
1083 (alist-cons 'volatile-root? #t result))) 1086 (alist-cons 'volatile-image-root? #t result)))
1087 (option '("persistent") #f #f
1088 (lambda (opt name arg result)
1089 (alist-cons 'volatile-vm-root? #f result)))
1084 (option '("label") #t #f 1090 (option '("label") #t #f
1085 (lambda (opt name arg result) 1091 (lambda (opt name arg result)
1086 (alist-cons 'label arg result))) 1092 (alist-cons 'label arg result)))
@@ -1149,7 +1155,8 @@ Some ACTIONS support additional ARGS.\n"))
1149 (image-size . guess) 1155 (image-size . guess)
1150 (install-bootloader? . #t) 1156 (install-bootloader? . #t)
1151 (label . #f) 1157 (label . #f)
1152 (volatile-root? . #f) 1158 (volatile-image-root? . #f)
1159 (volatile-vm-root? . #t)
1153 (graph-backend . "graphviz"))) 1160 (graph-backend . "graphviz")))
1154 1161
1155(define (verbosity-level opts) 1162(define (verbosity-level opts)
@@ -1219,7 +1226,8 @@ resulting from command-line parsing."
1219 ((docker-image) docker-image-type) 1226 ((docker-image) docker-image-type)
1220 (else image-type))) 1227 (else image-type)))
1221 (image-size (assoc-ref opts 'image-size)) 1228 (image-size (assoc-ref opts 'image-size))
1222 (volatile? (assoc-ref opts 'volatile-root?)) 1229 (volatile?
1230 (assoc-ref opts 'volatile-image-root?))
1223 (shared-network? 1231 (shared-network?
1224 (assoc-ref opts 'container-shared-network?)) 1232 (assoc-ref opts 'container-shared-network?))
1225 (base-image (if (operating-system? obj) 1233 (base-image (if (operating-system? obj)
@@ -1279,7 +1287,8 @@ resulting from command-line parsing."
1279 #:validate-reconfigure 1287 #:validate-reconfigure
1280 (assoc-ref opts 'validate-reconfigure) 1288 (assoc-ref opts 'validate-reconfigure)
1281 #:full-boot? (assoc-ref opts 'full-boot?) 1289 #:full-boot? (assoc-ref opts 'full-boot?)
1282 #:volatile? (assoc-ref opts 'volatile-root?) 1290 #:volatile-vm-root?
1291 (assoc-ref opts 'volatile-vm-root?)
1283 #:graphic? (not (assoc-ref opts 'no-graphic?)) 1292 #:graphic? (not (assoc-ref opts 'no-graphic?))
1284 #:container-shared-network? 1293 #:container-shared-network?
1285 (assoc-ref opts 'container-shared-network?) 1294 (assoc-ref opts 'container-shared-network?)