nixdots/system/shared/hardware/gpu/amd.nix

35 lines
913 B
Nix
Raw Normal View History

2024-05-15 18:29:28 +00:00
# WARNING: This file is currently untested
# (I didn't yet run this NixOS config on any AMD GPU systems)
{ config, lib, pkgs, ... }:
let
dev = config.myOptions.device;
in
{
config = lib.mkIf (dev.gpu.type == "amd") {
services.xserver.videoDrivers = lib.mkDefault ["modesetting" "amdgpu"];
boot = {
initrd.kernelModules = ["amdgpu"]; # load amdgpu kernel module as early as initrd
kernelModules = ["amdgpu"]; # if loading somehow fails during initrd but the boot continues, try again later
};
environment.systemPackages = with pkgs; [
mesa
vulkan-tools
vulkan-loader
vulkan-validation-layers
vulkan-extension-layer
];
# Enable OpenGL
2024-06-23 19:59:11 +00:00
hardware.graphics = {
2024-05-15 18:29:28 +00:00
enable = true;
# Enable OpenCL and AMDVLK
2024-06-23 19:59:11 +00:00
extraPackages = with pkgs; [ amdvlk ];
extraPackages32 = with pkgs; [ driversi686Linux.amdvlk ];
2024-05-15 18:29:28 +00:00
};
};
}