1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-10 12:36:01 +01:00

Fix nix flake init eval for path value

This commit is contained in:
Robert Hensing 2024-03-25 19:46:01 +01:00 committed by Tom Bereknyei
parent f3d2a16eff
commit f13dc79904

View file

@ -18,6 +18,7 @@
#include "markdown.hh" #include "markdown.hh"
#include "users.hh" #include "users.hh"
#include "terminal.hh" #include "terminal.hh"
#include "value/context.hh"
#include <filesystem> #include <filesystem>
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
@ -884,7 +885,9 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand
auto cursor = installable.getCursor(*evalState); auto cursor = installable.getCursor(*evalState);
auto templateDirAttr = cursor->getAttr("path"); auto templateDirAttr = cursor->getAttr("path");
auto templateDir = templateDirAttr->getString(); auto & v = templateDirAttr->forceValue();
NixStringContext ctx;
auto templateDir = evalState->coerceToString(noPos, v, ctx, "while casting the template value to a path", false, true).toOwned();
if (!store->isInStore(templateDir)) if (!store->isInStore(templateDir))
evalState->error<TypeError>( evalState->error<TypeError>(