about summary refs log tree commit diff
path: root/pkgs/development/tools/rocminfo
diff options
context:
space:
mode:
authorMadoura <madouura@gmail.com>2022-12-03 18:25:41 -0600
committerMadoura <madouura@gmail.com>2022-12-10 13:51:09 -0600
commit9b98f8433af210894f4bd9d6a76a1602fb9419ae (patch)
tree0a16ef8732c12fd2d95a810d53c1bd77d8cbccdd /pkgs/development/tools/rocminfo
parent72f5af191f2c799131bfb67398a12301e7663239 (diff)
rocm-related: create and use a generic updater script
Diffstat (limited to 'pkgs/development/tools/rocminfo')
-rw-r--r--pkgs/development/tools/rocminfo/default.nix29
1 files changed, 21 insertions, 8 deletions
diff --git a/pkgs/development/tools/rocminfo/default.nix b/pkgs/development/tools/rocminfo/default.nix
index 43bd1fc8d8d6e..34dcb52526bd0 100644
--- a/pkgs/development/tools/rocminfo/default.nix
+++ b/pkgs/development/tools/rocminfo/default.nix
@@ -1,14 +1,27 @@
-{ stdenv, lib, fetchFromGitHub, writeScript, fetchpatch, cmake, rocm-runtime, python3, rocm-cmake, busybox, gnugrep
+{ stdenv
+, lib
+, fetchFromGitHub
+, rocmUpdateScript
+, fetchpatch
+, cmake
+, rocm-runtime
+, python3
+, rocm-cmake
+, busybox
+, gnugrep
   # rocminfo requires that the calling user have a password and be in
   # the video group. If we let rocm_agent_enumerator rely upon
   # rocminfo's output, then it, too, has those requirements. Instead,
   # we can specify the GPU targets for this system (e.g. "gfx803" for
   # Polaris) such that no system call is needed for downstream
   # compilers to determine the desired target.
-, defaultTargets ? []}:
+, defaultTargets ? []
+}:
+
 stdenv.mkDerivation (finalAttrs: {
   version = "5.4.0";
   pname = "rocminfo";
+
   src = fetchFromGitHub {
     owner = "RadeonOpenCompute";
     repo = "rocminfo";
@@ -19,6 +32,7 @@ stdenv.mkDerivation (finalAttrs: {
   enableParallelBuilding = true;
   nativeBuildInputs = [ cmake ];
   buildInputs = [ rocm-cmake rocm-runtime ];
+
   cmakeFlags = [
     "-DROCM_DIR=${rocm-runtime}"
     "-DROCRTST_BLD_TYPE=Release"
@@ -37,12 +51,11 @@ stdenv.mkDerivation (finalAttrs: {
     echo '${lib.concatStringsSep "\n" defaultTargets}' > $out/bin/target.lst
   '';
 
-  passthru.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/RadeonOpenCompute/rocminfo/tags" | jq '.[].name | split("-") | .[1] | select( . != null )' --raw-output | sort -n | tail -1)"
-    update-source-version rocminfo "$version" --ignore-same-hash
-  '';
+  passthru.updateScript = rocmUpdateScript {
+    name = finalAttrs.pname;
+    owner = finalAttrs.src.owner;
+    repo = finalAttrs.src.repo;
+  };
 
   meta = with lib; {
     description = "ROCm Application for Reporting System Info";