Einstein predicted that clocks at different altitudes tick at various rates under the influence of gravity. This effect has been observed using 57 Fe Mössbauer spectroscopy over an elevation of 22.5m (ref. 1) or by comparing accurate optical clocks at different heights on a submetre scale. However, challenges remain in finding novel methods for the detection of gravitational and relativistic effects on more compact scales. Here, we investigate a scheme that potentially allows for millimetre- to submillimetre-scale studies of the gravitational redshift by probing a nuclear crystal with X-rays. Also, a rotating crystal can force interacting X-rays to experience inhomogeneous clock tick rates within it. We find that an association of gravitational redshift and special-relativistic time dilation with quantum interference is manifested by a time-dependent deflection of X-rays. The scheme suggests a table-top solution for probing gravitational and special-relativistic effects, which should be within the reach of current experimental technology.