diff options
| -rw-r--r-- | machines/x/configuration.nix | 5 | ||||
| -rw-r--r-- | modules/passthrough.nix | 25 | 
2 files changed, 28 insertions, 2 deletions
| diff --git a/machines/x/configuration.nix b/machines/x/configuration.nix index 62c119e..f3e60e4 100644 --- a/machines/x/configuration.nix +++ b/machines/x/configuration.nix @@ -9,6 +9,7 @@      "amdgpu.nix"      "amd.nix"      "nvidia.nix" +    "passthrough.nix"      "core/audio.nix"      "core/bluetooth.nix"      "core/fonts.nix" @@ -34,8 +35,8 @@      settings = {        CPU_SCALING_GOVERNOR_ON_AC = "performance";        CPU_SCALING_GOVERNOR_ON_BAT = "powersave"; -    } -  } +    }; +  };    networking.hostName = "x"; diff --git a/modules/passthrough.nix b/modules/passthrough.nix new file mode 100644 index 0000000..23afa88 --- /dev/null +++ b/modules/passthrough.nix @@ -0,0 +1,25 @@ +{ pkgs, lib, config, ... }: +let +  # RTX 3070 Ti +  gpuIDs = [ +    "10de:28e0" # Graphics +    "10de:22be" # Audio +  ]; +in { +  boot = { +    initrd.kernelModules = [ +      "vfio_pci" +      "vfio" +      "vfio_iommu_type1" + +      "nvidia" +      "nvidia_modeset" +      "nvidia_uvm" +      "nvidia_drm" +    ]; + +    kernelParams = [ +      ("vfio-pci.ids=" + lib.concatStringsSep "," gpuIDs) +    ]; +  }; +} | 
