vscode-extensions.rust-analyzer: init at unstable-2020-03-09
This commit is contained in:
parent
3ea54e6972
commit
b0a4ce1689
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p curl jq nix-prefetch-github
|
||||
#!nix-shell -i bash -p curl jq nix-prefetch-github nodePackages.node2nix
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
owner=rust-analyzer
|
||||
@ -37,3 +37,26 @@ echo "cargoSha256: $cargo_sha256"
|
||||
sed "s/cargoSha256 = \".*\"/cargoSha256 = \"$cargo_sha256\"/" \
|
||||
--in-place ./default.nix
|
||||
|
||||
# Update vscode extension
|
||||
|
||||
echo "Generating node lock"
|
||||
node_src="$(nix-build "$nixpkgs" -A rust-analyzer.src --no-out-link)/editors/code"
|
||||
pushd "$nixpkgs/pkgs/misc/vscode-extensions/rust-analyzer"
|
||||
ext_version=$(jq '.version' "$node_src/package.json" --raw-output)
|
||||
ext_publisher=$(jq '.publisher' "$node_src/package.json" --raw-output)
|
||||
echo "Extension version: $ext_version"
|
||||
[[ "$ext_publisher" == "matklad" ]]
|
||||
node2nix \
|
||||
--nodejs-12 \
|
||||
--development \
|
||||
--input "$node_src/package.json" \
|
||||
--lock "$node_src/package-lock.json" \
|
||||
--output ./node-packages.nix \
|
||||
--composition ./node-composition.nix \
|
||||
--no-copy-node-env \
|
||||
--node-env ../../../development/node-packages/node-env.nix
|
||||
sed -e 's_^.*src = [./]*/nix/store.*__g' \
|
||||
--in-place ./node-packages.nix
|
||||
sed -e "s/version = \".*\"/version = \"$ext_version\"/" \
|
||||
--in-place ./default.nix
|
||||
popd
|
||||
|
@ -140,6 +140,8 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
matklad.rust-analyzer = callPackage ./rust-analyzer {};
|
||||
|
||||
scala-lang.scala = buildVscodeMarketplaceExtension {
|
||||
mktplcRef = {
|
||||
name = "scala";
|
||||
|
50
pkgs/misc/vscode-extensions/rust-analyzer/default.nix
Normal file
50
pkgs/misc/vscode-extensions/rust-analyzer/default.nix
Normal file
@ -0,0 +1,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;
|
||||
};
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
# This file has been generated by node2nix 1.7.0. Do not edit!
|
||||
|
||||
{pkgs ? import <nixpkgs> {
|
||||
inherit system;
|
||||
}, system ? builtins.currentSystem, nodejs ? pkgs."nodejs-12_x"}:
|
||||
|
||||
let
|
||||
nodeEnv = import ../../../development/node-packages/node-env.nix {
|
||||
inherit (pkgs) stdenv python2 utillinux runCommand writeTextFile;
|
||||
inherit nodejs;
|
||||
libtool = if pkgs.stdenv.isDarwin then pkgs.darwin.cctools else null;
|
||||
};
|
||||
in
|
||||
import ./node-packages.nix {
|
||||
inherit (pkgs) fetchurl fetchgit;
|
||||
inherit nodeEnv;
|
||||
}
|
2157
pkgs/misc/vscode-extensions/rust-analyzer/node-packages.nix
generated
Normal file
2157
pkgs/misc/vscode-extensions/rust-analyzer/node-packages.nix
generated
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user