diff options
author | Peter Hoeg <peter@hoeg.com> | 2017-04-07 17:40:17 +0800 |
---|---|---|
committer | Peter Hoeg <peter@hoeg.com> | 2018-01-04 21:09:01 +0800 |
commit | 85e507ebeaa1958d04335c38ded126093a1fb409 (patch) | |
tree | 09e76db77ee2e22a500f8660ab1b488b7f55d63e /nixos/modules/virtualisation/hyperv-guest.nix | |
parent | ae20c22531d802f4acc45ab72b3dccb9b9205a3b (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" ]; + }; + }; + }; +} |