-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
buildDotnetModule buildInputs depend on dotnet runtime packages for every possible platform #337030
Comments
This is something that's on my radar. Currently the package set is meant to be 'everything that can be implicitly referenced from the SDK'. That can be useful, since it's possible to cross-target other RIDs, but is overkill in a lot of situations. Fixing this should also help integrate the souce-built SDK, because we can pull in binary packages for cross targeting. Ideally I'd like to solve this for both SDK packages and
This is described in update.sh
These explicit references are also bad, for the same reason. |
I believe this is the same issue I brought up in #179136 (comment), where I also suggested |
Okay, I thought about current state of affairs and have several observations:
What we can do with all those points above?
What do you think? |
The first thing that comes to mind is that I think we should always prefer packages from nixpkgs. For example, if you're building with the source-built SDK, you should have the source-built packages that go along with it, even if they have the same version as something on nuget.org. I think this could be important in the future, because we may want to patch the sdk to be more nix-friendly. It may also be important if people care about What you're describing would mostly not interfere with that, except for during I think I'd prefer to explicitly limit the packages pulled in from Is closure size in |
I don't think that rundeps should be unconditionally added to any packages, regardless of whether they're part of Nixpkgs. It goes against the idea of only depending on the derivations that are actually used/referenced (a la re: closure size, at least it respects |
As a base default for the nixpkgs - sure thing.
That would be the behavior of OverrideDeps I'm proposing - we identify inside a deps.nix that a package depends on say, Microsoft.AspNetCore.App.Ref-8.0.1 from nuget.org for whatever reason, and then we override it during build with our source-built Microsoft.AspNetCore.App.Ref-8.0.8 .
It's a matter of perspective and specific usecases. If you have an unlimited optical line and 1TB SSD, this level of overhead might not be concerning. If you're are on a laptop with a metered mobile connection and limited disk space - it gets concerning IMO. Especially, if you can clearly see that half of what you're downloading is just useless. Shell output
This gets multiplied by a number of relevant sdk (for example, fsautocomplete uses dotnet sdks from 6 to 8). If you maintain some dotnet project in a flake, you eventually will desync with your
Isn't it always the case now, especially during initial creation of of deps.nix file? |
What if we start by making something like In that case it'll need to pull in everything when doing We could limit it further by having packages opt-in to AOT support, but that might be overkill. |
This isn't central to the issue being discussed, but if such a refactor is done it should tie in with #325053 by either using a JSON deps file and |
I started working on this. What I have so far is Unfortunately I've found that some downstream projects were depending on restoring packages for runtimes we aren't targeting. For example, I'm going to take a look at fixing this in the projects, but I may have to add an escape hatch that brings in all the packages. |
@corngood instead of splitting packages per rid, couldn't we restructure Maybe something like making |
@GGG-KILLER The problem I see with that is that it's always going to be dependent on nuget.org if you build Something we could potentially do to avoid that is figure out which packages are actually required from the sdk packages during Is it worth it though? Here's what we're left with after cleaning things up (I stripped out everything except
|
#343837 Has my work so far on this, in case anyone is able to review. I think the next step might be to look at |
Describe the bug
Hello 👋
This line makes buildDotnetModule include every package from SDK runtime-collection into build-time closure. Basically, each time I want to tweak or update existing dotnet package, nix-build floods my terminal with a download list of stuff for platforms like macOS, win32, musl-linux and what not, even though I only care about linux-x64 platform.
I wonder what's a motivation behind this unconditional dependence? For one particular package I'm working on right now, removal of sdk runtime packages doesn't make a difference, it builds just fine. Probably that's because its deps.nix was already containing reference to Microsoft.NETCore.App.Runtime.linux-x64 . Searching for the 'Microsoft.NETCore.App.Runtime.linux-x64' inside nixpkgs also reveals several packages whose deps.nix contain explicit ref to a runtime. I wonder, maybe we can remove this runtime-collection from buildInputs altogether or hide it behind some flag?
Steps To Reproduce
Steps to reproduce the behavior:
Expected behavior
nix-build should only download dotnet runtime packages for platforms that I build my dotnet package for.
Notify maintainers
@NixOS/dotnet
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a 👍 reaction to issues you find important.
The text was updated successfully, but these errors were encountered: