I use iwd to manage the wireless interfaces, which is very easy to use. It is enabled via systemctl enable iwd.
iwctl station wlan0 connect <network-ssid>
I use dhcpcd as a DHCP client, which means iwd’s internal client has to be disabled. This is because I tried using iwd's internal client but was repeatedly having issues with it failing to obtain addresses (see below).
[General]
EnableNetworkConfiguration=false
I disable writing to /etc/resolv.conf in the dhcpcd configuration because that wreaks havoc with my mullvad setup (it interferes with systemd-resolved). I do that by adding:
nohook resolv.conf
To the bottom of /etc/dhcpcd.conf.
I use systemd-resolved to manage DNS servers. This requires iwd to know about the resolver, as well as some symlinks.
systemd-resolved must be enabled as a service (systemctl enable systemd-resolved)
iwd must be configured to use it:
[Network]
NameResolvingService=systemd
You must symlink resolvconf configuration appropriately: sudo ln -nsf /run/systemd/resolve/stub-resolv.conf /etc/resolv.conf
If necessary, (re)start the services in order (systemd-resolved and iwd)