2016-09-22 03:42:16 +02:00
|
|
|
# This module provides the proprietary AMDGPU-PRO drivers.
|
|
|
|
|
2018-11-03 06:55:57 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
2016-09-22 03:42:16 +02:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
drivers = config.services.xserver.videoDrivers;
|
|
|
|
|
|
|
|
enabled = elem "amdgpu-pro" drivers;
|
|
|
|
|
|
|
|
package = config.boot.kernelPackages.amdgpu-pro;
|
2018-09-17 03:12:59 +02:00
|
|
|
package32 = pkgs.pkgsi686Linux.linuxPackages.amdgpu-pro.override { kernel = null; };
|
2016-09-22 03:42:16 +02:00
|
|
|
|
|
|
|
opengl = config.hardware.opengl;
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
config = mkIf enabled {
|
|
|
|
|
2018-09-17 03:12:59 +02:00
|
|
|
nixpkgs.config.xorg.abiCompat = "1.20";
|
2017-01-30 00:02:48 +01:00
|
|
|
|
2016-09-22 03:42:16 +02:00
|
|
|
services.xserver.drivers = singleton
|
2019-08-14 18:37:03 +02:00
|
|
|
{ name = "amdgpu"; modules = [ package ]; display = true; };
|
2016-09-22 03:42:16 +02:00
|
|
|
|
|
|
|
hardware.opengl.package = package;
|
|
|
|
hardware.opengl.package32 = package32;
|
2019-05-24 01:21:57 +02:00
|
|
|
hardware.opengl.setLdLibraryPath = true;
|
2016-09-22 03:42:16 +02:00
|
|
|
|
2018-09-17 03:12:59 +02:00
|
|
|
boot.extraModulePackages = [ package.kmod ];
|
2018-01-10 01:49:55 +01:00
|
|
|
|
2018-09-17 03:12:59 +02:00
|
|
|
boot.kernelPackages = pkgs.linuxKernel.packagesFor
|
|
|
|
(pkgs.linuxKernel.kernels.linux_5_10.override {
|
|
|
|
structuredExtraConfig = {
|
|
|
|
DEVICE_PRIVATE = kernel.yes;
|
|
|
|
KALLSYMS_ALL = kernel.yes;
|
|
|
|
};
|
|
|
|
});
|
2016-09-22 03:42:16 +02:00
|
|
|
|
2018-09-17 03:12:59 +02:00
|
|
|
hardware.firmware = [ package.fw ];
|
2016-09-22 03:42:16 +02:00
|
|
|
|
|
|
|
system.activationScripts.setup-amdgpu-pro = ''
|
2018-09-17 03:12:59 +02:00
|
|
|
ln -sfn ${package}/opt/amdgpu{,-pro} /run
|
2016-09-22 03:42:16 +02:00
|
|
|
'';
|
|
|
|
|
2018-01-10 01:49:55 +01:00
|
|
|
system.requiredKernelConfig = with config.lib.kernelConfig; [
|
2018-09-17 03:12:59 +02:00
|
|
|
(isYes "DEVICE_PRIVATE")
|
2018-01-10 01:49:55 +01:00
|
|
|
(isYes "KALLSYMS_ALL")
|
|
|
|
];
|
|
|
|
|
2022-04-17 15:00:02 +02:00
|
|
|
boot.initrd.extraUdevRulesCommands = mkIf (!config.boot.initrd.systemd.enable) ''
|
2018-09-17 03:12:59 +02:00
|
|
|
cp -v ${package}/etc/udev/rules.d/*.rules $out/
|
|
|
|
'';
|
2022-04-17 15:00:02 +02:00
|
|
|
boot.initrd.services.udev.packages = [ package ];
|
2018-09-17 03:12:59 +02:00
|
|
|
|
|
|
|
environment.systemPackages =
|
|
|
|
[ package.vulkan ] ++
|
|
|
|
# this isn't really DRI, but we'll reuse this option for now
|
|
|
|
optional config.hardware.opengl.driSupport32Bit package32.vulkan;
|
|
|
|
|
2016-09-22 03:42:16 +02:00
|
|
|
environment.etc = {
|
2018-09-17 03:12:59 +02:00
|
|
|
"modprobe.d/blacklist-radeon.conf".source = package + "/etc/modprobe.d/blacklist-radeon.conf";
|
|
|
|
amd.source = package + "/etc/amd";
|
2016-09-22 03:42:16 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|