2023-11-17 07:17:12 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
2023-11-29 18:37:42 +00:00
|
|
|
cfg = config.myFlake.nixos.hardware.components.gpu.amd;
|
2023-11-17 07:17:12 +00:00
|
|
|
in {
|
|
|
|
options = {
|
2023-11-29 18:37:42 +00:00
|
|
|
myFlake.nixos.hardware.components.gpu.amd.enable = lib.mkEnableOption "Whether to enable AMD GPU.";
|
2023-11-17 07:17:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# https://nixos.wiki/wiki/AMD_GPU
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
|
|
hardware.opengl = {
|
|
|
|
enable = true;
|
|
|
|
driSupport = true;
|
|
|
|
driSupport32Bit = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
boot.initrd.kernelModules = ["amdgpu"];
|
|
|
|
services.xserver.videoDrivers = ["amdgpu"];
|
|
|
|
|
|
|
|
# OpenCL
|
|
|
|
hardware.opengl = {
|
|
|
|
extraPackages = with pkgs; [
|
|
|
|
amdvlk
|
|
|
|
rocm-opencl-icd
|
|
|
|
rocm-opencl-runtime
|
|
|
|
];
|
|
|
|
# Only available on unstable
|
|
|
|
extraPackages32 = with pkgs; [
|
|
|
|
driversi686Linux.amdvlk
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
# HIP
|
|
|
|
systemd.tmpfiles.rules = [
|
|
|
|
"L+ /opt/rocm/hip - - - - ${pkgs.hip}"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
}
|