3
0
Fork 0
forked from mirrors/nixpkgs

nixos/qemu: make display resolution configurable

This commit is contained in:
rnhmjoj 2021-06-23 17:18:21 +02:00
parent ec6c604b6e
commit 44d95b773b
No known key found for this signature in database
GPG key ID: BFBAF4C975F76450

View file

@ -350,6 +350,16 @@ in
'';
};
virtualisation.resolution =
mkOption {
type = options.services.xserver.resolutions.type.nestedTypes.elemType;
default = { x = 1024; y = 768; };
description =
''
The resolution of the virtual machine display.
'';
};
virtualisation.cores =
mkOption {
type = types.ints.positive;
@ -601,6 +611,7 @@ in
then driveDeviceName 2 # second disk
else cfg.bootDevice
);
boot.loader.grub.gfxmodeBios = with cfg.resolution; "${toString x}x${toString y}";
boot.initrd.extraUtilsCommands =
''
@ -780,7 +791,7 @@ in
# video driver the host uses.
services.xserver.videoDrivers = mkVMOverride [ "modesetting" ];
services.xserver.defaultDepth = mkVMOverride 0;
services.xserver.resolutions = mkVMOverride [ { x = 1024; y = 768; } ];
services.xserver.resolutions = mkVMOverride [ cfg.resolution ];
services.xserver.monitorSection =
''
# Set a higher refresh rate so that resolutions > 800x600 work.