-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
nix-prefetch-url doesn't use the fetcher cache #10881
Comments
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/lock-files-without-flakes-what-is-the-status/58297/7 |
What if |
It didn't. And even if it did, the whole point of npins is to, well. Pin. So that shouldn't matter in that tool's scenario. |
These aren't URLs pointing to immutable data though, so doesn't that mean that Suppose you lock your pins, and then you realize you forgot to push something, you push it, and then lock your pins again to pick up the update. For this scenario to work, you'd need I'm not arguing against using the fetcher cache; just against relying on |
To be fair, were I to file a report, I'd have written it a bit differently. For example, I mentioned a pin of "google-fonts": {
"type": "Git",
"repository": {
"type": "GitHub",
"owner": "google",
"repo": "fonts"
},
"branch": "main",
"revision": "cc8f3b4d3645c04030dfdccafa6d8514a0b8ba2c",
"url": "https://github.com/google/fonts/archive/cc8f3b4d3645c04030dfdccafa6d8514a0b8ba2c.tar.gz",
"hash": "0bamh7hj4vplxwqw5ph0vff4ylc5dfm233f6alwk8w59sqikp0ag",
"frozen": true
}, When pinning, It then, as far as I see, makes a call to https://github.com/andir/npins/blob/4dbde2a195aa86a8833a81ec5395ebfc7b7428e6/src/nix.rs#L9-L18 Finally it generates https://github.com/andir/npins/blob/4dbde2a195aa86a8833a81ec5395ebfc7b7428e6/src/default.nix#L69-L75 # At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository
# In the latter case, there we will always be an url to the tarball
if url != null && !submodules then
builtins.fetchTarball {
inherit url;
sha256 = hash; # FIXME: check nix version & use SRI hashes
} Naturally this URL should not change between the time that If nix is fact caching, as you claim, then it seems odd to me that both |
Yes, in the bug report I use a somewhat arbitrary URL for an example, but as @eclairevoyant points out it doesn't make a difference for the underlying problem. |
Judging by @fricklerhandwerk's response we're not actually off-topic when discussing the prior. @eclairevoyant do the store path |
So (by default) they are different paths despite resulting in the same hash, hence the cache miss... though they are identical - I guess the simple fix here would be on the npins side to explicitly set EDIT: Though, it's a little surprising to me that they used different formats? |
According to the nix reference manual:
So I tested with not-unpacking, and they do in fact match:
I can't think of a good reason for |
So the mismatched store path
Unfortunately we can't get rid of the old behavior because of Nix's promise to evaluate reproducibly. |
Sure, I've seen that before, but somehow the name would have to change but have the output hash stay fixed. I've never seen this play out in practice, at least in nixpkgs. And if that was really a valuable proposition then
Of course, I was only speaking in retrospect that the design seemed odd. I'm definitely not suggesting a |
@fricklerhandwerk did the explanations of @roberth solve your issue? |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2025-01-08-nix-team-meeting-minutes-207/58523/1 |
Describe the bug
nix-prefetch-url
re-downloads the same remote object every time, because it doesn't use the fetcher cache.Steps To Reproduce
Expected behavior
The second invocation does not require a download. But as you observe, it currently does.
Additional context
This is an issue for tools like npins: andir/npins#57
Priorities
Add 👍 to issues you find important.
The text was updated successfully, but these errors were encountered: