Merge pull request #6054 from lincolnauster/lf-reporterr

repl/load-flake: throw error if path isn't specified
This commit is contained in:
Eelco Dolstra 2022-02-07 20:44:10 +01:00 committed by GitHub
commit 7c64a9dfd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -623,6 +623,9 @@ void NixRepl::loadFile(const Path & path)
void NixRepl::loadFlake(const std::string & flakeRefS)
{
if (flakeRefS.empty())
throw Error("cannot use ':load-flake' without a path specified. (Use '.' for the current working directory.)");
auto flakeRef = parseFlakeRef(flakeRefS, absPath("."), true);
if (evalSettings.pureEval && !flakeRef.input.isImmutable())
throw Error("cannot use ':load-flake' on mutable flake reference '%s' (use --impure to override)", flakeRefS);