Change:
Steps to reproduce the behavior: msbuild Trying to build msbuild on a mac fails. <!-- Please @ people who are in the list of the offending package or module. If in doubt, check for whoever last touched something. --Please run and paste the result.

Discussion:
description = ".NET C# and Visual Basic compiler"; homepage = "https://github.com/dotnet/roslyn"; mainProgram = "csc"; <del> platforms = platforms.linux; </del> license = licenses.mit; maintainers = with maintainers; [ corngood ]; };

(fetchNuGet { pname = "Microsoft.AspNetCore.App.Ref"; version = "3.1.10"; sha256 = "0xn4zh7shvijqlr03fqsmps6gz856isd9bg9rk4z2c4599ggal77"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.aspnetcore.app.ref/3.1.10/microsoft.aspnetcore.app.ref.3.1.10.nupkg"; }) (fetchNuGet { pname = "Microsoft.AspNetCore.App.Runtime.linux-arm64"; version = "3.1.32"; sha256 = "00ha2sl4gvqv68mbrsizd6ngqy0vv6vamngzjxr338k1w7a276dx"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.aspnetcore.app.runtime.linux-arm64/3.1.32/microsoft.aspnetcore.app.runtime.linux-arm64.3.1.32.nupkg"; }) (fetchNuGet { pname = "Microsoft.AspNetCore.App.Runtime.linux-x64"; version = "3.1.32"; sha256 = "0ywz63q8vrdp25ix2j9b7h2jp5grc68hqfl64c6lqk26q9xwhp9r"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.aspnetcore.app.runtime.linux-x64/3.1.32/microsoft.aspnetcore.app.runtime.linux-x64.3.1.32.nupkg"; }) <ins> (fetchNuGet { pname = "Microsoft.AspNetCore.App.Runtime.osx-x64"; version = "3.1.32"; sha256 = "1crk54a1wvj76s9gnh46pi7wk8ryympm9xh2jq4s4rpp329fqgic"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.aspnetcore.app.runtime.osx-x64/3.1.32/microsoft.aspnetcore.app.runtime.osx-x64.3.1.32.nupkg"; }) </ins> (fetchNuGet { pname = "Microsoft.Build.Framework"; version = "16.5.0"; sha256 = "1xgr02r7s9i6s70n237hss4yi9zicssia3zd2ny6s8vyxb7jpdyb"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.build.framework/16.5.0/microsoft.build.framework.16.5.0.nupkg"; }) (fetchNuGet { pname = "Microsoft.Build.Tasks.Core"; version = "16.5.0"; sha256 = "08mpdcnjbjpsggfzb3plpmjg1jhx2j4zslm8m2p3icnrpw8swxz4"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.build.tasks.core/16.5.0/microsoft.build.tasks.core.16.5.0.nupkg"; }) (fetchNuGet { pname = "Microsoft.Build.Tasks.Git"; version = "1.2.0-beta-22167-02"; sha256 = "1zb5vhlc9kzqbw22hg84hakhqms0aa7ghy585229hsf278rfh2sy"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/d1622942-d16f-48e5-bc83-96f4539e7601/nuget/v3/flat2/microsoft.build.tasks.git/1.2.0-beta-22167-02/microsoft.build.tasks.git.1.2.0-beta-22167-02.nupkg"; })

(fetchNuGet { pname = "Microsoft.Net.Compilers.Toolset"; version = "4.2.0-1.final"; sha256 = "02zas22hj29gv2w7h74q786i0cvxffgwqai21ri0zj41nb2hwhyq"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.net.compilers.toolset/4.2.0-1.final/microsoft.net.compilers.toolset.4.2.0-1.final.nupkg"; }) (fetchNuGet { pname = "Microsoft.NETCore.App.Host.linux-arm64"; version = "3.1.32"; sha256 = "1zygp70xrk5zggs3q4a6yc6jfdwzcsjjsapqpwn6qyx35m69b72p"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.netcore.app.host.linux-arm64/3.1.32/microsoft.netcore.app.host.linux-arm64.3.1.32.nupkg"; }) (fetchNuGet { pname = "Microsoft.NETCore.App.Host.linux-x64"; version = "3.1.32"; sha256 = "08sar3s7j6z1q5prjmz2jrbsq5ms81mrsi1c1zbfrkplkfjpld3a"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.netcore.app.host.linux-x64/3.1.32/microsoft.netcore.app.host.linux-x64.3.1.32.nupkg"; }) <ins> (fetchNuGet { pname = "Microsoft.NETCore.App.Host.osx-x64"; version = "3.1.32"; sha256 = "186gjn8sbhp4z6pq8fw4g8nqk9dwyaplwvdz2y3fbbvg36lggsh0"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.netcore.app.host.osx-x64/3.1.32/microsoft.netcore.app.host.osx-x64.3.1.32.nupkg"; }) </ins> (fetchNuGet { pname = "Microsoft.NETCore.App.Ref"; version = "3.1.0"; sha256 = "08svsiilx9spvjamcnjswv0dlpdrgryhr3asdz7cvnl914gjzq4y"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.netcore.app.ref/3.1.0/microsoft.netcore.app.ref.3.1.0.nupkg"; }) (fetchNuGet { pname = "Microsoft.NETCore.App.Runtime.linux-arm64"; version = "3.1.32"; sha256 = "13pcn74z1swz73s72zjl07f118j35wacnzgk7kbjqn83nwgqdgvq"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.netcore.app.runtime.linux-arm64/3.1.32/microsoft.netcore.app.runtime.linux-arm64.3.1.32.nupkg"; }) (fetchNuGet { pname = "Microsoft.NETCore.App.Runtime.linux-x64"; version = "3.1.32"; sha256 = "0mmc57dl8plrspdxwb7209wz29vhiwqds4nfbdfws7zg35yy70c7"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.netcore.app.runtime.linux-x64/3.1.32/microsoft.netcore.app.runtime.linux-x64.3.1.32.nupkg"; }) <ins> (fetchNuGet { pname = "Microsoft.NETCore.App.Runtime.osx-x64"; version = "3.1.32"; sha256 = "06bk39zcv27cwshjsxfg5d6wzkkzdhfk08sipdc7mr1s8pk7ihi1"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.netcore.app.runtime.osx-x64/3.1.32/microsoft.netcore.app.runtime.osx-x64.3.1.32.nupkg"; }) </ins> (fetchNuGet { pname = "Microsoft.NETCore.Platforms"; version = "1.0.1"; sha256 = "01al6cfxp68dscl15z7rxfw9zvhm64dncsw09a1vmdkacsa2v6lr"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.netcore.platforms/1.0.1/microsoft.netcore.platforms.1.0.1.nupkg"; }) (fetchNuGet { pname = "Microsoft.NETCore.Platforms"; version = "1.1.0"; sha256 = "08vh1r12g6ykjygq5d3vq09zylgb84l63k49jc4v8faw9g93iqqm"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.netcore.platforms/1.1.0/microsoft.netcore.platforms.1.1.0.nupkg"; }) (fetchNuGet { pname = "Microsoft.NETCore.Platforms"; version = "1.1.1"; sha256 = "164wycgng4mi9zqi2pnsf1pq6gccbqvw6ib916mqizgjmd8f44pj"; url = "https://pkgs.dev.azure.com/dnceng/9ee6d478-d288-47f7-aacc-f6e6d082ae6d/_packaging/45bacae2-5efb-47c8-91e5-8ec20c22b4f8/nuget/v3/flat2/microsoft.netcore.platforms/1.1.1/microsoft.netcore.platforms.1.1.1.nupkg"; })

</configuration> ''; <ins> inherit (stdenv.hostPlatform.extensions) sharedLibrary; </ins> in stdenv.mkDerivation rec {

mv artifacts/msbuild artifacts/mono-msbuild chmod +x artifacts/mono-msbuild/MSBuild.dll <del> ln -s $(find ${dotnet-sdk} -name libhostfxr.so) artifacts/mono-msbuild/SdkResolvers/Microsoft.DotNet.MSBuildSdkResolver/ </del> <ins> # The provided libhostfxr.dylib is for x86_64-darwin, so we remove it rm artifacts/mono-msbuild/SdkResolvers/Microsoft.DotNet.MSBuildSdkResolver/libhostfxr.dylib ln -s $(find ${dotnet-sdk} -name libhostfxr${sharedLibrary}) artifacts/mono-msbuild/SdkResolvers/Microsoft.DotNet.MSBuildSdkResolver/ </ins> # overwrite the file echo "#!${stdenv.shell}" > eng/common/dotnet-install.sh echo "#!${stdenv.shell}" > mono/build/get_sdk_files.sh <ins> # Prevent msbuild from downloading a new libhostfxr echo "#!${stdenv.shell}" > mono/build/extract_and_copy_hostfxr.sh </ins> mkdir -p mono/dotnet-overlay/msbuild-bin cp ${dotnet-sdk}/sdk/*/{Microsoft.NETCoreSdk.BundledVersions.props,RuntimeIdentifierGraph.json} mono/dotnet-overlay/msbuild-bin

--set-default MONO_GC_PARAMS "nursery-size=64m"  --add-flags "$out/lib/mono/msbuild/15.0/bin/MSBuild.dll" <del> ln -s $(find ${dotnet-sdk} -name libhostfxr.so) $out/lib/mono/msbuild/Current/bin/SdkResolvers/Microsoft.DotNet.MSBuildSdkResolver/ </del> <ins> ln -s $(find ${dotnet-sdk} -name libhostfxr${sharedLibrary}) $out/lib/mono/msbuild/Current/bin/SdkResolvers/Microsoft.DotNet.MSBuildSdkResolver/ </ins> ''; doInstallCheck = true;