1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 16:51:15 +02:00

Accept empty directories

This commit is contained in:
Eelco Dolstra 2019-05-01 20:38:41 +02:00
parent fa88f71520
commit a37436d792
2 changed files with 5 additions and 2 deletions

View file

@ -285,7 +285,10 @@ Flake getFlake(EvalState & state, const FlakeRef & flakeRef, bool impureIsAllowe
+ "/" + flake.sourceInfo.rev->to_string(Base16, false));
}
Path flakeFile = sourceInfo.storePath + "/" + resolvedRef.subdir + "/flake.nix";
// Guard against symlink attacks.
auto flakeFile = canonPath(sourceInfo.storePath + "/" + resolvedRef.subdir + "/flake.nix");
if (!isInDir(flakeFile, sourceInfo.storePath))
throw Error("flake file '%s' escapes from '%s'", resolvedRef, sourceInfo.storePath);
if (!pathExists(flakeFile))
throw Error("source tree referenced by '%s' does not contain a '%s/flake.nix' file", resolvedRef, resolvedRef.subdir);