working passthrough support

This commit is contained in:
2026-02-28 16:33:52 +01:00
parent aaba57ee2f
commit d57aeb9ef3
3 changed files with 26 additions and 10 deletions

View File

@@ -1,23 +1,37 @@
{ config, lib, system, pkgs, ... }:
{
boot.kernelModules = [
"vfio"
"vfio-pci"
"vfio_iommu_type1"
];
boot.kernelParams = [
"amd_iommu=on"
"iommu=pt"
"vfio-pci.ids=10de:1b81,10de:10f0"
];
virtualisation.libvirtd = {
enable = true;
onBoot = "ignore";
onShutdown = "shutdown";
qemu.runAsRoot = true;
qemu.swtpm.enable = true;
qemu.package = pkgs.qemu_full;
};
# Make sure vfio is available inside initrd
boot.initrd.availableKernelModules = [
"vfio_pci"
];
# Bind by IDs (cleaner via modprobe instead of kernel param)
boot.extraModprobeConfig = ''
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; [
pciutils
virtiofsd
config.virtualisation.libvirtd.qemu.package
looking-glass-client
virt-manager
libguestfs-with-appliance
];
users.extraUsers.andreas.extraGroups = [ "libvirtd" ];
}

View File

@@ -8,6 +8,7 @@
[
(modulesPath + "/installer/scan/not-detected.nix")
./graphics/intel.nix
./graphics/passthrough_nvidia.nix
# ./graphics/intel_i915.nix
# ./graphics/nvidia.nix
./acer-monitor-edid.nix