diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2005-02-21 15:52:37 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2005-02-21 15:52:37 +0000 |
commit | cdaecff49f9b06d74de87e217659c13b2b2bba98 (patch) | |
tree | 94203cbed8a8367319c8e4a28a698bc15632428d /pkgs/build-support/fetchurl/default.nix | |
parent | 419f172ddb6959976b185722d535bc71f43e2923 (diff) | |
download | nixlib-cdaecff49f9b06d74de87e217659c13b2b2bba98.tar nixlib-cdaecff49f9b06d74de87e217659c13b2b2bba98.tar.gz nixlib-cdaecff49f9b06d74de87e217659c13b2b2bba98.tar.bz2 nixlib-cdaecff49f9b06d74de87e217659c13b2b2bba98.tar.lz nixlib-cdaecff49f9b06d74de87e217659c13b2b2bba98.tar.xz nixlib-cdaecff49f9b06d74de87e217659c13b2b2bba98.tar.zst nixlib-cdaecff49f9b06d74de87e217659c13b2b2bba98.zip |
* Use Nix 0.8-style fixed outputs.
svn path=/nixpkgs/trunk/; revision=2257
Diffstat (limited to 'pkgs/build-support/fetchurl/default.nix')
-rw-r--r-- | pkgs/build-support/fetchurl/default.nix | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/pkgs/build-support/fetchurl/default.nix b/pkgs/build-support/fetchurl/default.nix index b40b90985ac3..385a0a4c650c 100644 --- a/pkgs/build-support/fetchurl/default.nix +++ b/pkgs/build-support/fetchurl/default.nix @@ -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; } |