[Nix-dev] NixOS module system obscurities

Sander van der Burg - EWI S.vanderBurg at tudelft.nl
Wed Apr 27 16:02:21 CEST 2011


I'm trying to implement some new features to nixos-deploy-network, but I stumbled upon some obscurities in the NixOS module system. that I don't completely understand. Apparently, if I run the eval-config function with some modules which aren't files, they won't get evaluated, unless a key attribute is given:

For example, if I try this:

import /etc/nixos/nixos/lib/eval-config.nix {
  ...
  modules = [ /etc/nixos/configuration.nix
   { foo = "bar"; } # Does not get evaluated
}

The latter attribute set (which should trigger an error), isn't evaluated. If I add a key to it:

import /etc/nixos/nixos/lib/eval-config.nix {
  ...
  modules = [ /etc/nixos/configuration.nix
   { foo = "bar"; # Now it gets evaluated!
     key = "some-key"; # Because a key is given
   } 
}

It will get evaluated!

What I want is to avoid specifying the usage of these key attributes. The reason why I want this is because I want to adapt nixos-deploy-network to accept multiple network expressions that are zipped together. Because of the key requirement, the second NixOS network expression won't get evaluated (unless I manually specify key attributes, which isn't very nice).

Anyone an idea/suggestion how to deal with this issue?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20110427/277fd5a4/attachment.html 


More information about the nix-dev mailing list