summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorPeter Hoeg <peter@hoeg.com>2018-09-28 22:10:03 +0800
committerPeter Hoeg <peter@hoeg.com>2018-10-03 11:46:36 +0800
commit42968c07c5243c9abd6d98ef96b520af9ebca7a3 (patch)
tree7c0bd066e17b06718162d2c9c4d478ec75696e89 /nixos
parent7f70ebf30b8ff3cb10edd593c4549700b34bcc10 (diff)
nixos on hyperv: load modules and set video mode
(cherry picked from commit 3a76bc7a79e18020716ba063dcd1bd8ec11b0790)
Diffstat (limited to 'nixos')
-rw-r--r--nixos/modules/virtualisation/hyperv-guest.nix23
1 files changed, 23 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/hyperv-guest.nix b/nixos/modules/virtualisation/hyperv-guest.nix
index ecd2a8117710f..d86cb9fe1ab96 100644
--- a/nixos/modules/virtualisation/hyperv-guest.nix
+++ b/nixos/modules/virtualisation/hyperv-guest.nix
@@ -9,10 +9,33 @@ in {
   options = {
     virtualisation.hypervGuest = {
       enable = mkEnableOption "Hyper-V Guest Support";
+
+      videoMode = mkOption {
+        type = types.str;
+        default = "1152x864";
+        example = "1024x768";
+        description = ''
+          Resolution at which to initialize the video adapter.
+
+          Supports screen resolution up to Full HD 1920x1080 with 32 bit color
+          on Windows Server 2012, and 1600x1200 with 16 bit color on Windows
+          Server 2008 R2 or earlier.
+        '';
+      };
     };
   };
 
   config = mkIf cfg.enable {
+    boot = {
+      initrd.kernelModules = [
+        "hv_balloon" "hv_netvsc" "hv_storvsc" "hv_utils" "hv_vmbus"
+      ];
+
+      kernelParams = [
+        "video=hyperv_fb:${cfg.videoMode}"
+      ];
+    };
+
     environment.systemPackages = [ config.boot.kernelPackages.hyperv-daemons.bin ];
 
     security.rngd.enable = false;