Create new attributes inside lambda
Situation:
{
outputs = {...}: {
a = {};
};
}
Running nix-editor test.nix outputs.a -v 1 produces:
{
outputs = {...}: {
a = 1;
};
}
as expected. But nix-editor test.nix outputs.a.b -v 1 produces:
{
outputs = {...}: {
a = {};
};
outputs.a.b = 1;
}
where the attrset was not placed into the function call, but on the outside.
Should be fixed in 6f33bad9d0c9383bed39115c339b44e098d4e22f and 7b0af65075f002782b50bda3516c6266641cb6b4, although indentation is still hackish
This still seems to be an issue. Querying for values inside the lambda works as expected, but the traversal for writing doesn't seem to use the same logic.
$ cat test.nix
{
outputs = inputs: inputs.d {
a.b = {};
};
}
$ nix-editor test.nix outputs.a
{ b = { }; }
$ nix-editor test.nix outputs.a.b -v 1
{
outputs = inputs: inputs.d {
a.b = {};
};
outputs.a.b = 1;
}
$ nix-editor test.nix outputs.a.c -v 1
{
outputs = inputs: inputs.d {
a.b = {};
};
outputs.a.c = 1;
}
Latest changes (ab2a7e94ca176589c1e8236ce31cd89044e4818f):
nix-editor test.nix outputs.a.b -v '{v=1;}'
{
outputs = inputs: inputs.d {
a.b = {};
};
outputs.a.b = {v=1;};
}
and
nix-editor test.nix outputs.a.b -v 'true'
{
outputs = inputs: inputs.d {
a.b = {};
a.b = true;
};
}
Hm yeah, that seems to have to do with the way attribute sets are handled differently than values
work-around with an empty flake
nix-editor test.nix outputs.a.b -v 'rec {c=1;}'
{
outputs = inputs: inputs.d {
a.b = rec {c=1;};
};
}
This seems to bypass the "{" detection logic.