[Nix-dev] Re: NixOS: New scheme

Ludovic Courtès ludo at gnu.org
Wed Jan 7 15:00:56 CET 2009


Hi,

"Nicolas Pierron"
<nicolas.b.pierron at gmail.com> writes:

> I have started to write a bit of manual for NixOS (fix-style branch)
>
> Extending NixOS:
> http://nicolas.b.pierron.free.fr/nixos/manual.html#id2476872

I looked into it again and I find the `mkIf' thing non obvious:

  This line is used to declare a special IF statement. If you had put a
  usual IF statement here, with the same condition, then you will get an
  infinite loop. The reason is that your condition ask for the value of
  the option config.services.locate.enable but in order to get this
  value you have to evaluate all configuration sets including the
  configuration set contained inside your file.

  To remove this extra complexity, mkIf has been introduced to get rid
  of possible infinite loop and to factor your writing.

Given the description, I'd have called it `delayedIf', but OTOH, in a
lazily-evaluated language, everything is "delayed".  I expect the need
for special conditional constructs would make it harder to write Upstart
jobs.

Thanks,
Ludo'.




More information about the nix-dev mailing list