  Two fundamental quantum resources, nonlocality and contextuality, can be
connected through Bell inequalities that are violated by state-independent
contextuality (SI-C) sets. These Bell inequalities allow for applications that
require simultaneous nonlocality and contextuality. However, for existing Bell
inequalities, the nonlocality produced by SI-C sets is very sensitive to noise.
This precludes experimental implementation. Here we identify the Bell
inequalities for which the nonlocality produced by SI-C sets is optimal, i.e.,
maximally robust to either noise or detection inefficiency, for the simplest
SI-C [S. Yu and C. H. Oh, Phys. Rev. Lett. 108, 030402 (2012)] and
Kochen-Specker sets [A. Cabello et al., Phys. Lett. A 212, 183 (1996)] and show
that, in both cases, nonlocality is sufficiently resistant for experiments. Our
work enables experiments that combine nonlocality and contextuality and
therefore paves the way for applications that take advantage of their synergy.
