[Nix-dev] Re: [Nix-commits] SVN commit: nix - 15878 - eelco - nixos/branches/modular-nixos/modules/installer/cd-dvd

Nicolas Pierron nicolas.b.pierron at gmail.com
Fri Jun 5 17:33:24 CEST 2009


Hi Eelco,

On Fri, Jun 5, 2009 at 17:10, Eelco Dolstra<e.dolstra at tudelft.nl> wrote:
> Author: eelco
> Date: 2009-06-05 15:10:15 +0000 (Fri, 05 Jun 2009)
> New Revision: 15878
>
> You can view the changes in this commit at:
>   https://svn.nixos.org/viewvc/nix?rev=15878&view=rev
>
> Added:
>   nixos/branches/modular-nixos/modules/installer/cd-dvd/installation-cd.nix
>

You cannot add it in the module directory because you are setting a
lot of options and all modules contained in the "modules" directory
will be imported the next time the gen-module-list script will be
used.

What I suggest you is to:
- create a installer-modules directory inside nixos.
- add a " parent-modules.nix " which only contains:

{
  require = []
  ++ import ../modules/module-list.nix;
}

Then you just have to add an option to select the right module
directory on the command line or add in the main configuration file an
option pointing at ./nixos/modules.  The option point of view can be
the cleaner way even if this introduce a weird " special keyword "
computed before all other options.

# nixos/module-finder.nix

{
  module = mkOption {
    default = ./modules;
    example = ./installer-modules/;
    description = " Define the module directory. ";
  }
}

# /etc/nixos/configuration.nix

{
  module = ./nixos/installer-modules/;

  boot = ...;

  ...
}


Then you can use the following lines to work with the right module directory:

  configComponents = [
    configuration
    ./module-finder.nix
    "(pkgs.lib.fixOptionSets pkgs.lib.mergeOptionSets pkgs
[configuration ./module-finder.nix]).module" + "/module-list.nix"
  ];


-- 
Nicolas Pierron
http://www.linkedin.com/in/nicolasbpierron
Andrew S. Tanenbaum - Never underestimate the bandwith of a wagon full of tapes.



More information about the nix-dev mailing list