1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 00:11:17 +02:00

* Allow string concatenations involving derivations, e.g.,

configureFlags = "--with-freetype2-library="
      + freetype + "/lib";
This commit is contained in:
Eelco Dolstra 2006-05-01 09:56:56 +00:00
parent cce31b739c
commit 6cecad2be0
8 changed files with 130 additions and 18 deletions

View file

@ -109,6 +109,14 @@ static void processBinding(EvalState & state, Expr e, Derivation & drv,
int n;
Expr e1, e2;
if (matchContext(e, es, e2)) {
e = e2;
for (ATermIterator i(es); i; ++i) {
Strings dummy;
processBinding(state, *i, drv, dummy);
}
}
if (matchStr(e, s)) ss.push_back(aterm2String(s));
else if (matchUri(e, s)) ss.push_back(aterm2String(s));
else if (e == eTrue) ss.push_back("1");
@ -408,9 +416,10 @@ ATerm coerceToString(Expr e)
/* Convert the argument (which can be a path or a uri) to a string. */
static Expr primToString(EvalState & state, const ATermVector & args)
{
ATerm s = coerceToString(evalExpr(state, args[0]));
if (!s) throw Error("cannot coerce value to string");
return makeStr(s);
ATermList context = ATempty;
bool dummy;
string s = coerceToStringWithContext(state, context, args[0], dummy);
return wrapInContext(context, makeStr(toATerm(s)));
}