2023-05-18 12:07:07 +02:00
|
|
|
{ pkgs, lib, xorg, stdenv, openssl, libdrm, zlib, dpkg, patchelf, fetchurl }:
|
|
|
|
|
|
|
|
let
|
2023-05-23 16:25:39 +02:00
|
|
|
sources = import ./amdgpu-src.nix { inherit fetchurl; };
|
|
|
|
suffix = if pkgs.stdenv.system == "x86_64-linux" then "64" else "32";
|
|
|
|
amdbit = if pkgs.stdenv.system == "x86_64-linux" then "x86_64-linux-gnu" else "i386-linux-gnu";
|
2023-05-18 12:07:07 +02:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2023-05-23 16:25:39 +02:00
|
|
|
pname = "amdgpu-pro-vulkan-${suffix}";
|
|
|
|
version = sources.version;
|
2023-05-18 12:07:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2023-05-23 16:25:39 +02:00
|
|
|
src = if stdenv.system == "x86_64-linux" then sources.bit64.vulkan-amdgpu-pro else sources.bit32.vulkan-amdgpu-pro;
|
2023-05-18 12:07:07 +02:00
|
|
|
|
|
|
|
dontPatchELF = true;
|
|
|
|
sourceRoot = ".";
|
|
|
|
nativeBuildInputs = [
|
|
|
|
dpkg
|
|
|
|
patchelf
|
|
|
|
];
|
|
|
|
buildInputs = [
|
|
|
|
libdrm
|
|
|
|
openssl
|
|
|
|
stdenv.cc.cc.lib
|
|
|
|
xorg.libX11
|
|
|
|
xorg.libxcb
|
|
|
|
xorg.libxshmfence
|
|
|
|
zlib
|
|
|
|
];
|
|
|
|
rpath = lib.makeLibraryPath buildInputs;
|
|
|
|
|
|
|
|
unpackPhase = ''
|
|
|
|
dpkg -x $src .
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out/lib
|
|
|
|
mkdir -p $out/share/vulkan/icd.d
|
|
|
|
install -Dm644 opt/amdgpu-pro/etc/vulkan/icd.d/amd_icd${suffix}.json $out/share/vulkan/icd.d/amd_pro_icd${suffix}.json
|
|
|
|
install -Dm755 opt/amdgpu-pro/lib/${amdbit}/amdvlk${suffix}.so $out/lib/amdvlkpro${suffix}.so
|
|
|
|
sed -i "s#/opt/amdgpu-pro/lib/${amdbit}/amdvlk${suffix}.so#$out/lib/amdvlkpro${suffix}.so#" $out/share/vulkan/icd.d/amd_pro_icd${suffix}.json
|
|
|
|
patchelf --set-rpath "$rpath" $out/lib/amdvlkpro${suffix}.so
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "AMD Proprietary Driver For Vulkan";
|
|
|
|
homepage = "https://www.amd.com";
|
|
|
|
license = licenses.unfree;
|
|
|
|
platforms = [ "x86_64-linux" "i686-linux" ];
|
|
|
|
};
|
|
|
|
}
|