From 13b815603077abd0bcfcf412f9fbb28df2320ff3 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Sun, 7 Jul 2019 23:39:44 +0300 Subject: kvmgt service: use modprobe, force-load module --- nixos/modules/virtualisation/kvmgt.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'nixos/modules/virtualisation') diff --git a/nixos/modules/virtualisation/kvmgt.nix b/nixos/modules/virtualisation/kvmgt.nix index bfcf51d09c45..289e26e17035 100644 --- a/nixos/modules/virtualisation/kvmgt.nix +++ b/nixos/modules/virtualisation/kvmgt.nix @@ -4,13 +4,16 @@ with lib; let cfg = config.virtualisation.kvmgt; + kernelPackages = config.boot.kernelPackages; + vgpuOptions = { uuid = mkOption { type = types.string; description = "UUID of VGPU device. You can generate one with libossp_uuid."; }; }; + in { options = { virtualisation.kvmgt = { @@ -45,7 +48,13 @@ in { assertion = versionAtLeast kernelPackages.kernel.version "4.16"; message = "KVMGT is not properly supported for kernels older than 4.16"; }; - boot.kernelParams = [ "i915.enable_gvt=1" ]; + + boot.kernelModules = [ "kvmgt" ]; + + boot.extraModprobeConfig = '' + options i915 enable_gvt=1 + ''; + systemd.paths = mapAttrs' (name: value: nameValuePair "kvmgt-${name}" { description = "KVMGT VGPU ${name} path"; @@ -55,6 +64,7 @@ in { }; } ) cfg.vgpus; + systemd.services = mapAttrs' (name: value: nameValuePair "kvmgt-${name}" { description = "KVMGT VGPU ${name}"; -- cgit 1.4.1