From e6f61b4cf33887a9231a12e8c766404139a277d8 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 27 Feb 2016 20:27:24 +0100 Subject: [PATCH] fetchurlBoot: Use Nix's builtin fetchurl function This removes the need for curl in bootstrapTools, and enables https for bootstrap tarballs. --- pkgs/build-support/fetchurl/boot.nix | 20 ++++++++++++++++++++ pkgs/stdenv/linux/default.nix | 7 +++---- pkgs/stdenv/linux/make-bootstrap-tools.nix | 9 --------- 3 files changed, 23 insertions(+), 13 deletions(-) create mode 100644 pkgs/build-support/fetchurl/boot.nix diff --git a/pkgs/build-support/fetchurl/boot.nix b/pkgs/build-support/fetchurl/boot.nix new file mode 100644 index 000000000000..c007281e87b0 --- /dev/null +++ b/pkgs/build-support/fetchurl/boot.nix @@ -0,0 +1,20 @@ +let mirrors = import ./mirrors.nix; in + +{ system }: + +{ url ? builtins.head urls +, urls ? [] +, sha256 +}: + +import { + inherit system sha256; + + url = + # Handle mirror:// URIs. Since 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); + +} diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index cd49d4a5a742..965188a0cdd8 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -80,9 +80,9 @@ rec { ''; shell = "${bootstrapTools}/bin/bash"; initialPath = [bootstrapTools]; - fetchurlBoot = import ../../build-support/fetchurl { - stdenv = stage0.stdenv; - curl = bootstrapTools; + + fetchurlBoot = import ../../build-support/fetchurl/boot.nix { + inherit system; }; cc = if isNull gccPlain @@ -333,7 +333,6 @@ rec { awk --version grep --version gcc --version - curl --version ldlinux=$(echo ${bootstrapTools}/lib/ld-linux*.so.?) export CPP="cpp -idirafter ${bootstrapTools}/include-glibc -B${bootstrapTools}" diff --git a/pkgs/stdenv/linux/make-bootstrap-tools.nix b/pkgs/stdenv/linux/make-bootstrap-tools.nix index 7f7f4c6a2bd1..ef651f643684 100644 --- a/pkgs/stdenv/linux/make-bootstrap-tools.nix +++ b/pkgs/stdenv/linux/make-bootstrap-tools.nix @@ -10,13 +10,6 @@ rec { aclSupport = false; }); - curlMinimal = curl.override { - http2Support = false; - zlibSupport = false; - sslSupport = false; - scpSupport = false; - }; - busyboxMinimal = busybox.override { useMusl = true; enableStatic = true; @@ -84,8 +77,6 @@ rec { cp -d ${gnumake}/bin/* $out/bin cp -d ${patch}/bin/* $out/bin cp ${patchelf}/bin/* $out/bin - cp ${curlMinimal}/bin/curl $out/bin - cp -d ${curlMinimal}/lib/libcurl* $out/lib cp -d ${gnugrep.pcre}/lib/libpcre*.so* $out/lib # needed by grep