1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-16 02:01:59 +02:00

Make <nix/fetchurl.nix> a builtin builder

This ensures that 1) the derivation doesn't change when Nix changes;
2) the derivation closure doesn't contain Nix and its dependencies; 3)
we don't have to rely on ugly chroot hacks.
This commit is contained in:
Eelco Dolstra 2015-07-20 04:30:16 +02:00
parent eda2f36c2a
commit 0a2bee307b
9 changed files with 61 additions and 20 deletions

View file

@ -5,20 +5,9 @@ with import <nix/config.nix>;
assert (outputHash != "" && outputHashAlgo != "")
|| md5 != "" || sha1 != "" || sha256 != "";
let
builder = builtins.toFile "fetchurl.sh"
(''
echo "downloading $url into $out"
${curl} --fail --location --max-redirs 20 --insecure "$url" > "$out"
'' + (if executable then "${coreutils}/chmod +x $out" else ""));
in
derivation {
name = baseNameOf (toString url);
builder = shell;
args = [ "-e" builder ];
builder = "builtin:fetchurl";
# New-style output content requirements.
outputHashAlgo = if outputHashAlgo != "" then outputHashAlgo else
@ -39,6 +28,4 @@ derivation {
# by definition pure.
"http_proxy" "https_proxy" "ftp_proxy" "all_proxy" "no_proxy"
];
inherit chrootDeps;
}