diff options
author | Peter Hoeg <peter@hoeg.com> | 2017-04-07 17:40:17 +0800 |
---|---|---|
committer | Peter Hoeg <peter@hoeg.com> | 2017-10-14 14:38:04 +0800 |
commit | 0944d44f1b040856e420aad815a0d1b62194a2cb (patch) | |
tree | 75d99f09dcc54c0c5dacbc1da37dc35ed02878bf /nixos/modules/virtualisation/hyperv-guest.nix | |
parent | 51f1c635e679fdadead32e5aec464b28c254d099 (diff) |
hyperv-daemons: add nixos module
Diffstat (limited to 'nixos/modules/virtualisation/hyperv-guest.nix')
-rw-r--r-- | nixos/modules/virtualisation/hyperv-guest.nix | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/hyperv-guest.nix b/nixos/modules/virtualisation/hyperv-guest.nix new file mode 100644 index 0000000000000..ecd2a8117710f --- /dev/null +++ b/nixos/modules/virtualisation/hyperv-guest.nix @@ -0,0 +1,37 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.virtualisation.hypervGuest; + +in { + options = { + virtualisation.hypervGuest = { + enable = mkEnableOption "Hyper-V Guest Support"; + }; + }; + + config = mkIf cfg.enable { + environment.systemPackages = [ config.boot.kernelPackages.hyperv-daemons.bin ]; + + security.rngd.enable = false; + + # enable hotadding memory + services.udev.packages = lib.singleton (pkgs.writeTextFile { + name = "hyperv-memory-hotadd-udev-rules"; + destination = "/etc/udev/rules.d/99-hyperv-memory-hotadd.rules"; + text = '' + ACTION="add", SUBSYSTEM=="memory", ATTR{state}="online" + ''; + }); + + systemd = { + packages = [ config.boot.kernelPackages.hyperv-daemons.lib ]; + + targets.hyperv-daemons = { + wantedBy = [ "multi-user.target" ]; + }; + }; + }; +} |