summaryrefslogtreecommitdiffstats
path: root/pkgs/build-support/prefer-remote-fetch/default.nix
blob: c39caf4d6b4df71860e6339263ad3ea26f278adc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# 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:
let
  preferLocal =
    orig:
    self.lib.extendMkDerivation {
      constructDrv = orig;
      extendDrvArgs =
        finalAttrs:
        {
          preferLocalBuild ? false,
          ...
        }:
        {
          inherit preferLocalBuild;
        };
    };

in
{
  binary-cache = preferLocal super.binary-cache;
  buildenv = preferLocal super.buildenv;
  fetchfossil = preferLocal super.fetchfossil;
  fetchdocker = preferLocal super.fetchdocker;
  fetchgit = (preferLocal super.fetchgit) // {
    inherit (super.fetchgit) getRevWithTag;
  };
  fetchgx = preferLocal super.fetchgx;
  fetchhg = preferLocal super.fetchhg;
  fetchipfs = preferLocal super.fetchipfs;
  fetchrepoproject = preferLocal super.fetchrepoproject;
  fetchs3 = preferLocal super.fetchs3;
  fetchsvn = preferLocal super.fetchsvn;
  fetchurl = preferLocal super.fetchurl;
  mkNugetSource = preferLocal super.mkNugetSource;
}