{ config, lib, pkgs, ... }: # nvidia-offload script let nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" '' export __NV_PRIME_RENDER_OFFLOAD=1 export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0 export __GLX_VENDOR_LIBRARY_NAME=nvidia export __VK_LAYER_NV_optimus=NVIDIA_only exec "$@" ''; in { imports = [ ]; ##### SB3 Hardware ##### # surface kernel config users.users.caleb.extraGroups = [ "surface-control" ]; microsoft-surface.surface-control.enable = true; hardware.cpu.intel.updateMicrocode = true; # Nvidia driver setup hardware.nvidia = { modesetting.enable = true; package = config.boot.kernelPackages.nvidiaPackages.latest; nvidiaSettings = true; powerManagement = { enable = true; finegrained = true; }; nvidiaPersistenced = true; prime = { offload = { enable = true; enableOffloadCmd = true; }; intelBusId = "PCI:0:2:0"; nvidiaBusId = "PCI:2:0:0"; }; }; # preserve video memory after suspend https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Preserve_video_memory_after_suspend #boot.extraModprobeConfig = '' # options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=/var/tmp #''; }