about summary refs log tree commit diff
path: root/pkgs/development/tools/reindeer
diff options
context:
space:
mode:
authorfigsoda <figsoda@pm.me>2023-05-31 19:37:45 -0400
committerfigsoda <figsoda@pm.me>2023-05-31 19:38:29 -0400
commit01680e9f066b6c72e374be99290a2cdd10194804 (patch)
tree666ec9fa0a3799111aff781c56741d74e165c530 /pkgs/development/tools/reindeer
parent4c042866938cfef3dfb2b58e21319874cdeb8f4d (diff)
reindeer: update passthru.updateScript to use upstream Cargo.lock
Diffstat (limited to 'pkgs/development/tools/reindeer')
-rw-r--r--pkgs/development/tools/reindeer/default.nix4
-rwxr-xr-xpkgs/development/tools/reindeer/update.sh37
2 files changed, 3 insertions, 38 deletions
diff --git a/pkgs/development/tools/reindeer/default.nix b/pkgs/development/tools/reindeer/default.nix
index 5cd7c8eabb842..f46212cc2ac47 100644
--- a/pkgs/development/tools/reindeer/default.nix
+++ b/pkgs/development/tools/reindeer/default.nix
@@ -36,7 +36,9 @@ rustPlatform.buildRustPackage rec {
       darwin.apple_sdk.frameworks.CoreServices
     ];
 
-  passthru.updateScript = ./update.sh;
+  passthru.updateScript = nix-update-script {
+    extraArgs = [ "--version" "branch" ];
+  };
 
   meta = with lib; {
     description = "Reindeer is a tool which takes Rust Cargo dependencies and generates Buck build rules";
diff --git a/pkgs/development/tools/reindeer/update.sh b/pkgs/development/tools/reindeer/update.sh
deleted file mode 100755
index 2a34ede615189..0000000000000
--- a/pkgs/development/tools/reindeer/update.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env nix-shell
-#!nix-shell -I nixpkgs=./. -i bash -p curl jq nix-prefetch common-updater-scripts mktemp nix coreutils
-
-# First, check that we only update once per day since the version tag is dependent on the date.
-NEW_VERSION="unstable-$(date -u +%F)"
-CURRENT_VERSION=$(nix-instantiate --eval -E "with import ./. {}; reindeer.version" | tr -d '"')
-if [[ "$NEW_VERSION" == "$CURRENT_VERSION" ]]; then
-    echo "skipping reindeer update within same day (version: \"$CURRENT_VERSION\")"
-    exit 0
-fi
-
-# Second, let's check if there's a new commit to main.
-NEW_REV=$(curl https://api.github.com/repos/facebookincubator/reindeer/branches/main | jq '.commit.sha')
-CURRENT_REV=$(nix-instantiate --eval -E "with import ./. {}; reindeer.src.rev")
-if [[ "$NEW_REV" == "$CURRENT_REV" ]]; then
-    echo "reindeer is up-to-date (rev: $CURRENT_REV)"
-    exit 0
-fi
-echo "updating reindeer (new: $NEW_REV) (old: $CURRENT_REV)"
-
-# Generate the new lockfile in a temporary directory.
-pushd $(mktemp -d)
-git clone https://github.com/facebookincubator/reindeer.git --depth=1
-pushd reindeer
-cargo generate-lockfile
-LOCKFILE=$(realpath ./Cargo.lock)
-popd
-popd
-cp $LOCKFILE pkgs/development/tools/reindeer/
-
-# Get the new sha256 value.
-TRIMMED_REV=$(echo $NEW_REV | tr -d '"')
-HASH_RAW=$(nix-prefetch-url https://github.com/facebookincubator/reindeer/archive/${TRIMMED_REV}.tar.gz --unpack --type sha256)
-HASH_SRI=$(nix hash to-sri --type sha256 ${HASH_RAW})
-
-# Update the file accordingly.
-update-source-version reindeer "$NEW_VERSION" ${HASH_SRI} --rev=${TRIMMED_REV}