The thermal conductivity of disordered silicon-germanium alloys is computed from density-functional perturbation theory and with relaxation times that include both harmonic and anharmonic scattering terms. We show that this approach yields an excellent agreement at all compositions with experimental results and provides clear design rules for the engineering of nanostructured thermoelectrics. For Si(x)Ge(1-x), more than 50% of the heat is carried at room temperature by phonons of mean free path greater than 1 mu m, and an addition of as little as 12% Ge is sufficient to reduce the thermal conductivity to the minimum value achievable through alloying. Intriguingly, mass disorder is found to increase the anharmonic scattering of phonons through a modification of their vibration eigenmodes, resulting in an increase of 15% in thermal resistivity.