From 267dc693d2ca8dea13199f92c265fc35fdb047f6 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 14 Apr 2010 22:59:39 +0000 Subject: * Fix builtins. --- src/libexpr/primops.cc | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'src/libexpr/primops.cc') diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 83af7ada9315..0d7459feef46 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -999,15 +999,13 @@ void EvalState::createBaseEnv() { baseEnv.up = 0; -#if 0 - Value & builtins = baseEnv.bindings[symbols.create("builtins")]; - builtins.type = tAttrs; - builtins.attrs = new Bindings; -#endif - /* Add global constants such as `true' to the base environment. */ Value v; + /* `builtins' must be first! */ + mkAttrs(v); + addConstant("builtins", v); + mkBool(v, true); addConstant("true", v); @@ -1023,14 +1021,6 @@ void EvalState::createBaseEnv() mkString(v, thisSystem.c_str()); addConstant("__currentSystem", v); - /* Add a wrapper around the derivation primop that computes the - `drvPath' and `outPath' attributes lazily. */ -#if 0 - string s = "attrs: let res = derivationStrict attrs; in attrs // { drvPath = res.drvPath; outPath = res.outPath; type = \"derivation\"; }"; - mkThunk(v, baseEnv, parseExprFromString(*this, s, "/")); - addConstant("derivation", v); -#endif - // Miscellaneous addPrimOp("import", 1, prim_import); addPrimOp("isNull", 1, prim_isNull); @@ -1053,6 +1043,12 @@ void EvalState::createBaseEnv() // Derivations addPrimOp("derivationStrict", 1, prim_derivationStrict); + /* Add a wrapper around the derivation primop that computes the + `drvPath' and `outPath' attributes lazily. */ + string s = "attrs: let res = derivationStrict attrs; in attrs // { drvPath = res.drvPath; outPath = res.outPath; type = \"derivation\"; }"; + mkThunk(v, baseEnv, parseExprFromString(*this, s, "/")); + addConstant("derivation", v); + // Paths addPrimOp("__toPath", 1, prim_toPath); #if 0 @@ -1105,7 +1101,7 @@ void EvalState::createBaseEnv() // Versions addPrimOp("__parseDrvName", 1, prim_parseDrvName); - addPrimOp("__compareVersions", 2, prim_compareVersions); + addPrimOp("__compareVersions", 2, prim_compareVersions); } -- cgit 1.4.1