-
-
Notifications
You must be signed in to change notification settings - Fork 12.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
Make fetchFromGitHub & friends overridable #158968
Conversation
c27fe83
to
c130eab
Compare
488359a
to
3b14ecc
Compare
That would be very neat to have. I'm not aware of the downsides so I'm requesting some people to review this instead of me. |
This was also discussed before #158018 was updated to the change that it is now. The performance cost can be estimated as around 0.5%. I think that's not a lot, but it is something we won't get back. |
Are we still interested into having this? |
Yes but I won't be the one fighting for it |
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 believe that having this around, even if it does cost +0,5 % in heap size, will save more time for users.
What would be a usecase for this? |
Doing: |
Overriding the rev/hash, but keeping the owner/repo. |
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 don't have very strong opinions on this, although I feel like the intended use case overlaps with the reason #119942 was introduced.
I do have comments on implementation though: the makeOverridable
calls should be added to pkgs/build-support/foo
rather than all-packages.nix
. This has two advantages:
- we get to keep
fetchFoo.override
(which is different from the added(fetchFoo { ... }).override
) - putting less logic in
all-packages.nix
is always good
For example, fetchgithub/default.nix
would look like this:
{ lib, fetchgit, fetchzip }:
lib.makeOverridable (
/* rest of the file */
)
I'd also like to see some tests for this, to make sure both |
(The fetcher itself wouldn't have an |
I've just bumped into something where I could use this. If you yourself have a derivation where you want to make the source overridable, a workaround is to use |
The interactions with #119942 are certainly interesting, although I don't think this PR is completely obsoleted by it. Take the common use case where I want to override version + source hash.
|
f477a52
to
a205795
Compare
I sure hope "ofborg-eval" does a full evaluation, because I have no way of testing all those fetchers. @ncfavier I updated the design according to your review |
I think this breaks msteen's nix-prefetch.
(I've seen equivalent issues with fetchgit instead of fetchFromGitHub) Pinning nixpkgs in NIX_PATH to 60d3ce9 (this commit's parent) resolve the issue: export NIX_PATH='nixpkgs=/nix/store/ggpfzfa3v97fnxi734c2160qignm361m-source' Because https://github.com/berberman/nvfetcher uses this nix-prefetch, it is currently broken (see berberman/nvfetcher#96) (Edit: parent commit hash) |
@pschyska I unfortunately don't know much about nix-prefetch and how it works, and I have trouble associating these error messages with an explanation how this patch may have caused them. I think there already existed a couple of overridable fetchers before this patch, although I have forgotten which ones. You could try what happens with these, as a control. |
nix-prefetch seems to rely on EDIT: simply because |
Aside: Last updated in 2021. Time to migrate to nurl. |
I would happily migrate, if I could. |
What prevents you? https://github.com/nix-community/nurl#supported-fetchers |
nurl not support fetchurl now. |
As I wrote, I'm a nvfetcher user, not a direct nix-prefetch user. It's up to @berberman to make a decision to migrate. I think they are investigating it though. |
As per @ncfavier's comment this looks fixable, so probably no need to migrate |
Looks like there's prior art #134272 |
… mainly to pick up NixOS/nixpkgs#158968 which makes `fetchFromGitHub` overridable
… mainly to pick up NixOS/nixpkgs#158968 which makes `fetchFromGitHub` overridable
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: |
Motivation for this change
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)nixos/doc/manual/md-to-db.sh
to update generated release notes