[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
08/17: maint: The 'release' target builds a VM image.
From: |
Ludovic Courtès |
Subject: |
08/17: maint: The 'release' target builds a VM image. |
Date: |
Sat, 20 May 2017 04:24:05 -0400 (EDT) |
civodul pushed a commit to branch version-0.13.0
in repository guix.
commit a6c642ef63012508f755a1329aa66e4b09da72b5
Author: Leo Famulari <address@hidden>
Date: Sat May 13 20:44:36 2017 -0400
maint: The 'release' target builds a VM image.
* gnu/system/examples/vm-image.tmpl: New file.
* Makefile.am (GUIXSD_VM_SYSTEMS, GUIXSD_VM_IMAGE_BASE,
GUIXSD_VM_IMAGE_SIZE): New variables.
(release): Add logic to build a VM image.
(EXAMPLES): Add 'gnu/system/examples/vm-image.tmpl'.
* doc/guix.texi (Running GuixSD in a VM, Installing GuixSD in a VM):
Mention the
pre-built VM image.
---
Makefile.am | 27 +++++++++++++++++++-
doc/guix.texi | 29 +++++++++++++--------
gnu/system/examples/vm-image.tmpl | 53 +++++++++++++++++++++++++++++++++++++++
3 files changed, 97 insertions(+), 12 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index b90f419..c2fc264 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -5,6 +5,7 @@
# Copyright © 2016 Mathieu Lirzin <address@hidden>
# Copyright © 2016, 2017 Mark H Weaver <address@hidden>
# Copyright © 2017 Mathieu Othacehe <address@hidden>
+# Copyright © 2017 Leo Famulari <address@hidden>
#
# This file is part of GNU Guix.
#
@@ -224,7 +225,8 @@ AUX_FILES = \
EXAMPLES = \
gnu/system/examples/bare-bones.tmpl \
gnu/system/examples/desktop.tmpl \
- gnu/system/examples/lightweight-desktop.tmpl
+ gnu/system/examples/lightweight-desktop.tmpl \
+ gnu/system/examples/vm-image.tmpl
GOBJECTS = $(MODULES:%.scm=%.go) guix/config.go $(dist_noinst_DATA:%.scm=%.go)
@@ -572,12 +574,21 @@ BINARY_TARBALLS =
\
# Systems supported by GuixSD.
GUIXSD_SUPPORTED_SYSTEMS ?= x86_64-linux i686-linux
+# Systems for which we build GuixSD VMs.
+GUIXSD_VM_SYSTEMS ?= x86_64-linux
+
# Prefix of the GuixSD installation image file name.
GUIXSD_IMAGE_BASE = guixsd-usb-install-$(PACKAGE_VERSION)
+# Prefix of the GuixSD VM image file name.
+GUIXSD_VM_IMAGE_BASE = guixsd-vm-image-$(PACKAGE_VERSION)
+
# Size of the installation image (for x86_64 typically).
GUIXSD_INSTALLATION_IMAGE_SIZE ?= 950MiB
+# Size of the VM image (for x86_64 typically).
+GUIXSD_VM_IMAGE_SIZE ?= 2GiB
+
# The release process works in several phases:
#
# 0. We assume the developer created a 'vX.Y' tag.
@@ -632,6 +643,20 @@ release: dist
mv "$(releasedir)/$(GUIXSD_IMAGE_BASE).$$system.xz.tmp"
\
"$(releasedir)/$(GUIXSD_IMAGE_BASE).$$system.xz" ;
\
done
+ for system in $(GUIXSD_VM_SYSTEMS) ; do
\
+ image=`$(top_builddir)/pre-inst-env
\
+ guix system vm-image
\
+ --system=$$system
\
+ --image-size=$(GUIXSD_VM_IMAGE_SIZE)
\
+ gnu/system/examples/vm-image.tmpl` ;
\
+ if [ ! -f "$$image" ] ; then
\
+ echo "failed to produced GuixSD VM image for $$system" >&2 ;
\
+ exit 1 ;
\
+ fi ;
\
+ xz < "$$image" >
"$(releasedir)/$(GUIXSD_VM_IMAGE_BASE).$$system.xz.tmp" ; \
+ mv "$(releasedir)/$(GUIXSD_VM_IMAGE_BASE).$$system.xz.tmp"
\
+ "$(releasedir)/$(GUIXSD_VM_IMAGE_BASE).$$system.xz" ;
\
+ done
@echo
@echo "Congratulations! All the release files are now in
$(releasedir)."
@echo
diff --git a/doc/guix.texi b/doc/guix.texi
index 7baf6ee..3523937 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -7634,8 +7634,11 @@ good.
@subsection Installing GuixSD in a Virtual Machine
@cindex virtual machine, GuixSD installation
-If you'd like to install GuixSD in a virtual machine (VM) rather than on
-your beloved machine, this section is for you.
address@hidden virtual private server (VPS)
address@hidden VPS (virtual private server)
+If you'd like to install GuixSD in a virtual machine (VM) or on a
+virtual private server (VPS) rather than on your beloved machine, this
+section is for you.
To boot a @uref{http://qemu.org/,QEMU} VM for installing GuixSD in a
disk image, follow these steps:
@@ -15693,17 +15696,21 @@ example graph.
@subsection Running GuixSD in a Virtual Machine
@cindex virtual machine
-One way to run GuixSD in a virtual machine (VM) is to build a GuixSD
-virtual machine image using @command{guix system vm-image}
-(@pxref{Invoking guix system}). The returned image is in qcow2 format,
-which the @uref{http://qemu.org/, QEMU emulator} can efficiently use.
+To run GuixSD in a virtual machine (VM), one can either use the
+pre-built GuixSD VM image distributed at
address@hidden://alpha.gnu.org/guix/address@hidden@var{system}.tar.xz}
+, or build their own virtual machine image using @command{guix system
+vm-image} (@pxref{Invoking guix system}). The returned image is in
+qcow2 format, which the @uref{http://qemu.org/, QEMU emulator} can
+efficiently use.
@cindex QEMU
-To run the image in QEMU, copy it out of the store (@pxref{The Store})
-and give yourself permission to write to the copy. When invoking QEMU,
-you must choose a system emulator that is suitable for your hardware
-platform. Here is a minimal QEMU invocation that will boot the result
-of @command{guix system vm-image} on x86_64 hardware:
+If you built your own image, you must copy it out of the store
+(@pxref{The Store}) and give yourself permission to write to the copy
+before you can use it. When invoking QEMU, you must choose a system
+emulator that is suitable for your hardware platform. Here is a minimal
+QEMU invocation that will boot the result of @command{guix system
+vm-image} on x86_64 hardware:
@example
$ qemu-system-x86_64 \
diff --git a/gnu/system/examples/vm-image.tmpl
b/gnu/system/examples/vm-image.tmpl
new file mode 100644
index 0000000..57ac71c
--- /dev/null
+++ b/gnu/system/examples/vm-image.tmpl
@@ -0,0 +1,53 @@
+;;; This is an operating system configuration template for a "bare-bones"
setup,
+;;; suitable for booting in a virtualized environment, including virtual
private
+;;; servers (VPS).
+
+(use-modules (gnu))
+(use-package-modules bootloaders disk nvi)
+
+(define vm-image-motd (plain-file "motd" "
+This is the GNU system. Welcome!
+
+This instance of GuixSD is a bare-bones template for virtualized environments.
+
+You will probably want to do these things first if you booted in a virtual
+private server (VPS):
+
+* Set a password for 'root'.
+* Set up networking.
+* Expand the root partition to fill the space available by 0) deleting and
+recreating the partition with fdisk, 1) reloading the partition table with
+partprobe, and then 2) resizing the filesystem with resize2fs.\n"))
+
+(operating-system
+ (host-name "gnu")
+ (timezone "Etc/UTC")
+ (locale "en_US.utf8")
+
+ ;; Assuming /dev/sdX is the target hard disk, and "my-root" is
+ ;; the label of the target root file system.
+ (bootloader (grub-configuration (device "/dev/sda")
+ (terminal-outputs '(console))))
+ (file-systems (cons (file-system
+ (device "my-root")
+ (title 'label)
+ (mount-point "/")
+ (type "ext4"))
+ %base-file-systems))
+
+ ;; This is where user accounts are specified. The "root"
+ ;; account is implicit, and is initially created with the
+ ;; empty password.
+ (users %base-user-accounts)
+
+ ;; Globally-installed packages.
+ (packages (cons* nvi fdisk
+ grub ; mostly so xrefs to its manual work
+ parted ; partprobe
+ %base-packages))
+
+ (services (modify-services %base-services
+ (login-service-type config =>
+ (login-configuration
+ (inherit config)
+ (motd vm-image-motd))))))
- 09/17: services: openssh: Don't depend on networking., (continued)
- 09/17: services: openssh: Don't depend on networking., Ludovic Courtès, 2017/05/20
- 11/17: services: user-homes: Do not create home directories marked as no-create., Ludovic Courtès, 2017/05/20
- 10/17: install: Enable SSH in installation image., Ludovic Courtès, 2017/05/20
- 15/17: gnu: guile-ssh: Fix potential double-free/use-after-free issue., Ludovic Courtès, 2017/05/20
- 07/17: gnu: aspell: 'dict-dir' set to ~/.guix-profile/lib/aspell or $ASPELL_DICT_DIR., Ludovic Courtès, 2017/05/20
- 14/17: modules: Add more source-less modules., Ludovic Courtès, 2017/05/20
- 12/17: union: Gracefully handle dangling symlinks in the input., Ludovic Courtès, 2017/05/20
- 13/17: publish: Fix narinfo rendering for already-compressed items., Ludovic Courtès, 2017/05/20
- 17/17: vm: Support creating FAT partitions., Ludovic Courtès, 2017/05/20
- 05/17: gnu: qemu: Fix CVE-2017-7493., Ludovic Courtès, 2017/05/20
- 08/17: maint: The 'release' target builds a VM image.,
Ludovic Courtès <=
- 16/17: vm: Support arbitrary partition flags., Ludovic Courtès, 2017/05/20