Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 fetchFromGitHub,
4 mono,
5 buildDotnetModule,
6 dotnetCorePackages,
7 unzip,
8}:
9
10buildDotnetModule rec {
11 pname = "roslyn";
12 version = "4.2.0";
13
14 src = fetchFromGitHub {
15 owner = "dotnet";
16 repo = "roslyn";
17 rev = "v${version}";
18 hash = "sha256-4iXabFp0LqJ8TXOrqeD+oTAocg6ZTIfijfX3s3fMJuI=";
19 };
20
21 dotnet-sdk = dotnetCorePackages.sdk_6_0-bin;
22
23 projectFile = [
24 "src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj"
25 ];
26
27 nugetDeps = ./deps.json;
28
29 dontDotnetFixup = true;
30
31 nativeBuildInputs = [ unzip ];
32
33 postPatch = ''
34 sed -i 's/latestPatch/latestFeature/' global.json
35 '';
36
37 buildPhase = ''
38 runHook preBuild
39
40 dotnet msbuild -v:m -t:pack \
41 -p:Configuration=Release \
42 -p:RepositoryUrl="${meta.homepage}" \
43 -p:RepositoryCommit="v${version}" \
44 src/NuGet/Microsoft.Net.Compilers.Toolset/Microsoft.Net.Compilers.Toolset.Package.csproj
45
46 runHook postBuild
47 '';
48
49 installPhase = ''
50 pkg="$out/lib/dotnet/microsoft.net.compilers.toolset/${version}"
51 mkdir -p "$out/bin" "$pkg"
52
53 unzip -q artifacts/packages/Release/Shipping/Microsoft.Net.Compilers.Toolset.${version}-dev.nupkg \
54 -d "$pkg"
55 # nupkg has 0 permissions for a bunch of things
56 chmod -R +rw "$pkg"
57
58 makeWrapper ${mono}/bin/mono $out/bin/csc \
59 --add-flags "$pkg/tasks/net472/csc.exe"
60 makeWrapper ${mono}/bin/mono $out/bin/vbc \
61 --add-flags "$pkg/tasks/net472/vbc.exe"
62 '';
63
64 meta = with lib; {
65 description = ".NET C# and Visual Basic compiler";
66 homepage = "https://github.com/dotnet/roslyn";
67 mainProgram = "csc";
68 license = licenses.mit;
69 maintainers = with maintainers; [ corngood ];
70 };
71}