2019-02-04 02:02:18 +01:00
|
|
|
{ lib, stdenv, fetchurl, vscode-utils, extractNuGet
|
|
|
|
, icu, curl, openssl, lttng-ust, autoPatchelfHook
|
2018-07-07 23:38:11 +02:00
|
|
|
, pythonUseFixed ? false, python # When `true`, the python default setting will be fixed to specified.
|
2017-10-19 03:32:15 +02:00
|
|
|
# Use version from `PATH` for default setting otherwise.
|
|
|
|
# Defaults to `false` as we expect it to be project specific most of the time.
|
2018-07-07 23:38:11 +02:00
|
|
|
, ctagsUseFixed ? true, ctags # When `true`, the ctags default setting will be fixed to specified.
|
2017-10-19 03:32:15 +02:00
|
|
|
# Use version from `PATH` for default setting otherwise.
|
|
|
|
# Defaults to `true` as usually not defined on a per projet basis.
|
|
|
|
}:
|
|
|
|
|
|
|
|
assert pythonUseFixed -> null != python;
|
|
|
|
assert ctagsUseFixed -> null != ctags;
|
|
|
|
|
|
|
|
let
|
|
|
|
pythonDefaultsTo = if pythonUseFixed then "${python}/bin/python" else "python";
|
|
|
|
ctagsDefaultsTo = if ctagsUseFixed then "${ctags}/bin/ctags" else "ctags";
|
|
|
|
|
2019-02-04 02:02:18 +01:00
|
|
|
# The arch tag comes from 'PlatformName' defined here:
|
|
|
|
# https://github.com/Microsoft/vscode-python/blob/master/src/client/activation/types.ts
|
|
|
|
arch =
|
|
|
|
if stdenv.isLinux && stdenv.isx86_64 then "linux-x64"
|
|
|
|
else if stdenv.isDarwin then "osx-x64"
|
|
|
|
else throw "Only x86_64 Linux and Darwin are supported.";
|
|
|
|
|
|
|
|
languageServerSha256 = {
|
2020-01-18 03:47:21 +01:00
|
|
|
linux-x64 = "10qwi8lih5i6216d1vqsmviab73ha0d3zdvircrgrydkf0d4ancd";
|
|
|
|
osx-x64 = "08gjxs0bjhz5a9l35vvgwnvzshsyyqiqvb5hxv6w0k2ajgv5z7av";
|
2019-08-13 23:52:01 +02:00
|
|
|
}.${arch};
|
2019-02-04 02:02:18 +01:00
|
|
|
|
|
|
|
# version is languageServerVersion in the package.json
|
|
|
|
languageServer = extractNuGet rec {
|
|
|
|
name = "Python-Language-Server";
|
2020-01-18 03:47:21 +01:00
|
|
|
version = "0.4.127";
|
2019-02-04 02:02:18 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://pvsc.azureedge.net/python-language-server-stable/${name}-${arch}.${version}.nupkg";
|
|
|
|
sha256 = languageServerSha256;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
in vscode-utils.buildVscodeMarketplaceExtension {
|
2017-10-19 03:32:15 +02:00
|
|
|
mktplcRef = {
|
|
|
|
name = "python";
|
|
|
|
publisher = "ms-python";
|
2020-02-29 02:00:52 +01:00
|
|
|
version = "2020.2.64397";
|
|
|
|
sha256 = "1kwyc5ycz1276i2zbw93mpq59y2py6kj71gvhzya8xvm184jk07a";
|
2017-10-19 03:32:15 +02:00
|
|
|
};
|
|
|
|
|
2019-02-04 02:02:18 +01:00
|
|
|
buildInputs = [
|
|
|
|
icu
|
|
|
|
curl
|
|
|
|
openssl
|
|
|
|
lttng-ust
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
autoPatchelfHook
|
|
|
|
];
|
|
|
|
|
2017-10-19 03:32:15 +02:00
|
|
|
postPatch = ''
|
|
|
|
# Patch `packages.json` so that nix's *python* is used as default value for `python.pythonPath`.
|
|
|
|
substituteInPlace "./package.json" \
|
|
|
|
--replace "\"default\": \"python\"" "\"default\": \"${pythonDefaultsTo}\""
|
|
|
|
|
|
|
|
# Patch `packages.json` so that nix's *ctags* is used as default value for `python.workspaceSymbols.ctagsPath`.
|
|
|
|
substituteInPlace "./package.json" \
|
|
|
|
--replace "\"default\": \"ctags\"" "\"default\": \"${ctagsDefaultsTo}\""
|
|
|
|
'';
|
|
|
|
|
2019-02-04 02:02:18 +01:00
|
|
|
postInstall = ''
|
|
|
|
mkdir -p "$out/$installPrefix/languageServer.${languageServer.version}"
|
|
|
|
cp -R --no-preserve=ownership ${languageServer}/* "$out/$installPrefix/languageServer.${languageServer.version}"
|
|
|
|
chmod -R +wx "$out/$installPrefix/languageServer.${languageServer.version}"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = [ maintainers.jraygauthier ];
|
|
|
|
};
|
2018-04-19 17:41:12 +02:00
|
|
|
}
|