python 2.7's tk is over-eager in trying to open an x display, so run it in xvfb. xvfb is quite a heavy dependency (albeit only a build-time one), so ensure this is only used when needed.
fallout of https://github.com/NixOS/nixpkgs/pull/54182