diff options
Diffstat (limited to 'pkgs/development/dotnet-modules/python-language-server/default.nix')
-rw-r--r-- | pkgs/development/dotnet-modules/python-language-server/default.nix | 102 |
1 files changed, 18 insertions, 84 deletions
diff --git a/pkgs/development/dotnet-modules/python-language-server/default.nix b/pkgs/development/dotnet-modules/python-language-server/default.nix index 0af98bbfc07..420475806a0 100644 --- a/pkgs/development/dotnet-modules/python-language-server/default.nix +++ b/pkgs/development/dotnet-modules/python-language-server/default.nix @@ -1,105 +1,39 @@ -{ lib, stdenv +{ lib +, stdenv , fetchFromGitHub -, fetchurl -, makeWrapper -, dotnet-sdk_3 +, buildDotnetModule +, dotnetCorePackages +, autoPatchelfHook , openssl , icu -, patchelf -, Nuget }: -let deps = import ./deps.nix { inherit fetchurl; }; - version = "2021-05-20"; - - # Build the nuget source needed for the later build all by itself - # since it's a time-consuming step that only depends on ./deps.nix. - # This makes it easier to experiment with the main build. - nugetSource = stdenv.mkDerivation { - pname = "python-language-server-nuget-deps"; - inherit version; - - dontUnpack = true; - - nativeBuildInputs = [ Nuget ]; - - buildPhase = '' - export HOME=$(mktemp -d) - - mkdir -p $out/lib - - # disable default-source so nuget does not try to download from online-repo - nuget sources Disable -Name "nuget.org" - # add all dependencies to the source - for package in ${toString deps}; do - nuget add $package -Source $out/lib - done - ''; - - dontInstall = true; - }; - -in - -stdenv.mkDerivation { +buildDotnetModule rec { pname = "python-language-server"; - inherit version; + version = "2021-09-08"; src = fetchFromGitHub { owner = "microsoft"; repo = "python-language-server"; - rev = "86825796eae15d4d46919bc6e32f1197196ba1b3"; - sha256 = "sha256-izDE7Oil9g47Jf3eHPtW5coNixF71t9i0oYSuelakCo="; + rev = "26ea18997f45f7d7bc5a3c5a9efc723a8dbb02fa"; + sha256 = "1m8pf9k20wy4fzv27v3bswvc8s01ag6ka2qm9nn6bgq0s0lq78mh"; }; - buildInputs = [dotnet-sdk_3 openssl icu]; - - nativeBuildInputs = [ - Nuget - makeWrapper - patchelf - ]; + projectFile = "src/LanguageServer/Impl/Microsoft.Python.LanguageServer.csproj"; + nugetDeps = ./deps.nix; - buildPhase = '' - runHook preBuild + dotnet-sdk = dotnetCorePackages.sdk_3_1; + dotnet-runtime = dotnetCorePackages.runtime_3_1; - mkdir home - export HOME=$(mktemp -d) - export DOTNET_CLI_TELEMETRY_OPTOUT=1 - export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 - - pushd src - nuget sources Disable -Name "nuget.org" - dotnet restore --source ${nugetSource}/lib -r linux-x64 - popd - - pushd src/LanguageServer/Impl - dotnet publish --no-restore -c Release -r linux-x64 - popd - - runHook postBuild - ''; - - installPhase = '' - runHook preInstall - - mkdir -p $out - cp -r output/bin/Release/linux-x64/publish $out/lib - - mkdir $out/bin - makeWrapper $out/lib/Microsoft.Python.LanguageServer $out/bin/python-language-server - - runHook postInstall - ''; + nativeBuildInputs = [ autoPatchelfHook ]; + buildInputs = [ stdenv.cc.cc.lib ]; + runtimeDeps = [ openssl icu ]; postFixup = '' - patchelf --set-rpath ${icu}/lib $out/lib/System.Globalization.Native.so - patchelf --set-rpath ${openssl.out}/lib $out/lib/System.Security.Cryptography.Native.OpenSsl.so + mv $out/bin/Microsoft.Python.LanguageServer $out/bin/python-language-server ''; - # If we don't disable stripping, the executable fails to start with an error about being unable - # to find some of the packaged DLLs. - dontStrip = true; + passthru.updateScript = ./updater.sh; meta = with lib; { description = "Microsoft Language Server for Python"; |