On Wed, Jun 04, 2008 at 03:21:08PM -0400, [EMAIL PROTECTED] wrote:
> 
> Using nix-instantiate with --xml works great
> except that boolean types like:
> 
>       ttyBackgrounds = {
>               enable = true;
>       };
> 
> get translated into XML as:
>        <attr name="ttyBackgrounds">
>            <unevaluated />
>        </attr>
>        
> regardless of the actual value.  Is this the normal behavior or a bug?

Well, I fixed this using the following small change to
src/libexpr/expr-to-xml.cc (this is nix-0.12pre11869):

48a49
>     ATerm t1;
67,72c68,69
<     else if (e == eTrue)
<         doc.writeEmptyElement("bool", singletonAttrs("value",
"true"));
< 
<     else if (e == eFalse)
<         doc.writeEmptyElement("bool", singletonAttrs("value",
"false"));
< 
---
>     else if (matchVar(e,t1))
>         doc.writeEmptyElement("bool", singletonAttrs("value",
>         aterm2String(t1)));

I really don't know if this is appropriate or correct but it generates
the expected XML (<bool value="false"/> or <bool value="true"/>).

I am most worried that matchVar is too general but matchBool doesn't
appear to work as boolean types are apparently showing up as 'Var'?  I
don't know if this holds across all cases.

Can anyone tell me if this is the right fix or not?

thank you,

James Unger
_______________________________________________
nix-dev mailing list
nix-dev@cs.uu.nl
https://mail.cs.uu.nl/mailman/listinfo/nix-dev

Reply via email to