1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-20 01:09:37 +01:00

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
This commit is contained in:
regnat 2021-02-16 13:20:05 +01:00
parent 7568cbe344
commit 531cc6593a

View file

@ -600,7 +600,8 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand
Strings(attrsPathPrefixes), lockFlags); Strings(attrsPathPrefixes), lockFlags);
auto flakeValue = installable.toValue(*evalState); 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)); assert(store->isInStore(templateDir));