Notes about using virtualization technologies on Guix.
Below you will find a summary of how-to generate a virtual environment from a system configuration file. If you would like to learn more about different virtualization software, and how-to install and use them, please continue here: qemu / docker
Using Guix as host, we can generate a shell script that runs Guix based on a system configuration file. later we can pass QEMU parameters to this generated script.
$ guix system vm /path/to/config.scm
...
/gnu/store/...-run-vm.sh
$ /gnu/store/…-run-vm.sh -m 1024 -smp 2 -net user,model=virtio-net-pci
running the above script, we have a QEMU instance, that boots to an instance of Guix defined by our configuration file.
alternatively we can generate a disk image in QCOW2 format, containing Guix instance installed on match with our provided configuration file.
$ guix system vm-image /path/to/config.scm
...
/gnu/store/...-qemu-image
later we can run this image using qemu
.
$ qemu-system-x86_64 \
-nic user,model=virtio-net-pci \
-enable-kvm -m 1024 \
-device virtio-blk,drive=myhd \
-drive if=none,file=/path/to/...-qemu-image,id=myhd
running the disk image there are a series of items that we need to consider:
generated disk image will be saved in store
, and since store is a read-only location, we need to copy that to some other place and assign write permission before we can use generated image.
default image generated using guix system vm-image
usually doesn’t have enough space for additional files and packages to store/install. so if we need more space, we should pass our desired size using --image-size
parameter.
$ guix system vm-image /path/to/config.scm --image-size=10G
hostfwt
parameter of QEMU:$ qemu-system-x86_64 -nic user,model=virtio-net-pci,hostfwd=tcp::10022-:22 ...
later we can connect to guest machine using ssh client:
$ ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 10022 root@127.0.0.1
in order to switch to other virtual TTY in guest os, we need to switch to monitoring console of QEMU using ctrl+alt+2
and send our key combination using sendkey
command:
sendkey ctrl-alt-f2
later we can switch back to default console using ctrl+alt+1
command.
TODO
PantherX & (unofficial) GNU Guix Wiki.
Last update: 2022-08-10 21:54:56 +0000
Inspired by the excellent Arch Linux Wiki