Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkgs/build-support/binary-cache/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
nix,
xz,
zstd,

# Used in `pkgs/build-support/prefer-remote-fetch/default.nix`
preferLocalBuild ? true,
}:

# This function is for creating a flat-file binary cache, i.e. the kind created by
Expand Down Expand Up @@ -34,7 +37,7 @@ stdenv.mkDerivation {

exportReferencesGraph.closure = rootPaths;

preferLocalBuild = true;
inherit preferLocalBuild;

nativeBuildInputs = [
coreutils
Expand Down
5 changes: 4 additions & 1 deletion pkgs/build-support/buildenv/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
lib,
replaceVars,
writeClosure,

# Used in `pkgs/build-support/prefer-remote-fetch/default.nix`
preferLocalBuild ? true,
}:

let
Expand Down Expand Up @@ -104,10 +107,10 @@ lib.makeOverridable (
postBuild
nativeBuildInputs
buildInputs
preferLocalBuild
;
pkgs = builtins.toJSON chosenOutputs;
extraPathsFrom = lib.optional includeClosures (writeClosure pathsForClosure);
preferLocalBuild = true;
allowSubstitutes = false;
# XXX: The size is somewhat arbitrary
passAsFile = if builtins.stringLength pkgs >= 128 * 1024 then [ "pkgs" ] else [ ];
Expand Down
5 changes: 4 additions & 1 deletion pkgs/build-support/dotnet/make-nuget-source/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
lib,
python3,
stdenvNoCC,

# Used in `pkgs/build-support/prefer-remote-fetch/default.nix`
preferLocalBuild ? true,
}:

{
Expand All @@ -14,7 +17,7 @@
stdenvNoCC.mkDerivation (
lib.recursiveUpdate
{
inherit name;
inherit name preferLocalBuild;

nativeBuildInputs = [ python3 ];

Expand Down
5 changes: 4 additions & 1 deletion pkgs/build-support/fetchdocker/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
bash,
gnutar,
writeText,

# Used in `pkgs/build-support/prefer-remote-fetch/default.nix`
preferLocalBuild ? true,
}:
let
stripScheme = builtins.replaceStrings [ "https://" "http://" ] [ "" "" ];
Expand Down Expand Up @@ -59,13 +62,13 @@ in
stdenv.mkDerivation {
builder = ./fetchdocker-builder.sh;
buildInputs = [ coreutils ];
preferLocalBuild = true;

inherit
name
imageName
repository
tag
preferLocalBuild
;
inherit
bash
Expand Down
6 changes: 4 additions & 2 deletions pkgs/build-support/fetchfossil/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
lib,
fossil,
cacert,

# Used in `pkgs/build-support/prefer-remote-fetch/default.nix`
preferLocalBuild ? true,
}:

lib.fetchers.withNormalizedHash { } (
Expand All @@ -29,7 +32,6 @@ lib.fetchers.withNormalizedHash { } (
inherit outputHash outputHashAlgo;
outputHashMode = "recursive";

inherit url rev;
preferLocalBuild = true;
inherit url rev preferLocalBuild;
}
)
6 changes: 5 additions & 1 deletion pkgs/build-support/fetchgit/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
git,
git-lfs,
cacert,

# Used in `pkgs/build-support/prefer-remote-fetch/default.nix`
preferLocalBuild ? true,
}:

let
preferLocalBuildDefault = preferLocalBuild;
urlToName =
{
url,
Expand Down Expand Up @@ -68,7 +72,7 @@ lib.makeOverridable (
# Shell code executed after the file has been fetched
# successfully. This can do things like check or transform the file.
postFetch ? "",
preferLocalBuild ? true,
preferLocalBuild ? preferLocalBuildDefault,
fetchLFS ? false,
# Shell code to build a netrc file for BASIC auth
netrcPhase ? null,
Expand Down
7 changes: 4 additions & 3 deletions pkgs/build-support/fetchgx/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
gx-go,
go,
cacert,

# Used in `pkgs/build-support/prefer-remote-fetch/default.nix`
preferLocalBuild ? true,
}:

lib.fetchers.withNormalizedHash { } (
Expand All @@ -17,7 +20,7 @@ lib.fetchers.withNormalizedHash { } (

stdenvNoCC.mkDerivation {
name = "${name}-gxdeps";
inherit src;
inherit src preferLocalBuild;

nativeBuildInputs = [
cacert
Expand All @@ -42,7 +45,5 @@ lib.fetchers.withNormalizedHash { } (
installPhase = ''
mv vendor $out
'';

preferLocalBuild = true;
}
)
8 changes: 7 additions & 1 deletion pkgs/build-support/fetchhg/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
lib,
stdenvNoCC,
mercurial,

# Used in `pkgs/build-support/prefer-remote-fetch/default.nix`
preferLocalBuild ? true,
}:
let
preferLocalBuildDefault = preferLocalBuild;
in

lib.extendMkDerivation {
constructDrv = stdenvNoCC.mkDerivation;
Expand All @@ -16,7 +22,7 @@ lib.extendMkDerivation {
sha256 ? null,
hash ? null,
fetchSubrepos ? false,
preferLocalBuild ? true,
preferLocalBuild ? preferLocalBuildDefault,
}:
# TODO: statically check if mercurial has https support if the url starts with https.
{
Expand Down
10 changes: 9 additions & 1 deletion pkgs/build-support/fetchipfs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
lib,
stdenv,
curl,

# Used in `pkgs/build-support/prefer-remote-fetch/default.nix`
preferLocalBuild ? true,
}:

let
preferLocalBuildDefault = preferLocalBuild;
in

lib.fetchers.withNormalizedHash
{
hashTypes = [
Expand All @@ -21,7 +29,7 @@ lib.fetchers.withNormalizedHash
meta ? { },
port ? "8080",
postFetch ? "",
preferLocalBuild ? true,
preferLocalBuild ? preferLocalBuildDefault,
}:
stdenv.mkDerivation {
name = ipfs;
Expand Down
5 changes: 4 additions & 1 deletion pkgs/build-support/fetchrepoproject/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
gitRepo,
cacert,
copyPathsToStore,

# Used in `pkgs/build-support/prefer-remote-fetch/default.nix`
preferLocalBuild ? true,
}:
lib.fetchers.withNormalizedHash { } (
{
Expand Down Expand Up @@ -58,6 +61,7 @@ lib.fetchers.withNormalizedHash { } (
inherit
cacert
manifest
preferLocalBuild
rev
repoRepoURL
repoRepoRev
Expand All @@ -67,7 +71,6 @@ lib.fetchers.withNormalizedHash { } (
inherit outputHash outputHashAlgo;
outputHashMode = "recursive";

preferLocalBuild = true;
enableParallelBuilding = true;

impureEnvVars = fetchers.proxyImpureEnvVars ++ [
Expand Down
7 changes: 4 additions & 3 deletions pkgs/build-support/fetchs3/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
lib,
runCommand,
awscli,

# Used in `pkgs/build-support/prefer-remote-fetch/default.nix`
preferLocalBuild ? true,
}:
lib.fetchers.withNormalizedHash { } (
{
Expand Down Expand Up @@ -35,11 +38,9 @@ lib.fetchers.withNormalizedHash { } (
{
nativeBuildInputs = [ awscli ];

inherit outputHash outputHashAlgo;
inherit outputHash outputHashAlgo preferLocalBuild;
outputHashMode = if recursiveHash then "recursive" else "flat";

preferLocalBuild = true;

AWS_DEFAULT_REGION = region;
}
// credentialAttrs
Expand Down
6 changes: 5 additions & 1 deletion pkgs/build-support/fetchsvn/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@
glibcLocales,
sshSupport ? true,
openssh ? null,

# Used in `pkgs/build-support/prefer-remote-fetch/default.nix`
preferLocalBuild ? true,
}:

let
preferLocalBuildDefault = preferLocalBuild;
repoToName =
url: rev:
let
Expand Down Expand Up @@ -48,7 +52,7 @@ in
hash ? "",
ignoreExternals ? false,
ignoreKeywords ? false,
preferLocalBuild ? true,
preferLocalBuild ? preferLocalBuildDefault,
}:

assert sshSupport -> openssh != null;
Expand Down
32 changes: 13 additions & 19 deletions pkgs/build-support/prefer-remote-fetch/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,17 @@
# $ echo 'self: super: super.prefer-remote-fetch self super' > ~/.config/nixpkgs/overlays/prefer-remote-fetch.nix
#
self: super: {
binary-cache = args: super.binary-cache ({ preferLocalBuild = false; } // args);
buildenv = args: super.buildenv ({ preferLocalBuild = false; } // args);
fetchfossil = args: super.fetchfossil ({ preferLocalBuild = false; } // args);
fetchdocker = args: super.fetchdocker ({ preferLocalBuild = false; } // args);
fetchgit = args: super.fetchgit ({ preferLocalBuild = false; } // args);
fetchgx = args: super.fetchgx ({ preferLocalBuild = false; } // args);
fetchhg = args: super.fetchhg ({ preferLocalBuild = false; } // args);
fetchipfs = args: super.fetchipfs ({ preferLocalBuild = false; } // args);
fetchrepoproject = args: super.fetchrepoproject ({ preferLocalBuild = false; } // args);
fetchs3 = args: super.fetchs3 ({ preferLocalBuild = false; } // args);
fetchsvn = args: super.fetchsvn ({ preferLocalBuild = false; } // args);
fetchurl =
fpArgs:
super.fetchurl (
super.lib.extends (finalAttrs: args: { preferLocalBuild = args.preferLocalBuild or false; }) (
super.lib.toFunction fpArgs
)
);
mkNugetSource = args: super.mkNugetSource ({ preferLocalBuild = false; } // args);
binary-cache = super.binary-cache.override { preferLocalBuild = false; };
buildenv = super.buildenv.override { preferLocalBuild = false; };
fetchfossil = super.fetchfossil.override { preferLocalBuild = false; };
fetchdocker = super.fetchdocker.override { preferLocalBuild = false; };
fetchgit = super.fetchgit.override { preferLocalBuild = false; };
fetchgx = super.fetchgx.override { preferLocalBuild = false; };
fetchhg = super.fetchhg.override { preferLocalBuild = false; };
fetchipfs = super.fetchipfs.override { preferLocalBuild = false; };
fetchrepoproject = super.fetchrepoproject.override { preferLocalBuild = false; };
fetchs3 = super.fetchs3.override { preferLocalBuild = false; };
fetchsvn = super.fetchsvn.override { preferLocalBuild = false; };
fetchurl = super.fetchurl.override { preferLocalBuild = false; };
mkNugetSource = super.mkNugetSource.override { preferLocalBuild = false; };
}
Loading