How to use home-manager.xsession with GNOME, KDE, or Cinnamon's default WMs?

For many graphical-session configurations with Home Manager, xsession.enable = true; is needed, which depends on the configuration xsession.windowManager.command

The out-of-the-box options that provides xsession.windowManager.command are xsession.windowManager.awsome, .bspwm, .i3, and .xmonad (, which are all tiled). To use other windows manager, such as those comes with the desktop environments, users have to set xsession.windowManager.command themselves.

I have tried many ways to enable kwin or mutter from the config, but end up looping in the display manager.

What is the proper way to handle a graphical session of GNOME, KDE, Cinnamon, XFCE, … from Home Manager?

I just realized that the Cinnamon session is started by the cinnamon-session command provided by pkgs.cinnamon.cinnamon-session. So, the corresponding configuration is

xsession.windowManager.command = ''

Here’s a generalized version of the above answer: