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
fetchFromGitHub: make owner and repo accessible #42771
Conversation
Can we also merge this into staging? nixpkgs-update uses both master and staging. |
@@ -257,8 +257,8 @@ with pkgs; | |||
fetcherArgs = (if fetchSubmodules | |||
then { inherit rev fetchSubmodules; url = "${baseUrl}.git"; } | |||
else ({ url = "${baseUrl}/archive/${rev}.tar.gz"; } // privateAttrs) | |||
) // passthruAttrs // { inherit name; }; | |||
in fetcher fetcherArgs // { meta.homepage = baseUrl; inherit rev; }; |
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.
Actually, wouldn't it work to just use inherit owner repo rev;
here?
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.
I'll test this. Then probably not a single derivation will even change, because just overriding the derivation attribute sets attributes doesn't influence the drv, which is probably not the case with passthru.
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.
Turns out neither of those approaches influence the derivation, so I think passthru
is the cleaner way to do this then. passthru
is exactly meant for this kind of stuff.
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.
This is looking good to me then
@@ -257,8 +257,8 @@ with pkgs; | |||
fetcherArgs = (if fetchSubmodules | |||
then { inherit rev fetchSubmodules; url = "${baseUrl}.git"; } | |||
else ({ url = "${baseUrl}/archive/${rev}.tar.gz"; } // privateAttrs) | |||
) // passthruAttrs // { inherit name; }; | |||
in fetcher fetcherArgs // { meta.homepage = baseUrl; inherit rev; }; |
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.
Turns out neither of those approaches influence the derivation, so I think passthru
is the cleaner way to do this then. passthru
is exactly meant for this kind of stuff.
This looks incomplete: you don't pass through the information that the |
@orivej Thanks, that's a good point! You're right that I don't need this change. |
It would be possible to use |
@infinisil, @ryantm probably parses it another language. This PR is well intentioned and almost complete, but the exact set of attributes that should be passed through is not obvious (should there be |
One benefit of parsing URLs is that this supports derivations that use |
Good points |
Yes, Haskell. Here is my fake parser: |
I would like to be able to get the
repo
andowner
attrs of afetchFromGitHub
derivation so that I can add changelog information to nixpkgs-update's pull requests.I renamed
passthruArgs
because I thought this is a confusing name given we have apassthru
concept already, and addedowner
,repo
, andrev
to the passthru attrs for thefetchzip
andfetchgit
derivations. I also removed "inherit rev" from the attrset, since it seems to be covered by the passthru attrs.I'm not that familiar with this kind of nix editing and this is an important derivation, so please check my work!