git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #150664 from Flakebi/amdvlk

amdvlk: 2021.Q4.1 -> 2021.Q4.2

commitf91e43a0fa3b89af7aea6792972fe5fffe1e766f authorGuillaume Girol <symphorien@users.noreply.github.com> dateSat 18 Dec 2021, 20:24 (5 years ago) parent06be2a91769ca8
1 file changed+24−2
pkgs/development/libraries/amdvlk/default.nix+24−2
pkgs/development/libraries/amdvlk/default.nix+24−2
@@ -1,6 +1,7 @@
11{ stdenv
22, lib
33, fetchRepoProject
4+, writeScript
45, cmake
56, ninja
67, patchelf
@@ -21,17 +22,18 @@ let
2122
2223in stdenv.mkDerivation rec {
2324 pname = "amdvlk";
24− version = "2021.Q4.1";
25+ version = "2021.Q4.2";
2526
2627 src = fetchRepoProject {
2728 name = "${pname}-src";
2829 manifest = "https://github.com/GPUOpen-Drivers/AMDVLK.git";
2930 rev = "refs/tags/v-${version}";
30− sha256 = "sha256-yvpHLreBNhiSxnZis5+XcTOSZPRLq5K8YNJsjpYqD6s=";
31+ sha256 = "DpylZjIqWmCnUI0lEvd/HQcY+lr8asMurt1K9MI3qQw=";
3132 };
3233
3334 buildInputs = [
3435 expat
36+ libdrm
3537 ncurses
3638 openssl
3739 wayland
@@ -66,16 +68,36 @@ in stdenv.mkDerivation rec {
6668 cmakeDir = "../drivers/xgl";
6769
6870 installPhase = ''
71+ runHook preInstall
72+
6973 install -Dm755 -t $out/lib icd/amdvlk${suffix}.so
7074 install -Dm644 -t $out/share/vulkan/icd.d icd/amd_icd${suffix}.json
7175 install -Dm644 -t $out/share/vulkan/implicit_layer.d icd/amd_icd${suffix}.json
7276
7377 patchelf --set-rpath "$rpath" $out/lib/amdvlk${suffix}.so
78+
79+ runHook postInstall
7480 '';
7581
7682 # Keep the rpath, otherwise vulkaninfo and vkcube segfault
7783 dontPatchELF = true;
7884
85+ passthru.updateScript = writeScript "update.sh" ''
86+ #!/usr/bin/env nix-shell
87+ #!nix-shell -i bash -p coreutils curl gnused jq common-updater-scripts
88+
89+ function setHash() {
90+ sed -i "pkgs/development/libraries/amdvlk/default.nix" -e 's,sha256 = "[^.'"'"']*",sha256 = "'"$1"'",'
91+ }
92+
93+ version="$(curl -sL "https://api.github.com/repos/GPUOpen-Drivers/AMDVLK/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"
94+ sed -i "pkgs/development/libraries/amdvlk/default.nix" -e 's/version = "[^.'"'"']*"/version = "'"$version"'"/'
95+
96+ setHash "$(nix-instantiate --eval -A lib.fakeSha256 | xargs echo)"
97+ hash="$(nix to-base64 $(nix-build -A amdvlk 2>&1 | tail -n3 | grep 'got:' | cut -d: -f2- | xargs echo || true))"
98+ setHash "$hash"
99+ '';
100+
79101 meta = with lib; {
80102 description = "AMD Open Source Driver For Vulkan";
81103 homepage = "https://github.com/GPUOpen-Drivers/AMDVLK";