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-sdk: Allow multiple packages #73262
Conversation
I do like the idea of being able to compose many sdk's. I will have to take a closer look when I get back from work |
I can confirm this is something a Dot Net developer could need : I'm currently working on some legacy projects (2.2) and some new projects that are working with 3.0 only features (Like some Generic Hosts extensions). I'll will give a try to this PR this week. |
I've been using this work in a project of mine with no issues on Ubuntu, Windows WSL2, and a modified version of it for macOS. Excellent work and IMO exactly what I think the dotnet package should look like. @baracoder thank you! |
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.
on the whole, this looks great, I'll try to compile a few projects, and if it works, then I'll merge it.
Sorry for shelving this so long, was focusing on python for the longest time
I've only tried it with v3.1 (stable) of the SDK yet but that has been working without any issues for quite a few project. Since 3.1 is stable by now it should also be added to the list.
|
34ec6d3
to
2b3c24e
Compare
Thank you all for the suggestions. I have updated the branch with the changes and replaced |
2b3c24e
to
ea64697
Compare
Great! Maybe update the default version in
|
I am not sure about this change. This could break some of the packages, which depend on the current version of dotnet-sdk:
|
Ah, right. Never mind then - I suppose updating (which includes checking each of these and possibly fixing them to 2.2) warrants a separate issue in any case. |
9bf62cc
to
ea64697
Compare
@worldofpeace do you see anything out of the ordinary? it LGTM the reason why such a construction is necessary is: dotnet makes the assumption that it's able to download missing sdk's/runtimes to a directory relative to the executable, which ends up being in the nix store, but if the sdk/runtime is already available, then it skips this step. By allowing the sdks/runtimes to be composed through the dotnetPackages.combinePackages function, we can make sure the packages are available, even from mismatching versions (e.g. dotnet_3_1 sdk needs to build a package with dotnet-sdk_2_2). |
@baracoder I still haven't forgot this PR, I just keep getting sidetracked with other things :( |
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.
the only thing I noticed is that if i have 2 sdk's, and no runtimes, then this fails to build. It would also be nice to prefer runtimes from sdks if present, as that will reduce closure size
the problem with linking to sdk's as "runtimes" is that you don't really get any closure benefit, you bring in the whole other closure once you do that. |
Thank you for testing and the input.
Using the same sdk package in runtimes won't increase the closure size, as the directories are just linked. I had the wrong assumption that explicitly specifying the runtime would decrease closure size for built packages, but this is false, because the cli from the combined package would be used and pull in all SDKs. I will update the PR tomorrow. |
also, I don't think the cli argument is necessary, could order the sdks and runtimes first by sdk, then by version, then just choose the first one. |
I did not have time to update the pull request, but stumbled today on a nice nixpkgs function
It works a little bit different but simplifies the process a lot. |
ea64697
to
fe708ec
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.
Created files are missing final newlines.
fe708ec
to
f6ef8b4
Compare
Sorry, for the delay, I forgot to ping. I have updated the merge request. You can now get a combined package like this:
The cli tool will be used from the first entry. I have smuggled in another commit to fix the
|
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.
definite improvement, I have a few suggestions
Fixup assert Fixup: Move comment to top Fixup combine Fixup combine Fixup buildDotnet Fixup default.nix Fixup combine packages dotnetCorePackages: Fixup combinePackages Co-Authored-By: Jon <jonringer@users.noreply.github.com>
6152025
to
5f97a96
Compare
I'm happy with this for the time being. If it needs to be revisited we can do so in another PR. This is a much needed improvement to nixpkgs, thanks @baracoder for up-streaming this :) |
hydra built it https://hydra.nixos.org/eval/1565649#tabs-new . Once a successful release is done, we'll be able to use this on unstable :) |
I made a pull request to add the missing runtimes and use it with Jellyfin : #77961 |
How would I go about using this |
@Jumblemuddle I am using
Don't know if it is possible with |
I would probably use a shell.nix in the repository that you need it:
doing
|
once #77961 gets merged, and I write up some documentation, the I'll probably backport this to 19.09 so they can use it as well |
🤦♂️ I have made an error in copying things from
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/why-cant-i-install-dotnet-in-my-rust-build-environment-shell/5786/1 |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/what-are-your-goals-for-20-03/4773/16 |
Motivation for this change
Colleagues have switched some projects to version 3.0 of .NET Core. I want my development environment to work with all versions.
This changes allow to combine multiple SDKs and runtimes.
in
configuration.nix
This setup worked so far. I am open for suggestions.
Using the runtime packages, it should also be possible to build smaller docker images for deployment.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)Notify maintainers
cc @kuznero
Related issues
#73193
#72300
#69392
#69382
#69391