14910f5943
GitOrigin-RevId: 5aaed40d22f0d9376330b6fa413223435ad6fee5
70 lines
1.7 KiB
Nix
70 lines
1.7 KiB
Nix
# This module provides the proprietary AMDGPU-PRO drivers.
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
drivers = config.services.xserver.videoDrivers;
|
|
|
|
enabled = elem "amdgpu-pro" drivers;
|
|
|
|
package = config.boot.kernelPackages.amdgpu-pro;
|
|
package32 = pkgs.pkgsi686Linux.linuxPackages.amdgpu-pro.override { kernel = null; };
|
|
|
|
opengl = config.hardware.opengl;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
config = mkIf enabled {
|
|
|
|
nixpkgs.config.xorg.abiCompat = "1.20";
|
|
|
|
services.xserver.drivers = singleton
|
|
{ name = "amdgpu"; modules = [ package ]; display = true; };
|
|
|
|
hardware.opengl.package = package;
|
|
hardware.opengl.package32 = package32;
|
|
hardware.opengl.setLdLibraryPath = true;
|
|
|
|
boot.extraModulePackages = [ package.kmod ];
|
|
|
|
boot.kernelPackages = pkgs.linuxKernel.packagesFor
|
|
(pkgs.linuxKernel.kernels.linux_5_10.override {
|
|
structuredExtraConfig = {
|
|
DEVICE_PRIVATE = kernel.yes;
|
|
KALLSYMS_ALL = kernel.yes;
|
|
};
|
|
});
|
|
|
|
hardware.firmware = [ package.fw ];
|
|
|
|
system.activationScripts.setup-amdgpu-pro = ''
|
|
ln -sfn ${package}/opt/amdgpu{,-pro} /run
|
|
'';
|
|
|
|
system.requiredKernelConfig = with config.lib.kernelConfig; [
|
|
(isYes "DEVICE_PRIVATE")
|
|
(isYes "KALLSYMS_ALL")
|
|
];
|
|
|
|
boot.initrd.extraUdevRulesCommands = ''
|
|
cp -v ${package}/etc/udev/rules.d/*.rules $out/
|
|
'';
|
|
|
|
environment.systemPackages =
|
|
[ package.vulkan ] ++
|
|
# this isn't really DRI, but we'll reuse this option for now
|
|
optional config.hardware.opengl.driSupport32Bit package32.vulkan;
|
|
|
|
environment.etc = {
|
|
"modprobe.d/blacklist-radeon.conf".source = package + "/etc/modprobe.d/blacklist-radeon.conf";
|
|
amd.source = package + "/etc/amd";
|
|
};
|
|
|
|
};
|
|
|
|
}
|