$ cat /lib/systemd/system/systemd-networkd-resolvconf-update.service
[Unit]
Description=Update resolvconf for networkd DNS
ConditionPathIsSymbolicLink=/etc/resolv.conf
ConditionPathExists=/run/resolvconf/enable-updates
After=resolvconf.service
[Service]
Type=oneshot
StartLimitBurst=20
# we might be triggered several times in short succession during restarting networkd, so wait until we get a DNS entry
ExecStart=/bin/sh -c 'for timeout in `seq 30`; do out=$(sed -n "/^DNS=/ { s/^DNS=/nameserver /; p}" /run/systemd/netif/state /run/systemd/netif/leases/* | sort -u /run/systemd/netif/leases/* | sort -u); [ -z "$out" ] || break; sleep 1; done; echo "$out" | /sbin/resolvconf -a networkd'