I'm curious how to merge multiple listToUnkeyedAttrs. For example:
./ $ nix repl github:nix-community/nixvim
...
nix-repl> builtins.trace (lib.nixvim.toLuaObject ((lib.nixvim.listToUnkeyedAttrs ["a" "b"]) // (lib.nixvim.listToUnkeyedAttrs ["c" "d"]) // {foo = "bar";})) null
trace: { "c", "d", foo = "bar" }
null
Ideally, I would want the resulting lua table to be:
{ "a", "b", "c", "d", foo = "bar" }
It feels like this is a fundamental issue with how listToUnkeyedAttrs represents unkeyed attrs:
./ $ nix repl github:nix-community/nixvim
nix-repl> lib.nixvim.listToUnkeyedAttrs ["a" "b"]
{
__unkeyed-0 = "a";
__unkeyed-1 = "b";
}
Have we considered one of the following?
- Reworking
lib.nixvim.listToUnkeyedAttrs to represent unkeyed attrs in a different way? For example, rather than injecting integer indices into the keys, we could inject the value.
- Create a custom merge function that knows to treat these
--unkeyed-<N> attrs specially.
I'm curious how to merge multiple
listToUnkeyedAttrs. For example:Ideally, I would want the resulting lua table to be:
{ "a", "b", "c", "d", foo = "bar" }It feels like this is a fundamental issue with how
listToUnkeyedAttrsrepresents unkeyed attrs:Have we considered one of the following?
lib.nixvim.listToUnkeyedAttrsto represent unkeyed attrs in a different way? For example, rather than injecting integer indices into the keys, we could inject the value.--unkeyed-<N>attrs specially.