Skip to content

Commit

Permalink
Fix nix flake init eval for path value
Browse files Browse the repository at this point in the history
  • Loading branch information
roberth authored and tomberek committed Aug 24, 2024
1 parent f3d2a16 commit f13dc79
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/nix/flake.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "markdown.hh"
#include "users.hh"
#include "terminal.hh"
#include "value/context.hh"

#include <filesystem>
#include <nlohmann/json.hpp>
Expand Down Expand Up @@ -884,7 +885,9 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand
auto cursor = installable.getCursor(*evalState);

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))
evalState->error<TypeError>(
Expand Down

0 comments on commit f13dc79

Please sign in to comment.