|
|
|
|
|
by t0astbread
1107 days ago
|
|
One use case for lazy evaluation in NixOS is that you can reference other parts of the system configuration, possibly even defined in other modules, as long as you don't produce cyclic references. For example, I use stuff like the following often to avoid accidentally specifying a username that does not exist: { config, ... }:
{
systemd.services.foobar = {
enable = true;
serviceConfig.User = config.users.users.foobar.name;
# etc...
};
}
Another use case is being able to keep everything as plain values. For example, I can run `import <nixpkgs> { }` without evaluating all of `nixpkgs`. You can accomplish that in a language with eager evaluation by wrapping values in functions but I prefer the everything-is-a-value way.Of course, this is just a matter of preference. Like most Guix vs. Nix aspects, as far as I can tell. |
|
In Guix System, services extend one another, forming a directed acyclic graph of extensions. When a service extends another service, that connection is explicitly declared, there's no surprise.
To see what it means in practice, check out the Explorer: https://notabug.org/civodul/guix-explorer