NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.24k stars 1.48k forks source link

Attribute already defined when using function for it's definition #5232

Open dimchee opened 3 years ago

dimchee commented 3 years ago

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 = ...;
}
stale[bot] commented 2 years ago

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