{ lib, pkgs, config, ... }: with lib; let cfg = config.drivers.nvidia; in { options.drivers.nvidia = { enable = mkEnableOption "enable nvidia drivers"; }; config = mkIf cfg.enable { services.xserver.videoDrivers = [ "nvidia" ]; hardware.graphics = { enable = true; enable32Bit = true; extraPackages = with pkgs; [ vaapiVdpau libvdpau libvdpau-vaapi-driver vdpauinfo libva libva-utils ]; }; hardware.nvidia = { # modesetting is required modesetting.enable = true; # nvidia power management. experimental, can cause sleep/suspend to fail powerManagement.enable = false; # fine-grained power management. turns off gpu when not in use. # experimental and only works on modern nvidia gpus (turing or newer) powerManagement.finegrained = false; # dynamicBoost.enable = true; nvidiaPersistenced = false; # use the nvidia open source kernel module (not to be confused with the # independent third-party "nouveau" open source driver). # support is limited to turing and later architectures. full list of # supported gpus is at: # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus # only available from driver 515.43.04+ # currently alpha-quality/buggy, so false is currently the recommended setting. open = false; # enable the nvidia settings menu. # accessible via `nvidia-settings`. nvidiaSettings = true; # optionally, you may need to select the appropriate driver version for your # specific gpu. package = config.boot.kernelPackages.nvidiaPackages.latest; }; }; }