On Thu, Nov 20, 2008 at 09:58, Ludovic Courtès <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Marc Weber <[EMAIL PROTECTED]> writes:
>
>> let attrs = {
>>   a = 7;
>>   b = func attrs ; # eg func = (a : a.a);
>> }; in attrs
>>
>> now fix is an abstraction over the last style:
>>
>> fix ( attrs : {
>>     a = 7;
>>     b = func attrs
>> });
>
> (Although I don't yet understand exactly how it relates to Nicolas'
> post...)

The point is that all NixOS configuration files have an
argument/attribute called "config".  This attribute correspond to the
result of the computer configuration.  The fix function plus a merge
function ("require" attribute) allow the config attribute to look into
to the evaluated version of attributes.

{config, pkgs}:

{
  services = {
    foo = {
      enable = mkOption { default = false; };
    };

    bar = {
      enable = config.services.foo.enable; // not necessary false
    };
  };
}

-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron
- If you are doing something twice then you should try to do it once.
_______________________________________________
nix-dev mailing list
[email protected]
https://mail.cs.uu.nl/mailman/listinfo/nix-dev

Reply via email to