summary refs log tree commit diff
path: root/pkgs/development/libraries/amdvlk
diff options
context:
space:
mode:
authorSebastian Neubauer <Sebastian.Neubauer@amd.com>2021-12-14 12:32:55 +0100
committerNeubauer, Sebastian <Sebastian.Neubauer@amd.com>2021-12-14 12:32:55 +0100
commit1769ca8b7eaa551961e8396ab798693fb7d6d4d1 (patch)
treec91537ce1408a797993f9ccf5580d287bc6e4df4 /pkgs/development/libraries/amdvlk
parentd995f2abb98b92b26cc4b8044e3a3251a067757b (diff)
amdvlk: 2021.Q4.1 -> 2021.Q4.2
Diffstat (limited to 'pkgs/development/libraries/amdvlk')
-rw-r--r--pkgs/development/libraries/amdvlk/default.nix26
1 files changed, 24 insertions, 2 deletions
diff --git a/pkgs/development/libraries/amdvlk/default.nix b/pkgs/development/libraries/amdvlk/default.nix
index b5323464630f0..6c9650cacca94 100644
--- a/pkgs/development/libraries/amdvlk/default.nix
+++ b/pkgs/development/libraries/amdvlk/default.nix
@@ -1,6 +1,7 @@
 { stdenv
 , lib
 , fetchRepoProject
+, writeScript
 , cmake
 , ninja
 , patchelf
@@ -21,17 +22,18 @@ let
 
 in stdenv.mkDerivation rec {
   pname = "amdvlk";
-  version = "2021.Q4.1";
+  version = "2021.Q4.2";
 
   src = fetchRepoProject {
     name = "${pname}-src";
     manifest = "https://github.com/GPUOpen-Drivers/AMDVLK.git";
     rev = "refs/tags/v-${version}";
-    sha256 = "sha256-yvpHLreBNhiSxnZis5+XcTOSZPRLq5K8YNJsjpYqD6s=";
+    sha256 = "DpylZjIqWmCnUI0lEvd/HQcY+lr8asMurt1K9MI3qQw=";
   };
 
   buildInputs = [
     expat
+    libdrm
     ncurses
     openssl
     wayland
@@ -66,16 +68,36 @@ in stdenv.mkDerivation rec {
   cmakeDir = "../drivers/xgl";
 
   installPhase = ''
+    runHook preInstall
+
     install -Dm755 -t $out/lib icd/amdvlk${suffix}.so
     install -Dm644 -t $out/share/vulkan/icd.d icd/amd_icd${suffix}.json
     install -Dm644 -t $out/share/vulkan/implicit_layer.d icd/amd_icd${suffix}.json
 
     patchelf --set-rpath "$rpath" $out/lib/amdvlk${suffix}.so
+
+    runHook postInstall
   '';
 
   # Keep the rpath, otherwise vulkaninfo and vkcube segfault
   dontPatchELF = true;
 
+  passthru.updateScript = writeScript "update.sh" ''
+    #!/usr/bin/env nix-shell
+    #!nix-shell -i bash -p coreutils curl gnused jq common-updater-scripts
+
+    function setHash() {
+      sed -i "pkgs/development/libraries/amdvlk/default.nix" -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)"
+    sed -i "pkgs/development/libraries/amdvlk/default.nix" -e 's/version = "[^.'"'"']*"/version = "'"$version"'"/'
+
+    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))"
+    setHash "$hash"
+  '';
+
   meta = with lib; {
     description = "AMD Open Source Driver For Vulkan";
     homepage = "https://github.com/GPUOpen-Drivers/AMDVLK";