Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nix.conf: add build-hook-use-substitutes #1228

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 14 additions & 0 deletions doc/manual/command-ref/conf-file.xml
Expand Up @@ -302,6 +302,20 @@ flag, e.g. <literal>--option gc-keep-outputs false</literal>.</para>
</varlistentry>


<varlistentry><term><literal>build-hook-use-substitutes</literal></term>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this name since "build hook" is just an implementation detail used by the distributed build mechanism.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build-remote-use-substitutes perhaps?


<listitem><para>If set to <literal>true</literal>, Nix will instruct
remote build hooks to use their own binary substitutes if available. In
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no such thing as "remote build hooks". The build hook is local.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"remote building hosts" perhaps?

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>build-fallback</literal></term>

<listitem><para>If set to <literal>true</literal>, Nix will fall
Expand Down
6 changes: 4 additions & 2 deletions src/build-remote/build-remote.cc
Expand Up @@ -268,7 +268,8 @@ int main (int argc, char * * argv)
}
alarm(0);
signal(SIGALRM, old);
copyPaths(store, ref<Store>(sshStore), inputs);
copyPaths(store, ref<Store>(sshStore), inputs,
settings.buildHookUseSubstitutes);
uploadLock = -1;

cerr << "building ‘" << drvPath << "’ on ‘" << hostName << "’\n";
Expand All @@ -277,7 +278,8 @@ int main (int argc, char * * argv)
std::remove_if(outputs.begin(), outputs.end(), [=](const Path & path) { return store->isValidPath(path); });
if (!outputs.empty()) {
setenv("NIX_HELD_LOCKS", concatStringsSep(" ", outputs).c_str(), 1); /* FIXME: ugly */
copyPaths(ref<Store>(sshStore), store, outputs);
copyPaths(ref<Store>(sshStore), store, outputs,
settings.buildHookUseSubstitutes);
}
return;
});
Expand Down
2 changes: 2 additions & 0 deletions src/libstore/globals.cc
Expand Up @@ -59,6 +59,7 @@ Settings::Settings()
lockCPU = getEnv("NIX_AFFINITY_HACK", "1") == "1";
showTrace = false;
enableImportNative = false;
buildHookUseSubstitutes = false;
}


Expand Down Expand Up @@ -183,6 +184,7 @@ void Settings::update()
_get(enableImportNative, "allow-unsafe-native-code-during-evaluation");
_get(useCaseHack, "use-case-hack");
_get(preBuildHook, "pre-build-hook");
_get(buildHookUseSubstitutes, "build-hook-use-substitutes");
_get(keepGoing, "keep-going");
_get(keepFailed, "keep-failed");
}
Expand Down
3 changes: 3 additions & 0 deletions src/libstore/globals.hh
Expand Up @@ -193,6 +193,9 @@ struct Settings {
build settings */
Path preBuildHook;

/* Whether the build hook should be instructed to use substitutes. */
bool buildHookUseSubstitutes;

private:
SettingsMap settings, overrides;

Expand Down