2021-03-23 18:34:15 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
2023-10-10 20:23:31 +00:00
|
|
|
options.hardware.amdgpu.loadInInitrd = lib.mkEnableOption (lib.mdDoc
|
2022-12-15 21:01:50 +00:00
|
|
|
"loading `amdgpu` kernelModule at stage 1. (Add `amdgpu` to `boot.initrd.kernelModules`)"
|
|
|
|
) // {
|
|
|
|
default = true;
|
|
|
|
};
|
2023-10-10 20:23:31 +00:00
|
|
|
options.hardware.amdgpu.opencl = lib.mkEnableOption (lib.mdDoc
|
|
|
|
"rocm opencl runtime (Install rocmPackages.clr and rocmPackages.clr.icd)"
|
2023-01-28 15:46:56 +00:00
|
|
|
) // {
|
|
|
|
default = true;
|
|
|
|
};
|
2022-12-15 21:01:50 +00:00
|
|
|
|
|
|
|
config = lib.mkMerge [
|
|
|
|
{
|
2023-03-06 09:08:52 +00:00
|
|
|
services.xserver.videoDrivers = lib.mkDefault [ "modesetting" ];
|
2023-01-28 15:46:56 +00:00
|
|
|
|
|
|
|
hardware.opengl = {
|
|
|
|
driSupport = lib.mkDefault true;
|
|
|
|
driSupport32Bit = lib.mkDefault true;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
(lib.mkIf config.hardware.amdgpu.loadInInitrd {
|
|
|
|
boot.initrd.kernelModules = [ "amdgpu" ];
|
|
|
|
})
|
|
|
|
(lib.mkIf config.hardware.amdgpu.opencl {
|
2023-10-10 20:23:31 +00:00
|
|
|
hardware.opengl.extraPackages =
|
|
|
|
if pkgs ? rocmPackages.clr
|
|
|
|
then with pkgs.rocmPackages; [ clr clr.icd ]
|
|
|
|
else with pkgs; [ rocm-opencl-icd rocm-opencl-runtime ];
|
2022-12-15 21:01:50 +00:00
|
|
|
})
|
|
|
|
];
|
2023-10-10 20:23:31 +00:00
|
|
|
}
|