Describe the bug
Currently fetchFromGitHub works like this:
{ ... }:
let
...
fetcherArgs = (if useFetchGit
then {
inherit tag rev deepClone fetchSubmodules sparseCheckout fetchLFS; url = gitRepoUrl;
} // lib.optionalAttrs (leaveDotGit != null) { inherit leaveDotGit; }
else {
url = "${baseUrl}/archive/${revWithTag}.tar.gz";
passthru = {
inherit gitRepoUrl;
};
}
) // privateAttrs // passthruAttrs // { inherit name; };
in
fetcher fetcherArgs // { meta = newMeta; inherit owner repo tag; rev = revWithTag; }
(see the entire file: https://github.com/NixOS/nixpkgs/blob/edb546d0e3884c526dab475224136637cae3f36f/pkgs/build-support/fetchgithub/default.nix#L64C1-L78C85)
unfortunately, the last line is messing up the overrideAttrs interface: because // is used on the derivation itself overrideAttrs doesn't know about their existance and thus deletes them if we try to .overrideAttrs the result of fetchFromGitHub.
Possible solution
passthru is a method for achieving the same thing, aka. appending extra information onto a derivation, but from the inside. It's also supported by overrideAttrs.
If we did
passthru = {
inherit gitRepoUrl owner repo tag;
meta = newMeta;
rev = revWithTag;
};
it would be much better, however fetchgit currently doesn't support passing passthru, so we'd also need to change that.
(Though, meta should probably not be part of passthru if we did this)
Note
I know there's a .override interface over fetchFromGitHub, however that's not "generic" enough. .overrideAttrs should work with any kind of fetcher.
It would be amazing if we could be able to do something like this and not have to worry about implementation details of the src FOD.
Example:
some-package.overrideAttrs (prevAttrs: {
version = "2.0";
src = prevAttrs.src.overrideAttrs { outputHash = "new-hash"; };
})
Notify maintainers
Note for maintainers: Please tag this issue in your PR.
Add a 👍 reaction to issues you find important.
Describe the bug
Currently
fetchFromGitHubworks like this:(see the entire file: https://github.com/NixOS/nixpkgs/blob/edb546d0e3884c526dab475224136637cae3f36f/pkgs/build-support/fetchgithub/default.nix#L64C1-L78C85)
unfortunately, the last line is messing up the
overrideAttrsinterface: because//is used on the derivation itselfoverrideAttrsdoesn't know about their existance and thus deletes them if we try to.overrideAttrsthe result offetchFromGitHub.Possible solution
passthruis a method for achieving the same thing, aka. appending extra information onto a derivation, but from the inside. It's also supported byoverrideAttrs.If we did
it would be much better, however
fetchgitcurrently doesn't support passingpassthru, so we'd also need to change that.(Though,
metashould probably not be part ofpassthruif we did this)Note
I know there's a
.overrideinterface overfetchFromGitHub, however that's not "generic" enough..overrideAttrsshould work with any kind of fetcher.It would be amazing if we could be able to do something like this and not have to worry about implementation details of the src FOD.
Example:
Notify maintainers
Note for maintainers: Please tag this issue in your PR.
Add a 👍 reaction to issues you find important.