By using testProjectFile, we can properly build the test and run it in checkPhase, as well as not include the test in the derivation output. This also happens to fix the startup crash as described in #345038.
stdenv.is
stdenv.hostPlatform.is