2020-04-24 23:36:52 +00:00
|
|
|
# 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;
|
2022-01-13 20:06:32 +00:00
|
|
|
package32 = pkgs.pkgsi686Linux.linuxPackages.amdgpu-pro.override { kernel = null; };
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
opengl = config.hardware.opengl;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
config = mkIf enabled {
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
nixpkgs.config.xorg.abiCompat = "1.20";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
services.xserver.drivers = singleton
|
|
|
|
{ name = "amdgpu"; modules = [ package ]; display = true; };
|
|
|
|
|
|
|
|
hardware.opengl.package = package;
|
|
|
|
hardware.opengl.package32 = package32;
|
|
|
|
hardware.opengl.setLdLibraryPath = true;
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
boot.extraModulePackages = [ package.kmod ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
boot.kernelPackages = pkgs.linuxKernel.packagesFor
|
|
|
|
(pkgs.linuxKernel.kernels.linux_5_10.override {
|
|
|
|
structuredExtraConfig = {
|
|
|
|
DEVICE_PRIVATE = kernel.yes;
|
|
|
|
KALLSYMS_ALL = kernel.yes;
|
|
|
|
};
|
|
|
|
});
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
hardware.firmware = [ package.fw ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
system.activationScripts.setup-amdgpu-pro = ''
|
2022-01-13 20:06:32 +00:00
|
|
|
ln -sfn ${package}/opt/amdgpu{,-pro} /run
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
system.requiredKernelConfig = with config.lib.kernelConfig; [
|
2022-01-13 20:06:32 +00:00
|
|
|
(isYes "DEVICE_PRIVATE")
|
2020-04-24 23:36:52 +00:00
|
|
|
(isYes "KALLSYMS_ALL")
|
|
|
|
];
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
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;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
environment.etc = {
|
2022-01-13 20:06:32 +00:00
|
|
|
"modprobe.d/blacklist-radeon.conf".source = package + "/etc/modprobe.d/blacklist-radeon.conf";
|
|
|
|
amd.source = package + "/etc/amd";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|