nixos/kvmgt: add udev rules for unprivileged access

wip/yesman
Jörg Thalheim 4 years ago
parent 85aae79ca1
commit 505d241ee3
No known key found for this signature in database
GPG Key ID: 003F2096411B5F92
  1. 11
      nixos/modules/virtualisation/kvmgt.nix

@ -19,7 +19,8 @@ in {
virtualisation.kvmgt = {
enable = mkEnableOption ''
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.&lt;yourusername&gt;.extraGroups = [ "kvm" ];</literal>
'';
# multi GPU support is under the question
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>
'';
example = {
i915-GVTg_V5_8 = {
uuid = "a297db4a-f4c2-11e6-90f6-d3b88d6c9525";
};
i915-GVTg_V5_8.uuid = "a297db4a-f4c2-11e6-90f6-d3b88d6c9525";
};
};
};
@ -62,6 +61,10 @@ in {
}
) cfg.vgpus;
services.udev.extraRules = ''
SUBSYSTEM=="vfio", OWNER="root", GROUP="kvm"
'';
systemd.services = mapAttrs' (name: value:
nameValuePair "kvmgt-${name}" {
description = "KVMGT VGPU ${name}";

Loading…
Cancel
Save