about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/rocm-modules/6/update.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-03-24 11:04:41 +0100
committerAlyssa Ross <hi@alyssa.is>2024-03-24 11:04:41 +0100
commit5423cabbbf2b6dec5568f1ecabd288d5d9a642ec (patch)
treef316a6a921bfefd3a63bd4502c2eb50ff1644f67 /nixpkgs/pkgs/development/rocm-modules/6/update.nix
parent46a88117a05c3469af5d99433af140c3de8ca088 (diff)
parent8aa81f34981add12aecada6c702ddbbd0375ca36 (diff)
downloadnixlib-5423cabbbf2b6dec5568f1ecabd288d5d9a642ec.tar
nixlib-5423cabbbf2b6dec5568f1ecabd288d5d9a642ec.tar.gz
nixlib-5423cabbbf2b6dec5568f1ecabd288d5d9a642ec.tar.bz2
nixlib-5423cabbbf2b6dec5568f1ecabd288d5d9a642ec.tar.lz
nixlib-5423cabbbf2b6dec5568f1ecabd288d5d9a642ec.tar.xz
nixlib-5423cabbbf2b6dec5568f1ecabd288d5d9a642ec.tar.zst
nixlib-5423cabbbf2b6dec5568f1ecabd288d5d9a642ec.zip
Merge branch 'nixos-unstable-small' of https://github.com/NixOS/nixpkgs
Diffstat (limited to 'nixpkgs/pkgs/development/rocm-modules/6/update.nix')
-rw-r--r--nixpkgs/pkgs/development/rocm-modules/6/update.nix33
1 files changed, 33 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/rocm-modules/6/update.nix b/nixpkgs/pkgs/development/rocm-modules/6/update.nix
new file mode 100644
index 000000000000..4d531e6bb176
--- /dev/null
+++ b/nixpkgs/pkgs/development/rocm-modules/6/update.nix
@@ -0,0 +1,33 @@
+{ lib
+, writeScript
+}:
+
+{ name ? ""
+, owner ? ""
+, repo ? ""
+, page ? "releases/latest"
+, filter ? ".tag_name | split(\"-\") | .[1]"
+}:
+
+let
+  pname =
+    if lib.hasPrefix "rocm-llvm-" name
+    then "llvm.${lib.removePrefix "rocm-llvm-" name}"
+    else name;
+
+  updateScript = writeScript "update.sh" ''
+    #!/usr/bin/env nix-shell
+    #!nix-shell -i bash -p curl jq common-updater-scripts
+    version="$(curl ''${GITHUB_TOKEN:+-u ":$GITHUB_TOKEN"} \
+      -sL "https://api.github.com/repos/${owner}/${repo}/${page}" | jq '${filter}' --raw-output)"
+
+    IFS='.' read -a version_arr <<< "$version"
+
+    if (( ''${version_arr[0]} > 6 )); then
+      echo "'rocmPackages_6.${pname}' is already at it's maximum allowed version.''\nAny further upgrades should go into 'rocmPackages_X.${pname}'." 1>&2
+      exit 1
+    fi
+
+    update-source-version rocmPackages_6.${pname} "$version" --ignore-same-hash
+  '';
+in [ updateScript ]