From b71f27a2179cdfa58492e2696246d3d8e55f9844 Mon Sep 17 00:00:00 2001 From: Raghuram Subramani Date: Mon, 11 Mar 2024 21:05:53 +0530 Subject: update --- machines/x/configuration.nix | 5 +++-- modules/passthrough.nix | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 modules/passthrough.nix 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) + ]; + }; +} -- cgit v1.2.3