Closed mdarocha closed 1 year ago
cc @IvarWithoutBones for point 1
I've implement a basic fix for buildDotnetModule
in https://github.com/NixOS/nixpkgs/pull/233422. This should be enough to build most packages that require this.
Heya @mdarocha @GGG-KILLER 👋. I saw this issue was referenced in a fixme introduced in #187133. Is this something that can now be cleaned up?
Yeah, I think the comment can be removed
(...The note was removed in https://github.com/NixOS/nixpkgs/commit/ab466279f2f85293341206aa37b70ce541ce0f17.)
But point 2) of the OP (dotnet
from profile or mkShell
, no buildDotnetModule
) doesn't seem to have been addressed. I'm still getting [...] line 2: .../ilc: cannot execute: required file not found
when adding <PublishAot/>
. Is it not feasible to implement it for that scenario?
I do not think it is @YoshiRulz because we'd have to patch the dotnet
binary to once a nuget package is downloaded, its binary executables be patched to work with the current system.
This would require us to build from source and also maintain our own fork of .NET, so the easiest method is to either use steam-run
or a container. You can also manually patch those binaries yourself if you know how to using patchelf
.
Yes, nix-ld is is indeed a viable alternative to it, I've been using it for NativeAOT in one of my projects: https://github.com/GGG-KILLER/SimpleCompiler/blob/main/shell.nix
I didn't mention it before because only recently I've caved in and decided to use it, as before I wanted to keep a 100% pure nix environment and manually patchelf
'd anything I needed.
Issue description
Some NuGet packages include native binaries inside of them for various purposes - ie. see Grpc.Tools.
Using them in NixOS is currently impossible, since these binaries are compiled for a normal FHS linux system, and fail on NixOS.
Two additional features are needed for usage of such binaries to improve in NixOS:
Support in
buildDotnetModule
buildDotnetModule
should automatically runpatchelf
on all found binaries in the restored nuget dependencies. This would allow easy support innixpkgs
Support when running bare
dotnet
commandThis one is a lot more trickier. When running native
dotnet
command (outside the scope of a Nix build),patchelf
should automatically patch restored nuget packages.This is a lower priority feature, mainly aimed at developer egonomics. It would be also a lot harder to implement. Ideas welcome.
Steps to reproduce
Try to create and build any .NET project that uses nuget packages with native binaries (ie.
eventstore
)Technical details
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.