From 1ba55b468dc5a37f5c204d9de9ac374d9b0293a3 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sun, 11 Aug 2024 14:51:55 -0500 Subject: [PATCH] feat(hosts/orion): enable Nvidia GPU w/ PRIME --- hosts/orion/modules/graphical.nix | 8 ----- hosts/orion/modules/hardware.nix | 55 +++++++++++++++++-------------- 2 files changed, 31 insertions(+), 32 deletions(-) diff --git a/hosts/orion/modules/graphical.nix b/hosts/orion/modules/graphical.nix index cebc17f4..e98244f4 100644 --- a/hosts/orion/modules/graphical.nix +++ b/hosts/orion/modules/graphical.nix @@ -28,13 +28,5 @@ ]; }; }; - hardware.graphics = { - enable = true; - extraPackages = with pkgs; [ - intel-media-driver - intel-vaapi-driver - libvdpau - ]; - }; services.spice-vdagentd.enable = true; } diff --git a/hosts/orion/modules/hardware.nix b/hosts/orion/modules/hardware.nix index 63be4045..669ab74b 100644 --- a/hosts/orion/modules/hardware.nix +++ b/hosts/orion/modules/hardware.nix @@ -1,30 +1,37 @@ { - inputs, - lib, pkgs, + lib, + config, ... }: - { - # NOTE: Disable Nvidia GPU - boot.extraModprobeConfig = '' - blacklist nouveau - options nouveau iwlwifi power_save=1 modeset=0 - ''; - services.udev.extraRules = '' - # Remove NVIDIA USB xHCI Host Controller devices, if present - ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{power/control}="auto", ATTR{remove}="1" - # Remove NVIDIA USB Type-C UCSI devices, if present - ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{power/control}="auto", ATTR{remove}="1" - # Remove NVIDIA Audio devices, if present - ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{power/control}="auto", ATTR{remove}="1" - # Remove NVIDIA VGA/3D controller devices - ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", ATTR{power/control}="auto", ATTR{remove}="1" - ''; - boot.blacklistedKernelModules = [ - "nouveau" - "nvidia" - "nvidia_drm" - "nvidia_modeset" - ]; + services.xserver.videoDrivers = [ "nvidia" ]; + environment.variables.VDPAU_DRIVER = "va_gl"; + hardware = { + enableRedistributableFirmware = true; + graphics = { + enable = true; + extraPackages = with pkgs; [ + vpl-gpu-rt + intel-media-driver + intel-vaapi-driver + libvdpau-va-gl + nvidia-vaapi-driver + ]; + extraPackages32 = with pkgs.driversi686Linux; [ intel-vaapi-driver ]; + }; + nvidia = { + nvidiaSettings = true; + package = config.boot.kernelPackages.nvidiaPackages.beta; + powerManagement.enable = true; + prime = { + offload = { + enable = true; + enableOffloadCmd = true; + }; + nvidiaBusId = "PCI:1:0:0"; + intelBusId = "PCI:0:2:0"; + }; + }; + }; }