2021-03-23 14:34:15 -04:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
2022-12-15 16:01:50 -05:00
|
|
|
options.hardware.amdgpu.loadInInitrd = lib.mkEnableOption (lib.mdDoc
|
|
|
|
"loading `amdgpu` kernelModule at stage 1. (Add `amdgpu` to `boot.initrd.kernelModules`)"
|
|
|
|
) // {
|
|
|
|
default = true;
|
|
|
|
};
|
2023-01-28 10:46:56 -05:00
|
|
|
options.hardware.amdgpu.amdvlk = lib.mkEnableOption (lib.mdDoc
|
|
|
|
"use amdvlk drivers instead mesa radv drivers"
|
2023-02-17 09:27:13 -05:00
|
|
|
);
|
2023-01-28 10:46:56 -05:00
|
|
|
options.hardware.amdgpu.opencl = lib.mkEnableOption (lib.mdDoc
|
|
|
|
"rocm opencl runtime (Install rocm-opencl-icd and rocm-opencl-runtime)"
|
|
|
|
) // {
|
|
|
|
default = true;
|
|
|
|
};
|
2022-12-15 16:01:50 -05:00
|
|
|
|
|
|
|
config = lib.mkMerge [
|
|
|
|
{
|
2023-03-06 04:08:52 -05:00
|
|
|
services.xserver.videoDrivers = lib.mkDefault [ "modesetting" ];
|
2023-01-28 10:46:56 -05: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.amdvlk {
|
2022-12-15 16:01:50 -05:00
|
|
|
hardware.opengl.extraPackages = with pkgs; [
|
|
|
|
amdvlk
|
|
|
|
];
|
2021-03-23 14:34:15 -04:00
|
|
|
|
2022-12-15 16:01:50 -05:00
|
|
|
hardware.opengl.extraPackages32 = with pkgs; [
|
|
|
|
driversi686Linux.amdvlk
|
|
|
|
];
|
2023-01-28 10:46:56 -05:00
|
|
|
})
|
|
|
|
(lib.mkIf config.hardware.amdgpu.opencl {
|
|
|
|
hardware.opengl.extraPackages = with pkgs; [
|
|
|
|
rocm-opencl-icd
|
|
|
|
rocm-opencl-runtime
|
|
|
|
];
|
2022-12-15 16:01:50 -05:00
|
|
|
})
|
|
|
|
];
|
2021-03-23 14:34:15 -04:00
|
|
|
}
|