2 mirrors = import ./mirrors.nix;
8 url ? builtins.head urls,
12 name ? baseNameOf (toString url),
15 # assert exactly one hash is set
16 assert hash != "" || sha256 != "";
17 assert hash != "" -> sha256 == "";
19 import <nix/fetchurl.nix> {
28 # Handle mirror:// URIs. Since <nix/fetchurl.nix> currently
29 # supports only one URI, use the first listed mirror.
31 m = builtins.match "mirror://([a-z]+)/(.*)" url;
33 if m == null then url else builtins.head (mirrors.${builtins.elemAt m 0}) + (builtins.elemAt m 1);