mirror of
https://github.com/NixOS/nix
synced 2025-06-28 13:41:15 +02:00
Introduce EvalStore::storePath
This abstracts over a common case. Good for brevity, and enabling further experiments.
This commit is contained in:
parent
782c63fc8e
commit
de22f58dfc
5 changed files with 21 additions and 6 deletions
|
@ -3103,7 +3103,7 @@ std::optional<SourcePath> EvalState::resolveLookupPathPath(const LookupPath::Pat
|
|||
fetchSettings,
|
||||
EvalSettings::resolvePseudoUrl(value));
|
||||
auto storePath = fetchToStore(*store, SourcePath(accessor), FetchMode::Copy);
|
||||
return finish(rootPath(store->printStorePath(storePath)));
|
||||
return finish(this->storePath(storePath));
|
||||
} catch (Error & e) {
|
||||
logWarning({
|
||||
.msg = HintFmt("Nix search path entry '%1%' cannot be downloaded, ignoring", value)
|
||||
|
|
|
@ -389,6 +389,15 @@ public:
|
|||
*/
|
||||
SourcePath rootPath(PathView path);
|
||||
|
||||
/**
|
||||
* Return a `SourcePath` that refers to `path` in the store.
|
||||
*
|
||||
* For now, this has to also be within the root filesystem for
|
||||
* backwards compat, but for Windows and maybe also pure eval, we'll
|
||||
* probably want to do something different.
|
||||
*/
|
||||
SourcePath storePath(const StorePath & path);
|
||||
|
||||
/**
|
||||
* Allow access to a path.
|
||||
*/
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include "store-api.hh"
|
||||
#include "eval.hh"
|
||||
|
||||
namespace nix {
|
||||
|
@ -12,4 +13,9 @@ SourcePath EvalState::rootPath(PathView path)
|
|||
return {rootFS, CanonPath(absPath(path))};
|
||||
}
|
||||
|
||||
SourcePath EvalState::storePath(const StorePath & path)
|
||||
{
|
||||
return {rootFS, CanonPath{store->printStorePath(path)}};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue