Pure nix mustache implementation


There have been previous discussions and approaches on this topic (1, 2, 3, 4) . The recommended approach was to use built-in Nix interpolation or an external executable like go-mustache. Both methods have pros and cons, but I believe a pure Nix templating library would be the preferred solution in many cases.

So, I’ve implemented Mustache templating in Nix. It adheres to all core Mustache specifications and includes lambdas from the optional part. This is my first non-trivial program in Nix, so I’m interested in any feedback.

Specific question: The Mustache spec includes a case involving state/multiple calls. Do I correctly assume that such a thing is impossible in Nix, or is there a way to implement it?



I think, is to make sure any impure external library (ie access database), has most recent version of data. Not sure if it apply to your version.