Inline fetchurl.sh
This commit is contained in:
parent
51f9f9924b
commit
2dd3117c27
3 changed files with 13 additions and 9 deletions
|
@ -1,6 +1,6 @@
|
|||
all-local: config.nix
|
||||
|
||||
files = nar.nix buildenv.nix buildenv.pl unpack-channel.nix unpack-channel.sh derivation.nix fetchurl.nix fetchurl.sh
|
||||
files = nar.nix buildenv.nix buildenv.pl unpack-channel.nix unpack-channel.sh derivation.nix fetchurl.nix
|
||||
|
||||
install-exec-local:
|
||||
$(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs
|
||||
|
|
|
@ -5,13 +5,20 @@ with import <nix/config.nix>;
|
|||
assert (outputHash != "" && outputHashAlgo != "")
|
||||
|| md5 != "" || sha1 != "" || sha256 != "";
|
||||
|
||||
let
|
||||
|
||||
builder = builtins.toFile "fetchurl.sh"
|
||||
''
|
||||
echo "downloading $url into $out"
|
||||
${curl} --fail --location --max-redirs 20 "$url" > "$out"
|
||||
'';
|
||||
|
||||
in
|
||||
|
||||
derivation {
|
||||
name = baseNameOf (toString url);
|
||||
builder = shell;
|
||||
args = [ "-e" ./fetchurl.sh ];
|
||||
|
||||
# Compatibility with Nix <= 0.7.
|
||||
id = md5;
|
||||
args = [ "-e" builder ];
|
||||
|
||||
# New-style output content requirements.
|
||||
outputHashAlgo = if outputHashAlgo != "" then outputHashAlgo else
|
||||
|
@ -19,7 +26,7 @@ derivation {
|
|||
outputHash = if outputHash != "" then outputHash else
|
||||
if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5;
|
||||
|
||||
inherit system url curl;
|
||||
inherit system url;
|
||||
|
||||
# No need to double the amount of network traffic
|
||||
preferLocalBuild = true;
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
echo "downloading $url into $out"
|
||||
|
||||
$curl --fail --location --max-redirs 20 "$url" > "$out"
|
Loading…
Reference in a new issue