Merge pull request #335424 from JohnRTitor/amdvlk-update

amdvlk: apply nixfmt-rfc-style, move to finalAttrs, pkgs/by-name
This commit is contained in:
Masum Reza 2024-08-19 11:26:26 +05:30 committed by GitHub
commit 64481d023a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 87 additions and 71 deletions

View File

@ -1,78 +1,89 @@
{ stdenv {
, callPackage stdenv,
, lib callPackage,
, fetchRepoProject lib,
, writeScript fetchRepoProject,
, cmake writeScript,
, directx-shader-compiler cmake,
, glslang directx-shader-compiler,
, ninja glslang,
, patchelf ninja,
, perl patchelf,
, pkg-config perl,
, python3 pkg-config,
, expat python3,
, libdrm expat,
, ncurses libdrm,
, openssl ncurses,
, wayland openssl,
, xorg wayland,
, zlib xorg,
zlib,
}: }:
let let
suffix = if stdenv.system == "x86_64-linux" then "64" else "32"; suffix = if stdenv.system == "x86_64-linux" then "64" else "32";
in stdenv.mkDerivation rec { in
stdenv.mkDerivation (finalAttrs: {
pname = "amdvlk"; pname = "amdvlk";
version = "2024.Q3.1"; version = "2024.Q3.1";
src = fetchRepoProject { src = fetchRepoProject {
name = "${pname}-src"; name = "amdvlk-src";
manifest = "https://github.com/GPUOpen-Drivers/AMDVLK.git"; manifest = "https://github.com/GPUOpen-Drivers/AMDVLK.git";
rev = "refs/tags/v-${version}"; rev = "refs/tags/v-${finalAttrs.version}";
sha256 = "IZYv9ZfpIllYUhJ3f7AOFmSl7OfWWY8doaG8pe3GE+4="; sha256 = "IZYv9ZfpIllYUhJ3f7AOFmSl7OfWWY8doaG8pe3GE+4=";
}; };
buildInputs = [ buildInputs =
expat [
libdrm expat
ncurses libdrm
openssl ncurses
wayland openssl
xorg.libX11 wayland
xorg.libxcb zlib
xorg.xcbproto ]
xorg.libXext ++ (with xorg; [
xorg.libXrandr libX11
xorg.libXft libxcb
xorg.libxshmfence xcbproto
zlib libXext
]; libXrandr
libXft
libxshmfence
]);
nativeBuildInputs = [ nativeBuildInputs =
cmake [
directx-shader-compiler cmake
glslang directx-shader-compiler
ninja glslang
patchelf ninja
perl patchelf
pkg-config perl
python3 pkg-config
] ++ (with python3.pkgs; [ python3
jinja2 ]
ruamel-yaml ++ (with python3.pkgs; [
]); jinja2
ruamel-yaml
]);
rpath = lib.makeLibraryPath [ rpath = lib.makeLibraryPath (
libdrm [
openssl libdrm
stdenv.cc.cc.lib openssl
xorg.libX11 stdenv.cc.cc.lib
xorg.libxcb zlib
xorg.libxshmfence ]
zlib ++ (with xorg; [
]; libX11
libxcb
libxshmfence
])
);
cmakeDir = "../drivers/xgl"; cmakeDir = "../drivers/xgl";
@ -95,26 +106,33 @@ in stdenv.mkDerivation rec {
#!/usr/bin/env nix-shell #!/usr/bin/env nix-shell
#!nix-shell -i bash -p coreutils curl gnused jq common-updater-scripts #!nix-shell -i bash -p coreutils curl gnused jq common-updater-scripts
packagePath="pkgs/by-name/am/amdvlk/package.nix"
function setHash() { function setHash() {
sed -i "pkgs/development/libraries/amdvlk/default.nix" -e 's,sha256 = "[^'"'"'"]*",sha256 = "'"$1"'",' sed -i $packagePath -e 's,sha256 = "[^'"'"'"]*",sha256 = "'"$1"'",'
} }
version="$(curl -sL "https://api.github.com/repos/GPUOpen-Drivers/AMDVLK/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)" version="$(curl -sL "https://api.github.com/repos/GPUOpen-Drivers/AMDVLK/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"
sed -i "pkgs/development/libraries/amdvlk/default.nix" -e 's/version = "[^'"'"'"]*"/version = "'"$version"'"/' sed -i $packagePath -e 's/version = "[^'"'"'"]*"/version = "'"$version"'"/'
setHash "$(nix-instantiate --eval -A lib.fakeSha256 | xargs echo)" setHash "$(nix-instantiate --eval -A lib.fakeSha256 | xargs echo)"
hash="$(nix to-base64 $(nix-build -A amdvlk 2>&1 | tail -n3 | grep 'got:' | cut -d: -f2- | xargs echo || true))" hash="$(nix to-base64 $(nix-build -A amdvlk 2>&1 | tail -n3 | grep 'got:' | cut -d: -f2- | xargs echo || true))"
setHash "$hash" setHash "$hash"
''; '';
passthru.impureTests = { amdvlk = callPackage ./test.nix {}; }; passthru.impureTests = {
amdvlk = callPackage ./test.nix { };
};
meta = with lib; { meta = {
description = "AMD Open Source Driver For Vulkan"; description = "AMD Open Source Driver For Vulkan";
homepage = "https://github.com/GPUOpen-Drivers/AMDVLK"; homepage = "https://github.com/GPUOpen-Drivers/AMDVLK";
changelog = "https://github.com/GPUOpen-Drivers/AMDVLK/releases/tag/v-${version}"; changelog = "https://github.com/GPUOpen-Drivers/AMDVLK/releases/tag/v-${finalAttrs.version}";
license = licenses.mit; license = lib.licenses.mit;
platforms = [ "x86_64-linux" "i686-linux" ]; platforms = [
maintainers = with maintainers; [ Flakebi ]; "x86_64-linux"
"i686-linux"
];
maintainers = with lib.maintainers; [ Flakebi ];
}; };
} })

View File

@ -19421,8 +19421,6 @@ with pkgs;
allegro4 = callPackage ../development/libraries/allegro { }; allegro4 = callPackage ../development/libraries/allegro { };
allegro5 = callPackage ../development/libraries/allegro/5.nix { }; allegro5 = callPackage ../development/libraries/allegro/5.nix { };
amdvlk = callPackage ../development/libraries/amdvlk { };
amf-headers = callPackage ../development/libraries/amf-headers { }; amf-headers = callPackage ../development/libraries/amf-headers { };
aml = callPackage ../development/libraries/aml { }; aml = callPackage ../development/libraries/aml { };