Nix flake update timeout

Hello,
Since a few day, I get a strange behaviour while trying to update the lock file on a flake.
When I run ‘nix flake update’ it always timeout when downloading flake-registry.json.

warning: error: unable to download 'https://github.com/NixOS/flake-registry/raw/master/flake-registry.json': HTTP error 302 ('') (curl error: Timeout was reached); retrying in 1056 ms

if I try to download this file with curl I can do it without any trouble.
Any idea where this could come from ?
Thanks !

Github rate limiting, was my first idea. But you can grab it with curl. Strange. Could be temporary network problems. Whats your network stack look like and who do use for DNS?

Sorry for necrobumping this but I ran into the same problem!
The HTTP error 302 is a red herring, the Timeout was reached is not.

The solution for me was to increase the value for stalled-download-timeout in nix.conf e.g.:

stalled-download-timeout = 1000

In hindsight it seems obvious, but it took me way to long to figure out since this error neither appeared on my Pinebook Pro via WiFi nor on virtual machines which were running on the host where the error persisted.

i don’t think anyone is going prevent anyone from reviving an old thread with to an old problem.

why are you getting such high timeouts anyway, are you on the International Space Station?

I wish! I am blaming most of it on my ISP (Vodafone/Kabel Deutschland) I even had
timeouts/lags while playing chess!
It seems to be a bit better at the moment. But a higher timeout is still a must.

1 Like

Just a tip, on a NixOS or home-manager configuration, you can easily pin the registry so that Nix doesn’t have to download it so frequently in the first place.

# flake.nix
{inputs.flake-registry.url = "github:NixOS/flake-registry";}
# nixos module
{nix.settings.flake-registry = "${inputs.flake-registry}/flake-registry.json";}

That way it only changes when you explicitly update, and your Nix commands don’t randomly stall to check the registry every few minutes.

3 Likes

@nrdxp Amazing tip, thanks!

1 Like

i’d be cautious to hold the ISP at fault, no matter how good the ISP is, they are using a protocols designed and deployed when i was born. Sometimes the are using the same hardware to shunt packets installed before i was born.

However, if you get good speeds on a different ISP … then that is proof! If you have the luxury where you can switch ISP’s…then do it!

are you sure your not on mars?

nix.how have an experimental offline mode for nix, called marsnix.

1 Like

you are right especially since my VMs (mostly) didn’t have that problem, for now
chess runs without the lagging and the warning: error: unable to download only happens
once a day or so… might try to change the cabling at some point

i might be :upside_down_face:

marsnix looks interesting, although i am not sure if it is something i would use, might try it some day.