summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2021-01-19 18:09:28 +0100
committerMathieu Othacehe <othacehe@gnu.org>2021-02-17 10:52:28 +0100
commitee2a5da80a9bda25542c00a7a35a9ddddcbd58af (patch)
treea578e04f14dad512d5f2bbc66aeedc463a3a94c5
parent43b2e440c38a39eb64088bd6c08771c060aa10fc (diff)
scripts: system: Remove 'vm-image' command.
Remove the 'vm-image' command that has been superseded by the 'image' command. * gnu/system/vm.scm (system-qemu-image): Remove it. * guix/scripts/system.scm (system-derivation-for-action): Mark 'vm-image' command as deprecated and use the image API to produce the VM image. (perform-action, show-help): Adapt accordingly. * tests/guix-system.sh: Ditto. * doc/guix.texi (Invoking guix system, Running Guix in a VM): Ditto. * etc/completion/fish/guix.fish: Ditto. * etc/completion/zsh/_guix: Ditto.
-rw-r--r--doc/guix.texi33
-rw-r--r--etc/completion/fish/guix.fish7
-rw-r--r--etc/completion/zsh/_guix2
-rw-r--r--gnu/system/vm.scm63
-rw-r--r--guix/scripts/system.scm24
-rw-r--r--tests/guix-system.sh2
6 files changed, 33 insertions, 98 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index 942d5f93dff..69897169bd4 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -32575,8 +32575,7 @@ size of the image.
32575 32575
32576@cindex System images, creation in various formats 32576@cindex System images, creation in various formats
32577@cindex Creating system images in various formats 32577@cindex Creating system images in various formats
32578@item vm-image 32578@item image
32579@itemx image
32580@itemx docker-image 32579@itemx docker-image
32581Return a virtual machine, disk image, or Docker image of the operating 32580Return a virtual machine, disk image, or Docker image of the operating
32582system declared in @var{file} that stands alone. By default, 32581system declared in @var{file} that stands alone. By default,
@@ -32620,15 +32619,15 @@ the image to it using the following command:
32620The @code{--list-image-types} command lists all the available image 32619The @code{--list-image-types} command lists all the available image
32621types. 32620types.
32622 32621
32623@cindex vm-image, creating virtual machine images 32622@cindex creating virtual machine images
32624When using @code{vm-image}, the returned image is in qcow2 format, which 32623When using the @code{qcow2} image type, the returned image is in qcow2
32625the QEMU emulator can efficiently use. @xref{Running Guix in a VM}, for 32624format, which the QEMU emulator can efficiently use. @xref{Running Guix
32626more information on how to run the image in a virtual machine. The 32625in a VM}, for more information on how to run the image in a virtual
32627@code{grub-bootloader} bootloader is always used independently of what 32626machine. The @code{grub-bootloader} bootloader is always used
32628is declared in the @code{operating-system} file passed as argument. 32627independently of what is declared in the @code{operating-system} file
32629This is to make it easier to work with QEMU, which uses the SeaBIOS BIOS 32628passed as argument. This is to make it easier to work with QEMU, which
32630by default, expecting a bootloader to be installed in the Master Boot 32629uses the SeaBIOS BIOS by default, expecting a bootloader to be installed
32631Record (MBR). 32630in the Master Boot Record (MBR).
32632 32631
32633@cindex docker-image, creating docker images 32632@cindex docker-image, creating docker images
32634When using @code{docker-image}, a Docker image is produced. Guix builds 32633When using @code{docker-image}, a Docker image is produced. Guix builds
@@ -32723,7 +32722,7 @@ create a virtual machine image that contains provenance information, you
32723can run: 32722can run:
32724 32723
32725@example 32724@example
32726guix system vm-image --save-provenance config.scm 32725guix system image -t qcow2 --save-provenance config.scm
32727@end example 32726@end example
32728 32727
32729That way, the resulting image will effectively ``embed its own source'' 32728That way, the resulting image will effectively ``embed its own source''
@@ -32746,10 +32745,10 @@ When this option is omitted, @command{guix system} uses the
32746for burning on CDs and DVDs. 32745for burning on CDs and DVDs.
32747 32746
32748@item --image-size=@var{size} 32747@item --image-size=@var{size}
32749For the @code{vm-image} and @code{image} actions, create an image 32748For the @code{image} action, create an image of the given @var{size}.
32750of the given @var{size}. @var{size} may be a number of bytes, or it may 32749@var{size} may be a number of bytes, or it may include a unit as a
32751include a unit as a suffix (@pxref{Block size, size specifications,, 32750suffix (@pxref{Block size, size specifications,, coreutils, GNU
32752coreutils, GNU Coreutils}). 32751Coreutils}).
32753 32752
32754When this option is omitted, @command{guix system} computes an estimate 32753When this option is omitted, @command{guix system} computes an estimate
32755of the image size as a function of the size of the system declared in 32754of the image size as a function of the size of the system declared in
@@ -33112,7 +33111,7 @@ If you built your own image, you must copy it out of the store
33112before you can use it. When invoking QEMU, you must choose a system 33111before you can use it. When invoking QEMU, you must choose a system
33113emulator that is suitable for your hardware platform. Here is a minimal 33112emulator that is suitable for your hardware platform. Here is a minimal
33114QEMU invocation that will boot the result of @command{guix system 33113QEMU invocation that will boot the result of @command{guix system
33115vm-image} on x86_64 hardware: 33114image -t qcow2} on x86_64 hardware:
33116 33115
33117@example 33116@example
33118$ qemu-system-x86_64 \ 33117$ qemu-system-x86_64 \
diff --git a/etc/completion/fish/guix.fish b/etc/completion/fish/guix.fish
index 73bd1761123..422baab4bb1 100644
--- a/etc/completion/fish/guix.fish
+++ b/etc/completion/fish/guix.fish
@@ -133,7 +133,7 @@ complete -f -c guix -n '__fish_guix_using_command pull' -l url -d 'download the
133complete -f -c guix -n '__fish_guix_using_command pull' -l bootstrap -d 'use the bootstrap Guile to build the new Guix' 133complete -f -c guix -n '__fish_guix_using_command pull' -l bootstrap -d 'use the bootstrap Guile to build the new Guix'
134 134
135#### system 135#### system
136set -l remotecommands reconfigure roll-back switch-generation list-generations build container vm vm-image disk-image init extension-graph shepherd-graph load-path keep-failed keep-going dry-run fallback no-substitutes substitutes-urls no-grafts no-offload max-silent-time timeout verbosity rounds cores max-jobs derivation on-error image-size no-grub share expose full-boot 136set -l remotecommands reconfigure roll-back switch-generation list-generations build container vm image init extension-graph shepherd-graph load-path keep-failed keep-going dry-run fallback no-substitutes substitutes-urls no-grafts no-offload max-silent-time timeout verbosity rounds cores max-jobs derivation on-error image-size no-grub share expose full-boot
137complete -f -c guix -n '__fish_guix_needs_command' -a system -d 'Build the operating system declared in FILE according to ACTION.' 137complete -f -c guix -n '__fish_guix_needs_command' -a system -d 'Build the operating system declared in FILE according to ACTION.'
138complete -f -c guix -n '__fish_guix_using_command system' -l reconfigure -d 'switch to a new operating system configuration' 138complete -f -c guix -n '__fish_guix_using_command system' -l reconfigure -d 'switch to a new operating system configuration'
139complete -f -c guix -n '__fish_guix_using_command system' -l roll-back -d 'switch to the previous operating system configuration' 139complete -f -c guix -n '__fish_guix_using_command system' -l roll-back -d 'switch to the previous operating system configuration'
@@ -142,8 +142,7 @@ complete -f -c guix -n '__fish_guix_using_command system' -l list-generations -d
142complete -f -c guix -n '__fish_guix_using_command system' -l build -d 'build the operating system without installing anything' 142complete -f -c guix -n '__fish_guix_using_command system' -l build -d 'build the operating system without installing anything'
143complete -f -c guix -n '__fish_guix_using_command system' -l container -d 'build a container that shares the host\'s store' 143complete -f -c guix -n '__fish_guix_using_command system' -l container -d 'build a container that shares the host\'s store'
144complete -f -c guix -n '__fish_guix_using_command system' -l vm -d 'build a virtual machine image that shares the host\'s store' 144complete -f -c guix -n '__fish_guix_using_command system' -l vm -d 'build a virtual machine image that shares the host\'s store'
145complete -f -c guix -n '__fish_guix_using_command system' -l vm-image -d 'build a freestanding virtual machine image' 145complete -f -c guix -n '__fish_guix_using_command system' -l image -d 'build a disk image, suitable for a USB stick'
146complete -f -c guix -n '__fish_guix_using_command system' -l disk-image -d 'build a disk image, suitable for a USB stick'
147complete -f -c guix -n '__fish_guix_using_command system' -l init -d 'initialize a root file system to run GNU' 146complete -f -c guix -n '__fish_guix_using_command system' -l init -d 'initialize a root file system to run GNU'
148complete -f -c guix -n '__fish_guix_using_command system' -l extension-graph -d 'emit the service extension graph in Dot format' 147complete -f -c guix -n '__fish_guix_using_command system' -l extension-graph -d 'emit the service extension graph in Dot format'
149complete -f -c guix -n '__fish_guix_using_command system' -l shepherd-graph -d 'emit the graph of shepherd services in Dot format' 148complete -f -c guix -n '__fish_guix_using_command system' -l shepherd-graph -d 'emit the graph of shepherd services in Dot format'
@@ -167,7 +166,7 @@ complete -f -c guix -n '__fish_guix_using_command system' -s M -d 'allow at most
167complete -f -c guix -n '__fish_guix_using_command system' -a "--max-jobs=" -d 'allow at most N build jobs' 166complete -f -c guix -n '__fish_guix_using_command system' -a "--max-jobs=" -d 'allow at most N build jobs'
168complete -f -c guix -n '__fish_guix_using_command system' -s d -l derivation -d 'return the derivation of the given system' 167complete -f -c guix -n '__fish_guix_using_command system' -s d -l derivation -d 'return the derivation of the given system'
169complete -f -c guix -n '__fish_guix_using_command system' -a "--on-error=" -d 'apply STRATEGY when an error occurs while reading FILE' 168complete -f -c guix -n '__fish_guix_using_command system' -a "--on-error=" -d 'apply STRATEGY when an error occurs while reading FILE'
170complete -f -c guix -n '__fish_guix_using_command system' -a "--image-size=" -d 'for \'vm-image\', produce an image of SIZE' 169complete -f -c guix -n '__fish_guix_using_command system' -a "--image-size=" -d 'for \'image\', produce an image of SIZE'
171complete -f -c guix -n '__fish_guix_using_command system' -l no-grub -d 'for \'init\', do not install GRUB' 170complete -f -c guix -n '__fish_guix_using_command system' -l no-grub -d 'for \'init\', do not install GRUB'
172complete -f -c guix -n '__fish_guix_using_command system' -a "--share=" -d 'for \'vm\', share host file system according to SPEC' 171complete -f -c guix -n '__fish_guix_using_command system' -a "--share=" -d 'for \'vm\', share host file system according to SPEC'
173complete -f -c guix -n '__fish_guix_using_command system' -a "--expose=" -d 'for \'vm\', expose host file system according to SPEC' 172complete -f -c guix -n '__fish_guix_using_command system' -a "--expose=" -d 'for \'vm\', expose host file system according to SPEC'
diff --git a/etc/completion/zsh/_guix b/etc/completion/zsh/_guix
index ae93b62b1d4..aa1a859e0dd 100644
--- a/etc/completion/zsh/_guix
+++ b/etc/completion/zsh/_guix
@@ -383,7 +383,7 @@ _guix_list_installed_packages()
383 '--max-jobs=[allow at most N build jobs]:N' \ 383 '--max-jobs=[allow at most N build jobs]:N' \
384 '--derivation[return the derivation of the given system]' \ 384 '--derivation[return the derivation of the given system]' \
385 '--on-error=[apply STRATEGY when an error occurs while reading FILE]:STRATEGY' \ 385 '--on-error=[apply STRATEGY when an error occurs while reading FILE]:STRATEGY' \
386 '--image-size=[for "vm-image", produce an image of SIZE]:SIZE' \ 386 '--image-size=[for "image", produce an image of SIZE]:SIZE' \
387 '--no-grub[for "init", do not install GRUB]' \ 387 '--no-grub[for "init", do not install GRUB]' \
388 '--share=[for "vm", share host file system according to SPEC]:SPEC' \ 388 '--share=[for "vm", share host file system according to SPEC]:SPEC' \
389 '--expose=[for "vm", expose host file system according to SPEC]:SPEC' \ 389 '--expose=[for "vm", expose host file system according to SPEC]:SPEC' \
diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm
index 1afae6b4edf..d7ae048b81e 100644
--- a/gnu/system/vm.scm
+++ b/gnu/system/vm.scm
@@ -73,7 +73,6 @@
73 #:export (expression->derivation-in-linux-vm 73 #:export (expression->derivation-in-linux-vm
74 qemu-image 74 qemu-image
75 virtualized-operating-system 75 virtualized-operating-system
76 system-qemu-image
77 76
78 system-qemu-image/shared-store 77 system-qemu-image/shared-store
79 system-qemu-image/shared-store-script 78 system-qemu-image/shared-store-script
@@ -559,68 +558,6 @@ the operating system."
559 558
560 559
561;;; 560;;;
562;;; VM and disk images.
563;;;
564
565(define* (system-qemu-image os
566 #:key
567 (file-system-type "ext4")
568 (disk-image-size (* 900 (expt 2 20))))
569 "Return the derivation of a freestanding QEMU image of DISK-IMAGE-SIZE bytes
570of the GNU system as described by OS."
571 (define file-systems-to-keep
572 ;; Keep only file systems other than root and not normally bound to real
573 ;; devices.
574 (remove (lambda (fs)
575 (let ((target (file-system-mount-point fs))
576 (source (file-system-device fs)))
577 (or (string=? target "/")
578 (and (string? source)
579 (string-prefix? "/dev/" source))
580 (uuid? source)
581 (file-system-label? source))))
582 (operating-system-file-systems os)))
583
584 (define root-uuid
585 ;; UUID of the root file system.
586 (operating-system-uuid os
587 (if (string=? file-system-type "iso9660")
588 'iso9660
589 'dce)))
590
591
592 (let* ((os (operating-system
593 (inherit os)
594
595 ;; As in 'virtualized-operating-system', use BIOS-style GRUB.
596 (bootloader (bootloader-configuration
597 (bootloader grub-bootloader)
598 (target "/dev/vda")))
599
600 ;; Assume we have an initrd with the whole QEMU shebang.
601
602 ;; Force our own root file system. Refer to it by UUID so that
603 ;; it works regardless of how the image is used ("qemu -hda",
604 ;; Xen, etc.).
605 (file-systems (cons (file-system
606 (mount-point "/")
607 (device root-uuid)
608 (type file-system-type))
609 file-systems-to-keep))))
610 (bootcfg (operating-system-bootcfg os)))
611 (qemu-image #:os os
612 #:bootcfg-drv bootcfg
613 #:bootloader (bootloader-configuration-bootloader
614 (operating-system-bootloader os))
615 #:disk-image-size disk-image-size
616 #:file-system-type file-system-type
617 #:file-system-uuid root-uuid
618 #:inputs `(("system" ,os)
619 ("bootcfg" ,bootcfg))
620 #:copy-inputs? #t)))
621
622
623;;;
624;;; VMs that share file systems with the host. 561;;; VMs that share file systems with the host.
625;;; 562;;;
626 563
diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm
index 19b8c5163c4..ead20a071ea 100644
--- a/guix/scripts/system.scm
+++ b/guix/scripts/system.scm
@@ -695,8 +695,6 @@ checking this by themselves in their 'check' procedure."
695 os 695 os
696 #:mappings mappings 696 #:mappings mappings
697 #:shared-network? container-shared-network?)) 697 #:shared-network? container-shared-network?))
698 ((vm-image)
699 (system-qemu-image os #:disk-image-size image-size))
700 ((vm) 698 ((vm)
701 (system-qemu-image/shared-store-script os 699 (system-qemu-image/shared-store-script os
702 #:full-boot? full-boot? 700 #:full-boot? full-boot?
@@ -705,11 +703,16 @@ checking this by themselves in their 'check' procedure."
705 image-size 703 image-size
706 (* 70 (expt 2 20))) 704 (* 70 (expt 2 20)))
707 #:mappings mappings)) 705 #:mappings mappings))
708 ((image disk-image) 706 ((image disk-image vm-image)
709 (let* ((base-image (os->image os #:type image-type)) 707 (let* ((image-type (if (eq? action 'vm-image)
708 qcow2-image-type
709 image-type))
710 (base-image (os->image os #:type image-type))
710 (base-target (image-target base-image))) 711 (base-target (image-target base-image)))
711 (when (eq? action 'disk-image) 712 (when (eq? action 'disk-image)
712 (warning (G_ "'disk-image' is deprecated: use 'image' instead~%"))) 713 (warning (G_ "'disk-image' is deprecated: use 'image' instead~%")))
714 (when (eq? action 'vm-image)
715 (warning (G_ "'vm-image' is deprecated: use 'image' instead~%")))
713 (lower-object 716 (lower-object
714 (system-image 717 (system-image
715 (image 718 (image
@@ -781,9 +784,8 @@ and TARGET arguments."
781 "Perform ACTION for OS. INSTALL-BOOTLOADER? specifies whether to install 784 "Perform ACTION for OS. INSTALL-BOOTLOADER? specifies whether to install
782bootloader; BOOTLOADER-TAGET is the target for the bootloader; TARGET is the 785bootloader; BOOTLOADER-TAGET is the target for the bootloader; TARGET is the
783target root directory; IMAGE-SIZE is the size of the image to be built, for 786target root directory; IMAGE-SIZE is the size of the image to be built, for
784the 'vm-image' and 'image' actions. IMAGE-TYPE is the type of image to 787the 'image' action. IMAGE-TYPE is the type of image to be built. When
785be built. When VOLATILE-ROOT? is #t, the root file system is mounted 788VOLATILE-ROOT? is #t, the root file system is mounted volatile.
786volatile.
787 789
788FULL-BOOT? is used for the 'vm' action; it determines whether to 790FULL-BOOT? is used for the 'vm' action; it determines whether to
789boot directly to the kernel or to the bootloader. CONTAINER-SHARED-NETWORK? 791boot directly to the kernel or to the bootloader. CONTAINER-SHARED-NETWORK?
@@ -969,8 +971,6 @@ Some ACTIONS support additional ARGS.\n"))
969 (display (G_ "\ 971 (display (G_ "\
970 vm build a virtual machine image that shares the host's store\n")) 972 vm build a virtual machine image that shares the host's store\n"))
971 (display (G_ "\ 973 (display (G_ "\
972 vm-image build a freestanding virtual machine image\n"))
973 (display (G_ "\
974 image build a Guix System image\n")) 974 image build a Guix System image\n"))
975 (display (G_ "\ 975 (display (G_ "\
976 docker-image build a Docker image\n")) 976 docker-image build a Docker image\n"))
@@ -999,7 +999,7 @@ Some ACTIONS support additional ARGS.\n"))
999 (display (G_ " 999 (display (G_ "
1000 -t, --image-type=TYPE for 'image', produce an image of TYPE")) 1000 -t, --image-type=TYPE for 'image', produce an image of TYPE"))
1001 (display (G_ " 1001 (display (G_ "
1002 --image-size=SIZE for 'vm-image', produce an image of SIZE")) 1002 --image-size=SIZE for 'image', produce an image of SIZE"))
1003 (display (G_ " 1003 (display (G_ "
1004 --no-bootloader for 'init', do not install a bootloader")) 1004 --no-bootloader for 'init', do not install a bootloader"))
1005 (display (G_ " 1005 (display (G_ "
@@ -1017,8 +1017,8 @@ Some ACTIONS support additional ARGS.\n"))
1017 (display (G_ " 1017 (display (G_ "
1018 -N, --network for 'container', allow containers to access the network")) 1018 -N, --network for 'container', allow containers to access the network"))
1019 (display (G_ " 1019 (display (G_ "
1020 -r, --root=FILE for 'vm', 'vm-image', 'image', 'container', 1020 -r, --root=FILE for 'vm', 'image', 'container' and 'build',
1021 and 'build', make FILE a symlink to the result, and 1021 make FILE a symlink to the result, and
1022 register it as a garbage collector root")) 1022 register it as a garbage collector root"))
1023 (display (G_ " 1023 (display (G_ "
1024 --full-boot for 'vm', make a full boot sequence")) 1024 --full-boot for 'vm', make a full boot sequence"))
diff --git a/tests/guix-system.sh b/tests/guix-system.sh
index 24cc2591d54..8bc0dcf2fc5 100644
--- a/tests/guix-system.sh
+++ b/tests/guix-system.sh
@@ -339,7 +339,7 @@ done
339 339
340# Verify that the disk image types can be built. 340# Verify that the disk image types can be built.
341guix system -n vm gnu/system/examples/vm-image.tmpl 341guix system -n vm gnu/system/examples/vm-image.tmpl
342guix system -n vm-image gnu/system/examples/vm-image.tmpl 342guix system -n image -t qcow2 gnu/system/examples/vm-image.tmpl
343# This invocation was taken care of in the loop above: 343# This invocation was taken care of in the loop above:
344# guix system -n disk-image gnu/system/examples/bare-bones.tmpl 344# guix system -n disk-image gnu/system/examples/bare-bones.tmpl
345guix system -n disk-image -t iso9660 gnu/system/examples/bare-bones.tmpl 345guix system -n disk-image -t iso9660 gnu/system/examples/bare-bones.tmpl