Skip to content

Instantly share code, notes, and snippets.

@sdorminey
Created January 13, 2019 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdorminey/388d422708357975cc91a5f662fa173b to your computer and use it in GitHub Desktop.
Save sdorminey/388d422708357975cc91a5f662fa173b to your computer and use it in GitHub Desktop.
PR fails (bundling language with Python VS Code extension.)
{ lib, stdenv, fetchurl, unzip, vscode-utils
, pythonUseFixed ? false, python # When `true`, the python default setting will be fixed to specified.
# Use version from `PATH` for default setting otherwise.
# Defaults to `false` as we expect it to be project specific most of the time.
, ctagsUseFixed ? true, ctags # When `true`, the ctags default setting will be fixed to specified.
# 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";
# FIXME: Hardcoded architecture tag to be linux-x64. Need to derive this from stdenv.targetPlatform.
archTag = "linux-x64";
extractNuGet = { name, version, src, ... }:
stdenv.mkDerivation {
inherit name version src;
buildInputs = [ unzip ];
dontBuild = true;
unpackPhase = "unzip $src";
installPhase = ''
mkdir -p "$out"
chmod -R +w .
find . -mindepth 1 -maxdepth 1 | xargs cp -a -t "$out"
'';
};
languageServer = extractNuGet rec {
name="Python-Language-Server";
version = "0.1.75";
src = fetchurl {
url = "https://pvsc.azureedge.net/python-language-server-stable/${name}-${archTag}.${version}.nupkg";
sha256 = "c15937eb9e81538971794bced4d58041381d26724dc05a72b76bd7c25db5ebd5";
};
};
in
vscode-utils.buildVscodeMarketplaceExtension {
mktplcRef = {
name = "python";
publisher = "ms-python";
version = "2018.12.1";
sha256 = "1cf3yll2hfililcwq6avscgi35caccv8m8fdsvzqdfrggn5h41h4";
};
buildInputs = [ languageServer ];
postPatch = ''
mkdir -p "languageServer.${languageServer.version}"
cp -R ${languageServer}/* "languageServer.${languageServer.version}"
chmod +w "languageServer.${languageServer.version}"
# 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}\""
'';
meta = with lib; {
license = licenses.mit;
maintainers = [ maintainers.jraygauthier ];
};
}
builder for '/nix/store/401qbgsa1cyjnxln2h9qr4rnksab94xs-vscode-extension-ms-python-python-2018.12.1.drv' failed with exit code 123; last 10 log lines:
mv: cannot remove './languageServer.0.1.75/Typeshed/stdlib/2/exceptions.pyi': Permission denied
mv: cannot remove './languageServer.0.1.75/Typeshed/stdlib/2/future_builtins.pyi': Permission denied
mv: cannot remove './languageServer.0.1.75/Typeshed/stdlib/2/sre_parse.pyi': Permission denied
mv: cannot remove './languageServer.0.1.75/Typeshed/stdlib/2/builtins.pyi': Permission denied
mv: cannot remove './languageServer.0.1.75/Typeshed/stdlib/2/gettext.pyi': Permission denied
mv: cannot remove './languageServer.0.1.75/Typeshed/stdlib/2/io.pyi': Permission denied
mv: cannot remove './languageServer.0.1.75/Typeshed/stdlib/2/_hotshot.pyi': Permission denied
mv: cannot remove './languageServer.0.1.75/ja/StreamJsonRpc.resources.dll': Permission denied
mv: cannot remove './languageServer.0.1.75/ja/Microsoft.VisualStudio.Validation.resources.dll': Permission denied
mv: cannot remove './languageServer.0.1.75/ja/Microsoft.VisualStudio.Threading.resources.dll': Permission denied
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment