Merge pull request #47482 from peterhoeg/f/hyperv
nixos on hyperv: load proper modules and make installer use the module
This commit is contained in:
commit
7af39cb9b8
@ -277,8 +277,7 @@ if ($virt eq "qemu" || $virt eq "kvm" || $virt eq "bochs") {
|
|||||||
|
|
||||||
# Also for Hyper-V.
|
# Also for Hyper-V.
|
||||||
if ($virt eq "microsoft") {
|
if ($virt eq "microsoft") {
|
||||||
push @initrdAvailableKernelModules, "hv_storvsc";
|
push @attrs, "virtualisation.hypervGuest.enable = true;"
|
||||||
$videoDriver = "fbdev";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,20 +9,47 @@ in {
|
|||||||
options = {
|
options = {
|
||||||
virtualisation.hypervGuest = {
|
virtualisation.hypervGuest = {
|
||||||
enable = mkEnableOption "Hyper-V Guest Support";
|
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 {
|
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 ];
|
environment.systemPackages = [ config.boot.kernelPackages.hyperv-daemons.bin ];
|
||||||
|
|
||||||
security.rngd.enable = false;
|
security.rngd.enable = false;
|
||||||
|
|
||||||
# enable hotadding memory
|
# enable hotadding cpu/memory
|
||||||
services.udev.packages = lib.singleton (pkgs.writeTextFile {
|
services.udev.packages = lib.singleton (pkgs.writeTextFile {
|
||||||
name = "hyperv-memory-hotadd-udev-rules";
|
name = "hyperv-cpu-and-memory-hotadd-udev-rules";
|
||||||
destination = "/etc/udev/rules.d/99-hyperv-memory-hotadd.rules";
|
destination = "/etc/udev/rules.d/99-hyperv-cpu-and-memory-hotadd.rules";
|
||||||
text = ''
|
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"
|
||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user