[Nix-dev] NixOS require attribute

Sander van der Burg - EWI S.vanderBurg at tudelft.nl
Mon May 9 12:19:46 CEST 2011


It seems that it is only possible to specify files in the require attribute of a Nix module, e.g.:

{pkgs, ...}:

{
  require = [ /some/nixos/module/file.nix ]; # Works fine

  services.openssh.enable = true;
}

But it seems that it is impossible to specify functions or attribute sets, e.g.:

{pkgs, ...}:

{
  require = [ { services.httpd.enable = true; } ]; # Triggers an error

  services.openssh.enable = true;
}

I'm curious whether it is possible to also require functions or attribute sets. The reason I'm asking this is, that I'm working on a function that generates a network of NixOS configurations running web applications. In some cases you may want to run a database server and web server on a single machine, in other cases you may want to run a database and web server on separate machines. 

I think using the require attribute is the best way to combine certain properties into a single NixOS configuration.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20110509/96b70a72/attachment.html 


More information about the nix-dev mailing list