fetchurlBoot: Use Nix's builtin fetchurl function

This removes the need for curl in bootstrapTools, and enables https
for bootstrap tarballs.
This commit is contained in:
Eelco Dolstra
2016-02-27 20:27:24 +01:00
parent 824a1fb5b9
commit e6f61b4cf3
3 changed files with 23 additions and 13 deletions
+20
View File
@@ -0,0 +1,20 @@
let mirrors = import ./mirrors.nix; in
{ system }:
{ url ? builtins.head urls
, urls ? []
, sha256
}:
import <nix/fetchurl.nix> {
inherit system sha256;
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);
}