mirror of
https://github.com/NixOS/nix
synced 2025-06-25 06:31:14 +02:00
Require flake.nix to be an attrset (not a non-trivial thunk)
This commit is contained in:
parent
c87840ae14
commit
f97d3753a1
4 changed files with 28 additions and 8 deletions
|
@ -198,9 +198,7 @@ static SourceInfo fetchFlake(EvalState & state, const FlakeRef & resolvedRef)
|
|||
static void expectType(EvalState & state, ValueType type,
|
||||
Value & value, const Pos & pos)
|
||||
{
|
||||
if (value.type == tThunk &&
|
||||
((type == tAttrs && dynamic_cast<ExprAttrs *>(value.thunk.expr)) ||
|
||||
(type == tLambda && dynamic_cast<ExprLambda *>(value.thunk.expr))))
|
||||
if (value.type == tThunk && value.isTrivial())
|
||||
state.forceValue(value, pos);
|
||||
if (value.type != type)
|
||||
throw Error("expected %s but got %s at %s",
|
||||
|
@ -231,8 +229,7 @@ Flake getFlake(EvalState & state, const FlakeRef & flakeRef)
|
|||
throw Error("source tree referenced by '%s' does not contain a '%s/flake.nix' file", resolvedRef, resolvedRef.subdir);
|
||||
|
||||
Value vInfo;
|
||||
// FIXME: don't evaluate vInfo.
|
||||
state.evalFile(realFlakeFile, vInfo); // FIXME: symlink attack
|
||||
state.evalFile(realFlakeFile, vInfo, true); // FIXME: symlink attack
|
||||
|
||||
expectType(state, tAttrs, vInfo, Pos(state.symbols.create(realFlakeFile), 0, 0));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue