1 # This module provides the proprietary AMDGPU-PRO drivers.
3 { config, lib, pkgs, ... }:
9 drivers = config.services.xserver.videoDrivers;
11 enabled = elem "amdgpu-pro" drivers;
13 package = config.boot.kernelPackages.amdgpu-pro;
14 package32 = pkgs.pkgsi686Linux.linuxPackages.amdgpu-pro.override { kernel = null; };
16 opengl = config.hardware.opengl;
22 config = mkIf enabled {
23 services.xserver.drivers = singleton
24 { name = "amdgpu"; modules = [ package ]; display = true; };
26 hardware.opengl.package = package;
27 hardware.opengl.package32 = package32;
28 hardware.opengl.setLdLibraryPath = true;
30 boot.extraModulePackages = [ package.kmod ];
32 boot.kernelPackages = pkgs.linuxKernel.packagesFor
33 (pkgs.linuxKernel.kernels.linux_5_10.override {
34 structuredExtraConfig = {
35 DEVICE_PRIVATE = kernel.yes;
36 KALLSYMS_ALL = kernel.yes;
40 hardware.firmware = [ package.fw ];
42 system.activationScripts.setup-amdgpu-pro = ''
43 ln -sfn ${package}/opt/amdgpu{,-pro} /run
46 system.requiredKernelConfig = with config.lib.kernelConfig; [
47 (isYes "DEVICE_PRIVATE")
48 (isYes "KALLSYMS_ALL")
51 boot.initrd.extraUdevRulesCommands = mkIf (!config.boot.initrd.systemd.enable) ''
52 cp -v ${package}/etc/udev/rules.d/*.rules $out/
54 boot.initrd.services.udev.packages = [ package ];
56 environment.systemPackages =
58 # this isn't really DRI, but we'll reuse this option for now
59 optional config.hardware.opengl.driSupport32Bit package32.vulkan;
62 "modprobe.d/blacklist-radeon.conf".source = package + "/etc/modprobe.d/blacklist-radeon.conf";
63 amd.source = package + "/etc/amd";