[Nix-dev] concatAttrs :: [attrSet] -> attrSet ?

Sergiu Ivanov sivanov at colimite.fr
Sun May 28 14:18:06 CEST 2017


Hello,

I found myself in the need of a function which would take a list of Nix
attribute sets and concatenate them to produce one big attribute set:

  nix-repl> concatAttrs [ {x=1;} {y=2;} ]
  {x=1; y=2;}

I did quite some research online and in nixpkgs source tree and found a
lot of cool functions, but nothing resembling to concatAttrs.

Does such a function exist?


In the meantime, I ended up writing the following definition:

   concatAttrs = attrList: pkgs.lib.fold (x: y: x // y) {} attrList;

Do you see any isssues with such an implementation?

--
Sergiu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <https://mailman.science.uu.nl/pipermail/nix-dev/attachments/20170528/6ebf9cfc/attachment.sig>


More information about the nix-dev mailing list