From 9d13605f1c9e3de4864429fead360516f9bbbb56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Sun, 22 Sep 2024 10:57:58 +0200 Subject: [PATCH 1/6] omnisharp-roslyn: format --- .../tools/omnisharp-roslyn/default.nix | 196 ++++++++++-------- 1 file changed, 113 insertions(+), 83 deletions(-) diff --git a/pkgs/development/tools/omnisharp-roslyn/default.nix b/pkgs/development/tools/omnisharp-roslyn/default.nix index bd5102e038a2..dd88a85a8284 100644 --- a/pkgs/development/tools/omnisharp-roslyn/default.nix +++ b/pkgs/development/tools/omnisharp-roslyn/default.nix @@ -1,93 +1,123 @@ -{ buildDotnetModule -, dotnetCorePackages -, fetchFromGitHub -, lib -, stdenv -, runCommand -, expect +{ + buildDotnetModule, + dotnetCorePackages, + fetchFromGitHub, + lib, + stdenv, + runCommand, + expect, }: + let inherit (dotnetCorePackages) sdk_8_0 runtime_6_0; in -let finalPackage = buildDotnetModule rec { - pname = "omnisharp-roslyn"; - version = "1.39.12"; +let + finalPackage = buildDotnetModule rec { + pname = "omnisharp-roslyn"; + version = "1.39.12"; - src = fetchFromGitHub { - owner = "OmniSharp"; - repo = "omnisharp-roslyn"; - rev = "refs/tags/v${version}"; - hash = "sha256-WQIBNqUqvVA0UhSoPdf179X+GYKp4LhPvYeEAet6TnY="; - }; + src = fetchFromGitHub { + owner = "OmniSharp"; + repo = "omnisharp-roslyn"; + rev = "refs/tags/v${version}"; + hash = "sha256-WQIBNqUqvVA0UhSoPdf179X+GYKp4LhPvYeEAet6TnY="; + }; - projectFile = "src/OmniSharp.Stdio.Driver/OmniSharp.Stdio.Driver.csproj"; - nugetDeps = ./deps.nix; + projectFile = "src/OmniSharp.Stdio.Driver/OmniSharp.Stdio.Driver.csproj"; + nugetDeps = ./deps.nix; - dotnet-sdk = with dotnetCorePackages; combinePackages [ sdk_6_0 sdk_8_0 ]; - dotnet-runtime = sdk_8_0; + dotnet-sdk = + with dotnetCorePackages; + combinePackages [ + sdk_6_0 + sdk_8_0 + ]; + dotnet-runtime = sdk_8_0; - dotnetInstallFlags = [ "--framework net6.0" ]; - dotnetBuildFlags = [ "--framework net6.0" "--no-self-contained" ]; - dotnetFlags = [ - # These flags are set by the cake build. - "-property:PackageVersion=${version}" - "-property:AssemblyVersion=${version}.0" - "-property:FileVersion=${version}.0" - "-property:InformationalVersion=${version}" - "-property:RuntimeFrameworkVersion=${runtime_6_0.version}" - "-property:RollForward=LatestMajor" - ]; - - postPatch = '' - # Relax the version requirement - rm global.json - - # Patch the project files so we can compile them properly - 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 - substituteInPlace $project \ - --replace 'win7-x64;win7-x86;win10-arm64' 'linux-x64;linux-arm64;osx-x64;osx-arm64' - done - ''; - - useDotnetFromEnv = true; - executables = [ "OmniSharp" ]; - - passthru.tests = let - with-sdk = sdk: runCommand "with-${if sdk ? version then sdk.version else "no"}-sdk" - { nativeBuildInputs = [ finalPackage sdk expect ]; meta.timeout = 60; } '' - HOME=$TMPDIR - expect <<"EOF" - spawn OmniSharp - expect_before timeout { - send_error "timeout!\n" - exit 1 - } - expect ".NET Core SDK ${if sdk ? version then sdk.version else sdk_8_0.version}" - expect "{\"Event\":\"started\"," - send \x03 - expect eof - catch wait result - exit [lindex $result 3] - EOF - touch $out - ''; - in { - # Make sure we can run OmniSharp with any supported SDK version, as well as without - with-net6-sdk = with-sdk dotnetCorePackages.sdk_6_0; - with-net7-sdk = with-sdk dotnetCorePackages.sdk_7_0; - with-net8-sdk = with-sdk dotnetCorePackages.sdk_8_0; - no-sdk = with-sdk null; - }; - - meta = { - description = "OmniSharp based on roslyn workspaces"; - homepage = "https://github.com/OmniSharp/omnisharp-roslyn"; - sourceProvenance = with lib.sourceTypes; [ - fromSource - binaryNativeCode # dependencies + dotnetInstallFlags = [ "--framework net6.0" ]; + dotnetBuildFlags = [ + "--framework net6.0" + "--no-self-contained" ]; - license = lib.licenses.mit; - maintainers = with lib.maintainers; [ tesq0 ericdallo corngood mdarocha ]; - mainProgram = "OmniSharp"; + dotnetFlags = [ + # These flags are set by the cake build. + "-property:PackageVersion=${version}" + "-property:AssemblyVersion=${version}.0" + "-property:FileVersion=${version}.0" + "-property:InformationalVersion=${version}" + "-property:RuntimeFrameworkVersion=${runtime_6_0.version}" + "-property:RollForward=LatestMajor" + ]; + + postPatch = '' + # Relax the version requirement + rm global.json + + # Patch the project files so we can compile them properly + 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 + substituteInPlace $project \ + --replace 'win7-x64;win7-x86;win10-arm64' 'linux-x64;linux-arm64;osx-x64;osx-arm64' + done + ''; + + useDotnetFromEnv = true; + executables = [ "OmniSharp" ]; + + passthru.tests = + let + with-sdk = + sdk: + runCommand "with-${if sdk ? version then sdk.version else "no"}-sdk" + { + nativeBuildInputs = [ + finalPackage + sdk + expect + ]; + meta.timeout = 60; + } + '' + HOME=$TMPDIR + expect <<"EOF" + spawn OmniSharp + expect_before timeout { + send_error "timeout!\n" + exit 1 + } + expect ".NET Core SDK ${if sdk ? version then sdk.version else sdk_8_0.version}" + expect "{\"Event\":\"started\"," + send \x03 + expect eof + catch wait result + exit [lindex $result 3] + EOF + touch $out + ''; + in + { + # Make sure we can run OmniSharp with any supported SDK version, as well as without + with-net6-sdk = with-sdk dotnetCorePackages.sdk_6_0; + with-net7-sdk = with-sdk dotnetCorePackages.sdk_7_0; + with-net8-sdk = with-sdk dotnetCorePackages.sdk_8_0; + no-sdk = with-sdk null; + }; + + meta = { + description = "OmniSharp based on roslyn workspaces"; + homepage = "https://github.com/OmniSharp/omnisharp-roslyn"; + sourceProvenance = with lib.sourceTypes; [ + fromSource + binaryNativeCode # dependencies + ]; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ + tesq0 + ericdallo + corngood + mdarocha + ]; + mainProgram = "OmniSharp"; + }; }; -}; in finalPackage +in +finalPackage From f9d3af6fce11ee199e65f8fc8c9bbc2945682113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Sun, 22 Sep 2024 11:00:22 +0200 Subject: [PATCH 2/6] omnisharp-roslyn: move to pkgs/by-name --- .../{development/tools => by-name/om}/omnisharp-roslyn/deps.nix | 0 .../default.nix => by-name/om/omnisharp-roslyn/package.nix} | 0 .../tools => by-name/om}/omnisharp-roslyn/updater.sh | 2 +- pkgs/top-level/all-packages.nix | 2 -- 4 files changed, 1 insertion(+), 3 deletions(-) rename pkgs/{development/tools => by-name/om}/omnisharp-roslyn/deps.nix (100%) rename pkgs/{development/tools/omnisharp-roslyn/default.nix => by-name/om/omnisharp-roslyn/package.nix} (100%) rename pkgs/{development/tools => by-name/om}/omnisharp-roslyn/updater.sh (89%) diff --git a/pkgs/development/tools/omnisharp-roslyn/deps.nix b/pkgs/by-name/om/omnisharp-roslyn/deps.nix similarity index 100% rename from pkgs/development/tools/omnisharp-roslyn/deps.nix rename to pkgs/by-name/om/omnisharp-roslyn/deps.nix diff --git a/pkgs/development/tools/omnisharp-roslyn/default.nix b/pkgs/by-name/om/omnisharp-roslyn/package.nix similarity index 100% rename from pkgs/development/tools/omnisharp-roslyn/default.nix rename to pkgs/by-name/om/omnisharp-roslyn/package.nix diff --git a/pkgs/development/tools/omnisharp-roslyn/updater.sh b/pkgs/by-name/om/omnisharp-roslyn/updater.sh similarity index 89% rename from pkgs/development/tools/omnisharp-roslyn/updater.sh rename to pkgs/by-name/om/omnisharp-roslyn/updater.sh index 10868fbd0992..74980c3d57ef 100755 --- a/pkgs/development/tools/omnisharp-roslyn/updater.sh +++ b/pkgs/by-name/om/omnisharp-roslyn/updater.sh @@ -7,7 +7,7 @@ set -euo pipefail cd "$(dirname "${BASH_SOURCE[0]}")" new_version="$(curl -s "https://api.github.com/repos/OmniSharp/omnisharp-roslyn/releases?per_page=1" | jq -r '.[0].name')" -old_version="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)" +old_version="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./package.nix)" if [[ "$new_version" == "$old_version" ]]; then echo "Already up to date!" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 72a2be0f2dff..ec873e088491 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -39018,8 +39018,6 @@ with pkgs; nanoizeNewlib = true; }; - omnisharp-roslyn = callPackage ../development/tools/omnisharp-roslyn { }; - wasmtime = callPackage ../development/interpreters/wasmtime { inherit (darwin.apple_sdk.frameworks) Security; }; From 18542a7bff212cf15815530be088d3f86d5ee4a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Sun, 22 Sep 2024 11:01:07 +0200 Subject: [PATCH 3/6] omnisharp-roslyn: drop test for .NET 7 --- pkgs/by-name/om/omnisharp-roslyn/package.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/pkgs/by-name/om/omnisharp-roslyn/package.nix b/pkgs/by-name/om/omnisharp-roslyn/package.nix index dd88a85a8284..5d3d57080011 100644 --- a/pkgs/by-name/om/omnisharp-roslyn/package.nix +++ b/pkgs/by-name/om/omnisharp-roslyn/package.nix @@ -97,7 +97,6 @@ let { # Make sure we can run OmniSharp with any supported SDK version, as well as without with-net6-sdk = with-sdk dotnetCorePackages.sdk_6_0; - with-net7-sdk = with-sdk dotnetCorePackages.sdk_7_0; with-net8-sdk = with-sdk dotnetCorePackages.sdk_8_0; no-sdk = with-sdk null; }; From ac2f7cf25a11216f157a709f83724ae00220fc2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Sun, 22 Sep 2024 11:05:16 +0200 Subject: [PATCH 4/6] omnisharp-roslyn: set passthru.updateScript --- pkgs/by-name/om/omnisharp-roslyn/package.nix | 2 ++ pkgs/by-name/om/omnisharp-roslyn/{updater.sh => update.sh} | 0 2 files changed, 2 insertions(+) rename pkgs/by-name/om/omnisharp-roslyn/{updater.sh => update.sh} (100%) diff --git a/pkgs/by-name/om/omnisharp-roslyn/package.nix b/pkgs/by-name/om/omnisharp-roslyn/package.nix index 5d3d57080011..098187ce981a 100644 --- a/pkgs/by-name/om/omnisharp-roslyn/package.nix +++ b/pkgs/by-name/om/omnisharp-roslyn/package.nix @@ -101,6 +101,8 @@ let no-sdk = with-sdk null; }; + passthru.updateScript = ./update.sh; + meta = { description = "OmniSharp based on roslyn workspaces"; homepage = "https://github.com/OmniSharp/omnisharp-roslyn"; diff --git a/pkgs/by-name/om/omnisharp-roslyn/updater.sh b/pkgs/by-name/om/omnisharp-roslyn/update.sh similarity index 100% rename from pkgs/by-name/om/omnisharp-roslyn/updater.sh rename to pkgs/by-name/om/omnisharp-roslyn/update.sh From 218f0f9c40d79b059db0762b43d22fa485f7691b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Sun, 22 Sep 2024 11:29:53 +0200 Subject: [PATCH 5/6] omnisharp-roslyn: ignore beta releases for update script --- pkgs/by-name/om/omnisharp-roslyn/update.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/by-name/om/omnisharp-roslyn/update.sh b/pkgs/by-name/om/omnisharp-roslyn/update.sh index 74980c3d57ef..6acb7d7e1a0a 100755 --- a/pkgs/by-name/om/omnisharp-roslyn/update.sh +++ b/pkgs/by-name/om/omnisharp-roslyn/update.sh @@ -6,7 +6,7 @@ set -euo pipefail cd "$(dirname "${BASH_SOURCE[0]}")" -new_version="$(curl -s "https://api.github.com/repos/OmniSharp/omnisharp-roslyn/releases?per_page=1" | jq -r '.[0].name')" +new_version="$(curl -s "https://api.github.com/repos/OmniSharp/omnisharp-roslyn/releases/latest" | jq -r '.name')" old_version="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./package.nix)" if [[ "$new_version" == "$old_version" ]]; then From 1e56561c12fb90d1e861e2cf5547622de6c5ce68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gutyina=20Gerg=C5=91?= Date: Sun, 22 Sep 2024 11:38:49 +0200 Subject: [PATCH 6/6] omnisharp-roslyn: add maintainer gepbird --- pkgs/by-name/om/omnisharp-roslyn/package.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/om/omnisharp-roslyn/package.nix b/pkgs/by-name/om/omnisharp-roslyn/package.nix index 098187ce981a..5ca7c3290eab 100644 --- a/pkgs/by-name/om/omnisharp-roslyn/package.nix +++ b/pkgs/by-name/om/omnisharp-roslyn/package.nix @@ -112,10 +112,11 @@ let ]; license = lib.licenses.mit; maintainers = with lib.maintainers; [ - tesq0 - ericdallo corngood + ericdallo + gepbird mdarocha + tesq0 ]; mainProgram = "OmniSharp"; };