53 lines
1.6 KiB
Nix
53 lines
1.6 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
lib,
|
|
systemConfig,
|
|
...
|
|
}:
|
|
|
|
lib.mkIf systemConfig.nvidia.enable {
|
|
boot.kernelParams = [ "nvidia.NVreg_PreserveVideoMemoryAllocations=1" ];
|
|
|
|
# For hardware acceleration
|
|
environment.sessionVariables.LIBVA_DRIVER_NAME = "nvidia";
|
|
|
|
hardware = {
|
|
graphics.extraPackages = with pkgs; [
|
|
# Used for hardware-acceleration
|
|
nvidia-vaapi-driver
|
|
];
|
|
nvidia = {
|
|
# Required
|
|
modesetting.enable = true;
|
|
# Use open-source kernel module
|
|
open = true;
|
|
# Enable the Nvidia settings menu
|
|
nvidiaSettings = true;
|
|
# Enable nvidia-suspend.service, nvidia-hibernate.service and nvidia-resume.service
|
|
powerManagement = {
|
|
enable = true;
|
|
finegrained = false;
|
|
};
|
|
|
|
# https://discourse.nixos.org/t/nvidia-dgpu-prime-offload-mode-amd-igpu-wayland/63194/3
|
|
package = config.boot.kernelPackages.nvidiaPackages.mkDriver {
|
|
version = "570.133.07";
|
|
# this is the third one it will complain is wrong
|
|
sha256_64bit = "sha256-LUPmTFgb5e9VTemIixqpADfvbUX1QoTT2dztwI3E3CY=";
|
|
# unused
|
|
sha256_aarch64 = "sha256-2l8N83Spj0MccA8+8R1uqiXBS0Ag4JrLPjrU3TaXHnM=";
|
|
# this is the second one it will complain is wrong
|
|
openSha256 = "sha256-9l8N83Spj0MccA8+8R1uqiXBS0Ag4JrLPjrU3TaXHnM=";
|
|
# this is the first one it will complain is wrong
|
|
settingsSha256 = "sha256-XMk+FvTlGpMquM8aE8kgYK2PIEszUZD2+Zmj2OpYrzU=";
|
|
# unused
|
|
persistencedSha256 = "sha256-4l8N83Spj0MccA8+8R1uqiXBS0Ag4JrLPjrU3TaXHnM=";
|
|
};
|
|
};
|
|
};
|
|
|
|
# Load Nvidia driver for Xorg and Wayland
|
|
services.xserver.videoDrivers = [ "nvidia" ];
|
|
}
|