diff options
author | Guillaume Maudoux <guillaume.maudoux@tweag.io> | 2022-03-18 01:25:55 +0100 |
---|---|---|
committer | Guillaume Maudoux <guillaume.maudoux@tweag.io> | 2022-03-18 01:25:55 +0100 |
commit | ca5c3e86abf4ba7ff8e680a0a89c895d452931b9 (patch) | |
tree | 1a5dc481a375e6ab060221118f0d61959a06ecf6 /src/nix/flake.cc | |
parent | 1942fed6d9cee95775046c5ad3d253ab2e8ab210 (diff) | |
parent | 6afc3617982e872fac2142c3aeccd1e8482e7e52 (diff) |
Merge remote-tracking branch 'origin/master' into coerce-string
Diffstat (limited to 'src/nix/flake.cc')
-rw-r--r-- | src/nix/flake.cc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/nix/flake.cc b/src/nix/flake.cc index 356f89713..3cf764a20 100644 --- a/src/nix/flake.cc +++ b/src/nix/flake.cc @@ -706,9 +706,14 @@ struct CmdFlakeInitCommon : virtual Args, EvalCommand auto [cursor, attrPath] = installable.getCursor(*evalState); - auto templateDir = cursor->getAttr("path")->getString(); - - assert(store->isInStore(templateDir)); + auto templateDirAttr = cursor->getAttr("path"); + auto templateDir = templateDirAttr->getString(); + + if (!store->isInStore(templateDir)) + throw TypeError( + "'%s' was not found in the Nix store\n" + "If you've set '%s' to a string, try using a path instead.", + templateDir, templateDirAttr->getAttrPathStr()); std::vector<Path> files; |