2022-11-25 02:11:28 +00:00
|
|
|
{ lib
|
2021-03-25 17:19:46 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, mono
|
2022-11-25 02:11:28 +00:00
|
|
|
, buildDotnetModule
|
|
|
|
, dotnetCorePackages
|
2021-03-25 17:19:46 +00:00
|
|
|
, unzip
|
|
|
|
}:
|
|
|
|
|
2022-11-25 02:46:37 +00:00
|
|
|
buildDotnetModule rec {
|
2021-03-25 17:19:46 +00:00
|
|
|
pname = "roslyn";
|
2022-11-25 02:46:37 +00:00
|
|
|
version = "4.2.0";
|
2021-03-25 17:19:46 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "dotnet";
|
|
|
|
repo = "roslyn";
|
|
|
|
rev = "v${version}";
|
2022-11-25 02:46:37 +00:00
|
|
|
hash = "sha256-4iXabFp0LqJ8TXOrqeD+oTAocg6ZTIfijfX3s3fMJuI=";
|
2021-03-25 17:19:46 +00:00
|
|
|
};
|
|
|
|
|
2022-11-25 02:46:37 +00:00
|
|
|
dotnet-sdk = dotnetCorePackages.sdk_6_0;
|
2022-11-25 02:11:28 +00:00
|
|
|
|
|
|
|
projectFile = [ "src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj" ];
|
|
|
|
|
2023-06-24 15:57:50 +00:00
|
|
|
nugetDeps = ./deps.nix;
|
2022-11-25 02:11:28 +00:00
|
|
|
|
|
|
|
dontDotnetFixup = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ unzip ];
|
2021-03-25 17:19:46 +00:00
|
|
|
|
2022-11-25 02:46:37 +00:00
|
|
|
postPatch = ''
|
|
|
|
sed -i 's/latestPatch/latestFeature/' global.json
|
|
|
|
'';
|
|
|
|
|
2021-03-25 17:19:46 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
2022-11-25 02:11:28 +00:00
|
|
|
dotnet msbuild -v:m -t:pack \
|
2021-03-25 17:19:46 +00:00
|
|
|
-p:Configuration=Release \
|
|
|
|
-p:RepositoryUrl="${meta.homepage}" \
|
|
|
|
-p:RepositoryCommit="v${version}" \
|
|
|
|
src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
2022-11-25 02:46:37 +00:00
|
|
|
pkg="$out/lib/dotnet/microsoft.net.compilers.toolset/${version}"
|
2022-11-25 02:11:28 +00:00
|
|
|
mkdir -p "$out/bin" "$pkg"
|
|
|
|
|
2022-11-25 02:46:37 +00:00
|
|
|
unzip -q artifacts/packages/Release/Shipping/Microsoft.Net.Compilers.Toolset.${version}-dev.nupkg \
|
2022-11-25 02:11:28 +00:00
|
|
|
-d "$pkg"
|
2021-03-25 17:19:46 +00:00
|
|
|
# nupkg has 0 permissions for a bunch of things
|
2022-11-25 02:11:28 +00:00
|
|
|
chmod -R +rw "$pkg"
|
2021-03-25 17:19:46 +00:00
|
|
|
|
|
|
|
makeWrapper ${mono}/bin/mono $out/bin/csc \
|
|
|
|
--add-flags "$pkg/tasks/net472/csc.exe"
|
2022-11-25 02:11:28 +00:00
|
|
|
makeWrapper ${mono}/bin/mono $out/bin/vbc \
|
|
|
|
--add-flags "$pkg/tasks/net472/vbc.exe"
|
2021-03-25 17:19:46 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = ".NET C# and Visual Basic compiler";
|
|
|
|
homepage = "https://github.com/dotnet/roslyn";
|
2022-11-25 02:46:37 +00:00
|
|
|
mainProgram = "csc";
|
2021-03-25 17:19:46 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ corngood ];
|
|
|
|
};
|
|
|
|
}
|