nixpkgs-suyu/pkgs/build-support/fetchurl/boot.nix
Eelco Dolstra e6f61b4cf3 fetchurlBoot: Use Nix's builtin fetchurl function
This removes the need for curl in bootstrapTools, and enables https
for bootstrap tarballs.
2016-02-27 20:27:24 +01:00

20 lines
459 B
Nix

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);
}