From 6450f5699fa824934b92ca7ba1d345c36e9c009a Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 8 Jul 2012 10:25:58 -0400 Subject: Move fetchurl files out of their subdirectory --- corepkgs/fetchurl.nix | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 corepkgs/fetchurl.nix (limited to 'corepkgs/fetchurl.nix') diff --git a/corepkgs/fetchurl.nix b/corepkgs/fetchurl.nix new file mode 100644 index 000000000000..37f01b55eeb0 --- /dev/null +++ b/corepkgs/fetchurl.nix @@ -0,0 +1,23 @@ +# Argh, this thing is duplicated (more-or-less) in Nixpkgs. Need to +# find a way to combine them. + +{system, url, outputHash ? "", outputHashAlgo ? "", md5 ? "", sha1 ? "", sha256 ? ""}: + +assert (outputHash != "" && outputHashAlgo != "") + || md5 != "" || sha1 != "" || sha256 != ""; + +derivation { + name = baseNameOf (toString url); + builder = ./builder.sh; + + # 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"; + outputHash = if outputHash != "" then outputHash else + if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5; + + inherit system url; +} -- cgit 1.4.1