Home-manager and xsession with gdm

I’m trying to set up home-manager “cleanly” on a new NixOS setup and am a little stumped. When i set

xsession.enable = true;
xsession.windowManager.command = "emacs";

Then home-manager generates an ~/.xsession file. But to actually use this from gdm, which I’m using, I need a custom session file for that as well, don’t I? I tried stitching one together using xserver.windowManager.session = [ ... ] (in /etc/nixos/configuration.nix, mind you) but that isn’t recognized by gdm, apparently.

What’s the most “idiomatic” way to connect home-manager and NixOS with a custom X session, then?