[Nix-dev] Small Question on Strings, Attributes & Functions

Matan Shenhav matan at fluxcraft.net
Wed Aug 24 13:04:39 CEST 2016


Thanks,

Is there a resource covering the rules for variables, values and functions? I am still somewhat confused because if I define func = x: x=="x" I do not need to antiquote with ${}.


Cheers,
Matan


---- On Wed, 24 Aug 2016 03:35:28 -0700 Damien Cassou<damien at cassou.me> wrote ---- 


When you write "attset.at", it means " search for key named 'at' in the set". 'at' is not considered as a variable but as a value. If you have a variable, you first have to ask Nix to replace your variable by its value. 



---- On Wed, 24 Aug 2016 03:46:37 -0700 Eelco Dolstra<eelco.dolstra at logicblox.com> wrote ---- 


That should be: 
 
 pick = at: attset: if (attset ? ${at}) then [ attset.${at} ] else [] 
 
Note ${...} around "at". Otherwise it tests for an attribute named "at". 



 * * * * *

Matan Bendix Shenhav
Chief Science Officer
Fluxcraft
+358 (0)45 6 135 315


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.science.uu.nl/pipermail/nix-dev/attachments/20160824/a8b6e949/attachment.html>


More information about the nix-dev mailing list