From c4df7472676cac9bf5243ee8bc7cd0017f91a28d Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 8 Jul 2012 10:19:17 -0400 Subject: Resurrect old corepkgs fetchurl --- corepkgs/fetchurl/Makefile.am | 11 +++++++++++ corepkgs/fetchurl/builder.sh.in | 5 +++++ corepkgs/fetchurl/default.nix | 23 +++++++++++++++++++++++ 3 files changed, 39 insertions(+) create mode 100644 corepkgs/fetchurl/Makefile.am create mode 100644 corepkgs/fetchurl/builder.sh.in create mode 100644 corepkgs/fetchurl/default.nix (limited to 'corepkgs') diff --git a/corepkgs/fetchurl/Makefile.am b/corepkgs/fetchurl/Makefile.am new file mode 100644 index 000000000000..3cb63e0ce177 --- /dev/null +++ b/corepkgs/fetchurl/Makefile.am @@ -0,0 +1,11 @@ +all-local: builder.sh + +install-exec-local: + $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs + $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/fetchurl + $(INSTALL_DATA) default.nix $(DESTDIR)$(datadir)/nix/corepkgs/fetchurl + $(INSTALL_PROGRAM) builder.sh $(DESTDIR)$(datadir)/nix/corepkgs/fetchurl + +include ../../substitute.mk + +EXTRA_DIST = default.nix builder.sh.in diff --git a/corepkgs/fetchurl/builder.sh.in b/corepkgs/fetchurl/builder.sh.in new file mode 100644 index 000000000000..02abb18b4b77 --- /dev/null +++ b/corepkgs/fetchurl/builder.sh.in @@ -0,0 +1,5 @@ +#! @shell@ -e + +echo "downloading $url into $out" + +@curl@ --fail --location --max-redirs 20 "$url" > "$out" diff --git a/corepkgs/fetchurl/default.nix b/corepkgs/fetchurl/default.nix new file mode 100644 index 000000000000..37f01b55eeb0 --- /dev/null +++ b/corepkgs/fetchurl/default.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 From 40c01ec4671c09a6ceb61ef201dad48156000075 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 8 Jul 2012 10:22:26 -0400 Subject: corepkgs/config.nix.in: We'll need curl --- corepkgs/config.nix.in | 1 + 1 file changed, 1 insertion(+) (limited to 'corepkgs') diff --git a/corepkgs/config.nix.in b/corepkgs/config.nix.in index b324d732a1a2..98924c4ef779 100644 --- a/corepkgs/config.nix.in +++ b/corepkgs/config.nix.in @@ -9,5 +9,6 @@ in { bzip2 = fromEnv "NIX_BZIP2" "@bzip2@"; tar = "@tar@"; tr = "@tr@"; + curl = "@curl@"; nixBinDir = fromEnv "NIX_BIN_DIR" "@bindir@"; } -- cgit 1.4.1 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 +++++++++++++++++++++++ corepkgs/fetchurl.sh | 5 +++++ corepkgs/fetchurl/builder.sh.in | 5 ----- corepkgs/fetchurl/default.nix | 23 ----------------------- 4 files changed, 28 insertions(+), 28 deletions(-) create mode 100644 corepkgs/fetchurl.nix create mode 100644 corepkgs/fetchurl.sh delete mode 100644 corepkgs/fetchurl/builder.sh.in delete mode 100644 corepkgs/fetchurl/default.nix (limited to 'corepkgs') 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; +} diff --git a/corepkgs/fetchurl.sh b/corepkgs/fetchurl.sh new file mode 100644 index 000000000000..02abb18b4b77 --- /dev/null +++ b/corepkgs/fetchurl.sh @@ -0,0 +1,5 @@ +#! @shell@ -e + +echo "downloading $url into $out" + +@curl@ --fail --location --max-redirs 20 "$url" > "$out" diff --git a/corepkgs/fetchurl/builder.sh.in b/corepkgs/fetchurl/builder.sh.in deleted file mode 100644 index 02abb18b4b77..000000000000 --- a/corepkgs/fetchurl/builder.sh.in +++ /dev/null @@ -1,5 +0,0 @@ -#! @shell@ -e - -echo "downloading $url into $out" - -@curl@ --fail --location --max-redirs 20 "$url" > "$out" diff --git a/corepkgs/fetchurl/default.nix b/corepkgs/fetchurl/default.nix deleted file mode 100644 index 37f01b55eeb0..000000000000 --- a/corepkgs/fetchurl/default.nix +++ /dev/null @@ -1,23 +0,0 @@ -# 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 From fd2630e1f739c12b4a1f01159e1230d9fb7fb997 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 8 Jul 2012 10:26:50 -0400 Subject: Remove old fetchurl makefile --- corepkgs/fetchurl/Makefile.am | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 corepkgs/fetchurl/Makefile.am (limited to 'corepkgs') diff --git a/corepkgs/fetchurl/Makefile.am b/corepkgs/fetchurl/Makefile.am deleted file mode 100644 index 3cb63e0ce177..000000000000 --- a/corepkgs/fetchurl/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -all-local: builder.sh - -install-exec-local: - $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs - $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs/fetchurl - $(INSTALL_DATA) default.nix $(DESTDIR)$(datadir)/nix/corepkgs/fetchurl - $(INSTALL_PROGRAM) builder.sh $(DESTDIR)$(datadir)/nix/corepkgs/fetchurl - -include ../../substitute.mk - -EXTRA_DIST = default.nix builder.sh.in -- cgit 1.4.1 From 9d94a28bed39d0e9bcb3532cdac1a254a44efa97 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 8 Jul 2012 10:29:18 -0400 Subject: The fetchurl builder is now fetchurl.sh --- corepkgs/fetchurl.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'corepkgs') diff --git a/corepkgs/fetchurl.nix b/corepkgs/fetchurl.nix index 37f01b55eeb0..c85c007ff218 100644 --- a/corepkgs/fetchurl.nix +++ b/corepkgs/fetchurl.nix @@ -8,7 +8,7 @@ assert (outputHash != "" && outputHashAlgo != "") derivation { name = baseNameOf (toString url); - builder = ./builder.sh; + builder = ./fetchurl.sh; # Compatibility with Nix <= 0.7. id = md5; -- cgit 1.4.1 From a994eb92a4e0d8744b244cd421c855d76831bdc0 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 8 Jul 2012 10:32:12 -0400 Subject: corepkgs/fetchurl.sh: Use config.nix's curl --- corepkgs/fetchurl.nix | 4 +++- corepkgs/fetchurl.sh | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'corepkgs') diff --git a/corepkgs/fetchurl.nix b/corepkgs/fetchurl.nix index c85c007ff218..758212015aee 100644 --- a/corepkgs/fetchurl.nix +++ b/corepkgs/fetchurl.nix @@ -1,3 +1,5 @@ +with import ; + # Argh, this thing is duplicated (more-or-less) in Nixpkgs. Need to # find a way to combine them. @@ -19,5 +21,5 @@ derivation { outputHash = if outputHash != "" then outputHash else if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5; - inherit system url; + inherit system url curl; } diff --git a/corepkgs/fetchurl.sh b/corepkgs/fetchurl.sh index 02abb18b4b77..608a946ab8d8 100644 --- a/corepkgs/fetchurl.sh +++ b/corepkgs/fetchurl.sh @@ -2,4 +2,4 @@ echo "downloading $url into $out" -@curl@ --fail --location --max-redirs 20 "$url" > "$out" +$curl --fail --location --max-redirs 20 "$url" > "$out" -- cgit 1.4.1 From f863673a903d17566be8a03bcf8655d9912428bd Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 8 Jul 2012 10:33:40 -0400 Subject: corepkgs/fetchurl: Call the shell directly instead of using the shebang --- corepkgs/fetchurl.nix | 3 ++- corepkgs/fetchurl.sh | 2 -- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'corepkgs') diff --git a/corepkgs/fetchurl.nix b/corepkgs/fetchurl.nix index 758212015aee..72107294c72a 100644 --- a/corepkgs/fetchurl.nix +++ b/corepkgs/fetchurl.nix @@ -10,7 +10,8 @@ assert (outputHash != "" && outputHashAlgo != "") derivation { name = baseNameOf (toString url); - builder = ./fetchurl.sh; + builder = shell; + args = [ "-e" ./fetchurl.sh ]; # Compatibility with Nix <= 0.7. id = md5; diff --git a/corepkgs/fetchurl.sh b/corepkgs/fetchurl.sh index 608a946ab8d8..6d35794cafbe 100644 --- a/corepkgs/fetchurl.sh +++ b/corepkgs/fetchurl.sh @@ -1,5 +1,3 @@ -#! @shell@ -e - echo "downloading $url into $out" $curl --fail --location --max-redirs 20 "$url" > "$out" -- cgit 1.4.1 From 543bf742c9391bc49f59c52adb042bbd3c5e2364 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 8 Jul 2012 10:55:35 -0400 Subject: corepkgs: distribute fetchurl files --- corepkgs/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'corepkgs') diff --git a/corepkgs/Makefile.am b/corepkgs/Makefile.am index a8de601657b1..94d37357233b 100644 --- a/corepkgs/Makefile.am +++ b/corepkgs/Makefile.am @@ -1,6 +1,6 @@ all-local: config.nix -files = nar.nix buildenv.nix buildenv.pl unpack-channel.nix unpack-channel.sh derivation.nix +files = nar.nix buildenv.nix buildenv.pl unpack-channel.nix unpack-channel.sh derivation.nix fetchurl.nix fetchurl.sh install-exec-local: $(INSTALL) -d $(DESTDIR)$(datadir)/nix/corepkgs -- cgit 1.4.1 From 53f52c2111bcf339bdaab703a263fd2c001da51c Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 8 Jul 2012 11:04:11 -0400 Subject: corepkgs/fetchurl: the 'system' argument can be optional --- corepkgs/fetchurl.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'corepkgs') diff --git a/corepkgs/fetchurl.nix b/corepkgs/fetchurl.nix index 72107294c72a..3d467fe187b0 100644 --- a/corepkgs/fetchurl.nix +++ b/corepkgs/fetchurl.nix @@ -3,7 +3,7 @@ with import ; # 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 ? ""}: +{system ? builtins.currentSystem, url, outputHash ? "", outputHashAlgo ? "", md5 ? "", sha1 ? "", sha256 ? ""}: assert (outputHash != "" && outputHashAlgo != "") || md5 != "" || sha1 != "" || sha256 != ""; -- cgit 1.4.1 From a2865f6b3d2af5593a100cba5c86ba62a1330bdb Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 8 Jul 2012 11:11:02 -0400 Subject: corepkgs/fetchurl: Build locally and outside of the chroot --- corepkgs/fetchurl.nix | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'corepkgs') diff --git a/corepkgs/fetchurl.nix b/corepkgs/fetchurl.nix index 3d467fe187b0..91870a70c18c 100644 --- a/corepkgs/fetchurl.nix +++ b/corepkgs/fetchurl.nix @@ -23,4 +23,10 @@ derivation { if sha256 != "" then sha256 else if sha1 != "" then sha1 else md5; inherit system url curl; + + # No need to double the amount of network traffic + preferLocalBuild = true; + + # Don't build in a chroot because Nix's dependencies may not be there. + __noChroot = true; } -- cgit 1.4.1 From 035aa114037857b51968e62a1176f4086e2477ec Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sun, 8 Jul 2012 11:14:57 -0400 Subject: Remove obsolete comment --- corepkgs/fetchurl.nix | 3 --- 1 file changed, 3 deletions(-) (limited to 'corepkgs') diff --git a/corepkgs/fetchurl.nix b/corepkgs/fetchurl.nix index 91870a70c18c..29cf6720b3f1 100644 --- a/corepkgs/fetchurl.nix +++ b/corepkgs/fetchurl.nix @@ -1,8 +1,5 @@ with import ; -# Argh, this thing is duplicated (more-or-less) in Nixpkgs. Need to -# find a way to combine them. - {system ? builtins.currentSystem, url, outputHash ? "", outputHashAlgo ? "", md5 ? "", sha1 ? "", sha256 ? ""}: assert (outputHash != "" && outputHashAlgo != "") -- cgit 1.4.1 From 2dd3117c2723ff08c6226b71d569bcea50d58ad1 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 9 Jul 2012 15:48:55 -0400 Subject: Inline fetchurl.sh --- corepkgs/Makefile.am | 2 +- corepkgs/fetchurl.nix | 17 ++++++++++++----- corepkgs/fetchurl.sh | 3 --- 3 files changed, 13 insertions(+), 9 deletions(-) delete mode 100644 corepkgs/fetchurl.sh (limited to 'corepkgs') diff --git a/corepkgs/Makefile.am b/corepkgs/Makefile.am index 94d37357233b..729d15e7b191 100644 --- a/corepkgs/Makefile.am +++ b/corepkgs/Makefile.am @@ -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 diff --git a/corepkgs/fetchurl.nix b/corepkgs/fetchurl.nix index 29cf6720b3f1..8fc1c5970bc5 100644 --- a/corepkgs/fetchurl.nix +++ b/corepkgs/fetchurl.nix @@ -5,13 +5,20 @@ with import ; 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; diff --git a/corepkgs/fetchurl.sh b/corepkgs/fetchurl.sh deleted file mode 100644 index 6d35794cafbe..000000000000 --- a/corepkgs/fetchurl.sh +++ /dev/null @@ -1,3 +0,0 @@ -echo "downloading $url into $out" - -$curl --fail --location --max-redirs 20 "$url" > "$out" -- cgit 1.4.1 From eae802459d7639a69baec555264f394adad043c0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 9 Jul 2012 15:49:20 -0400 Subject: Pass --insecure to curl so that https works --- corepkgs/fetchurl.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'corepkgs') diff --git a/corepkgs/fetchurl.nix b/corepkgs/fetchurl.nix index 8fc1c5970bc5..4a0ae827995d 100644 --- a/corepkgs/fetchurl.nix +++ b/corepkgs/fetchurl.nix @@ -10,7 +10,7 @@ let builder = builtins.toFile "fetchurl.sh" '' echo "downloading $url into $out" - ${curl} --fail --location --max-redirs 20 "$url" > "$out" + ${curl} --fail --location --max-redirs 20 --insecure "$url" > "$out" ''; in -- cgit 1.4.1