10 inherit (dotnetCorePackages) sdk_6_0 runtime_6_0;
12 let finalPackage = buildDotnetModule rec {
13 pname = "omnisharp-roslyn";
16 src = fetchFromGitHub {
20 hash = "sha256-3RjRFc+keNLazUS5nLG1ZE7SfVCWoQDti2CCnnSPPQ0=";
23 projectFile = "src/OmniSharp.Stdio.Driver/OmniSharp.Stdio.Driver.csproj";
24 nugetDeps = ./deps.nix;
27 dotnet-runtime = sdk_6_0;
29 dotnetInstallFlags = [ "--framework net6.0" ];
30 dotnetBuildFlags = [ "--framework net6.0" "--no-self-contained" ];
32 # These flags are set by the cake build.
33 "-property:PackageVersion=${version}"
34 "-property:AssemblyVersion=${version}.0"
35 "-property:FileVersion=${version}.0"
36 "-property:InformationalVersion=${version}"
37 "-property:RuntimeFrameworkVersion=${runtime_6_0.version}"
38 "-property:RollForward=LatestMajor"
42 # Relax the version requirement
45 # Patch the project files so we can compile them properly
46 for project in src/OmniSharp.Http.Driver/OmniSharp.Http.Driver.csproj src/OmniSharp.LanguageServerProtocol/OmniSharp.LanguageServerProtocol.csproj src/OmniSharp.Stdio.Driver/OmniSharp.Stdio.Driver.csproj; do
47 substituteInPlace $project \
48 --replace '<RuntimeIdentifiers>win7-x64;win7-x86;win10-arm64</RuntimeIdentifiers>' '<RuntimeIdentifiers>linux-x64;linux-arm64;osx-x64;osx-arm64</RuntimeIdentifiers>'
52 useDotnetFromEnv = true;
53 executables = [ "OmniSharp" ];
56 with-sdk = sdk: runCommand "with-${if sdk ? version then sdk.version else "no"}-sdk"
57 { nativeBuildInputs = [ finalPackage sdk expect ]; meta.timeout = 60; } ''
61 expect_before timeout {
62 send_error "timeout!\n"
65 expect ".NET Core SDK ${if sdk ? version then sdk.version else sdk_6_0.version}"
66 expect "{\"Event\":\"started\","
70 exit [lindex $result 3]
75 # Make sure we can run OmniSharp with any supported SDK version, as well as without
76 with-net6-sdk = with-sdk sdk_6_0;
77 with-net7-sdk = with-sdk dotnetCorePackages.sdk_7_0;
78 no-sdk = with-sdk null;
82 description = "OmniSharp based on roslyn workspaces";
83 homepage = "https://github.com/OmniSharp/omnisharp-roslyn";
84 sourceProvenance = with sourceTypes; [
86 binaryNativeCode # dependencies
88 license = licenses.mit;
89 maintainers = with maintainers; [ tesq0 ericdallo corngood mdarocha ];
90 mainProgram = "OmniSharp";