{ config, lib, pkgs, ... }: { # Enable graphics driver support and 32-bit acceleration (for Steam/gaming) hardware.graphics = { enable = true; enable32Bit = true; }; #OpenTabletDriver hardware.opentabletdriver.enable = true; hardware.uinput.enable = true; boot.kernelModules = [ "uinput" "v4l2loopback" ]; # Virtual webcam device so ffmpeg (fed by the GoPro's stream) can appear # as a normal camera to apps like Discord. exclusive_caps=1 is required # for Chromium/WebRTC-based apps to recognize it as a real capture device. boot.extraModulePackages = [ config.boot.kernelPackages.v4l2loopback ]; boot.extraModprobeConfig = '' options v4l2loopback devices=1 video_nr=10 card_label="GoPro Webcam" exclusive_caps=1 # PS4/PS5 controllers (e.g. DualSense) connect over Bluetooth then # immediately disconnect — a well-known Linux Bluetooth stack issue # where many adapters' Enhanced Retransmission Mode implementation is # broken. Disabling ERTM is the standard, widely-documented fix. options bluetooth disable_ertm=1 ''; # I2C bus, for DDC/CI monitor control (brightness) via ddcutil, when # driving an external monitor over DisplayPort/HDMI. The internal panel # uses the kernel backlight class instead (brightness-ctl picks whichever # applies — see modules/scripts/brightness-ctl.sh). hardware.i2c.enable = true; # --- Hybrid graphics: AMD Radeon 680M (iGPU, drives the internal panel) # + NVIDIA RTX 4050 Max-Q (dGPU, offload-only) — ASUS TUF Gaming A15 # FA507NU. Bus IDs come straight from `lspci` on this machine, not # guessed: 01:00.0 (NVIDIA) -> PCI:1:0:0, 35:00.0 (AMD) -> PCI:53:0:0. services.xserver.videoDrivers = [ "nvidia" ]; hardware.nvidia = { # Required settings modesetting.enable = true; # Enable NVIDIA Open GPU Kernel Modules (Turing architecture or newer — # this RTX 4050 is Ada Lovelace, well within support) open = true; # Enable the NVIDIA settings menu nvidiaSettings = true; # Use the stable driver package matching current kernel package = config.boot.kernelPackages.nvidiaPackages.stable; # Fixes suspend/resume hangs that are common with NVIDIA on laptops. powerManagement.enable = true; # PRIME render offload: the AMD iGPU drives the display at all times # (much better battery life than keeping the dGPU powered on), and the # NVIDIA GPU is only spun up on demand for a specific process — run # anything with `nvidia-offload ` (generated by # enableOffloadCmd) to route it through the RTX 4050, e.g. games or # Blender's Cycles renderer. prime = { offload = { enable = true; enableOffloadCmd = true; }; amdgpuBusId = "PCI:53:0:0"; nvidiaBusId = "PCI:1:0:0"; }; }; # ASUS laptop control: keyboard backlight/fan curves/battery charge limit # (asusctl) and dGPU power-state switching between Integrated/Hybrid modes # (supergfxctl) — the two standard asus-linux.org daemons for ROG/TUF # laptops, both packaged directly in nixpkgs. services.asusd.enable = true; services.supergfxd.enable = true; }