nixos icon indicating copy to clipboard operation
nixos copied to clipboard

nix should use curl -C

Open fare opened this issue 12 years ago • 1 comments

On bad connections, loading a single big file in one go is a non-starter. That's why curl has option -C for continue/resume, and other tools have similar options. Nix should use it. This assumes that Nix should somehow be able to determine the total size at the beginning of the download query, and/or cache it together with a digest of the file, and that it should detect issues that lead to incomplete download, so as not to delete the partial file in those cases (as opposed to cases of file corruption).

This all suggests that, like apt, nix should have a download protocol that knows about partial files and resume, and use that instead of a trivial curl.

(This issue might be for nix rather than nixos.)

fare avatar Feb 14 '13 01:02 fare

It's actually for both Nix and Nixpkgs, but not NixOS :-)

Nix's substituters (i.e. for downloading binaries) can probably be made to use -C fairly easily.

Nixpkgs' fetchurl is trickier because it may run under a build user uid. So having a shared cache for partially downloaded files is hard. OTOH, fetchurl does use curl's --retry flag, so maybe in combination with -C, curl will do resumes automatically?

edolstra avatar Feb 15 '13 12:02 edolstra