Reduce the incidental complexity of the system tests by cleanly separating the Nix and Python parts of their definition
The system tests are currently defined using NixOS's system testing harness. This involves some Nix to invoke the harness APIs and some Python to define the actual tests. The Python currently lives in a string inside the Nix source.
The result of this is additional unnecessary complexity in the form of:
- extra quoting to make the Python source code correct in the context of a Nix string literal
- action-at-a-distance via Nix string interpolation into the Python string to supply certain needed values
- lack of developer conveniences such as syntax coloring for the Python code, availability of linting tools, etc
Beyond this, there's some legacy complexity from when the system tests were written in Perl instead of Python. This is in the form of Nix functions that are used to generate code strings to interpolate into the Python string - rather than a simpler approach of defining Python functions.
A simple refactoring to put the Python source code in its own source files and integrate it into the system tests without surprising string formatting tricks will make this code more flexible and more easily maintainable.