Fetchurl should automatically try to download the file from a (user-configurable) set of mirrors (such as http://nix.cs.uu.nl/dist/tarballs). This way we dont have to change the URL in fetchurl calls from the original location.

The mirrors should be taken from:

  • Nixpkgs itself (e.g., in build-support/fetchurl/mirrors.nix) - this would contain at least http://nix.cs.uu.nl/dist/tarballs.
  • ~/.nixpkgs/mirrors.nix
  • Some environment variable, say NIXPKGS_MIRRORS.

The mirroring mechanism should primarily be keyed on hashes, so given fetchurl {url = ; md5 = ;} we would fetch http://mirror…/md5/.

It may also be useful to specify some alternate download locations per package. E.g., for gcc:

fetchurl {
urls = [
ftp://ftp.nluug.nl/mirror/languages/gcc/releases/gcc-4.0.4/gcc-4.0.4.tar.bz2
ftp://ftp.gnu.org/pub/gnu/gcc/gcc-4.0.4/gcc-4.0.4.tar.bz2

]
sha256 = …;
}

Or maybe even global “substitutions”, e.g., for any URL starting with ftp://ftp.gnu.org/pub/gnu/, we can also try ftp://ftp.nluug.nl/pub/gnu.

Submitted on 8 August 2007 at 02:40

Log in to post comments