2024-02-19 20:01:35 +00:00
|
|
|
{ lib, fetchFromGitHub, buildDotnetModule, dotnetCorePackages, stdenvNoCC, testers, roslyn-ls, jq }:
|
2024-02-01 21:23:35 +00:00
|
|
|
let
|
|
|
|
pname = "roslyn-ls";
|
2024-06-09 09:08:17 +00:00
|
|
|
dotnet-sdk = dotnetCorePackages.sdk_9_0;
|
2024-02-01 21:23:35 +00:00
|
|
|
# need sdk on runtime as well
|
2024-06-09 09:08:17 +00:00
|
|
|
dotnet-runtime = dotnet-sdk;
|
2024-02-01 21:23:35 +00:00
|
|
|
|
|
|
|
project = "Microsoft.CodeAnalysis.LanguageServer";
|
|
|
|
in
|
|
|
|
buildDotnetModule rec {
|
|
|
|
inherit pname dotnet-sdk dotnet-runtime;
|
|
|
|
|
2024-06-09 09:08:17 +00:00
|
|
|
vsVersion = "2.39.29";
|
2024-02-01 21:23:35 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "dotnet";
|
|
|
|
repo = "roslyn";
|
|
|
|
rev = "VSCode-CSharp-${vsVersion}";
|
2024-06-09 09:08:17 +00:00
|
|
|
hash = "sha256-E0gha6jZnXyRVH5XUuXxa7H9+2lfD9XTlQcNSiQycHA=";
|
2024-02-01 21:23:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# versioned independently from vscode-csharp
|
|
|
|
# "roslyn" in here:
|
|
|
|
# https://github.com/dotnet/vscode-csharp/blob/main/package.json
|
2024-06-09 09:08:17 +00:00
|
|
|
version = "4.12.0-1.24359.11";
|
|
|
|
projectFile = "src/LanguageServer/${project}/${project}.csproj";
|
2024-02-01 21:23:35 +00:00
|
|
|
useDotnetFromEnv = true;
|
|
|
|
nugetDeps = ./deps.nix;
|
|
|
|
|
2024-02-19 20:01:35 +00:00
|
|
|
nativeBuildInputs = [ jq ];
|
|
|
|
|
2024-02-01 21:23:35 +00:00
|
|
|
postPatch = ''
|
2024-02-19 20:01:35 +00:00
|
|
|
# Upstream uses rollForward = latestPatch, which pins to an *exact* .NET SDK version.
|
|
|
|
jq '.sdk.rollForward = "latestMinor"' < global.json > global.json.tmp
|
|
|
|
mv global.json.tmp global.json
|
|
|
|
|
2024-02-01 21:23:35 +00:00
|
|
|
substituteInPlace $projectFile \
|
|
|
|
--replace-fail \
|
2024-06-09 09:08:17 +00:00
|
|
|
'>win-x64;win-arm64;linux-x64;linux-arm64;linux-musl-x64;linux-musl-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>' \
|
2024-03-08 09:28:53 +00:00
|
|
|
'>linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>'
|
2024-02-01 21:23:35 +00:00
|
|
|
'';
|
|
|
|
|
2024-03-30 16:22:20 +00:00
|
|
|
dotnetFlags = [
|
|
|
|
# this removes the Microsoft.WindowsDesktop.App.Ref dependency
|
|
|
|
"-p:EnableWindowsTargeting=false"
|
2024-06-09 09:08:17 +00:00
|
|
|
# see this comment: https://github.com/NixOS/nixpkgs/pull/318497#issuecomment-2256096471
|
|
|
|
# we can remove below line after https://github.com/dotnet/roslyn/issues/73439 is fixed
|
|
|
|
"-p:UsingToolMicrosoftNetCompilers=false"
|
2024-03-30 16:22:20 +00:00
|
|
|
];
|
|
|
|
|
2024-02-01 21:23:35 +00:00
|
|
|
# two problems solved here:
|
|
|
|
# 1. --no-build removed -> BuildHost project within roslyn is running Build target during publish
|
|
|
|
# 2. missing crossgen2 7.* in local nuget directory when PublishReadyToRun=true
|
|
|
|
# the latter should be fixable here but unsure how
|
|
|
|
installPhase =
|
|
|
|
let
|
|
|
|
rid = dotnetCorePackages.systemToDotnetRid stdenvNoCC.targetPlatform.system;
|
|
|
|
in
|
|
|
|
''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
env dotnet publish $projectFile \
|
|
|
|
-p:ContinuousIntegrationBuild=true \
|
|
|
|
-p:Deterministic=true \
|
|
|
|
-p:InformationalVersion=$version \
|
|
|
|
-p:UseAppHost=true \
|
|
|
|
-p:PublishTrimmed=false \
|
|
|
|
-p:PublishReadyToRun=false \
|
|
|
|
--configuration Release \
|
|
|
|
--no-self-contained \
|
|
|
|
--output "$out/lib/$pname" \
|
2024-03-30 16:22:20 +00:00
|
|
|
--runtime ${rid} \
|
|
|
|
''${dotnetInstallFlags[@]} \
|
|
|
|
''${dotnetFlags[@]}
|
2024-02-01 21:23:35 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
tests.version = testers.testVersion { package = roslyn-ls; };
|
|
|
|
updateScript = ./update.sh;
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
homepage = "https://github.com/dotnet/vscode-csharp";
|
|
|
|
description = "Language server behind C# Dev Kit for Visual Studio Code";
|
|
|
|
changelog = "https://github.com/dotnet/vscode-csharp/releases/tag/v${vsVersion}";
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = with lib.maintainers; [ konradmalik ];
|
|
|
|
mainProgram = "Microsoft.CodeAnalysis.LanguageServer";
|
|
|
|
};
|
|
|
|
}
|