diff options
Diffstat (limited to 'pkgs/build-support/fetchurl/boot.nix')
-rw-r--r-- | pkgs/build-support/fetchurl/boot.nix | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/pkgs/build-support/fetchurl/boot.nix b/pkgs/build-support/fetchurl/boot.nix index 8f8c78b7a454..4aa76094a843 100644 --- a/pkgs/build-support/fetchurl/boot.nix +++ b/pkgs/build-support/fetchurl/boot.nix @@ -1,12 +1,15 @@ -let mirrors = import ./mirrors.nix; in +let + mirrors = import ./mirrors.nix; +in { system }: -{ url ? builtins.head urls -, urls ? [] -, sha256 ? "" -, hash ? "" -, name ? baseNameOf (toString url) +{ + url ? builtins.head urls, + urls ? [ ], + sha256 ? "", + hash ? "", + name ? baseNameOf (toString url), }: # assert exactly one hash is set @@ -14,12 +17,18 @@ assert hash != "" || sha256 != ""; assert hash != "" -> sha256 == ""; import <nix/fetchurl.nix> { - inherit system hash sha256 name; + inherit + system + hash + sha256 + name + ; url = # Handle mirror:// URIs. Since <nix/fetchurl.nix> currently # supports only one URI, use the first listed mirror. - let m = builtins.match "mirror://([a-z]+)/(.*)" url; in - if m == null then url - else builtins.head (mirrors.${builtins.elemAt m 0}) + (builtins.elemAt m 1); + let + m = builtins.match "mirror://([a-z]+)/(.*)" url; + in + if m == null then url else builtins.head (mirrors.${builtins.elemAt m 0}) + (builtins.elemAt m 1); } |