Hi,

On 16/06/14 00:57, Mateusz Kowalczyk wrote:

> I just opened [1] and started to implement it, basically making
> pass-through options that user can configure.
> 
> What is the way to test NixOS modules? I don't particularly want to wait
> until ‘updatedb’ is scheduled to run, perhaps I only want to see the
> final command nix produces. 

You don't have to wait until it's scheduled to run, you can just do "systemctl
start update-locatedb" right away.

>I don't particularly want to install
> half-finished and experimental changes onto my system either. With nix
> packages I can nix-build and then play with the results but is there
> anything of the sort for system modules?

You can use nix-build to build individual NixOS services. See here:

  http://nixos.org/nixos/manual#sec-building-parts

> Another question is whether I should be trying to catch obvious mistakes
> and how: say there's on option that takes a username. In order to do
> something sensible, the user has to exist. Should I be checking for this
> and throwing an error when the user doesn't exist on the system or are
> we trusting the user to know it best and to configure it all properly.

More checking is always good.

> If some checks are in order, how do we throw an error? ‘assert’?

NixOS has an "assertions" config option:

  config = {

    assertions = singleton
      { assertion = config.users.extraUsers ? userName;
        message = "User ${userName} must exist.";
      };

-- 
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/
_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to