From f13dc79904c668f70ba1e220429b5b02592a31e9 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Mon, 25 Mar 2024 19:46:01 +0100 Subject: [PATCH] Fix nix flake init eval for path value --- src/nix/flake.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/nix/flake.cc b/src/nix/flake.cc index 928f7c9fd..0ea60084b 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -18,6 +18,7 @@ #include "markdown.hh" #include "users.hh" #include "terminal.hh" +#include "value/context.hh" #include #include @@ -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(