mirror of
https://github.com/NixOS/nix
synced 2025-07-06 21:41:48 +02:00
Parser: Respect the accessor of the source file for relative paths
This commit is contained in:
parent
38f391444b
commit
6e2fcb7e29
2 changed files with 13 additions and 10 deletions
|
@ -186,9 +186,7 @@ static FlakeInput parseFlakeInput(
|
|||
url = attr.value->string_view();
|
||||
else if (attr.value->type() == nPath) {
|
||||
auto path = attr.value->path();
|
||||
if (path.accessor != flakeDir.accessor
|
||||
// FIXME: hack necessary since the parser currently stores all paths as inside rootFS.
|
||||
&& flakeDir.accessor == state.rootFS)
|
||||
if (path.accessor != flakeDir.accessor)
|
||||
throw Error("input attribute path '%s' at %s must be in the same source tree as %s",
|
||||
path, state.positions[attr.pos], flakeDir);
|
||||
url = "path:" + flakeDir.path.makeRelative(path.path);
|
||||
|
@ -337,9 +335,7 @@ static Flake readFlake(
|
|||
state.symbols[setting.name],
|
||||
std::string(state.forceStringNoCtx(*setting.value, setting.pos, "")));
|
||||
else if (setting.value->type() == nPath) {
|
||||
// FIXME: hack necessary since the parser currently stores all paths as inside rootFS.
|
||||
SourcePath path(rootDir.accessor, setting.value->path().path);
|
||||
auto storePath = fetchToStore(*state.store, path, FetchMode::Copy);
|
||||
auto storePath = fetchToStore(*state.store, setting.value->path(), FetchMode::Copy);
|
||||
flake.config.settings.emplace(
|
||||
state.symbols[setting.name],
|
||||
state.store->toRealPath(storePath));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue