fetchFromGitHub: pass owner, repo, rev, tag to mkDerivation and make rev and tag overridable with <pkg>.overrideAttrs#456751
Conversation
ab42386 to
27c7b8f
Compare
|
|
|
|
This |
Reduce future test rebuilds when making githubBase overridable.
c5f90ac to
8bb3bbb
Compare
|
Rebased for CI fix. See issue #457845 |
MattSturgeon
left a comment
There was a problem hiding this comment.
Diff LGTM, and the rebuilds seem reasonable (exclusively tests). Others have tested, and CI is green.
|
This broke fetchgit with prefer-remote-fetch but that will also be fixed in #457313 most likely. |
This PR adds the
derivationArgsargument to fetchers likefetchurl,fetchzip, andfetchgitfor derived fetchers to pass down default arguments tostdenvNoCC.mkDerivation.Contrasting to previous works to preserve those attributes after
<pkg>.overrideAttrsusingpasstru, this PR passes them directly downstdenv.mkDerivationand make them overridable as, e.g.,taginstead ofpassthru.tag. Even with a larger diff, it could better address #444503 and #370418 from the overriding perspective.This PR surpasses:
passthruand enhance overriding #294329Detail:
fetchurl,fetchzip, andfetchgit: Add argumentderivationArgsIt takes derivationArgs from extended build helpers and pass them all the way down
stdenvNoCC.mkDerivation.Their precedence are lower than any other arguments specified by the current build helper or by the user.
fetchzip: Pass argumentsextensionandstripRootdownmkDerivationviaderivationArgs, and make them overridable with<pkg>.overrideAttrs.fetchgit: Maketagandrevoverridable with<pkg>.overrideAttrsastagandrevCustom.tagdirectly tomkDerivationinstead of viapassthru.tag.revtomkDerivationasrevCustom(sincerevWithHashhas been passed asrev).tagandrevCustomoverridden via<pkg>.overrideAttrs, i.e.,finalAttrs.tagandfinalAttrs.revCustom.fetchgit: Abstract, simplify, and exposegetRevWithHashrevWithTagconstruction asgetRevWithHash.tagandrevis specified, and only increase when both unspecified (which is a rare edge-case).getRevWithTagasfetchgit.getRevWithTagso that other fetchers can form this value the same way.fetchFromGitHubhandle itsowner,repo,rev,tag, andmetaarguments, making them equally overridable whether the backend fetcher isfetchziporfetchgit.metaproperly viafetcherArgs.finalAttrstofetcherArgsto utilizefetchurlandfetchgit's fixed-point arguments support, as a workaround beforefetchFromGitHubitself are reconstructed withlib.extendMkDerivation.ownerandrepotomkDerivationviaderivationArgs. We can start fixing their overriding afterlib.extendMkDerivationreconstruction.tagandrevpass the same way asfetchzipdoes when using thefetchzipbackend, with the help ofderivationArgs:namespecification temporarily down thefetcherArgso as to reference fromfinalAttrs. We can move it back during reconstruction withlib.extendMkDerivation.githubBasewithderivationArgsto prevent rebuilds when we make it overridable in the future.Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.