hyperv-daemons: add nixos module

This commit is contained in:
Peter Hoeg 2017-04-07 17:40:17 +08:00
parent ae20c22531
commit 85e507ebea
2 changed files with 38 additions and 0 deletions

View file

@ -746,6 +746,7 @@
./virtualisation/lxcfs.nix ./virtualisation/lxcfs.nix
./virtualisation/lxd.nix ./virtualisation/lxd.nix
./virtualisation/amazon-options.nix ./virtualisation/amazon-options.nix
./virtualisation/hyperv-guest.nix
./virtualisation/openvswitch.nix ./virtualisation/openvswitch.nix
./virtualisation/parallels-guest.nix ./virtualisation/parallels-guest.nix
./virtualisation/rkt.nix ./virtualisation/rkt.nix

View file

@ -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" ];
};
};
};
}