aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-09-09 17:34:38 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-09-09 17:34:38 +0200
commitf97d3753a13f0ff916d83dbea4fe7dae7194f903 (patch)
treed513688163b5f597ab6c890b916b2640755c7dac /src/libexpr/flake
parentc87840ae14eea84b5910cb0b188ec3fb32cc1466 (diff)
Require flake.nix to be an attrset (not a non-trivial thunk)
Diffstat (limited to 'src/libexpr/flake')
-rw-r--r--src/libexpr/flake/flake.cc7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/libexpr/flake/flake.cc b/src/libexpr/flake/flake.cc
index c10906731..050e65259 100644
--- a/src/libexpr/flake/flake.cc
+++ b/src/libexpr/flake/flake.cc
@@ -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));