maintainers/scripts/update.nix: various fixes and clean-ups #87731
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation for this change
The
packagesWith
function expected an attrSet butpackagesWithUpdateScript
could be passing it a derivation or a list when the attribute path supplied by user through the--argstr path
argument pointed to one. It only worked because derivations are also attrSets and contain their outputs as attributes, and did not work for lists at all.Additionally, the improper handling would cause the
src
attribute to be built in some rare cases (mkYarnPackage
seems to trigger this).Rewriting the
packagesWith
function to be inductive with a derivation as a base case and attrSets and lists as inductive steps is much cleaner and also fixes the unnecessary build.How to test this
Apply the following patch:
and run:
None of these should fail or try to download their sources.