-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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: allow fetching nuget dependencies at compile time #314990
base: master
Are you sure you want to change the base?
buildDotnetModule: allow fetching nuget dependencies at compile time #314990
Conversation
, ... } @ args: | ||
|
||
assert projectFile == null -> throw "Defining the `projectFile` attribute is required. This is usually an `.csproj`, or `.sln` file."; | ||
assert (nugetDeps != null && nugetSha256 != null) -> throw "The attributes `nugetDeps` and 'nugetSha256' are mutually exclusive!"; |
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.
Triggers with buildDotnetGlobalTools since it passes through the same attr.
dotnetValidateLockfileHook = makeSetupHook | ||
{ | ||
name = "dotnet-validate-lockfile-hook"; | ||
deps = [ jq ]; |
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.
Depreciated; replace with propagagedBuildInputs
Result of 61 packages built:
|
Have you any package this new hash can be tested with? Maybe we can also remove the lock file for a package in nixpkgs for testing? |
I just tried it with jellyfin with no success; looks like some more work needs to be done. |
|
||
# This is the last phase that runs before we error out about the hash being wrong | ||
postFixup = lib.optionalString (nugetSha256 == null) '' | ||
echo "Please set nugetSha256 to the hash below!" |
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.
New things should ideally only support hash
This allows user to specify a hash for the dependencies using the "nugetSha256" attribute, instead of having to manually generate a lockfile. This is done by generating a lockfile with `dotnet restore`, and then parsing the requested version ranges to see if anything is floating. Afterwards we generate a nix-based lockfile containing hashes and stable downloads for each dependency, which we can IFD. The checksum of this lockfile is specified with "nugetSha256". We want to use the checksum of the nix-based lockfile instead of hashing the entire nuget source so that we can independantly fetch all dependencies, and re-use them across derivations. Co-authored-by: Valentin Gagarin <[email protected]>
e2c84cf
to
c84d0a1
Compare
Motivated to get this working again due to the recent ascii regression. It is unclean, and probably needs to be looked at a lot closer to pull any more recent updates that have been created from the original pr, but it now works, successfully building jellyfin! |
c84d0a1
to
5987390
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.
Still some updates needed, particularly documentation
@@ -43,7 +54,7 @@ EOF | |||
find -name paket.dependencies -exec sed -i 's+source .*+source @nugetSource@/lib+g' {} \; | |||
find -name paket.lock -exec sed -i 's+remote:.*+remote: @nugetSource@/lib+g' {} \; | |||
|
|||
dotnet tool restore --add-source "@nugetSource@/lib" | |||
#dotnet tool restore --add-source "@nugetSource@/lib" |
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.
Commented out due to making a network call; I believe that telemetry will just need to be disabled with export DOTNET_CLI_TELEMETRY_OPTOUT=1
now that I think about it.
@@ -136,6 +136,7 @@ mkCommon type rec { | |||
|
|||
passthru = { | |||
inherit icu; | |||
packages_list = packages; |
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.
Wasn't sure how to get the list of projects so I just readded this since the previous pr did that. If there's a better way do get the packages already retrieved from dotnet, then we can change this.
Oh so I guess I didn't notice that the original used IFD(Was it not banned back then?). Next step is to remove that. |
Should we wait for NuGet/Home#13288 to be considered before implementing something like this? |
A (quick) attempt to rebase #162548
I have tested building jellyfin so far, but nothing else to see if it broke anything. I haven't had a chance to update the warning or docs, but i wanted to at least get nixpkgs-review running on the PR. I also haven't had a chance to see if the hash specification still works, but i wanted to at least get nixpkgs-review running on it to make sure nothing else broke.
Pinging people from the last PR:
@jonringer @SuperSandro2000 @winterqt @IvarWithoutBones @Mic92
Hope these are reasonable pings; sorry if not!
Also I'm not quite so sure why almost everyone's name was removed from authoring the pr? I just noticed that, so I'll see if I can fix that tomorrow. There's probably a bunch documentation stuff that needs to be updated as well.
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.