From 531cc6593a7d119110b8924d35f839bb8f2a1af9 Mon Sep 17 00:00:00 2001 From: regnat Date: Tue, 16 Feb 2021 13:20:05 +0100 Subject: [PATCH] Fix a runtime type error `nix flake init` Forcibly coerce the `path` argument to a string to make it work even if it's a path --- src/nix/flake.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nix/flake.cc b/src/nix/flake.cc index a278011e3..be972f4f2 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -600,7 +600,8 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand Strings(attrsPathPrefixes), lockFlags); auto flakeValue = installable.toValue(*evalState); - auto templateDir = evalState->forceStringNoCtx(*evalState->getAttrField(*flakeValue.value, {evalState->symbols.create("path")}, flakeValue.pos)); + PathSet context; + auto templateDir = evalState->coerceToString(flakeValue.pos, *evalState->getAttrField(*flakeValue.value, {evalState->symbols.create("path")}, flakeValue.pos), context, false, false); assert(store->isInStore(templateDir));