fetchurl: Remove some compatibility hacks

This commit is contained in:
Eelco Dolstra 2013-02-06 15:00:33 +01:00
parent 6b702f23ea
commit f337ab4430
2 changed files with 5 additions and 25 deletions

View file

@ -29,20 +29,6 @@ tryDownload() {
finish() {
# On old versions of Nix, verify the hash of the output. On newer
# versions, Nix verifies the hash itself.
if test "$NIX_OUTPUT_CHECKED" != "1"; then
if test "$outputHashAlgo" != "md5"; then
echo "hashes other than md5 are unsupported in Nix <= 0.7, upgrade to Nix 0.8"
exit 1
fi
actual=$(md5sum -b "$out" | cut -c1-32)
if test "$actual" != "$id"; then
echo "hash is $actual, expected $id"
exit 1
fi
fi
stopNest
exit 0
}

View file

@ -1,4 +1,4 @@
{stdenv, curl}: # 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.
let
@ -17,10 +17,7 @@ let
# Names of the master sites that are mirrored (i.e., "sourceforge",
# "gnu", etc.).
sites =
if builtins ? attrNames
then builtins.attrNames mirrors
else [] /* backwards compatibility */;
sites = builtins.attrNames mirrors;
impureEnvVars = [
# We borrow these environment variables from the caller to allow
@ -38,7 +35,7 @@ let
] ++ (map (site: "NIX_MIRRORS_${site}") sites);
in
{ # URL to fetch.
url ? ""
@ -79,9 +76,9 @@ stdenv.mkDerivation {
if showURLs then "urls"
else if name != "" then name
else baseNameOf (toString (builtins.head urls_));
builder = ./builder.sh;
buildInputs = [curl];
urls = urls_;
@ -90,9 +87,6 @@ stdenv.mkDerivation {
# (http://nixos.org/tarballs) over the original URLs.
preferHashedMirrors = true;
# Compatibility with Nix <= 0.7.
id = md5;
# New-style output content requirements.
outputHashAlgo = if outputHashAlgo != "" then outputHashAlgo else
if sha256 != "" then "sha256" else if sha1 != "" then "sha1" else "md5";