mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 14:54:29 +01:00
* Use Nix 0.8-style fixed outputs.
svn path=/nixpkgs/trunk/; revision=2257
This commit is contained in:
parent
419f172ddb
commit
cdaecff49f
2 changed files with 18 additions and 9 deletions
|
@ -4,10 +4,4 @@ header "downloading $out from $url"
|
|||
|
||||
curl --fail --location --max-redirs 20 "$url" > "$out"
|
||||
|
||||
actual=$(md5sum -b "$out" | cut -c1-32)
|
||||
if test "$actual" != "$md5"; then
|
||||
echo "hash is $actual, expected $md5"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
stopNest
|
||||
|
|
|
@ -1,11 +1,26 @@
|
|||
{stdenv, curl}: {url, md5}:
|
||||
# Argh, this thing is duplicated (more-or-less) in Nix (in corepkgs).
|
||||
# Need to find a way to combine them.
|
||||
|
||||
# Note that `curl' may be `null', in case of the native stdenv.
|
||||
{stdenv, curl}: # Note that `curl' may be `null', in case of the native stdenv.
|
||||
|
||||
{url, outputHash ? "", outputHashAlgo ? "", md5 ? "", sha1 ? "", sha256 ? ""}:
|
||||
|
||||
assert (outputHash != "" && outputHashAlgo != "")
|
||||
|| md5 != "" || sha1 != "" || sha256 != "";
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = baseNameOf (toString url);
|
||||
builder = ./builder.sh;
|
||||
buildInputs = [curl];
|
||||
|
||||
# Compatibility with Nix <= 0.7.
|
||||
id = md5;
|
||||
inherit url md5;
|
||||
|
||||
# New-style output content requirements.
|
||||
outputHashAlgo = if outputHashAlgo != "" then outputHashAlgo else
|
||||
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;
|
||||
|
||||
inherit url;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue