Workaround for unreachable binary cache

nix.dev advises to use --option connect-timeout 5 --fallback to workaround an unavailable binary cache, but for me this results in:

$ nix-env -i signal-desktop --option connect-timeout 5 --fallback
installing 'signal-desktop-1.34.4'
warning: unable to download 'https://binary-cache.some-unreachable-server.de/6gf4wr0wb9r4q7bs9kiki5kgjj42cjf4.narinfo': Couldn't resolve host name (6); retrying in 304 ms
warning: unable to download 'https://binary-cache.some-unreachable-server.de/6gf4wr0wb9r4q7bs9kiki5kgjj42cjf4.narinfo': Couldn't resolve host name (6); retrying in 706 ms
warning: unable to download 'https://binary-cache.some-unreachable-server.de/6gf4wr0wb9r4q7bs9kiki5kgjj42cjf4.narinfo': Couldn't resolve host name (6); retrying in 1057 ms
warning: unable to download 'https://binary-cache.some-unreachable-server.de/6gf4wr0wb9r4q7bs9kiki5kgjj42cjf4.narinfo': Couldn't resolve host name (6); retrying in 2625 ms
disabling binary cache 'https://binary-cache.some-unreachable-server.de' for 60 seconds
unable to download 'https://binary-cache.some-unreachable-server.de/6gf4wr0wb9r4q7bs9kiki5kgjj42cjf4.narinfo': Couldn't resolve host name (6)
error: unexpected end-of-file

So the cache is eventually removed, but the command fails anyway. Any suggestions what to do in this scenario?

2 Likes

I’ve exactly the same problem. I can’t run nix-build while offline.

In my case, I always pass --option substitute false to nix-build or nix-env when I’m offline and it works ok. According to nix.conf(5) manpage this is what the option does:

   substitute
       If set to true (default), Nix will use binary substitutes if available. This option can
       be disabled to force building from source.
1 Like

That used to work :confused: I’ve updated Frequently Asked Questions — nix.dev documentation

3 Likes

Not unrelated: https://github.com/NixOS/nix/issues/3796