Skip to content
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

My nix queries /nar/<hash>-<name>.narinfo, not just /<hash>.narinfo #120

Open
t184256 opened this issue Jul 28, 2023 · 7 comments · Fixed by #122
Open

My nix queries /nar/<hash>-<name>.narinfo, not just /<hash>.narinfo #120

t184256 opened this issue Jul 28, 2023 · 7 comments · Fixed by #122

Comments

@t184256
Copy link

t184256 commented Jul 28, 2023

My nix 2.15.1 queries /nar/<hash>-<name>.narinfo for some reason, so I had to

location ~ "^/nar/([a-z0-9]{32})-.*\.narinfo$" {
  proxy_pass http://127.0.0.1:5000/$1.narinfo$is_args$args;
  ...
}

(It was worth to set it up though, I've seen ~10x speedups in synthetic local tests vs whatever's built into hydra.)

@chayleaf
Copy link

chayleaf commented Jul 30, 2023

Sadly, this workaround didn't work for me on 2.16 (nix-serve doesn't work either for some reason). A new URL format seems to have been added again, this time it looks like nar/yy5li73s8bxjbmax8slbwg8a7sji3dlw-11nzfcccqldbfdpw4mmbxdjp29jaimvkmdsc1cz6xnadlcjqna1n.nar

Edit: it seems to be implemented here

@mikepurvis
Copy link

Out of curiosity, was this a case where you did a drop in replacement of nix-serve -> harmonia?

What I found after doing that was that the harmonia-backed cache worked fine in fresh environments like new containers, but it was a problem for existing installs that seemed to have cached the nix-store-info data and weren't periodically re-fetching it. We were able to use nginx mapping rules to satisfy the old requests, but it would be nice if Harmonia would just exactly copy what nix-serve does in this regard.

@t184256
Copy link
Author

t184256 commented Aug 3, 2023

Hm, solid theory! I've removed the redirect now (~5 days later) and I can't reproduce the issue anymore.

@mergify mergify bot closed this as completed in #122 Aug 6, 2023
@chayleaf
Copy link

chayleaf commented Aug 6, 2023

This isn't really resolved as the root cause still hasn't been found (and I've implemented hash-hash.nar, not hash-name.narinfo), #122 is just a fix for a related issue @Mic92

@Mic92 Mic92 reopened this Aug 7, 2023
@Mic92
Copy link
Member

Mic92 commented Aug 7, 2023

I don't see these types of queries and I also don't see in the nix code base any code that would generate /nar/<hash>-<name>.narinfo type paths. Here for your reference: https://github.com/search?q=repo%3ANixOS%2Fnix+.narinfo+lang%3AC%2B%2B+&type=code

We are testing now with nix 2.17 and I don't see any issues.

@ajs124
Copy link

ajs124 commented Aug 7, 2023

That sounds like a narinfo caching artifact. To quote the documentation from narinfo-cache-positive-ttl: The default TTL is a month.

@Mic92
Copy link
Member

Mic92 commented Aug 7, 2023

For .nar urls this makes sense but not for .narinfo files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants