Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
Loading...
Searching...
No Matches
nix::WorkerSettings Struct Reference
Inheritance diagram for nix::WorkerSettings:
nix::Config nix::AbstractConfig nix::Settings

Public Attributes

Setting< bool > keepGoing
Setting< bool > tryFallback
Setting< size_t > logLines
MaxBuildJobsSetting maxBuildJobs
Setting< unsigned int > maxSubstitutionJobs
Setting< time_t > maxSilentTime
Setting< time_t > buildTimeout
Setting< Strings > buildHook
Setting< uint32_t > buildHookKillTimeout
Setting< std::string > builders
Setting< bool > alwaysAllowSubstitutes
Setting< bool > buildersUseSubstitutes
Setting< bool > useSubstitutes
Setting< std::vector< StoreReference > > substituters
Setting< unsigned long > maxLogSize
Setting< unsigned int > pollInterval {this, 5, "build-poll-interval", "How often (in seconds) to poll for locks."}
Setting< std::string > postBuildHook

Additional Inherited Members

Public Types inherited from nix::Config
using Settings = std::map<std::string, SettingData>
Public Member Functions inherited from nix::Config
 Config (StringMap initials={})
bool set (const std::string &name, const std::string &value) override
void addSetting (AbstractSetting *setting)
void getSettings (std::map< std::string, SettingInfo > &res, bool overriddenOnly=false) const override
void resetOverridden () override
nlohmann::json toJSON () override
std::string toKeyValue (bool overriddenOnly=false) override
void convertToArgs (Args &args, const std::string &category) override
Public Member Functions inherited from nix::AbstractConfig
void applyConfig (const std::string &contents, const std::string &path="<unknown>")
void warnUnknownSettings ()
void reapplyUnknownSettings ()
Protected Member Functions inherited from nix::AbstractConfig
 AbstractConfig (StringMap initials={})
Protected Attributes inherited from nix::AbstractConfig
StringMap unknownSettings

Member Data Documentation

◆ alwaysAllowSubstitutes

Setting<bool> nix::WorkerSettings::alwaysAllowSubstitutes
Initial value:
{
this,
false,
"always-allow-substitutes",
R"(
If set to `true`, Nix ignores the [`allowSubstitutes`](@docroot@/language/advanced-attributes.md) attribute in derivations and always attempt to use [available substituters](#conf-substituters).
)"}

◆ buildersUseSubstitutes

Setting<bool> nix::WorkerSettings::buildersUseSubstitutes
Initial value:
{
this,
false,
"builders-use-substitutes",
R"(
If set to `true`, Nix instructs [remote build machines](#conf-builders) to use their own [`substituters`](#conf-substituters) if available.
It means that remote build hosts fetch as many dependencies as possible from their own substituters (e.g, from `cache.nixos.org`) instead of waiting for the local machine to upload them all.
This can drastically reduce build times if the network connection between the local machine and the remote build host is slow.
)"}

◆ buildHook

Setting<Strings> nix::WorkerSettings::buildHook
Initial value:
{
this,
{"nix", "__build-remote"},
"build-hook",
R"(
The path to the helper program that executes remote builds.
Nix communicates with the build hook over `stdio` using a custom protocol to request builds that cannot be performed directly by the Nix daemon.
The default value is the internal Nix binary that implements remote building.
> **Important**
>
> Change this setting only if you really know what you’re doing.
)"}

◆ buildHookKillTimeout

Setting<uint32_t> nix::WorkerSettings::buildHookKillTimeout
Initial value:
{
this,
500,
"build-hook-kill-timeout",
"How long to wait in milliseconds for build hooks to exit on interrupt before sending SIGKILL."}

◆ buildTimeout

Setting<time_t> nix::WorkerSettings::buildTimeout
Initial value:
{
this,
0,
"timeout",
R"(
This option defines the maximum number of seconds that a builder can
run. This is useful (for instance in an automated build system) to
catch builds that are stuck in an infinite loop but keep writing to
their standard output or standard error. It can be overridden using
the `--timeout` command line switch.
The value `0` means that there is no timeout. This is also the
default.
)",
{"build-timeout"}}

◆ keepGoing

Setting<bool> nix::WorkerSettings::keepGoing
Initial value:
{
this, false, "keep-going", "Whether to keep building derivations when another build fails."}

◆ logLines

Setting<size_t> nix::WorkerSettings::logLines
Initial value:
{
this,
25,
"log-lines",
"The number of lines of the tail of "
"the log to show if a build fails."}

◆ maxBuildJobs

MaxBuildJobsSetting nix::WorkerSettings::maxBuildJobs
Initial value:
{
this,
1,
"max-jobs",
R"(
Maximum number of jobs that Nix tries to build locally in parallel.
The special value `auto` causes Nix to use the number of CPUs in your system.
Use `0` to disable local builds and directly use the remote machines specified in [`builders`](#conf-builders).
This doesn't affect derivations that have [`preferLocalBuild = true`](@docroot@/language/advanced-attributes.md#adv-attr-preferLocalBuild), which are always built locally.
> **Note**
>
> The number of CPU cores to use for each build job is independently determined by the [`cores`](#conf-cores) setting.
<!-- TODO(@fricklerhandwerk): would be good to have those shorthands for common options as part of the specification -->
The setting can be overridden using the `--max-jobs` (`-j`) command line switch.
)",
{"build-max-jobs"}}

◆ maxLogSize

Setting<unsigned long> nix::WorkerSettings::maxLogSize
Initial value:
{
this,
0,
"max-build-log-size",
R"(
This option defines the maximum number of bytes that a builder can
write to its stdout/stderr. If the builder exceeds this limit, it's
killed. A value of `0` (the default) means that there is no limit.
)",
{"build-max-log-size"}}

◆ maxSilentTime

Setting<time_t> nix::WorkerSettings::maxSilentTime
Initial value:
{
this,
0,
"max-silent-time",
R"(
This option defines the maximum number of seconds that a builder can
go without producing any data on standard output or standard error.
This is useful (for instance in an automated build system) to catch
builds that are stuck in an infinite loop, or to catch remote builds
that are hanging due to network problems. It can be overridden using
the `--max-silent-time` command line switch.
The value `0` means that there is no timeout. This is also the
default.
)",
{"build-max-silent-time"}}

◆ maxSubstitutionJobs

Setting<unsigned int> nix::WorkerSettings::maxSubstitutionJobs
Initial value:
{
this,
16,
"max-substitution-jobs",
R"(
This option defines the maximum number of substitution jobs that Nix
tries to run in parallel. The default is `16`. The minimum value
one can choose is `1` and lower values are interpreted as `1`.
)",
{"substitution-max-jobs"}}

◆ substituters

Setting<std::vector<StoreReference> > nix::WorkerSettings::substituters
Initial value:
{
this,
std::vector<StoreReference>{StoreReference::parse("https://cache.nixos.org/")},
"substituters",
R"(
A list of [URLs of Nix stores](@docroot@/store/types/index.md#store-url-format) to be used as substituters, separated by whitespace.
A substituter is an additional [store](@docroot@/glossary.md#gloss-store) from which Nix can obtain [store objects](@docroot@/store/store-object.md) instead of building them.
Substituters are tried based on their priority value, which each substituter can set independently.
Lower value means higher priority.
The default is `https://cache.nixos.org`, which has a priority of 40.
At least one of the following conditions must be met for Nix to use a substituter:
- The substituter is in the [`trusted-substituters`](#conf-trusted-substituters) list
- The user calling Nix is in the [`trusted-users`](#conf-trusted-users) list
In addition, each store path should be trusted as described in [`trusted-public-keys`](#conf-trusted-public-keys)
)",
{"binary-caches"}}

◆ tryFallback

Setting<bool> nix::WorkerSettings::tryFallback
Initial value:
{
this,
false,
"fallback",
R"(
If set to `true`, Nix falls back to building from source if a
binary substitute fails. This is equivalent to the `--fallback`
flag. The default is `false`.
)",
{"build-fallback"}}

◆ useSubstitutes

Setting<bool> nix::WorkerSettings::useSubstitutes
Initial value:
{
this,
true,
"substitute",
R"(
If set to `true` (default), Nix uses binary substitutes if
available. This option can be disabled to force building from
source.
)",
{"build-use-substitutes"}}

The documentation for this struct was generated from the following files: