[Nix-dev] Re: environment.systemPackages
Eelco Dolstra
e.dolstra at tudelft.nl
Fri Mar 4 16:55:44 CET 2011
Hi,
On 03/04/2011 04:34 PM, Benjamin Franksen wrote:
> Eelco Dolstra wrote:
>>> How can I make the pkgs variable visible here?
>>
>> Add the following line to the top of the file:
>>
>> { pkgs, ... }:
>>
>> Lots of examples of configurations can be found here:
>> https://svn.nixos.org/repos/nix/configurations/trunk/
>
> 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.
--
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/
More information about the nix-dev
mailing list