[Nix-dev] [Nix-commits] [NixOS/nixos] b609ff: allow out-of-tree nixos modules

Nicolas Pierron nicolas.b.pierron at gmail.com
Sun Jul 22 03:04:59 CEST 2012


Hi all,

I wrote a bit of documentation to for people who cannot understand
NixOS logic.  You might find main use case of modules described on

    https://nixos.org/wiki/NixOS:Modules

On Sat, Jul 21, 2012 at 9:25 AM, Mathijs Kwik <mathijs at bluescreen303.nl> wrote:
> Ah :)
>
> I did read the sources of lib/eval-config and saw that
> configuration.nix is just treated as a module, so I did understand
> that part. However it wasn't clear to me how to use that to add
> additional modules (config option "modules" of course doesn't exist).

The reason is that modules are filtered to avoid duplicates and this
option may cause the evaluation of a configuration to have no
fix-point.
In addition, of having no fix-point, this is likely to cause a huge
memory consumption compared to our current system, which does not do
that well right now.

> But indeed, now it's clear. Didn't see lib/modules in nixpkgs yet.
> Quite ingenious :)

Thanks, I think I will keep this email around for the bad days :)

> I'll revert my commit.
>
> On Sat, Jul 21, 2012 at 6:11 PM, Shea Levy <shea at shealevy.com> wrote:
>> Nope, it works for both. 'configuration files' are actually a special case of a module (a module that has no options and unconditionally sets other options).
>>
>> On Jul 21, 2012, at 12:05 PM, Mathijs Kwik <mathijs at bluescreen303.nl> wrote:
>>> As I understood, "require" is for including configuration files (that
>>> set options).
>>>
>>> This new option allows adding modules, leading to new options to configure.
>>>
>>> On Sat, Jul 21, 2012 at 6:00 PM, Shea Levy <shea at shealevy.com> wrote:
>>>> How does the 'require' option not suit this need?
>>>>
>>>> On Jul 21, 2012, at 11:38 AM, Mathijs Kwik <mathijs at bluescreen303.nl> wrote:
>>>>> The environment variable "NIXOS_EXTRA_MODULES" is now checked to
>>>>> contain a path to a file similar to modules/module-list.nix.

You might find some examples in my laptops configurations:

https://nixos.org/repos/nix/configurations/trunk/misc/nicolas.b.pierron/

I made a few modules in the common directory which are included in
most of my configurations.  Which was the first reason of NixOS module
system ;)

-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron - http://nbp.name/


More information about the nix-dev mailing list