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

Public Member Functions

ref< Cache > getCache () const
ref< GitRepo > getTarballCache () const
ref< GitRepoPool > getTarballWriterPool () 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 ref< SrcToStore > createSrcToStore ()

Public Attributes

Setting< StringMap > accessTokens
Setting< bool > allowDirty {this, true, "allow-dirty", "Whether to allow dirty Git/Mercurial trees."}
Setting< bool > warnDirty {this, true, "warn-dirty", "Whether to warn about dirty Git/Mercurial trees."}
Setting< bool > allowDirtyLocks
Setting< bool > trustTarballsFromGitForges
Setting< std::string > flakeRegistry
Setting< unsigned int > tarballTtl
const ref< SrcToStore > srcToStore = createSrcToStore()

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

◆ createSrcToStore()

ref< SrcToStore > nix::fetchers::Settings::createSrcToStore ( )
static

In-memory cache for calls to fetchToStore(); maps source paths to their store paths / hashes.

Member Data Documentation

◆ allowDirtyLocks

Setting<bool> nix::fetchers::Settings::allowDirtyLocks
Initial value:
{
this,
false,
"allow-dirty-locks",
R"(
Whether to allow dirty inputs (such as dirty Git workdirs)
to be locked via their NAR hash. This is generally bad
practice since Nix has no way to obtain such inputs if they
are subsequently modified. Therefore lock files with dirty
locks should generally only be used for local testing, and
should not be pushed to other users.
)",
{},
true,
Xp::Flakes}

◆ flakeRegistry

Setting<std::string> nix::fetchers::Settings::flakeRegistry
Initial value:
{
this,
"https://channels.nixos.org/flake-registry.json",
"flake-registry",
R"(
Path or URI of the global flake registry.
When empty, disables the global flake registry.
)",
{},
true,
Xp::Flakes}

◆ tarballTtl

Setting<unsigned int> nix::fetchers::Settings::tarballTtl
Initial value:
{
this,
60 * 60,
"tarball-ttl",
R"(
The number of seconds a downloaded tarball is considered fresh. If
the cached tarball is stale, Nix checks whether it is still up
to date using the ETag header. Nix downloads a new version if
the ETag header is unsupported, or the cached ETag doesn't match.
Setting the TTL to `0` forces Nix to always check if the tarball is
up to date.
Nix caches tarballs in `$XDG_CACHE_HOME/nix/tarballs`.
Files fetched via `NIX_PATH`, `fetchGit`, `fetchMercurial`,
`fetchTarball`, and `fetchurl` respect this TTL.
)"}

◆ trustTarballsFromGitForges

Setting<bool> nix::fetchers::Settings::trustTarballsFromGitForges
Initial value:
{
this,
true,
"trust-tarballs-from-git-forges",
R"(
If enabled (the default), Nix considers tarballs from
GitHub and similar Git forges to be locked if a Git revision
is specified,
e.g. `github:NixOS/patchelf/7c2f768bf9601268a4e71c2ebe91e2011918a70f`.
This requires Nix to trust that the provider returns the
correct contents for the specified Git revision.
If disabled, such tarballs are only considered locked if a
`narHash` attribute is specified,
e.g. `github:NixOS/patchelf/7c2f768bf9601268a4e71c2ebe91e2011918a70f?narHash=sha256-PPXqKY2hJng4DBVE0I4xshv/vGLUskL7jl53roB8UdU%3D`.
)"}

The documentation for this struct was generated from the following files:
  • libfetchers/include/nix/fetchers/fetch-settings.hh
  • libfetchers/cache.cc
  • libfetchers/fetch-settings.cc
  • libfetchers/fetch-to-store.cc
  • libfetchers/git-utils.cc