omnisharp-roslyn: use usedotnetFromEnv instead of overriding fixup phase

This commit is contained in:
mdarocha 2023-06-20 17:19:30 +02:00
parent abf6081bc2
commit 6b84101c47

View File

@ -23,7 +23,8 @@ let finalPackage = buildDotnetModule rec {
projectFile = "src/OmniSharp.Stdio.Driver/OmniSharp.Stdio.Driver.csproj";
nugetDeps = ./deps.nix;
useAppHost = false;
dotnet-sdk = sdk_6_0;
dotnet-runtime = sdk_6_0;
dotnetInstallFlags = [ "--framework net6.0" ];
dotnetBuildFlags = [ "--framework net6.0" "--no-self-contained" ];
@ -48,24 +49,8 @@ let finalPackage = buildDotnetModule rec {
done
'';
dontDotnetFixup = true; # we'll fix it ourselves
preFixup = ''
# We create a wrapper that will run the OmniSharp dll using the `dotnet`
# executable from PATH. Doing it this way allows it to run using newer SDK
# versions than it was build with, which allows it to properly find those SDK
# versions - OmniSharp only finds SDKs with the same version or newer as
# itself. We still provide a fallback, in case no `dotnet` is provided in
# PATH
mkdir -p "$out/bin"
cat << EOF > "$out/bin/OmniSharp"
#!${stdenv.shell}
export PATH="\''${PATH}:${sdk_6_0}/bin"
dotnet "$out/lib/omnisharp-roslyn/OmniSharp.dll" "\$@"
EOF
chmod +x "$out/bin/OmniSharp"
'';
useDotnetFromEnv = true;
executables = [ "OmniSharp" ];
passthru.tests = let
with-sdk = sdk: runCommand "with-${if sdk ? version then sdk.version else "no"}-sdk"