blob: 8dd4a29a792cf3e9a62ad5ec8df152ff4b867054 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# Update script: pkgs/development/tools/rust/rust-analyzer/update.sh
{ lib, pkgs, stdenv, nodejs, vscode-utils, jq, rust-analyzer
, setDefaultRaLspServerPath ? true
}:
let
pname = "rust-analyzer";
publisher = "matklad";
# Follow the unstable version of rust-analyzer, since the extension is not stable yet.
inherit (rust-analyzer) version;
vsix = (import ./node-composition.nix {
inherit pkgs nodejs;
inherit (stdenv.hostPlatform) system;
}).package.override {
src = "${rust-analyzer.src}/editors/code";
outputs = [ "vsix" "out" ];
postInstall = ''
npm run package
mkdir $vsix
cp ${pname}.vsix $vsix/${pname}.zip
'';
};
in vscode-utils.buildVscodeExtension {
inherit version vsix;
name = "${pname}-${version}";
src = "${vsix}/${pname}.zip";
vscodeExtUniqueId = "${publisher}.${pname}";
nativeBuildInputs = lib.optional setDefaultRaLspServerPath jq;
postFixup = lib.optionalString setDefaultRaLspServerPath ''
package_json="$out/share/vscode/extensions/${publisher}.${pname}/package.json"
jq '.contributes.configuration.properties."rust-analyzer.serverPath".default = $s' \
--arg s "${rust-analyzer}/bin/rust-analyzer" \
$package_json >$package_json.new
mv $package_json.new $package_json
'';
meta = with lib; {
description = "An alternative rust language server to the RLS";
homepage = "https://github.com/rust-analyzer/rust-analyzer";
license = with licenses; [ mit asl20 ];
maintainers = with maintainers; [ oxalica ];
platforms = platforms.all;
};
}
|