Open lostmsu opened 3 days ago
Hi, Avalonia depends on some libs.
You can use nix develop
command with flake.nix like this:
{
description = "A Nix-flake-based C# development environment";
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";
outputs = {
self,
nixpkgs,
}: let
supportedSystems = ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"];
forEachSupportedSystem = f:
nixpkgs.lib.genAttrs supportedSystems (system:
f {
pkgs = import nixpkgs {inherit system;};
});
in {
devShells = forEachSupportedSystem ({pkgs}: {
default = pkgs.mkShell {
packages = with pkgs; [
#dotnet-sdk_6
#dotnet-sdk_7
#dotnet-sdk_8
(with dotnetCorePackages;
combinePackages [
sdk_6_0
sdk_7_0
sdk_8_0
])
omnisharp-roslyn
mono
msbuild
(pkgs.buildFHSEnv {
name = "avalonia-fhs-shell";
targetPkgs = pkgs:
with pkgs;
[
udev
alsa-lib
fontconfig
glew
]
++ (with pkgs.xorg; [
# Avalonia UI
libX11
libICE
libSM
libXi
libXcursor
libXext
libXrandr
]);
#runScript = "zsh"; # same colors scheme of zsh confusing me
})
];
};
});
};
}
then enter shell:
avalonia-fhs-shell
then run:
dotnet run
There also ILSpy.Avalonia package in nixpkgs See: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/applications/misc/avalonia-ilspy/default.nix#L51
Upd. And even Avalonia 11 o_O https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/av/avalonia/package.nix
Or if You don't use flakes, then create file shell.nix:
{ pkgs ? import <nixpkgs> {} }:
(pkgs.buildFHSEnv {
name = "simple-x11-env";
targetPkgs = pkgs: (with pkgs; [
udev
alsa-lib
fontconfig
glew
]) ++ (with pkgs.xorg; [
# Avalonia UI
libX11
libICE
libSM
libXi
libXcursor
libXext
libXrandr
]);
multiPkgs = pkgs: (with pkgs; [
udev
alsa-lib
]);
runScript = "bash";
}).env
then run nix-shell shell.nix
before dotnet-run
Describe the bug
The app fails to start with
Steps To Reproduce
Steps to reproduce the behavior:
dotnetCorePackages.sdk_8_0
dotnet new install "Avalonia.Templates"
dotnet new avalonia.app -o MyApp
MyApp/
dodotnet run
Expected behavior
The app should start
Additional context
The default template pulls SkiaSharp.NativeAssets.Linux package, which has
libSkiaSharp.so
. It ends up inbin/Debug/net8.0/runtimes/linux-x64/native/libSkiaSharp.so
, but can not be loaded.Not quite sure what exactly is going on, as installing
fontconfig
NixOS package did not resolve the error at the top (libfontconfig.so.1: cannot open shared object file: No such file or directory). I suspect for a descent experience all native dependencies from NuGet need to be patched on download (might break building for other Linuxes) or on build (whenbin/Debug
is created).EXTRA: the issue also reproduces with
dotnet publish
followed bydotnet MyApp.dll
frompublish/
output directory.Notify maintainers
@kuznero @mdarocha
Metadata
Add a :+1: reaction to issues you find important.