From Arch forums. Aslo follow this great instructions

Okay, so I’ll walk you through this since there is really not a whole lot of documentation on the subject. This assumes that your NIC is wlan0, your SSID is MyNetwork, and the password is SuperSecretPassphrase.

You need to create a wpa_supplicant-wlan0.conf. So use wpa_passphrase to generate one:

wpa_passphrase MyNetwork SuperSecretPassphrase > /etc/wpa_supplicant/wpa_supplicant-wlan0.conf

Enable it so that it runs on boot:

systemctl enable wpa_supplicant@wlan0.service

Get the IP

Wired and wireless adapters on the same machine

This setup will enable a DHCP IP for both a wired and wireless connection making use of the metric directive to allow the kernel to decide on-the-fly which one to use. This way, no connection downtime is observed when the wired connection is unplugged.

The kernel’s route metric (same as configured with ip) decides which route to use for outgoing packets, in cases when several match. This will be the case when both wireless and wired devices on the system have active connections. To break the tie, the kernel uses the metric. If one of the connections is terminated, the other automatically wins without there being a gap with nothing configured (ongoing transfers may still not deal with this nicely but that is at a different OSI layer).

Note: The Metric option is for static routes while the RouteMetric option is for setups not using static routes. See systemd.network(5) for more details.

/etc/systemd/network/20-wired.network
'''
[Match]
Name=enp1s0

[Network]
DHCP=ipv4

[DHCP]
RouteMetric=10
'''
/etc/systemd/network/25-wireless.network
'''
[Match]
Name=wlp2s0

[Network]
DHCP=ipv4

[DHCP]
RouteMetric=20
'''

Now ensure that systemd-networkd.service is enabled.

systemctl enable systemd-networkd.service

Reboot, and it should be working.

Edit: I forgot to mention that you also need to ensure that /etc/resolv.conf is a symlink to /run/systemd/network/resolv.conf. As a hack (since I don’t use systemd-networkd regularly) I have the following:

cat /etc/systemd/system/systemd-networkd.service.d/resolv.conf
[Service]
ExecStartPost=/usr/bin/ln -sf /run/systemd/network/resolv.conf /etc/resolv.conf
ExecStopPost=/usr/bin/rm /etc/resolv.conf
ExecStopPost=/usr/bin/touch /etc/resolv.conf