An alternative is to have something like
services.xserver.desktopManager.session = [
{
name = "home-manager";
start = ''
${pkgs.runtimeShell} $HOME/.hm-xsession &
waitPID=$!
'';
}
];
in your system configuration and
xsession.scriptPath = ".hm-xsession";
in your HM configuration.