In reply to @djacu:matrix.org
olaf: You might be interested in what I was proposing for the module tutorials update. It's probably not as comprehensive as what you have in mind but might be suitable for smaller tests that don't need the infrastructure of a full nixos-test.
For my workshop, I created lessons where the code was separate from the markdown and inserted at build time of the site. Each example was evaluated/built and the result was also injected into the markdown. Essentially creating a system where the site would not build if the examples failed to evaluate. I didn't do any checking to make sure the answer was correct but that could be added.
The way I did this was pretty hacky and sometimes cursed (and definitely not the way we should do it on nix.dev) but it's what I had to do given my time constraints. With more time I would have needed to run Nix inside of Nix or come up with some other solution.
I feel this might lead to the problem that it is difficult to write the tutorial if you don't see directly what the reader will be able to see. mdbook supports including lines from rs files into the documentation files. but this can become very easily mangled. but i also see the benefits to separate the two. i need to look into literal programming more, to see what caveats have been solved in which way.