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

Public Member Functions

StringSet getDefaultSystemFeatures ()
StringSet getDefaultExtraPlatforms ()
bool isWSL1 ()
LocalSettings & getLocalSettings ()
const LocalSettings & getLocalSettings () const
LogFileSettings & getLogFileSettings ()
const LogFileSettings & getLogFileSettings () const
WorkerSettings & getWorkerSettings ()
const WorkerSettings & getWorkerSettings () const
NarInfoDiskCacheSettings & getNarInfoDiskCacheSettings ()
const NarInfoDiskCacheSettings & getNarInfoDiskCacheSettings () const
ProfileDirsOptions getProfileDirsOptions () const
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 ()

Static Public Member Functions

static unsigned int getDefaultCores ()

Public Attributes

std::filesystem::path nixStateDir
Setting< StoreReference > storeUri
Setting< bool > useSQLiteWAL {this, !isWSL1(), "use-sqlite-wal", "Whether SQLite should use WAL mode."}
Setting< bool > keepFailed {this, false, "keep-failed", "Whether to keep temporary directories of failed builds."}
bool verboseBuild = true
bool readOnlyMode = false
Setting< std::string > thisSystem
Setting< Strings > trustedPublicKeys
Setting< Strings > secretKeyFiles
Setting< bool > requireSigs
Setting< StringSet > extraPlatforms
Setting< StringSet > systemFeatures
Setting< std::set< StoreReference > > trustedSubstituters
Setting< bool > printMissing
Setting< bool > useXDGBaseDirectories
Setting< uint64_t > warnLargePathThreshold

Additional Inherited Members

Public Types inherited from nix::Config
using Settings = std::map<std::string, SettingData>
Protected Member Functions inherited from nix::AbstractConfig
 AbstractConfig (StringMap initials={})
Protected Attributes inherited from nix::AbstractConfig
StringMap unknownSettings

Member Function Documentation

◆ getLocalSettings()

LocalSettings & nix::Settings::getLocalSettings ( )
inline

Get the local store settings.

◆ getLogFileSettings()

LogFileSettings & nix::Settings::getLogFileSettings ( )
inline

Get the log file settings.

◆ getNarInfoDiskCacheSettings()

NarInfoDiskCacheSettings & nix::Settings::getNarInfoDiskCacheSettings ( )
inline

Get the NAR info disk cache settings.

◆ getProfileDirsOptions()

ProfileDirsOptions nix::Settings::getProfileDirsOptions ( ) const

Get the options needed for profile directory functions.

◆ getWorkerSettings()

WorkerSettings & nix::Settings::getWorkerSettings ( )
inline

Get the worker settings.

Member Data Documentation

◆ extraPlatforms

Setting<StringSet> nix::Settings::extraPlatforms
Initial value:
{
this,
getDefaultExtraPlatforms(),
"extra-platforms",
R"(
System types of executables that can be run on this machine.
Nix only builds a given [store derivation](@docroot@/glossary.md#gloss-store-derivation) locally when its `system` attribute equals any of the values specified here or in the [`system` option](#conf-system).
Setting this can be useful to build derivations locally on compatible machines:
- `i686-linux` executables can be run on `x86_64-linux` machines (set by default)
- `x86_64-darwin` executables can be run on macOS `aarch64-darwin` with Rosetta 2 (set by default where applicable)
- `armv6` and `armv5tel` executables can be run on `armv7`
- some `aarch64` machines can also natively run 32-bit ARM code
- `qemu-user` may be used to support non-native platforms (though this
may be slow and buggy)
Build systems usually detect the target platform to be the current physical system and therefore produce machine code incompatible with what may be intended in the derivation.
You should design your derivation's `builder` accordingly and cross-check the results when using this option against natively-built versions of your derivation.
)",
{},
false}

◆ nixStateDir

std::filesystem::path nix::Settings::nixStateDir

The directory where state is stored.

◆ printMissing

Setting<bool> nix::Settings::printMissing
Initial value:
{
this, true, "print-missing", "Whether to print what paths need to be built or downloaded."}

◆ readOnlyMode

bool nix::Settings::readOnlyMode = false

Read-only mode. Don't copy stuff to the store, don't change the database.

◆ requireSigs

Setting<bool> nix::Settings::requireSigs
Initial value:
{
this,
true,
"require-sigs",
R"(
If set to `true` (the default), any non-content-addressed path added
or copied to the Nix store (e.g. when substituting from a binary
cache) must have a signature by a trusted key. A trusted key is one
listed in `trusted-public-keys`, or a public key counterpart to a
private key stored in a file listed in `secret-key-files`.
Set to `false` to disable signature checking and trust all
non-content-addressed paths unconditionally.
(Content-addressed paths are inherently trustworthy and thus
unaffected by this configuration option.)
)"}

◆ secretKeyFiles

Setting<Strings> nix::Settings::secretKeyFiles
Initial value:
{
this,
{},
"secret-key-files",
R"(
A whitespace-separated list of files containing secret (private)
keys. These are used to sign locally-built paths. They can be
generated using `nix-store --generate-binary-cache-key`. The
corresponding public key can be distributed to other users, who
can add it to `trusted-public-keys` in their `nix.conf`.
)"}

◆ storeUri

Setting<StoreReference> nix::Settings::storeUri
Initial value:
{
this,
StoreReference::parse(getEnv("NIX_REMOTE").value_or("auto")),
"store",
R"(
The [URL of the Nix store](@docroot@/store/types/index.md#store-url-format)
to use for most operations.
See the
[Store Types](@docroot@/store/types/index.md)
section of the manual for supported store types and settings.
Can be overridden by the [`NIX_REMOTE`](@docroot@/command-ref/env-common.md#env-NIX_REMOTE) environment variable.
The default value is [`auto`](@docroot@/store/types/index.md#auto).
)"}

◆ thisSystem

Setting<std::string> nix::Settings::thisSystem
Initial value:
{
this,
NIX_LOCAL_SYSTEM,
"system",
R"(
The system type of the current Nix installation.
Nix only builds a given [store derivation](@docroot@/glossary.md#gloss-store-derivation) locally when its `system` attribute equals any of the values specified here or in [`extra-platforms`](#conf-extra-platforms).
The default value is set when Nix itself is compiled for the system it will run on.
The following system types are widely used, as Nix is actively supported on these platforms:
- `x86_64-linux`
- `x86_64-darwin` (only via Rosetta 2)
- `i686-linux`
- `aarch64-linux`
- `aarch64-darwin`
- `armv6l-linux`
- `armv7l-linux`
In general, you do not have to modify this setting.
While you can force Nix to run a Darwin-specific `builder` executable on a Linux machine, the result would obviously be wrong.
This value is available in the Nix language as
[`builtins.currentSystem`](@docroot@/language/builtins.md#builtins-currentSystem)
if the
[`eval-system`](#conf-eval-system)
configuration option is set as the empty string.
)"}

◆ trustedPublicKeys

Setting<Strings> nix::Settings::trustedPublicKeys
Initial value:
{
this,
{"cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY="},
"trusted-public-keys",
R"(
A whitespace-separated list of public keys.
At least one of the following condition must be met
for Nix to accept copying a store object from another
Nix store (such as a [substituter](#conf-substituters)):
- the store object has been signed using a key in the trusted keys list
- the [`require-sigs`](#conf-require-sigs) option has been set to `false`
- the store URL is configured with `trusted=true`
- the store object is [content-addressed](@docroot@/glossary.md#gloss-content-addressed-store-object)
)",
{"binary-cache-public-keys"}}

◆ trustedSubstituters

Setting<std::set<StoreReference> > nix::Settings::trustedSubstituters
Initial value:
{
this,
{},
"trusted-substituters",
R"(
A list of [Nix store URLs](@docroot@/store/types/index.md#store-url-format), separated by whitespace.
These are not used by default, but users of the Nix daemon can enable them by specifying [`substituters`](#conf-substituters).
Unprivileged users (those set in only [`allowed-users`](#conf-allowed-users) but not [`trusted-users`](#conf-trusted-users)) can pass as `substituters` only those URLs listed in `trusted-substituters`.
)",
{"trusted-binary-caches"}}

◆ verboseBuild

bool nix::Settings::verboseBuild = true

Whether to show build log output in real time.

◆ warnLargePathThreshold

Setting<uint64_t> nix::Settings::warnLargePathThreshold
Initial value:
{
this,
0,
"warn-large-path-threshold",
R"(
Warn when copying a path larger than this number of bytes to the Nix store
(as determined by its NAR serialisation).
Default is 0, which disables the warning.
Set it to 1 to warn on all paths.
)"}

The documentation for this class was generated from the following files:
  • libstore/include/nix/store/globals.hh
  • libstore/globals.cc