2016-09-22 01:42:16 +00:00
|
|
|
# This module provides the proprietary AMDGPU-PRO drivers.
|
|
|
|
|
2018-11-03 05:55:57 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
2016-09-22 01:42:16 +00:00
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
|
|
|
|
drivers = config.services.xserver.videoDrivers;
|
|
|
|
|
|
|
|
enabled = elem "amdgpu-pro" drivers;
|
|
|
|
|
|
|
|
package = config.boot.kernelPackages.amdgpu-pro;
|
2018-11-03 05:55:57 +00:00
|
|
|
package32 = pkgs.pkgsi686Linux.linuxPackages.amdgpu-pro.override { libsOnly = true; kernel = null; };
|
2016-09-22 01:42:16 +00:00
|
|
|
|
|
|
|
opengl = config.hardware.opengl;
|
|
|
|
|
2018-01-10 00:49:55 +00:00
|
|
|
kernel = pkgs.linux_4_9.override {
|
|
|
|
extraConfig = ''
|
|
|
|
KALLSYMS_ALL y
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2016-09-22 01:42:16 +00:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
config = mkIf enabled {
|
|
|
|
|
2018-01-10 00:49:55 +00:00
|
|
|
nixpkgs.config.xorg.abiCompat = "1.19";
|
2017-01-29 23:02:48 +00:00
|
|
|
|
2016-09-22 01:42:16 +00:00
|
|
|
services.xserver.drivers = singleton
|
2019-08-14 16:37:03 +00:00
|
|
|
{ name = "amdgpu"; modules = [ package ]; display = true; };
|
2016-09-22 01:42:16 +00:00
|
|
|
|
|
|
|
hardware.opengl.package = package;
|
|
|
|
hardware.opengl.package32 = package32;
|
2019-05-23 23:21:57 +00:00
|
|
|
hardware.opengl.setLdLibraryPath = true;
|
2016-09-22 01:42:16 +00:00
|
|
|
|
|
|
|
boot.extraModulePackages = [ package ];
|
|
|
|
|
2018-01-10 00:49:55 +00:00
|
|
|
boot.kernelPackages =
|
|
|
|
pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor kernel);
|
|
|
|
|
2016-09-22 01:42:16 +00:00
|
|
|
boot.blacklistedKernelModules = [ "radeon" ];
|
|
|
|
|
|
|
|
hardware.firmware = [ package ];
|
|
|
|
|
|
|
|
system.activationScripts.setup-amdgpu-pro = ''
|
|
|
|
mkdir -p /run/lib
|
|
|
|
ln -sfn ${package}/lib ${package.libCompatDir}
|
2018-01-10 00:49:55 +00:00
|
|
|
ln -sfn ${package} /run/amdgpu-pro
|
2016-09-22 01:42:16 +00:00
|
|
|
'' + optionalString opengl.driSupport32Bit ''
|
|
|
|
ln -sfn ${package32}/lib ${package32.libCompatDir}
|
|
|
|
'';
|
|
|
|
|
2018-01-10 00:49:55 +00:00
|
|
|
system.requiredKernelConfig = with config.lib.kernelConfig; [
|
|
|
|
(isYes "KALLSYMS_ALL")
|
|
|
|
];
|
|
|
|
|
2016-09-22 01:42:16 +00:00
|
|
|
environment.etc = {
|
|
|
|
"amd/amdrc".source = package + "/etc/amd/amdrc";
|
|
|
|
"amd/amdapfxx.blb".source = package + "/etc/amd/amdapfxx.blb";
|
|
|
|
"gbm/gbm.conf".source = package + "/etc/gbm/gbm.conf";
|
|
|
|
};
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|