Nix 2.93.3
Lix: A modern, delicious implementation of the Nix package manager; unstable internal interfaces
Loading...
Searching...
No Matches
local-fs-store.hh
Go to the documentation of this file.
1#pragma once
3
7
8namespace nix {
9
10struct LocalFSStoreConfig : virtual StoreConfig
11{
12 using StoreConfig::StoreConfig;
13
14 const PathsSetting<std::optional<Path>> rootDir{this, std::nullopt,
15 "root",
16 "Directory prefixed to all other paths."};
17
18 const PathsSetting<Path> stateDir{this,
19 rootDir.get() ? *rootDir.get() + "/nix/var/nix" : settings.nixStateDir,
20 "state",
21 "Directory where Lix will store state."};
22
23 const PathsSetting<Path> logDir{this,
24 rootDir.get() ? *rootDir.get() + "/nix/var/log/nix" : settings.nixLogDir,
25 "log",
26 "directory where Lix will store log files."};
27
28 const PathsSetting<Path> realStoreDir{this,
29 rootDir.get() ? *rootDir.get() + "/nix/store" : storeDir, "real",
30 "Physical path of the Nix store."};
31};
32
33class LocalFSStore : public virtual Store,
34 public virtual GcStore,
35 public virtual LogStore
36{
37public:
38 inline static std::string operationName = "Local Filesystem Store";
39
40 const static std::string drvsLogDir;
41
42 LocalFSStoreConfig & config() override = 0;
43 const LocalFSStoreConfig & config() const override = 0;
44
45 kj::Promise<Result<box_ptr<Source>>> narFromPath(const StorePath & path) override;
47
62 virtual kj::Promise<Result<Path>>
63 addPermRoot(const StorePath & storePath, const Path & gcRoot) = 0;
64
65 virtual Path getRealStoreDir() { return config().realStoreDir; }
66
67 Path toRealPath(const Path & storePath) override
68 {
69 assert(isInStore(storePath));
70 return getRealStoreDir() + "/" + std::string(storePath, config().storeDir.size() + 1);
71 }
72
73 kj::Promise<Result<std::optional<std::string>>> getBuildLogExact(const StorePath & path) override;
74
75};
76
77}
Definition local-fs-store.hh:36
virtual kj::Promise< Result< Path > > addPermRoot(const StorePath &storePath, const Path &gcRoot)=0
kj::Promise< Result< box_ptr< Source > > > narFromPath(const StorePath &path) override
Definition local-fs-store.cc:87
ref< FSAccessor > getFSAccessor() override
Definition local-fs-store.cc:81
Definition config.hh:333
Definition path.hh:21
bool isInStore(PathView path) const
Definition store-api.cc:42
Definition ref.hh:19
Definition gc-store.hh:121
Definition local-fs-store.hh:11
Definition log-store.hh:10
std::string Path
Definition types.hh:28