The Raspberry Pi family who have wireless capabilities can all serve as wifi Access Points - meaning some other devices connect to it, perhaps accessing internet through it. We'll leave the "forward internet" part for another time, and concentrate on serving wifi connections as a hotspot.
If what you need is a "rescue" Access Point to be able to log back into the
machine, you might rather check my other article on RPi basics,
where you will see how to let wpa_supplicant fall back to being an Access
Point if it can't connect to any.
And for now let's use hostapd, a package to implement and advertise a wifi
access point. It might be a better option for production use since it's a
dedicated tool, whereas wpa_supplicant is a bit out of its league here.
hostapd needs the interface to be up and configured with an IP. So we'll
configure systemd-networkd to do that, and by the way propose an IP address to
clients that get connected to our AP. Change
/etc/systemd/network/05-wlan.network so that it reads :
[Network]
true
true
true
[DHCPServer]
100
20
true
Now hostapd won't work (at least in this configuration) if you have
wpa_supplicant installed. Go on and
# pacman -Rs wpa_supplicant
And last, you will need to tweak /etc/hostapd/hostapd.conf. This one was taken
from Archwiki's, and curated for RPi zero W :
wlan0
FR
zero
YOUR_PASSWORD_HERE
b
5
5
2
1
CCMP
WPA-PSK
-1
2
[HT20][TX-STBC1][DSSS_CCK-40]
If you use a Realtek-based wifi adapter, there is a specific hostapd package for hosts using rtl871 hardware. You will have to install it from the AUR ; you will have to
$ yay -S hostapd-rtl871xrdv
And modify /etc/hostapd/hostapd.conf to mention driver=rtl871xdrv.