@jarkko Declaration order does not matter (e.g. order of bindings in a let
expression or attrset (object)), but functional languages can express both declarative and non-declarative solutions.
Strikingly a function has a before (argument) and an after (return value).
It matters a lot how it's used. lib.fix
makes the argument and return value the same value.
Declarative systems built with the Nix language tend to use fixpoints created with such helpers, including evalModules
aka the Module System.
@jarkko Got it. You've configured an undeclarative thing with a functional/declarative tool. We do that a lot with Nix.
The fixed points thing is interesting if you're into theory or digging into libraries, but it's perfectly fine to know that there's a connection, and just use the existing tooling without deep thoughts about the related math. Basically it lets us name one or two abstract things, but a lot of fixed point usage in math isn't all that relevant to what we do with it.
@jarkko yeah, nixosSystem is evalModules underneath. Flake.nix also has recursive let bindings, the way it's evaluated internally by Nix. Not factored out to have a fix
call, but broadly the same kind of recursion. outputs
is called with its return value plus extras in the self
argument.