summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--modules/services/x11/xserver.nix12
-rw-r--r--modules/virtualisation/qemu-vm.nix7
2 files changed, 15 insertions, 4 deletions
diff --git a/modules/services/x11/xserver.nix b/modules/services/x11/xserver.nix
index ddb6047df215..38822b2627ab 100644
--- a/modules/services/x11/xserver.nix
+++ b/modules/services/x11/xserver.nix
@@ -137,6 +137,7 @@ in
 
       resolutions = mkOption {
         default = [];
+        example = [ { x = 1600; y = 1200; } { x = 1024; y = 786; } ];
         description = ''
           The screen resolutions for the X server.  The first element
           is the default resolution.  If this list is empty, the X
@@ -496,6 +497,9 @@ in
           Section "Screen"
             Identifier "Screen-${driver.name}[0]"
             Device "Device-${driver.name}[0]"
+            ${optionalString (cfg.monitorSection != "") ''
+              Monitor "Monitor[0]"
+            ''}
 
             ${cfg.screenSection}
 
@@ -508,9 +512,11 @@ in
             ''}
 
             ${optionalString
-                (driver.name != "virtualbox" && (cfg.resolutions != []
-                 || cfg.extraDisplaySettings != "" || cfg.virtualScreen != null)) (
-              let
+                (driver.name != "virtualbox" &&
+                 (cfg.resolutions != [] ||
+                  cfg.extraDisplaySettings != "" ||
+                  cfg.virtualScreen != null))
+              (let
                 f = depth:
                   ''
                     SubSection "Display"
diff --git a/modules/virtualisation/qemu-vm.nix b/modules/virtualisation/qemu-vm.nix
index e054b537d438..73d527a91caa 100644
--- a/modules/virtualisation/qemu-vm.nix
+++ b/modules/virtualisation/qemu-vm.nix
@@ -265,7 +265,12 @@ in
   services.xserver.videoDriver = mkOverride 50 {} null;
   services.xserver.videoDrivers = mkOverride 50 {} [ "cirrus" "vesa" ];
   services.xserver.defaultDepth = mkOverride 50 {} 0;
-  services.xserver.resolutions = mkOverride 50 {} [];
+  services.xserver.monitorSection =
+    ''
+      # Set a higher refresh rate so that resolutions > 800x600 work.
+      HorizSync 30-140
+      VertRefresh 50-160
+    '';
 
   services.mingetty.ttys = ttys ++ optional (!cfg.graphics) "ttyS0";