We present a platform for the simulation of quantum magnetism with full control of interactions between pairs of spins at arbitrary distances in 1D and 2D lattices. In our scheme, two internal atomic states represent a pseudospin for atoms trapped within a photonic crystal waveguide (PCW). With the atomic transition frequency aligned inside a band gap of the PCW, virtual photons mediate coherent spin-spin interactions between lattice sites. To obtain full control of interaction coefficients at arbitrary atom-atom separations, ground-state energy shifts are introduced as a function of distance across the PCW. In conjunction with auxiliary pump fields, spin-exchange versus atom-atom separation can be engineered with arbitrary magnitude and phase, and arranged to introduce nontrivial Berry phases in the spin lattice, thus opening new avenues for realizing topological spin models. We illustrate the broad applicability of our scheme by explicit construction for several wellknown spin models.nanophotonics | quantum matter | cold atoms | quantum many-body | quantum spin Q uantum simulation has become an important theme for research in contemporary physics (1). A quantum simulator consists of quantum particles (e.g., neutral atoms) that interact by way of a variety of processes, such as atomic collisions. Such processes typically lead to short-range, nearest-neighbor interactions (2-6). Alternative approaches for quantum simulation use dipolar quantum gases (7,8), polar molecules (9-11), and Rydberg atoms (12-15), leading to interactions that typically scale as 1=r 3 , where r is the interparticle separation. For trapped ion quantum simulators (16)(17)(18)(19)(20), tunability in a power law scaling of r −η with 0 < η < 3 can in principle be achieved. Beyond simple power law scaling, it is also possible to engineer arbitrary long-range interactions mediated by the collective phonon modes, which can be achieved by independent Raman addressing on individual ions (21).Using photons to mediate controllable long-range interactions between isolated quantum systems presents yet another approach for assembling quantum simulators (22). Recent successful approaches include coupling ultracold atoms to a driven photonic mode in a conventional mirror cavity, thereby creating quantum many-body models (using atomic external degrees of freedom) with cavity-field-mediated infinite-range interactions (23). Finite-range and spatially disordered interactions can be realized by using multimode cavities (24). Recent demonstrations on coupling cold atoms to guided mode photons in photonic crystal waveguides (25, 26) and cavities (27, 28) present promising avenues (using atomic internal degrees of freedom) due to unprecedented strong single atom-photon coupling rate and scalability. Related efforts also exists for coupling solid-state quantum emitters, such as quantum dots (29, 30) and diamond nitrogen-vacancy centers (31, 32), to photonic crystals. Scaling to a many-body quantum simulator based on solid-state systems, however, still remains el...