amdvlk: use nix-update-script

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2025-01-01 16:12:09 +01:00
parent 499b84731a
commit 2422a31beb
+9 -18
View File
@@ -3,7 +3,7 @@
callPackage,
lib,
fetchRepoProject,
writeScript,
nix-update-script,
cmake,
directx-shader-compiler,
glslang,
@@ -102,23 +102,14 @@ stdenv.mkDerivation (finalAttrs: {
# 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
packagePath="pkgs/by-name/am/amdvlk/package.nix"
function setHash() {
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)"
sed -i $packagePath -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"
'';
passthru.updateScript = nix-update-script {
extraArgs = [
"--url"
"https://github.com/GPUOpen-Drivers/AMDVLK"
"--version-regex"
"v-(.*)"
];
};
passthru.impureTests = {
amdvlk = callPackage ./test.nix { };