You can do that via *System Settings* > *Keyboard* (or `gnome-control-center keyboard` in terminal): go to *Typing* and set *Modifiers-only switch to next source* to _Caps Lock_

[![enter image description here][1]][1]

Alternatively, set the corresponding `xkb` option (which is what the above does underneath) via `gsettings` or `dconf`: navigate to *org* > *gnome* > *desktop* > *input-sources* and add `grp:caps_toggle` to your *xkb-options*:

[![enter image description here][2]][2]

Note each option is enclosed in single quotes, options are separated by comma+space.

 [1]: https://i.sstatic.net/8aQuN.png
 [2]: https://i.sstatic.net/VPXaG.png