working passthrough support
This commit is contained in:
@@ -171,9 +171,10 @@
|
|||||||
virtualisation.libvirtd = {
|
virtualisation.libvirtd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
qemu = {
|
qemu = {
|
||||||
package = pkgs.qemu_kvm;
|
package = pkgs.qemu_full;
|
||||||
runAsRoot = true;
|
runAsRoot = true;
|
||||||
swtpm.enable = true;
|
swtpm.enable = true;
|
||||||
|
vhostUserPackages = [ pkgs.virtiofsd ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,23 +1,37 @@
|
|||||||
{ config, lib, system, pkgs, ... }:
|
{ config, lib, system, pkgs, ... }:
|
||||||
{
|
{
|
||||||
|
boot.kernelModules = [
|
||||||
|
"vfio"
|
||||||
|
"vfio-pci"
|
||||||
|
"vfio_iommu_type1"
|
||||||
|
];
|
||||||
boot.kernelParams = [
|
boot.kernelParams = [
|
||||||
"amd_iommu=on"
|
"amd_iommu=on"
|
||||||
"iommu=pt"
|
"iommu=pt"
|
||||||
"vfio-pci.ids=10de:1b81,10de:10f0"
|
|
||||||
];
|
];
|
||||||
virtualisation.libvirtd = {
|
# Make sure vfio is available inside initrd
|
||||||
enable = true;
|
boot.initrd.availableKernelModules = [
|
||||||
onBoot = "ignore";
|
"vfio_pci"
|
||||||
onShutdown = "shutdown";
|
];
|
||||||
qemu.runAsRoot = true;
|
# Bind by IDs (cleaner via modprobe instead of kernel param)
|
||||||
qemu.swtpm.enable = true;
|
boot.extraModprobeConfig = ''
|
||||||
qemu.package = pkgs.qemu_full;
|
options vfio-pci ids=10de:1b81,10de:10f0
|
||||||
};
|
'';
|
||||||
|
boot.initrd.preDeviceCommands = ''
|
||||||
|
modprobe vfio-pci
|
||||||
|
'';
|
||||||
|
# # EARLY and deterministic binding
|
||||||
|
# boot.initrd.preDeviceCommands = ''
|
||||||
|
# echo 0000:05:00.0 > /sys/bus/pci/drivers/vfio-pci/bind
|
||||||
|
# echo 0000:05:00.1 > /sys/bus/pci/drivers/vfio-pci/bind
|
||||||
|
# '';
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
|
pciutils
|
||||||
virtiofsd
|
virtiofsd
|
||||||
config.virtualisation.libvirtd.qemu.package
|
config.virtualisation.libvirtd.qemu.package
|
||||||
looking-glass-client
|
looking-glass-client
|
||||||
virt-manager
|
virt-manager
|
||||||
libguestfs-with-appliance
|
libguestfs-with-appliance
|
||||||
];
|
];
|
||||||
|
users.extraUsers.andreas.extraGroups = [ "libvirtd" ];
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
[
|
[
|
||||||
(modulesPath + "/installer/scan/not-detected.nix")
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
./graphics/intel.nix
|
./graphics/intel.nix
|
||||||
|
./graphics/passthrough_nvidia.nix
|
||||||
# ./graphics/intel_i915.nix
|
# ./graphics/intel_i915.nix
|
||||||
# ./graphics/nvidia.nix
|
# ./graphics/nvidia.nix
|
||||||
./acer-monitor-edid.nix
|
./acer-monitor-edid.nix
|
||||||
|
|||||||
Reference in New Issue
Block a user