rust-analyzer: 2021-04-05 -> 2021-04-12

This commit is contained in:
Riey 2021-04-12 16:06:42 +09:00
parent 8fd3894d85
commit 62b44d8dfa
No known key found for this signature in database
GPG Key ID: 2D09658FE7407060
2 changed files with 15 additions and 19 deletions

View File

@ -4,20 +4,16 @@
, doCheck ? true , doCheck ? true
}: }:
let rustPlatform.buildRustPackage rec {
rev = "2021-04-05";
in
rustPlatform.buildRustPackage {
pname = "rust-analyzer-unwrapped"; pname = "rust-analyzer-unwrapped";
version = "unstable-${rev}"; version = "2021-04-12";
cargoSha256 = "sha256-kDwdKa08E0h24lOOa7ALeNqHlMjMry/ru1qwCIyKmuE="; cargoSha256 = "1mnx0mnfkvz6gmzy2jcl0wrdwd1mgfnrny4xf9wkd5vd4ks4k338";
src = fetchFromGitHub { src = fetchFromGitHub {
owner = "rust-analyzer"; owner = "rust-analyzer";
repo = "rust-analyzer"; repo = "rust-analyzer";
inherit rev; rev = version;
sha256 = "sha256-ZDxy87F3uz8bTF1/2LIy5r4Nv/M3xe97F7mwJNEFcUs="; sha256 = "1rg20aswbh9palwr3qfcnscsvzmbmhghn4k0nl11m9j7z6hva6bg";
}; };
buildAndTestSubdir = "crates/rust-analyzer"; buildAndTestSubdir = "crates/rust-analyzer";
@ -31,7 +27,7 @@ rustPlatform.buildRustPackage {
libiconv libiconv
]; ];
RUST_ANALYZER_REV = rev; RUST_ANALYZER_REV = version;
inherit doCheck; inherit doCheck;
preCheck = lib.optionalString doCheck '' preCheck = lib.optionalString doCheck ''
@ -43,7 +39,7 @@ rustPlatform.buildRustPackage {
runHook preInstallCheck runHook preInstallCheck
versionOutput="$($out/bin/rust-analyzer --version)" versionOutput="$($out/bin/rust-analyzer --version)"
echo "'rust-analyzer --version' returns: $versionOutput" echo "'rust-analyzer --version' returns: $versionOutput"
[[ "$versionOutput" == "rust-analyzer ${rev}" ]] [[ "$versionOutput" == "rust-analyzer ${version}" ]]
runHook postInstallCheck runHook postInstallCheck
''; '';

View File

@ -8,23 +8,23 @@ nixpkgs=../../../../..
# Update lsp # Update lsp
rev=$( ver=$(
curl -s "https://api.github.com/repos/$owner/$repo/releases" | curl -s "https://api.github.com/repos/$owner/$repo/releases" |
jq 'map(select(.prerelease | not)) | .[0].tag_name' --raw-output jq 'map(select(.prerelease | not)) | .[0].tag_name' --raw-output
) )
old_rev=$(sed -nE 's/.*\brev = "(.*)".*/\1/p' ./default.nix) old_ver=$(sed -nE 's/.*\bversion = "(.*)".*/\1/p' ./default.nix)
if grep -q 'cargoSha256 = ""' ./default.nix; then if grep -q 'cargoSha256 = ""' ./default.nix; then
old_rev='broken' old_ver='broken'
fi fi
if [[ "$rev" == "$old_rev" ]]; then if [[ "$ver" == "$old_ver" ]]; then
echo "Up to date: $rev" echo "Up to date: $ver"
exit exit
fi fi
echo "$old_rev -> $rev" echo "$old_ver -> $ver"
sha256=$(nix-prefetch -f "$nixpkgs" rust-analyzer-unwrapped.src --rev "$rev") sha256=$(nix-prefetch -f "$nixpkgs" rust-analyzer-unwrapped.src --rev "$ver")
# Clear cargoSha256 to avoid inconsistency. # Clear cargoSha256 to avoid inconsistency.
sed -e "s#rev = \".*\"#rev = \"$rev\"#" \ sed -e "s#version = \".*\"#version = \"$ver\"#" \
-e "/fetchFromGitHub/,/}/ s#sha256 = \".*\"#sha256 = \"$sha256\"#" \ -e "/fetchFromGitHub/,/}/ s#sha256 = \".*\"#sha256 = \"$sha256\"#" \
-e "s#cargoSha256 = \".*\"#cargoSha256 = \"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\"#" \ -e "s#cargoSha256 = \".*\"#cargoSha256 = \"sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=\"#" \
--in-place ./default.nix --in-place ./default.nix