24 inherit (dotnetCorePackages) systemToDotnetRid;
27 with dotnetCorePackages;
33 npmDepsFile = ./npm-deps.nix;
36 stdenvNoCC.mkDerivation (
38 dotnetCorePackages.addNuGetDeps
40 nugetDeps = ./deps.nix;
41 overrideFetchAttrs = old: rec {
42 runtimeIds = map (system: dotnetCorePackages.systemToDotnetRid system) old.meta.platforms;
45 ++ lib.concatLists (lib.attrValues (lib.getAttrs runtimeIds dotnet-sdk.targetPackages));
52 src = fetchFromGitHub {
56 fetchSubmodules = true;
57 hash = "sha256-Du8DEsZKl7rnVH9YZKAWTCpEQ/5HrNlgacgK/46kx/o=";
61 # Fix failing tests that use unicode.org
62 ./0001-use-files-for-unicode-character-database.patch
63 # [ERR] Compile: [...]/Microsoft.NET.Sdk.targets(148,5): error MSB4018: The "GenerateDepsFile" task failed unexpectedly. [/build/source/src/tools/DevAnalyzers/DevAnalyzers.csproj]
64 # [ERR] Compile: [...]/Microsoft.NET.Sdk.targets(148,5): error MSB4018: System.IO.IOException: The process cannot access the file '/build/source/src/tools/DevAnalyzers/bin/Release/netstandard2.0/DevAnalyzers.deps.json' because it is being used by another process. [/build/source/src/tools/DevAnalyzers/DevAnalyzers.csproj]
65 ./0002-disable-parallel-compile.patch
68 # this needs to be match the version being patched above
69 UNICODE_CHARACTER_DATABASE = fetchzip {
70 url = "https://www.unicode.org/Public/15.0.0/ucd/UCD.zip";
71 hash = "sha256-jj6bX46VcnH7vpc9GwM9gArG+hSPbOGL6E4SaVd0s60=";
77 patchShebangs build.sh
79 substituteInPlace src/Avalonia.X11/ICELib.cs \
80 --replace-fail '"libICE.so.6"' '"${lib.getLib libICE}/lib/libICE.so.6"'
81 substituteInPlace src/Avalonia.X11/SMLib.cs \
82 --replace-fail '"libSM.so.6"' '"${lib.getLib libSM}/lib/libSM.so.6"'
83 substituteInPlace src/Avalonia.X11/XLib.cs \
84 --replace-fail '"libX11.so.6"' '"${lib.getLib libX11}/lib/libX11.so.6"' \
85 --replace-fail '"libXrandr.so.2"' '"${lib.getLib libXrandr}/lib/libXrandr.so.2"' \
86 --replace-fail '"libXext.so.6"' '"${lib.getLib libXext}/lib/libXext.so.6"' \
87 --replace-fail '"libXi.so.6"' '"${lib.getLib libXi}/lib/libXi.so.6"' \
88 --replace-fail '"libXcursor.so.1"' '"${lib.getLib libXcursor}/lib/libXcursor.so.1"'
90 # from RestoreAdditionalProjectSources, which isn't supported by nuget-to-nix
91 dotnet nuget add source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet8-transport/nuget/v3/index.json
93 # Tricky way to run npmConfigHook multiple times (borrowed from pagefind)
95 local postPatchHooks=() # written to by npmConfigHook
96 source ${npmHooks.npmConfigHook}/nix-support/setup-hook
99 # TODO: implement updateScript
100 lib.concatMapStrings (
103 deps = fetchNpmDeps {
104 src = "${src}/${path}";
109 npmRoot=${path} npmDeps="${deps}" npmConfigHook
110 rm -rf "$TMPDIR/cache"
112 ) (import npmDepsFile)
115 # Avalonia.Native is normally only packed on darwin.
116 substituteInPlace src/Avalonia.Native/Avalonia.Native.csproj \
118 '<IsPackable>$(PackAvaloniaNative)</IsPackable>' \
119 '<IsPackable>true</IsPackable>'
122 makeCacheWritable = true;
124 # CSC : error CS1566: Error reading resource 'pdbstr.exe' -- 'Could not find a part of the path '/build/.nuget-temp/packages/sourcelink/1.1.0/tools/pdbstr.exe'.' [/build/source/nukebuild/_build.csproj]
125 linkNugetPackages = true;
127 # [WRN] Could not inject value for Build.ApiCompatTool
128 # System.Exception: Missing package reference/download.
129 # Run one of the following commands:
130 # ---> System.ArgumentException: Could not find package 'Microsoft.DotNet.ApiCompat.Tool' using:
131 # - Project assets file '/build/source/nukebuild/obj/project.assets.json'
132 # - NuGet packages config '/build/source/nukebuild/_build.csproj'
133 makeEmptyNupkgInPackages = true;
137 fc = makeFontsConf { fontDirectories = [ liberation_ttf ]; };
139 runCommand "fonts.conf" { } ''
140 substitute ${fc} $out \
141 --replace-fail "/etc/" "${fontconfig.out}/etc/"
145 # closed source (telemetry?) https://github.com/AvaloniaUI/Avalonia/discussions/16878
146 dotnet remove packages/Avalonia/Avalonia.csproj package Avalonia.BuildServices
149 runtimeIds = [ (systemToDotnetRid stdenvNoCC.hostPlatform.system) ];
153 for project in nukebuild/_build.csproj dirs.proj; do
154 for rid in $runtimeIds; do
155 dotnet restore --runtime "$rid" "$project"
158 runHook postConfigure
161 nativeBuildInputs = [
165 buildInputs = dotnet-sdk.packages;
167 buildTarget = "Package";
171 # ValidateApiDiff requires a network connection
172 ./build.sh --target $buildTarget --verbosity Verbose --skip ValidateApiDiff
178 mkdir -p "$out/share/nuget/source"
179 cp artifacts/nuget/* "$out/share/nuget/source"
184 updateScript = ./update.bash;
189 homepage = "https://avaloniaui.net/";
190 license = [ lib.licenses.mit ];
191 maintainers = with lib.maintainers; [ corngood ];
192 description = "A cross-platform UI framework for dotnet";
193 sourceProvenance = with lib.sourceTypes; [
195 binaryNativeCode # npm dependencies contain binaries
197 platforms = dotnet-sdk.meta.platforms;
198 broken = stdenvNoCC.hostPlatform.isDarwin;