summary refs log tree commit diff
path: root/pkgs/development/tools/electron/print-hashes.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/electron/print-hashes.sh')
-rwxr-xr-xpkgs/development/tools/electron/print-hashes.sh14
1 files changed, 9 insertions, 5 deletions
diff --git a/pkgs/development/tools/electron/print-hashes.sh b/pkgs/development/tools/electron/print-hashes.sh
index 203e5a4dfec..45656a8f7b2 100755
--- a/pkgs/development/tools/electron/print-hashes.sh
+++ b/pkgs/development/tools/electron/print-hashes.sh
@@ -19,11 +19,15 @@ SYSTEMS=(
     [x86_64-darwin]=darwin-x64
 )
 
+hashfile="$(nix-prefetch-url --print-path "https://github.com/electron/electron/releases/download/v${VERSION}/SHASUMS256.txt" 2>/dev/null | tail -n1)"
+
+echo "Entry similar to the following goes in default.nix:"
+echo
+echo "  electron_${VERSION%%.*} = mkElectron \"${VERSION}\" {"
+
 for S in "${!SYSTEMS[@]}"; do
-  HASHES["$S"]=$(nix-prefetch-url "https://github.com/electron/electron/releases/download/v${VERSION}/electron-v${VERSION}-${SYSTEMS[$S]}.zip")
+  hash="$(grep " *electron-v${VERSION}-${SYSTEMS[$S]}.zip$" "$hashfile"|cut -f1 -d' ')"
+  echo "    $S = \"$hash\";"
 done
 
-for S in "${!HASHES[@]}"; do
-    echo "$S"
-    echo "sha256 = \"${HASHES[$S]}\";"
-done
+echo "  };"