forked from mirrors/nixpkgs
Merge pull request #82468 from Mic92/kvmgt
nixos/kvmgt: udev rules + fix module initialisation
This commit is contained in:
commit
4a8a014be4
|
@ -19,7 +19,8 @@ in {
|
||||||
virtualisation.kvmgt = {
|
virtualisation.kvmgt = {
|
||||||
enable = mkEnableOption ''
|
enable = mkEnableOption ''
|
||||||
KVMGT (iGVT-g) VGPU support. Allows Qemu/KVM guests to share host's Intel integrated graphics card.
|
KVMGT (iGVT-g) VGPU support. Allows Qemu/KVM guests to share host's Intel integrated graphics card.
|
||||||
Currently only one graphical device can be shared
|
Currently only one graphical device can be shared. To allow users to access the device without root add them
|
||||||
|
to the kvm group: <literal>users.extraUsers.<yourusername>.extraGroups = [ "kvm" ];</literal>
|
||||||
'';
|
'';
|
||||||
# multi GPU support is under the question
|
# multi GPU support is under the question
|
||||||
device = mkOption {
|
device = mkOption {
|
||||||
|
@ -35,9 +36,7 @@ in {
|
||||||
and find info about device via <command>cat /sys/bus/pci/devices/*/mdev_supported_types/i915-GVTg_V5_4/description</command>
|
and find info about device via <command>cat /sys/bus/pci/devices/*/mdev_supported_types/i915-GVTg_V5_4/description</command>
|
||||||
'';
|
'';
|
||||||
example = {
|
example = {
|
||||||
i915-GVTg_V5_8 = {
|
i915-GVTg_V5_8.uuid = "a297db4a-f4c2-11e6-90f6-d3b88d6c9525";
|
||||||
uuid = "a297db4a-f4c2-11e6-90f6-d3b88d6c9525";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -50,10 +49,7 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
boot.kernelModules = [ "kvmgt" ];
|
boot.kernelModules = [ "kvmgt" ];
|
||||||
|
boot.kernelParams = [ "i915.enable_gvt=1" ];
|
||||||
boot.extraModprobeConfig = ''
|
|
||||||
options i915 enable_gvt=1
|
|
||||||
'';
|
|
||||||
|
|
||||||
systemd.paths = mapAttrs' (name: value:
|
systemd.paths = mapAttrs' (name: value:
|
||||||
nameValuePair "kvmgt-${name}" {
|
nameValuePair "kvmgt-${name}" {
|
||||||
|
@ -65,6 +61,10 @@ in {
|
||||||
}
|
}
|
||||||
) cfg.vgpus;
|
) cfg.vgpus;
|
||||||
|
|
||||||
|
services.udev.extraRules = ''
|
||||||
|
SUBSYSTEM=="vfio", OWNER="root", GROUP="kvm"
|
||||||
|
'';
|
||||||
|
|
||||||
systemd.services = mapAttrs' (name: value:
|
systemd.services = mapAttrs' (name: value:
|
||||||
nameValuePair "kvmgt-${name}" {
|
nameValuePair "kvmgt-${name}" {
|
||||||
description = "KVMGT VGPU ${name}";
|
description = "KVMGT VGPU ${name}";
|
||||||
|
|
Loading…
Reference in a new issue