diff options
author | Peter Hoeg <peter@hoeg.com> | 2018-10-03 11:45:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-03 11:45:29 +0800 |
commit | 7af39cb9b8f88d7f2658a0ce3608371dc99056b6 (patch) | |
tree | 1cff085af10b14288b4f5d8fa3f431245a227197 /nixos/modules | |
parent | 8bc64b6c24b1b7bf46ddf4d3ee6a7d9a5f055d0c (diff) | |
parent | 6e3e136f77b3103a0c3b3fe7578c5864932b649c (diff) | |
download | nixlib-7af39cb9b8f88d7f2658a0ce3608371dc99056b6.tar nixlib-7af39cb9b8f88d7f2658a0ce3608371dc99056b6.tar.gz nixlib-7af39cb9b8f88d7f2658a0ce3608371dc99056b6.tar.bz2 nixlib-7af39cb9b8f88d7f2658a0ce3608371dc99056b6.tar.lz nixlib-7af39cb9b8f88d7f2658a0ce3608371dc99056b6.tar.xz nixlib-7af39cb9b8f88d7f2658a0ce3608371dc99056b6.tar.zst nixlib-7af39cb9b8f88d7f2658a0ce3608371dc99056b6.zip |
Merge pull request #47482 from peterhoeg/f/hyperv
nixos on hyperv: load proper modules and make installer use the module
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/installer/tools/nixos-generate-config.pl | 3 | ||||
-rw-r--r-- | nixos/modules/virtualisation/hyperv-guest.nix | 35 |
2 files changed, 32 insertions, 6 deletions
diff --git a/nixos/modules/installer/tools/nixos-generate-config.pl b/nixos/modules/installer/tools/nixos-generate-config.pl index 359caad89a72..b70faa380e54 100644 --- a/nixos/modules/installer/tools/nixos-generate-config.pl +++ b/nixos/modules/installer/tools/nixos-generate-config.pl @@ -277,8 +277,7 @@ if ($virt eq "qemu" || $virt eq "kvm" || $virt eq "bochs") { # Also for Hyper-V. if ($virt eq "microsoft") { - push @initrdAvailableKernelModules, "hv_storvsc"; - $videoDriver = "fbdev"; + push @attrs, "virtualisation.hypervGuest.enable = true;" } diff --git a/nixos/modules/virtualisation/hyperv-guest.nix b/nixos/modules/virtualisation/hyperv-guest.nix index ecd2a8117710..0f1f052880c5 100644 --- a/nixos/modules/virtualisation/hyperv-guest.nix +++ b/nixos/modules/virtualisation/hyperv-guest.nix @@ -9,20 +9,47 @@ 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; - # enable hotadding memory + # enable hotadding cpu/memory services.udev.packages = lib.singleton (pkgs.writeTextFile { - name = "hyperv-memory-hotadd-udev-rules"; - destination = "/etc/udev/rules.d/99-hyperv-memory-hotadd.rules"; + name = "hyperv-cpu-and-memory-hotadd-udev-rules"; + destination = "/etc/udev/rules.d/99-hyperv-cpu-and-memory-hotadd.rules"; text = '' - ACTION="add", SUBSYSTEM=="memory", ATTR{state}="online" + # Memory hotadd + SUBSYSTEM=="memory", ACTION=="add", DEVPATH=="/devices/system/memory/memory[0-9]*", TEST=="state", ATTR{state}="online" + + # CPU hotadd + SUBSYSTEM=="cpu", ACTION=="add", DEVPATH=="/devices/system/cpu/cpu[0-9]*", TEST=="online", ATTR{online}="1" ''; }); |