A Cahn-Hilliard Approach to Thermodiffusion in Porous Media