From dae5dc7ade60aa6a9a05e41133da7faebe6bdc1b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 30 Oct 2015 11:27:47 +0100 Subject: : Support downloading and unpacking NARs This removes the need to have multiple downloads in the stdenv bootstrap process (like a separate busybox binary for Linux, or curl/mkdir/sh/bzip2 for Darwin). Now all those files can be combined into a single NAR. --- corepkgs/fetchurl.nix | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'corepkgs') diff --git a/corepkgs/fetchurl.nix b/corepkgs/fetchurl.nix index 9ecb2225ba67..5e0ad9da3c68 100644 --- a/corepkgs/fetchurl.nix +++ b/corepkgs/fetchurl.nix @@ -1,12 +1,19 @@ with import ; -{system ? builtins.currentSystem, url, outputHash ? "", outputHashAlgo ? "", md5 ? "", sha1 ? "", sha256 ? "", executable ? false}: +{ system ? builtins.currentSystem +, url +, outputHash ? "" +, outputHashAlgo ? "" +, md5 ? "", sha1 ? "", sha256 ? "" +, executable ? false +, unpack ? false +, name ? baseNameOf (toString url) +}: assert (outputHash != "" && outputHashAlgo != "") || md5 != "" || sha1 != "" || sha256 != ""; derivation { - name = baseNameOf (toString url); builder = "builtin:fetchurl"; # New-style output content requirements. @@ -14,9 +21,9 @@ derivation { if sha256 != "" then "sha256" else if sha1 != "" then "sha1" else "md5"; outputHash = if outputHash != "" then outputHash else if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5; - outputHashMode = if executable then "recursive" else "flat"; + outputHashMode = if unpack || executable then "recursive" else "flat"; - inherit system url executable; + inherit name system url executable unpack; # No need to double the amount of network traffic preferLocalBuild = true; -- cgit 1.4.1