-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tom McLaughlin
committed
Dec 9, 2024
1 parent
d9f9023
commit 3bdc5e0
Showing
2 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
modules/kernels/rust/language_server_rust_analyzer/rnls-version.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"0.2.3.0" |
40 changes: 40 additions & 0 deletions
40
modules/kernels/rust/language_server_rust_analyzer/rnls_update.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |