server.py tries to launch a matrix_sso_helper binary when connecting to
a homeserver that uses some SSO mechanism instead of plain login and
password, but doesn't have $out/bin in $PATH.
Using substituteInPlace to patch server.py so that the helper process is
started by using its actual filesystem location instead of relying on
$PATH.
Fixes: https://github.com/NixOS/nixpkgs/issues/124186
matrix.py tries to import its dependencies, and its own code from
$out/${python.sitePackages}, and neither of these worked because
nothing was telling Python where to load that stuff from.
Using patchPythonScript made it so matrix.py could find its
dependencies, but it still wasn't able to find its own code, so that
had to be added to program_PYTHONPATH beforehand so patchPythonScript
would include it as well.
Fixes: https://github.com/NixOS/nixpkgs/issues/89499