diff options
Diffstat (limited to 'pkgs/development/compilers/llvm/rocm/llvm.nix')
-rw-r--r-- | pkgs/development/compilers/llvm/rocm/llvm.nix | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/pkgs/development/compilers/llvm/rocm/llvm.nix b/pkgs/development/compilers/llvm/rocm/llvm.nix index 728c9024ee376..143c9516d5adb 100644 --- a/pkgs/development/compilers/llvm/rocm/llvm.nix +++ b/pkgs/development/compilers/llvm/rocm/llvm.nix @@ -58,24 +58,34 @@ in stdenv.mkDerivation (finalAttrs: { --replace 'FILES_MATCHING' 'NO_SOURCE_PERMISSIONS FILES_MATCHING' ''; - updateScript = writeScript "update.sh" '' - #!/usr/bin/env nix-shell - #!nix-shell -i bash -p curl jq common-updater-scripts nix-prefetch-github - - version="$(curl ''${GITHUB_TOKEN:+"-u \":$GITHUB_TOKEN\""} -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 - ''; + passthru = { + isClang = true; + + updateScript = writeScript "update.sh" '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p curl jq common-updater-scripts nix-prefetch-github + + version="$(curl ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \ + -sL "https://api.github.com/repos/RadeonOpenCompute/llvm-project/releases?per_page=1" | jq '.[0].tag_name | split("-") | .[1]' --raw-output)" + + IFS='.' read -a version_arr <<< "$version" + + if [ "''${#version_arr[*]}" == 2 ]; then + version="''${version}.0" + fi - passthru.isClang = true; + 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"; |