{self, ...}: { # Hybrid Intel + NVIDIA (PRIME) for laptops like the T480 (Intel UHD 620 + # NVIDIA MX150). Uses "offload" mode: the dGPU stays powered down by default # (minimal extra battery drain) and is only used for apps launched with # `nvidia-offload `. It also pulls in the Intel GPU stack (gpuIntel). # # Bus IDs below are specific to the T480 (from `lspci`): # Intel 00:02.0 -> PCI:0:2:0 # NVIDIA 01:00.0 -> PCI:1:0:0 # Adjust for other machines. flake.nixosModules.gpuNvidiaPrime = { config, pkgs, ... }: { imports = [self.nixosModules.gpuIntel]; services.xserver.videoDrivers = ["nvidia"]; hardware.nvidia = { modesetting.enable = true; # MX150 is Pascal (pre-Turing); the proprietary modules are the safe choice. open = false; nvidiaSettings = true; powerManagement.enable = true; prime = { # Offload keeps the NVIDIA GPU asleep until explicitly used. This gives # the `nvidia-offload` helper wrapper. Swap to sync mode if you want the # dGPU always driving the display (higher power draw). offload = { enable = true; enableOffloadCmd = true; # provides `nvidia-offload` wrapper }; intelBusId = "PCI:0:2:0"; nvidiaBusId = "PCI:1:0:0"; }; }; }; }