One of the most advertised features of NixOS is the simplicity of building
VMs.
Just build a VM with your new modules and test it.
`nixos-rebuild` has a bunch of cool options, including `nixos-rebuild
build` (in case you just want to check you got all the files and symlinks
right).


Assertions, yes you might use them. Just `grep` `nixos/modules` for
`assert`, and you'll get both `assert` and `assertions` with examples.
But I think having as little assertions as possible is a good idea.
If we are talking about users, it might be better to just ensure the user's
existence, e.g. see `services/web-servers/nginx/default.nix`.


--
Кирилл Елагин


On Mon, Jun 16, 2014 at 8:57 AM, Mateusz Kowalczyk <fuuze...@fuuzetsu.co.uk>
wrote:

> Greetings,
>
> 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. 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?
>
> 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.
> If some checks are in order, how do we throw an error? ‘assert’?
>
> [1]: https://github.com/NixOS/nixpkgs/issues/2961
> --
> Mateusz K.
> _______________________________________________
> nix-dev mailing list
> nix-dev@lists.science.uu.nl
> http://lists.science.uu.nl/mailman/listinfo/nix-dev
>
_______________________________________________
nix-dev mailing list
nix-dev@lists.science.uu.nl
http://lists.science.uu.nl/mailman/listinfo/nix-dev

Reply via email to