"guix system: warning: service 'lightdm' could not be found" when trying to switch to lightdm

I want to use lightdm instead of gdm,
since it’s the default display manager for the Xfce DE.

But I get this warning:

$ sudo guix system reconfigure /etc/config.scm
...
guix system: warning: service 'lightdm' could not be found
guix system: warning: some services could not be upgraded

/etc/config.scm

(use-modules (gnu)
             ...
)
(use-service-modules ...
                     desktop
                     lightdm
                     ...
                     xorg)
...
(services 
 (append ( list
  ...
  (service lightdm-service-type)
  ...
 )
 (modify-services %desktop-services)
(delete gdm-service-type))))
...

Am I forgetting something?

Maybe you missed a use-modules?

How can I tell which modules are needed?

https://toys.whereis.social/ is a good resource for looking up a service and it’s respective module.

I would search the code and see, where lightdm is defined.
see:

Try something like:

(use-modules (gnu)
...
             (gnu packages display-managers)
...
)

I can’t test as I can’t currently access my guix test vm.

I tried it and it’s not working for me.
I’m still getting the warning.

%desktop-services in gnu/services/desktop.scm can do some funny things when customizing the X11 display manager that ends up re-adding GDM.

If you haven’t already, it’s probably worth checking that the operating-system doesn’t have GDM after being defined/evaluated. This can be done in repl or in other ways.

idk whether it’s still an issue, but i needed to explicitly remove it like this

(define %base-desktop-services
  (remove (lambda (service)
            (memq (service-kind service)
                  (list gdm-service-type sddm-service-type)))
          %desktop-services))