nixpkgs/nixos/modules/hardware/video/amdgpu-pro.nix

68 lines
1.6 KiB
Nix
Raw Normal View History

2016-09-22 03:42:16 +02:00
# This module provides the proprietary AMDGPU-PRO drivers.
{ config, lib, pkgs, pkgs_i686, ... }:
with lib;
let
drivers = config.services.xserver.videoDrivers;
enabled = elem "amdgpu-pro" drivers;
package = config.boot.kernelPackages.amdgpu-pro;
package32 = pkgs_i686.linuxPackages.amdgpu-pro.override { libsOnly = true; kernel = null; };
opengl = config.hardware.opengl;
2018-01-10 01:49:55 +01:00
kernel = pkgs.linux_4_9.override {
extraConfig = ''
KALLSYMS_ALL y
'';
};
2016-09-22 03:42:16 +02:00
in
{
config = mkIf enabled {
2018-01-10 01:49:55 +01:00
nixpkgs.config.xorg.abiCompat = "1.19";
2016-09-22 03:42:16 +02:00
services.xserver.drivers = singleton
{ name = "amdgpu"; modules = [ package ]; libPath = [ package ]; };
hardware.opengl.package = package;
hardware.opengl.package32 = package32;
boot.extraModulePackages = [ package ];
2018-01-10 01:49:55 +01:00
boot.kernelPackages =
pkgs.recurseIntoAttrs (pkgs.linuxPackagesFor kernel);
2016-09-22 03:42:16 +02: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 01:49:55 +01:00
ln -sfn ${package} /run/amdgpu-pro
2016-09-22 03:42:16 +02:00
'' + optionalString opengl.driSupport32Bit ''
ln -sfn ${package32}/lib ${package32.libCompatDir}
'';
2018-01-10 01:49:55 +01:00
system.requiredKernelConfig = with config.lib.kernelConfig; [
(isYes "KALLSYMS_ALL")
];
2016-09-22 03:42:16 +02: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";
};
};
}