[Nix-dev] Checksum of an attrset?

Rickard Nilsson rickard.nilsson at telia.com
Thu Jul 19 17:21:58 CEST 2012


Den 2012-07-19 16:48:01 skrev Marc Weber <marco-oweber at gmx.de>:

> Try checksumming
>
> rec {
>   a = b;
>   b = a;
> };

:)


> and you'll understand that it is not easy to do so (even less since the
> aterm library implementation was dropped).
>
> So think about what makes your attr sets distinct and use that for
> creating a unique name.
>
> So it may pay off providing more details.
>
> Adding a md5sum primop function to the nix language should be straight
> forward.

Yes, and that would probably be sufficient for me. Then I could checksum
some of the attributes to create an id.


> An alternative solution would be using natural numbers:
>
> let attrs = [a,b,c]
> then turn the list into the attr set with unique names - using the list
> index as name and the like (check that everything get restarted
> correctly)

I'm not sure I'm following you here.


Thanks!

   / Rickard


More information about the nix-dev mailing list