[Nix-dev] Re: environment.systemPackages

Benjamin Franksen benjamin.franksen at helmholtz-berlin.de
Fri Mar 4 18:07:23 CET 2011


Eelco Dolstra wrote:
>> Thanks. I looked at these examples and saw such a line but, well... I
>> just didn't think this could work. I mean, with this addition
>> /etc/nixos/configuration.nix becomes a function, right? Is there a
>> special trick that makes nixos interpret the code as either a function or
>> a plain value?
> 
> Yes, there is, which is rather ugly :-)  Basically modules are called by
> doing
> 
>    if builtins.isFunction module
>    then module { ... args ... }
>    else module
> 
> But this is really for backwards compatibility.  It's best to always
> write modules as functions.
> 
>> Please forgive my beginner's confusion, I have some problems groking the
>> nix language (the only functional languages I know are all statically
>> typed).
> 
> Indeed we can get away with this only because we don't have static typing.

Ah, okay, everything is clear now.

I suggest to adapt the example NixOS configuration in the manual ("Example 
1.2. NixOS configuration") to the new function style, then.

Cheers
Ben




More information about the nix-dev mailing list