-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
dotnet: infrastructure improvements #336824
Conversation
401a09c
to
ebbaff2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few initial comments
pkgs/build-support/dotnet/build-dotnet-module/hooks/dotnet-install-hook.sh
Show resolved
Hide resolved
@@ -25,7 +25,6 @@ runCommandLocal "nuget-to-nix" { | |||
curl | |||
gnugrep | |||
gawk | |||
dotnet-sdk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this be a breaking change since it now retrieves the dotnet from path (which isn't guaranteed to be there)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm still not sure this is a good idea, but having to override it all over the place seems wrong.
pkgs/by-name/av/avalonia/package.nix
Outdated
with dotnetCorePackages; | ||
combinePackages [ | ||
sdk_6_0 | ||
sdk_7_0_1xx |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we really add a new dependency on .NEY 7 when it's EOL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I specifically chose the version of avalonia
used by nexusmods-app
, and it's pinned to 7.0.1xx. Newer versions are on 8 I believe.
I'll do some experimenting with newer versions, but I don't think it's a worse situation than pulling the binary blob, which was also built with the EOL sdk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a situation where it'd be useful to have multiple versions of avalonia packaged? Or perhaps that's jumping the gun, if it's currently only used by nexusmods-app...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope that we won't have to do any more than package multiple major versions of packages.
For example, right now I see things in nixpkgs using avalonia:
- 0.10.12
- 0.10.13
- 0.10.15
- 0.10.18
- 11.0.4
- 11.0.5
- 11.0.9
- 11.0.10
- 11.0.11
So maybe we'd get away with just avalonia_11
, until 12 exists? 0.10 could probably stay as binary. Some work will probably still have to be done to relax version constraints and ensure we're prioritising packages from nixpkgs.
Another good example is newtonsoft.json. To support all major versions currently used in nixpkgs, we'd need newtonsoft-json_9
, _10
, _11
, _12
, and _13
.
ebbaff2
to
88761e1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of this goes a little over my head, but I like the high level direction!
Speaking from the nexusmods perspective, this seems useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad to see 14 deps dropped here.
Slightly confused why there's still a handful of Avalonia deps in the file.
Also confused why running fetch-deps has given us new hashes for each dep even though their versions are unchanged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Slightly confused why there's still a handful of Avalonia deps in the file.
Some are from separate repos I believe (buildsystem?), but some are just older versions, which is something I need to investigate.
Also confused why running fetch-deps has given us new hashes for each dep even though their versions are unchanged?
I believe that's just changing to SRI hashes, and the actual hash values aren't actually changed.
48b508d
to
574ebcb
Compare
574ebcb
to
fe51471
Compare
It would also be fairly easy to make a |
I've split some of this stuff into: #339953. @js6pak patching sounds like an interesting idea. The PR I referenced has the package overriding mechanism in it, and you can see how it adds the runtime deps specifically for Avalonia.X11. If that was replaced with assembly patching, it would be more robust. |
I've been doing some more work on the source-built avalonia, and I'm trying to figure out the best way to consume it in other packages. Say we add the package https://learn.microsoft.com/en-us/nuget/concepts/dependency-resolution#lowest-applicable-version I can think of a couple of ways of approaching this.
I've implemented (1), and it's promising, but you can't map by version (NuGet/Home#13351), so you can't really have a mix of versions from nuget.org and nixpkgs for a specific package. It also complicates things because turning on (2) is more work per-package, and if you use floating versions, your source-built dependency can be overridden in Anyone have any thoughts/ideas? @GGG-KILLER @js6pak @MattSturgeon maybe? |
My first thought is that if we want fuzzy versions, this should be up to the package to declare. Replacing nuget x.y.z with source-built x.y.z should usually be fine, but doing fuzzy matching like x.y.* could be more likely to introduce unexpected issues? Alternatively, instead of doing version matching, we could simply have a This has the pro and con of being more explicit about which inputs are handled by nuget and which come from nixpkgs. |
Well a dependency like this from nexusmods-app:
Really means NuGet calls normal semver dependencies 'floating versions'. If those were more widely used (for example nexusmods-app could probably use |
Given this, couldn't we have the option of just packaging the latest version for each major without needing to change anything? |
Yeah, sort of, but only if you use the package source mapping to force it to pick packages from nixpkgs instead of nuget.org. If nixpkgs has 11.0.11, then nugetmods-app will use it if it's the only option. If it can find both 11.0.11 (from nixpkgs) and 11.0.10 (from nuget.org), it'll use the later due to 'lowest applicable version'. I personally think we should force the nixpkgs dependencies, as long as they meet the project constraints. The default behaviour (i.e. 'lowest applicable version') seems like a nightmare for rolling out security fixes. We'd also be encouraging projects to declare dependencies more carefully than just |
But given that we use a directory as a source on the |
3cfb72d
to
974e546
Compare
xq has such a long startup time that this significantly improves performance.
linkNugetPackages and linkNuGetPackagesAndSources can now be disabled by setting them to false. linkNugetPackages will use _linkPackages, which is much faster.
This allows the script to run on platforms that can't fetch all of the packages, or without allowing unfree.
This allows you to resume after a failure by passing the name of the first package you want to be fetched.
dae56bc
to
d8bd63a
Compare
Sorry @GGG-KILLER, I missed this question. Yeah, I was thinking of |
Hi, sorry just saw this and the changes for Scarab, should I be making a PR upstream to include this change? |
@huantianad possibly. I found a few others that did the same thing. It's not really wrong exactly, it's just depending on the user's global nuget configuration. It's pretty easy to hack around in nixpkgs, and might even be worthy of a shared hook/option. A lot of projects are explicit about package sources like this: https://github.com/AvaloniaUI/Avalonia/blob/master/NuGet.Config. Other projects don't even specify a nuget configuration. In those cases we create a default config which includes nuget.org. Maybe we should be adding nuget.org when there isn't a |
Does dotnet-runtime need to retain the dependency on the setup hook at runtime? eg right now ArchiSteamFarm uses this https://github.com/NixOS/nixpkgs/blob/d40eb2f76888d5936a1f91ebce4c01f34ae43f10/pkgs/applications/misc/ArchiSteamFarm/default.nix#L23C3-L23C17 and through that has a dependency on xmlstarlet which I didn't have on my system before. |
@SuperSandro2000 the runtime should use only Edit: oh, I see, it's |
Ah yeah, I think this is the way to go:
This removes a bunch of stuff from the |
Description of changes
The most important parts of this change are:
dotnet-sdk-setup-hook: configure nuget in sourceRoot
nuget.config
in$NIX_BUILD_TOP
(or wherevergenericBuild
was executed from. Instead, we now attempt to make the changes to the rootnuget.config
insourceRoot
, creating a default one if it doesn't exist.xmlstarlet
logic that I would like to eventually move to something more robust (C# maybe, if bootstrapping can be done in a sane way?).dotnetCorePackages: split fetch-deps logic into addNuGetDeps
fetch-deps
to be added to anystdenv
package, not just viabuildDotnetModule
.avalonia: init at 11.0.10
nexusmods-app
. I've tested all other Avalonia 11 apps with it, but I want to get a better idea of how upgrading is going to work before forcing it on all maintainers.add
mapNuGetDependencies
packageSourceMapping
.nexusmods-app
in order to force it to use avalonia11.0.11
.Supporting work:
$out/share/nuget/source/*.nupkgs
will have them repacked and fixed-up as withbuildDotnetModule
.nuget.config
, dependency versions, etc.nuget-to-nix
significantly faster:Unrelated fixes to problems I found along the way:
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.