System/machines/levitation/passthrough.nix

36 lines
826 B
Nix

{ config, lib, pkgs, ... }:
let
gpuIDs = [
# 2080 super
"10de:1e81" # Graphics
"10de:10f8" # Audio
"10de:1ad8" # Usb ????
"10de:1ad9" # Usb ????
];
in {
boot = {
kernelParams = [
# enable iommu
"amd_iommu=on"
# Isolate the nvidia gpu
("vfio-pci.ids=" + lib.concatStringsSep "," gpuIDs)
];
# Modules needed
initrd.kernelModules = [ "vfio_pci" "vfio" "vfio_iommu_type1" ];
};
environment.systemPackages = with pkgs; [ looking-glass-client ];
virtualisation.spiceUSBRedirection.enable = true;
virtualisation.libvirtd = {
qemu = {
swtpm.enable = true;
ovmf = {
enable = true;
packages = [ pkgs.OVMFFull.fd ];
};
};
};
systemd.tmpfiles.rules =
[ "f /dev/shm/looking-glass 0660 nathan qemu-libvirtd -" ];
}