mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-11 00:36:20 +02:00
678d1c2aa0
Continue progress on #5729. Just as I hoped, this uncovered an issue: the daemon protocol is missing a way to query build logs. This doesn't effect `unix://`, but does effect `ssh://`. A FIXME is left for this, so we come back to it later.
57 lines
1.8 KiB
C++
57 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include "store-api.hh"
|
|
#include "gc-store.hh"
|
|
#include "log-store.hh"
|
|
|
|
namespace nix {
|
|
|
|
struct LocalFSStoreConfig : virtual StoreConfig
|
|
{
|
|
using StoreConfig::StoreConfig;
|
|
// FIXME: the (StoreConfig*) cast works around a bug in gcc that causes
|
|
// it to omit the call to the Setting constructor. Clang works fine
|
|
// either way.
|
|
const PathSetting rootDir{(StoreConfig*) this, true, "",
|
|
"root", "directory prefixed to all other paths"};
|
|
const PathSetting stateDir{(StoreConfig*) this, false,
|
|
rootDir != "" ? rootDir + "/nix/var/nix" : settings.nixStateDir,
|
|
"state", "directory where Nix will store state"};
|
|
const PathSetting logDir{(StoreConfig*) this, false,
|
|
rootDir != "" ? rootDir + "/nix/var/log/nix" : settings.nixLogDir,
|
|
"log", "directory where Nix will store state"};
|
|
const PathSetting realStoreDir{(StoreConfig*) this, false,
|
|
rootDir != "" ? rootDir + "/nix/store" : storeDir, "real",
|
|
"physical path to the Nix store"};
|
|
};
|
|
|
|
class LocalFSStore : public virtual LocalFSStoreConfig,
|
|
public virtual Store,
|
|
public virtual GcStore,
|
|
public virtual LogStore
|
|
{
|
|
public:
|
|
|
|
const static std::string drvsLogDir;
|
|
|
|
LocalFSStore(const Params & params);
|
|
|
|
void narFromPath(const StorePath & path, Sink & sink) override;
|
|
ref<FSAccessor> getFSAccessor() override;
|
|
|
|
/* Register a permanent GC root. */
|
|
Path addPermRoot(const StorePath & storePath, const Path & gcRoot);
|
|
|
|
virtual Path getRealStoreDir() { return realStoreDir; }
|
|
|
|
Path toRealPath(const Path & storePath) override
|
|
{
|
|
assert(isInStore(storePath));
|
|
return getRealStoreDir() + "/" + std::string(storePath, storeDir.size() + 1);
|
|
}
|
|
|
|
std::optional<std::string> getBuildLog(const StorePath & path) override;
|
|
|
|
};
|
|
|
|
}
|