From 6df2d06fbb8d66c727a3853e49842157cc5568da Mon Sep 17 00:00:00 2001 From: shynd Date: Thu, 20 Feb 2025 18:19:30 +0100 Subject: [PATCH] modules - nvidia drivers --- modules/nvidia-drivers.nix | 61 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 modules/nvidia-drivers.nix diff --git a/modules/nvidia-drivers.nix b/modules/nvidia-drivers.nix new file mode 100644 index 0000000..8a65822 --- /dev/null +++ b/modules/nvidia-drivers.nix @@ -0,0 +1,61 @@ +{ 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; + }; +} \ No newline at end of file