I also have my sway configured entirely in home-manager standalone. I wanted something similar.
tldr: I don’t use a display manager (gdm) anymore I just login on the command line and run sway.
So when sway is enabled in your configuration.nix, it adds sway as a “sessionPackage” for the display manager ref. This in-turn make the session information visible to the display manager in a way it expects ref.
The big thing here is that this is all “system level” config, most if not all display managers look for info about installed desktop environments in system path. While your sway config will be in the nix store as well as your home dir after you do
home-manager switch, the desktop environment does not look any of those location automatically. And from my understanding there is no reliable way for your configuration.nix to refer to any derivations in you home-manager config because they can update independently.
What would be needed is a display manager that can scan a safely scan a user’s dir for installed desktop environment configurations and show those as options, I think I heard something about maybe being able to us greetd for something like that, but I have not figured it out.
For sddm there is pretty stale issue related to this https://github.com/sddm/sddm/issues/916, and last I checked gdm does not have any functionality like that either (that might have changed, I could not tell from a quick look at the repo)
But if this would work one day this is the way I see it working. When you run
home-manager switch some config about what is your default desktop environment/available desktop environments would get dumped in your home dir (maybe somewhere in
~/.local or something), then your display manager would scan each users dir for such config and use that info for displaying options and as instructions on how to launch the desktop environment. I think there are some security concerns with the display manager scanning things in user’s dirs.
So yeah from what I understand gdm does not do something like that, that could have changed, but I don’t personally know how to make it work.