nix-build implement --offline

Created on 25 Jan 2021  路  5Comments  路  Source: NixOS/nix

Is your feature request related to a problem? Please describe.
Related to #2715, sometimes we are in poor network, nix-build will keep trying to fetch narinfo, and die for fail to reach them. But in fact, we know those narinfo are 404, they have to been built anyway, so connecting to network is needless.

Describe the solution you'd like
Add option --offline to disable network, treat all remote resources are missing and build locally (with local cached resources available). If something is requisite to fetch online (e.g. source tarball), just fail building.

Describe alternatives you've considered
Carefully dealing network connection like #2715, fail network but don't fail building.

improvement

Most helpful comment

--offline makes me immediately understand what it would do compared to --no-net

All 5 comments

related #2022 #1985 #1195 #2022 #3796, tt seems these network issue has bothered people for a long time, we could add an option to fix them once for all.

nix should handle nix::SubstituterDisabled when using --fallback. Related #3768

disabling binary cache 'https://mirrors.bfsu.edu.cn/nix-channels/store' for 60 seconds
unable to download 'https://mirrors.bfsu.edu.cn/nix-channels/store/him3d1gkcz9spa3qkgscdzspnlwbwdbs.narinfo': Couldn't resolve host name (6)
querying info about '/nix/store/him3d1gkcz9spa3qkgscdzspnlwbwdbs-cctools-port-949.0.1-man' on 'https://cache.nixos.org'...
libc++abi.dylib: terminating with uncaught exception of type nix::SubstituterDisabled: substituter 'https://cache.nixos.org' is disabled
[1]    76806 abort      nix-build --show-trace -E  -v --fallback

The nix command has a --no-net flag that disables substituters (among other things).

The nix command has a --no-net flag that disables substituters (among other things).

nix has --no-net, but nix-build doesn't.

--offline makes me immediately understand what it would do compared to --no-net

Was this page helpful?
0 / 5 - 0 ratings