Skip to content

Commit aeb803d

Browse files
author
eldritch horrors
committed
Merge pull request NixOS#8047 from lovesegfault/always-allow-substitutes
feat: add always-allow-substitutes (cherry picked from commit da2b59a) Change-Id: I50481cd8fe643c673c610fec28bad84519a4d650
1 parent 6897e23 commit aeb803d

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

doc/manual/src/language/advanced-attributes.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ Derivations can declare some infrequently used optional attributes.
261261
useful for very trivial derivations (such as `writeText` in Nixpkgs)
262262
that are cheaper to build than to substitute from a binary cache.
263263
264+
You may disable the effects of this attibute by enabling the
265+
`always-allow-substitutes` configuration option in Nix.
266+
264267
> **Note**
265268
>
266269
> You need to have a builder configured which satisfies the

src/libstore/globals.hh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,14 @@ public:
261261
For the exact format and examples, see [the manual chapter on remote builds](../advanced-topics/distributed-builds.md)
262262
)"};
263263

264+
Setting<bool> alwaysAllowSubstitutes{
265+
this, false, "always-allow-substitutes",
266+
R"(
267+
If set to `true`, Nix will ignore the `allowSubstitutes` attribute in
268+
derivations and always attempt to use available substituters.
269+
For more information on `allowSubstitutes`, see [the manual chapter on advanced attributes](../language/advanced-attributes.md).
270+
)"};
271+
264272
Setting<bool> buildersUseSubstitutes{
265273
this, false, "builders-use-substitutes",
266274
R"(

src/libstore/parsed-derivations.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ bool ParsedDerivation::willBuildLocally(Store & localStore) const
122122

123123
bool ParsedDerivation::substitutesAllowed() const
124124
{
125-
return getBoolAttr("allowSubstitutes", true);
125+
return settings.alwaysAllowSubstitutes ? true : getBoolAttr("allowSubstitutes", true);
126126
}
127127

128128
bool ParsedDerivation::useUidRange() const

0 commit comments

Comments
 (0)