mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-24 07:53:19 +00:00
Adding a virtualisation option: run qemu without graphics.
svn path=/nixos/trunk/; revision=18978
This commit is contained in:
parent
daa814980e
commit
79073c7b3d
@ -34,9 +34,23 @@ let
|
||||
exist.
|
||||
'';
|
||||
};
|
||||
virtualisation.graphics =
|
||||
mkOption {
|
||||
default = true;
|
||||
description =
|
||||
''
|
||||
Whether to run qemu with a graphics window, or access
|
||||
the guest computer serial port through the host tty.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
cfg = config.virtualisation;
|
||||
|
||||
qemuGraphics = if (cfg.graphics) then "" else "-nographic";
|
||||
kernelConsole = if (cfg.graphics) then "" else "console=ttyS0";
|
||||
ttys = [ "tty1" "tty2" "tty3" "tty4" "tty5" "tty6" ];
|
||||
|
||||
# Shell script to start the VM.
|
||||
startVM =
|
||||
@ -59,8 +73,9 @@ let
|
||||
-drive file=$NIX_DISK_IMAGE,if=virtio,boot=on \
|
||||
-kernel ${config.system.build.toplevel}/kernel \
|
||||
-initrd ${config.system.build.toplevel}/initrd \
|
||||
${qemuGraphics} \
|
||||
$QEMU_OPTS \
|
||||
-append "$(cat ${config.system.build.toplevel}/kernel-params) init=${config.system.build.bootStage2} systemConfig=${config.system.build.toplevel} $QEMU_KERNEL_PARAMS"
|
||||
-append "$(cat ${config.system.build.toplevel}/kernel-params) init=${config.system.build.bootStage2} systemConfig=${config.system.build.toplevel} ${kernelConsole} $QEMU_KERNEL_PARAMS"
|
||||
'';
|
||||
|
||||
in
|
||||
@ -156,6 +171,8 @@ in
|
||||
services.xserver.defaultDepth = mkOverride 50 {} 0;
|
||||
services.xserver.resolutions = mkOverride 50 {} [];
|
||||
|
||||
services.mingetty.ttys = ttys ++ optional (!cfg.graphics) "ttyS0";
|
||||
|
||||
# Wireless won't work in the VM.
|
||||
networking.enableWLAN = mkOverride 50 {} false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user