![]() |
Nix 2.36.0
Nix, the purely functional package manager; unstable internal interfaces
|
#include <store-api.hh>
Classes | |
| class | StoreDirSetting |
Public Member Functions | |
| StoreConfigBase (const StoreReference::Params ¶ms, FilePathType pathType) | |
| 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 () |
Public Attributes | |
| StoreDirSetting | storeDir_ |
Protected Types | |
| enum struct | FilePathType { Unix , Native } |
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 |
Need to make this a separate class so I can get the right initialization order in the constructor for StoreConfig.
|
strongprotected |
This data type is only used for StoreConfigBase constructor's pathType parameter. This documentation will describe what it means in that one context.
This enum determines how the default (logical) store path for the store is chosen, if no explicit setting was given. There are two different ways to default this setting. Native is appropriate for any store which is a LocalFSStore, and Unix is appropriate for any store which is not a LocalFSStore.
Because this information is needed when constructing StoreConfigBase, we cannot use a virtual method in a directed class (like LocalFSStore) so instead we add this argument to StoreConfigBase in order to make the choice in a non-vtable/inheritance-based way.
| Enumerator | |
|---|---|
| Unix | Unix-style path (e.g., /nix/store) Unix paths use forward slashes, and do not have any root "drive" or other such notion. When the store dir is defaulted this way, we do not care what OS we are on. The default path is canonicalized, removing any .. lexically. This is used for store implementations that do not use the host file system, like DummyStore which is entirely in-memory and portable, or remote stores which refer to some other computer's file system. The default store path used in this case is morally a CanonPath. The default store path in this case is a hard-coded constant, NIX_STORE_DIR, which is probably /nix/store.
|
| Native | Native path for the current platform. On Unix this is a Unix Path, and on Windows, it is a Windows path. This is used for store implementations that do use the local file system as part of their interface (not just as an implementation detail). Concretely, that is all stores that inherit from LocalFSStore. Those stores advertise that the store objects are on disk, and the logical store directory path (at least after one enters the appropriate chroot / other similar mechanism) is the literal directory those store objects are contained with. As such, the store directory path must be something that is supported by the OS's native file system (or inside the chroot / other similar mechanism, if needed). The default store path used in this case is morally a std::filesystem::path. The default store path in this case depends on the platform:
In both cases, the default path is canonicalized, removing any .. lexically. |
| nix::StoreConfigBase::StoreConfigBase | ( | const StoreReference::Params & | params, |
| FilePathType | pathType ) |
| pathType | see FilePathType |