Merge pull request #1788 from k0001/rem-subs-1

nix.conf: builders-use-substitutes
This commit is contained in:
Eelco Dolstra 2018-01-10 11:31:51 +01:00 committed by GitHub
commit 874ad7d9f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 2 deletions

View file

@ -321,6 +321,20 @@ false</literal>.</para>
</varlistentry> </varlistentry>
<varlistentry><term><literal>builders-use-substitutes</literal></term>
<listitem><para>If set to <literal>true</literal>, Nix will instruct
remote build machines to use their own binary substitutes if available. In
practical terms, this means that remote hosts will fetch as many build
dependencies as possible from their own substitutes (e.g, from
<literal>cache.nixos.org</literal>), instead of waiting for this host to
upload them all. This can drastically reduce build times if the network
connection between this computer and the remote build host is slow. Defaults
to <literal>false</literal>.</para></listitem>
</varlistentry>
<varlistentry><term><literal>fallback</literal></term> <varlistentry><term><literal>fallback</literal></term>
<listitem><para>If set to <literal>true</literal>, Nix will fall <listitem><para>If set to <literal>true</literal>, Nix will fall

View file

@ -218,9 +218,11 @@ connected:
signal(SIGALRM, old); signal(SIGALRM, old);
} }
auto substitute = settings.buildersUseSubstitutes ? Substitute : NoSubstitute;
{ {
Activity act(*logger, lvlTalkative, actUnknown, fmt("copying dependencies to '%s'", storeUri)); Activity act(*logger, lvlTalkative, actUnknown, fmt("copying dependencies to '%s'", storeUri));
copyPaths(store, ref<Store>(sshStore), inputs, NoRepair, NoCheckSigs); copyPaths(store, ref<Store>(sshStore), inputs, NoRepair, NoCheckSigs, substitute);
} }
uploadLock = -1; uploadLock = -1;
@ -240,7 +242,7 @@ connected:
if (!missing.empty()) { if (!missing.empty()) {
Activity act(*logger, lvlTalkative, actUnknown, fmt("copying outputs from '%s'", storeUri)); Activity act(*logger, lvlTalkative, actUnknown, fmt("copying outputs from '%s'", storeUri));
setenv("NIX_HELD_LOCKS", concatStringsSep(" ", missing).c_str(), 1); /* FIXME: ugly */ setenv("NIX_HELD_LOCKS", concatStringsSep(" ", missing).c_str(), 1); /* FIXME: ugly */
copyPaths(ref<Store>(sshStore), store, missing, NoRepair, NoCheckSigs); copyPaths(ref<Store>(sshStore), store, missing, NoRepair, NoCheckSigs, substitute);
} }
return; return;

View file

@ -138,6 +138,11 @@ public:
Setting<std::string> builders{this, "@" + nixConfDir + "/machines", "builders", Setting<std::string> builders{this, "@" + nixConfDir + "/machines", "builders",
"A semicolon-separated list of build machines, in the format of nix.machines."}; "A semicolon-separated list of build machines, in the format of nix.machines."};
Setting<bool> buildersUseSubstitutes{this, false, "builders-use-substitutes",
"Whether build machines should use their own substitutes for obtaining "
"build dependencies if possible, rather than waiting for this host to "
"upload them."};
Setting<off_t> reservedSize{this, 8 * 1024 * 1024, "gc-reserved-space", Setting<off_t> reservedSize{this, 8 * 1024 * 1024, "gc-reserved-space",
"Amount of reserved disk space for the garbage collector."}; "Amount of reserved disk space for the garbage collector."};