[Nix-dev] Re: NixOS: New scheme - small explanation of fix
Nicolas Pierron
nicolas.b.pierron at gmail.com
Thu Nov 20 20:57:08 CET 2008
On Thu, Nov 20, 2008 at 09:58, Ludovic Courtès <ludo at gnu.org> wrote:
> Hi,
>
> Marc Weber <marco-oweber at gmx.de> 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.
More information about the nix-dev
mailing list