lol

Merge pull request #235295 from nikstur/qemu-vm-improve-comments-and-docs

nixos/qemu-vm: improve comments and option descriptions

authored by

Ryan Lahfa and committed by
GitHub
09029580 fc6855d8

+11 -18
+11 -18
nixos/modules/virtualisation/qemu-vm.nix
··· 1 1 # This module creates a virtual machine from the NixOS configuration. 2 2 # Building the `config.system.build.vm' attribute gives you a command 3 3 # that starts a KVM/QEMU VM running the NixOS configuration defined in 4 - # `config'. The Nix store is shared read-only with the host, which 5 - # makes (re)building VMs very efficient. However, it also means you 6 - # can't reconfigure the guest inside the guest - you need to rebuild 7 - # the VM in the host. On the other hand, the root filesystem is a 8 - # read/writable disk image persistent across VM reboots. 4 + # `config'. By default, the Nix store is shared read-only with the 5 + # host, which makes (re)building VMs very efficient. 9 6 10 7 { config, lib, pkgs, options, ... }: 11 8 ··· 778 775 default = false; 779 776 description = 780 777 lib.mdDoc '' 781 - If enabled, the virtual machine will be booted using the 782 - regular boot loader (i.e., GRUB 1 or 2). This allows 783 - testing of the boot loader. If 784 - disabled (the default), the VM directly boots the NixOS 785 - kernel and initial ramdisk, bypassing the boot loader 786 - altogether. 778 + Use a boot loader to boot the system. 779 + This allows, among other things, testing the boot loader. 780 + 781 + If disabled, the kernel and initrd are directly booted, 782 + forgoing any bootloader. 787 783 ''; 788 784 }; 789 785 ··· 1026 1022 "-netdev user,id=user.0,${forwardingOptions}${restrictNetworkOption}\"$QEMU_NET_OPTS\"" 1027 1023 ]; 1028 1024 1029 - # FIXME: Consolidate this one day. 1030 1025 virtualisation.qemu.options = mkMerge [ 1031 1026 (mkIf cfg.qemu.virtioKeyboard [ 1032 1027 "-device virtio-keyboard" ··· 1078 1073 }) cfg.emptyDiskImages) 1079 1074 ]; 1080 1075 1076 + # Use mkVMOverride to enable building test VMs (e.g. via `nixos-rebuild 1077 + # build-vm`) of a system configuration, where the regular value for the 1078 + # `fileSystems' attribute should be disregarded (since those filesystems 1079 + # don't necessarily exist in the VM). 1081 1080 fileSystems = mkVMOverride cfg.fileSystems; 1082 1081 1083 - # Mount the host filesystem via 9P, and bind-mount the Nix store 1084 - # of the host into our own filesystem. We use mkVMOverride to 1085 - # allow this module to be applied to "normal" NixOS system 1086 - # configuration, where the regular value for the `fileSystems' 1087 - # attribute should be disregarded for the purpose of building a VM 1088 - # test image (since those filesystems don't exist in the VM). 1089 1082 virtualisation.fileSystems = let 1090 1083 mkSharedDir = tag: share: 1091 1084 {