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

Public Attributes

Setting< bool > enableHttp2 {this, true, "http2", "Whether to enable HTTP/2 support."}
Setting< bool > enableHttp3
Setting< std::string > userAgentSuffix
Setting< size_t > httpConnections
Setting< unsigned long > connectTimeout
Setting< unsigned long > stalledDownloadTimeout
Setting< uint32_t > tries
Setting< uint32_t > retryDelayMs
Setting< uint32_t > retryDelayRateLimitedMs
Setting< uint32_t > retryMaxDelayMs
Setting< bool > retryJitter
Setting< size_t > downloadBufferSize
Setting< unsigned int > downloadSpeed
Setting< AbsolutePath > netrcFile
Setting< std::optional< AbsolutePath > > caFile

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

◆ caFile

Setting<std::optional<AbsolutePath> > nix::FileTransferSettings::caFile
Initial value:
{
this,
getDefaultSSLCertFile(),
"ssl-cert-file",
R"(
The path of a file containing CA certificates used to
authenticate `https://` downloads. Nix by default uses
the first of the following files that exists:
1. `/etc/ssl/certs/ca-certificates.crt`
2. `/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt`
The path can be overridden by the following environment
variables, in order of precedence:
1. `NIX_SSL_CERT_FILE`
2. `SSL_CERT_FILE`
)",
{},
false}

◆ connectTimeout

Setting<unsigned long> nix::FileTransferSettings::connectTimeout
Initial value:
{
this,
15,
"connect-timeout",
R"(
The timeout (in seconds) for establishing connections in the
binary cache substituter. It corresponds to `curl`’s
`--connect-timeout` option. A value of 0 means no limit.
)"}

◆ downloadBufferSize

Setting<size_t> nix::FileTransferSettings::downloadBufferSize
Initial value:
{
this,
1 * 1024 * 1024,
"download-buffer-size",
R"(
The size of Nix's internal download buffer in bytes during `curl` transfers. If data is
not processed quickly enough to exceed the size of this buffer, downloads may stall.
The default is 1048576 (1 MiB).
)"}

◆ downloadSpeed

Setting<unsigned int> nix::FileTransferSettings::downloadSpeed
Initial value:
{
this,
0,
"download-speed",
R"(
Specify the maximum transfer rate in kilobytes per second you want
Nix to use for downloads.
)"}

◆ enableHttp3

Setting<bool> nix::FileTransferSettings::enableHttp3
Initial value:
{
this,
false,
"http3",
R"(
Whether to try enabling HTTP/3 (QUIC).
When enabled, Nix requests HTTP/3 and transparently falls back
to HTTP/2 or HTTP/1.1 for servers that do not support it.
This option has no effect unless the `nix` binary is linked
against a libcurl built with HTTP/3 (QUIC) support.
)"}

◆ httpConnections

Setting<size_t> nix::FileTransferSettings::httpConnections
Initial value:
{
this,
25,
"http-connections",
R"(
The maximum number of parallel TCP connections used to fetch
files from binary caches and by other downloads. It defaults
to 25. 0 means no limit.
)",
{"binary-caches-parallel-connections"}}

◆ netrcFile

Setting<AbsolutePath> nix::FileTransferSettings::netrcFile
Initial value:
{
this,
nixConfDir() / "netrc",
"netrc-file",
R"(
If set to an absolute path to a `netrc` file, Nix uses the HTTP
authentication credentials in this file when trying to download from
a remote host through HTTP or HTTPS. Defaults to
`$NIX_CONF_DIR/netrc`.
The `netrc` file consists of a list of accounts in the following
format:
machine my-machine
login my-username
password my-password
For the exact syntax, see [the `curl`
documentation](https://ec.haxx.se/usingcurl-netrc.html).
> **Note**
>
> This must be an absolute path, and `~` is not resolved. For
> example, `~/.netrc` won't resolve to your home directory's
> `.netrc`.
)"}

◆ retryDelayMs

Setting<uint32_t> nix::FileTransferSettings::retryDelayMs
Initial value:
{
this,
100,
"filetransfer-retry-delay",
R"(
Initial delay in milliseconds before retrying a failed file transfer
(download or upload). The delay doubles with each subsequent attempt
(exponential backoff) and is subject to random jitter (see
`filetransfer-retry-jitter`).
)"}

◆ retryDelayRateLimitedMs

Setting<uint32_t> nix::FileTransferSettings::retryDelayRateLimitedMs
Initial value:
{
this,
5000,
"filetransfer-retry-delay-rate-limited",
R"(
Initial delay in milliseconds before retrying a file transfer that
failed with a rate-limit response (HTTP 429 or 503). The delay doubles
with each subsequent attempt.
Servers may send a `Retry-After` header specifying a longer delay;
when present, Nix respects the larger of the two values.
)"}

◆ retryJitter

Setting<bool> nix::FileTransferSettings::retryJitter
Initial value:
{
this,
true,
"filetransfer-retry-jitter",
R"(
Whether to apply random jitter to retry delays. When enabled, each
retry waits for a random duration between 0 and the computed delay
("full jitter"), which spreads out retry storms from many clients.
Disable for deterministic retry timing (primarily useful for tests).
)"}

◆ retryMaxDelayMs

Setting<uint32_t> nix::FileTransferSettings::retryMaxDelayMs
Initial value:
{
this,
60000,
"filetransfer-retry-max-delay",
R"(
Ceiling on the exponential backoff delay in milliseconds. This does not
cap server-provided `Retry-After` values, which are honored as-is.
)"}

◆ stalledDownloadTimeout

Setting<unsigned long> nix::FileTransferSettings::stalledDownloadTimeout
Initial value:
{
this,
300,
"stalled-download-timeout",
R"(
The timeout (in seconds) for receiving data from servers
during download. Nix cancels idle downloads after this
timeout's duration.
)"}

◆ tries

Setting<uint32_t> nix::FileTransferSettings::tries
Initial value:
{
this,
5,
"filetransfer-retry-attempts",
R"(
The number of times Nix attempts a file transfer (download
or upload) before giving up. Retries apply to transient
failures: connection-level errors, HTTP 408, 429, and most
5xx responses. Authentication failures (401/403/407),
404/410, and other 4xx responses are not retried.
)",
{"download-attempts"}}

◆ userAgentSuffix

Setting<std::string> nix::FileTransferSettings::userAgentSuffix
Initial value:
{
this, "", "user-agent-suffix", "String appended to the user agent in HTTP requests."}

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