Thin-film cavities containing layers of Mössbauer nuclei have been demonstrated to be a rich platform for x-ray quantum optics. At low excitation, these systems can be described by effective few-level schemes, thereby providing tunable artificial quantum systems at hard x-ray energies. With the recent advent of an ab initio theory, a numerically efficient description of these systems is now possible. On this basis, we introduce the inverse design and develop a comprehensive optimization for an archetype system with a single resonant layer, corresponding to an artificial two-level scheme. We discover a number of qualitative insights into x-ray photonic environments for nuclei that will likely impact the design of future x-ray cavities and thereby improve their performance. The presented methods readily generalize beyond the two-level case and thus provide a clear perspective towards the inverse design of more advanced tunable x-ray quantum optical level schemes.