Skip to content

Commit

Permalink
Working on rnls update script noci
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom McLaughlin committed Dec 9, 2024
1 parent d9f9023 commit 3bdc5e0
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"0.2.3.0"
40 changes: 40 additions & 0 deletions modules/kernels/rust/language_server_rust_analyzer/rnls_update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#! /usr/bin/env nix-shell
#! nix-shell -i bash -p nix-prefetch python3

VERSION=$(nix eval --raw --expr 'import ./rnls-version.nix' --impure)

echo "Got version: $VERSION"

NEW_HASHES=$(
for system in x86_64-linux x86_64-darwin aarch64-darwin; do
URL="https://github.com/codedownio/rust-notebook-language-server/releases/download/v${VERSION}/rust-notebook-language-server-${VERSION}-${system}.tar.gz"
HASH=$(nix-prefetch fetchzip --url "$URL" 2>/dev/null)
echo >&2 "$URL -> $HASH"
echo " \"$system\" = fetchzip {"
echo " url = \"$URL\";"
echo " hash = \"$HASH\";"
echo " });"
done
)

py_script=$(cat <<END
from operator import indexOf
import sys
input = sys.stdin.read()
with open("./rnls.nix", 'r') as f:
lines = f.readlines()
start_index = indexOf(map(lambda x: "HASHES_START" in x, lines), True)
end_index = indexOf(map(lambda x: "HASHES_END" in x, lines), True)
with open("./rnls.nix", 'w') as f:
f.write("".join(lines[0:(start_index+1)]) + input + "".join(lines[end_index:]))
END
)

echo "$NEW_HASHES" | python -c "$py_script"

0 comments on commit 3bdc5e0

Please sign in to comment.