The ability to nondestructively detect the presence of a single, traveling photon has been a long-standing goal in optics, with applications in quantum information and measurement. Realizing such a detector is complicated by the fact that photon-photon interactions are typically very weak. At microwave frequencies, very strong effective photon-photon interactions in a waveguide have recently been demonstrated. Here we show how this type of interaction can be used to realize a quantum nondemolition measurement of a single propagating microwave photon. The scheme we propose uses a chain of solid-state three-level systems (transmons) cascaded through circulators which suppress photon backscattering. Our theoretical analysis shows that microwave-photon detection with fidelity around 90% can be realized with existing technologies.