nix-git/modules/gpu-amd.nix

51 lines
1.8 KiB
Nix
Raw Normal View History

2024-12-07 19:24:26 +01:00
# See `NixOS.md` at section "Graphic drivers".
# There more details are given including commands to verify working hardware acceleration.
2024-02-04 14:50:41 +01:00
{ config, pkgs, ... }:
2024-12-07 19:24:26 +01:00
let
extra = [
];
in
2024-02-04 14:50:41 +01:00
{
2024-12-07 19:24:26 +01:00
hardware = {
graphics = {
# This is enabled by default. We have this for cosmetical reasons only.
# It provides the RADV driver.
enable = true;
# Required for wine.
enable32Bit = true;
2024-02-04 14:50:41 +01:00
2024-12-07 19:24:26 +01:00
# Additional packages to add to the default graphics driver lookup path. This can be used to add OpenCL drivers, VA-API/VDPAU drivers, etc.
extraPackages = extra;
# Required for wine.
extraPackages32 = extra;
};
2024-02-04 14:50:41 +01:00
2024-12-07 19:24:26 +01:00
amdgpu = {
# Load amdgpu kernelModule in stage 1. Can fix lower resolution in boot screen during initramfs phase.
#initrd.enable = true;
2024-02-04 14:50:41 +01:00
2024-12-07 19:24:26 +01:00
# OpenCL (Open Computing Language) is a framework for writing programs that execute across heterogeneous platforms.
opencl.enable = true;
2024-02-04 14:50:41 +01:00
2024-12-07 19:24:26 +01:00
# AMD driver for Vulkan.
2024-02-04 14:50:41 +01:00
#
2024-12-07 19:24:26 +01:00
# => Please use RADV instead except if some Windows games don't run with it.
# https://www.reddit.com/r/NixOS/comments/1dmkim8/comment/l9zaz75/
# > Side note: you don't need to enable amdvlk unless you have a very specific reason to. Mesa has radv by default which is better for vulkan.
2024-02-04 14:50:41 +01:00
#
2024-12-07 19:24:26 +01:00
#amdvlk.enable = true;
#amdvlk.support32Bit.enable = true;
};
};
2024-02-04 14:50:41 +01:00
2024-12-07 19:24:26 +01:00
environment.variables = {
# VDPAU does not pick up correct driver. Thus, we need to configure it manually.
# https://wiki.archlinux.org/title/Hardware_video_acceleration#Failed_to_open_VDPAU_backend
#
# https://discourse.nixos.org/t/24-11-amd-gpu-how-to-use-mesa-radv-instead-of-amdvlk/57110/5
# https://github.com/NixOS/nixpkgs/issues/221535#issuecomment-1473815585
"VDPAU_DRIVER" = "radeonsi";
2024-02-04 14:50:41 +01:00
};
}