mirror of
https://github.com/NixOS/nix
synced 2025-06-29 02:11:15 +02:00
Backport SourcePath from the lazy-trees branch
This introduces the SourcePath type from lazy-trees as an abstraction for accessing files from inputs that may not be materialized in the real filesystem (e.g. Git repositories). Currently, however, it's just a wrapper around CanonPath, so it shouldn't change any behaviour. (On lazy-trees, SourcePath is a <InputAccessor, CanonPath> tuple.)
This commit is contained in:
parent
5256ba6d87
commit
94812cca98
35 changed files with 567 additions and 263 deletions
|
@ -168,9 +168,11 @@ static int main_nix_instantiate(int argc, char * * argv)
|
|||
|
||||
if (findFile) {
|
||||
for (auto & i : files) {
|
||||
Path p = state->findFile(i);
|
||||
if (p == "") throw Error("unable to find '%1%'", i);
|
||||
std::cout << p << std::endl;
|
||||
auto p = state->findFile(i);
|
||||
if (auto fn = p.getPhysicalPath())
|
||||
std::cout << fn->abs() << std::endl;
|
||||
else
|
||||
throw Error("'%s' has no physical path", p);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -184,7 +186,7 @@ static int main_nix_instantiate(int argc, char * * argv)
|
|||
|
||||
for (auto & i : files) {
|
||||
Expr * e = fromArgs
|
||||
? state->parseExprFromString(i, absPath("."))
|
||||
? state->parseExprFromString(i, state->rootPath(CanonPath::fromCwd()))
|
||||
: state->parseExprFromFile(resolveExprPath(state->checkSourcePath(lookupFileArg(*state, i))));
|
||||
processExpr(*state, attrPaths, parseOnly, strict, autoArgs,
|
||||
evalOnly, outputKind, xmlOutputSourceLocation, e);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue