Add a option to add(or disadd) amdgpu to kernelModule

Add a option to add(or disadd) amdgpu to boot.initrd.kernelModule
This commit is contained in:
ChaosAttractor 2022-12-16 05:01:50 +08:00
parent 1f60672721
commit a1a8723bf9

View file

@ -1,8 +1,15 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
boot.initrd.kernelModules = [ "amdgpu" ]; options.hardware.amdgpu.loadInInitrd = lib.mkEnableOption (lib.mdDoc
services.xserver.videoDrivers = [ "amdgpu" ]; "loading `amdgpu` kernelModule at stage 1. (Add `amdgpu` to `boot.initrd.kernelModules`)"
) // {
default = true;
};
config = lib.mkMerge [
{
services.xserver.videoDrivers = lib.mkDefault [ "amdgpu" ];
hardware.opengl.extraPackages = with pkgs; [ hardware.opengl.extraPackages = with pkgs; [
rocm-opencl-icd rocm-opencl-icd
@ -20,4 +27,9 @@
}; };
environment.variables.AMD_VULKAN_ICD = lib.mkDefault "RADV"; environment.variables.AMD_VULKAN_ICD = lib.mkDefault "RADV";
}
(lib.mkIf config.hardware.amdgpu.loadInInitrd {
boot.initrd.kernelModules = [ "amdgpu" ];
})
];
} }