2024-04-04 23:07:44 +00:00
|
|
|
{
|
|
|
|
system ? "", # obsolete
|
|
|
|
url,
|
|
|
|
hash ? "", # an SRI hash
|
|
|
|
|
|
|
|
# Legacy hash specification
|
|
|
|
md5 ? "",
|
|
|
|
sha1 ? "",
|
|
|
|
sha256 ? "",
|
|
|
|
sha512 ? "",
|
|
|
|
outputHash ?
|
|
|
|
if hash != "" then
|
|
|
|
hash
|
|
|
|
else if sha512 != "" then
|
|
|
|
sha512
|
|
|
|
else if sha1 != "" then
|
|
|
|
sha1
|
|
|
|
else if md5 != "" then
|
|
|
|
md5
|
|
|
|
else
|
|
|
|
sha256,
|
|
|
|
outputHashAlgo ?
|
|
|
|
if hash != "" then
|
|
|
|
""
|
|
|
|
else if sha512 != "" then
|
|
|
|
"sha512"
|
|
|
|
else if sha1 != "" then
|
|
|
|
"sha1"
|
|
|
|
else if md5 != "" then
|
|
|
|
"md5"
|
|
|
|
else
|
|
|
|
"sha256",
|
|
|
|
|
|
|
|
executable ? false,
|
|
|
|
unpack ? false,
|
|
|
|
name ? baseNameOf (toString url),
|
|
|
|
impure ? false,
|
2015-10-30 10:27:47 +00:00
|
|
|
}:
|
2012-07-08 14:19:17 +00:00
|
|
|
|
2024-04-04 23:07:44 +00:00
|
|
|
derivation (
|
|
|
|
{
|
|
|
|
builder = "builtin:fetchurl";
|
2012-07-08 14:19:17 +00:00
|
|
|
|
2024-04-04 23:07:44 +00:00
|
|
|
# New-style output content requirements.
|
|
|
|
outputHashMode = if unpack || executable then "recursive" else "flat";
|
2015-03-24 10:15:45 +00:00
|
|
|
|
2024-04-04 23:07:44 +00:00
|
|
|
inherit
|
|
|
|
name
|
|
|
|
url
|
|
|
|
executable
|
|
|
|
unpack
|
|
|
|
;
|
2018-01-16 18:07:27 +00:00
|
|
|
|
2024-04-04 23:07:44 +00:00
|
|
|
system = "builtin";
|
2012-07-08 15:11:02 +00:00
|
|
|
|
2024-04-04 23:07:44 +00:00
|
|
|
# No need to double the amount of network traffic
|
|
|
|
preferLocalBuild = true;
|
2012-07-08 15:11:02 +00:00
|
|
|
|
2024-04-04 23:07:44 +00:00
|
|
|
impureEnvVars = [
|
|
|
|
# We borrow these environment variables from the caller to allow
|
|
|
|
# easy proxy configuration. This is impure, but a fixed-output
|
|
|
|
# derivation like fetchurl is allowed to do so since its result is
|
|
|
|
# by definition pure.
|
|
|
|
"http_proxy"
|
|
|
|
"https_proxy"
|
|
|
|
"ftp_proxy"
|
|
|
|
"all_proxy"
|
|
|
|
"no_proxy"
|
|
|
|
];
|
2016-09-22 13:48:14 +00:00
|
|
|
|
2024-04-04 23:07:44 +00:00
|
|
|
# To make "nix-prefetch-url" work.
|
|
|
|
urls = [ url ];
|
|
|
|
}
|
|
|
|
// (if impure then { __impure = true; } else { inherit outputHashAlgo outputHash; })
|
|
|
|
)
|