about summary refs log tree commit diff
path: root/pkgs/build-support/prefer-remote-fetch
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2018-12-31 08:10:28 +0100
committerJörg Thalheim <joerg@thalheim.io>2019-01-18 14:41:10 +0000
commiteac6797380af1f0927ab683e2375429826d34e76 (patch)
tree4d292ad4c8eac2df780174bbcbe143802be68de9 /pkgs/build-support/prefer-remote-fetch
parent487d2a7ccdf520e60b77809681e4ca377a7b741d (diff)
prefer-fetch-remote: an overlay to fetch on remote builders
This is useful when running tools like NixOps or nix-review
on workstations where the upload to the builder is significantly
slower then downloading the source on the builder itself.
Diffstat (limited to 'pkgs/build-support/prefer-remote-fetch')
-rw-r--r--pkgs/build-support/prefer-remote-fetch/default.nix19
1 files changed, 19 insertions, 0 deletions
diff --git a/pkgs/build-support/prefer-remote-fetch/default.nix b/pkgs/build-support/prefer-remote-fetch/default.nix
new file mode 100644
index 0000000000000..2e55e3707421e
--- /dev/null
+++ b/pkgs/build-support/prefer-remote-fetch/default.nix
@@ -0,0 +1,19 @@
+# An overlay that download sources on remote builder.
+# This is useful when the evaluating machine has a slow
+# upload while the builder can fetch faster directly from the source.
+# Usage: Put the following snippet in your usual overlay definition:
+#
+#   self: super:
+#     (super.prefer-remote-fetch self super)
+# Full configuration example for your own account:
+#
+# $ mkdir ~/.config/nixpkgs/overlays/
+# $ echo 'self: super: super.prefer-remote-fetch self super' > ~/.config/nixpkgs/overlays/prefer-remote-fetch.nix
+#
+self: super: {
+  fetchurl = args: super.fetchurl (args // { preferLocalBuild = false; });
+  fetchgit = args: super.fetchgit (args // { preferLocalBuild = false; });
+  fetchhg = args: super.fetchhg (args // { preferLocalBuild = false; });
+  fetchsvn = args: super.fetchsvn (args // { preferLocalBuild = false; });
+  fetchipfs = args: super.fetchipfs (args // { preferLocalBuild = false; });
+}