llvmPackages_rocm: add update script

mullvad-ns
Sebastian Neubauer 3 years ago
parent d99dfe5821
commit 61a2864b18
  1. 18
      pkgs/development/compilers/llvm/rocm/llvm/default.nix

@ -1,6 +1,7 @@
{ stdenv
, lib
, fetchFromGitHub
, writeScript
, cmake
, python3
, libxml2
@ -88,6 +89,23 @@ in stdenv.mkDerivation rec {
passthru.src = src;
updateScript = writeScript "update.sh" ''
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p curl jq common-updater-scripts nix-prefetch-github
version="$(curl -sL "https://api.github.com/repos/RadeonOpenCompute/llvm-project/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)"
current_version="$(grep "version =" pkgs/development/compilers/llvm/rocm/default.nix | cut -d'"' -f2)"
if [[ "$version" != "$current_version" ]]; then
tarball_meta="$(nix-prefetch-github RadeonOpenCompute llvm-project --rev "rocm-$version")"
tarball_hash="$(nix to-base64 sha256-$(jq -r '.sha256' <<< "$tarball_meta"))"
sed -i "pkgs/development/compilers/llvm/rocm/default.nix" \
-e 's,version = "\(.*\)",version = "'"$version"'",' \
-e 's,hash = "\(.*\)",hash = "sha256-'"$tarball_hash"'",'
else
echo rocm-llvm already up-to-date
fi
'';
meta = with lib; {
description = "ROCm fork of the LLVM compiler infrastructure";
homepage = "https://github.com/RadeonOpenCompute/llvm-project";

Loading…
Cancel
Save