[Nix-dev] Resolution context of `require' paths

Nicolas Pierron nicolas.b.pierron at gmail.com
Tue Jun 30 11:40:03 CEST 2009


> - Pass the full set of modules to configuration.nix (and other modules of
> course) where they can be selected *by attribute name* rather than filename:
>
>  {config, pkgs, modules, ...}:
>
>  {
>     require = [modules.intel4965agn];
>  }
>
>  where "modules" is defined somewhere in the NixOS tree:
>
>  modules =
>    { intel4965agn = ./hardware/network/intel-4965agn.nix;
>      sshd = ./services/networking/sshd.nix;
>      ...
>    };
>
>  This allows a bit more abstraction than hardcoded filenames, because you can
> now refactor the module structure.  For instance, if you ever combine all those
> Intel modules into one:
>
>  modules =
>    { intel4965agn = ./hardware/network/intel.nix;
>      intel3965abg = ./hardware/network/intel.nix;
>      ...
>    };

This one is nice but I would prefer "nixosModules" because you can
expect to have other module store in the future, and then being able
to give other sources.  Or keep the "modules" name but find a way to
fill it with other module stores.


-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron
Albert Einstein - Never memorize what you can look up on books.



More information about the nix-dev mailing list