nix icon indicating copy to clipboard operation
nix copied to clipboard

Attribute already defined when using function for it's definition

Open dimchee opened this issue 4 years ago • 2 comments

I couldn't find this documented anywhere, although it seems like reasonable compromise in implementation.

nix-repl> {a = ({} // {}); a.b = {};}
error: attribute 'a.b' already defined at (string):1:2

       at «string»:1:18:

            1| {a = ({} // {}); a.b = {};}
             |                  ^
            2|

I find this behavior annoying, especially when using custom functions for configuration like this

{
  xdg.configFile = generateTSConfigs [  ... ];
  xdg.configFile."nvim/init.lua".source = ...;
}

dimchee avatar Sep 10 '21 17:09 dimchee

I marked this as stale due to inactivity. → More info

stale[bot] avatar Apr 16 '22 10:04 stale[bot]

same issue, do you have any solution about this?

suspenss avatar Oct 11 '24 09:10 suspenss

This should work, but perhaps there is a more elegant solution

{
  xdg.configFile = (generateTSConfigs [  ... ] // { "nvim/init.lua".source = ... });
}

dimchee avatar Oct 21 '24 21:10 dimchee