vifo config

This commit is contained in:
Nathan McCarty 2023-07-01 17:41:02 -04:00
parent 8f2ecff5d1
commit 7c1e567f48
Signed by: thatonelutenist
SSH Key Fingerprint: SHA256:hwQEcmak9E6sdU9bXc98RHw/Xd1AhpB5HZT7ZSVJkRM
3 changed files with 37 additions and 2 deletions

View File

@ -6,6 +6,7 @@ let
inherit system;
};
in {
imports = [ ./passthrough.nix ];
# Sops setup for this machine
sops.secrets = {
"borg-ssh-key" = {
@ -79,8 +80,6 @@ in {
allowedUDPPorts = [ 61377 1701 9001 ];
};
};
# GPU passthrough
boot.kernelParams = [ "amd_iommu=on" ];
# Setup home manager
home-manager.users.nathan = import ./home.nix;

View File

@ -0,0 +1,35 @@
{ 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 -" ];
}

View File

@ -6,6 +6,7 @@ in with lib; {
# Enable the kernel modules
boot.kernelModules = [ "kvm-amd" "kvm-intel" ];
# Enable libvirt
programs.dconf.enable = true;
virtualisation.libvirtd.enable = true;
# Install virt-manager
environment.systemPackages = with pkgs; [ virtmanager virt-viewer ];